All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Cédric Le Goater" <clg@kaod.org>
To: "Havard Skinnemoen" <hskinnemoen@google.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>
Cc: Kevin Wolf <kwolf@redhat.com>,
	Peter Maydell <peter.maydell@linaro.org>,
	Thomas Huth <thuth@redhat.com>,
	Qemu-block <qemu-block@nongnu.org>,
	Markus Armbruster <armbru@redhat.com>,
	QEMU Developers <qemu-devel@nongnu.org>,
	CS20 KFTing <kfting@nuvoton.com>, qemu-arm <qemu-arm@nongnu.org>,
	IS20 Avi Fishman <Avi.Fishman@nuvoton.com>
Subject: Re: [PATCH v5 10/11] hw/arm: Wire up BMC boot flash for npcm750-evb and quanta-gsj
Date: Fri, 17 Jul 2020 22:21:32 +0200	[thread overview]
Message-ID: <edd8e05f-deaa-7981-92e1-686643086138@kaod.org> (raw)
In-Reply-To: <CAFQmdRbdSYOGw1o2ur_dYdSAZZfvQMfz4PX1Hmu+XvX7b9B-QQ@mail.gmail.com>

On 7/17/20 9:18 PM, Havard Skinnemoen wrote:
> On Fri, Jul 17, 2020 at 2:00 AM Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>>
>> On 7/17/20 10:27 AM, Philippe Mathieu-Daudé wrote:
>>> On 7/17/20 10:03 AM, Thomas Huth wrote:
>>>> On 17/07/2020 09.48, Philippe Mathieu-Daudé wrote:
>>>>> +Thomas
>>>>
>>>>> On 7/16/20 10:56 PM, Havard Skinnemoen wrote:
>>>>>> On Wed, Jul 15, 2020 at 1:54 PM Havard Skinnemoen
>>>>>> <hskinnemoen@google.com> wrote:
>>>>>>>
>>>>>>> On Wed, Jul 15, 2020 at 3:57 AM Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>>>>>>>>
>>>>>>>> On 7/15/20 11:00 AM, Markus Armbruster wrote:
>>>>>>>>> Now my point.  Why first make up user configuration, then use that to
>>>>>>>>> create a BlockBackend, when you could just go ahead and create the
>>>>>>>>> BlockBackend?
>>>>>>>>
>>>>>>>> CLI issue mostly.
>>>>>>>>
>>>>>>>> We can solve it similarly to the recent "sdcard: Do not allow invalid SD
>>>>>>>> card sizes" patch:
>>>>>>>>
>>>>>>>>  if (!dinfo) {
>>>>>>>>      error_setg(errp, "Missing SPI flash drive");
>>>>>>>>      error_append_hint(errp, "You can use a dummy drive using:\n");
>>>>>>>>      error_append_hint(errp, "-drive if=mtd,driver=null-co,"
>>>>>>>>                              "read-ones=on,size=64M\n);
>>>>>>>>      return;
>>>>>>>>  }
>>>>>>>>
>>>>>>>> having npcm7xx_connect_flash() taking an Error* argument,
>>>>>>>> and MachineClass::init() call it with &error_fatal.
>>>>>>>
>>>>>>> Erroring out if the user specifies a configuration that can't possibly
>>>>>>> boot sounds good to me. Better than trying to come up with defaults
>>>>>>> that are still not going to result in a bootable system.
>>>>>>>
>>>>>>> For testing recovery paths, I think it makes sense to explicitly
>>>>>>> specify a null device as you suggest.
>>>>>>
>>>>>> Hmm, one problem. qom-test fails with
>>>>>>
>>>>>> qemu-system-aarch64: Missing SPI flash drive
>>>>>> You can add a dummy drive using:
>>>>>> -drive if=mtd,driver=null-co,read-zeroes=on,size=32M
>>>>>> Broken pipe
>>>>>> /usr/local/google/home/hskinnemoen/qemu/for-upstream/tests/qtest/libqtest.c:166:
>>>>>> kill_qemu() tried to terminate QEMU process but encountered exit
>>>>>> status 1 (expected 0)
>>>>>> ERROR qom-test - too few tests run (expected 68, got 7)
>>>>>>
>>>>>> So it looks like we might need a different solution to this, unless we
>>>>>> want to make generic tests more machine-aware...
>>>>
>>>> I didn't follow the other mails in this thread, but what we usually do
>>>> in such a case: Add a "if (qtest_enabled())" check to the device or the
>>>> machine to ignore the error if it is running in qtest mode.
>>>
>>> Hmm I'm not sure it works in this case. We could do:
>>>
>>>   if (!dinfo) {
>>>      if (qtest) {
>>>         /* create null drive for qtest */
>>>         opts = ...;
>>>         dinfo = drive_new(opts, IF_MTD, &error_abort);
>>>      } else {
>>>         /* teach user to use proper CLI */
>>>         error_setg(errp, "Missing SPI flash drive");
>>>         error_append_hint(errp, "You can use a dummy drive using:\n");
>>>         error_append_hint(errp, "-drive if=mtd,driver=null-co,"
>>>                                 "read-ones=on,size=64M\n);
>>>      }
>>>   }
>>>
>>> But I'm not sure Markus will enjoy it :)
>>>
>>> Markus, any better idea about how to handle that with automatic qtests?
>>
>> FWIW IDE device has a concept of "Anonymous BlockBackend for an empty
>> drive":
>>
>> static void ide_dev_initfn(IDEDevice *dev, IDEDriveKind kind, Error **errp)
>> {
>>     IDEBus *bus = DO_UPCAST(IDEBus, qbus, dev->qdev.parent_bus);
>>     IDEState *s = bus->ifs + dev->unit;
>>     int ret;
>>
>>     if (!dev->conf.blk) {
>>         if (kind != IDE_CD) {
>>             error_setg(errp, "No drive specified");
>>             return;
>>         } else {
>>             /* Anonymous BlockBackend for an empty drive */
>>             dev->conf.blk = blk_new(qemu_get_aio_context(), 0,
>> BLK_PERM_ALL);
>>             ret = blk_attach_dev(dev->conf.blk, &dev->qdev);
>>             assert(ret == 0);
>>         }
>>     }
> 
> Could someone please remind me what problem we're trying to solve here?
> 
> Currently, if the user (or test) doesn't provide a drive, we pass NULL
> as the block backend to m25p80. This means we'll take the code path in
> m25p_realize() that does
> 
>         trace_m25p80_binding_no_bdrv(s);
>         s->storage = blk_blockalign(NULL, s->size);
>         memset(s->storage, 0xFF, s->size);
> 
> which will look like a freshly chip-erased flash chip.

which is perfect. 

C. 



  reply	other threads:[~2020-07-17 20:22 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-09  0:35 [PATCH v5 00/11] Add Nuvoton NPCM730/NPCM750 SoCs and two BMC machines Havard Skinnemoen
2020-07-09  0:35 ` [PATCH v5 01/11] hw/misc: Add NPCM7xx System Global Control Registers device model Havard Skinnemoen
2020-07-09  6:04   ` Philippe Mathieu-Daudé
2020-07-09  6:43     ` Havard Skinnemoen
2020-07-09 16:23       ` Philippe Mathieu-Daudé
2020-07-09 17:09         ` Havard Skinnemoen
2020-07-09 17:24           ` Philippe Mathieu-Daudé
2020-07-09 17:42             ` Havard Skinnemoen
2020-07-10  9:31               ` Philippe Mathieu-Daudé
2020-07-11  6:46                 ` Havard Skinnemoen
2020-07-12  5:49                   ` Havard Skinnemoen
2020-07-09  0:35 ` [PATCH v5 02/11] hw/misc: Add NPCM7xx Clock Controller " Havard Skinnemoen
2020-07-15  7:18   ` Philippe Mathieu-Daudé
2020-07-09  0:36 ` [PATCH v5 03/11] hw/timer: Add NPCM7xx Timer " Havard Skinnemoen
2020-07-15  7:25   ` Philippe Mathieu-Daudé
2020-07-15 23:04     ` Havard Skinnemoen
2020-07-16  8:04       ` Philippe Mathieu-Daudé
2020-07-09  0:36 ` [PATCH v5 04/11] hw/arm: Add NPCM730 and NPCM750 SoC models Havard Skinnemoen
2020-07-09  6:11   ` Philippe Mathieu-Daudé
2020-07-13 15:02   ` Cédric Le Goater
2020-07-14  0:44     ` Havard Skinnemoen
2020-07-14 11:37       ` Philippe Mathieu-Daudé
2020-07-14 16:01         ` Markus Armbruster
2020-07-14 17:11           ` Philippe Mathieu-Daudé
2020-07-15  1:03             ` Havard Skinnemoen
2020-07-15  9:35               ` Markus Armbruster
2020-07-09  0:36 ` [PATCH v5 05/11] hw/arm: Add two NPCM7xx-based machines Havard Skinnemoen
2020-07-09  5:57   ` Philippe Mathieu-Daudé
2020-07-09  6:09     ` Philippe Mathieu-Daudé
2020-07-09  0:36 ` [PATCH v5 06/11] hw/arm: Load -bios image as a boot ROM for npcm7xx Havard Skinnemoen
2020-07-13 17:50   ` Philippe Mathieu-Daudé
2020-07-09  0:36 ` [PATCH v5 07/11] hw/nvram: NPCM7xx OTP device model Havard Skinnemoen
2020-07-09  0:36 ` [PATCH v5 08/11] hw/mem: Stubbed out NPCM7xx Memory Controller model Havard Skinnemoen
2020-07-09 16:29   ` Philippe Mathieu-Daudé
2020-07-09  0:36 ` [PATCH v5 09/11] hw/ssi: NPCM7xx Flash Interface Unit device model Havard Skinnemoen
2020-07-09 17:00   ` Philippe Mathieu-Daudé
2020-07-12  5:42     ` Havard Skinnemoen
2020-07-13 17:38       ` Philippe Mathieu-Daudé
2020-07-14  2:39         ` Havard Skinnemoen
2020-07-09  0:36 ` [PATCH v5 10/11] hw/arm: Wire up BMC boot flash for npcm750-evb and quanta-gsj Havard Skinnemoen
2020-07-13 14:57   ` Cédric Le Goater
2020-07-13 17:59     ` Philippe Mathieu-Daudé
2020-07-13 18:02       ` Philippe Mathieu-Daudé
2020-07-14  2:56     ` Havard Skinnemoen
2020-07-14  9:16       ` Markus Armbruster
2020-07-14 11:29         ` Philippe Mathieu-Daudé
2020-07-14 16:21           ` Markus Armbruster
2020-07-14 17:16             ` Philippe Mathieu-Daudé
2020-07-15  9:00               ` Markus Armbruster
2020-07-15 10:57                 ` Philippe Mathieu-Daudé
2020-07-15 20:54                   ` Havard Skinnemoen
2020-07-16 20:56                     ` Havard Skinnemoen
2020-07-17  7:48                       ` Philippe Mathieu-Daudé
2020-07-17  8:03                         ` Thomas Huth
2020-07-17  8:27                           ` Philippe Mathieu-Daudé
2020-07-17  9:00                             ` Philippe Mathieu-Daudé
2020-07-17 19:18                               ` Havard Skinnemoen
2020-07-17 20:21                                 ` Cédric Le Goater [this message]
2020-07-17 20:52                                 ` Philippe Mathieu-Daudé
2020-07-17 20:57                                   ` Havard Skinnemoen
2020-07-20  7:58                               ` Markus Armbruster
2020-07-15  7:42       ` Cédric Le Goater
2020-07-15 21:19         ` Havard Skinnemoen
2020-07-09  0:36 ` [PATCH v5 11/11] docs/system: Add Nuvoton machine documentation Havard Skinnemoen

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=edd8e05f-deaa-7981-92e1-686643086138@kaod.org \
    --to=clg@kaod.org \
    --cc=Avi.Fishman@nuvoton.com \
    --cc=armbru@redhat.com \
    --cc=f4bug@amsat.org \
    --cc=hskinnemoen@google.com \
    --cc=kfting@nuvoton.com \
    --cc=kwolf@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    /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.