virtio,pc,pci: features, cleanups, fixes
Subsystems (3)
The following changes since commit c15dc499cc22f4a71639e42e36051e118761c25f:
Merge tag 'pull-misc-20221218' of https://gitlab.com/rth7680/qemu into staging (2022-12-19 10:28:57 +0000)
are available in the Git repository at:
https://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream
for you to fetch changes up to 87d67ffe4f7e4faad9fa5bc7129ca91d314677ed:
contrib/vhost-user-blk: Replace lseek64 with lseek (2022-12-21 07:32:24 -0500)
----------------------------------------------------------------
virtio,pc,pci: features, cleanups, fixes
make TCO watchdog work by default part of generic vdpa support asid interrupt for vhost-vdpa added flex bus port DVSEC for cxl
misc fixes, cleanups, documentation
----------------------------------------------------------------
Alex Bennée (1):
include/hw: attempt to document VirtIO feature variables
Ani Sinha (3):
acpi/tests/avocado/bits: add SPDX license identifiers for bios bits tests docs/acpi/bits: document BITS_DEBUG environment variable acpi/tests/avocado/bits: add mformat as one of the dependencies
Cornelia Huck (2):
hw: Add compat machines for 8.0
pc: clean up compat machines
Daniel P. Berrangé (5):
hw/acpi: add trace events for TCO watchdog register access hw/isa: add trace events for ICH9 LPC chip config access hw/watchdog: add trace events for watchdog action handling hw/isa: enable TCO watchdog reboot pin strap by default
ich9: honour 'enable_tco' property
Eugenio Pérez (12):
vdpa: use v->shadow_vqs_enabled in vhost_vdpa_svqs_start & stop
vhost: set SVQ device call handler at SVQ start
vhost: allocate SVQ device file descriptors at device start
vhost: move iova_tree set to vhost_svq_start
vdpa: add vhost_vdpa_net_valid_svq_features
vdpa: request iova_range only once
vdpa: move SVQ vring features check to net/
vdpa: allocate SVQ array unconditionally
vdpa: add asid parameter to vhost_vdpa_dma_map/unmap
vdpa: store x-svq parameter in VhostVDPAState
vdpa: add shadow_data to vhost_vdpa
vdpa: always start CVQ in SVQ mode if possible
Igor Mammedov (2):
remove DEC 21154 PCI bridge
pci: drop redundant PCIDeviceClass::is_bridge field
Ira Weiny (1):
hw/cxl/device: Add Flex Bus Port DVSEC
Jason Wang (1):
vhost: fix vq dirty bitmap syncing when vIOMMU is enabled
Khem Raj (1):
contrib/vhost-user-blk: Replace lseek64 with lseek
Longpeng (Mike) (4):
virtio: get class_id and pci device id by the virtio id
vdpa: add vdpa-dev support
vdpa: add vdpa-dev-pci support
vdpa-dev: mark the device as unmigratable
Marcel Holtmann (1):
libvhost-user: Switch to unsigned int for inuse field in struct VuVirtq
Philippe Mathieu-Daudé (7):
hw/acpi: Rename tco.c -> ich9_tco.c
hw/virtio: Add missing "hw/core/cpu.h" include
hw/virtio: Rename virtio_ss[] -> specific_virtio_ss[]
hw/virtio: Guard and restrict scope of qmp_virtio_feature_map_t[]
hw/virtio: Constify qmp_virtio_feature_map_t[]
hw/virtio: Extract config read/write accessors to virtio-config-io.c
hw/virtio: Extract QMP related code virtio-qmp.cYajun Wu (1):
vhost-user: send set log base message only once
hw/pci-bridge/dec.h | 9 -
hw/virtio/vhost-shadow-virtqueue.h | 5 +-
hw/virtio/virtio-qmp.h | 20 +
include/hw/acpi/ich9.h | 2 +-
include/hw/acpi/{tco.h => ich9_tco.h} | 2 +-
include/hw/boards.h | 3 +
include/hw/i386/pc.h | 3 +
include/hw/pci/pci.h | 10 +-
include/hw/pci/pci_bridge.h | 1 +
include/hw/pci/pci_ids.h | 1 -
include/hw/virtio/vdpa-dev.h | 43 ++
include/hw/virtio/vhost-vdpa.h | 16 +-
include/hw/virtio/vhost.h | 25 +-
include/hw/virtio/virtio-pci.h | 5 +
include/hw/virtio/virtio.h | 19 +-
subprojects/libvhost-user/libvhost-user.h | 2 +-
contrib/vhost-user-blk/vhost-user-blk.c | 4 +-
hw/acpi/ich9.c | 8 +-
hw/acpi/{tco.c => ich9_tco.c} | 43 +-
hw/acpi/pcihp.c | 3 +-
hw/arm/virt.c | 11 +-
hw/core/machine.c | 3 +
hw/i386/acpi-build.c | 5 +-
hw/i386/pc.c | 5 +
hw/i386/pc_piix.c | 41 +-
hw/i386/pc_q35.c | 29 +-
hw/isa/lpc_ich9.c | 5 +-
hw/m68k/virt.c | 11 +-
hw/mem/cxl_type3.c | 11 +
hw/pci-bridge/cxl_downstream.c | 1 -
hw/pci-bridge/cxl_upstream.c | 1 -
hw/pci-bridge/dec.c | 164 -----
hw/pci-bridge/i82801b11.c | 1 -
hw/pci-bridge/pci_bridge_dev.c | 1 -
hw/pci-bridge/pcie_pci_bridge.c | 1 -
hw/pci-bridge/pcie_root_port.c | 1 -
hw/pci-bridge/simba.c | 1 -
hw/pci-bridge/xio3130_downstream.c | 1 -
hw/pci-bridge/xio3130_upstream.c | 1 -
hw/pci-host/designware.c | 1 -
hw/pci-host/uninorth.c | 9 +-
hw/pci-host/xilinx-pcie.c | 1 -
hw/pci/pci.c | 20 +-
hw/ppc/spapr.c | 17 +-
hw/ppc/spapr_pci.c | 15 +-
hw/s390x/s390-virtio-ccw.c | 14 +-
hw/virtio/vdpa-dev-pci.c | 102 +++
hw/virtio/vdpa-dev.c | 377 +++++++++++
hw/virtio/vhost-shadow-virtqueue.c | 44 +-
hw/virtio/vhost-user.c | 5 +
hw/virtio/vhost-vdpa.c | 140 ++--
hw/virtio/vhost.c | 84 ++-
hw/virtio/virtio-config-io.c | 204 ++++++
hw/virtio/virtio-pci.c | 88 +++
hw/virtio/virtio-qmp.c | 659 +++++++++++++++++++
hw/virtio/virtio.c | 798 +----------------------
hw/watchdog/watchdog.c | 4 +
net/vhost-vdpa.c | 174 ++++-
tests/qtest/tco-test.c | 4 +-
MAINTAINERS | 4 +-
docs/devel/acpi-bits.rst | 3 +
hw/acpi/meson.build | 2 +-
hw/acpi/trace-events | 2 +
hw/isa/trace-events | 4 +
hw/pci-bridge/meson.build | 2 -
hw/virtio/Kconfig | 5 +
hw/virtio/meson.build | 44 +-
hw/virtio/trace-events | 4 +-
hw/watchdog/trace-events | 4 +
tests/avocado/acpi-bits.py | 2 +-
tests/avocado/acpi-bits/bits-tests/smbios.py2 | 4 +
tests/avocado/acpi-bits/bits-tests/testacpi.py2 | 4 +
tests/avocado/acpi-bits/bits-tests/testcpuid.py2 | 4 +
73 files changed, 2074 insertions(+), 1292 deletions(-)
delete mode 100644 hw/pci-bridge/dec.h
create mode 100644 hw/virtio/virtio-qmp.h
rename include/hw/acpi/{tco.h => ich9_tco.h} (97%)
create mode 100644 include/hw/virtio/vdpa-dev.h
rename hw/acpi/{tco.c => ich9_tco.c} (91%)
delete mode 100644 hw/pci-bridge/dec.c
create mode 100644 hw/virtio/vdpa-dev-pci.c
create mode 100644 hw/virtio/vdpa-dev.c
create mode 100644 hw/virtio/virtio-config-io.c
create mode 100644 hw/virtio/virtio-qmp.c[PULL 01/41] hw/acpi: add trace events for TCO watchdog register access
From: Daniel P. Berrangé <[email protected]>
These tracepoints aid in understanding and debugging the guest drivers for the TCO watchdog.
Message-Id: <[email protected]>
--- hw/acpi/tco.c | 41 ++++++++++++++++++++++++++++------------- hw/acpi/trace-events | 2 ++ 2 files changed, 30 insertions(+), 13 deletions(-)
hw/acpi/tco.c +28 -13
@@ -86,6 +86,7 @@ static inline int can_start_tco_timer(TCOIORegs *tr)static uint32_t tco_ioport_readw (TCOIORegs *tr,uint32_t addr) {uint16_t rld; +uint32_t ret =0 ;switch (addr) {case TCO_RLD :
@@ -96,35 +97,49 @@ static uint32_t tco_ioport_readw(TCOIORegs *tr, uint32_t addr) }else { rld = tr->tco.rld; } -return rld; + ret = rld; +break ;case TCO_DAT_IN : -return tr->tco.din; + ret = tr->tco.din; +break ;case TCO_DAT_OUT : -return tr->tco.dout; + ret = tr->tco.dout; +break ;case TCO1_STS : -return tr->tco.sts1; + ret = tr->tco.sts1; +break ;case TCO2_STS : -return tr->tco.sts2; + ret = tr->tco.sts2; +break ;case TCO1_CNT : -return tr->tco.cnt1; + ret = tr->tco.cnt1; +break ;case TCO2_CNT : -return tr->tco.cnt2; + ret = tr->tco.cnt2; +break ;case TCO_MESSAGE1 : -return tr->tco.msg1; + ret = tr->tco.msg1; +break ;case TCO_MESSAGE2 : -return tr->tco.msg2; + ret = tr->tco.msg2; +break ;case TCO_WDCNT : -return tr->tco.wdcnt; + ret = tr->tco.wdcnt; +break ;case TCO_TMR : -return tr->tco.tmr; + ret = tr->tco.tmr; +break ;case SW_IRQ_GEN : -return tr->sw_irq_gen; + ret = tr->sw_irq_gen; +break ; } -return 0 ; +trace_tco_io_read (addr, ret); +return ret; }static void tco_ioport_writew (TCOIORegs *tr,uint32_t addr,uint32_t val) { +trace_tco_io_write (addr, val);switch (addr) {case TCO_RLD : tr->timeouts_no =0 ;
hw/acpi/trace-events +2 -0
@@ -55,6 +55,8 @@ piix4_gpe_writeb(uint64_t addr, unsigned width, uint64_t val) "addr: 0x%" PRIx64 # tco.c tco_timer_reload(int ticks, int msec) "ticks=%d (%d ms)" tco_timer_expired(int timeouts_no, bool strap, bool no_reboot) "timeouts_no=%d no_reboot=%d/%d" +tco_io_write(uint64_t addr, uint32_t val) "addr=0x%" PRIx64 " val=0x%" PRIx32 +tco_io_read(uint64_t addr, uint32_t val) "addr=0x%" PRIx64 " val=0x%" PRIx32 # erst.c acpi_erst_reg_write(uint64_t addr, uint64_t val, unsigned size) "addr: 0x%04" PRIx64 " <== 0x%016" PRIx64 " (size: %u)"
Signature · 1 line
MST
[PULL 03/41] hw/watchdog: add trace events for watchdog action handling
In reply to Michael S. TsirkinFrom: Daniel P. Berrangé <[email protected]>
The tracepoints aid in debugging the triggering of watchdog devices.
Message-Id: <[email protected]>
--- hw/watchdog/watchdog.c | 4 ++++ hw/watchdog/trace-events | 4 ++++ 2 files changed, 8 insertions(+)
hw/watchdog/watchdog.c +4 -0
@@ -30,6 +30,7 @@#include "sysemu/watchdog.h" #include "hw/nmi.h" #include "qemu/help_option.h" +#include "trace.h" static WatchdogAction watchdog_action =WATCHDOG_ACTION_RESET ;
@@ -43,6 +44,8 @@ WatchdogAction get_watchdog_action(void)*/ void watchdog_perform_action (void ) { +trace_watchdog_perform_action (watchdog_action); +switch (watchdog_action) {case WATCHDOG_ACTION_RESET :/* same as 'system_reset' in monitor */ qapi_event_send_watchdog (WATCHDOG_ACTION_RESET );
@@ -89,4 +92,5 @@ void watchdog_perform_action(void)void qmp_watchdog_set_action (WatchdogAction action,Error **errp) { watchdog_action = action; +trace_watchdog_set_action (watchdog_action); }
hw/watchdog/trace-events +4 -0
@@ -16,3 +16,7 @@ spapr_watchdog_stop(uint64_t num, uint64_t ret) "num=%" PRIu64 " ret=%" PRId64 spapr_watchdog_query(uint64_t caps) "caps=0x%" PRIx64 spapr_watchdog_query_lpm(uint64_t caps) "caps=0x%" PRIx64 spapr_watchdog_expired(uint64_t num, unsigned action) "num=%" PRIu64 " action=%u" + +# watchdog.c +watchdog_perform_action(unsigned int action) "action=%u" +watchdog_set_action(unsigned int action) "action=%u"
Signature · 1 line
MST
[PULL 04/41] hw: Add compat machines for 8.0
In reply to Michael S. TsirkinFrom: Cornelia Huck <[email protected]>
Add 8.0 machine types for arm/i440fx/m68k/q35/s390x/spapr.
Message-Id: <[email protected]>
--- include/hw/boards.h | 3 +++ include/hw/i386/pc.h | 3 +++ hw/arm/virt.c | 11 +++++++++-- hw/core/machine.c | 3 +++ hw/i386/pc.c | 3 +++ hw/i386/pc_piix.c | 14 +++++++++++++- hw/i386/pc_q35.c | 13 ++++++++++++- hw/m68k/virt.c | 11 +++++++++-- hw/ppc/spapr.c | 17 ++++++++++++++--- hw/s390x/s390-virtio-ccw.c | 14 +++++++++++++- 10 files changed, 82 insertions(+), 10 deletions(-)
include/hw/boards.h +3 -0
@@ -379,6 +379,9 @@ struct MachineState { } \ type_init(machine_initfn##_register_types) +extern GlobalProperty hw_compat_7_2[]; +extern const size_t hw_compat_7_2_len; +extern GlobalProperty hw_compat_7_1[];extern const size_t hw_compat_7_1_len;
include/hw/i386/pc.h +3 -0
@@ -200,6 +200,9 @@ void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid,/* sgx.c */ void pc_machine_init_sgx_epc (PCMachineState *pcms); +extern GlobalProperty pc_compat_7_2[]; +extern const size_t pc_compat_7_2_len; +extern GlobalProperty pc_compat_7_1[];extern const size_t pc_compat_7_1_len;
hw/arm/virt.c +9 -2
@@ -3218,10 +3218,17 @@ static void machvirt_machine_init(void) }type_init (machvirt_machine_init); -static void virt_machine_7_2_options (MachineClass *mc) +static void virt_machine_8_0_options (MachineClass *mc) { } -DEFINE_VIRT_MACHINE_AS_LATEST(7, 2) +DEFINE_VIRT_MACHINE_AS_LATEST(8, 0) + +static void virt_machine_7_2_options (MachineClass *mc) +{ +virt_machine_8_0_options (mc); +compat_props_add (mc->compat_props, hw_compat_7_2, hw_compat_7_2_len); +} +DEFINE_VIRT_MACHINE(7, 2)static void virt_machine_7_1_options (MachineClass *mc) {
hw/core/machine.c +3 -0
@@ -40,6 +40,9 @@#include "hw/virtio/virtio-pci.h" #include "qom/object_interfaces.h" +GlobalProperty hw_compat_7_2[] = {}; +const size_t hw_compat_7_2_len =G_N_ELEMENTS (hw_compat_7_2); +GlobalProperty hw_compat_7_1[] = { {"virtio-device" ,"queue_reset" ,"false" }, };
hw/i386/pc.c +3 -0
@@ -107,6 +107,9 @@ { "qemu64-" TYPE_X86_CPU, "model-id", "QEMU Virtual CPU version " v, },\ { "athlon-" TYPE_X86_CPU, "model-id", "QEMU Virtual CPU version " v, }, +GlobalProperty pc_compat_7_2[] = {}; +const size_t pc_compat_7_2_len =G_N_ELEMENTS (pc_compat_7_2); +GlobalProperty pc_compat_7_1[] = {};const size_t pc_compat_7_1_len =G_N_ELEMENTS (pc_compat_7_1);
hw/i386/pc_piix.c +13 -1
@@ -435,7 +435,7 @@ static void pc_i440fx_machine_options(MachineClass *m)machine_class_allow_dynamic_sysbus_dev (m,TYPE_VMBUS_BRIDGE ); } -static void pc_i440fx_7_2_machine_options (MachineClass *m) +static void pc_i440fx_8_0_machine_options (MachineClass *m) {PCMachineClass *pcmc =PC_MACHINE_CLASS (m);pc_i440fx_machine_options (m);
@@ -444,6 +444,18 @@ static void pc_i440fx_7_2_machine_options(MachineClass *m) pcmc->default_cpu_version =1 ; } +DEFINE_I440FX_MACHINE (v8_0,"pc-i440fx-8.0" ,NULL , + pc_i440fx_8_0_machine_options); + +static void pc_i440fx_7_2_machine_options (MachineClass *m) +{ +pc_i440fx_8_0_machine_options (m); + m->alias =NULL ; + m->is_default = false; +compat_props_add (m->compat_props, hw_compat_7_2, hw_compat_7_2_len); +compat_props_add (m->compat_props, pc_compat_7_2, pc_compat_7_2_len); +} +DEFINE_I440FX_MACHINE (v7_2,"pc-i440fx-7.2" ,NULL , pc_i440fx_7_2_machine_options);
hw/i386/pc_q35.c +12 -1
@@ -370,7 +370,7 @@ static void pc_q35_machine_options(MachineClass *m) m->max_cpus =288 ; } -static void pc_q35_7_2_machine_options (MachineClass *m) +static void pc_q35_8_0_machine_options (MachineClass *m) {PCMachineClass *pcmc =PC_MACHINE_CLASS (m);pc_q35_machine_options (m);
@@ -378,6 +378,17 @@ static void pc_q35_7_2_machine_options(MachineClass *m) pcmc->default_cpu_version =1 ; } +DEFINE_Q35_MACHINE (v8_0,"pc-q35-8.0" ,NULL , + pc_q35_8_0_machine_options); + +static void pc_q35_7_2_machine_options (MachineClass *m) +{ +pc_q35_8_0_machine_options (m); + m->alias =NULL ; +compat_props_add (m->compat_props, hw_compat_7_2, hw_compat_7_2_len); +compat_props_add (m->compat_props, pc_compat_7_2, pc_compat_7_2_len); +} +DEFINE_Q35_MACHINE (v7_2,"pc-q35-7.2" ,NULL , pc_q35_7_2_machine_options);
hw/m68k/virt.c +9 -2
@@ -346,10 +346,17 @@ type_init(virt_machine_register_types) } \ type_init(machvirt_machine_##major##_##minor##_init); -static void virt_machine_7_2_options (MachineClass *mc) +static void virt_machine_8_0_options (MachineClass *mc) { } -DEFINE_VIRT_MACHINE(7, 2, true) +DEFINE_VIRT_MACHINE(8, 0, true) + +static void virt_machine_7_2_options (MachineClass *mc) +{ +virt_machine_8_0_options (mc); +compat_props_add (mc->compat_props, hw_compat_7_2, hw_compat_7_2_len); +} +DEFINE_VIRT_MACHINE(7, 2, false)static void virt_machine_7_1_options (MachineClass *mc) {
hw/ppc/spapr.c +14 -3
@@ -4734,14 +4734,25 @@ static void spapr_machine_latest_class_options(MachineClass *mc) type_init(spapr_machine_register_##suffix)/* -* pseries-7.2 +* pseries-8.0 */ -static void spapr_machine_7_2_class_options(MachineClass *mc) +static void spapr_machine_8_0_class_options(MachineClass *mc) {/* Defaults for the latest behaviour inherited from the base class */ } -DEFINE_SPAPR_MACHINE(7_2, "7.2", true); +DEFINE_SPAPR_MACHINE(8_0, "8.0", true); + +/* +* pseries-7.2 +*/ +static void spapr_machine_7_2_class_options (MachineClass *mc) +{ +spapr_machine_8_0_class_options (mc); +compat_props_add (mc->compat_props, hw_compat_7_2, hw_compat_7_2_len); +} + +DEFINE_SPAPR_MACHINE(7_2, "7.2", false);/* * pseries-7.1
hw/s390x/s390-virtio-ccw.c +13 -1
@@ -823,14 +823,26 @@ bool css_migration_enabled(void) } \ type_init(ccw_machine_register_##suffix) +static void ccw_machine_8_0_instance_options(MachineState *machine) +{ +} + +static void ccw_machine_8_0_class_options (MachineClass *mc) +{ +} +DEFINE_CCW_MACHINE(8_0, "8.0", true); +static void ccw_machine_7_2_instance_options (MachineState *machine) { +ccw_machine_8_0_instance_options (machine); }static void ccw_machine_7_2_class_options (MachineClass *mc) { +ccw_machine_8_0_class_options (mc); +compat_props_add (mc->compat_props, hw_compat_7_2, hw_compat_7_2_len); } -DEFINE_CCW_MACHINE(7_2, "7.2", true); +DEFINE_CCW_MACHINE(7_2, "7.2", false);static void ccw_machine_7_1_instance_options (MachineState *machine) {
Signature · 1 line
MST
[PULL 06/41] hw/isa: enable TCO watchdog reboot pin strap by default
In reply to Michael S. TsirkinFrom: Daniel P. Berrangé <[email protected]>
The TCO watchdog implementation default behaviour from POV of the guest OS relies on the initial values for two I/O ports:
* TCO1_CNT == 0x0
Since bit 11 (TCO Timer Halt) is clear, the watchdog state is considered to be initially running
* GCS == 0x20
Since bit 5 (No Reboot) is set, the watchdog will not trigger when the timer expires
This is a safe default, because the No Reboot bit will prevent the watchdog from triggering if the guest OS is unaware of its existance, or is slow in configuring it. When a Linux guest initializes the TCO watchdog, it will attempt to clear the "No Reboot" flag, and read the value back. If the clear was honoured, the driver will treat this as an indicator that the watchdog is functional and create the guest watchdog device.
QEMU implements a second "no reboot" flag, however, via pin straps which overrides the behaviour of the guest controlled "no reboot" flag:
commit 5add35bec1e249bb5345a47008c8f298d4760be4
Author: Paulo Alcantara <[email protected]>
Date: Sun Jun 28 14:58:58 2015 -0300
ich9: implement strap SPKR pin logic
This second 'noreboot' pin was defaulted to high, which also inhibits triggering of the requested watchdog actions, unless QEMU is launched with the magic flag "-global ICH9-LPC.noreboot=false".
This is a bad default as we are exposing a watchdog to every guest OS using the q35 machine type, but preventing it from actually doing what it is designed to do. What is worse is that the guest OS and its apps have no way to know that the watchdog is never going to fire, due to this second 'noreboot' pin.
If a guest OS had no watchdog device at all, then apps whose operation and/or data integrity relies on a watchdog can refuse to launch, and alert the administrator of the problematic deployment. With Q35 machines unconditionally exposing a watchdog though, apps will think their deployment is correct but in fact have no protection at all.
This patch flips the default of the second 'no reboot' flag, so that configured watchdog actions will be honoured out of the box for the 7.2 Q35 machine type onwards, if the guest enables use of the watchdog.
See also related bug reports
https://bugzilla.redhat.com/show_bug.cgi?id=2080207
https://bugzilla.redhat.com/show_bug.cgi?id=2136889
https://bugzilla.redhat.com/show_bug.cgi?id=2137346
Message-Id: <[email protected]>
--- hw/i386/pc.c | 4 +++- hw/isa/lpc_ich9.c | 2 +- tests/qtest/tco-test.c | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-)
hw/i386/pc.c +3 -1
@@ -107,7 +107,9 @@ { "qemu64-" TYPE_X86_CPU, "model-id", "QEMU Virtual CPU version " v, },\ { "athlon-" TYPE_X86_CPU, "model-id", "QEMU Virtual CPU version " v, }, -GlobalProperty pc_compat_7_2[] = {}; +GlobalProperty pc_compat_7_2[] = { + { "ICH9-LPC", "noreboot", "true" }, +};const size_t pc_compat_7_2_len =G_N_ELEMENTS (pc_compat_7_2);GlobalProperty pc_compat_7_1[] = {};
hw/isa/lpc_ich9.c +1 -1
@@ -792,7 +792,7 @@ static const VMStateDescription vmstate_ich9_lpc = { };static Property ich9_lpc_properties[] = { -DEFINE_PROP_BOOL ("noreboot" , ICH9LPCState, pin_strap.spkr_hi, true), +DEFINE_PROP_BOOL ("noreboot" , ICH9LPCState, pin_strap.spkr_hi, false),DEFINE_PROP_BOOL ("smm-compat" , ICH9LPCState, pm.smm_compat, false),DEFINE_PROP_BIT64 ("x-smi-broadcast" , ICH9LPCState, smi_host_features,ICH9_LPC_SMI_F_BROADCAST_BIT , true),
tests/qtest/tco-test.c +1 -1
@@ -60,7 +60,7 @@ static void test_init(TestData *d)QTestState *qs; qs =qtest_initf ("-machine q35 %s %s" , - d->noreboot ?"" :"-global ICH9-LPC.noreboot=false" , + d->noreboot ?"-global ICH9-LPC.noreboot=true" :"" , !d->args ?"" : d->args);qtest_irq_intercept_in (qs,"ioapic" );
Signature · 1 line
MST
[PULL 02/41] hw/isa: add trace events for ICH9 LPC chip config access
In reply to Michael S. TsirkinFrom: Daniel P. Berrangé <[email protected]>
These tracepoints aid in understanding and debugging the guest drivers for the TCO watchdog.
Message-Id: <[email protected]>
--- hw/isa/lpc_ich9.c | 3 +++ hw/isa/trace-events | 4 ++++ 2 files changed, 7 insertions(+)
hw/isa/lpc_ich9.c +3 -0
@@ -52,6 +52,7 @@#include "hw/nvram/fw_cfg.h" #include "qemu/cutils.h" #include "hw/acpi/acpi_aml_interface.h" +#include "trace.h" /*****************************************************************************/ /* ICH9 LPC PCI to ISA bridge */
@@ -162,6 +163,7 @@ static void ich9_cc_write(void *opaque, hwaddr addr, {ICH9LPCState *lpc = (ICH9LPCState *)opaque; +trace_ich9_cc_write (addr, val, len);ich9_cc_addr_len (&addr, &len);memcpy (lpc->chip_config + addr, &val, len);pci_bus_fire_intx_routing_notifier (pci_get_bus (&lpc->d));
@@ -177,6 +179,7 @@ static uint64_t ich9_cc_read(void *opaque, hwaddr addr,uint32_t val =0 ;ich9_cc_addr_len (&addr, &len);memcpy (&val, lpc->chip_config + addr, len); +trace_ich9_cc_read (addr, val, len);return val; }
hw/isa/trace-events +4 -0
@@ -21,3 +21,7 @@ via_pm_io_read(uint32_t addr, uint32_t val, int len) "addr 0x%x val 0x%x len 0x% via_pm_io_write(uint32_t addr, uint32_t val, int len) "addr 0x%x val 0x%x len 0x%x" via_superio_read(uint8_t addr, uint8_t val) "addr 0x%x val 0x%x" via_superio_write(uint8_t addr, uint32_t val) "addr 0x%x val 0x%x" + +# lpc_ich9.c +ich9_cc_write(uint64_t addr, uint64_t val, unsigned len) "addr=0x%"PRIx64 " val=0x%"PRIx64 " len=%u" +ich9_cc_read(uint64_t addr, uint64_t val, unsigned len) "addr=0x%"PRIx64 " val=0x%"PRIx64 " len=%u"
Signature · 1 line
MST
[PULL 26/41] acpi/tests/avocado/bits: add SPDX license identifiers for bios bits tests
In reply to Michael S. TsirkinFrom: Ani Sinha <[email protected]>
Added the SPDX license identifiers for biosbits tests.
Also added a comment on each of the test scripts to indicate that they run from within the biosbits environment and hence are not subjected to the regular maintenance activities for QEMU and is excluded from the dependency management challenges in the host testing environment.
Message-Id: <[email protected]>
--- tests/avocado/acpi-bits/bits-tests/smbios.py2 | 4 ++++ tests/avocado/acpi-bits/bits-tests/testacpi.py2 | 4 ++++ tests/avocado/acpi-bits/bits-tests/testcpuid.py2 | 4 ++++ 3 files changed, 12 insertions(+)
tests/avocado/acpi-bits/bits-tests/smbios.py2 +4 -0
@@ -1,6 +1,8 @@ # Copyright (c) 2015, Intel Corporation # All rights reserved. # +# SPDX-License-Identifier: BSD-3-Clause +# # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: #
@@ -24,6 +26,8 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# This script runs only from the biosbits VM. + """SMBIOS/DMI module.""" import bits
tests/avocado/acpi-bits/bits-tests/testacpi.py2 +4 -0
@@ -1,6 +1,8 @@ # Copyright (c) 2015, Intel Corporation # All rights reserved. # +# SPDX-License-Identifier: BSD-3-Clause +# # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: #
@@ -24,6 +26,8 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# This script runs only from the biosbits VM. + """Tests for ACPI""" import acpi
tests/avocado/acpi-bits/bits-tests/testcpuid.py2 +4 -0
@@ -1,6 +1,8 @@ # Copyright (c) 2012, Intel Corporation # All rights reserved. # +# SPDX-License-Identifier: BSD-3-Clause +# # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: #
@@ -24,6 +26,8 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# This script runs only from the biosbits VM. + """Tests and helpers for CPUID.""" import bits
Signature · 1 line
MST
[PULL 07/41] ich9: honour 'enable_tco' property
In reply to Michael S. TsirkinFrom: Daniel P. Berrangé <[email protected]>
An 'ICH9-LPC.enable_tco' property has been exposed for a very long time, but attempts to set it have never been honoured.
Originally, any user provided 'enable_tco' value was force replaced by a value passed from the machine type setup code that was determine by machine type compat properties.
commit d6b304ba924b95d12edfddaac99777b577301309
Author: Eduardo Habkost <[email protected]>
Date: Sat Jan 23 14:02:10 2016 -0200
machine: Remove no_tco field
The field is always set to zero, so it is not necessary anymore.
After legacy Q35 machine types were deleted in:
commit 86165b499edf8b03bb2d0e926d116c2f12a95bfe
Author: Eduardo Habkost <[email protected]>
Date: Sat Jan 23 14:02:09 2016 -0200
q35: Remove old machine versions
the machine type code ended up just unconditionally passing 'true', all the time, so this was further simplified in
commit d6b304ba924b95d12edfddaac99777b577301309
Author: Eduardo Habkost <[email protected]>
Date: Sat Jan 23 14:02:10 2016 -0200
machine: Remove no_tco field
The field is always set to zero, so it is not necessary anymore.
commit 18d6abae3ea092950629e5d26aff1dcfc9a2d78e
Author: Eduardo Habkost <[email protected]>
Date: Sat Jan 23 14:02:11 2016 -0200
ich9: Remove enable_tco arguments from init functions
The enable_tco arguments are always true, so they are not needed anymore.
Leaving the ich9_pm_init to just force set 'enable_tco' to true. This still overrides any user specified property. The initialization of property defaults should be done when properties are first registered, rather than during object construction.
Message-Id: <[email protected]>
--- hw/acpi/ich9.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
hw/acpi/ich9.c +4 -2
@@ -316,8 +316,9 @@ void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm, pm->smm_enabled = smm_enabled; - pm->enable_tco = true; -acpi_pm_tco_init (&pm->tco_regs, &pm->io); +if (pm->enable_tco) { +acpi_pm_tco_init (&pm->tco_regs, &pm->io); + }if (pm->use_acpi_hotplug_bridge) { acpi_pcihp_init(OBJECT(lpc_pci),
@@ -440,6 +441,7 @@ void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm) pm->s4_val =2 ; pm->use_acpi_hotplug_bridge = true; pm->keep_pci_slot_hpc = true; + pm->enable_tco = true;object_property_add_uint32_ptr (obj,ACPI_PM_PROP_PM_IO_BASE , &pm->pm_io_base,OBJ_PROP_FLAG_READ );
Signature · 1 line
MST
[PULL 13/41] vhost: set SVQ device call handler at SVQ start
In reply to Michael S. TsirkinFrom: Eugenio Pérez <[email protected]>
By the end of this series CVQ is shadowed as long as the features support it.
Since we don't know at the beginning of qemu running if this is supported, move the event notifier handler setting to the start of the SVQ, instead of the start of qemu run. This will avoid to create them if the device does not support SVQ.
Message-Id: <[email protected]>
--- hw/virtio/vhost-shadow-virtqueue.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/virtio/vhost-shadow-virtqueue.c +2 -2
@@ -648,6 +648,7 @@ void vhost_svq_start(VhostShadowVirtqueue *svq, VirtIODevice *vdev, {size_t desc_size, driver_size, device_size; +event_notifier_set_handler (&svq->hdev_call, vhost_svq_handle_call); svq->next_guest_avail_elem =NULL ; svq->shadow_avail_idx =0 ; svq->shadow_used_idx =0 ;
@@ -704,6 +705,7 @@ void vhost_svq_stop(VhostShadowVirtqueue *svq)g_free (svq->desc_state);qemu_vfree (svq->vring.desc);qemu_vfree (svq->vring.used); +event_notifier_set_handler (&svq->hdev_call,NULL ); }/**
@@ -740,7 +742,6 @@ VhostShadowVirtqueue *vhost_svq_new(VhostIOVATree *iova_tree, }event_notifier_init_fd (&svq->svq_kick,VHOST_FILE_UNBIND ); -event_notifier_set_handler (&svq->hdev_call, vhost_svq_handle_call); svq->iova_tree = iova_tree; svq->ops = ops; svq->ops_opaque = ops_opaque;
@@ -763,7 +764,6 @@ void vhost_svq_free(gpointer pvq)VhostShadowVirtqueue *vq = pvq;vhost_svq_stop (vq);event_notifier_cleanup (&vq->hdev_kick); -event_notifier_set_handler (&vq->hdev_call,NULL );event_notifier_cleanup (&vq->hdev_call);g_free (vq); }
Signature · 1 line
MST
[PULL 30/41] docs/acpi/bits: document BITS_DEBUG environment variable
In reply to Michael S. TsirkinFrom: Ani Sinha <[email protected]>
Debug specific actions can be enabled in bios bits acpi tests by passing BITS_DEBUG in the environment variable while running the test. Document that.
Message-Id: <[email protected]>
--- docs/devel/acpi-bits.rst | 3 +++ 1 file changed, 3 insertions(+)
docs/devel/acpi-bits.rst +3 -0
@@ -52,6 +52,9 @@ Under ``tests/avocado/`` as the root we have: for their tests. In order to enable debugging, you can set **V=1** environment variable. This enables verbose mode for the test and also dumps the entire log from bios bits and more information in case failure happens. + You can also set **BITS_DEBUG=1** to turn on debug mode. It will enable + verbose logs and also retain the temporary work directory the test used for + you to inspect and run the specific commands manually. In order to run this test, please perform the following steps from the QEMU build directory:
Signature · 1 line
MST
[PULL 15/41] vhost: move iova_tree set to vhost_svq_start
In reply to Michael S. TsirkinFrom: Eugenio Pérez <[email protected]>
Since we don't know if we will use SVQ at qemu initialization, let's allocate iova_tree only if needed. To do so, accept it at SVQ start, not at initialization.
This will avoid to create it if the device does not support SVQ.
Message-Id: <[email protected]>
--- hw/virtio/vhost-shadow-virtqueue.h | 5 ++--- hw/virtio/vhost-shadow-virtqueue.c | 9 ++++----- hw/virtio/vhost-vdpa.c | 5 ++--- 3 files changed, 8 insertions(+), 11 deletions(-)
hw/virtio/vhost-shadow-virtqueue.h +2 -3
@@ -126,11 +126,10 @@ size_t vhost_svq_driver_area_size(const VhostShadowVirtqueue *svq);size_t vhost_svq_device_area_size (const VhostShadowVirtqueue *svq);void vhost_svq_start (VhostShadowVirtqueue *svq,VirtIODevice *vdev, -VirtQueue *vq); +VirtQueue *vq,VhostIOVATree *iova_tree);void vhost_svq_stop (VhostShadowVirtqueue *svq); -VhostShadowVirtqueue *vhost_svq_new (VhostIOVATree *iova_tree, -const VhostShadowVirtqueueOps *ops, +VhostShadowVirtqueue *vhost_svq_new (const VhostShadowVirtqueueOps *ops,void *ops_opaque);void vhost_svq_free (gpointer vq);
hw/virtio/vhost-shadow-virtqueue.c +4 -5
@@ -642,9 +642,10 @@ void vhost_svq_set_svq_kick_fd(VhostShadowVirtqueue *svq, int svq_kick_fd)* @svq: Shadow Virtqueue * @vdev: VirtIO device * @vq: Virtqueue to shadow +* @iova_tree: Tree to perform descriptors translations */ void vhost_svq_start (VhostShadowVirtqueue *svq,VirtIODevice *vdev, -VirtQueue *vq) +VirtQueue *vq,VhostIOVATree *iova_tree) {size_t desc_size, driver_size, device_size;
@@ -655,6 +656,7 @@ void vhost_svq_start(VhostShadowVirtqueue *svq, VirtIODevice *vdev, svq->last_used_idx =0 ; svq->vdev = vdev; svq->vq = vq; + svq->iova_tree = iova_tree; svq->vring.num =virtio_queue_get_num (vdev,virtio_get_queue_index (vq)); driver_size =vhost_svq_driver_area_size (svq);
@@ -712,18 +714,15 @@ void vhost_svq_stop(VhostShadowVirtqueue *svq)* Creates vhost shadow virtqueue, and instructs the vhost device to use the * shadow methods and file descriptors. * -* @iova_tree: Tree to perform descriptors translations * @ops: SVQ owner callbacks * @ops_opaque: ops opaque pointer */ -VhostShadowVirtqueue *vhost_svq_new (VhostIOVATree *iova_tree, -const VhostShadowVirtqueueOps *ops, +VhostShadowVirtqueue *vhost_svq_new (const VhostShadowVirtqueueOps *ops,void *ops_opaque) {VhostShadowVirtqueue *svq =g_new0 (VhostShadowVirtqueue,1 );event_notifier_init_fd (&svq->svq_kick,VHOST_FILE_UNBIND ); - svq->iova_tree = iova_tree; svq->ops = ops; svq->ops_opaque = ops_opaque;return svq;
hw/virtio/vhost-vdpa.c +2 -3
@@ -430,8 +430,7 @@ static int vhost_vdpa_init_svq(struct vhost_dev *hdev, struct vhost_vdpa *v,for (unsigned n =0 ; n < hdev->nvqs; ++n) {VhostShadowVirtqueue *svq; - svq =vhost_svq_new (v->iova_tree, v->shadow_vq_ops, - v->shadow_vq_ops_opaque); + svq =vhost_svq_new (v->shadow_vq_ops, v->shadow_vq_ops_opaque);g_ptr_array_add (shadow_vqs, svq); }
@@ -1063,7 +1062,7 @@ static bool vhost_vdpa_svqs_start(struct vhost_dev *dev) goto err; } -vhost_svq_start (svq, dev->vdev, vq); +vhost_svq_start (svq, dev->vdev, vq, v->iova_tree); ok =vhost_vdpa_svq_map_rings (dev, svq, &addr, &err);if (unlikely (!ok)) { goto err_map;
Signature · 1 line
MST
[PULL 33/41] hw/cxl/device: Add Flex Bus Port DVSEC
In reply to Michael S. TsirkinFrom: Ira Weiny <[email protected]>
The Flex Bus Port DVSEC was missing on type 3 devices which was blocking RAS checks.[1]
Add the Flex Bus Port DVSEC to type 3 devices as per CXL 3.0 8.2.1.3.
Message-Id: <[email protected]>
--- hw/mem/cxl_type3.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
hw/mem/cxl_type3.c +11 -0
@@ -295,6 +295,17 @@ static void build_dvsecs(CXLType3Dev *ct3d)cxl_component_create_dvsec (cxl_cstate,CXL2_TYPE3_DEVICE ,GPF_DEVICE_DVSEC_LENGTH ,GPF_DEVICE_DVSEC ,GPF_DEVICE_DVSEC_REVID , dvsec); + + dvsec = (uint8_t *)&(CXLDVSECPortFlexBus ){ + .cap =0x26 ,/* 68B, IO, Mem, non-MLD */ + .ctrl =0x02 ,/* IO always enabled */ + .status =0x26 ,/* same as capabilities */ + .rcvd_mod_ts_data_phase1 =0xef ,/* WTF? */ + }; +cxl_component_create_dvsec (cxl_cstate,CXL2_TYPE3_DEVICE , +PCIE_FLEXBUS_PORT_DVSEC_LENGTH_2_0 , +PCIE_FLEXBUS_PORT_DVSEC , +PCIE_FLEXBUS_PORT_DVSEC_REVID_2_0 , dvsec); }static void hdm_decoder_commit (CXLType3Dev *ct3d,int which)
Signature · 1 line
MST
[PULL 08/41] virtio: get class_id and pci device id by the virtio id
In reply to Michael S. TsirkinFrom: Longpeng <[email protected]>
Add helpers to get the "Transitional PCI Device ID" and "class_id" of the device specified by the "Virtio Device ID".
These helpers will be used to build the generic vDPA device later.
Message-Id: <[email protected]>
--- include/hw/virtio/virtio-pci.h | 5 ++ hw/virtio/virtio-pci.c | 88 ++++++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+)
include/hw/virtio/virtio-pci.h +5 -0
@@ -151,6 +151,8 @@ struct VirtIOPCIProxy {bool disable_modern;bool ignore_backend_features;OnOffAuto disable_legacy; +/* Transitional device id */ +uint16_t trans_devid;uint32_t class_code;uint32_t nvectors;uint32_t dfselect;
@@ -184,6 +186,9 @@ static inline void virtio_pci_disable_modern(VirtIOPCIProxy *proxy) proxy->disable_modern = true; } +uint16_t virtio_pci_get_trans_devid (uint16_t device_id); +uint16_t virtio_pci_get_class_id (uint16_t device_id); +/* * virtio-input-pci: This extends VirtioPCIProxy. */
hw/virtio/virtio-pci.c +88 -0
106 lines not on this page · raw message
Signature · 1 line
MST
[PULL 11/41] vdpa-dev: mark the device as unmigratable
In reply to Michael S. TsirkinFrom: Longpeng <[email protected]>
The generic vDPA device doesn't support migration currently, so mark it as unmigratable temporarily.
Message-Id: <[email protected]>
--- hw/virtio/vdpa-dev.c | 1 + 1 file changed, 1 insertion(+)
hw/virtio/vdpa-dev.c +1 -0
@@ -327,6 +327,7 @@ static Property vhost_vdpa_device_properties[] = {static const VMStateDescription vmstate_vhost_vdpa_device = { .name ="vhost-vdpa-device" , + .unmigratable =1 , .minimum_version_id =1 , .version_id =1 , .fields = (VMStateField []) {
Signature · 1 line
MST
[PULL 05/41] pc: clean up compat machines
In reply to Michael S. TsirkinFrom: Cornelia Huck <[email protected]>
We can move setting default_cpu_version into the base machine options, and we need to unset alias and is_default only once.
Message-Id: <[email protected]>
--- hw/i386/pc_piix.c | 27 +-------------------------- hw/i386/pc_q35.c | 16 +--------------- 2 files changed, 2 insertions(+), 41 deletions(-)
hw/i386/pc_piix.c +1 -26
@@ -426,6 +426,7 @@ static void pc_i440fx_machine_options(MachineClass *m)PCMachineClass *pcmc =PC_MACHINE_CLASS (m); pcmc->default_nic_model ="e1000" ; pcmc->pci_root_uid =0 ; + pcmc->default_cpu_version =1 ; m->family ="pc_piix" ; m->desc ="Standard PC (i440FX + PIIX, 1996)" ;
@@ -437,11 +438,9 @@ static void pc_i440fx_machine_options(MachineClass *m)static void pc_i440fx_8_0_machine_options (MachineClass *m) { -PCMachineClass *pcmc =PC_MACHINE_CLASS (m);pc_i440fx_machine_options (m); m->alias ="pc" ; m->is_default = true; - pcmc->default_cpu_version =1 ; } DEFINE_I440FX_MACHINE(v8_0, "pc-i440fx-8.0", NULL,
@@ -463,8 +462,6 @@ static void pc_i440fx_7_1_machine_options(MachineClass *m) {PCMachineClass *pcmc =PC_MACHINE_CLASS (m);pc_i440fx_7_2_machine_options (m); - m->alias =NULL ; - m->is_default = false; pcmc->legacy_no_rng_seed = true;compat_props_add (m->compat_props, hw_compat_7_1, hw_compat_7_1_len);compat_props_add (m->compat_props, pc_compat_7_1, pc_compat_7_1_len);
@@ -477,8 +474,6 @@ static void pc_i440fx_7_0_machine_options(MachineClass *m) {PCMachineClass *pcmc =PC_MACHINE_CLASS (m);pc_i440fx_7_1_machine_options (m); - m->alias =NULL ; - m->is_default = false; pcmc->enforce_amd_1tb_hole = false;compat_props_add (m->compat_props, hw_compat_7_0, hw_compat_7_0_len);compat_props_add (m->compat_props, pc_compat_7_0, pc_compat_7_0_len);
@@ -490,8 +485,6 @@ DEFINE_I440FX_MACHINE(v7_0, "pc-i440fx-7.0", NULL,static void pc_i440fx_6_2_machine_options (MachineClass *m) {pc_i440fx_7_0_machine_options (m); - m->alias =NULL ; - m->is_default = false;compat_props_add (m->compat_props, hw_compat_6_2, hw_compat_6_2_len);compat_props_add (m->compat_props, pc_compat_6_2, pc_compat_6_2_len); }
@@ -502,8 +495,6 @@ DEFINE_I440FX_MACHINE(v6_2, "pc-i440fx-6.2", NULL,static void pc_i440fx_6_1_machine_options (MachineClass *m) {pc_i440fx_6_2_machine_options (m); - m->alias =NULL ; - m->is_default = false;compat_props_add (m->compat_props, hw_compat_6_1, hw_compat_6_1_len);compat_props_add (m->compat_props, pc_compat_6_1, pc_compat_6_1_len); m->smp_props.prefer_sockets = true;
@@ -515,8 +506,6 @@ DEFINE_I440FX_MACHINE(v6_1, "pc-i440fx-6.1", NULL,static void pc_i440fx_6_0_machine_options (MachineClass *m) {pc_i440fx_6_1_machine_options (m); - m->alias =NULL ; - m->is_default = false;compat_props_add (m->compat_props, hw_compat_6_0, hw_compat_6_0_len);compat_props_add (m->compat_props, pc_compat_6_0, pc_compat_6_0_len); }
@@ -527,8 +516,6 @@ DEFINE_I440FX_MACHINE(v6_0, "pc-i440fx-6.0", NULL,static void pc_i440fx_5_2_machine_options (MachineClass *m) {pc_i440fx_6_0_machine_options (m); - m->alias =NULL ; - m->is_default = false;compat_props_add (m->compat_props, hw_compat_5_2, hw_compat_5_2_len);compat_props_add (m->compat_props, pc_compat_5_2, pc_compat_5_2_len); }
@@ -541,8 +528,6 @@ static void pc_i440fx_5_1_machine_options(MachineClass *m)PCMachineClass *pcmc =PC_MACHINE_CLASS (m);pc_i440fx_5_2_machine_options (m); - m->alias =NULL ; - m->is_default = false;compat_props_add (m->compat_props, hw_compat_5_1, hw_compat_5_1_len);compat_props_add (m->compat_props, pc_compat_5_1, pc_compat_5_1_len); pcmc->kvmclock_create_always = false;
@@ -555,8 +540,6 @@ DEFINE_I440FX_MACHINE(v5_1, "pc-i440fx-5.1", NULL,static void pc_i440fx_5_0_machine_options (MachineClass *m) {pc_i440fx_5_1_machine_options (m); - m->alias =NULL ; - m->is_default = false; m->numa_mem_supported = true;compat_props_add (m->compat_props, hw_compat_5_0, hw_compat_5_0_len);compat_props_add (m->compat_props, pc_compat_5_0, pc_compat_5_0_len);
@@ -569,8 +552,6 @@ DEFINE_I440FX_MACHINE(v5_0, "pc-i440fx-5.0", NULL,static void pc_i440fx_4_2_machine_options (MachineClass *m) {pc_i440fx_5_0_machine_options (m); - m->alias =NULL ; - m->is_default = false;compat_props_add (m->compat_props, hw_compat_4_2, hw_compat_4_2_len);compat_props_add (m->compat_props, pc_compat_4_2, pc_compat_4_2_len); }
@@ -581,8 +562,6 @@ DEFINE_I440FX_MACHINE(v4_2, "pc-i440fx-4.2", NULL,static void pc_i440fx_4_1_machine_options (MachineClass *m) {pc_i440fx_4_2_machine_options (m); - m->alias =NULL ; - m->is_default = false;compat_props_add (m->compat_props, hw_compat_4_1, hw_compat_4_1_len);compat_props_add (m->compat_props, pc_compat_4_1, pc_compat_4_1_len); }
@@ -594,8 +573,6 @@ static void pc_i440fx_4_0_machine_options(MachineClass *m) {PCMachineClass *pcmc =PC_MACHINE_CLASS (m);pc_i440fx_4_1_machine_options (m); - m->alias =NULL ; - m->is_default = false; pcmc->default_cpu_version =CPU_VERSION_LEGACY ;compat_props_add (m->compat_props, hw_compat_4_0, hw_compat_4_0_len);compat_props_add (m->compat_props, pc_compat_4_0, pc_compat_4_0_len);
@@ -609,9 +586,7 @@ static void pc_i440fx_3_1_machine_options(MachineClass *m)PCMachineClass *pcmc =PC_MACHINE_CLASS (m);pc_i440fx_4_0_machine_options (m); - m->is_default = false; m->smbus_no_migration_support = true; - m->alias =NULL ; pcmc->pvh_enabled = false;compat_props_add (m->compat_props, hw_compat_3_1, hw_compat_3_1_len);compat_props_add (m->compat_props, pc_compat_3_1, pc_compat_3_1_len);
hw/i386/pc_q35.c +1 -15
@@ -355,6 +355,7 @@ static void pc_q35_machine_options(MachineClass *m)PCMachineClass *pcmc =PC_MACHINE_CLASS (m); pcmc->default_nic_model ="e1000e" ; pcmc->pci_root_uid =0 ; + pcmc->default_cpu_version =1 ; m->family ="pc_q35" ; m->desc ="Standard PC (Q35 + ICH9, 2009)" ;
@@ -372,10 +373,8 @@ static void pc_q35_machine_options(MachineClass *m)static void pc_q35_8_0_machine_options (MachineClass *m) { -PCMachineClass *pcmc =PC_MACHINE_CLASS (m);pc_q35_machine_options (m); m->alias ="q35" ; - pcmc->default_cpu_version =1 ; } DEFINE_Q35_MACHINE(v8_0, "pc-q35-8.0", NULL,
@@ -396,7 +395,6 @@ static void pc_q35_7_1_machine_options(MachineClass *m) {PCMachineClass *pcmc =PC_MACHINE_CLASS (m);pc_q35_7_2_machine_options (m); - m->alias =NULL ; pcmc->legacy_no_rng_seed = true;compat_props_add (m->compat_props, hw_compat_7_1, hw_compat_7_1_len);compat_props_add (m->compat_props, pc_compat_7_1, pc_compat_7_1_len);
@@ -409,7 +407,6 @@ static void pc_q35_7_0_machine_options(MachineClass *m) {PCMachineClass *pcmc =PC_MACHINE_CLASS (m);pc_q35_7_1_machine_options (m); - m->alias =NULL ; pcmc->enforce_amd_1tb_hole = false;compat_props_add (m->compat_props, hw_compat_7_0, hw_compat_7_0_len);compat_props_add (m->compat_props, pc_compat_7_0, pc_compat_7_0_len);
@@ -421,7 +418,6 @@ DEFINE_Q35_MACHINE(v7_0, "pc-q35-7.0", NULL,static void pc_q35_6_2_machine_options (MachineClass *m) {pc_q35_7_0_machine_options (m); - m->alias =NULL ;compat_props_add (m->compat_props, hw_compat_6_2, hw_compat_6_2_len);compat_props_add (m->compat_props, pc_compat_6_2, pc_compat_6_2_len); }
@@ -432,7 +428,6 @@ DEFINE_Q35_MACHINE(v6_2, "pc-q35-6.2", NULL,static void pc_q35_6_1_machine_options (MachineClass *m) {pc_q35_6_2_machine_options (m); - m->alias =NULL ;compat_props_add (m->compat_props, hw_compat_6_1, hw_compat_6_1_len);compat_props_add (m->compat_props, pc_compat_6_1, pc_compat_6_1_len); m->smp_props.prefer_sockets = true;
@@ -444,7 +439,6 @@ DEFINE_Q35_MACHINE(v6_1, "pc-q35-6.1", NULL,static void pc_q35_6_0_machine_options (MachineClass *m) {pc_q35_6_1_machine_options (m); - m->alias =NULL ;compat_props_add (m->compat_props, hw_compat_6_0, hw_compat_6_0_len);compat_props_add (m->compat_props, pc_compat_6_0, pc_compat_6_0_len); }
@@ -455,7 +449,6 @@ DEFINE_Q35_MACHINE(v6_0, "pc-q35-6.0", NULL,static void pc_q35_5_2_machine_options (MachineClass *m) {pc_q35_6_0_machine_options (m); - m->alias =NULL ;compat_props_add (m->compat_props, hw_compat_5_2, hw_compat_5_2_len);compat_props_add (m->compat_props, pc_compat_5_2, pc_compat_5_2_len); }
@@ -468,7 +461,6 @@ static void pc_q35_5_1_machine_options(MachineClass *m)PCMachineClass *pcmc =PC_MACHINE_CLASS (m);pc_q35_5_2_machine_options (m); - m->alias =NULL ;compat_props_add (m->compat_props, hw_compat_5_1, hw_compat_5_1_len);compat_props_add (m->compat_props, pc_compat_5_1, pc_compat_5_1_len); pcmc->kvmclock_create_always = false;
@@ -481,7 +473,6 @@ DEFINE_Q35_MACHINE(v5_1, "pc-q35-5.1", NULL,static void pc_q35_5_0_machine_options (MachineClass *m) {pc_q35_5_1_machine_options (m); - m->alias =NULL ; m->numa_mem_supported = true;compat_props_add (m->compat_props, hw_compat_5_0, hw_compat_5_0_len);compat_props_add (m->compat_props, pc_compat_5_0, pc_compat_5_0_len);
@@ -494,7 +485,6 @@ DEFINE_Q35_MACHINE(v5_0, "pc-q35-5.0", NULL,static void pc_q35_4_2_machine_options (MachineClass *m) {pc_q35_5_0_machine_options (m); - m->alias =NULL ;compat_props_add (m->compat_props, hw_compat_4_2, hw_compat_4_2_len);compat_props_add (m->compat_props, pc_compat_4_2, pc_compat_4_2_len); }
@@ -505,7 +495,6 @@ DEFINE_Q35_MACHINE(v4_2, "pc-q35-4.2", NULL,static void pc_q35_4_1_machine_options (MachineClass *m) {pc_q35_4_2_machine_options (m); - m->alias =NULL ;compat_props_add (m->compat_props, hw_compat_4_1, hw_compat_4_1_len);compat_props_add (m->compat_props, pc_compat_4_1, pc_compat_4_1_len); }
@@ -517,7 +506,6 @@ static void pc_q35_4_0_1_machine_options(MachineClass *m) {PCMachineClass *pcmc =PC_MACHINE_CLASS (m);pc_q35_4_1_machine_options (m); - m->alias =NULL ; pcmc->default_cpu_version =CPU_VERSION_LEGACY ;/* * This is the default machine for the 4.0-stable branch. It is basically
@@ -535,7 +523,6 @@ static void pc_q35_4_0_machine_options(MachineClass *m) {pc_q35_4_0_1_machine_options (m); m->default_kernel_irqchip_split = true; - m->alias =NULL ;/* Compat props are applied by the 4.0.1 machine */ }
@@ -549,7 +536,6 @@ static void pc_q35_3_1_machine_options(MachineClass *m)pc_q35_4_0_machine_options (m); m->default_kernel_irqchip_split = false; m->smbus_no_migration_support = true; - m->alias =NULL ; pcmc->pvh_enabled = false;compat_props_add (m->compat_props, hw_compat_3_1, hw_compat_3_1_len);compat_props_add (m->compat_props, pc_compat_3_1, pc_compat_3_1_len);
Signature · 1 line
MST
[PULL 10/41] vdpa: add vdpa-dev-pci support
In reply to Michael S. TsirkinFrom: Longpeng <[email protected]>
Supports vdpa-dev-pci, we can use the device as follow:
-device vhost-vdpa-device-pci,vhostdev=/dev/vhost-vdpa-X
Message-Id: <[email protected]>
--- hw/virtio/vdpa-dev-pci.c | 102 +++++++++++++++++++++++++++++++++++++++ hw/virtio/meson.build | 1 + 2 files changed, 103 insertions(+) create mode 100644 hw/virtio/vdpa-dev-pci.c
hw/virtio/vdpa-dev-pci.c new file +102 -0
@@ -0,0 +1,102 @@ +/* +* Vhost Vdpa Device PCI Bindings +* +* Copyright (c) Huawei Technologies Co., Ltd. 2022. All Rights Reserved. +* +* Authors: +* Longpeng <[email protected]> +* +* Largely based on the "vhost-user-blk-pci.c" and "vhost-user-blk.c" +* implemented by: +* Changpeng Liu <[email protected]> +* +* This work is licensed under the terms of the GNU LGPL, version 2 or later. +* See the COPYING.LIB file in the top-level directory. +*/ +#include "qemu/osdep.h" +#include <sys/ioctl.h> +#include <linux/vhost.h> +#include "hw/virtio/virtio.h" +#include "hw/virtio/vdpa-dev.h" +#include "hw/pci/pci.h" +#include "hw/qdev-properties.h" +#include "qapi/error.h" +#include "qemu/error-report.h" +#include "qemu/module.h" +#include "hw/virtio/virtio-pci.h" +#include "qom/object.h" + + +typedef struct VhostVdpaDevicePCI VhostVdpaDevicePCI ; + +#define TYPE_VHOST_VDPA_DEVICE_PCI "vhost-vdpa-device-pci-base" +DECLARE_INSTANCE_CHECKER (VhostVdpaDevicePCI,VHOST_VDPA_DEVICE_PCI , + TYPE_VHOST_VDPA_DEVICE_PCI) + +struct VhostVdpaDevicePCI { +VirtIOPCIProxy parent_obj; +VhostVdpaDevice vdev; +}; + +static void vhost_vdpa_device_pci_instance_init (Object *obj) +{ +VhostVdpaDevicePCI *dev =VHOST_VDPA_DEVICE_PCI (obj); + +virtio_instance_init_common (obj, &dev->vdev,sizeof (dev->vdev), +TYPE_VHOST_VDPA_DEVICE ); +object_property_add_alias (obj,"bootindex" ,OBJECT (&dev->vdev), +"bootindex" ); +} + +static Property vhost_vdpa_device_pci_properties[] = { +DEFINE_PROP_END_OF_LIST (), +}; + +static int vhost_vdpa_device_pci_post_init (VhostVdpaDevice *v,Error **errp) +{ +VhostVdpaDevicePCI *dev =container_of (v, VhostVdpaDevicePCI, vdev); +VirtIOPCIProxy *vpci_dev = &dev->parent_obj; + + vpci_dev->class_code =virtio_pci_get_class_id (v->vdev_id); + vpci_dev->trans_devid =virtio_pci_get_trans_devid (v->vdev_id); +/* one for config vector */ + vpci_dev->nvectors = v->num_queues +1 ; + +return 0 ; +} + +static void +vhost_vdpa_device_pci_realize (VirtIOPCIProxy *vpci_dev,Error **errp) +{ +VhostVdpaDevicePCI *dev =VHOST_VDPA_DEVICE_PCI (vpci_dev); + + dev->vdev.post_init = vhost_vdpa_device_pci_post_init; +qdev_realize (DEVICE (&dev->vdev),BUS (&vpci_dev->bus), errp); +} + +static void vhost_vdpa_device_pci_class_init (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); +VirtioPCIClass *k =VIRTIO_PCI_CLASS (klass); + +set_bit (DEVICE_CATEGORY_MISC , dc->categories); +device_class_set_props (dc, vhost_vdpa_device_pci_properties); + k->realize = vhost_vdpa_device_pci_realize; +} + +static const VirtioPCIDeviceTypeInfo vhost_vdpa_device_pci_info = { + .base_name =TYPE_VHOST_VDPA_DEVICE_PCI , + .generic_name ="vhost-vdpa-device-pci" , + .transitional_name ="vhost-vdpa-device-pci-transitional" , + .non_transitional_name ="vhost-vdpa-device-pci-non-transitional" , + .instance_size =sizeof (VhostVdpaDevicePCI), + .instance_init = vhost_vdpa_device_pci_instance_init, + .class_init = vhost_vdpa_device_pci_class_init, +}; + +static void vhost_vdpa_device_pci_register (void ) +{ +virtio_pci_types_register (&vhost_vdpa_device_pci_info); +} + +type_init (vhost_vdpa_device_pci_register);
hw/virtio/meson.build +1 -0
@@ -57,6 +57,7 @@ virtio_pci_ss.add(when: 'CONFIG_VIRTIO_SERIAL', if_true: files('virtio-serial-pc virtio_pci_ss.add(when: 'CONFIG_VIRTIO_PMEM', if_true: files('virtio-pmem-pci.c')) virtio_pci_ss.add(when: 'CONFIG_VIRTIO_IOMMU', if_true: files('virtio-iommu-pci.c')) virtio_pci_ss.add(when: 'CONFIG_VIRTIO_MEM', if_true: files('virtio-mem-pci.c')) +virtio_pci_ss.add(when: 'CONFIG_VHOST_VDPA_DEV', if_true: files('vdpa-dev-pci.c')) virtio_ss.add_all(when: 'CONFIG_VIRTIO_PCI', if_true: virtio_pci_ss)
Signature · 1 line
MST
[PULL 17/41] vdpa: request iova_range only once
In reply to Michael S. TsirkinFrom: Eugenio Pérez <[email protected]>
Currently iova range is requested once per queue pair in the case of net. Reduce the number of ioctls asking it once at initialization and reusing that value for each vhost_vdpa.
Message-Id: <[email protected]>
--- hw/virtio/vhost-vdpa.c | 15 --------------- net/vhost-vdpa.c | 27 ++++++++++++++------------- 2 files changed, 14 insertions(+), 28 deletions(-)
hw/virtio/vhost-vdpa.c +0 -15
@@ -365,19 +365,6 @@ static int vhost_vdpa_add_status(struct vhost_dev *dev, uint8_t status)return 0 ; } -static void vhost_vdpa_get_iova_range (struct vhost_vdpa *v) -{ -int ret =vhost_vdpa_call (v->dev,VHOST_VDPA_GET_IOVA_RANGE , - &v->iova_range); -if (ret !=0 ) { - v->iova_range.first =0 ; - v->iova_range.last =UINT64_MAX ; - } - -trace_vhost_vdpa_get_iova_range (v->dev, v->iova_range.first, - v->iova_range.last); -} -/* * The use of this function is for requests that only need to be * applied once. Typically such request occurs at the beginning
@@ -465,8 +452,6 @@ static int vhost_vdpa_init(struct vhost_dev *dev, void *opaque, Error **errp) goto err; } -vhost_vdpa_get_iova_range (v); -if (!vhost_vdpa_first_dev (dev)) {return 0 ; }
net/vhost-vdpa.c +14 -13
@@ -541,14 +541,15 @@ static const VhostShadowVirtqueueOps vhost_vdpa_net_svq_ops = { };static NetClientState *net_vhost_vdpa_init (NetClientState *peer, -const char *device, -const char *name, -int vdpa_device_fd, -int queue_pair_index, -int nvqs, -bool is_datapath, -bool svq, -VhostIOVATree *iova_tree) +const char *device, +const char *name, +int vdpa_device_fd, +int queue_pair_index, +int nvqs, +bool is_datapath, +bool svq, +struct vhost_vdpa_iova_range iova_range, +VhostIOVATree *iova_tree) {NetClientState *nc =NULL ;VhostVDPAState *s;
@@ -567,6 +568,7 @@ static NetClientState *net_vhost_vdpa_init(NetClientState *peer, s->vhost_vdpa.device_fd = vdpa_device_fd; s->vhost_vdpa.index = queue_pair_index; s->vhost_vdpa.shadow_vqs_enabled = svq; + s->vhost_vdpa.iova_range = iova_range; s->vhost_vdpa.iova_tree = iova_tree;if (!is_datapath) { s->cvq_cmd_out_buffer = qemu_memalign(qemu_real_host_page_size(),
@@ -646,6 +648,7 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char *name,int vdpa_device_fd; g_autofree NetClientState **ncs = NULL;g_autoptr (VhostIOVATree) iova_tree =NULL ; +struct vhost_vdpa_iova_range iova_range;NetClientState *nc;int queue_pairs, r, i =0 , has_cvq =0 ;
@@ -689,14 +692,12 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char *name,return queue_pairs; } +vhost_vdpa_get_iova_range (vdpa_device_fd, &iova_range);if (opts->x_svq) { -struct vhost_vdpa_iova_range iova_range; -if (!vhost_vdpa_net_valid_svq_features (features, errp)) { goto err_svq; } -vhost_vdpa_get_iova_range (vdpa_device_fd, &iova_range); iova_tree =vhost_iova_tree_new (iova_range.first, iova_range.last); }
@@ -705,7 +706,7 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char *name,for (i =0 ; i < queue_pairs; i++) { ncs[i] =net_vhost_vdpa_init (peer,TYPE_VHOST_VDPA , name, vdpa_device_fd, i,2 , true, opts->x_svq, - iova_tree); + iova_range, iova_tree);if (!ncs[i]) goto err; }
@@ -713,7 +714,7 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char *name,if (has_cvq) { nc =net_vhost_vdpa_init (peer,TYPE_VHOST_VDPA , name, vdpa_device_fd, i,1 , false, - opts->x_svq, iova_tree); + opts->x_svq, iova_range, iova_tree);if (!nc) goto err; }
Signature · 1 line
MST
[PULL 18/41] vdpa: move SVQ vring features check to net/
In reply to Michael S. TsirkinFrom: Eugenio Pérez <[email protected]>
The next patches will start control SVQ if possible. However, we don't know if that will be possible at qemu boot anymore.
Since the moved checks will be already evaluated at net/ to know if it is ok to shadow CVQ, move them.
Message-Id: <[email protected]>
--- hw/virtio/vhost-vdpa.c | 32 ++------------------------------ net/vhost-vdpa.c | 3 ++- 2 files changed, 4 insertions(+), 31 deletions(-)
hw/virtio/vhost-vdpa.c +2 -30
@@ -389,29 +389,9 @@ static int vhost_vdpa_get_dev_features(struct vhost_dev *dev,return ret; } -static int vhost_vdpa_init_svq (struct vhost_dev *hdev,struct vhost_vdpa *v, -Error **errp) +static void vhost_vdpa_init_svq (struct vhost_dev *hdev,struct vhost_vdpa *v) {g_autoptr (GPtrArray) shadow_vqs =NULL ; -uint64_t dev_features, svq_features; -int r; -bool ok; - -if (!v->shadow_vqs_enabled) { -return 0 ; - } - - r =vhost_vdpa_get_dev_features (hdev, &dev_features); -if (r !=0 ) { -error_setg_errno (errp, -r,"Can't get vdpa device features" ); -return r; - } - - svq_features = dev_features; - ok =vhost_svq_valid_features (svq_features, errp); -if (unlikely (!ok)) { -return -1 ; - } shadow_vqs =g_ptr_array_new_full (hdev->nvqs, vhost_svq_free);for (unsigned n =0 ; n < hdev->nvqs; ++n) {
@@ -422,7 +402,6 @@ static int vhost_vdpa_init_svq(struct vhost_dev *hdev, struct vhost_vdpa *v, } v->shadow_vqs =g_steal_pointer (&shadow_vqs); -return 0 ; }static int vhost_vdpa_init (struct vhost_dev *dev,void *opaque,Error **errp)
@@ -447,10 +426,7 @@ static int vhost_vdpa_init(struct vhost_dev *dev, void *opaque, Error **errp) dev->opaque = opaque ; v->listener = vhost_vdpa_memory_listener; v->msg_type =VHOST_IOTLB_MSG_V2 ; - ret =vhost_vdpa_init_svq (dev, v, errp); -if (ret) { - goto err; - } +vhost_vdpa_init_svq (dev, v);if (!vhost_vdpa_first_dev (dev)) {return 0 ;
@@ -460,10 +436,6 @@ static int vhost_vdpa_init(struct vhost_dev *dev, void *opaque, Error **errp) VIRTIO_CONFIG_S_DRIVER);return 0 ; - -err: -ram_block_discard_disable (false); -return ret; } static void vhost_vdpa_host_notifier_uninit(struct vhost_dev *dev,
net/vhost-vdpa.c +2 -1
@@ -118,9 +118,10 @@ static bool vhost_vdpa_net_valid_svq_features(uint64_t features, Error **errp)if (invalid_dev_features) {error_setg (errp,"vdpa svq does not work with features 0x%" PRIx64, invalid_dev_features); +return false; } -return !invalid_dev_features; +return vhost_svq_valid_features (features, errp); }static int vhost_vdpa_net_check_device_id (struct vhost_net *net)
Signature · 1 line
MST
[PULL 27/41] vhost: fix vq dirty bitmap syncing when vIOMMU is enabled
In reply to Michael S. TsirkinFrom: Jason Wang <[email protected]>
When vIOMMU is enabled, the vq->used_phys is actually the IOVA not GPA. So we need to translate it to GPA before the syncing otherwise we may hit the following crash since IOVA could be out of the scope of the GPA log size. This could be noted when using virtio-IOMMU with vhost using 1G memory.
Message-Id: <[email protected]>
--- hw/virtio/vhost.c | 84 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 64 insertions(+), 20 deletions(-)
hw/virtio/vhost.c +64 -20
@@ -20,6 +20,7 @@#include "qemu/range.h" #include "qemu/error-report.h" #include "qemu/memfd.h" +#include "qemu/log.h" #include "standard-headers/linux/vhost_types.h" #include "hw/virtio/virtio-bus.h" #include "hw/virtio/virtio-access.h"
@@ -106,6 +107,24 @@ static void vhost_dev_sync_region(struct vhost_dev *dev, } } +static bool vhost_dev_has_iommu (struct vhost_dev *dev) +{ +VirtIODevice *vdev = dev->vdev; + +/* +* For vhost, VIRTIO_F_IOMMU_PLATFORM means the backend support +* incremental memory mapping API via IOTLB API. For platform that +* does not have IOMMU, there's no need to enable this feature +* which may cause unnecessary IOTLB miss/update transactions. +*/ +if (vdev) { +return virtio_bus_device_iommu_enabled (vdev) && +virtio_host_has_feature (vdev,VIRTIO_F_IOMMU_PLATFORM ); + }else { +return false; + } +} + static int vhost_sync_dirty_bitmap(struct vhost_dev *dev, MemoryRegionSection *section, hwaddr first,
@@ -137,8 +156,51 @@ static int vhost_sync_dirty_bitmap(struct vhost_dev *dev,continue ; } -vhost_dev_sync_region (dev, section, start_addr, end_addr, vq->used_phys, -range_get_last (vq->used_phys, vq->used_size)); +if (vhost_dev_has_iommu (dev)) { +IOMMUTLBEntry iotlb; +hwaddr used_phys = vq->used_phys, used_size = vq->used_size; +hwaddr phys, s, offset; + +while (used_size) { +rcu_read_lock (); + iotlb =address_space_get_iotlb_entry (dev->vdev->dma_as, + used_phys, + true, +MEMTXATTRS_UNSPECIFIED ); +rcu_read_unlock (); + +if (!iotlb.target_as) { +qemu_log_mask (LOG_GUEST_ERROR ,"translation " +"failure for used_iova %" PRIx64"\n" , + used_phys); +return -EINVAL ; + } + + offset = used_phys & iotlb.addr_mask; + phys = iotlb.translated_addr + offset; + +/* +* Distance from start of used ring until last byte of +* IOMMU page. +*/ + s = iotlb.addr_mask - offset; +/* +* Size of used ring, or of the part of it until end +* of IOMMU page. To avoid zero result, do the adding +* outside of MIN(). +*/ + s =MIN (s, used_size -1 ) +1 ; + +vhost_dev_sync_region (dev, section, start_addr, end_addr, phys, +range_get_last (phys, s)); + used_size -= s; + used_phys += s; + } + }else { +vhost_dev_sync_region (dev, section, start_addr, + end_addr, vq->used_phys, +range_get_last (vq->used_phys, vq->used_size)); + } }return 0 ; }
@@ -306,24 +368,6 @@ static inline void vhost_dev_log_resize(struct vhost_dev *dev, uint64_t size) dev->log_size = size; } -static bool vhost_dev_has_iommu (struct vhost_dev *dev) -{ -VirtIODevice *vdev = dev->vdev; - -/* -* For vhost, VIRTIO_F_IOMMU_PLATFORM means the backend support -* incremental memory mapping API via IOTLB API. For platform that -* does not have IOMMU, there's no need to enable this feature -* which may cause unnecessary IOTLB miss/update transactions. -*/ -if (vdev) { -return virtio_bus_device_iommu_enabled (vdev) && -virtio_host_has_feature (vdev,VIRTIO_F_IOMMU_PLATFORM ); - }else { -return false; - } -} -static void *vhost_memory_map (struct vhost_dev *dev,hwaddr addr,hwaddr *plen,bool is_write) {
Signature · 1 line
MST
[PULL 40/41] libvhost-user: Switch to unsigned int for inuse field in struct VuVirtq
In reply to Michael S. TsirkinFrom: Marcel Holtmann <[email protected]>
It seems there is no need to keep the inuse field signed and end up with compiler warnings for sign-compare.
CC libvhost-user.olibvhost-user.c: In function ‘vu_queue_pop’:
libvhost-user.c:2763:19: error: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ [-Werror=sign-compare]
2763 | if (vq->inuse >= vq->vring.num) {
| ^~libvhost-user.c: In function ‘vu_queue_rewind’:
libvhost-user.c:2808:13: error: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Werror=sign-compare]
2808 | if (num > vq->inuse) {
| ^
Instead of casting the comparision to unsigned int, just make the inuse field unsigned int in the fist place.
Message-Id: <[email protected]>
--- subprojects/libvhost-user/libvhost-user.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
subprojects/libvhost-user/libvhost-user.h +1 -1
@@ -343,7 +343,7 @@ typedef struct VuVirtq {/* Notification enabled? */ bool notification; -int inuse; +unsigned int inuse;vu_queue_handler_cb handler;
Signature · 1 line
MST
[PULL 09/41] vdpa: add vdpa-dev support
In reply to Michael S. TsirkinFrom: Longpeng <[email protected]>
Supports vdpa-dev, we can use the deivce directly:
-M microvm -m 512m -smp 2 -kernel ... -initrd ... -device \
vhost-vdpa-device,vhostdev=/dev/vhost-vdpa-x
Message-Id: <[email protected]>
--- include/hw/virtio/vdpa-dev.h | 43 ++++ hw/virtio/vdpa-dev.c | 376 +++++++++++++++++++++++++++++++++++ hw/virtio/Kconfig | 5 + hw/virtio/meson.build | 1 + 4 files changed, 425 insertions(+) create mode 100644 include/hw/virtio/vdpa-dev.h create mode 100644 hw/virtio/vdpa-dev.c
include/hw/virtio/vdpa-dev.h new file +43 -0
@@ -0,0 +1,43 @@ +/* +* Vhost Vdpa Device +* +* Copyright (c) Huawei Technologies Co., Ltd. 2022. All Rights Reserved. +* +* Authors: +* Longpeng <[email protected]> +* +* Largely based on the "vhost-user-blk.h" implemented by: +* Changpeng Liu <[email protected]> +* +* This work is licensed under the terms of the GNU LGPL, version 2 or later. +* See the COPYING.LIB file in the top-level directory. +*/ +#ifndef _VHOST_VDPA_DEVICE_H +#define _VHOST_VDPA_DEVICE_H + +#include "hw/virtio/vhost.h" +#include "hw/virtio/vhost-vdpa.h" +#include "qom/object.h" + + +#define TYPE_VHOST_VDPA_DEVICE "vhost-vdpa-device" +OBJECT_DECLARE_SIMPLE_TYPE(VhostVdpaDevice, VHOST_VDPA_DEVICE) + +struct VhostVdpaDevice { +VirtIODevice parent_obj; +char *vhostdev; +int vhostfd; +int32_t bootindex; +uint32_t vdev_id; +uint32_t num_queues; +struct vhost_dev dev; +struct vhost_vdpa vdpa; +VirtQueue **virtqs; +uint8_t *config; +int config_size; +uint16_t queue_size; +bool started; +int (*post_init)(VhostVdpaDevice *v,Error **errp); +}; + +#endif
hw/virtio/vdpa-dev.c new file +376 -0
376 lines not on this page · raw message
hw/virtio/Kconfig +5 -0
@@ -85,3 +85,8 @@ config VHOST_USER_GPIO bool default y depends on VIRTIO && VHOST_USER + +config VHOST_VDPA_DEV + bool + default y + depends on VIRTIO && VHOST_VDPA && LINUX
hw/virtio/meson.build +1 -0
@@ -31,6 +31,7 @@ virtio_ss.add(when: 'CONFIG_VHOST_USER_I2C', if_true: files('vhost-user-i2c.c')) virtio_ss.add(when: 'CONFIG_VHOST_USER_RNG', if_true: files('vhost-user-rng.c')) virtio_ss.add(when: 'CONFIG_VHOST_USER_GPIO', if_true: files('vhost-user-gpio.c')) virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_GPIO'], if_true: files('vhost-user-gpio-pci.c')) +virtio_ss.add(when: 'CONFIG_VHOST_VDPA_DEV', if_true: files('vdpa-dev.c')) virtio_pci_ss = ss.source_set() virtio_pci_ss.add(when: 'CONFIG_VHOST_VSOCK', if_true: files('vhost-vsock-pci.c'))
Signature · 1 line
MST
[PULL 12/41] vdpa: use v->shadow_vqs_enabled in vhost_vdpa_svqs_start & stop
In reply to Michael S. TsirkinFrom: Eugenio Pérez <[email protected]>
This function used to trust in v->shadow_vqs != NULL to know if it must start svq or not.
This is not going to be valid anymore, as qemu is going to allocate svq array unconditionally (but it will only start them conditionally).
Message-Id: <[email protected]>
--- hw/virtio/vhost-vdpa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/virtio/vhost-vdpa.c +2 -2
@@ -1029,7 +1029,7 @@ static bool vhost_vdpa_svqs_start(struct vhost_dev *dev)Error *err =NULL ;unsigned i; -if (!v->shadow_vqs) { +if (!v->shadow_vqs_enabled) {return true; }
@@ -1082,7 +1082,7 @@ static void vhost_vdpa_svqs_stop(struct vhost_dev *dev) {struct vhost_vdpa *v = dev->opaque; -if (!v->shadow_vqs) { +if (!v->shadow_vqs_enabled) {return ; }
Signature · 1 line
MST
[PULL 38/41] hw/virtio: Extract config read/write accessors to virtio-config-io.c
In reply to Michael S. TsirkinFrom: Philippe Mathieu-Daudé <[email protected]>
These config helpers use the target-dependent LD/ST API.
Message-Id: <[email protected]>
--- hw/virtio/virtio-config-io.c | 204 +++++++++++++++++++++++++++++++++++ hw/virtio/virtio.c | 190 -------------------------------- hw/virtio/meson.build | 1 + 3 files changed, 205 insertions(+), 190 deletions(-) create mode 100644 hw/virtio/virtio-config-io.c
hw/virtio/virtio-config-io.c new file +204 -0
@@ -0,0 +1,204 @@ +/* +* Virtio Support +* +* Copyright IBM, Corp. 2007 +* +* Authors: +* Anthony Liguori <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "qemu/osdep.h" +#include "hw/virtio/virtio.h" +#include "cpu.h" + +uint32_t virtio_config_readb (VirtIODevice *vdev,uint32_t addr) +{ +VirtioDeviceClass *k =VIRTIO_DEVICE_GET_CLASS (vdev); +uint8_t val; + +if (addr +sizeof (val) > vdev->config_len) { +return (uint32_t )-1 ; + } + + k->get_config (vdev, vdev->config); + + val =ldub_p (vdev->config + addr); +return val; +} + +uint32_t virtio_config_readw (VirtIODevice *vdev,uint32_t addr) +{ +VirtioDeviceClass *k =VIRTIO_DEVICE_GET_CLASS (vdev); +uint16_t val; + +if (addr +sizeof (val) > vdev->config_len) { +return (uint32_t )-1 ; + } + + k->get_config (vdev, vdev->config); + + val =lduw_p (vdev->config + addr); +return val; +} + +uint32_t virtio_config_readl (VirtIODevice *vdev,uint32_t addr) +{ +VirtioDeviceClass *k =VIRTIO_DEVICE_GET_CLASS (vdev); +uint32_t val; + +if (addr +sizeof (val) > vdev->config_len) { +return (uint32_t )-1 ; + } + + k->get_config (vdev, vdev->config); + + val =ldl_p (vdev->config + addr); +return val; +} + +void virtio_config_writeb (VirtIODevice *vdev,uint32_t addr,uint32_t data) +{ +VirtioDeviceClass *k =VIRTIO_DEVICE_GET_CLASS (vdev); +uint8_t val = data; + +if (addr +sizeof (val) > vdev->config_len) { +return ; + } + +stb_p (vdev->config + addr, val); + +if (k->set_config) { + k->set_config (vdev, vdev->config); + } +} + +void virtio_config_writew (VirtIODevice *vdev,uint32_t addr,uint32_t data) +{ +VirtioDeviceClass *k =VIRTIO_DEVICE_GET_CLASS (vdev); +uint16_t val = data; + +if (addr +sizeof (val) > vdev->config_len) { +return ; + } + +stw_p (vdev->config + addr, val); + +if (k->set_config) { + k->set_config (vdev, vdev->config); + } +} + +void virtio_config_writel (VirtIODevice *vdev,uint32_t addr,uint32_t data) +{ +VirtioDeviceClass *k =VIRTIO_DEVICE_GET_CLASS (vdev); +uint32_t val = data; + +if (addr +sizeof (val) > vdev->config_len) { +return ; + } + +stl_p (vdev->config + addr, val); + +if (k->set_config) { + k->set_config (vdev, vdev->config); + } +} + +uint32_t virtio_config_modern_readb (VirtIODevice *vdev,uint32_t addr) +{ +VirtioDeviceClass *k =VIRTIO_DEVICE_GET_CLASS (vdev); +uint8_t val; + +if (addr +sizeof (val) > vdev->config_len) { +return (uint32_t )-1 ; + } + + k->get_config (vdev, vdev->config); + + val =ldub_p (vdev->config + addr); +return val; +} + +uint32_t virtio_config_modern_readw (VirtIODevice *vdev,uint32_t addr) +{ +VirtioDeviceClass *k =VIRTIO_DEVICE_GET_CLASS (vdev); +uint16_t val; + +if (addr +sizeof (val) > vdev->config_len) { +return (uint32_t )-1 ; + } + + k->get_config (vdev, vdev->config); + + val =lduw_le_p (vdev->config + addr); +return val; +} + +uint32_t virtio_config_modern_readl (VirtIODevice *vdev,uint32_t addr) +{ +VirtioDeviceClass *k =VIRTIO_DEVICE_GET_CLASS (vdev); +uint32_t val; + +if (addr +sizeof (val) > vdev->config_len) { +return (uint32_t )-1 ; + } + + k->get_config (vdev, vdev->config); + + val =ldl_le_p (vdev->config + addr); +return val; +} + +void virtio_config_modern_writeb (VirtIODevice *vdev, +uint32_t addr,uint32_t data) +{ +VirtioDeviceClass *k =VIRTIO_DEVICE_GET_CLASS (vdev); +uint8_t val = data; + +if (addr +sizeof (val) > vdev->config_len) { +return ; + } + +stb_p (vdev->config + addr, val); + +if (k->set_config) { + k->set_config (vdev, vdev->config); + } +} + +void virtio_config_modern_writew (VirtIODevice *vdev, +uint32_t addr,uint32_t data) +{ +VirtioDeviceClass *k =VIRTIO_DEVICE_GET_CLASS (vdev); +uint16_t val = data; + +if (addr +sizeof (val) > vdev->config_len) { +return ; + } + +stw_le_p (vdev->config + addr, val); + +if (k->set_config) { + k->set_config (vdev, vdev->config); + } +} + +void virtio_config_modern_writel (VirtIODevice *vdev, +uint32_t addr,uint32_t data) +{ +VirtioDeviceClass *k =VIRTIO_DEVICE_GET_CLASS (vdev); +uint32_t val = data; + +if (addr +sizeof (val) > vdev->config_len) { +return ; + } + +stl_le_p (vdev->config + addr, val); + +if (k->set_config) { + k->set_config (vdev, vdev->config); + } +} +
hw/virtio/virtio.c +0 -190
202 lines not on this page · raw message
hw/virtio/meson.build +1 -0
@@ -5,6 +5,7 @@ softmmu_virtio_ss.add(when: 'CONFIG_VIRTIO_MMIO', if_true: files('virtio-mmio.c' specific_virtio_ss = ss.source_set() specific_virtio_ss.add(files('virtio.c')) +specific_virtio_ss.add(files('virtio-config-io.c')) if have_vhost specific_virtio_ss.add(files('vhost.c', 'vhost-backend.c', 'vhost-iova-tree.c'))
Signature · 1 line
MST
[PULL 23/41] vdpa: always start CVQ in SVQ mode if possible
In reply to Michael S. TsirkinFrom: Eugenio Pérez <[email protected]>
Isolate control virtqueue in its own group, allowing to intercept control commands but letting dataplane run totally passthrough to the guest.
Message-Id: <[email protected]>
--- hw/virtio/vhost-vdpa.c | 3 +- net/vhost-vdpa.c | 110 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 111 insertions(+), 2 deletions(-)
hw/virtio/vhost-vdpa.c +2 -1
@@ -638,7 +638,8 @@ static int vhost_vdpa_set_backend_cap(struct vhost_dev *dev) {uint64_t features;uint64_t f =0x1ULL <<VHOST_BACKEND_F_IOTLB_MSG_V2 | -0x1ULL <<VHOST_BACKEND_F_IOTLB_BATCH ; +0x1ULL <<VHOST_BACKEND_F_IOTLB_BATCH | +0x1ULL <<VHOST_BACKEND_F_IOTLB_ASID ;int r;if (vhost_vdpa_call (dev,VHOST_GET_BACKEND_FEATURES , &features)) {
net/vhost-vdpa.c +109 -1
138 lines not on this page · raw message
Signature · 1 line
MST
[PULL 32/41] hw/acpi: Rename tco.c -> ich9_tco.c
In reply to Michael S. TsirkinFrom: Philippe Mathieu-Daudé <[email protected]>
tco.c contains the ICH9 implementation of its "total cost of ownership". Rename it accordingly to emphasis this is a part of the ICH9 model.
Message-Id: <[email protected]>
---
include/hw/acpi/ich9.h | 2 +-
include/hw/acpi/{tco.h => ich9_tco.h} | 2 +-
hw/acpi/ich9.c | 2 +-
hw/acpi/{tco.c => ich9_tco.c} | 2 +-
tests/qtest/tco-test.c | 2 +-
MAINTAINERS | 4 ++--
hw/acpi/meson.build | 2 +-
7 files changed, 8 insertions(+), 8 deletions(-)
rename include/hw/acpi/{tco.h => ich9_tco.h} (97%)
rename hw/acpi/{tco.c => ich9_tco.c} (99%)include/hw/acpi/ich9.h +1 -1
@@ -27,7 +27,7 @@#include "hw/acpi/pcihp.h" #include "hw/acpi/memory_hotplug.h" #include "hw/acpi/acpi_dev_interface.h" -#include "hw/acpi/tco.h" +#include "hw/acpi/ich9_tco.h" #define ACPI_PCIHP_ADDR_ICH9 0x0cc0
include/hw/acpi/ich9_tco.h renamed from include/hw/acpi/tco.h +1 -1
@@ -1,5 +1,5 @@/* -* QEMU ICH9 TCO emulation +* QEMU ICH9 TCO emulation (total cost of ownership) * * Copyright (c) 2015 Paulo Alcantara <[email protected]> *
hw/acpi/ich9.c +1 -1
@@ -34,7 +34,7 @@#include "sysemu/reset.h" #include "sysemu/runstate.h" #include "hw/acpi/acpi.h" -#include "hw/acpi/tco.h" +#include "hw/acpi/ich9_tco.h" #include "hw/i386/ich9.h" #include "hw/mem/pc-dimm.h"
hw/acpi/ich9_tco.c renamed from hw/acpi/tco.c +1 -1
@@ -12,7 +12,7 @@#include "hw/i386/ich9.h" #include "migration/vmstate.h" -#include "hw/acpi/tco.h" +#include "hw/acpi/ich9_tco.h" #include "trace.h" enum {
tests/qtest/tco-test.c +1 -1
@@ -16,7 +16,7 @@#include "hw/pci/pci_regs.h" #include "hw/i386/ich9.h" #include "hw/acpi/ich9.h" -#include "hw/acpi/tco.h" +#include "hw/acpi/ich9_tco.h" #define RCBA_BASE_ADDR 0xfed1c000#define PM_IO_BASE_ADDR 0xb000
MAINTAINERS +2 -2
@@ -1659,8 +1659,8 @@ F: hw/isa/piix3.c F: hw/isa/lpc_ich9.c F: hw/i2c/smbus_ich9.c F: hw/acpi/piix4.c -F: hw/acpi/ich9.c -F: include/hw/acpi/ich9.h +F: hw/acpi/ich9*.c +F: include/hw/acpi/ich9*.h F: include/hw/southbridge/piix.h F: hw/misc/sga.c F: hw/isa/apm.c
hw/acpi/meson.build +1 -1
@@ -22,7 +22,7 @@ acpi_ss.add(when: 'CONFIG_ACPI_PIIX4', if_true: files('piix4.c')) acpi_ss.add(when: 'CONFIG_ACPI_PCIHP', if_true: files('pcihp.c')) acpi_ss.add(when: 'CONFIG_ACPI_PCIHP', if_false: files('acpi-pci-hotplug-stub.c')) acpi_ss.add(when: 'CONFIG_ACPI_VIOT', if_true: files('viot.c')) -acpi_ss.add(when: 'CONFIG_ACPI_X86_ICH', if_true: files('ich9.c', 'tco.c')) +acpi_ss.add(when: 'CONFIG_ACPI_X86_ICH', if_true: files('ich9.c', 'ich9_tco.c')) acpi_ss.add(when: 'CONFIG_ACPI_ERST', if_true: files('erst.c')) acpi_ss.add(when: 'CONFIG_IPMI', if_true: files('ipmi.c'), if_false: files('ipmi-stub.c')) acpi_ss.add(when: 'CONFIG_PC', if_false: files('acpi-x86-stub.c'))
Signature · 1 line
MST
[PULL 25/41] include/hw: attempt to document VirtIO feature variables
In reply to Michael S. TsirkinFrom: Alex Bennée <[email protected]>
We have a bunch of variables associated with the device and the vhost backend which are used inconsistently throughout the code base. Lets start trying to bring some order by agreeing what each variable is for.
Message-Id: <[email protected]>
--- include/hw/virtio/vhost.h | 25 ++++++++++++++++++++++--- include/hw/virtio/virtio.h | 19 ++++++++++++++++++- 2 files changed, 40 insertions(+), 4 deletions(-)
include/hw/virtio/vhost.h +22 -3
@@ -88,13 +88,32 @@ struct vhost_dev {int vq_index_end;/* if non-zero, minimum required value for max_queues */ int num_queues; +/** +* vhost feature handling requires matching the feature set +* offered by a backend which may be a subset of the total +* features eventually offered to the guest. +* +* @features: available features provided by the backend +* @acked_features: final negotiated features with front-end driver +* +* @backend_features: this is used in a couple of places to either +* store VHOST_USER_F_PROTOCOL_FEATURES to apply to +* VHOST_USER_SET_FEATURES or VHOST_NET_F_VIRTIO_NET_HDR. Its +* future use should be discouraged and the variable retired as +* its easy to confuse with the VirtIO backend_features. +*/ uint64_t features; -/** @acked_features: final set of negotiated features */ uint64_t acked_features; -/** @backend_features: backend specific feature bits */ uint64_t backend_features; -/** @protocol_features: final negotiated protocol features */ + +/** +* @protocol_features: is the vhost-user only feature set by +* VHOST_USER_SET_PROTOCOL_FEATURES. Protocol features are only +* negotiated if VHOST_USER_F_PROTOCOL_FEATURES has been offered +* by the backend (see @features). +*/ uint64_t protocol_features; +uint64_t max_queues;uint64_t backend_cap;/* @started: is the vhost device started? */
include/hw/virtio/virtio.h +18 -1
@@ -93,6 +93,12 @@ enum virtio_device_endian { VIRTIO_DEVICE_ENDIAN_BIG, }; +/** +* struct VirtIODevice - common VirtIO structure +* @name: name of the device +* @status: VirtIO Device Status field +* +*/ struct VirtIODevice {DeviceState parent_obj;
@@ -100,9 +106,20 @@ struct VirtIODeviceuint8_t status;uint8_t isr;uint16_t queue_sel; -uint64_t guest_features; +/** +* These fields represent a set of VirtIO features at various +* levels of the stack. @host_features indicates the complete +* feature set the VirtIO device can offer to the driver. +* @guest_features indicates which features the VirtIO driver has +* selected by writing to the feature register. Finally +* @backend_features represents everything supported by the +* backend (e.g. vhost) and could potentially be a subset of the +* total feature set offered by QEMU. +*/ uint64_t host_features; +uint64_t guest_features;uint64_t backend_features; +size_t config_len;void *config;uint16_t config_vector;
Signature · 1 line
MST
[PULL 16/41] vdpa: add vhost_vdpa_net_valid_svq_features
In reply to Michael S. TsirkinFrom: Eugenio Pérez <[email protected]>
It will be reused at vdpa device start so let's extract in its own function.
Message-Id: <[email protected]>
--- net/vhost-vdpa.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-)
net/vhost-vdpa.c +17 -9
@@ -107,6 +107,22 @@ VHostNetState *vhost_vdpa_get_vhost_net(NetClientState *nc)return s->vhost_net; } +static bool vhost_vdpa_net_valid_svq_features (uint64_t features,Error **errp) +{ +uint64_t invalid_dev_features = + features & ~vdpa_svq_device_features & +/* Transport are all accepted at this point */ + ~MAKE_64BIT_MASK (VIRTIO_TRANSPORT_F_START , +VIRTIO_TRANSPORT_F_END -VIRTIO_TRANSPORT_F_START ); + +if (invalid_dev_features) { +error_setg (errp,"vdpa svq does not work with features 0x%" PRIx64, + invalid_dev_features); + } + +return !invalid_dev_features; +} +static int vhost_vdpa_net_check_device_id (struct vhost_net *net) {uint32_t device_id;
@@ -676,15 +692,7 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char *name,if (opts->x_svq) {struct vhost_vdpa_iova_range iova_range; -uint64_t invalid_dev_features = - features & ~vdpa_svq_device_features & -/* Transport are all accepted at this point */ - ~MAKE_64BIT_MASK (VIRTIO_TRANSPORT_F_START , -VIRTIO_TRANSPORT_F_END -VIRTIO_TRANSPORT_F_START ); - -if (invalid_dev_features) { -error_setg (errp,"vdpa svq does not work with features 0x%" PRIx64, - invalid_dev_features); +if (!vhost_vdpa_net_valid_svq_features (features, errp)) { goto err_svq; }
Signature · 1 line
MST
[PULL 28/41] remove DEC 21154 PCI bridge
In reply to Michael S. TsirkinFrom: Igor Mammedov <[email protected]>
Code has not been used practically since its inception (2004)
f2aa58c6f4a20 UniNorth PCI bridge support
or maybe even earlier, but it was consuming contributors time as QEMU was being rewritten.
Drop it for now. Whomever would like to actually use the thing, can make sure it actually works/reintroduce it back when there is a user.
PS:
I've stumbled upon this when replacing PCIDeviceClass::is_bridge field with QOM cast to PCI_BRIDGE type. Unused DEC 21154 was the only one trying to use the field with plain PCIDevice. It's not worth keeping the field around for the sake of the code that was commented out 'forever'.
Message-Id: <[email protected]>
--- hw/pci-bridge/dec.h | 9 --- include/hw/pci/pci_ids.h | 1 - hw/pci-bridge/dec.c | 164 -------------------------------------- hw/pci-host/uninorth.c | 9 +-- hw/pci-bridge/meson.build | 2 - 5 files changed, 4 insertions(+), 181 deletions(-) delete mode 100644 hw/pci-bridge/dec.h delete mode 100644 hw/pci-bridge/dec.c
hw/pci-bridge/dec.h deleted +0 -9
@@ -1,9 +0,0 @@ -#ifndef HW_PCI_BRIDGE_DEC_H -#define HW_PCI_BRIDGE_DEC_H - - -#define TYPE_DEC_21154 "dec-21154-sysbus" - -PCIBus *pci_dec_21154_init (PCIBus *parent_bus,int devfn); - -#endif
include/hw/pci/pci_ids.h +0 -1
@@ -169,7 +169,6 @@#define PCI_VENDOR_ID_DEC 0x1011#define PCI_DEVICE_ID_DEC_21143 0x0019 -#define PCI_DEVICE_ID_DEC_21154 0x0026#define PCI_VENDOR_ID_CIRRUS 0x1013
hw/pci-bridge/dec.c deleted +0 -164
164 lines not on this page · raw message
hw/pci-host/uninorth.c +4 -5
@@ -128,11 +128,10 @@ static void pci_unin_main_realize(DeviceState *dev, Error **errp)pci_create_simple (h->bus,PCI_DEVFN (11 ,0 ),"uni-north-pci" ); -/* DEC 21154 bridge */ -#if 0 -/* XXX: not activated as PPC BIOS doesn't handle multiple buses properly */ -pci_create_simple (h->bus,PCI_DEVFN (12 ,0 ),"dec-21154" ); -#endif +/* +* DEC 21154 bridge was unused for many years, this comment is +* a placeholder for whoever wishes to resurrect it +*/ }static void pci_unin_main_init (Object *obj)
hw/pci-bridge/meson.build +0 -2
@@ -8,8 +8,6 @@ pci_ss.add(when: 'CONFIG_PXB', if_true: files('pci_expander_bridge.c'), pci_ss.add(when: 'CONFIG_XIO3130', if_true: files('xio3130_upstream.c', 'xio3130_downstream.c')) pci_ss.add(when: 'CONFIG_CXL', if_true: files('cxl_root_port.c', 'cxl_upstream.c', 'cxl_downstream.c')) -# NewWorld PowerMac -pci_ss.add(when: 'CONFIG_DEC_PCI', if_true: files('dec.c')) # Sun4u pci_ss.add(when: 'CONFIG_SIMBA', if_true: files('simba.c'))
Signature · 1 line
MST
[PULL 19/41] vdpa: allocate SVQ array unconditionally
In reply to Michael S. TsirkinFrom: Eugenio Pérez <[email protected]>
SVQ may run or not in a device depending on runtime conditions (for example, if the device can move CVQ to its own group or not).
Allocate the SVQ array unconditionally at startup, since its hard to move this allocation elsewhere.
Message-Id: <[email protected]>
--- hw/virtio/vhost-vdpa.c | 4 ---- 1 file changed, 4 deletions(-)
hw/virtio/vhost-vdpa.c +0 -4
@@ -532,10 +532,6 @@ static void vhost_vdpa_svq_cleanup(struct vhost_dev *dev)struct vhost_vdpa *v = dev->opaque;size_t idx; -if (!v->shadow_vqs) { -return ; - } -for (idx =0 ; idx < v->shadow_vqs->len; ++idx) {vhost_svq_stop (g_ptr_array_index (v->shadow_vqs, idx)); }
Signature · 1 line
MST
[PULL 14/41] vhost: allocate SVQ device file descriptors at device start
In reply to Michael S. TsirkinFrom: Eugenio Pérez <[email protected]>
The next patches will start control SVQ if possible. However, we don't know if that will be possible at qemu boot anymore.
Delay device file descriptors until we know it at device start. This will avoid to create them if the device does not support SVQ.
Message-Id: <[email protected]>
--- hw/virtio/vhost-shadow-virtqueue.c | 31 ++------------------------ hw/virtio/vhost-vdpa.c | 35 ++++++++++++++++++++++++------ 2 files changed, 30 insertions(+), 36 deletions(-)
hw/virtio/vhost-shadow-virtqueue.c +2 -29
@@ -715,43 +715,18 @@ void vhost_svq_stop(VhostShadowVirtqueue *svq)* @iova_tree: Tree to perform descriptors translations * @ops: SVQ owner callbacks * @ops_opaque: ops opaque pointer -* -* Returns the new virtqueue or NULL. -* -* In case of error, reason is reported through error_report. */ VhostShadowVirtqueue *vhost_svq_new (VhostIOVATree *iova_tree,const VhostShadowVirtqueueOps *ops,void *ops_opaque) { - g_autofree VhostShadowVirtqueue *svq = g_new0(VhostShadowVirtqueue, 1); -int r; - - r =event_notifier_init (&svq->hdev_kick,0 ); -if (r !=0 ) { -error_report ("Couldn't create kick event notifier: %s (%d)" , -g_strerror (errno), errno); - goto err_init_hdev_kick; - } - - r =event_notifier_init (&svq->hdev_call,0 ); -if (r !=0 ) { -error_report ("Couldn't create call event notifier: %s (%d)" , -g_strerror (errno), errno); - goto err_init_hdev_call; - } +VhostShadowVirtqueue *svq =g_new0 (VhostShadowVirtqueue,1 );event_notifier_init_fd (&svq->svq_kick,VHOST_FILE_UNBIND ); svq->iova_tree = iova_tree; svq->ops = ops; svq->ops_opaque = ops_opaque; -return g_steal_pointer (&svq); - -err_init_hdev_call: -event_notifier_cleanup (&svq->hdev_kick); - -err_init_hdev_kick: -return NULL ; +return svq; }/**
@@ -763,7 +738,5 @@ void vhost_svq_free(gpointer pvq) {VhostShadowVirtqueue *vq = pvq;vhost_svq_stop (vq); -event_notifier_cleanup (&vq->hdev_kick); -event_notifier_cleanup (&vq->hdev_call);g_free (vq); }
hw/virtio/vhost-vdpa.c +28 -7
@@ -428,15 +428,11 @@ static int vhost_vdpa_init_svq(struct vhost_dev *hdev, struct vhost_vdpa *v, shadow_vqs =g_ptr_array_new_full (hdev->nvqs, vhost_svq_free);for (unsigned n =0 ; n < hdev->nvqs; ++n) { -g_autoptr (VhostShadowVirtqueue) svq; +VhostShadowVirtqueue *svq; svq =vhost_svq_new (v->iova_tree, v->shadow_vq_ops, v->shadow_vq_ops_opaque); -if (unlikely (!svq)) { -error_setg (errp,"Cannot create svq %u" , n); -return -1 ; - } -g_ptr_array_add (shadow_vqs,g_steal_pointer (&svq)); +g_ptr_array_add (shadow_vqs, svq); } v->shadow_vqs =g_steal_pointer (&shadow_vqs);
@@ -864,11 +860,23 @@ static int vhost_vdpa_svq_set_fds(struct vhost_dev *dev,const EventNotifier *event_notifier = &svq->hdev_kick;int r; + r =event_notifier_init (&svq->hdev_kick,0 ); +if (r !=0 ) { +error_setg_errno (errp, -r,"Couldn't create kick event notifier" ); + goto err_init_hdev_kick; + } + + r =event_notifier_init (&svq->hdev_call,0 ); +if (r !=0 ) { +error_setg_errno (errp, -r,"Couldn't create call event notifier" ); + goto err_init_hdev_call; + } + file.fd =event_notifier_get_fd (event_notifier); r =vhost_vdpa_set_vring_dev_kick (dev, &file);if (unlikely (r !=0 )) {error_setg_errno (errp, -r,"Can't set device kick fd" ); -return r; + goto err_init_set_dev_fd; } event_notifier = &svq->hdev_call;
@@ -876,8 +884,18 @@ static int vhost_vdpa_svq_set_fds(struct vhost_dev *dev, r =vhost_vdpa_set_vring_dev_call (dev, &file);if (unlikely (r !=0 )) {error_setg_errno (errp, -r,"Can't set device call fd" ); + goto err_init_set_dev_fd; } +return 0 ; + +err_init_set_dev_fd: +event_notifier_set_handler (&svq->hdev_call,NULL ); + +err_init_hdev_call: +event_notifier_cleanup (&svq->hdev_kick); + +err_init_hdev_kick:return r; }
@@ -1089,6 +1107,9 @@ static void vhost_vdpa_svqs_stop(struct vhost_dev *dev)for (unsigned i =0 ; i < v->shadow_vqs->len; ++i) {VhostShadowVirtqueue *svq =g_ptr_array_index (v->shadow_vqs, i);vhost_vdpa_svq_unmap_rings (dev, svq); + +event_notifier_cleanup (&svq->hdev_kick); +event_notifier_cleanup (&svq->hdev_call); } }
Signature · 1 line
MST
[PULL 41/41] contrib/vhost-user-blk: Replace lseek64 with lseek
In reply to Michael S. TsirkinFrom: Khem Raj <[email protected]>
64bit off_t is already in use since build uses _FILE_OFFSET_BITS=64 already. Using lseek/off_t also makes it work with latest musl without using _LARGEFILE64_SOURCE macro. This macro is implied with _GNU_SOURCE when using glibc but not with musl.
Message-Id: <[email protected]>
--- contrib/vhost-user-blk/vhost-user-blk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
contrib/vhost-user-blk/vhost-user-blk.c +2 -2
@@ -532,9 +532,9 @@ vub_get_blocksize(int fd)static void vub_initialize_config (int fd,struct virtio_blk_config *config) { -off64_t capacity; +off_t capacity; - capacity =lseek64 (fd,0 ,SEEK_END ); + capacity =lseek (fd,0 ,SEEK_END ); config->capacity = capacity >>9 ; config->blk_size =vub_get_blocksize (fd); config->size_max =65536 ;
Signature · 1 line
MST
[PULL 29/41] pci: drop redundant PCIDeviceClass::is_bridge field
In reply to Michael S. TsirkinFrom: Igor Mammedov <[email protected]>
and use cast to TYPE_PCI_BRIDGE instead.
Message-Id: <[email protected]>
--- include/hw/pci/pci.h | 10 +--------- include/hw/pci/pci_bridge.h | 1 + hw/acpi/pcihp.c | 3 +-- hw/i386/acpi-build.c | 5 ++--- hw/pci-bridge/cxl_downstream.c | 1 - hw/pci-bridge/cxl_upstream.c | 1 - hw/pci-bridge/i82801b11.c | 1 - hw/pci-bridge/pci_bridge_dev.c | 1 - hw/pci-bridge/pcie_pci_bridge.c | 1 - hw/pci-bridge/pcie_root_port.c | 1 - hw/pci-bridge/simba.c | 1 - hw/pci-bridge/xio3130_downstream.c | 1 - hw/pci-bridge/xio3130_upstream.c | 1 - hw/pci-host/designware.c | 1 - hw/pci-host/xilinx-pcie.c | 1 - hw/pci/pci.c | 20 +++++++++----------- hw/ppc/spapr_pci.c | 15 +++++---------- 17 files changed, 19 insertions(+), 46 deletions(-)
include/hw/pci/pci.h +1 -9
@@ -251,15 +251,7 @@ struct PCIDeviceClass {uint16_t subsystem_vendor_id;/* only for header type = 0 */ uint16_t subsystem_id;/* only for header type = 0 */ -/* -* pci-to-pci bridge or normal device. -* This doesn't mean pci host switch. -* When card bus bridge is supported, this would be enhanced. -*/ -bool is_bridge; - -/* rom bar */ -const char *romfile; +const char *romfile;/* rom bar */ };typedef void (*PCIINTxRoutingNotifier )(PCIDevice *dev);
include/hw/pci/pci_bridge.h +1 -0
@@ -53,6 +53,7 @@ struct PCIBridgeWindows {#define TYPE_PCI_BRIDGE "base-pci-bridge" OBJECT_DECLARE_SIMPLE_TYPE(PCIBridge, PCI_BRIDGE) +#define IS_PCI_BRIDGE (dev) object_dynamic_cast(OBJECT(dev), TYPE_PCI_BRIDGE)struct PCIBridge {/*< private >*/
hw/acpi/pcihp.c +1 -2
@@ -186,7 +186,6 @@ static PCIBus *acpi_pcihp_find_hotplug_bus(AcpiPciHpState *s, int bsel)static bool acpi_pcihp_pc_no_hotplug (AcpiPciHpState *s,PCIDevice *dev) { -PCIDeviceClass *pc =PCI_DEVICE_GET_CLASS (dev);DeviceClass *dc =DEVICE_GET_CLASS (dev);/* * ACPI doesn't allow hotplug of bridge devices. Don't allow
@@ -196,7 +195,7 @@ static bool acpi_pcihp_pc_no_hotplug(AcpiPciHpState *s, PCIDevice *dev)* Don't allow hot-unplug of SR-IOV Virtual Functions, as they * will be removed implicitly, when Physical Function is unplugged. */ -return (pc->is_bridge && !dev->qdev.hotplugged) || !dc->hotpluggable || +return (IS_PCI_BRIDGE (dev) && !dev->qdev.hotplugged) || !dc->hotpluggable ||pci_is_vf (dev); }
hw/i386/acpi-build.c +2 -3
@@ -403,7 +403,6 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,for (devfn =0 ; devfn <ARRAY_SIZE (bus->devices); devfn++) {DeviceClass *dc; -PCIDeviceClass *pc;PCIDevice *pdev = bus->devices[devfn];int slot =PCI_SLOT (devfn);int func =PCI_FUNC (devfn);
@@ -414,14 +413,14 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,bool cold_plugged_bridge = false;if (pdev) { - pc =PCI_DEVICE_GET_CLASS (pdev); dc =DEVICE_GET_CLASS (pdev);/* * Cold plugged bridges aren't themselves hot-pluggable. * Hotplugged bridges *are* hot-pluggable. */ - cold_plugged_bridge = pc->is_bridge && !DEVICE (pdev)->hotplugged; + cold_plugged_bridge =IS_PCI_BRIDGE (pdev) && + !DEVICE (pdev)->hotplugged; bridge_in_acpi = cold_plugged_bridge && pcihp_bridge_en; hotpluggbale_slot = bsel && dc->hotpluggable &&
hw/pci-bridge/cxl_downstream.c +0 -1
@@ -217,7 +217,6 @@ static void cxl_dsp_class_init(ObjectClass *oc, void *data)DeviceClass *dc =DEVICE_CLASS (oc);PCIDeviceClass *k =PCI_DEVICE_CLASS (oc); - k->is_bridge = true; k->config_write = cxl_dsp_config_write; k->realize = cxl_dsp_realize; k->exit = cxl_dsp_exitfn;
hw/pci-bridge/cxl_upstream.c +0 -1
@@ -375,7 +375,6 @@ static void cxl_upstream_class_init(ObjectClass *oc, void *data)DeviceClass *dc =DEVICE_CLASS (oc);PCIDeviceClass *k =PCI_DEVICE_CLASS (oc); - k->is_bridge = true; k->config_write = cxl_usp_write_config; k->config_read = cxl_usp_read_config; k->realize = cxl_usp_realize;
hw/pci-bridge/i82801b11.c +0 -1
@@ -92,7 +92,6 @@ static void i82801b11_bridge_class_init(ObjectClass *klass, void *data)PCIDeviceClass *k =PCI_DEVICE_CLASS (klass);DeviceClass *dc =DEVICE_CLASS (klass); - k->is_bridge = true; k->vendor_id =PCI_VENDOR_ID_INTEL ; k->device_id =PCI_DEVICE_ID_INTEL_82801BA_11 ; k->revision =ICH9_D2P_A2_REVISION ;
hw/pci-bridge/pci_bridge_dev.c +0 -1
@@ -254,7 +254,6 @@ static void pci_bridge_dev_class_init(ObjectClass *klass, void *data) k->vendor_id =PCI_VENDOR_ID_REDHAT ; k->device_id =PCI_DEVICE_ID_REDHAT_BRIDGE ; k->class_id =PCI_CLASS_BRIDGE_PCI ; - k->is_bridge = true; dc->desc ="Standard PCI Bridge" ; dc->reset = qdev_pci_bridge_dev_reset;device_class_set_props (dc, pci_bridge_dev_properties);
hw/pci-bridge/pcie_pci_bridge.c +0 -1
@@ -145,7 +145,6 @@ static void pcie_pci_bridge_class_init(ObjectClass *klass, void *data)DeviceClass *dc =DEVICE_CLASS (klass);HotplugHandlerClass *hc =HOTPLUG_HANDLER_CLASS (klass); - k->is_bridge = true; k->vendor_id =PCI_VENDOR_ID_REDHAT ; k->device_id =PCI_DEVICE_ID_REDHAT_PCIE_BRIDGE ; k->realize = pcie_pci_bridge_realize;
hw/pci-bridge/pcie_root_port.c +0 -1
@@ -174,7 +174,6 @@ static void rp_class_init(ObjectClass *klass, void *data)PCIDeviceClass *k =PCI_DEVICE_CLASS (klass);ResettableClass *rc =RESETTABLE_CLASS (klass); - k->is_bridge = true; k->config_write = rp_write_config; k->realize = rp_realize; k->exit = rp_exit;
hw/pci-bridge/simba.c +0 -1
@@ -77,7 +77,6 @@ static void simba_pci_bridge_class_init(ObjectClass *klass, void *data) k->device_id =PCI_DEVICE_ID_SUN_SIMBA ; k->revision =0x11 ; k->config_write = pci_bridge_write_config; - k->is_bridge = true;set_bit (DEVICE_CATEGORY_BRIDGE , dc->categories); dc->reset = pci_bridge_reset; dc->vmsd = &vmstate_pci_device;
hw/pci-bridge/xio3130_downstream.c +0 -1
@@ -159,7 +159,6 @@ static void xio3130_downstream_class_init(ObjectClass *klass, void *data)DeviceClass *dc =DEVICE_CLASS (klass);PCIDeviceClass *k =PCI_DEVICE_CLASS (klass); - k->is_bridge = true; k->config_write = xio3130_downstream_write_config; k->realize = xio3130_downstream_realize; k->exit = xio3130_downstream_exitfn;
hw/pci-bridge/xio3130_upstream.c +0 -1
@@ -128,7 +128,6 @@ static void xio3130_upstream_class_init(ObjectClass *klass, void *data)DeviceClass *dc =DEVICE_CLASS (klass);PCIDeviceClass *k =PCI_DEVICE_CLASS (klass); - k->is_bridge = true; k->config_write = xio3130_upstream_write_config; k->realize = xio3130_upstream_realize; k->exit = xio3130_upstream_exitfn;
hw/pci-host/designware.c +0 -1
@@ -600,7 +600,6 @@ static void designware_pcie_root_class_init(ObjectClass *klass, void *data) k->device_id =0xABCD ; k->revision =0 ; k->class_id =PCI_CLASS_BRIDGE_PCI ; - k->is_bridge = true; k->exit = pci_bridge_exitfn; k->realize = designware_pcie_root_realize; k->config_read = designware_pcie_root_config_read;
hw/pci-host/xilinx-pcie.c +0 -1
@@ -298,7 +298,6 @@ static void xilinx_pcie_root_class_init(ObjectClass *klass, void *data) k->device_id =0x7021 ; k->revision =0 ; k->class_id =PCI_CLASS_BRIDGE_HOST ; - k->is_bridge = true; k->realize = xilinx_pcie_root_realize; k->exit = pci_bridge_exitfn; dc->reset = pci_bridge_reset;
hw/pci/pci.c +9 -11
@@ -576,7 +576,7 @@ void pci_bus_range(PCIBus *bus, int *min_bus, int *max_bus)for (i =0 ; i <ARRAY_SIZE (bus->devices); ++i) {PCIDevice *dev = bus->devices[i]; -if (dev &&PCI_DEVICE_GET_CLASS (dev)->is_bridge) { +if (dev &&IS_PCI_BRIDGE (dev)) { *min_bus =MIN (*min_bus, dev->config[PCI_SECONDARY_BUS ]); *max_bus =MAX (*max_bus, dev->config[PCI_SUBORDINATE_BUS ]); }
@@ -592,7 +592,6 @@ static int get_pci_config_device(QEMUFile *f, void *pv, size_t size, const VMStateField *field) {PCIDevice *s =container_of (pv, PCIDevice, config); -PCIDeviceClass *pc =PCI_DEVICE_GET_CLASS (s);uint8_t *config;int i;
@@ -614,9 +613,8 @@ static int get_pci_config_device(QEMUFile *f, void *pv, size_t size,memcpy (s->config, config, size);pci_update_mappings (s); -if (pc->is_bridge) { -PCIBridge *b =PCI_BRIDGE (s); -pci_bridge_update_mappings (b); +if (IS_PCI_BRIDGE (s)) { +pci_bridge_update_mappings (PCI_BRIDGE (s)); } memory_region_set_enabled(&s->bus_master_enable_region,
@@ -1090,9 +1088,10 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev,Error *local_err =NULL ;DeviceState *dev =DEVICE (pci_dev);PCIBus *bus =pci_get_bus (pci_dev); +bool is_bridge =IS_PCI_BRIDGE (pci_dev);/* Only pci bridges can be attached to extra PCI root buses */ -if (pci_bus_is_root (bus) && bus->parent_dev && !pc->is_bridge) { +if (pci_bus_is_root (bus) && bus->parent_dev && !is_bridge) {error_setg (errp,"PCI: Only PCI/PCIe bridges can be plugged into %s" , bus->parent_dev->name);
@@ -1154,7 +1153,7 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev,pci_config_set_revision (pci_dev->config, pc->revision);pci_config_set_class (pci_dev->config, pc->class_id); -if (!pc->is_bridge) { +if (!is_bridge) {if (pc->subsystem_vendor_id || pc->subsystem_id) {pci_set_word (pci_dev->config +PCI_SUBSYSTEM_VENDOR_ID , pc->subsystem_vendor_id);
@@ -1171,7 +1170,7 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev,pci_init_cmask (pci_dev);pci_init_wmask (pci_dev);pci_init_w1cmask (pci_dev); -if (pc->is_bridge) { +if (is_bridge) {pci_init_mask_bridge (pci_dev); }pci_init_multifunction (bus, pci_dev, &local_err);
@@ -2094,7 +2093,7 @@ static bool pci_root_bus_in_range(PCIBus *bus, int bus_num)for (i =0 ; i <ARRAY_SIZE (bus->devices); ++i) {PCIDevice *dev = bus->devices[i]; -if (dev &&PCI_DEVICE_GET_CLASS (dev)->is_bridge) { +if (dev &&IS_PCI_BRIDGE (dev)) {if (pci_secondary_bus_in_range (dev, bus_num)) {return true; }
@@ -2839,7 +2838,6 @@ void pci_setup_iommu(PCIBus *bus, PCIIOMMUFunc fn, void *opaque)static void pci_dev_get_w64 (PCIBus *b,PCIDevice *dev,void *opaque) {Range *range = opaque; -PCIDeviceClass *pc =PCI_DEVICE_GET_CLASS (dev);uint16_t cmd =pci_get_word (dev->config +PCI_COMMAND );int i;
@@ -2847,7 +2845,7 @@ static void pci_dev_get_w64(PCIBus *b, PCIDevice *dev, void *opaque)return ; } -if (pc->is_bridge) { +if (IS_PCI_BRIDGE (dev)) {pcibus_t base =pci_bridge_get_base (dev,PCI_BASE_ADDRESS_MEM_PREFETCH );pcibus_t limit =pci_bridge_get_limit (dev,PCI_BASE_ADDRESS_MEM_PREFETCH );
hw/ppc/spapr_pci.c +5 -10
@@ -1361,7 +1361,6 @@ static int spapr_dt_pci_device(SpaprPhbState *sphb, PCIDevice *dev, {int offset; g_autofree gchar *nodename = spapr_pci_fw_dev_name(dev); -PCIDeviceClass *pc =PCI_DEVICE_GET_CLASS (dev);ResourceProps rp;SpaprDrc *drc =drc_from_dev (sphb, dev);uint32_t vendor_id =pci_default_read_config (dev,PCI_VENDOR_ID ,2 );
@@ -1446,7 +1445,7 @@ static int spapr_dt_pci_device(SpaprPhbState *sphb, PCIDevice *dev,spapr_phb_nvgpu_populate_pcidev_dt (dev, fdt, offset, sphb); -if (!pc->is_bridge) { +if (!IS_PCI_BRIDGE (dev)) {/* Properties only for non-bridges */ uint32_t min_grant =pci_default_read_config (dev,PCI_MIN_GNT ,1 );uint32_t max_latency =pci_default_read_config (dev,PCI_MAX_LAT ,1 );
@@ -1544,7 +1543,6 @@ static void spapr_pci_pre_plug(HotplugHandler *plug_handler, {SpaprPhbState *phb =SPAPR_PCI_HOST_BRIDGE (DEVICE (plug_handler));PCIDevice *pdev =PCI_DEVICE (plugged_dev); -PCIDeviceClass *pc =PCI_DEVICE_GET_CLASS (plugged_dev);SpaprDrc *drc =drc_from_dev (phb, pdev);PCIBus *bus =PCI_BUS (qdev_get_parent_bus (DEVICE (pdev)));uint32_t slotnr =PCI_SLOT (pdev->devfn);
@@ -1560,7 +1558,7 @@ static void spapr_pci_pre_plug(HotplugHandler *plug_handler, } } -if (pc->is_bridge) { +if (IS_PCI_BRIDGE (plugged_dev)) {if (!bridge_has_valid_chassis_nr (OBJECT (plugged_dev), errp)) {return ; }
@@ -1589,7 +1587,6 @@ static void spapr_pci_plug(HotplugHandler *plug_handler, {SpaprPhbState *phb =SPAPR_PCI_HOST_BRIDGE (DEVICE (plug_handler));PCIDevice *pdev =PCI_DEVICE (plugged_dev); -PCIDeviceClass *pc =PCI_DEVICE_GET_CLASS (plugged_dev);SpaprDrc *drc =drc_from_dev (phb, pdev);uint32_t slotnr =PCI_SLOT (pdev->devfn);
@@ -1603,7 +1600,7 @@ static void spapr_pci_plug(HotplugHandler *plug_handler,g_assert (drc); -if (pc->is_bridge) { +if (IS_PCI_BRIDGE (plugged_dev)) {spapr_pci_bridge_plug (phb,PCI_BRIDGE (plugged_dev)); }
@@ -1646,7 +1643,6 @@ static void spapr_pci_bridge_unplug(SpaprPhbState *phb,static void spapr_pci_unplug (HotplugHandler *plug_handler,DeviceState *plugged_dev,Error **errp) { -PCIDeviceClass *pc =PCI_DEVICE_GET_CLASS (plugged_dev);SpaprPhbState *phb =SPAPR_PCI_HOST_BRIDGE (DEVICE (plug_handler));/* some version guests do not wait for completion of a device
@@ -1661,7 +1657,7 @@ static void spapr_pci_unplug(HotplugHandler *plug_handler,*/ pci_device_reset (PCI_DEVICE (plugged_dev)); -if (pc->is_bridge) { +if (IS_PCI_BRIDGE (plugged_dev)) {spapr_pci_bridge_unplug (phb,PCI_BRIDGE (plugged_dev));return ; }
@@ -1686,7 +1682,6 @@ static void spapr_pci_unplug_request(HotplugHandler *plug_handler,g_assert (drc->dev == plugged_dev);if (!spapr_drc_unplug_requested (drc)) { -PCIDeviceClass *pc =PCI_DEVICE_GET_CLASS (plugged_dev);uint32_t slotnr =PCI_SLOT (pdev->devfn);SpaprDrc *func_drc;SpaprDrcClass *func_drck;
@@ -1694,7 +1689,7 @@ static void spapr_pci_unplug_request(HotplugHandler *plug_handler,int i;uint8_t chassis =chassis_from_bus (pci_get_bus (pdev)); -if (pc->is_bridge) { +if (IS_PCI_BRIDGE (plugged_dev)) {error_setg (errp,"PCI: Hot unplug of PCI bridges not supported" );return ; }
Signature · 1 line
MST
[PULL 21/41] vdpa: store x-svq parameter in VhostVDPAState
In reply to Michael S. TsirkinFrom: Eugenio Pérez <[email protected]>
CVQ can be shadowed two ways:
- Device has x-svq=on parameter (current way)
- The device can isolate CVQ in its own vq group
QEMU needs to check for the second condition dynamically, because CVQ index is not known before the driver ack the features. Since this is dynamic, the CVQ isolation could vary with different conditions, making it possible to go from "not isolated group" to "isolated".
Saving the cmdline parameter in an extra field so we never disable CVQ SVQ in case the device was started with x-svq cmdline.
Message-Id: <[email protected]>
--- net/vhost-vdpa.c | 3 +++ 1 file changed, 3 insertions(+)
net/vhost-vdpa.c +3 -0
@@ -38,6 +38,8 @@ typedef struct VhostVDPAState {void *cvq_cmd_out_buffer;virtio_net_ctrl_ack *status; +/* The device always have SVQ enabled */ +bool always_svq;bool started; } VhostVDPAState;
@@ -568,6 +570,7 @@ static NetClientState *net_vhost_vdpa_init(NetClientState *peer, s->vhost_vdpa.device_fd = vdpa_device_fd; s->vhost_vdpa.index = queue_pair_index; + s->always_svq = svq; s->vhost_vdpa.shadow_vqs_enabled = svq; s->vhost_vdpa.iova_range = iova_range; s->vhost_vdpa.iova_tree = iova_tree;
Signature · 1 line
MST
[PULL 24/41] vhost-user: send set log base message only once
In reply to Michael S. TsirkinFrom: Yajun Wu <[email protected]>
Vhost message VHOST_USER_SET_LOG_BASE is device wide. So only send it once with the first queue pair.
Message-Id: <[email protected]>
--- hw/virtio/vhost-user.c | 5 +++++ 1 file changed, 5 insertions(+)
hw/virtio/vhost-user.c +5 -0
@@ -527,6 +527,11 @@ static int vhost_user_set_log_base(struct vhost_dev *dev, uint64_t base, .hdr.size = sizeof(msg.payload.log), }; +/* Send only once with first queue pair */ +if (dev->vq_index !=0 ) { +return 0 ; + } +if (shmfd && log->fd !=-1 ) { fds[fd_num++] = log->fd; }
Signature · 1 line
MST
[PULL 20/41] vdpa: add asid parameter to vhost_vdpa_dma_map/unmap
In reply to Michael S. TsirkinFrom: Eugenio Pérez <[email protected]>
So the caller can choose which ASID is destined.
No need to update the batch functions as they will always be called from memory listener updates at the moment. Memory listener updates will always update ASID 0, as it's the passthrough ASID.
All vhost devices's ASID are 0 at this moment.
Message-Id: <[email protected]>
--- include/hw/virtio/vhost-vdpa.h | 14 ++++++++++--- hw/virtio/vhost-vdpa.c | 36 +++++++++++++++++++++++----------- net/vhost-vdpa.c | 6 +++--- hw/virtio/trace-events | 4 ++-- 4 files changed, 41 insertions(+), 19 deletions(-)
include/hw/virtio/vhost-vdpa.h +11 -3
@@ -19,6 +19,12 @@#include "hw/virtio/virtio.h" #include "standard-headers/linux/vhost_types.h" +/* +* ASID dedicated to map guest's addresses. If SVQ is disabled it maps GPA to +* qemu's IOVA. If SVQ is enabled it maps also the SVQ vring here +*/ +#define VHOST_VDPA_GUEST_PA_ASID 0 + typedef struct VhostVDPAHostNotifier { MemoryRegion mr; void *addr;
@@ -29,6 +35,7 @@ typedef struct vhost_vdpa {int index;uint32_t msg_type;bool iotlb_batch_begin_sent; +uint32_t address_space_id;MemoryListener listener;struct vhost_vdpa_iova_range iova_range;uint64_t acked_features;
@@ -42,8 +49,9 @@ typedef struct vhost_vdpa { VhostVDPAHostNotifier notifier[VIRTIO_QUEUE_MAX]; } VhostVDPA; -int vhost_vdpa_dma_map (struct vhost_vdpa *v,hwaddr iova,hwaddr size, -void *vaddr,bool readonly); -int vhost_vdpa_dma_unmap (struct vhost_vdpa *v,hwaddr iova,hwaddr size); +int vhost_vdpa_dma_map (struct vhost_vdpa *v,uint32_t asid,hwaddr iova, +hwaddr size,void *vaddr,bool readonly); +int vhost_vdpa_dma_unmap (struct vhost_vdpa *v,uint32_t asid,hwaddr iova, +hwaddr size);#endif
hw/virtio/vhost-vdpa.c +25 -11
@@ -72,22 +72,28 @@ static bool vhost_vdpa_listener_skipped_section(MemoryRegionSection *section,return false; } -int vhost_vdpa_dma_map (struct vhost_vdpa *v,hwaddr iova,hwaddr size, -void *vaddr,bool readonly) +/* +* The caller must set asid = 0 if the device does not support asid. +* This is not an ABI break since it is set to 0 by the initializer anyway. +*/ +int vhost_vdpa_dma_map (struct vhost_vdpa *v,uint32_t asid,hwaddr iova, +hwaddr size,void *vaddr,bool readonly) {struct vhost_msg_v2 msg = {};int fd = v->device_fd;int ret =0 ; msg.type = v->msg_type; + msg.asid = asid; msg.iotlb.iova = iova; msg.iotlb.size = size; msg.iotlb.uaddr = (uint64_t )(uintptr_t )vaddr; msg.iotlb.perm = readonly ?VHOST_ACCESS_RO :VHOST_ACCESS_RW ; msg.iotlb.type =VHOST_IOTLB_UPDATE ; -trace_vhost_vdpa_dma_map (v, fd, msg.type, msg.iotlb.iova, msg.iotlb.size, - msg.iotlb.uaddr, msg.iotlb.perm, msg.iotlb.type); +trace_vhost_vdpa_dma_map (v, fd, msg.type, msg.asid, msg.iotlb.iova, + msg.iotlb.size, msg.iotlb.uaddr, msg.iotlb.perm, + msg.iotlb.type);if (write (fd, &msg,sizeof (msg)) !=sizeof (msg)) { error_report("failed to write, fd=%d, errno=%d (%s)",
@@ -98,18 +104,24 @@ int vhost_vdpa_dma_map(struct vhost_vdpa *v, hwaddr iova, hwaddr size,return ret; } -int vhost_vdpa_dma_unmap (struct vhost_vdpa *v,hwaddr iova,hwaddr size) +/* +* The caller must set asid = 0 if the device does not support asid. +* This is not an ABI break since it is set to 0 by the initializer anyway. +*/ +int vhost_vdpa_dma_unmap (struct vhost_vdpa *v,uint32_t asid,hwaddr iova, +hwaddr size) {struct vhost_msg_v2 msg = {};int fd = v->device_fd;int ret =0 ; msg.type = v->msg_type; + msg.asid = asid; msg.iotlb.iova = iova; msg.iotlb.size = size; msg.iotlb.type =VHOST_IOTLB_INVALIDATE ; -trace_vhost_vdpa_dma_unmap (v, fd, msg.type, msg.iotlb.iova, +trace_vhost_vdpa_dma_unmap (v, fd, msg.type, msg.asid, msg.iotlb.iova, msg.iotlb.size, msg.iotlb.type);if (write (fd, &msg,sizeof (msg)) !=sizeof (msg)) {
@@ -229,8 +241,8 @@ static void vhost_vdpa_listener_region_add(MemoryListener *listener, }vhost_vdpa_iotlb_batch_begin_once (v); - ret =vhost_vdpa_dma_map (v, iova,int128_get64 (llsize), - vaddr, section->readonly); + ret =vhost_vdpa_dma_map (v,VHOST_VDPA_GUEST_PA_ASID , iova, +int128_get64 (llsize), vaddr, section->readonly);if (ret) {error_report ("vhost vdpa map fail!" ); goto fail_map;
@@ -303,7 +315,8 @@ static void vhost_vdpa_listener_region_del(MemoryListener *listener,vhost_iova_tree_remove (v->iova_tree, *result); }vhost_vdpa_iotlb_batch_begin_once (v); - ret =vhost_vdpa_dma_unmap (v, iova,int128_get64 (llsize)); + ret =vhost_vdpa_dma_unmap (v,VHOST_VDPA_GUEST_PA_ASID , iova, +int128_get64 (llsize));if (ret) {error_report ("vhost_vdpa dma unmap error!" ); }
@@ -869,7 +882,7 @@ static void vhost_vdpa_svq_unmap_ring(struct vhost_vdpa *v, hwaddr addr) } size =ROUND_UP (result->size,qemu_real_host_page_size ()); - r =vhost_vdpa_dma_unmap (v, result->iova, size); + r =vhost_vdpa_dma_unmap (v, v->address_space_id, result->iova, size);if (unlikely (r <0 )) {error_report ("Unable to unmap SVQ vring: %s (%d)" ,g_strerror (-r), -r);return ;
@@ -909,7 +922,8 @@ static bool vhost_vdpa_svq_map_ring(struct vhost_vdpa *v, DMAMap *needle,return false; } - r =vhost_vdpa_dma_map (v, needle->iova, needle->size +1 , + r =vhost_vdpa_dma_map (v, v->address_space_id, needle->iova, + needle->size +1 , (void *)(uintptr_t )needle->translated_addr, needle->perm ==IOMMU_RO );if (unlikely (r !=0 )) {
net/vhost-vdpa.c +3 -3
@@ -259,7 +259,7 @@ static void vhost_vdpa_cvq_unmap_buf(struct vhost_vdpa *v, void *addr)return ; } - r =vhost_vdpa_dma_unmap (v, map->iova, map->size +1 ); + r =vhost_vdpa_dma_unmap (v, v->address_space_id, map->iova, map->size +1 );if (unlikely (r !=0 )) {error_report ("Device cannot unmap: %s(%d)" ,g_strerror (r), r); }
@@ -299,8 +299,8 @@ static int vhost_vdpa_cvq_map_buf(struct vhost_vdpa *v, void *buf, size_t size,return r; } - r =vhost_vdpa_dma_map (v, map.iova,vhost_vdpa_net_cvq_cmd_page_len (), buf, - !write); + r =vhost_vdpa_dma_map (v, v->address_space_id, map.iova, +vhost_vdpa_net_cvq_cmd_page_len (), buf, !write);if (unlikely (r <0 )) { goto dma_map_err; }
hw/virtio/trace-events +2 -2
@@ -30,8 +30,8 @@ vhost_user_write(uint32_t req, uint32_t flags) "req:%d flags:0x%"PRIx32"" vhost_user_create_notifier(int idx, void *n) "idx:%d n:%p" # vhost-vdpa.c -vhost_vdpa_dma_map(void *vdpa, int fd, uint32_t msg_type, uint64_t iova, uint64_t size, uint64_t uaddr, uint8_t perm, uint8_t type) "vdpa:%p fd: %d msg_type: %"PRIu32" iova: 0x%"PRIx64" size: 0x%"PRIx64" uaddr: 0x%"PRIx64" perm: 0x%"PRIx8" type: %"PRIu8 -vhost_vdpa_dma_unmap(void *vdpa, int fd, uint32_t msg_type, uint64_t iova, uint64_t size, uint8_t type) "vdpa:%p fd: %d msg_type: %"PRIu32" iova: 0x%"PRIx64" size: 0x%"PRIx64" type: %"PRIu8 +vhost_vdpa_dma_map(void *vdpa, int fd, uint32_t msg_type, uint32_t asid, uint64_t iova, uint64_t size, uint64_t uaddr, uint8_t perm, uint8_t type) "vdpa:%p fd: %d msg_type: %"PRIu32" asid: %"PRIu32" iova: 0x%"PRIx64" size: 0x%"PRIx64" uaddr: 0x%"PRIx64" perm: 0x%"PRIx8" type: %"PRIu8 +vhost_vdpa_dma_unmap(void *vdpa, int fd, uint32_t msg_type, uint32_t asid, uint64_t iova, uint64_t size, uint8_t type) "vdpa:%p fd: %d msg_type: %"PRIu32" asid: %"PRIu32" iova: 0x%"PRIx64" size: 0x%"PRIx64" type: %"PRIu8 vhost_vdpa_listener_begin_batch(void *v, int fd, uint32_t msg_type, uint8_t type) "vdpa:%p fd: %d msg_type: %"PRIu32" type: %"PRIu8 vhost_vdpa_listener_commit(void *v, int fd, uint32_t msg_type, uint8_t type) "vdpa:%p fd: %d msg_type: %"PRIu32" type: %"PRIu8 vhost_vdpa_listener_region_add(void *vdpa, uint64_t iova, uint64_t llend, void *vaddr, bool readonly) "vdpa: %p iova 0x%"PRIx64" llend 0x%"PRIx64" vaddr: %p read-only: %d"
Signature · 1 line
MST
[PULL 22/41] vdpa: add shadow_data to vhost_vdpa
In reply to Michael S. TsirkinFrom: Eugenio Pérez <[email protected]>
The memory listener that thells the device how to convert GPA to qemu's va is registered against CVQ vhost_vdpa. memory listener translations are always ASID 0, CVQ ones are ASID 1 if supported.
Let's tell the listener if it needs to register them on iova tree or not.
Message-Id: <[email protected]>
--- include/hw/virtio/vhost-vdpa.h | 2 ++ hw/virtio/vhost-vdpa.c | 6 +++--- net/vhost-vdpa.c | 1 + 3 files changed, 6 insertions(+), 3 deletions(-)
include/hw/virtio/vhost-vdpa.h +2 -0
@@ -40,6 +40,8 @@ typedef struct vhost_vdpa {struct vhost_vdpa_iova_range iova_range;uint64_t acked_features;bool shadow_vqs_enabled; +/* Vdpa must send shadow addresses as IOTLB key for data queues, not GPA */ +bool shadow_data;/* IOVA mapping used by the Shadow Virtqueue */ VhostIOVATree *iova_tree;GPtrArray *shadow_vqs;
hw/virtio/vhost-vdpa.c +3 -3
@@ -224,7 +224,7 @@ static void vhost_vdpa_listener_region_add(MemoryListener *listener, vaddr, section->readonly); llsize =int128_sub (llend,int128_make64 (iova)); -if (v->shadow_vqs_enabled) { +if (v->shadow_data) {int r; mem_region.translated_addr = (hwaddr)(uintptr_t)vaddr,
@@ -251,7 +251,7 @@ static void vhost_vdpa_listener_region_add(MemoryListener *listener,return ; fail_map: -if (v->shadow_vqs_enabled) { +if (v->shadow_data) {vhost_iova_tree_remove (v->iova_tree, mem_region); }
@@ -296,7 +296,7 @@ static void vhost_vdpa_listener_region_del(MemoryListener *listener, llsize =int128_sub (llend,int128_make64 (iova)); -if (v->shadow_vqs_enabled) { +if (v->shadow_data) {const DMAMap *result;const void *vaddr =memory_region_get_ram_ptr (section->mr) + section->offset_within_region +
net/vhost-vdpa.c +1 -0
@@ -573,6 +573,7 @@ static NetClientState *net_vhost_vdpa_init(NetClientState *peer, s->always_svq = svq; s->vhost_vdpa.shadow_vqs_enabled = svq; s->vhost_vdpa.iova_range = iova_range; + s->vhost_vdpa.shadow_data = svq; s->vhost_vdpa.iova_tree = iova_tree;if (!is_datapath) { s->cvq_cmd_out_buffer = qemu_memalign(qemu_real_host_page_size(),
Signature · 1 line
MST
[PULL 31/41] acpi/tests/avocado/bits: add mformat as one of the dependencies
In reply to Michael S. TsirkinFrom: Ani Sinha <[email protected]>
mformat is needed by grub-mkrescue and hence, add this as one of the dependencies to run bits tests. This avoids errors such as the following:
/var/tmp/acpi-bits-wju6tqoa.tmp/grub-inst-x86_64-efi/bin/grub-mkrescue: 360: mformat: not found
Message-Id: <[email protected]>
--- tests/avocado/acpi-bits.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/avocado/acpi-bits.py +1 -1
@@ -50,7 +50,7 @@ from avocado import skipIf from avocado_qemu import QemuBaseTest -deps = ["xorriso"] # dependent tools needed in the test setup/box. +deps = ["xorriso", "mformat"] # dependent tools needed in the test setup/box. supported_platforms = ['x86_64'] # supported test platforms.
Signature · 1 line
MST
[PULL 35/41] hw/virtio: Rename virtio_ss[] -> specific_virtio_ss[]
In reply to Michael S. TsirkinFrom: Philippe Mathieu-Daudé <[email protected]>
Since virtio_ss[] is added to specific_ss[], rename it as specific_virtio_ss[] to make it clearer.
Message-Id: <[email protected]>
--- hw/virtio/meson.build | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-)
hw/virtio/meson.build +22 -21
@@ -3,35 +3,35 @@ softmmu_virtio_ss.add(files('virtio-bus.c')) softmmu_virtio_ss.add(when: 'CONFIG_VIRTIO_PCI', if_true: files('virtio-pci.c')) softmmu_virtio_ss.add(when: 'CONFIG_VIRTIO_MMIO', if_true: files('virtio-mmio.c')) -virtio_ss = ss.source_set() -virtio_ss.add(files('virtio.c')) +specific_virtio_ss = ss.source_set() +specific_virtio_ss.add(files('virtio.c')) if have_vhost - virtio_ss.add(files('vhost.c', 'vhost-backend.c', 'vhost-iova-tree.c')) + specific_virtio_ss.add(files('vhost.c', 'vhost-backend.c', 'vhost-iova-tree.c')) if have_vhost_user - virtio_ss.add(files('vhost-user.c')) + specific_virtio_ss.add(files('vhost-user.c')) endif if have_vhost_vdpa - virtio_ss.add(files('vhost-vdpa.c', 'vhost-shadow-virtqueue.c')) + specific_virtio_ss.add(files('vhost-vdpa.c', 'vhost-shadow-virtqueue.c')) endif else softmmu_virtio_ss.add(files('vhost-stub.c')) endif -virtio_ss.add(when: 'CONFIG_VIRTIO_BALLOON', if_true: files('virtio-balloon.c')) -virtio_ss.add(when: 'CONFIG_VIRTIO_CRYPTO', if_true: files('virtio-crypto.c')) -virtio_ss.add(when: 'CONFIG_VHOST_USER_FS', if_true: files('vhost-user-fs.c')) -virtio_ss.add(when: 'CONFIG_VIRTIO_PMEM', if_true: files('virtio-pmem.c')) -virtio_ss.add(when: 'CONFIG_VHOST_VSOCK', if_true: files('vhost-vsock.c', 'vhost-vsock-common.c')) -virtio_ss.add(when: 'CONFIG_VHOST_USER_VSOCK', if_true: files('vhost-user-vsock.c', 'vhost-vsock-common.c')) -virtio_ss.add(when: 'CONFIG_VIRTIO_RNG', if_true: files('virtio-rng.c')) -virtio_ss.add(when: 'CONFIG_VIRTIO_IOMMU', if_true: files('virtio-iommu.c')) -virtio_ss.add(when: 'CONFIG_VIRTIO_MEM', if_true: files('virtio-mem.c')) -virtio_ss.add(when: 'CONFIG_VHOST_USER_I2C', if_true: files('vhost-user-i2c.c')) -virtio_ss.add(when: 'CONFIG_VHOST_USER_RNG', if_true: files('vhost-user-rng.c')) -virtio_ss.add(when: 'CONFIG_VHOST_USER_GPIO', if_true: files('vhost-user-gpio.c')) -virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_GPIO'], if_true: files('vhost-user-gpio-pci.c')) -virtio_ss.add(when: 'CONFIG_VHOST_VDPA_DEV', if_true: files('vdpa-dev.c')) +specific_virtio_ss.add(when: 'CONFIG_VIRTIO_BALLOON', if_true: files('virtio-balloon.c')) +specific_virtio_ss.add(when: 'CONFIG_VIRTIO_CRYPTO', if_true: files('virtio-crypto.c')) +specific_virtio_ss.add(when: 'CONFIG_VHOST_USER_FS', if_true: files('vhost-user-fs.c')) +specific_virtio_ss.add(when: 'CONFIG_VIRTIO_PMEM', if_true: files('virtio-pmem.c')) +specific_virtio_ss.add(when: 'CONFIG_VHOST_VSOCK', if_true: files('vhost-vsock.c', 'vhost-vsock-common.c')) +specific_virtio_ss.add(when: 'CONFIG_VHOST_USER_VSOCK', if_true: files('vhost-user-vsock.c', 'vhost-vsock-common.c')) +specific_virtio_ss.add(when: 'CONFIG_VIRTIO_RNG', if_true: files('virtio-rng.c')) +specific_virtio_ss.add(when: 'CONFIG_VIRTIO_IOMMU', if_true: files('virtio-iommu.c')) +specific_virtio_ss.add(when: 'CONFIG_VIRTIO_MEM', if_true: files('virtio-mem.c')) +specific_virtio_ss.add(when: 'CONFIG_VHOST_USER_I2C', if_true: files('vhost-user-i2c.c')) +specific_virtio_ss.add(when: 'CONFIG_VHOST_USER_RNG', if_true: files('vhost-user-rng.c')) +specific_virtio_ss.add(when: 'CONFIG_VHOST_USER_GPIO', if_true: files('vhost-user-gpio.c')) +specific_virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_GPIO'], if_true: files('vhost-user-gpio-pci.c')) +specific_virtio_ss.add(when: 'CONFIG_VHOST_VDPA_DEV', if_true: files('vdpa-dev.c')) virtio_pci_ss = ss.source_set() virtio_pci_ss.add(when: 'CONFIG_VHOST_VSOCK', if_true: files('vhost-vsock-pci.c'))
@@ -59,11 +59,12 @@ virtio_pci_ss.add(when: 'CONFIG_VIRTIO_IOMMU', if_true: files('virtio-iommu-pci. virtio_pci_ss.add(when: 'CONFIG_VIRTIO_MEM', if_true: files('virtio-mem-pci.c')) virtio_pci_ss.add(when: 'CONFIG_VHOST_VDPA_DEV', if_true: files('vdpa-dev-pci.c')) -virtio_ss.add_all(when: 'CONFIG_VIRTIO_PCI', if_true: virtio_pci_ss) +specific_virtio_ss.add_all(when: 'CONFIG_VIRTIO_PCI', if_true: virtio_pci_ss) -specific_ss.add_all(when: 'CONFIG_VIRTIO', if_true: virtio_ss) softmmu_ss.add_all(when: 'CONFIG_VIRTIO', if_true: softmmu_virtio_ss) softmmu_ss.add(when: 'CONFIG_VIRTIO', if_false: files('vhost-stub.c')) softmmu_ss.add(when: 'CONFIG_VIRTIO', if_false: files('virtio-stub.c')) softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('vhost-stub.c')) softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('virtio-stub.c')) + +specific_ss.add_all(when: 'CONFIG_VIRTIO', if_true: specific_virtio_ss)
Signature · 1 line
MST
[PULL 34/41] hw/virtio: Add missing "hw/core/cpu.h" include
In reply to Michael S. TsirkinFrom: Philippe Mathieu-Daudé <[email protected]>
virtio.c uses target_words_bigendian() which is declared in "hw/core/cpu.h". Add the missing header to avoid when refactoring:
hw/virtio/virtio.c:2451:9: error: implicit declaration of function 'target_words_bigendian' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
if (target_words_bigendian()) {
^Message-Id: <[email protected]>
--- hw/virtio/virtio.c | 1 + 1 file changed, 1 insertion(+)
hw/virtio/virtio.c +1 -0
@@ -25,6 +25,7 @@#include "qemu/main-loop.h" #include "qemu/module.h" #include "qom/object_interfaces.h" +#include "hw/core/cpu.h" #include "hw/virtio/virtio.h" #include "migration/qemu-file-types.h" #include "qemu/atomic.h"
Signature · 1 line
MST
[PULL 36/41] hw/virtio: Guard and restrict scope of qmp_virtio_feature_map_t[]
In reply to Michael S. TsirkinFrom: Philippe Mathieu-Daudé <[email protected]>
Commit f3034ad71f ("qmp: decode feature & status bits in virtio-status") did not guard all qmp_virtio_feature_map_t arrays with the corresponding #ifdef'ry used in qmp_decode_features(). Fix that and reduce the arrays scope by declaring them static.
Message-Id: <[email protected]>
--- hw/virtio/virtio.c | 56 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 42 insertions(+), 14 deletions(-)
hw/virtio/virtio.c +42 -14
@@ -179,7 +179,8 @@ static qmp_virtio_feature_map_t virtio_config_status_map[] = { };/* virtio-blk features mapping */ -qmp_virtio_feature_map_t virtio_blk_feature_map[] = { +#ifdef CONFIG_VIRTIO_BLK +static qmp_virtio_feature_map_t virtio_blk_feature_map[] = { FEATURE_ENTRY(VIRTIO_BLK_F_SIZE_MAX, \ "VIRTIO_BLK_F_SIZE_MAX: Max segment size is size_max"), FEATURE_ENTRY(VIRTIO_BLK_F_SEG_MAX, \
@@ -216,9 +217,11 @@ qmp_virtio_feature_map_t virtio_blk_feature_map[] = { "negotiation supported"), { -1, "" } }; +#endif /* virtio-serial features mapping */ -qmp_virtio_feature_map_t virtio_serial_feature_map[] = { +#ifdef CONFIG_VIRTIO_SERIAL +static qmp_virtio_feature_map_t virtio_serial_feature_map[] = { FEATURE_ENTRY(VIRTIO_CONSOLE_F_SIZE, \ "VIRTIO_CONSOLE_F_SIZE: Host providing console size"), FEATURE_ENTRY(VIRTIO_CONSOLE_F_MULTIPORT, \
@@ -227,9 +230,11 @@ qmp_virtio_feature_map_t virtio_serial_feature_map[] = { "VIRTIO_CONSOLE_F_EMERG_WRITE: Emergency write supported"), { -1, "" } }; +#endif /* virtio-gpu features mapping */ -qmp_virtio_feature_map_t virtio_gpu_feature_map[] = { +#ifdef CONFIG_VIRTIO_GPU +static qmp_virtio_feature_map_t virtio_gpu_feature_map[] = { FEATURE_ENTRY(VIRTIO_GPU_F_VIRGL, \ "VIRTIO_GPU_F_VIRGL: Virgl 3D mode supported"), FEATURE_ENTRY(VIRTIO_GPU_F_EDID, \
@@ -248,9 +253,11 @@ qmp_virtio_feature_map_t virtio_gpu_feature_map[] = { "negotiation supported"), { -1, "" } }; +#endif /* virtio-input features mapping */ -qmp_virtio_feature_map_t virtio_input_feature_map[] = { +#ifdef CONFIG_VIRTIO_INPUT +static qmp_virtio_feature_map_t virtio_input_feature_map[] = { FEATURE_ENTRY(VHOST_F_LOG_ALL, \ "VHOST_F_LOG_ALL: Logging write descriptors supported"), FEATURE_ENTRY(VHOST_USER_F_PROTOCOL_FEATURES, \
@@ -258,9 +265,11 @@ qmp_virtio_feature_map_t virtio_input_feature_map[] = { "negotiation supported"), { -1, "" } }; +#endif /* virtio-net features mapping */ -qmp_virtio_feature_map_t virtio_net_feature_map[] = { +#ifdef CONFIG_VIRTIO_NET +static qmp_virtio_feature_map_t virtio_net_feature_map[] = {FEATURE_ENTRY (VIRTIO_NET_F_CSUM , \"VIRTIO_NET_F_CSUM: Device handling packets with partial checksum " "supported"),
@@ -336,9 +345,11 @@ qmp_virtio_feature_map_t virtio_net_feature_map[] = { "negotiation supported"), { -1, "" } }; +#endif /* virtio-scsi features mapping */ -qmp_virtio_feature_map_t virtio_scsi_feature_map[] = { +#ifdef CONFIG_VIRTIO_SCSI +static qmp_virtio_feature_map_t virtio_scsi_feature_map[] = {FEATURE_ENTRY (VIRTIO_SCSI_F_INOUT , \"VIRTIO_SCSI_F_INOUT: Requests including read and writable data " "buffers suppoted"),
@@ -357,9 +368,11 @@ qmp_virtio_feature_map_t virtio_scsi_feature_map[] = { "negotiation supported"), { -1, "" } }; +#endif /* virtio/vhost-user-fs features mapping */ -qmp_virtio_feature_map_t virtio_fs_feature_map[] = { +#ifdef CONFIG_VHOST_USER_FS +static qmp_virtio_feature_map_t virtio_fs_feature_map[] = { FEATURE_ENTRY(VHOST_F_LOG_ALL, \ "VHOST_F_LOG_ALL: Logging write descriptors supported"), FEATURE_ENTRY(VHOST_USER_F_PROTOCOL_FEATURES, \
@@ -367,9 +380,11 @@ qmp_virtio_feature_map_t virtio_fs_feature_map[] = { "negotiation supported"), { -1, "" } }; +#endif /* virtio/vhost-user-i2c features mapping */ -qmp_virtio_feature_map_t virtio_i2c_feature_map[] = { +#ifdef CONFIG_VIRTIO_I2C_ADAPTER +static qmp_virtio_feature_map_t virtio_i2c_feature_map[] = { FEATURE_ENTRY(VIRTIO_I2C_F_ZERO_LENGTH_REQUEST, \ "VIRTIO_I2C_F_ZERO_LEGNTH_REQUEST: Zero length requests supported"), FEATURE_ENTRY(VHOST_F_LOG_ALL, \
@@ -379,9 +394,11 @@ qmp_virtio_feature_map_t virtio_i2c_feature_map[] = { "negotiation supported"), { -1, "" } }; +#endif /* virtio/vhost-vsock features mapping */ -qmp_virtio_feature_map_t virtio_vsock_feature_map[] = { +#ifdef CONFIG_VHOST_VSOCK +static qmp_virtio_feature_map_t virtio_vsock_feature_map[] = { FEATURE_ENTRY(VIRTIO_VSOCK_F_SEQPACKET, \ "VIRTIO_VSOCK_F_SEQPACKET: SOCK_SEQPACKET supported"), FEATURE_ENTRY(VHOST_F_LOG_ALL, \
@@ -391,9 +408,11 @@ qmp_virtio_feature_map_t virtio_vsock_feature_map[] = { "negotiation supported"), { -1, "" } }; +#endif /* virtio-balloon features mapping */ -qmp_virtio_feature_map_t virtio_balloon_feature_map[] = { +#ifdef CONFIG_VIRTIO_BALLOON +static qmp_virtio_feature_map_t virtio_balloon_feature_map[] = {FEATURE_ENTRY (VIRTIO_BALLOON_F_MUST_TELL_HOST , \"VIRTIO_BALLOON_F_MUST_TELL_HOST: Tell host before reclaiming " "pages"),
@@ -409,16 +428,20 @@ qmp_virtio_feature_map_t virtio_balloon_feature_map[] = { "VIRTIO_BALLOON_F_REPORTING: Page reporting VQ enabled"), { -1, "" } }; +#endif /* virtio-crypto features mapping */ -qmp_virtio_feature_map_t virtio_crypto_feature_map[] = { +#ifdef CONFIG_VIRTIO_CRYPTO +static qmp_virtio_feature_map_t virtio_crypto_feature_map[] = {FEATURE_ENTRY (VHOST_F_LOG_ALL , \"VHOST_F_LOG_ALL: Logging write descriptors supported" ), {-1 ,"" } }; +#endif /* virtio-iommu features mapping */ -qmp_virtio_feature_map_t virtio_iommu_feature_map[] = { +#ifdef CONFIG_VIRTIO_IOMMU +static qmp_virtio_feature_map_t virtio_iommu_feature_map[] = {FEATURE_ENTRY (VIRTIO_IOMMU_F_INPUT_RANGE , \"VIRTIO_IOMMU_F_INPUT_RANGE: Range of available virtual addrs. " "available"),
@@ -439,9 +462,11 @@ qmp_virtio_feature_map_t virtio_iommu_feature_map[] = { "available"), { -1, "" } }; +#endif /* virtio-mem features mapping */ -qmp_virtio_feature_map_t virtio_mem_feature_map[] = { +#ifdef CONFIG_VIRTIO_MEM +static qmp_virtio_feature_map_t virtio_mem_feature_map[] = { #ifndef CONFIG_ACPIFEATURE_ENTRY (VIRTIO_MEM_F_ACPI_PXM , \ "VIRTIO_MEM_F_ACPI_PXM: node_id is an ACPI PXM and is valid"),
@@ -451,9 +476,11 @@ qmp_virtio_feature_map_t virtio_mem_feature_map[] = { "accessed"), { -1, "" } }; +#endif /* virtio-rng features mapping */ -qmp_virtio_feature_map_t virtio_rng_feature_map[] = { +#ifdef CONFIG_VIRTIO_RNG +static qmp_virtio_feature_map_t virtio_rng_feature_map[] = { FEATURE_ENTRY(VHOST_F_LOG_ALL, \ "VHOST_F_LOG_ALL: Logging write descriptors supported"), FEATURE_ENTRY(VHOST_USER_F_PROTOCOL_FEATURES, \
@@ -461,6 +488,7 @@ qmp_virtio_feature_map_t virtio_rng_feature_map[] = { "negotiation supported"), { -1, "" } }; +#endif /* * The alignment to use between consumer and producer parts of vring.
Signature · 1 line
MST
[PULL 37/41] hw/virtio: Constify qmp_virtio_feature_map_t[]
In reply to Michael S. TsirkinFrom: Philippe Mathieu-Daudé <[email protected]>
These arrays are only accessed read-only, move them to .rodata.
Message-Id: <[email protected]>
--- hw/virtio/virtio.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-)
hw/virtio/virtio.c +17 -17
@@ -80,7 +80,7 @@ enum VhostUserProtocolFeature { };/* Virtio transport features mapping */ -static qmp_virtio_feature_map_t virtio_transport_map[] = { +static const qmp_virtio_feature_map_t virtio_transport_map[] = {/* Virtio device transport features */ #ifndef VIRTIO_CONFIG_NO_LEGACY FEATURE_ENTRY(VIRTIO_F_NOTIFY_ON_EMPTY, \
@@ -111,7 +111,7 @@ static qmp_virtio_feature_map_t virtio_transport_map[] = { };/* Vhost-user protocol features mapping */ -static qmp_virtio_feature_map_t vhost_user_protocol_map[] = { +static const qmp_virtio_feature_map_t vhost_user_protocol_map[] = {FEATURE_ENTRY (VHOST_USER_PROTOCOL_F_MQ , \"VHOST_USER_PROTOCOL_F_MQ: Multiqueue protocol supported" ), FEATURE_ENTRY(VHOST_USER_PROTOCOL_F_LOG_SHMFD, \
@@ -161,7 +161,7 @@ static qmp_virtio_feature_map_t vhost_user_protocol_map[] = { };/* virtio device configuration statuses */ -static qmp_virtio_feature_map_t virtio_config_status_map[] = { +static const qmp_virtio_feature_map_t virtio_config_status_map[] = {FEATURE_ENTRY (VIRTIO_CONFIG_S_DRIVER_OK , \"VIRTIO_CONFIG_S_DRIVER_OK: Driver setup and ready" ), FEATURE_ENTRY(VIRTIO_CONFIG_S_FEATURES_OK, \
@@ -180,7 +180,7 @@ static qmp_virtio_feature_map_t virtio_config_status_map[] = {/* virtio-blk features mapping */ #ifdef CONFIG_VIRTIO_BLK -static qmp_virtio_feature_map_t virtio_blk_feature_map[] = { +static const qmp_virtio_feature_map_t virtio_blk_feature_map[] = { FEATURE_ENTRY(VIRTIO_BLK_F_SIZE_MAX, \ "VIRTIO_BLK_F_SIZE_MAX: Max segment size is size_max"), FEATURE_ENTRY(VIRTIO_BLK_F_SEG_MAX, \
@@ -221,7 +221,7 @@ static qmp_virtio_feature_map_t virtio_blk_feature_map[] = {/* virtio-serial features mapping */ #ifdef CONFIG_VIRTIO_SERIAL -static qmp_virtio_feature_map_t virtio_serial_feature_map[] = { +static const qmp_virtio_feature_map_t virtio_serial_feature_map[] = { FEATURE_ENTRY(VIRTIO_CONSOLE_F_SIZE, \ "VIRTIO_CONSOLE_F_SIZE: Host providing console size"), FEATURE_ENTRY(VIRTIO_CONSOLE_F_MULTIPORT, \
@@ -234,7 +234,7 @@ static qmp_virtio_feature_map_t virtio_serial_feature_map[] = {/* virtio-gpu features mapping */ #ifdef CONFIG_VIRTIO_GPU -static qmp_virtio_feature_map_t virtio_gpu_feature_map[] = { +static const qmp_virtio_feature_map_t virtio_gpu_feature_map[] = { FEATURE_ENTRY(VIRTIO_GPU_F_VIRGL, \ "VIRTIO_GPU_F_VIRGL: Virgl 3D mode supported"), FEATURE_ENTRY(VIRTIO_GPU_F_EDID, \
@@ -257,7 +257,7 @@ static qmp_virtio_feature_map_t virtio_gpu_feature_map[] = {/* virtio-input features mapping */ #ifdef CONFIG_VIRTIO_INPUT -static qmp_virtio_feature_map_t virtio_input_feature_map[] = { +static const qmp_virtio_feature_map_t virtio_input_feature_map[] = { FEATURE_ENTRY(VHOST_F_LOG_ALL, \ "VHOST_F_LOG_ALL: Logging write descriptors supported"), FEATURE_ENTRY(VHOST_USER_F_PROTOCOL_FEATURES, \
@@ -269,7 +269,7 @@ static qmp_virtio_feature_map_t virtio_input_feature_map[] = {/* virtio-net features mapping */ #ifdef CONFIG_VIRTIO_NET -static qmp_virtio_feature_map_t virtio_net_feature_map[] = { +static const qmp_virtio_feature_map_t virtio_net_feature_map[] = {FEATURE_ENTRY (VIRTIO_NET_F_CSUM , \"VIRTIO_NET_F_CSUM: Device handling packets with partial checksum " "supported"),
@@ -349,7 +349,7 @@ static qmp_virtio_feature_map_t virtio_net_feature_map[] = {/* virtio-scsi features mapping */ #ifdef CONFIG_VIRTIO_SCSI -static qmp_virtio_feature_map_t virtio_scsi_feature_map[] = { +static const qmp_virtio_feature_map_t virtio_scsi_feature_map[] = {FEATURE_ENTRY (VIRTIO_SCSI_F_INOUT , \"VIRTIO_SCSI_F_INOUT: Requests including read and writable data " "buffers suppoted"),
@@ -372,7 +372,7 @@ static qmp_virtio_feature_map_t virtio_scsi_feature_map[] = {/* virtio/vhost-user-fs features mapping */ #ifdef CONFIG_VHOST_USER_FS -static qmp_virtio_feature_map_t virtio_fs_feature_map[] = { +static const qmp_virtio_feature_map_t virtio_fs_feature_map[] = { FEATURE_ENTRY(VHOST_F_LOG_ALL, \ "VHOST_F_LOG_ALL: Logging write descriptors supported"), FEATURE_ENTRY(VHOST_USER_F_PROTOCOL_FEATURES, \
@@ -384,7 +384,7 @@ static qmp_virtio_feature_map_t virtio_fs_feature_map[] = {/* virtio/vhost-user-i2c features mapping */ #ifdef CONFIG_VIRTIO_I2C_ADAPTER -static qmp_virtio_feature_map_t virtio_i2c_feature_map[] = { +static const qmp_virtio_feature_map_t virtio_i2c_feature_map[] = { FEATURE_ENTRY(VIRTIO_I2C_F_ZERO_LENGTH_REQUEST, \ "VIRTIO_I2C_F_ZERO_LEGNTH_REQUEST: Zero length requests supported"), FEATURE_ENTRY(VHOST_F_LOG_ALL, \
@@ -398,7 +398,7 @@ static qmp_virtio_feature_map_t virtio_i2c_feature_map[] = {/* virtio/vhost-vsock features mapping */ #ifdef CONFIG_VHOST_VSOCK -static qmp_virtio_feature_map_t virtio_vsock_feature_map[] = { +static const qmp_virtio_feature_map_t virtio_vsock_feature_map[] = { FEATURE_ENTRY(VIRTIO_VSOCK_F_SEQPACKET, \ "VIRTIO_VSOCK_F_SEQPACKET: SOCK_SEQPACKET supported"), FEATURE_ENTRY(VHOST_F_LOG_ALL, \
@@ -412,7 +412,7 @@ static qmp_virtio_feature_map_t virtio_vsock_feature_map[] = {/* virtio-balloon features mapping */ #ifdef CONFIG_VIRTIO_BALLOON -static qmp_virtio_feature_map_t virtio_balloon_feature_map[] = { +static const qmp_virtio_feature_map_t virtio_balloon_feature_map[] = {FEATURE_ENTRY (VIRTIO_BALLOON_F_MUST_TELL_HOST , \"VIRTIO_BALLOON_F_MUST_TELL_HOST: Tell host before reclaiming " "pages"),
@@ -432,7 +432,7 @@ static qmp_virtio_feature_map_t virtio_balloon_feature_map[] = {/* virtio-crypto features mapping */ #ifdef CONFIG_VIRTIO_CRYPTO -static qmp_virtio_feature_map_t virtio_crypto_feature_map[] = { +static const qmp_virtio_feature_map_t virtio_crypto_feature_map[] = {FEATURE_ENTRY (VHOST_F_LOG_ALL , \"VHOST_F_LOG_ALL: Logging write descriptors supported" ), { -1, "" }
@@ -441,7 +441,7 @@ static qmp_virtio_feature_map_t virtio_crypto_feature_map[] = {/* virtio-iommu features mapping */ #ifdef CONFIG_VIRTIO_IOMMU -static qmp_virtio_feature_map_t virtio_iommu_feature_map[] = { +static const qmp_virtio_feature_map_t virtio_iommu_feature_map[] = {FEATURE_ENTRY (VIRTIO_IOMMU_F_INPUT_RANGE , \"VIRTIO_IOMMU_F_INPUT_RANGE: Range of available virtual addrs. " "available"),
@@ -466,7 +466,7 @@ static qmp_virtio_feature_map_t virtio_iommu_feature_map[] = {/* virtio-mem features mapping */ #ifdef CONFIG_VIRTIO_MEM -static qmp_virtio_feature_map_t virtio_mem_feature_map[] = { +static const qmp_virtio_feature_map_t virtio_mem_feature_map[] = { #ifndef CONFIG_ACPIFEATURE_ENTRY (VIRTIO_MEM_F_ACPI_PXM , \ "VIRTIO_MEM_F_ACPI_PXM: node_id is an ACPI PXM and is valid"),
@@ -480,7 +480,7 @@ static qmp_virtio_feature_map_t virtio_mem_feature_map[] = {/* virtio-rng features mapping */ #ifdef CONFIG_VIRTIO_RNG -static qmp_virtio_feature_map_t virtio_rng_feature_map[] = { +static const qmp_virtio_feature_map_t virtio_rng_feature_map[] = { FEATURE_ENTRY(VHOST_F_LOG_ALL, \ "VHOST_F_LOG_ALL: Logging write descriptors supported"), FEATURE_ENTRY(VHOST_USER_F_PROTOCOL_FEATURES, \
Signature · 1 line
MST
[PULL 39/41] hw/virtio: Extract QMP related code virtio-qmp.c
In reply to Michael S. TsirkinFrom: Philippe Mathieu-Daudé <[email protected]>
The monitor decoders are the only functions using the CONFIG_xxx definitions declared in the target specific CONFIG_DEVICES header.
Message-Id: <[email protected]>
--- hw/virtio/virtio-qmp.h | 20 ++ hw/virtio/virtio-qmp.c | 659 +++++++++++++++++++++++++++++++++++++++++ hw/virtio/virtio.c | 635 +-------------------------------------- hw/virtio/meson.build | 2 +- 4 files changed, 682 insertions(+), 634 deletions(-) create mode 100644 hw/virtio/virtio-qmp.h create mode 100644 hw/virtio/virtio-qmp.c
hw/virtio/virtio-qmp.h new file +20 -0
@@ -0,0 +1,20 @@ +/* +* Virtio QMP helpers +* +* Copyright IBM, Corp. 2007 +* +* Authors: +* Anthony Liguori <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ +#ifndef HW_VIRTIO_QMP_H +#define HW_VIRTIO_QMP_H + +#include "qapi/qapi-types-virtio.h" + +VirtioDeviceStatus *qmp_decode_status (uint8_t bitmap); +VhostDeviceProtocols *qmp_decode_protocols (uint64_t bitmap); +VirtioDeviceFeatures *qmp_decode_features (uint16_t device_id,uint64_t bitmap); + +#endif
hw/virtio/virtio-qmp.c new file +659 -0
659 lines not on this page · raw message
hw/virtio/virtio.c +2 -633
665 lines not on this page · raw message
hw/virtio/meson.build +1 -1
@@ -5,7 +5,7 @@ softmmu_virtio_ss.add(when: 'CONFIG_VIRTIO_MMIO', if_true: files('virtio-mmio.c' specific_virtio_ss = ss.source_set() specific_virtio_ss.add(files('virtio.c')) -specific_virtio_ss.add(files('virtio-config-io.c')) +specific_virtio_ss.add(files('virtio-config-io.c', 'virtio-qmp.c')) if have_vhost specific_virtio_ss.add(files('vhost.c', 'vhost-backend.c', 'vhost-iova-tree.c'))
Signature · 1 line
MST
Peter Maydell
AppliedQuoted 16 lines · Michael S. Tsirkin
The following changes since commit
c15dc499cc22f4a71639e42e36051e118761c25f:Merge tag 'pull-misc-20221218' of https://gitlab.com/rth7680/qemu into staging (2022-12-19 10:28:57 +0000)
are available in the Git repository at:
https://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream
for you to fetch changes up to
87d67ffe4f7e4faad9fa5bc7129ca91d314677ed:contrib/vhost-user-blk: Replace lseek64 with lseek (2022-12-21 07:32:24 -0500)
----------------------------------------------------------------
virtio,pc,pci: features, cleanups, fixes
Quoted 9 lines
make TCO watchdog work by default part of generic vdpa support asid interrupt for vhost-vdpa added flex bus port DVSEC for cxl
misc fixes, cleanups, documentation
Signed-off-by Michael S. Tsirkin <[email protected]>
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/8.0
for any user-visible changes.
-- PMM