All of lore.kernel.org
 help / color / mirror / Atom feed
* how to use spi flash BIOS/Host firmware??
@ 2019-09-10 13:03 www
  2019-09-10 21:46 ` Milton Miller II
  0 siblings, 1 reply; 6+ messages in thread
From: www @ 2019-09-10 13:03 UTC (permalink / raw)
  To: openbmc

[-- Attachment #1: Type: text/plain, Size: 365 bytes --]

Dear all,


    I want to ask a question about how to spi driver flash host/bios firmware? I don't want use mtd mode flash it, because the mtd mode need read spi-id when BMC load spi driver, may be it is risky, it need switch the  system spi to BMC when the host running, It may break host startup. Do we have other solutions to solve this problem?


thanks,
Byron 

[-- Attachment #2: Type: text/html, Size: 590 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re:how to use spi flash BIOS/Host firmware??
  2019-09-10 13:03 how to use spi flash BIOS/Host firmware?? www
@ 2019-09-10 21:46 ` Milton Miller II
  2019-09-10 23:56   ` how " Andrew Jeffery
  0 siblings, 1 reply; 6+ messages in thread
From: Milton Miller II @ 2019-09-10 21:46 UTC (permalink / raw)
  To: www; +Cc: openbmc

On September 10, 2019, Byron <ouyangxuan10@163.com> wrote:

>Dear all,
>
>    I want to ask a question about how to spi driver flash host/bios
>firmware? I don't want use mtd mode flash it, because the mtd mode
>need read spi-id when BMC load spi driver, may be it is risky, it
>need switch the  system spi to BMC when the host running, It may
>break host startup. Do we have other solutions to solve this problem?
>

Indeed, we did have some initial hand-off issues especially as the 
Linux kernel spi nor layer matured.  Over time the assumptions that 
the bios had that the chip would be set to 4-byte addressing by 
default were not met by the kernel driver which switched to using 
4-byte specific read and write commands.

You probably have a few options:

If you host is read-only, you can allocate a block of dram 
and point the lpc window to the dram.  The aspeed lpc 
controller drivers has ioctl calls for this.

If you host is directly connected to the chip and you are 
using the spi mode mux, then you would need to handshake 
with your bios.

If your host is using lpc to the aspeed chip and programming 
the controller directly, you probably have given full overtake 
of your bmc to the host.

In Openpower systems, we have implemented a protocol to map 
sections of the SPI rom into memory, and use IPMI messages 
to page in and out windows from this access window in memory 
to the backing SPI chip. We also have a method.

If you are not using an aspeed bmc soc, some of these details
may be different in your system.

>thanks,
>Byron 
>

I hope this can give you some thoughts to pursue.
milton

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: how to use spi flash BIOS/Host firmware??
  2019-09-10 21:46 ` Milton Miller II
@ 2019-09-10 23:56   ` Andrew Jeffery
  2019-09-11 15:28     ` Oskar Senft
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Jeffery @ 2019-09-10 23:56 UTC (permalink / raw)
  To: Milton Miller II, www; +Cc: openbmc



On Wed, 11 Sep 2019, at 07:16, Milton Miller II wrote:
> On September 10, 2019, Byron <ouyangxuan10@163.com> wrote:
> 
> >Dear all,
> >
> >    I want to ask a question about how to spi driver flash host/bios
> >firmware? I don't want use mtd mode flash it, because the mtd mode
> >need read spi-id when BMC load spi driver, may be it is risky, it
> >need switch the  system spi to BMC when the host running, It may
> >break host startup. Do we have other solutions to solve this problem?
> >
> 
> Indeed, we did have some initial hand-off issues especially as the 
> Linux kernel spi nor layer matured.  Over time the assumptions that 
> the bios had that the chip would be set to 4-byte addressing by 
> default were not met by the kernel driver which switched to using 
> 4-byte specific read and write commands.
> 
> You probably have a few options:
> 
> If you host is read-only, you can allocate a block of dram 
> and point the lpc window to the dram.  The aspeed lpc 
> controller drivers has ioctl calls for this.
> 
> If you host is directly connected to the chip and you are 
> using the spi mode mux, then you would need to handshake 
> with your bios.
> 
> If your host is using lpc to the aspeed chip and programming 
> the controller directly, you probably have given full overtake 
> of your bmc to the host.

This is the case for ASPEED BMCs, so be conscious of threat models.

> 
> In Openpower systems, we have implemented a protocol to map 
> sections of the SPI rom into memory, and use IPMI messages 
> to page in and out windows from this access window in memory 
> to the backing SPI chip. We also have a method.

That sentence looks incomplete :)

Anyway, yes, in OpenPOWER platform designs the BMC owns the flash
and we provide an abstract means for the host to access flash data such
that the BMC always remains in control. If you have questions on what
we've done there, don't hesitate to ask me.

Any other mechanisms will require an explicit handshake as Milton
mentions and there may be some corner cases in the event of ungraceful
shutdowns of the host.

Andrew

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: how to use spi flash BIOS/Host firmware??
  2019-09-10 23:56   ` how " Andrew Jeffery
@ 2019-09-11 15:28     ` Oskar Senft
       [not found]       ` <cff298c.8724.16d3961f88b.Coremail.ouyangxuan10@163.com>
  0 siblings, 1 reply; 6+ messages in thread
From: Oskar Senft @ 2019-09-11 15:28 UTC (permalink / raw)
  To: Andrew Jeffery, Milton Miller II, www; +Cc: OpenBMC Maillist

[-- Attachment #1: Type: text/plain, Size: 2619 bytes --]

One option I heard of (unverified by me) is to use user-space-only
implementation (e.g. flashrom) on the BMC to dynamically access the host's
SPI "when it is safe to do so", without requiring a kernel driver on the
BMC.

The tricky part is "when it is safe to do so", but you could define certain
points in time, e.g. when the host is powered off or in reset.

Oskar.

On Tue, Sep 10, 2019 at 7:56 PM Andrew Jeffery <andrew@aj.id.au> wrote:

>
>
> On Wed, 11 Sep 2019, at 07:16, Milton Miller II wrote:
> > On September 10, 2019, Byron <ouyangxuan10@163.com> wrote:
> >
> > >Dear all,
> > >
> > >    I want to ask a question about how to spi driver flash host/bios
> > >firmware? I don't want use mtd mode flash it, because the mtd mode
> > >need read spi-id when BMC load spi driver, may be it is risky, it
> > >need switch the  system spi to BMC when the host running, It may
> > >break host startup. Do we have other solutions to solve this problem?
> > >
> >
> > Indeed, we did have some initial hand-off issues especially as the
> > Linux kernel spi nor layer matured.  Over time the assumptions that
> > the bios had that the chip would be set to 4-byte addressing by
> > default were not met by the kernel driver which switched to using
> > 4-byte specific read and write commands.
> >
> > You probably have a few options:
> >
> > If you host is read-only, you can allocate a block of dram
> > and point the lpc window to the dram.  The aspeed lpc
> > controller drivers has ioctl calls for this.
> >
> > If you host is directly connected to the chip and you are
> > using the spi mode mux, then you would need to handshake
> > with your bios.
> >
> > If your host is using lpc to the aspeed chip and programming
> > the controller directly, you probably have given full overtake
> > of your bmc to the host.
>
> This is the case for ASPEED BMCs, so be conscious of threat models.
>
> >
> > In Openpower systems, we have implemented a protocol to map
> > sections of the SPI rom into memory, and use IPMI messages
> > to page in and out windows from this access window in memory
> > to the backing SPI chip. We also have a method.
>
> That sentence looks incomplete :)
>
> Anyway, yes, in OpenPOWER platform designs the BMC owns the flash
> and we provide an abstract means for the host to access flash data such
> that the BMC always remains in control. If you have questions on what
> we've done there, don't hesitate to ask me.
>
> Any other mechanisms will require an explicit handshake as Milton
> mentions and there may be some corner cases in the event of ungraceful
> shutdowns of the host.
>
> Andrew
>

[-- Attachment #2: Type: text/html, Size: 3365 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Re: how to use spi flash BIOS/Host firmware??
       [not found]       ` <cff298c.8724.16d3961f88b.Coremail.ouyangxuan10@163.com>
@ 2019-09-16 14:58         ` Oskar Senft
  2019-09-18  1:05           ` www
  0 siblings, 1 reply; 6+ messages in thread
From: Oskar Senft @ 2019-09-16 14:58 UTC (permalink / raw)
  To: www; +Cc: OpenBMC Maillist

[-- Attachment #1: Type: text/plain, Size: 3634 bytes --]

Hi Byron

I have not verified that or how exactly this would work.

The idea I heard floating around was to NOT use a kernel driver, but
instead use a user-space tool like flashrom to access the BIOS SPI flash
from the BMC.

If you (or someone else) does go down this route, it would be great if it
was reported back here.

Oskar.

On Mon, Sep 16, 2019 at 5:23 AM www <ouyangxuan10@163.com> wrote:

> Dear Oskar,
>
> In current BMC kernel, if I add a bios flash partition on dts, it need get
> bios flash chip ip when loading spi driver, It may have a bad effect on
> BIOS startup.
> Could you explain in detail how this safe flash method is implemented? how
> can I modify it on bmc kernel(I guess need modify kernel) and user space?
>
> thanks,
> Byron
>
>
>
> At 2019-09-11 23:28:27, "Oskar Senft" <osk@google.com> wrote:
>
> One option I heard of (unverified by me) is to use user-space-only
> implementation (e.g. flashrom) on the BMC to dynamically access the host's
> SPI "when it is safe to do so", without requiring a kernel driver on the
> BMC.
>
> The tricky part is "when it is safe to do so", but you could define
> certain points in time, e.g. when the host is powered off or in reset.
>
> Oskar.
>
> On Tue, Sep 10, 2019 at 7:56 PM Andrew Jeffery <andrew@aj.id.au> wrote:
>
>>
>>
>> On Wed, 11 Sep 2019, at 07:16, Milton Miller II wrote:
>> > On September 10, 2019, Byron <ouyangxuan10@163.com> wrote:
>> >
>> > >Dear all,
>> > >
>> > >    I want to ask a question about how to spi driver flash host/bios
>> > >firmware? I don't want use mtd mode flash it, because the mtd mode
>> > >need read spi-id when BMC load spi driver, may be it is risky, it
>> > >need switch the  system spi to BMC when the host running, It may
>> > >break host startup. Do we have other solutions to solve this problem?
>> > >
>> >
>> > Indeed, we did have some initial hand-off issues especially as the
>> > Linux kernel spi nor layer matured.  Over time the assumptions that
>> > the bios had that the chip would be set to 4-byte addressing by
>> > default were not met by the kernel driver which switched to using
>> > 4-byte specific read and write commands.
>> >
>> > You probably have a few options:
>> >
>> > If you host is read-only, you can allocate a block of dram
>> > and point the lpc window to the dram.  The aspeed lpc
>> > controller drivers has ioctl calls for this.
>> >
>> > If you host is directly connected to the chip and you are
>> > using the spi mode mux, then you would need to handshake
>> > with your bios.
>> >
>> > If your host is using lpc to the aspeed chip and programming
>> > the controller directly, you probably have given full overtake
>> > of your bmc to the host.
>>
>> This is the case for ASPEED BMCs, so be conscious of threat models.
>>
>> >
>> > In Openpower systems, we have implemented a protocol to map
>> > sections of the SPI rom into memory, and use IPMI messages
>> > to page in and out windows from this access window in memory
>> > to the backing SPI chip. We also have a method.
>>
>> That sentence looks incomplete :)
>>
>> Anyway, yes, in OpenPOWER platform designs the BMC owns the flash
>> and we provide an abstract means for the host to access flash data such
>> that the BMC always remains in control. If you have questions on what
>> we've done there, don't hesitate to ask me.
>>
>> Any other mechanisms will require an explicit handshake as Milton
>> mentions and there may be some corner cases in the event of ungraceful
>> shutdowns of the host.
>>
>> Andrew
>>
>
>
>
>

[-- Attachment #2: Type: text/html, Size: 5548 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re:Re: Re: how to use spi flash BIOS/Host firmware??
  2019-09-16 14:58         ` Oskar Senft
@ 2019-09-18  1:05           ` www
  0 siblings, 0 replies; 6+ messages in thread
From: www @ 2019-09-18  1:05 UTC (permalink / raw)
  To: Oskar Senft; +Cc: OpenBMC Maillist

[-- Attachment #1: Type: text/plain, Size: 3460 bytes --]

Dear Oskar,


thank you very much.


Thanks,
Byron






At 2019-09-16 22:58:33, "Oskar Senft" <osk@google.com> wrote:

Hi Byron


I have not verified that or how exactly this would work.


The idea I heard floating around was to NOT use a kernel driver, but instead use a user-space tool like flashrom to access the BIOS SPI flash from the BMC.


If you (or someone else) does go down this route, it would be great if it was reported back here.


Oskar.


On Mon, Sep 16, 2019 at 5:23 AM www <ouyangxuan10@163.com> wrote:

Dear Oskar,


In current BMC kernel, if I add a bios flash partition on dts, it need get bios flash chip ip when loading spi driver, It may have a bad effect on BIOS startup.
Could you explain in detail how this safe flash method is implemented? how can I modify it on bmc kernel(I guess need modify kernel) and user space? 


thanks,
Byron




At 2019-09-11 23:28:27, "Oskar Senft" <osk@google.com> wrote:

One option I heard of (unverified by me) is to use user-space-only implementation (e.g. flashrom) on the BMC to dynamically access the host's SPI "when it is safe to do so", without requiring a kernel driver on the BMC.


The tricky part is "when it is safe to do so", but you could define certain points in time, e.g. when the host is powered off or in reset.


Oskar.


On Tue, Sep 10, 2019 at 7:56 PM Andrew Jeffery <andrew@aj.id.au> wrote:



On Wed, 11 Sep 2019, at 07:16, Milton Miller II wrote:
> On September 10, 2019, Byron <ouyangxuan10@163.com> wrote:
>
> >Dear all,
> >
> >    I want to ask a question about how to spi driver flash host/bios
> >firmware? I don't want use mtd mode flash it, because the mtd mode
> >need read spi-id when BMC load spi driver, may be it is risky, it
> >need switch the  system spi to BMC when the host running, It may
> >break host startup. Do we have other solutions to solve this problem?
> >
>
> Indeed, we did have some initial hand-off issues especially as the
> Linux kernel spi nor layer matured.  Over time the assumptions that
> the bios had that the chip would be set to 4-byte addressing by
> default were not met by the kernel driver which switched to using
> 4-byte specific read and write commands.
>
> You probably have a few options:
>
> If you host is read-only, you can allocate a block of dram
> and point the lpc window to the dram.  The aspeed lpc
> controller drivers has ioctl calls for this.
>
> If you host is directly connected to the chip and you are
> using the spi mode mux, then you would need to handshake
> with your bios.
>
> If your host is using lpc to the aspeed chip and programming
> the controller directly, you probably have given full overtake
> of your bmc to the host.

This is the case for ASPEED BMCs, so be conscious of threat models.

>
> In Openpower systems, we have implemented a protocol to map
> sections of the SPI rom into memory, and use IPMI messages
> to page in and out windows from this access window in memory
> to the backing SPI chip. We also have a method.

That sentence looks incomplete :)

Anyway, yes, in OpenPOWER platform designs the BMC owns the flash
and we provide an abstract means for the host to access flash data such
that the BMC always remains in control. If you have questions on what
we've done there, don't hesitate to ask me.

Any other mechanisms will require an explicit handshake as Milton
mentions and there may be some corner cases in the event of ungraceful
shutdowns of the host.

Andrew





 

[-- Attachment #2: Type: text/html, Size: 6041 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-09-18  1:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-10 13:03 how to use spi flash BIOS/Host firmware?? www
2019-09-10 21:46 ` Milton Miller II
2019-09-10 23:56   ` how " Andrew Jeffery
2019-09-11 15:28     ` Oskar Senft
     [not found]       ` <cff298c.8724.16d3961f88b.Coremail.ouyangxuan10@163.com>
2019-09-16 14:58         ` Oskar Senft
2019-09-18  1:05           ` www

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.