All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Cédric Le Goater" <clg@kaod.org>
To: andrew@aj.id.au, openbmc@lists.ozlabs.org
Subject: Re: [PATCH qemu 06/12] ast2400: use contents of first SPI flash as a rom
Date: Thu, 9 Jun 2016 12:42:30 +0200	[thread overview]
Message-ID: <57594816.4000201@kaod.org> (raw)
In-Reply-To: <1465280684.16048.68.camel@aj.id.au>

On 06/07/2016 08:24 AM, Andrew Jeffery wrote:
> On Sun, 2016-05-29 at 23:19 +0200, Cédric Le Goater wrote:
>> This provides support for U-Boot images which are loaded at 0x0.
>>
>> A Palmetto BMC guest can now be simply booted with :
>>
>>   $ qemu-system-arm -m 256 -M palmetto-bmc -nographic -nodefaults  \
>> 	-mtdblock ./flash-palmetto-20160512040959  \
>> 	-mtdblock ./palmetto.pnor
>>
>> The first block device uses the file "./flash-palmetto-20160512040959"
>> which will act as a SPI flash module for the BMC, handled by the
>> SMC/FMC controller. The second block device uses the file
>> "./palmetto.pnor" which is an OpenPower firmware image for a palmetto
>> OpenPower system. This one will be handled by the SMC/SPI controller.
>>
>> The flash images can be grabbed here :
>>
>>     https://openpower.xyz/job/openbmc-build/distro=ubuntu,target=palmetto/lastSuccessfulBuild/artifact/images/palmetto/flash-palmetto
>>     https://openpower.xyz/job/openpower-op-build/distro=ubuntu,target=palmetto/lastSuccessfulBuild/artifact/images/palmetto.pnor
>>
>> We could add a second BMC SPI flash by changing the 'num-cs' property
>> of the controller and emulate a golden image flash module.
>>
>> Signed-off-by: Cédric Le Goater <clg@kaod.org>
>> ---
>>
>>  That might seem a little too hacky ? 
>>
>>  hw/arm/palmetto-bmc.c | 9 +++++++++
>>  1 file changed, 9 insertions(+)
>>
>> diff --git a/hw/arm/palmetto-bmc.c b/hw/arm/palmetto-bmc.c
>> index c4099987d354..50369c0331a6 100644
>> --- a/hw/arm/palmetto-bmc.c
>> +++ b/hw/arm/palmetto-bmc.c
>> @@ -17,6 +17,7 @@
>>  #include "hw/arm/arm.h"
>>  #include "hw/arm/ast2400.h"
>>  #include "hw/boards.h"
>> +#include "hw/loader.h"
>>  
>>  static struct arm_boot_info palmetto_bmc_binfo = {
>>      .loader_start = AST2400_SDRAM_BASE,
>> @@ -53,6 +54,14 @@ static void palmetto_bmc_init(MachineState *machine)
>>      aspeed_smc_init_flashes(&bmc->soc.smc, "n25q256a");
>>      aspeed_smc_init_flashes(&bmc->soc.spi, "mx25l25635e");
>>  
>> +    /*
>> +     * Install first SMC/FMC flash content as a rom.
>> +     */
>> +    if (bmc->soc.smc.flashes[0]) {
>> +        rom_add_blob_fixed("aspeed.smc.0", bmc->soc.smc.flashes[0]->storage,
>> +                           bmc->soc.smc.flashes[0]->size, 0);
>> +    }
>> +
> 
> As mentioned on IRC it's probably best we investigate alternative
> approaches and use this as a last resort.

I agree. Ideally, we should add a memory region alias of bmc->soc.smc.flashes[0] 
at address 0x0.

To get it right, we would need a memory region of type rom backing 
the SPI flash object. The m25p80 object we use is initialized all 
at once today: it gets a disk and allocates storage. The init 
sequence needs a change to allow a late-init method (there are a 
couple of FIXMEs on that topic) and to set a preferred storage, 
like a rom memory region. Hopefully, there are no impacts on the 
SSI framework.

I quickly validated the idea with some hacks. The SMC model seems 
fine, we only have to make sure the rom mode is deactivated when 
not in user mode :

    memory_region_rom_device_set_romd(&s->flashes[i]->mmio, !usermode);

I need to study the m25p80 init question deeper now. 

Thanks,

C.

  reply	other threads:[~2016-06-09 11:00 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-29 21:19 [PATCH qemu 00/12] SMC and network support Cédric Le Goater
2016-05-29 21:19 ` [PATCH qemu 01/12] ast2400: add SMC controllers (FMC and SPI) Cédric Le Goater
2016-06-07  2:08   ` Andrew Jeffery
2016-06-08 11:53     ` Cédric Le Goater
2016-05-29 21:19 ` [PATCH qemu 02/12] ast2400: add SPI flash slave object Cédric Le Goater
2016-06-07  5:34   ` Andrew Jeffery
2016-06-08 12:42     ` Cédric Le Goater
2016-05-29 21:19 ` [PATCH qemu 03/12] ast2400: create SPI flash slaves Cédric Le Goater
2016-06-07  5:56   ` Andrew Jeffery
2016-06-08 12:46     ` Cédric Le Goater
2016-05-29 21:19 ` [PATCH qemu 04/12] m25p80: add a get storage routine Cédric Le Goater
2016-05-29 21:19 ` [PATCH qemu 05/12] ast2400: handle SPI flash Command mode (read only) Cédric Le Goater
2016-06-07  6:04   ` Andrew Jeffery
2016-05-29 21:19 ` [PATCH qemu 06/12] ast2400: use contents of first SPI flash as a rom Cédric Le Goater
2016-06-07  6:24   ` Andrew Jeffery
2016-06-09 10:42     ` Cédric Le Goater [this message]
2016-05-29 21:20 ` [PATCH qemu 07/12] m25p80: add RDCR instruction for Macronix chip Cédric Le Goater
2016-05-29 21:20 ` [PATCH qemu 08/12] m25p80: add mx25l25635f chip Cédric Le Goater
2016-05-29 21:20 ` [PATCH qemu 09/12] ast2400: use a " Cédric Le Goater
2016-06-07  6:29   ` Andrew Jeffery
2016-05-29 21:20 ` [PATCH qemu 10/12] ast2400: add a BT device Cédric Le Goater
2016-06-07  7:15   ` Andrew Jeffery
2016-05-29 21:20 ` [PATCH qemu 11/12] net: add FTGMAC100 support Cédric Le Goater
2016-06-08  3:50   ` Andrew Jeffery
2016-05-29 21:20 ` [PATCH qemu 12/12] ast2400: add a FTGMAC100 nic Cédric Le Goater
2016-06-07  7:26   ` Andrew Jeffery
2016-06-23 17:00 ` [PATCH qemu 00/12] SMC and network support Cédric Le Goater
2016-06-24  7:06   ` Joel Stanley
2016-06-24  7:18     ` Cédric Le Goater
2016-06-27 16:09   ` Andrew Jeffery

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=57594816.4000201@kaod.org \
    --to=clg@kaod.org \
    --cc=andrew@aj.id.au \
    --cc=openbmc@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.