[Qemu-devel] [RFC 0/4] Replace has_dynamic_sysbus with device type whitelist

Eduardo Habkost posted 4 patches 7 years ago
Failed in applying to current master (apply log)
include/hw/arm/sysbus-fdt.h |  7 +++++++
include/hw/boards.h         |  3 ++-
hw/arm/sysbus-fdt.c         | 10 ++++++++++
hw/arm/virt.c               |  4 +++-
hw/core/machine.c           | 43 +++++++++++++++++++++++++++++--------------
hw/i386/pc_q35.c            | 25 ++++++++++++++++++++++++-
hw/ppc/e500plat.c           |  4 +++-
hw/ppc/spapr.c              |  2 +-
hw/xen/xen_backend.c        | 11 -----------
9 files changed, 79 insertions(+), 30 deletions(-)
[Qemu-devel] [RFC 0/4] Replace has_dynamic_sysbus with device type whitelist
Posted by Eduardo Habkost 7 years ago
Summary
-------

This series replaces the existing has_dynamic_sysbus flag (that
makes the machine accept every single sysbus device type on the
command-line) with a short whitelist.

This will be helpful when implementing the new query-device-slots
command, because each machine type will include only the sysbus
devices it really supports, instead of including a catch-all
TYPE_SYS_BUS_DEVICE "slot".

Most of the machines already have an internal whitelist
implemented using foreach_dynamic_sysbus_device(), so we just
encode the existing behavior inside the new MachineClass field.

Caveat: q35
-----------

The only problematic case is q35, that accepts all sysbus device
types. In this case, instead of adding TYPE_SYS_BUS_DEVICE to the
whitelist, I'm adding the existing list of existing sysbus device
types to keep compatibility. After that, we can gradually and
carefully remove unnecessary entries from the q35 whitelist.

Issue: xen_set_dynamic_sysbus() hack
------------------------------------

We still have an obstacle to get around: the callers of
qdev_set_id() outside qdev_device_add() are breaking
foreach_dynamic_sysbus_device(), and xen_set_dynamic_sysbus() is
a workaround for that bug. We now need to fix that bug to be able
to remove the xen_set_dynamic_sysbus() hack. This means the first
patch of this series will probably break Xen, until we fix that
bug.

Eduardo Habkost (4):
  [UNTESTED] xen: Don't force has_dynamic_sysbus on machine class
  machine: Replace has_dynamic_sysbus with a whitelist
  q35: Remove ioapic devices from sysbus whitelist
  q35: Remove fw_cfg* from sysbus whitelist

 include/hw/arm/sysbus-fdt.h |  7 +++++++
 include/hw/boards.h         |  3 ++-
 hw/arm/sysbus-fdt.c         | 10 ++++++++++
 hw/arm/virt.c               |  4 +++-
 hw/core/machine.c           | 43 +++++++++++++++++++++++++++++--------------
 hw/i386/pc_q35.c            | 25 ++++++++++++++++++++++++-
 hw/ppc/e500plat.c           |  4 +++-
 hw/ppc/spapr.c              |  2 +-
 hw/xen/xen_backend.c        | 11 -----------
 9 files changed, 79 insertions(+), 30 deletions(-)

-- 
2.11.0.259.g40922b1


Re: [Qemu-devel] [RFC 0/4] Replace has_dynamic_sysbus with device type whitelist
Posted by Juergen Gross 7 years ago
On 23/03/17 22:28, Eduardo Habkost wrote:
> Summary
> -------
> 
> This series replaces the existing has_dynamic_sysbus flag (that
> makes the machine accept every single sysbus device type on the
> command-line) with a short whitelist.
> 
> This will be helpful when implementing the new query-device-slots
> command, because each machine type will include only the sysbus
> devices it really supports, instead of including a catch-all
> TYPE_SYS_BUS_DEVICE "slot".
> 
> Most of the machines already have an internal whitelist
> implemented using foreach_dynamic_sysbus_device(), so we just
> encode the existing behavior inside the new MachineClass field.
> 
> Caveat: q35
> -----------
> 
> The only problematic case is q35, that accepts all sysbus device
> types. In this case, instead of adding TYPE_SYS_BUS_DEVICE to the
> whitelist, I'm adding the existing list of existing sysbus device
> types to keep compatibility. After that, we can gradually and
> carefully remove unnecessary entries from the q35 whitelist.
> 
> Issue: xen_set_dynamic_sysbus() hack
> ------------------------------------
> 
> We still have an obstacle to get around: the callers of
> qdev_set_id() outside qdev_device_add() are breaking
> foreach_dynamic_sysbus_device(), and xen_set_dynamic_sysbus() is
> a workaround for that bug. We now need to fix that bug to be able
> to remove the xen_set_dynamic_sysbus() hack. This means the first
> patch of this series will probably break Xen, until we fix that
> bug.
> 
> Eduardo Habkost (4):
>   [UNTESTED] xen: Don't force has_dynamic_sysbus on machine class
>   machine: Replace has_dynamic_sysbus with a whitelist
>   q35: Remove ioapic devices from sysbus whitelist
>   q35: Remove fw_cfg* from sysbus whitelist
> 
>  include/hw/arm/sysbus-fdt.h |  7 +++++++
>  include/hw/boards.h         |  3 ++-
>  hw/arm/sysbus-fdt.c         | 10 ++++++++++
>  hw/arm/virt.c               |  4 +++-
>  hw/core/machine.c           | 43 +++++++++++++++++++++++++++++--------------
>  hw/i386/pc_q35.c            | 25 ++++++++++++++++++++++++-
>  hw/ppc/e500plat.c           |  4 +++-
>  hw/ppc/spapr.c              |  2 +-
>  hw/xen/xen_backend.c        | 11 -----------
>  9 files changed, 79 insertions(+), 30 deletions(-)
> 

This seems to break Xen. I got:

qemu-system-i386: Option '-device xen-backend' cannot be handled by this
machine

when using qemu as Xen backend driver.


Juergen