Re: [Qemu-devel] [RFC PATCH 6/6] pc: Support firmware configuration with -blockdev

2019-03-05 Thread Markus Armbruster
Laszlo Ersek writes: > On 03/04/19 18:50, Markus Armbruster wrote: > >> Alright, we can call object_get_class(dev_obj)->unparent(dev_obj). >> >> Final complication: if I call just that, the device's reference counter >> goes down to zero in the middle of device_unparent(), and we use after >> fr

Re: [Qemu-devel] [RFC PATCH 6/6] pc: Support firmware configuration with -blockdev

2019-03-05 Thread Laszlo Ersek
On 03/04/19 18:50, Markus Armbruster wrote: > Alright, we can call object_get_class(dev_obj)->unparent(dev_obj). > > Final complication: if I call just that, the device's reference counter > goes down to zero in the middle of device_unparent(), and we use after > free. So I bracket he call with

Re: [Qemu-devel] [RFC PATCH 6/6] pc: Support firmware configuration with -blockdev

2019-03-05 Thread Markus Armbruster
Philippe Mathieu-Daudé writes: > On 2/25/19 7:37 PM, Markus Armbruster wrote: >> The PC machines put firmware in ROM by default. To get it put into >> flash memory (required by OVMF), you have to use -drive >> if=pflash,unit=0,... and optionally -drive if=pflash,unit=1,... >> >> Why two -drive?

Re: [Qemu-devel] [RFC PATCH 6/6] pc: Support firmware configuration with -blockdev

2019-03-04 Thread Philippe Mathieu-Daudé
On 3/4/19 8:14 PM, Philippe Mathieu-Daudé wrote: > On 2/25/19 7:37 PM, Markus Armbruster wrote: >> The PC machines put firmware in ROM by default. To get it put into >> flash memory (required by OVMF), you have to use -drive >> if=pflash,unit=0,... and optionally -drive if=pflash,unit=1,... >> >>

Re: [Qemu-devel] [RFC PATCH 6/6] pc: Support firmware configuration with -blockdev

2019-03-04 Thread Philippe Mathieu-Daudé
On 2/25/19 7:37 PM, Markus Armbruster wrote: > The PC machines put firmware in ROM by default. To get it put into > flash memory (required by OVMF), you have to use -drive > if=pflash,unit=0,... and optionally -drive if=pflash,unit=1,... > > Why two -drive? This permits setting up one part of th

Re: [Qemu-devel] [RFC PATCH 6/6] pc: Support firmware configuration with -blockdev

2019-03-04 Thread Markus Armbruster
The problem at hand is how to destroy a device created with qdev_create() without ever realizing it. This hack passes tests: diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c index ed608a53d3..1bd538796b 100644 --- a/hw/i386/pc_sysfw.c +++ b/hw/i386/pc_sysfw.c @@ -116,14 +116,9 @@ static void

Re: [Qemu-devel] [RFC PATCH 6/6] pc: Support firmware configuration with -blockdev

2019-02-26 Thread Laszlo Ersek
On 02/26/19 13:35, Markus Armbruster wrote: > Laszlo Ersek writes: >>> -#define FLASH_MAP_UNIT_MAX 2 >>> +static PFlashCFI01 *pc_pflash_create(const char *name) >>> +{ >>> +DeviceState *dev = qdev_create(NULL, TYPE_CFI_PFLASH01); >>> + >>> +qdev_prop_set_uint64(dev, "sector-length", 4096)

Re: [Qemu-devel] [RFC PATCH 6/6] pc: Support firmware configuration with -blockdev

2019-02-26 Thread Markus Armbruster
Laszlo Ersek writes: > Hi Markus, > > On 02/25/19 19:37, Markus Armbruster wrote: >> The PC machines put firmware in ROM by default. To get it put into >> flash memory (required by OVMF), you have to use -drive >> if=pflash,unit=0,... and optionally -drive if=pflash,unit=1,... >> >> Why two -dr

Re: [Qemu-devel] [RFC PATCH 6/6] pc: Support firmware configuration with -blockdev

2019-02-26 Thread Laszlo Ersek
Hi Markus, On 02/25/19 19:37, Markus Armbruster wrote: > The PC machines put firmware in ROM by default. To get it put into > flash memory (required by OVMF), you have to use -drive > if=pflash,unit=0,... and optionally -drive if=pflash,unit=1,... > > Why two -drive? This permits setting up one

[Qemu-devel] [RFC PATCH 6/6] pc: Support firmware configuration with -blockdev

2019-02-25 Thread Markus Armbruster
The PC machines put firmware in ROM by default. To get it put into flash memory (required by OVMF), you have to use -drive if=pflash,unit=0,... and optionally -drive if=pflash,unit=1,... Why two -drive? This permits setting up one part of the flash memory read-only, and the other part read/write