[PATCH for-8.3 v2 01/46] net: add qemu_{configure,create}_nic_device(), qemu_find_nic_info()

2023-11-06 Thread David Woodhouse
From: David Woodhouse Most code which directly accesses nd_table[] and nb_nics uses them for one of two things. Either "I have created a NIC device and I'd like a configuration for it", or "I will create a NIC device *if* there is a configuration for it". With some var

[PATCH for-8.3 v2 38/46] hw/openrisc/openrisc_sim: use qemu_create_nic_device()

2023-11-06 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse --- hw/openrisc/openrisc_sim.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/hw/openrisc/openrisc_sim.c b/hw/openrisc/openrisc_sim.c index 35da123aef..bffd6f721f 100644 --- a/hw/openrisc

[PATCH for-8.3 v2 16/46] hw/ppc/spapr: use qemu_get_nic_info() and pci_init_nic_devices()

2023-11-06 Thread David Woodhouse
From: David Woodhouse Avoid directly referencing nd_table[] by first instantiating any spapr-vlan devices using a qemu_get_nic_info() loop, then calling pci_init_nic_devices() to do the rest. No functional change intended. Signed-off-by: David Woodhouse --- hw/ppc/spapr.c | 18

[PATCH for-8.3 v2 12/46] hw/mips/fuloong2e: use pci_init_nic_devices()

2023-11-06 Thread David Woodhouse
From: David Woodhouse The previous behaviour was: *if* the first NIC specified on the command line was an RTL8139 (or unspecified model) then it gets assigned to PCI slot 7, which is where the Fuloong board had an RTL8139. All other devices (including the first, if it was specified a anything

[PATCH for-8.3 v2 39/46] hw/riscv: use qemu_configure_nic_device()

2023-11-06 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse --- hw/riscv/microchip_pfsoc.c | 14 ++ hw/riscv/sifive_u.c| 7 +-- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/hw/riscv/microchip_pfsoc.c b/hw/riscv/microchip_pfsoc.c index b775aa8946..7725dfbde5

[PATCH for-8.3 v2 17/46] hw/ppc: use pci_init_nic_devices()

2023-11-06 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse --- hw/ppc/e500.c | 4 +--- hw/ppc/mac_newworld.c | 4 +--- hw/ppc/mac_oldworld.c | 4 +--- hw/ppc/ppc440_bamboo.c | 14 +- 4 files changed, 8 insertions(+), 18 deletions(-) diff --git a/hw/ppc/e500.c b/hw/ppc/e500

[PATCH for-8.3 v2 29/46] hw/arm/stellaris: use qemu_find_nic_info()

2023-11-06 Thread David Woodhouse
From: David Woodhouse Rather than just using qemu_configure_nic_device(), populate the MAC address in the system-registers device by peeking at the NICInfo before it's assigned to the device. Generate the MAC address early, if there is no matching -nic option. Otherwise the MAC address wou

[PATCH for-8.3 v2 10/46] hw/hppa: use pci_init_nic_devices()

2023-11-06 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse --- hw/hppa/machine.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c index 67d4d1b5e0..d7cee6e49e 100644 --- a/hw/hppa/machine.c +++ b/hw/hppa/machine.c @@ -309,7 +309,6

[PATCH for-8.3 v2 27/46] hw/arm/highbank: use qemu_create_nic_device()

2023-11-06 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse --- hw/arm/highbank.c | 12 +--- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c index f12aacea6b..798e5391dc 100644 --- a/hw/arm/highbank.c +++ b/hw/arm/highbank.c @@ -296,19

[PATCH for-8.3 v2 26/46] hw/net/lan9118: use qemu_configure_nic_device()

2023-11-06 Thread David Woodhouse
From: David Woodhouse Some callers instantiate the device unconditionally, others will do so only if there is a NICInfo to go with it. This appears to be fairly random, but preseve the existing behaviour for now. Signed-off-by: David Woodhouse --- hw/arm/kzm.c | 4 ++-- hw/arm

[PATCH for-8.3 v2 33/46] hw/m68k/q800: use qemu_find_nic_info()

2023-11-06 Thread David Woodhouse
From: David Woodhouse If a corresponding NIC configuration was found, it will have a MAC address already assigned, so use that. Else, generate and assign a default one. Using qemu_find_nic_info() is simpler than the alternative of using qemu_configure_nic_device() and then having to fetch the

[PATCH for-8.3 v2 35/46] hw/mips/mipssim: use qemu_create_nic_device()

2023-11-06 Thread David Woodhouse
From: David Woodhouse The MIPS SIM platform instantiates its NIC only if a corresponding configuration exists for it. Use qemu_create_nic_device() function for that. Signed-off-by: David Woodhouse --- hw/mips/mipssim.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff

[PATCH for-8.3 v2 23/46] hw/arm/exynos4: use qemu_create_nic_device()

2023-11-06 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse --- hw/arm/exynos4_boards.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/arm/exynos4_boards.c b/hw/arm/exynos4_boards.c index b0e13eb4f0..003992189b 100644 --- a/hw/arm/exynos4_boards.c +++ b/hw/arm

[PATCH for-8.3 v2 25/46] hw/net/smc91c111: use qemu_configure_nic_device()

2023-11-06 Thread David Woodhouse
From: David Woodhouse Some callers instantiate the device unconditionally, others will do so only if there is a NICInfo to go with it. This appears to be fairly random, but preserve the existing behaviour for now. Signed-off-by: David Woodhouse --- hw/arm/gumstix.c | 6 ++ hw

[PATCH for-8.3 v2 30/46] hw/arm: use qemu_configure_nic_device()

2023-11-06 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse --- hw/arm/mps2-tz.c | 8 ++-- hw/arm/msf2-soc.c| 6 +- hw/arm/musicpal.c| 3 +-- hw/arm/xilinx_zynq.c | 11 --- hw/arm/xlnx-versal.c | 7 +-- hw/arm/xlnx-zynqmp.c | 8 +--- 6 files changed, 10

[PATCH for-8.3 v2 02/46] net: report list of available models according to platform

2023-11-06 Thread David Woodhouse
From: David Woodhouse By noting the models for which a configuration was requested, we can give the user an accurate list of which NIC models were actually available on the platform/configuration that was otherwise chosen. Signed-off-by: David Woodhouse Reviewed-by: Paul Durrant --- net

[PATCH for-8.3 v2 44/46] hw/pci: remove pci_nic_init_nofail()

2023-11-06 Thread David Woodhouse
From: David Woodhouse This function is no longer used. Signed-off-by: David Woodhouse --- hw/pci/pci.c | 72 include/hw/pci/pci.h | 3 -- 2 files changed, 75 deletions(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 5703266c0b

[PATCH for-8.3 v2 18/46] hw/sh4/r2d: use pci_init_nic_devices()

2023-11-06 Thread David Woodhouse
From: David Woodhouse Previously, the first PCI NIC would be assigned to slot 2 even if the user override the model and made it something other than an rtl8139 which is the default. Everything else would be dynamically assigned. Now, the first rtl8139 gets slot 2 and everything else is dynamic

[PATCH for-8.3 v2 09/46] hw/arm/virt: use pci_init_nic_devices()

2023-11-06 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse --- hw/arm/virt.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 92085d2d8f..61706bfcfc 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1481,9 +1481,7 @@ static void create_pcie

[PATCH for-8.3 v2 45/46] net: remove qemu_show_nic_models(), qemu_find_nic_model()

2023-11-06 Thread David Woodhouse
From: David Woodhouse These old functions can be removed now too. Let net_param_nic() print the full set of network devices directly, and also make it note that a list more specific to this platform/config will be available by using '-nic model=help' instead. Signed-off-by: David

[PATCH for-8.3 v2 32/46] hw/m68k/mcf5208: use qemu_create_nic_device()

2023-11-06 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse --- hw/m68k/mcf5208.c | 20 ++-- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/hw/m68k/mcf5208.c b/hw/m68k/mcf5208.c index d22d8536db..c1a5bde571 100644 --- a/hw/m68k/mcf5208.c +++ b/hw/m68k/mcf5208.c

[PATCH for-8.3 v2 22/46] hw/arm/aspeed: use qemu_configure_nic_device()

2023-11-06 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse --- hw/arm/aspeed.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c index cc59176563..bed5e4f40b 100644 --- a/hw/arm/aspeed.c +++ b/hw/arm/aspeed.c @@ -356,7 +356,6 @@ static

[PATCH for-8.3 v2 00/46] Rework matching of network devices to -nic options

2023-11-06 Thread David Woodhouse
now we can make nd_table[] and nb_nics static in net/net.c because nothing else has any business poking at them directly. v2: Some build fixes after better coverage testing, revert the Xen fix in this series because I'm putting the less invasive hack into 8.2 (hopefully). David Woo

[PATCH for-8.3 v2 21/46] hw/arm/allwinner: use qemu_configure_nic_device()

2023-11-06 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse --- hw/arm/allwinner-a10.c | 6 +- hw/arm/allwinner-h3.c | 6 +- hw/arm/allwinner-r40.c | 27 ++- 3 files changed, 4 insertions(+), 35 deletions(-) diff --git a/hw/arm/allwinner-a10.c b/hw/arm/allwinner

[PATCH for-8.3 v2 43/46] net: remove qemu_check_nic_model()

2023-11-06 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse --- include/net/net.h | 1 - net/net.c | 13 - 2 files changed, 14 deletions(-) diff --git a/include/net/net.h b/include/net/net.h index ce830a47d0..1512650190 100644 --- a/include/net/net.h +++ b/include/net/net.h

[PATCH for-8.3 v2 05/46] hw/i386/pc: use qemu_get_nic_info() and pci_init_nic_devices()

2023-11-06 Thread David Woodhouse
From: David Woodhouse Eliminate direct access to nd_table[] and nb_nics by processing the the Xen and ISA NICs first and then calling pci_init_nic_devices() for the rest. Signed-off-by: David Woodhouse Reviewed-by: Paul Durrant --- hw/i386/pc.c| 26

[PATCH for-8.3 v2 06/46] hw/xen: use qemu_create_nic_bus_devices() to instantiate Xen NICs

2023-11-06 Thread David Woodhouse
From: David Woodhouse When instantiating XenBus itself, for each NIC which is configured with either the model unspecified, or set to to "xen" or "xen-net-device", create a corresponding xen-net-device for it. Now we can revert the previous more hackish version which relied

[PATCH for-8.3 v2 41/46] hw/sparc/sun4m: use qemu_find_nic_info()

2023-11-06 Thread David Woodhouse
From: David Woodhouse Obtain the MAC address from the NIC configuration if there is one, or generate one explicitly so that it can be placed in the PROM. Signed-off-by: David Woodhouse --- hw/sparc/sun4m.c | 20 ++-- 1 file changed, 14 insertions(+), 6 deletions(-) diff --git

[PATCH for-8.3 v2 42/46] hw/xtensa/xtfpga: use qemu_create_nic_device()

2023-11-06 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse --- hw/xtensa/xtfpga.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/hw/xtensa/xtfpga.c b/hw/xtensa/xtfpga.c index fbad1c83a3..f49e6591dc 100644 --- a/hw/xtensa/xtfpga.c +++ b/hw/xtensa/xtfpga.c @@ -141,14

[PATCH for-8.3 v2 46/46] net: make nb_nics and nd_table[] static in net/net.c

2023-11-06 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse --- include/net/net.h | 4 net/net.c | 3 +++ system/globals.c | 2 -- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/include/net/net.h b/include/net/net.h index 290e604f03..5a38766942 100644 --- a/include/net

[PATCH for-8.3 v2 31/46] hw/net/etraxfs-eth: use qemu_configure_nic_device()

2023-11-06 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse --- hw/cris/axis_dev88.c | 9 - hw/net/etraxfs_eth.c | 5 ++--- include/hw/cris/etraxfs.h | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/hw/cris/axis_dev88.c b/hw/cris/axis_dev88.c index d82050d927

[PATCH for-8.3 v2 40/46] hw/s390x/s390-virtio-ccw: use qemu_create_nic_device()

2023-11-06 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse --- hw/s390x/s390-virtio-ccw.c | 11 ++- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index 7262725d2e..69d6852840 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b

[PATCH for-8.3 v2 28/46] hw/arm/npcm7xx: use qemu_configure_nic_device, allow emc0/emc1 as aliases

2023-11-06 Thread David Woodhouse
From: David Woodhouse Also update the test to specify which device to attach the test socket to, and remove the comment lamenting the fact that we can't do so. Signed-off-by: David Woodhouse --- hw/arm/npcm7xx.c | 16 +--- tests/qtest/npcm7xx_emc-test.c

[PATCH for-8.3 v2 08/46] hw/arm/sbsa-ref: use pci_init_nic_devices()

2023-11-06 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse Reviewed-by: Leif Lindholm --- hw/arm/sbsa-ref.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c index bce44690e5..7ad8e1fcea 100644 --- a/hw/arm/sbsa-ref.c +++ b/hw/arm/sbsa

[PATCH for-8.3 v2 04/46] hw/pci: add pci_init_nic_devices(), pci_init_nic_in_slot()

2023-11-06 Thread David Woodhouse
From: David Woodhouse The loop over nd_table[] to add PCI NICs is repeated in quite a few places. Add a helper function to do it. Some platforms also try to instantiate a specific model in a specific slot, to match the real hardware. Add pci_init_nic_in_slot() for that purpose. Signed-off-by

[PULL 01/15] i386/xen: Ignore VCPU_SSHOTTMR_future flag in set_singleshot_timer()

2023-11-07 Thread David Woodhouse
From: David Woodhouse Upstream Xen now ignores this flag¹, since the only guest kernel ever to use it was buggy. ¹ https://xenbits.xen.org/gitweb/?p=xen.git;a=commitdiff;h=19c6cbd909 Signed-off-by: David Woodhouse Reviewed-by: Paul Durrant --- target/i386/kvm/xen-emu.c | 20

[PULL 02/15] hw/xen: Clean up event channel 'type_val' handling to use union

2023-11-07 Thread David Woodhouse
From: David Woodhouse A previous implementation of this stuff used a 64-bit field for all of the port information (vcpu/type/type_val) and did atomic exchanges on them. When I implemented that in Qemu I regretted my life choices and just kept it simple with locking instead. So there's no

[PULL 04/15] i386/xen: advertise XEN_HVM_CPUID_UPCALL_VECTOR in CPUID

2023-11-07 Thread David Woodhouse
From: David Woodhouse This will allow Linux guests (since v6.0) to use the per-vCPU upcall vector delivered as MSI through the local APIC. Signed-off-by: David Woodhouse Reviewed-by: Paul Durrant --- target/i386/kvm/kvm.c | 4 1 file changed, 4 insertions(+) diff --git a/target/i386

[PULL 15/15] docs: update Xen-on-KVM documentation

2023-11-07 Thread David Woodhouse
From: David Woodhouse Add notes about console and network support, and how to launch PV guests. Clean up the disk configuration examples now that that's simpler, and remove the comment about IDE unplug on q35/AHCI now that it's fixed. Update the -initrd option documentation to expl

[PULL 09/15] hw/xen: update Xen console to XenDevice model

2023-11-07 Thread David Woodhouse
From: David Woodhouse This allows (non-primary) console devices to be created on the command line and hotplugged. Signed-off-by: David Woodhouse Reviewed-by: Paul Durrant --- hw/char/trace-events| 8 + hw/char/xen_console.c | 532 +++- hw/xen

[PULL 06/15] hw/xen: automatically assign device index to block devices

2023-11-07 Thread David Woodhouse
From: David Woodhouse There's no need to force the user to assign a vdev. We can automatically assign one, starting at xvda and searching until we find the first disk name that's unused. This means we can now allow '-drive if=xen,file=xxx' to work without an explicit separ

[PULL 00/15] xenfv.for-upstream queue

2023-11-07 Thread David Woodhouse
ng the opportunity to simplify what it says about q35 by making unplug work for AHCI. Ignore the VCPU_SSHOTTMR_future timer flag, and advertise the 'fixed' per-vCPU upcall vector support, as newer upstream Xen do. ---- Davi

[PULL 12/15] hw/xen: update Xen PV NIC to XenDevice model

2023-11-07 Thread David Woodhouse
From: David Woodhouse This allows us to use Xen PV networking with emulated Xen guests, and to add them on the command line or hotplug. Signed-off-by: David Woodhouse Reviewed-by: Paul Durrant --- hw/net/meson.build| 2 +- hw/net/trace-events | 11 + hw/net/xen_nic.c

[PULL 11/15] hw/xen: only remove peers of PCI NICs on unplug

2023-11-07 Thread David Woodhouse
From: David Woodhouse When the Xen guest asks to unplug *emulated* NICs, it's kind of unhelpful also to unplug the peer of the *Xen* PV NIC. Signed-off-by: David Woodhouse Reviewed-by: Paul Durrant --- hw/i386/xen/xen_platform.c | 9 +++-- 1 file changed, 7 insertions(+), 2 dele

[PULL 13/15] hw/i386/pc: support '-nic' for xen-net-device

2023-11-07 Thread David Woodhouse
From: David Woodhouse The default NIC creation seems a bit hackish to me. I don't understand why each platform has to call pci_nic_init_nofail() from a point in the code where it actually has a pointer to the PCI bus, and then we have the special cases for things like ne2k_isa

[PULL 05/15] hw/xen: populate store frontend nodes with XenStore PFN/port

2023-11-07 Thread David Woodhouse
From: David Woodhouse This is kind of redundant since without being able to get these through some other method (HVMOP_get_param) the guest wouldn't be able to access XenStore in order to find them. Signed-off-by: David Woodhouse Reviewed-by: Paul Durrant --- hw/i386/kvm/xen_xenstore.c

[PULL 10/15] hw/xen: add support for Xen primary console in emulated mode

2023-11-07 Thread David Woodhouse
From: David Woodhouse The primary console is special because the toolstack maps a page into the guest for its ring, and also allocates the guest-side event channel. The guest's grant table is even primed to export that page using a known grant ref#. Add support for all that in emulated mod

[PULL 07/15] hw/xen: add get_frontend_path() method to XenDeviceClass

2023-11-07 Thread David Woodhouse
From: David Woodhouse The primary Xen console is special. The guest's side is set up for it by the toolstack automatically and not by the standard PV init sequence. Accordingly, its *frontend* doesn't appear in …/device/console/0 either; instead it appears under …/console in t

[PULL 14/15] xen-platform: unplug AHCI disks

2023-11-07 Thread David Woodhouse
From: David Woodhouse To support Xen guests using the Q35 chipset, the unplug protocol needs to also remove AHCI disks. Make pci_xen_ide_unplug() more generic, iterating over the children of the PCI device and destroying the "ide-hd" devices. That works the same for both AHCI and ID

[PULL 03/15] include: update Xen public headers to Xen 4.17.2 release

2023-11-07 Thread David Woodhouse
From: David Woodhouse ... in order to advertise the XEN_HVM_CPUID_UPCALL_VECTOR feature, which will come in a subsequent commit. Signed-off-by: David Woodhouse Acked-by: Paul Durrant --- hw/i386/kvm/xen_xenstore.c| 2 +- include/hw/xen/interface/arch-arm.h | 37

[PULL 08/15] hw/xen: do not repeatedly try to create a failing backend device

2023-11-07 Thread David Woodhouse
From: David Woodhouse If xen_backend_device_create() fails to instantiate a device, the XenBus code will just keep trying over and over again each time the bus is re-enumerated, as long as the backend appears online and in XenbusStateInitialising. The only thing which prevents the XenBus code

Re: [PATCH v4 16/17] doc/sphinx/hxtool.py: add optional label argument to SRST directive

2023-11-07 Thread David Woodhouse
On Mon, 2023-11-06 at 14:35 +, David Woodhouse wrote: > From: David Woodhouse > > We can't just embed labels directly into files like qemu-options.hx which > are included from multiple top-level RST files, because Sphinx sees the > labels as duplicate: https://github.c

Re: [PATCH v4 14/17] net: do not delete nics in net_cleanup()

2023-11-07 Thread David Woodhouse
On Mon, 2023-11-06 at 14:35 +, David Woodhouse wrote: > From: David Woodhouse > > In net_cleanup() we only need to delete the netdevs, as those may have > state which outlives Qemu when it exits, and thus may actually need to > be cleaned up on exit. > > The nics, o

Re: [PULL 06/15] hw/xen: automatically assign device index to block devices

2023-11-09 Thread David Woodhouse
On Thu, 2023-11-09 at 14:33 +, Peter Maydell wrote: > On Tue, 7 Nov 2023 at 09:24, David Woodhouse wrote: > > > > From: David Woodhouse > > > > There's no need to force the user to assign a vdev. We can automatically > > assign one, starting at xvda

[PATCH] hw/xen: clean up xen_block_find_free_vdev() to avoid Coverity false positive

2023-11-09 Thread David Woodhouse
From: David Woodhouse Coverity couldn't see that nr_existing was always going to be zero when qemu_xen_xs_directory() returned NULL in the ENOENT case (CID 1523906). Perhaps more to the point, neither could Peter at first glance. Improve the code to hopefully make it clearer to Coverit

Re: [PATCH] include/hw/xen: Use more inclusive language in comment

2023-11-10 Thread David Woodhouse
On Thu, 2023-11-09 at 18:40 +0100, Thomas Huth wrote: > Let's improve the wording here. > > Signed-off-by: Thomas Huth Absolutely, but please can we change it in Xen first because these headers are a direct import. Acked-by: David Woodhouse > --- >  include/hw/xen/interf

Re: [PATCH for-8.3 v2 04/46] hw/pci: add pci_init_nic_devices(), pci_init_nic_in_slot()

2023-11-10 Thread David Woodhouse
On Fri, 2023-11-10 at 08:31 +0100, Philippe Mathieu-Daudé wrote: > > > +    pci_dev = pci_new(devfn, model); > > +    qdev_set_nic_properties(&pci_dev->qdev, nd); > > +    pci_realize_and_unref(pci_dev, bus, &error_fatal); > > Could these functions be used with hotplug devices? > > If so we shou

Re: [PATCH for-8.3 v2 05/46] hw/i386/pc: use qemu_get_nic_info() and pci_init_nic_devices()

2023-11-10 Thread David Woodhouse
On Fri, 2023-11-10 at 08:40 +0100, Philippe Mathieu-Daudé wrote: > Hi David, > > +Markus/Bernhard > > On 6/11/23 20:49, David Woodhouse wrote: > > From: David Woodhouse > > > > Eliminate direct access to nd_table[] and nb_nics by processing the the > >

Re: [PATCH] include/hw/xen: Use more inclusive language in comment

2023-11-10 Thread David Woodhouse
On Fri, 2023-11-10 at 10:30 +0100, Jan Beulich wrote: > On 09.11.2023 18:40, Thomas Huth wrote: > > --- a/include/hw/xen/interface/hvm/params.h > > +++ b/include/hw/xen/interface/hvm/params.h > > @@ -255,7 +255,7 @@ > >   * Note that 'mixed' mode has not been evaluated for safety from a > >   * sec

Re: [PATCH v1 1/7] xen-block: Do not write frontend nodes

2023-11-11 Thread David Woodhouse
On Fri, 2023-11-10 at 20:42 +, Volodymyr Babchuk wrote: > From: Oleksandr Tyshchenko > > The PV backend running in other than Dom0 domain (non toolstack domain) > is not allowed to write frontend nodes. The more, the backend does not > need to do that at all, this is purely toolstack/xl devd

Re: [PATCH v1 3/7] xen: xenstore: add possibility to preserve owner

2023-11-11 Thread David Woodhouse
On Fri, 2023-11-10 at 20:42 +, Volodymyr Babchuk wrote: > Add option to preserve owner when creating an entry in Xen Store. This > may be needed in cases when Qemu is working as device model in a > domain that is Domain-0, e.g. in driver domain. > > "owner" parameter for qemu_xen_xs_create() f

Re: [PATCH v1 5/7] xen-bus: Set offline if backend's state is XenbusStateClosed

2023-11-11 Thread David Woodhouse
(When sending a series, if you Cc someone on one message please could you Cc them on the whole thread for context? Thanks.) > Both state (XenbusStateClosed) and online (0) are expected by > toolstack/xl devd to completely destroy the device. But "offline" > is never being set by the backend resul

Re: [PATCH v1 1/7] xen-block: Do not write frontend nodes

2023-11-11 Thread David Woodhouse
On 11 November 2023 08:43:40 GMT-05:00, Andrew Cooper wrote: >Furthermore, the control domain doesn't always have the domid of 0. > >If qemu wants/needs to make changes like this, the control domain has to >arrange for qemu's domain to have appropriate permissions on the nodes. Right. And that's

Re: [PATCH v1 1/7] xen-block: Do not write frontend nodes

2023-11-11 Thread David Woodhouse
On 11 November 2023 16:51:22 GMT-05:00, Andrew Cooper wrote: >On 11/11/2023 8:18 pm, David Woodhouse wrote: >> On 11 November 2023 08:43:40 GMT-05:00, Andrew Cooper >> wrote: >>> Furthermore, the control domain doesn't always have the domid of 0. >>> &

Re: [PATCH v1 4/7] xen_pvdev: Do not assume Dom0 when creating a directrory

2023-11-12 Thread David Woodhouse
On Fri, 2023-11-10 at 20:42 +, Volodymyr Babchuk wrote: > From: Oleksandr Tyshchenko > > Instead of forcing the owner to domid 0, use XS_PRESERVE_OWNER to save > the previous owner of the directory. > You're missing the words "... if it already exists" from that sentence. If the directory

Re: [PATCH v1 3/7] xen: xenstore: add possibility to preserve owner

2023-11-12 Thread David Woodhouse
On Sat, 2023-11-11 at 11:01 +, David Woodhouse wrote: > > > --- a/hw/xen/xen-operations.c > > +++ b/hw/xen/xen-operations.c > > @@ -300,6 +300,18 @@ static bool libxenstore_create(struct qemu_xs_handle > > *h, xs_transaction_t t, > > return false; &g

Re: [PATCH v1 2/7] xen-bus: Do not destroy frontend/backend directories

2023-11-12 Thread David Woodhouse
MU created itself. Then your patch to which I'm replying, and other parts of the code which create the nodes in xen_device_realize() and elsewhere, can use 'if (xendev->backend)' as the condition for whether to make the changes in XenStore. From 99ab85e8c766d0bb9c3ac556172208db8c69a3d7

Re: [PATCH v1 7/7] xen_arm: Add basic virtio-pci support

2023-11-12 Thread David Woodhouse
On Fri, 2023-11-10 at 20:42 +, Volodymyr Babchuk wrote: > From: Oleksandr Tyshchenko > > This patch adds basic virtio-pci support for xen_arm machine. Why only xen_arm? Couldn't this be a fairly generic device which can be instantiated on x86 too, both for real and emulated Xen guests? And r

Re: [PATCH-for-9.0 04/10] hw/xen: Factor xen_arch_align_ioreq_data() out of handle_ioreq()

2023-11-13 Thread David Woodhouse
On Mon, 2023-11-13 at 17:09 +0100, Philippe Mathieu-Daudé wrote: > On 13/11/23 16:58, Woodhouse, David wrote: > > On 13 Nov 2023 10:22, Philippe Mathieu-Daudé > > wrote: > > > >     Per commit f17068c1c7 ("xen-hvm: reorganize xen-hvm and move > > common > >     function to xen-hvm-common"), handl

Re: [PATCH-for-9.0 02/10] hw/xen/xen_arch_hvm: Rename prototypes using 'xen_arch_' prefix

2023-11-13 Thread David Woodhouse
On Mon, 2023-11-13 at 16:21 +0100, Philippe Mathieu-Daudé wrote: > Use a common 'xen_arch_' prefix for architecture-specific functions. > Rename xen_arch_set_memory() and xen_arch_handle_ioreq(). > > Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: David Woodhouse sm

Re: [PATCH-for-9.0 03/10] hw/xen: Merge 'hw/xen/arch_hvm.h' in 'hw/xen/xen-hvm-common.h'

2023-11-13 Thread David Woodhouse
pe Mathieu-Daudé Reviewed-by: David Woodhouse smime.p7s Description: S/MIME cryptographic signature

Re: [PATCH-for-9.0 04/10] hw/xen: Factor xen_arch_align_ioreq_data() out of handle_ioreq()

2023-11-13 Thread David Woodhouse
icitly state 'No function change intended', and on that basis: Reviewed-by: David Woodhouse But... > --- a/hw/i386/xen/xen-hvm.c > +++ b/hw/i386/xen/xen-hvm.c > @@ -699,6 +699,14 @@ void xen_arch_set_memory(XenIOState *state, > MemoryRegionSection *section, > } &g

Re: [PATCH-for-9.0 05/10] hw/xen: Use target-agnostic qemu_target_page_bits()

2023-11-13 Thread David Woodhouse
On Mon, 2023-11-13 at 16:21 +0100, Philippe Mathieu-Daudé wrote: > Instead of the target-specific TARGET_PAGE_BITS definition, > use qemu_target_page_bits() which is target agnostic. > > Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: David Woodhouse smime.p7s Descrip

Re: [PATCH-for-9.0 06/10] hw/xen: Reduce inclusion of 'cpu.h' to target-specific sources

2023-11-13 Thread David Woodhouse
; remove from the "hw/xen/xen-hvm-common.h" *common* header. > > Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: David Woodhouse smime.p7s Description: S/MIME cryptographic signature

Re: [PATCH-for-9.0 07/10] sysemu/xen-mapcache: Check Xen availability with CONFIG_XEN_IS_POSSIBLE

2023-11-13 Thread David Woodhouse
hilippe Mathieu-Daudé Noting that CONFIG_XEN_IS_POSSIBLE is for Xen accelerator support, and may not be set in all cases when we're hosting Xen-compatible guests, Reviewed-by: David Woodhouse smime.p7s Description: S/MIME cryptographic signature

Re: [PATCH-for-9.0 08/10] system/physmem: Only include 'hw/xen/xen.h' when Xen is available

2023-11-13 Thread David Woodhouse
On Mon, 2023-11-13 at 16:21 +0100, Philippe Mathieu-Daudé wrote: > "hw/xen/xen.h" contains declarations for Xen hardware. There is > no point including it when Xen is not available. ... if even when Xen *is* available, AFAICT. Can you just remove the inclusion of hw/xen/xen.h entirely? I think tha

Re: [PATCH-for-9.0 09/10] hw/xen: Extract 'xen_igd.h' from 'xen_pt.h'

2023-11-13 Thread David Woodhouse
that, extract > these methos into a new "hw/xen/xen_igd.h" header. > > Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: David Woodhouse > --- > What license for the new "hw/xen/xen_igd.h" header? The existing xen_pt.h came in with xen_pt.c (GPLv2) in

Re: [PATCH-for-9.0 10/10] hw/xen: Have most of Xen files become target-agnostic

2023-11-13 Thread David Woodhouse
On Mon, 2023-11-13 at 16:21 +0100, Philippe Mathieu-Daudé wrote: > Previous commits re-organized the target-specific bits > from Xen files. We can now build the common files once > instead of per-target. > > Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: David Woodhous

Re: [PATCH-for-9.0 01/10] sysemu/xen: Forbid using Xen headers in user emulation

2023-11-13 Thread David Woodhouse
On Mon, 2023-11-13 at 16:21 +0100, Philippe Mathieu-Daudé wrote: > Xen is a system specific accelerator, it makes no sense > to include its headers in user emulation. > > Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: David Woodhouse smime.p7s Description: S/MIME c

Re: [PATCH-for-9.0 07/10] sysemu/xen-mapcache: Check Xen availability with CONFIG_XEN_IS_POSSIBLE

2023-11-14 Thread David Woodhouse
On Tue, 2023-11-14 at 13:25 +0100, Philippe Mathieu-Daudé wrote: > > As is CONFIG_XEN. > > Maybe be worth renaming CONFIG_ACCEL_XEN if you think we need > guest hw specific CONFIG_foo_XEN variables. I don't think so. We have CONFIG_XEN_BUS and CONFIG_XEN_EMU (from commit 820c1aba519b) which I th

Re: [PATCH-for-9.0 04/10] hw/xen: Factor xen_arch_align_ioreq_data() out of handle_ioreq()

2023-11-14 Thread David Woodhouse
On Tue, 2023-11-14 at 08:58 +0100, Philippe Mathieu-Daudé wrote: > > > Reviewing quickly hw/block/dataplane/xen-block.c, this code doesn't > > > seem target specific at all IMHO. Otherwise I'd really expect it to > > > fail compiling. But I don't know much about Xen, so I'll let block & > > > xen e

Re: [PATCH-for-9.0 v2 01/19] tests/avocado: Add 'guest:xen' tag to tests running Xen guest

2023-11-14 Thread David Woodhouse
On 14 November 2023 09:37:57 GMT-05:00, "Philippe Mathieu-Daudé" wrote: >Add a tag to run all Xen-specific tests using: > > $ make check-avocado AVOCADO_TAGS='guest:xen' > >Signed-off-by: Philippe Mathieu-Daudé >--- > tests/avocado/boot_xen.py | 3 +++ > tests/avocado/kvm_xen_guest.py | 1 +

Re: [PATCH-for-9.0 v2 04/19] system/physmem: Do not include 'hw/xen/xen.h' but 'sysemu/xen.h'

2023-11-14 Thread David Woodhouse
On 14 November 2023 09:38:00 GMT-05:00, "Philippe Mathieu-Daudé" wrote: >physmem.c doesn't use any declaration from "hw/xen/xen.h", >it only requires "sysemu/xen.h" and "system/xen-mapcache.h". > >Suggested-by: David Woodhouse &g

Re: [PATCH-for-9.0 v2 01/19] tests/avocado: Add 'guest:xen' tag to tests running Xen guest

2023-11-14 Thread David Woodhouse
On 14 November 2023 10:00:09 GMT-05:00, "Philippe Mathieu-Daudé" wrote: >On 14/11/23 15:50, David Woodhouse wrote: >> On 14 November 2023 09:37:57 GMT-05:00, "Philippe Mathieu-Daudé" >> wrote: >>> Add a tag to run all Xen-specific tests using:

Re: [PATCH-for-9.0 v2 06/19] hw/pci/msi: Restrict xen_is_pirq_msi() call to Xen

2023-11-14 Thread David Woodhouse
On 14 November 2023 09:38:02 GMT-05:00, "Philippe Mathieu-Daudé" wrote: >Similarly to the restriction in hw/pci/msix.c (see commit >e1e4bf2252 "msix: fix msix_vector_masked"), restrict the >xen_is_pirq_msi() call in msi_is_masked() to Xen. > >Signed-off-by: Philippe Mathieu-Daudé Hm, we do also

Re: [PATCH-for-9.0 v2 01/19] tests/avocado: Add 'guest:xen' tag to tests running Xen guest

2023-11-14 Thread David Woodhouse
On 14 November 2023 10:13:14 GMT-05:00, "Philippe Mathieu-Daudé" wrote: >On 14/11/23 16:08, David Woodhouse wrote: >> On 14 November 2023 10:00:09 GMT-05:00, "Philippe Mathieu-Daudé" >> wrote: >>> On 14/11/23 15:50, David Woodhouse wrote: >>&g

Re: [PATCH-for-9.0 v2 07/19] hw/xen: Remove unnecessary xen_hvm_inject_msi() stub

2023-11-14 Thread David Woodhouse
On 14 November 2023 09:38:03 GMT-05:00, "Philippe Mathieu-Daudé" wrote: >Since commit 04b0de0ee8 ("xen: factor out common functions") >xen_hvm_inject_msi() stub is not required. > >Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: David Woodhouse

Re: [RFC PATCH-for-9.0 v2 09/19] hw/block/xen_blkif: Align structs with QEMU_ALIGNED() instead of #pragma

2023-11-14 Thread David Woodhouse
On 14 November 2023 09:38:05 GMT-05:00, "Philippe Mathieu-Daudé" wrote: >Except imported source files, QEMU code base uses >the QEMU_ALIGNED() macro to align its structures. > >Signed-off-by: Philippe Mathieu-Daudé Can we have a BUILD_BUG_ON(sizeof==) for these please?

Re: [PATCH-for-9.0 v2 06/19] hw/pci/msi: Restrict xen_is_pirq_msi() call to Xen

2023-11-14 Thread David Woodhouse
On 14 November 2023 10:22:23 GMT-05:00, "Philippe Mathieu-Daudé" wrote: >On 14/11/23 16:13, David Woodhouse wrote: >> On 14 November 2023 09:38:02 GMT-05:00, "Philippe Mathieu-Daudé" >> wrote: >>> Similarly to the restriction in hw/pci/

Re: [PATCH-for-9.0 v2 10/19] hw/xen: Rename 'ram_memory' global variable as 'xen_memory'

2023-11-14 Thread David Woodhouse
K, but aren't you going to be coming back later to eliminate global variables which are actually per-VM? Or is that the point, because *then* the conflicting name will actually matter? Reviewed-by: David Woodhouse

Re: [PATCH-for-9.0 v2 16/19] hw/xen/xen_pt: Add missing license

2023-11-14 Thread David Woodhouse
On 14 November 2023 09:38:12 GMT-05:00, "Philippe Mathieu-Daudé" wrote: >Commit eaab4d60d3 ("Introduce Xen PCI Passthrough, qdevice") >introduced both xen_pt.[ch], but only added the license to >xen_pt.c. Use the same license for xen_pt.h. > >Suggested-

Re: [PATCH-for-9.0 v2 18/19] hw/i386/xen: Compile 'xen-hvm.c' with Xen CPPFLAGS

2023-11-14 Thread David Woodhouse
On 14 November 2023 09:38:14 GMT-05:00, "Philippe Mathieu-Daudé" wrote: >xen-hvm.c calls xc_set_hvm_param() from , >so better compile it with Xen CPPFLAGS. > >Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: David Woodhouse

Re: [PATCH-for-9.0 v2 06/19] hw/pci/msi: Restrict xen_is_pirq_msi() call to Xen

2023-11-14 Thread David Woodhouse
On Tue, 2023-11-14 at 16:22 +0100, Philippe Mathieu-Daudé wrote: > > If so, possibly few places incorrectly check 'xen_enabled()' > instead of this 'xen_guest()'. Sorry, I meant to respond to that one directly. I don't *think* there are any cases of that. As I added the CONFIG_XEN_EMU support, I

Re: [PATCH-for-9.0 v2 06/19] hw/pci/msi: Restrict xen_is_pirq_msi() call to Xen

2023-11-14 Thread David Woodhouse
On Tue, 2023-11-14 at 10:44 -0500, David Woodhouse wrote: > > I believe that if you push your branch to a gitlab tree with the > right CI variables defined, it'll run all the CI? And I *hope* it > fails with this patch. It's precisely the kind of thing I was > *int

Re: [PATCH v1 1/7] xen-block: Do not write frontend nodes

2023-11-14 Thread David Woodhouse
On Tue, 2023-11-14 at 21:32 +, Volodymyr Babchuk wrote: > > > I think we want to kill the xen_backend_set_device() function and > > instead set the backend as a property of the XenDevice *before* > > realizing it. > > Not sure that I got this. Right now device is property of > XenBackendInsta

[PATCH 2/3] vl: disable default serial when xen-console is enabled

2023-11-15 Thread David Woodhouse
From: David Woodhouse If a Xen console is configured on the command line, do not add a default serial port. Signed-off-by: David Woodhouse --- system/vl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/system/vl.c b/system/vl.c index 5af7ced2a1..8109231834 100644 --- a/system/vl.c +++ b

[PATCH 1/3] net: do not delete nics in net_cleanup()

2023-11-15 Thread David Woodhouse
From: David Woodhouse In net_cleanup() we only need to delete the netdevs, as those may have state which outlives Qemu when it exits, and thus may actually need to be cleaned up on exit. The nics, on the other hand, are owned by the device which created them. Most devices don't bother to

[PATCH 3/3] hw/xen: clean up xen_block_find_free_vdev() to avoid Coverity false positive

2023-11-15 Thread David Woodhouse
From: David Woodhouse Coverity couldn't see that nr_existing was always going to be zero when qemu_xen_xs_directory() returned NULL in the ENOENT case (CID 1523906). Perhaps more to the point, neither could Peter at first glance. Improve the code to hopefully make it clearer to Coverit

[PATCH 0/3] Misc fixes for 8.2

2023-11-15 Thread David Woodhouse
Fix a use-after-free (or double-free) due to net_cleanup() freeing NICs that don't belong to it, fix a newly-introduced launch failure with a documented command line, and clean up code to avoid a Coverity warning. David Woodhouse (3): net: do not delete nics in net_cleanup()

Re: [PATCH] acpi_idle: use raw_safe_halt() from acpi_idle_play_dead()

2023-11-20 Thread David Woodhouse
On Fri, 2023-10-27 at 21:14 +0200, Peter Zijlstra wrote: > On Fri, Oct 27, 2023 at 07:36:51PM +0100, David Woodhouse wrote: > > From: David Woodhouse > > > > Xen HVM guests were observed taking triple-faults when attempting to > > online a previously offlined vCPU. &g

<    2   3   4   5   6   7   8   9   10   >