qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 164340: pflash: Rename pflash_t to PFlashCFI0


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] 164340: pflash: Rename pflash_t to PFlashCFI01, PFlashCFI02
Date: Tue, 12 Mar 2019 05:29:25 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 1643406520f8ff6f4cc11062950f5f898b03b573
      
https://github.com/qemu/qemu/commit/1643406520f8ff6f4cc11062950f5f898b03b573
  Author: Markus Armbruster <address@hidden>
  Date:   2019-03-11 (Mon, 11 Mar 2019)

  Changed paths:
    M hw/arm/vexpress.c
    M hw/block/pflash_cfi01.c
    M hw/block/pflash_cfi02.c
    M hw/i386/pc_sysfw.c
    M hw/mips/mips_malta.c
    M hw/xtensa/xtfpga.c
    M include/hw/block/flash.h

  Log Message:
  -----------
  pflash: Rename pflash_t to PFlashCFI01, PFlashCFI02

flash.h's incomplete struct pflash_t is completed both in
pflash_cfi01.c and in pflash_cfi02.c.  The complete types are
incompatible.  This can hide type errors, such as passing a pflash_t
created with pflash_cfi02_register() to pflash_cfi01_get_memory().

Furthermore, POSIX reserves typedef names ending with _t.

Rename the two structs to PFlashCFI01 and PFlashCFI02.

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Alex Bennée <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Tested-by: Philippe Mathieu-Daudé <address@hidden>
Message-Id: <address@hidden>


  Commit: 2d93bebf81520ccebeb9a3ea9bd051ce088854ea
      
https://github.com/qemu/qemu/commit/2d93bebf81520ccebeb9a3ea9bd051ce088854ea
  Author: Markus Armbruster <address@hidden>
  Date:   2019-03-11 (Mon, 11 Mar 2019)

  Changed paths:
    M hw/block/pflash_cfi01.c

  Log Message:
  -----------
  pflash_cfi01: Do not exit() on guest aborting "write to buffer"

When a guest tries to abort "write to buffer" (command 0xE8), we print
"PFLASH: Possible BUG - Write block confirm", then exit(1).  Letting
the guest terminate QEMU is not a good idea.  Instead, LOG_UNIMP we
screwed up, then reset the device.

Macro PFLASH_BUG() is now unused; delete it.

Suggested-by: Philippe Mathieu-Daudé <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Reviewed-by: Alex Bennée <address@hidden>
Message-Id: <address@hidden>


  Commit: 4dbda935e054600667f9e57095fa97e2ce5936f9
      
https://github.com/qemu/qemu/commit/4dbda935e054600667f9e57095fa97e2ce5936f9
  Author: Markus Armbruster <address@hidden>
  Date:   2019-03-11 (Mon, 11 Mar 2019)

  Changed paths:
    M hw/block/pflash_cfi01.c

  Log Message:
  -----------
  pflash_cfi01: Log use of flawed "write to buffer"

Our implementation of "write to buffer" (command 0xE8) is flawed.
LOG_UNIMP its use, and add some FIXME comments.

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Reviewed-by: Alex Bennée <address@hidden>
Message-Id: <address@hidden>


  Commit: e7b6274197c5f096860014ca750544d6aca0b9b9
      
https://github.com/qemu/qemu/commit/e7b6274197c5f096860014ca750544d6aca0b9b9
  Author: Markus Armbruster <address@hidden>
  Date:   2019-03-11 (Mon, 11 Mar 2019)

  Changed paths:
    M hw/block/pflash_cfi01.c
    M hw/block/pflash_cfi02.c
    M include/hw/block/flash.h

  Log Message:
  -----------
  pflash: Rename *CFI_PFLASH* to *PFLASH_CFI*

pflash_cfi01.c and pflash_cfi02.c start their identifiers with
pflash_cfi01_ and pflash_cfi02_ respectively, except for
CFI_PFLASH01(), TYPE_CFI_PFLASH01, CFI_PFLASH02(), TYPE_CFI_PFLASH02.
Rename for consistency.

Suggested-by: Philippe Mathieu-Daudé <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Reviewed-by: Alex Bennée <address@hidden>
Message-Id: <address@hidden>


  Commit: 81c7db723ebd0c677784a728020c7e8845868daf
      
https://github.com/qemu/qemu/commit/81c7db723ebd0c677784a728020c7e8845868daf
  Author: Markus Armbruster <address@hidden>
  Date:   2019-03-11 (Mon, 11 Mar 2019)

  Changed paths:
    M hw/arm/vexpress.c
    M hw/arm/virt.c
    M hw/block/pflash_cfi01.c
    M hw/block/pflash_cfi02.c
    M hw/xtensa/xtfpga.c
    M include/hw/block/flash.h

  Log Message:
  -----------
  hw: Use PFLASH_CFI0{1,2} and TYPE_PFLASH_CFI0{1,2}

We have two open-coded copies of macro PFLASH_CFI01().  Move the macro
to the header, so we can ditch the copies.  Move PFLASH_CFI02() to the
header for symmetry.

We define macros TYPE_PFLASH_CFI01 and TYPE_PFLASH_CFI02 for type name
strings, then mostly use the strings.  If the macros are worth
defining, they are worth using.  Replace the strings by the macros.

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Laszlo Ersek <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Reviewed-by: Alex Bennée <address@hidden>
Message-Id: <address@hidden>


  Commit: f30bc99559306eee9ef363bc11bf63a021aee707
      
https://github.com/qemu/qemu/commit/f30bc99559306eee9ef363bc11bf63a021aee707
  Author: Markus Armbruster <address@hidden>
  Date:   2019-03-11 (Mon, 11 Mar 2019)

  Changed paths:
    M hw/ppc/sam460ex.c

  Log Message:
  -----------
  sam460ex: Don't size flash memory to match backing image

Machine "sam460ex" maps its flash memory at address 0xFFF00000.  When
no image is supplied, its size is 1MiB (0x100000), and 512KiB of ROM
get mapped on top of its second half.  Else, it's the size of the
image rounded up to the next multiple of 64KiB.

The rounding is actually useless: pflash_cfi01_realize() fails with
"failed to read the initial flash content" unless it's a no-op.

I have no idea what happens when the pflash's size exceeds 1MiB.
Useful outcomes seem unlikely.

I guess memory at the end of the address space remains unmapped when
it's smaller than 1MiB.  Again, useful outcomes seem unlikely.

The physical hardware appears to have 512KiB of flash memory:
https://eu.mouser.com/datasheet/2/268/atmel_AT49BV040B-1180330.pdf

For now, just set the flash memory size to 1MiB regardless of image
size, and document the mess.

Cc: BALATON Zoltan <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: BALATON Zoltan <address@hidden>
Reviewed-by: Alex Bennée <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>


  Commit: 886db7c55c72246e3810628d735f5e25eceb8c45
      
https://github.com/qemu/qemu/commit/886db7c55c72246e3810628d735f5e25eceb8c45
  Author: Markus Armbruster <address@hidden>
  Date:   2019-03-11 (Mon, 11 Mar 2019)

  Changed paths:
    M hw/ppc/ppc405_boards.c

  Log Message:
  -----------
  ppc405_boards: Delete stale, disabled DEBUG_BOARD_INIT code

The disabled DEBUG_BOARD_INIT code goes back to the initial commit
1a6c0886203, and has since seen only mechanical updates.  It sure
feels like useless clutter now.  Delete it.

Suggested-by: Alex Bennée <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Alex Bennée <address@hidden>


  Commit: dd59bcae7687df4b2ba8e5292607724996e00892
      
https://github.com/qemu/qemu/commit/dd59bcae7687df4b2ba8e5292607724996e00892
  Author: Markus Armbruster <address@hidden>
  Date:   2019-03-11 (Mon, 11 Mar 2019)

  Changed paths:
    M hw/ppc/ppc405_boards.c

  Log Message:
  -----------
  ppc405_boards: Don't size flash memory to match backing image

Machine "ref405ep" maps its flash memory at address 2^32 - image size.
Image size is rounded up to the next multiple of 64KiB.  Useless,
because pflash_cfi02_realize() fails with "failed to read the initial
flash content" unless the rounding is a no-op.

If the image size exceeds 0x80000 Bytes, we overlap first SRAM, then
other stuff.  No idea how that would play out, but useful outcomes
seem unlikely.

Map the flash memory at fixed address 0xFFF80000 with size 512KiB,
regardless of image size, to match the physical hardware.

Machine "taihu" maps its boot flash memory similarly.  The code even
has a comment /* XXX: should check that size is 2MB */, followed by
disabled code to adjust the size to 2MiB regardless of image size.

Its code to map its application flash memory looks the same, except
there the XXX comment asks for 32MiB, and the code to adjust the size
isn't disabled.  Note that pflash_cfi02_realize() fails with "failed
to read the initial flash content" for images smaller than 32MiB.

Map the boot flash memory at fixed address 0xFFE00000 with size 2MiB,
to match the physical hardware.  Delete dead code from application
flash mapping, and simplify some.

Cc: David Gibson <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
Acked-by: David Gibson <address@hidden>
Reviewed-by: Alex Bennée <address@hidden>
Message-Id: <address@hidden>


  Commit: 8468713412b1eb0d24d605bf97d159a9b01d4b02
      
https://github.com/qemu/qemu/commit/8468713412b1eb0d24d605bf97d159a9b01d4b02
  Author: Markus Armbruster <address@hidden>
  Date:   2019-03-11 (Mon, 11 Mar 2019)

  Changed paths:
    M hw/sh4/r2d.c

  Log Message:
  -----------
  r2d: Fix flash memory size, sector size, width, device ID

pflash_cfi02_register() takes a size in bytes, a block size in bytes
and a number of blocks.  r2d_init() passes FLASH_SIZE, 16 * KiB,
FLASH_SIZE >> 16.  Does not compute: size doesn't match block size *
number of blocks.  The latter happens to win: FLASH_SIZE / 4,
i.e. 8MiB.

The best information we have on the physical hardware lists a Cypress
S29PL127J60TFI130 128MiBit NOR flash addressable in words of 16 bits,
in sectors of 4 and 32 Kibiwords.  We don't model multiple sector
sizes.

Fix the flash size from 8 to 16MiB, and adjust the sector size from 16
to 64KiB.  Fix the width from 4 to 2.  While there, supply the real
device IDs 0x0001, 0x227e, 0x2220, 0x2200 instead of zeros.

Cc: Magnus Damm <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Message-Id: <address@hidden>
Tested-by: Philippe Mathieu-Daudé <address@hidden>


  Commit: 5a4abb197b2ee8e6c545a8ec6e0bf9ca4e470127
      
https://github.com/qemu/qemu/commit/5a4abb197b2ee8e6c545a8ec6e0bf9ca4e470127
  Author: Markus Armbruster <address@hidden>
  Date:   2019-03-11 (Mon, 11 Mar 2019)

  Changed paths:
    M hw/mips/mips_malta.c

  Log Message:
  -----------
  mips_malta: Delete disabled, broken DEBUG_BOARD_INIT code

The debug code under DEBUG_BOARD_INIT doesn't compile:

      hw/mips/mips_malta.c:1273:16: error: implicit declaration of function 
‘blk_name’; did you mean ‘basename’? [-Werror=implicit-function-declaration]
                    blk_name(dinfo->bdrv), fl_sectors);
                    ^~~~~~~~
      hw/mips/mips_malta.c:1273:16: error: nested extern declaration of 
‘blk_name’ [-Werror=nested-externs]
      hw/mips/mips_malta.c:1273:30: error: ‘DriveInfo’ {aka ‘struct DriveInfo’} 
has no member named ‘bdrv’
                    blk_name(dinfo->bdrv), fl_sectors);
                                    ^~

Delete it.

Reported-by: Philippe Mathieu-Daudé <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Aleksandar Markovic <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Alex Bennée <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Tested-by: Philippe Mathieu-Daudé <address@hidden>


  Commit: 5207c595eb8910eee3d329214e65d64e348985d1
      
https://github.com/qemu/qemu/commit/5207c595eb8910eee3d329214e65d64e348985d1
  Author: Philippe Mathieu-Daudé <address@hidden>
  Date:   2019-03-11 (Mon, 11 Mar 2019)

  Changed paths:
    M hw/mips/mips_malta.c

  Log Message:
  -----------
  hw/mips/malta: Remove fl_sectors variable

Variable fl_sectors is used just once.  Since
fl_sectors = bios_size >> 16 and bios_size = FLASH_SIZE there,
we can simply use FLASH_SIZE >> 16, and eliminate variable.

Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
Message-Id: <address@hidden>


  Commit: 74c02ebd80fa331361c431d8dbfcba45a2a36e85
      
https://github.com/qemu/qemu/commit/74c02ebd80fa331361c431d8dbfcba45a2a36e85
  Author: Philippe Mathieu-Daudé <address@hidden>
  Date:   2019-03-11 (Mon, 11 Mar 2019)

  Changed paths:
    M hw/mips/mips_malta.c

  Log Message:
  -----------
  hw/mips/malta: Restrict 'bios_size' variable scope

The 'bios_size' variable is only used in the 'if (!kernel_filename &&
!dinfo)' clause. This is the case when we don't provide -pflash command
line option, and also don't provide a -kernel option. In this case we
will check for the -bios option, or use the default BIOS_FILENAME file.

The 'bios' term is valid in this if statement, but is confuse in the
whole mips_malta_init() scope. Restrict his scope.

Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
Message-Id: <address@hidden>


  Commit: 7ebfece56a9370eecd4b425b109dd722b09b9303
      
https://github.com/qemu/qemu/commit/7ebfece56a9370eecd4b425b109dd722b09b9303
  Author: Markus Armbruster <address@hidden>
  Date:   2019-03-11 (Mon, 11 Mar 2019)

  Changed paths:
    M hw/mips/mips_malta.c

  Log Message:
  -----------
  mips_malta: Clean up definition of flash memory size somewhat

pflash_cfi01_register() takes a size in bytes, a block size in bytes
and a number of blocks.  mips_malta_init() passes BIOS_SIZE, 65536,
FLASH_SIZE >> 16.  Actually consistent only because BIOS_SIZE (defined
in include/hw/mips/bios.h as (4 * MiB)) matches FLASH_SIZE (defined
locally as 0x400000).  Confusing all the same.

Pass FLASH_SIZE instead of BIOS_SIZE.

Cc: Aurelien Jarno <address@hidden>
Cc: Aleksandar Rikalo <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Alex Bennée <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Tested-by: Philippe Mathieu-Daudé <address@hidden>


  Commit: 940d5b132fab085bd8ec2bcfa5c1dd119785b217
      
https://github.com/qemu/qemu/commit/940d5b132fab085bd8ec2bcfa5c1dd119785b217
  Author: Markus Armbruster <address@hidden>
  Date:   2019-03-11 (Mon, 11 Mar 2019)

  Changed paths:
    M hw/arm/collie.c
    M hw/arm/digic_boards.c
    M hw/arm/gumstix.c
    M hw/arm/mainstone.c
    M hw/arm/musicpal.c
    M hw/arm/omap_sx1.c
    M hw/arm/versatilepb.c
    M hw/arm/xilinx_zynq.c
    M hw/arm/z2.c
    M hw/block/pflash_cfi01.c
    M hw/block/pflash_cfi02.c
    M hw/i386/pc_sysfw.c
    M hw/lm32/lm32_boards.c
    M hw/lm32/milkymist.c
    M hw/microblaze/petalogix_ml605_mmu.c
    M hw/microblaze/petalogix_s3adsp1800_mmu.c
    M hw/mips/mips_malta.c
    M hw/mips/mips_r4k.c
    M hw/ppc/ppc405_boards.c
    M hw/ppc/sam460ex.c
    M hw/ppc/virtex_ml507.c
    M hw/sh4/r2d.c
    M include/hw/block/flash.h

  Log Message:
  -----------
  pflash: Clean up after commit 368a354f02b, part 1

QOMification left parameter @qdev unused in pflash_cfi01_register()
and pflash_cfi02_register().  All callers pass NULL.  Remove.

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Laszlo Ersek <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Reviewed-by: Alex Bennée <address@hidden>
Tested-by: Philippe Mathieu-Daudé <address@hidden>
Message-Id: <address@hidden>


  Commit: ce14710f4fdfca32123d7efd3ddcbee984ef0ae5
      
https://github.com/qemu/qemu/commit/ce14710f4fdfca32123d7efd3ddcbee984ef0ae5
  Author: Markus Armbruster <address@hidden>
  Date:   2019-03-11 (Mon, 11 Mar 2019)

  Changed paths:
    M hw/arm/collie.c
    M hw/arm/digic_boards.c
    M hw/arm/gumstix.c
    M hw/arm/mainstone.c
    M hw/arm/musicpal.c
    M hw/arm/omap_sx1.c
    M hw/arm/versatilepb.c
    M hw/arm/xilinx_zynq.c
    M hw/arm/z2.c
    M hw/block/pflash_cfi01.c
    M hw/block/pflash_cfi02.c
    M hw/i386/pc_sysfw.c
    M hw/lm32/lm32_boards.c
    M hw/lm32/milkymist.c
    M hw/microblaze/petalogix_ml605_mmu.c
    M hw/microblaze/petalogix_s3adsp1800_mmu.c
    M hw/mips/mips_malta.c
    M hw/mips/mips_r4k.c
    M hw/ppc/ppc405_boards.c
    M hw/ppc/sam460ex.c
    M hw/ppc/virtex_ml507.c
    M hw/sh4/r2d.c
    M include/hw/block/flash.h

  Log Message:
  -----------
  pflash: Clean up after commit 368a354f02b, part 2

Our pflash devices are simplistically modelled has having
"num-blocks" sectors of equal size "sector-length".  Real hardware
commonly has sectors of different sizes.  How our "sector-length"
property is related to the physical device's multiple sector sizes
is unclear.

Helper functions pflash_cfi01_register() and pflash_cfi02_register()
create a pflash device, set properties including "sector-length" and
"num-blocks", and realize.  They take parameters @size, @sector_len
and @nb_blocs.

QOMification left parameter @size unused.  Obviously, @size should
match @sector_len and @nb_blocs, i.e. size == sector_len * nb_blocs.
All callers satisfy this.

Remove @nb_blocs and compute it from @size and @sector_len.

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Laszlo Ersek <address@hidden>
Reviewed-by: Alex Bennée <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>


  Commit: 1a3ec8c1564f51628cce10d435a2e22559ea29fd
      
https://github.com/qemu/qemu/commit/1a3ec8c1564f51628cce10d435a2e22559ea29fd
  Author: Markus Armbruster <address@hidden>
  Date:   2019-03-11 (Mon, 11 Mar 2019)

  Changed paths:
    M accel/accel.c
    M hw/core/qdev.c
    M include/hw/qdev-core.h
    M vl.c

  Log Message:
  -----------
  qdev: Fix latent bug with compat_props and onboard devices

Compatibility properties started life as a qdev property thing: we
supported them only for qdev properties, and implemented them with the
machinery backing command line option -global.

Recent commit fa0cb34d221 put them to use (tacitly) with memory
backend objects (subtypes of TYPE_MEMORY_BACKEND).  To make that
possible, we first moved the work of applying them from the -global
machinery into TYPE_DEVICE's .instance_post_init() method
device_post_init(), in commits ea9ce8934c5 and b66bbee39f6, then made
it available to TYPE_MEMORY_BACKEND's .instance_post_init() method
host_memory_backend_post_init() as object_apply_compat_props(), in
commit 1c3994f6d2a.

Note the code smell: we now have function name starting with object_
in hw/core/qdev.c.  It has to be there rather than in qom/, because it
calls qdev_get_machine() to find the current accelerator's and
machine's compat_props.

Turns out calling qdev_get_machine() there is problematic.  If we
qdev_create() from a machine's .instance_init() method, we call
device_post_init() and thus qdev_get_machine() before main() can
create "/machine" in QOM.  qdev_get_machine() tries to get it with
container_get(), which "helpfully" creates it as "container" object,
and returns that.  object_apply_compat_props() tries to paper over the
problem by doing nothing when the value of qdev_get_machine() isn't a
TYPE_MACHINE.  But the damage is done already: when main() later
attempts to create the real "/machine", it fails with "attempt to add
duplicate property 'machine' to object (type 'container')", and
aborts.

Since no machine .instance_init() calls qdev_create() so far, the bug
is latent.  But since I want to do that, I get to fix the bug first.

Observe that object_apply_compat_props() doesn't actually need the
MachineState, only its the compat_props member of its MachineClass and
AccelClass.  This permits a simple fix: register MachineClass and
AccelClass compat_props with the object_apply_compat_props() machinery
right after these classes get selected.

This is actually similar to how things worked before commits
ea9ce8934c5 and b66bbee39f6, except we now register much earlier.  The
old code registered them only after the machine's .instance_init()
ran, which would've broken compatibility properties for any devices
created there.

Cc: Marc-André Lureau <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Marc-André Lureau <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>


  Commit: 617902af2c9203f4bb4112eb384870e248d42ad7
      
https://github.com/qemu/qemu/commit/617902af2c9203f4bb4112eb384870e248d42ad7
  Author: Markus Armbruster <address@hidden>
  Date:   2019-03-11 (Mon, 11 Mar 2019)

  Changed paths:
    M hw/core/qdev.c
    M include/hw/qdev-core.h
    M include/qom/object.h
    M qom/object.c

  Log Message:
  -----------
  qom: Move compat_props machinery from qdev to QOM

See the previous commit for rationale.

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Marc-André Lureau <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>


  Commit: fc4a473482d595da08ae20ce239f0b62fa55d0f2
      
https://github.com/qemu/qemu/commit/fc4a473482d595da08ae20ce239f0b62fa55d0f2
  Author: Markus Armbruster <address@hidden>
  Date:   2019-03-11 (Mon, 11 Mar 2019)

  Changed paths:
    M vl.c

  Log Message:
  -----------
  vl: Fix latent bug with -global and onboard devices

main() registers the user's -global only after we create the machine
object, i.e. too late for devices created in the machine's
.instance_init().

Fortunately, we know the bug is only latent: the commit before
previous fixed a bug that would've crashed any attempt to create a
device in an .instance_init().

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Marc-André Lureau <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>


  Commit: e2fb3fbbf9ce6b8eed00b53a91d3a316362f1b0d
      
https://github.com/qemu/qemu/commit/e2fb3fbbf9ce6b8eed00b53a91d3a316362f1b0d
  Author: Markus Armbruster <address@hidden>
  Date:   2019-03-11 (Mon, 11 Mar 2019)

  Changed paths:
    M hw/core/sysbus.c
    M vl.c

  Log Message:
  -----------
  sysbus: Fix latent bug with onboard devices

The first call of sysbus_get_default() creates the main system bus and
stores it in QOM as "/machine/unattached/sysbus".  This must not
happen before main() creates "/machine", or else container_get() would
"helpfully" create it as "container" object, and the real creation of
"/machine" would later abort with "attempt to add duplicate property
'machine' to object (type 'container')".  Has been that way ever since
we wired up busses in QOM (commit f968fc6892d, v1.2.0).

I believe the bug is latent.  I got it to bite by trying to
qdev_create() a sysbus device from a machine's .instance_init()
method.

The fix is obvious: store the main system bus in QOM right after
creating "/machine".

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Marc-André Lureau <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Reviewed-by: Thomas Huth <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>


  Commit: 651af51c0882a4c60704716819878043c1b8a215
      
https://github.com/qemu/qemu/commit/651af51c0882a4c60704716819878043c1b8a215
  Author: Markus Armbruster <address@hidden>
  Date:   2019-03-11 (Mon, 11 Mar 2019)

  Changed paths:
    M vl.c

  Log Message:
  -----------
  vl: Improve legibility of BlockdevOptions queue

Give the queue head type a name: BlockdevOptionsQueue.

Rename the queue entry type from BlockdevOptions_queue to
BlockdevOptionsQueueEntry.

Signed-off-by: Markus Armbruster <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>


  Commit: d11bf9bf0fd66057aa5e8acb1bbc797419d5a4e6
      
https://github.com/qemu/qemu/commit/d11bf9bf0fd66057aa5e8acb1bbc797419d5a4e6
  Author: Markus Armbruster <address@hidden>
  Date:   2019-03-11 (Mon, 11 Mar 2019)

  Changed paths:
    M vl.c

  Log Message:
  -----------
  vl: Factor configure_blockdev() out of main()

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>


  Commit: cda4aa9a5a08777cf13e164c0543bd4888b8adce
      
https://github.com/qemu/qemu/commit/cda4aa9a5a08777cf13e164c0543bd4888b8adce
  Author: Markus Armbruster <address@hidden>
  Date:   2019-03-11 (Mon, 11 Mar 2019)

  Changed paths:
    M vl.c

  Log Message:
  -----------
  vl: Create block backends before setting machine properties

qemu-system-FOO's main() acts on command line arguments in its own
idiosyncratic order.  There's not much method to its madness.
Whenever we find a case where one kind of command line argument needs
to refer to something created for another kind later, we rejigger the
order.

Block devices get created long after machine properties get processed.
Therefore, block device machine properties can be created, but not
set.  No such properties exist.  But the next commit will create some.
Time to rejigger again: create block devices earlier.

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>


  Commit: e60cf76549a628d63f865fb6faeb1c7c0f390d0b
      
https://github.com/qemu/qemu/commit/e60cf76549a628d63f865fb6faeb1c7c0f390d0b
  Author: Philippe Mathieu-Daudé <address@hidden>
  Date:   2019-03-11 (Mon, 11 Mar 2019)

  Changed paths:
    M hw/block/pflash_cfi01.c
    M include/hw/block/flash.h

  Log Message:
  -----------
  pflash_cfi01: Add pflash_cfi01_get_blk() helper

Add an helper to access the opaque struct PFlashCFI01.

Signed-off-by: Markus Armbruster <address@hidden>
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
Reviewed-by: Laszlo Ersek <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>


  Commit: d6edbe91b98e3e6e0d0185a9c4c3d2e6d6bf0a6b
      
https://github.com/qemu/qemu/commit/d6edbe91b98e3e6e0d0185a9c4c3d2e6d6bf0a6b
  Author: Philippe Mathieu-Daudé <address@hidden>
  Date:   2019-03-11 (Mon, 11 Mar 2019)

  Changed paths:
    M hw/i386/pc_sysfw.c

  Log Message:
  -----------
  pc_sysfw: Remove unused PcSysFwDevice

This structure is not used since commit 6dd2a5c98a.

Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
Reviewed-by: Laszlo Ersek <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>


  Commit: 5e640a9e78ea61c50401a2b11fa144b5f0c217dc
      
https://github.com/qemu/qemu/commit/5e640a9e78ea61c50401a2b11fa144b5f0c217dc
  Author: Philippe Mathieu-Daudé <address@hidden>
  Date:   2019-03-11 (Mon, 11 Mar 2019)

  Changed paths:
    M hw/i386/pc.c
    M hw/i386/pc_sysfw.c
    M include/hw/i386/pc.h

  Log Message:
  -----------
  pc_sysfw: Pass PCMachineState to pc_system_firmware_init()

pc_system_firmware_init() parameter @isapc_ram_fw is PCMachineState
member pci_enabled negated.  The next commit will need more of
PCMachineState.  To prepare for that, pass a PCMachineState *, and
drop the now redundant parameter @isapc_ram_fw.

Signed-off-by: Markus Armbruster <address@hidden>
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
Reviewed-by: Laszlo Ersek <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>


  Commit: ebc29e1beab02646702c8cb9a1d29b68f72ad503
      
https://github.com/qemu/qemu/commit/ebc29e1beab02646702c8cb9a1d29b68f72ad503
  Author: Markus Armbruster <address@hidden>
  Date:   2019-03-11 (Mon, 11 Mar 2019)

  Changed paths:
    M hw/i386/pc.c
    M hw/i386/pc_sysfw.c
    M include/hw/i386/pc.h

  Log Message:
  -----------
  pc: Support firmware configuration with -blockdev

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.  It also makes upgrading
firmware on the host easier.  Below the hood, it creates two separate
flash devices, because we were too lazy to improve our flash device
models to support sector protection.

The problem at hand is to do the same with -blockdev somehow, as one
more step towards deprecating -drive.

Mapping -drive if=none,... to -blockdev is a solved problem.  With
if=T other than if=none, -drive additionally configures a block device
frontend.  For non-onboard devices, that part maps to -device.  Also a
solved problem.  For onboard devices such as PC flash memory, we have
an unsolved problem.

This is actually an instance of a wider problem: our general device
configuration interface doesn't cover onboard devices.  Instead, we have
a zoo of ad hoc interfaces that are much more limited.  One of them is
-drive, which we'd rather deprecate, but can't until we have suitable
replacements for all its uses.

Sadly, I can't attack the wider problem today.  So back to the narrow
problem.

My first idea was to reduce it to its solved buddy by using pluggable
instead of onboard devices for the flash memory.  Workable, but it
requires some extra smarts in firmware descriptors and libvirt.  Paolo
had an idea that is simpler for libvirt: keep the devices onboard, and
add machine properties for their block backends.

The implementation is less than straightforward, I'm afraid.

First, block backend properties are *qdev* properties.  Machines can't
have those, as they're not devices.  I could duplicate these qdev
properties as QOM properties, but I hate that.

More seriously, the properties do not belong to the machine, they
belong to the onboard flash devices.  Adding them to the machine would
then require bad magic to somehow transfer them to the flash devices.
Fortunately, QOM provides the means to handle exactly this case: add
alias properties to the machine that forward to the onboard devices'
properties.

Properties need to be created in .instance_init() methods.  For PC
machines, that's pc_machine_initfn().  To make alias properties work,
we need to create the onboard flash devices there, too.  Requires
several bug fixes, in the previous commits.  We also have to realize
the devices.  More on that below.

If the user sets pflash0, firmware resides in flash memory.
pc_system_firmware_init() maps and realizes the flash devices.

Else, firmware resides in ROM.  The onboard flash devices aren't used
then.  pc_system_firmware_init() destroys them unrealized, along with
the alias properties.

The existing code to pick up drives defined with -drive if=pflash is
replaced by code to desugar into the machine properties.

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Acked-by: Laszlo Ersek <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Message-Id: <address@hidden>


  Commit: e33763be7cd3769c9ae48e67d775348863fdabdb
      
https://github.com/qemu/qemu/commit/e33763be7cd3769c9ae48e67d775348863fdabdb
  Author: Markus Armbruster <address@hidden>
  Date:   2019-03-11 (Mon, 11 Mar 2019)

  Changed paths:
    M docs/interop/firmware.json

  Log Message:
  -----------
  docs/interop/firmware.json: Prefer -machine to if=pflash

The previous commit added a way to configure firmware with -blockdev
rather than -drive if=pflash.  Document it as the preferred way.

Signed-off-by: Markus Armbruster <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Reviewed-by: Laszlo Ersek <address@hidden>


  Commit: eda1df0345f5a1e337e30367124dcb0e802bdfde
      
https://github.com/qemu/qemu/commit/eda1df0345f5a1e337e30367124dcb0e802bdfde
  Author: Peter Maydell <address@hidden>
  Date:   2019-03-12 (Tue, 12 Mar 2019)

  Changed paths:
    M accel/accel.c
    M docs/interop/firmware.json
    M hw/arm/collie.c
    M hw/arm/digic_boards.c
    M hw/arm/gumstix.c
    M hw/arm/mainstone.c
    M hw/arm/musicpal.c
    M hw/arm/omap_sx1.c
    M hw/arm/versatilepb.c
    M hw/arm/vexpress.c
    M hw/arm/virt.c
    M hw/arm/xilinx_zynq.c
    M hw/arm/z2.c
    M hw/block/pflash_cfi01.c
    M hw/block/pflash_cfi02.c
    M hw/core/qdev.c
    M hw/core/sysbus.c
    M hw/i386/pc.c
    M hw/i386/pc_sysfw.c
    M hw/lm32/lm32_boards.c
    M hw/lm32/milkymist.c
    M hw/microblaze/petalogix_ml605_mmu.c
    M hw/microblaze/petalogix_s3adsp1800_mmu.c
    M hw/mips/mips_malta.c
    M hw/mips/mips_r4k.c
    M hw/ppc/ppc405_boards.c
    M hw/ppc/sam460ex.c
    M hw/ppc/virtex_ml507.c
    M hw/sh4/r2d.c
    M hw/xtensa/xtfpga.c
    M include/hw/block/flash.h
    M include/hw/i386/pc.h
    M include/hw/qdev-core.h
    M include/qom/object.h
    M qom/object.c
    M vl.c

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/armbru/tags/pull-pflash-2019-03-11' 
into staging

Pflash and firmware configuration patches for 2019-03-11

# gpg: Signature made Mon 11 Mar 2019 21:59:12 GMT
# gpg:                using RSA key 3870B400EB918653
# gpg: Good signature from "Markus Armbruster <address@hidden>" [full]
# gpg:                 aka "Markus Armbruster <address@hidden>" [full]
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653

* remotes/armbru/tags/pull-pflash-2019-03-11: (27 commits)
  docs/interop/firmware.json: Prefer -machine to if=pflash
  pc: Support firmware configuration with -blockdev
  pc_sysfw: Pass PCMachineState to pc_system_firmware_init()
  pc_sysfw: Remove unused PcSysFwDevice
  pflash_cfi01: Add pflash_cfi01_get_blk() helper
  vl: Create block backends before setting machine properties
  vl: Factor configure_blockdev() out of main()
  vl: Improve legibility of BlockdevOptions queue
  sysbus: Fix latent bug with onboard devices
  vl: Fix latent bug with -global and onboard devices
  qom: Move compat_props machinery from qdev to QOM
  qdev: Fix latent bug with compat_props and onboard devices
  pflash: Clean up after commit 368a354f02b, part 2
  pflash: Clean up after commit 368a354f02b, part 1
  mips_malta: Clean up definition of flash memory size somewhat
  hw/mips/malta: Restrict 'bios_size' variable scope
  hw/mips/malta: Remove fl_sectors variable
  mips_malta: Delete disabled, broken DEBUG_BOARD_INIT code
  r2d: Fix flash memory size, sector size, width, device ID
  ppc405_boards: Don't size flash memory to match backing image
  ...

Signed-off-by: Peter Maydell <address@hidden>


Compare: https://github.com/qemu/qemu/compare/bc76b7148993...eda1df0345f5



reply via email to

[Prev in Thread] Current Thread [Next in Thread]