virtio,acpi,pci: features, fixes, cleanups, tests
The following changes since commit 49ee11555262a256afec592dfed7c5902d5eefd2:
Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-5.1-pull-request' into staging (2020-06-08 11:04:57 +0100)
are available in the Git repository at:
git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream
for you to fetch changes up to 23fe04b63b412276c7c2f67c550961af9d0b4e1e:
Fix parameter type in vhost migration log path (2020-06-09 14:18:04 -0400)
----------------------------------------------------------------
virtio,acpi,pci: features, fixes, cleanups, tests
Max slots negotiation for vhost-user.
Free page reporting for balloon.
Partial TPM2 ACPI support for ARM.
Support for NVDIMMs having their own proximity domains. New vhost-user-vsock device.
Fixes, cleanups in ACPI, PCI, virtio. New tests for TPM ACPI.
----------------------------------------------------------------
Alexander Duyck (2):
virtio-balloon: Implement support for page poison reporting feature
virtio-balloon: Provide an interface for free page reporting
David Hildenbrand (3):
virtio-balloon: fix free page hinting without an iothread
virtio-balloon: fix free page hinting check on unrealize
virtio-balloon: unref the iothread when unrealizing
Dima Stepanov (2):
char-socket: return -1 in case of disconnect during tcp_chr_write
vhost-user-blk: delay vhost_user_blk_disconnect
Eric Auger (8):
acpi: Convert build_tpm2() to build_append* API
acpi: Move build_tpm2() in the generic part
arm/acpi: TPM2 ACPI table support
test/tpm-emu: include sockets and channel headers in tpm-emu header tests/acpi: Add void tables for Q35/TPM-TIS bios-tables-test
tests: tpm-emu: Remove assert on TPM2_ST_NO_SESSIONS
bios-tables-test: Add Q35/TPM-TIS test
bios-tables-test: Generate reference tables for Q35/TPM-TIS
Gerd Hoffmann (12):
qtest: allow DSDT acpi table changes
acpi: move aml builder code for rtc device
acpi: rtc: use a single crs range
acpi: serial: don't use _STA method
acpi: move aml builder code for serial device
acpi: parallel: don't use _STA method
acpi: move aml builder code for parallel device
acpi: make build_madt() more generic.
acpi: create acpi-common.c and move madt code
acpi: madt: skip pci override on pci-less systems.
acpi: fadt: add hw-reduced sleep register support
acpi: ged: rename event memory region
Julia Suvorova (1):
hw/pci/pcie: Move hot plug capability check to pre_plug callback
Michael S. Tsirkin (2):
msix: allow qword MSI-X table accesses tests/acpi: update DSDT expected files
Philippe Mathieu-Daudé (4):
hw/pci-host/prep: Correct RAVEN bus bridge memory region size hw/pci/pci_bridge: Correct pci_bridge_io memory region size hw/pci/pci_bridge: Use the IEC binary prefix definitions hw/pci-host: Use the IEC binary prefix definitions
Prasad J Pandit (1):
pci: assert configuration access is within bounds
Raphael Norwitz (11):
Add helper to populate vhost-user message regions Add vhost-user helper to get MemoryRegion data Add VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS Transmit vhost-user memory regions individually Lift max memory slots limit imposed by vhost-user Refactor out libvhost-user fault generation logic Support ram slot configuration in libvhost-user Support adding individual regions in libvhost-user Support individual region unmap in libvhost-user Lift max ram slots limit in libvhost-user Fix parameter type in vhost migration log path
Stefan Berger (1):
acpi: tpm: Do not build TCPA table for TPM 2
Stefan Hajnoczi (1):
libvhost-user: advertise vring features
Stefano Garzarella (3):
vhost-vsock: add vhost-vsock-common abstraction
virtio: add vhost-user-vsock base device
virtio: add vhost-user-vsock-pci device
Thomas Huth (2):
MAINTAINERS: Fix the classification of bios-tables-test-allowed-diff.h hw/pci: Fix crash when running QEMU with "-nic model=rocker"
Vishal Verma (3):
diffs-allowed: add the SRAT AML to diffs-allowed hw/acpi/nvdimm: add a helper to augment SRAT generation tests/acpi: update expected SRAT files
configure | 3 + contrib/libvhost-user/libvhost-user.h | 24 +- hw/i386/acpi-common.h | 15 + include/hw/acpi/acpi-defs.h | 2 + include/hw/acpi/aml-build.h | 2 + include/hw/acpi/generic_event_device.h | 2 +- include/hw/mem/nvdimm.h | 1 + include/hw/virtio/vhost-user-vsock.h | 36 ++ include/hw/virtio/vhost-user.h | 1 + include/hw/virtio/vhost-vsock-common.h | 47 +++ include/hw/virtio/vhost-vsock.h | 11 +- include/hw/virtio/virtio-balloon.h | 3 +- include/sysemu/tpm.h | 2 + tests/qtest/tpm-emu.h | 3 + chardev/char-socket.c | 7 +- contrib/libvhost-user/libvhost-user.c | 351 +++++++++++++---- contrib/vhost-user-blk/vhost-user-blk.c | 4 +- hw/acpi/aml-build.c | 49 ++- hw/acpi/generic_event_device.c | 16 +- hw/acpi/nvdimm.c | 23 ++ hw/arm/virt-acpi-build.c | 11 + hw/block/vhost-user-blk.c | 38 +- hw/char/parallel.c | 22 ++ hw/char/serial-isa.c | 22 ++ hw/core/machine.c | 4 +- hw/i386/acpi-build.c | 270 +------------ hw/i386/acpi-common.c | 156 ++++++++ hw/pci-host/i440fx.c | 3 +- hw/pci-host/prep.c | 2 +- hw/pci-host/q35.c | 2 +- hw/pci-host/versatile.c | 5 +- hw/pci/msix.c | 6 + hw/pci/pci.c | 17 +- hw/pci/pci_bridge.c | 7 +- hw/pci/pcie.c | 19 +- hw/rtc/mc146818rtc.c | 24 ++ hw/virtio/vhost-user-vsock-pci.c | 84 +++++ hw/virtio/vhost-user-vsock.c | 181 +++++++++ hw/virtio/vhost-user.c | 646 +++++++++++++++++++++++++++----- hw/virtio/vhost-vsock-common.c | 258 +++++++++++++ hw/virtio/vhost-vsock.c | 283 +++----------- hw/virtio/vhost.c | 4 +- hw/virtio/virtio-balloon.c | 137 ++++++- tests/qtest/bios-tables-test.c | 58 +++ tests/qtest/tpm-emu.c | 1 - MAINTAINERS | 3 +- docs/interop/vhost-user.rst | 44 +++ hw/i386/Makefile.objs | 1 + hw/virtio/Makefile.objs | 4 +- tests/data/acpi/pc/DSDT | Bin 5125 -> 5014 bytes tests/data/acpi/pc/DSDT.acpihmat | Bin 6449 -> 6338 bytes tests/data/acpi/pc/DSDT.bridge | Bin 6984 -> 6873 bytes tests/data/acpi/pc/DSDT.cphp | Bin 5588 -> 5477 bytes tests/data/acpi/pc/DSDT.dimmpxm | Bin 6778 -> 6667 bytes tests/data/acpi/pc/DSDT.ipmikcs | Bin 5197 -> 5086 bytes tests/data/acpi/pc/DSDT.memhp | Bin 6484 -> 6373 bytes tests/data/acpi/pc/DSDT.numamem | Bin 5131 -> 5020 bytes tests/data/acpi/pc/SRAT.dimmpxm | Bin 392 -> 392 bytes tests/data/acpi/q35/DSDT | Bin 7863 -> 7752 bytes tests/data/acpi/q35/DSDT.acpihmat | Bin 9187 -> 9076 bytes tests/data/acpi/q35/DSDT.bridge | Bin 7880 -> 7769 bytes tests/data/acpi/q35/DSDT.cphp | Bin 8326 -> 8215 bytes tests/data/acpi/q35/DSDT.dimmpxm | Bin 9516 -> 9405 bytes tests/data/acpi/q35/DSDT.ipmibt | Bin 7938 -> 7827 bytes tests/data/acpi/q35/DSDT.memhp | Bin 9222 -> 9111 bytes tests/data/acpi/q35/DSDT.mmio64 | Bin 8993 -> 8882 bytes tests/data/acpi/q35/DSDT.numamem | Bin 7869 -> 7758 bytes tests/data/acpi/q35/DSDT.tis | Bin 0 -> 8357 bytes tests/data/acpi/q35/SRAT.dimmpxm | Bin 392 -> 392 bytes tests/data/acpi/q35/TPM2.tis | Bin 0 -> 76 bytes tests/data/acpi/virt/SRAT.memhp | Bin 186 -> 226 bytes tests/qtest/Makefile.include | 1 + 72 files changed, 2168 insertions(+), 747 deletions(-) create mode 100644 hw/i386/acpi-common.h create mode 100644 include/hw/virtio/vhost-user-vsock.h create mode 100644 include/hw/virtio/vhost-vsock-common.h create mode 100644 hw/i386/acpi-common.c create mode 100644 hw/virtio/vhost-user-vsock-pci.c create mode 100644 hw/virtio/vhost-user-vsock.c create mode 100644 hw/virtio/vhost-vsock-common.c create mode 100644 tests/data/acpi/q35/DSDT.tis create mode 100644 tests/data/acpi/q35/TPM2.tis
[PULL 01/56] msix: allow qword MSI-X table accesses
PCI spec says:
For all accesses to MSI-X Table and MSI-X PBA fields, software must use aligned full DWORD or aligned full QWORD transactions; otherwise, the result is undefined.
However, since MSI-X was converted to use memory API, QEMU started blocking qword transactions, only allowing DWORD ones. Guests do not seem to use QWORD accesses, but let's be spec compliant.
--- hw/pci/msix.c | 6 ++++++ 1 file changed, 6 insertions(+)
hw/pci/msix.c +6 -0
@@ -199,6 +199,9 @@ static const MemoryRegionOps msix_table_mmio_ops = { .endianness = DEVICE_LITTLE_ENDIAN, .valid = { .min_access_size = 4, + .max_access_size = 8, + }, + .impl = { .max_access_size = 4, }, };
@@ -227,6 +230,9 @@ static const MemoryRegionOps msix_pba_mmio_ops = { .endianness = DEVICE_LITTLE_ENDIAN, .valid = { .min_access_size = 4, + .max_access_size = 8, + }, + .impl = { .max_access_size = 4, }, };
Signature · 1 line
MST
[PULL 09/56] acpi: move aml builder code for serial device
In reply to Michael S. TsirkinFrom: Gerd Hoffmann <[email protected]>
The code uses the isa_serial_io array to figure what the device uid is. Side effect is that acpi antries are not limited to port 1+2 any more, we'll also get entries for ports 3+4.
Message-Id: <[email protected]>
--- hw/char/serial-isa.c | 22 ++++++++++++++++++++++ hw/i386/acpi-build.c | 32 -------------------------------- 2 files changed, 22 insertions(+), 32 deletions(-)
hw/char/serial-isa.c +22 -0
@@ -27,6 +27,7 @@#include "qapi/error.h" #include "qemu/module.h" #include "sysemu/sysemu.h" +#include "hw/acpi/aml-build.h" #include "hw/char/serial.h" #include "hw/isa/isa.h" #include "hw/qdev-properties.h"
@@ -81,6 +82,25 @@ static void serial_isa_realizefn(DeviceState *dev, Error **errp)isa_register_ioport (isadev, &s->io, isa->iobase); } +static void serial_isa_build_aml (ISADevice *isadev,Aml *scope) +{ +ISASerialState *isa =ISA_SERIAL (isadev); +Aml *dev; +Aml *crs; + + crs =aml_resource_template (); +aml_append (crs,aml_io (AML_DECODE16 , isa->iobase, isa->iobase,0x00 ,0x08 )); +aml_append (crs,aml_irq_no_flags (isa->isairq)); + + dev =aml_device ("COM%d" , isa->index +1 ); +aml_append (dev,aml_name_decl ("_HID" ,aml_eisaid ("PNP0501" ))); +aml_append (dev,aml_name_decl ("_UID" ,aml_int (isa->index +1 ))); +aml_append (dev,aml_name_decl ("_STA" ,aml_int (0xf ))); +aml_append (dev,aml_name_decl ("_CRS" , crs)); + +aml_append (scope, dev); +} +static const VMStateDescription vmstate_isa_serial = { .name ="serial" , .version_id =3 ,
@@ -103,9 +123,11 @@ static Property serial_isa_properties[] = {static void serial_isa_class_initfn (ObjectClass *klass,void *data) {DeviceClass *dc =DEVICE_CLASS (klass); +ISADeviceClass *isa =ISA_DEVICE_CLASS (klass); dc->realize = serial_isa_realizefn; dc->vmsd = &vmstate_isa_serial; + isa->build_aml = serial_isa_build_aml;device_class_set_props (dc, serial_isa_properties);set_bit (DEVICE_CATEGORY_INPUT , dc->categories); }
hw/i386/acpi-build.c +0 -32
@@ -1208,36 +1208,6 @@ static Aml *build_lpt_device_aml(void)return dev; } -static void build_com_device_aml (Aml *scope,uint8_t uid) -{ -Aml *dev; -Aml *crs; -uint8_t irq =4 ; -uint16_t io_port =0x03F8 ; - -assert (uid ==1 || uid ==2 ); -if (uid ==2 ) { - irq =3 ; - io_port =0x02F8 ; - } -if (!memory_region_present (get_system_io (), io_port)) { -return ; - } - - dev =aml_device ("COM%d" , uid); -aml_append (dev,aml_name_decl ("_HID" ,aml_eisaid ("PNP0501" ))); -aml_append (dev,aml_name_decl ("_UID" ,aml_int (uid))); - -aml_append (dev,aml_name_decl ("_STA" ,aml_int (0xf ))); - - crs =aml_resource_template (); -aml_append (crs,aml_io (AML_DECODE16 , io_port, io_port,0x00 ,0x08 )); -aml_append (crs,aml_irq_no_flags (irq)); -aml_append (dev,aml_name_decl ("_CRS" , crs)); - -aml_append (scope, dev); -} -static void build_isa_devices_aml (Aml *table) {ISADevice *fdc =pc_find_fdc0 ();
@@ -1252,8 +1222,6 @@ static void build_isa_devices_aml(Aml *table)aml_append (scope,build_fdc_device_aml (fdc)); }aml_append (scope,build_lpt_device_aml ()); -build_com_device_aml (scope,1 ); -build_com_device_aml (scope,2 );if (ambiguous) {error_report ("Multiple ISA busses, unable to define IPMI ACPI data" );
Signature · 1 line
MST
[PULL 14/56] acpi: Convert build_tpm2() to build_append* API
In reply to Michael S. TsirkinFrom: Eric Auger <[email protected]>
In preparation of its move to the generic acpi code, let's convert build_tpm2() to use build_append API. This latter now is prefered in place of direct ACPI struct field settings with manual endianness conversion.
Message-Id: <[email protected]>
--- hw/i386/acpi-build.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-)
hw/i386/acpi-build.c +19 -9
@@ -2197,30 +2197,40 @@ build_tpm_tcpa(GArray *table_data, BIOSLinker *linker, GArray *tcpalog)static void build_tpm2 (GArray *table_data,BIOSLinker *linker,GArray *tcpalog) { -Acpi20TPM2 *tpm2_ptr =acpi_data_push (table_data,sizeof *tpm2_ptr); +Acpi20TPM2 *tpm2_ptr =acpi_data_push (table_data,sizeof (AcpiTableHeader));unsigned log_addr_size =sizeof (tpm2_ptr->log_area_start_address);unsigned log_addr_offset = (char *)&tpm2_ptr->log_area_start_address - table_data->data; +uint8_t start_method_params[12 ] = {}; - tpm2_ptr->platform_class =cpu_to_le16 (TPM2_ACPI_CLASS_CLIENT ); +/* platform class */ +build_append_int_noprefix (table_data,TPM2_ACPI_CLASS_CLIENT ,2 ); +/* reserved */ +build_append_int_noprefix (table_data,0 ,2 );if (TPM_IS_TIS_ISA (tpm_find ())) { - tpm2_ptr->control_area_address =cpu_to_le64 (0 ); - tpm2_ptr->start_method =cpu_to_le32 (TPM2_START_METHOD_MMIO ); +/* address of control area */ +build_append_int_noprefix (table_data,0 ,8 ); +/* start method */ +build_append_int_noprefix (table_data,TPM2_START_METHOD_MMIO ,4 ); }else if (TPM_IS_CRB (tpm_find ())) { - tpm2_ptr->control_area_address =cpu_to_le64 (TPM_CRB_ADDR_CTRL ); - tpm2_ptr->start_method =cpu_to_le32 (TPM2_START_METHOD_CRB ); +build_append_int_noprefix (table_data,TPM_CRB_ADDR_CTRL ,8 ); +build_append_int_noprefix (table_data,TPM2_START_METHOD_CRB ,4 ); }else {g_warn_if_reached (); } - tpm2_ptr->log_area_minimum_length = -cpu_to_le32 (TPM_LOG_AREA_MINIMUM_SIZE ); +/* platform specific parameters */ +g_array_append_vals (table_data, &start_method_params,12 ); -acpi_data_push (tcpalog,le32_to_cpu (tpm2_ptr->log_area_minimum_length)); +/* log area minimum length */ +build_append_int_noprefix (table_data,TPM_LOG_AREA_MINIMUM_SIZE ,4 ); + +acpi_data_push (tcpalog,TPM_LOG_AREA_MINIMUM_SIZE );bios_linker_loader_alloc (linker,ACPI_BUILD_TPMLOG_FILE , tcpalog,1 , false);/* log area start address to be filled by Guest linker */ +build_append_int_noprefix (table_data,0 ,8 );bios_linker_loader_add_pointer (linker,ACPI_BUILD_TABLE_FILE , log_addr_offset, log_addr_size,ACPI_BUILD_TPMLOG_FILE ,0 );
Signature · 1 line
MST
[PULL 02/56] diffs-allowed: add the SRAT AML to diffs-allowed
In reply to Michael S. TsirkinFrom: Vishal Verma <[email protected]>
In anticipation of a change to the SRAT generation in qemu, add the AML file to diffs-allowed.
Message-Id: <[email protected]>
--- tests/qtest/bios-tables-test-allowed-diff.h | 3 +++ 1 file changed, 3 insertions(+)
tests/qtest/bios-tables-test-allowed-diff.h +3 -0
@@ -1 +1,4 @@/* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/pc/SRAT.dimmpxm" , +"tests/data/acpi/q35/SRAT.dimmpxm" , +"tests/data/acpi/virt/SRAT.memhp",
Signature · 1 line
MST
[PULL 06/56] acpi: move aml builder code for rtc device
In reply to Michael S. TsirkinFrom: Gerd Hoffmann <[email protected]>
Message-Id: <[email protected]>
--- hw/i386/acpi-build.c | 17 ----------------- hw/rtc/mc146818rtc.c | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 17 deletions(-)
hw/i386/acpi-build.c +0 -17
@@ -1137,22 +1137,6 @@ static Aml *build_fdc_device_aml(ISADevice *fdc)return dev; } -static Aml *build_rtc_device_aml (void ) -{ -Aml *dev; -Aml *crs; - - dev =aml_device ("RTC" ); -aml_append (dev,aml_name_decl ("_HID" ,aml_eisaid ("PNP0B00" ))); - crs =aml_resource_template (); -aml_append (crs,aml_io (AML_DECODE16 ,0x0070 ,0x0070 ,0x10 ,0x02 )); -aml_append (crs,aml_irq_no_flags (8 )); -aml_append (crs,aml_io (AML_DECODE16 ,0x0072 ,0x0072 ,0x02 ,0x06 )); -aml_append (dev,aml_name_decl ("_CRS" , crs)); - -return dev; -} -static Aml *build_kbd_device_aml (void ) {Aml *dev;
@@ -1278,7 +1262,6 @@ static void build_isa_devices_aml(Aml *table)Aml *scope =aml_scope ("_SB.PCI0.ISA" );Object *obj =object_resolve_path_type ("" ,TYPE_ISA_BUS , &ambiguous); -aml_append (scope,build_rtc_device_aml ());aml_append (scope,build_kbd_device_aml ());aml_append (scope,build_mouse_device_aml ());if (fdc) {
hw/rtc/mc146818rtc.c +22 -0
@@ -27,6 +27,7 @@#include "qemu/cutils.h" #include "qemu/module.h" #include "qemu/bcd.h" +#include "hw/acpi/aml-build.h" #include "hw/irq.h" #include "hw/qdev-properties.h" #include "qemu/timer.h"
@@ -1007,13 +1008,34 @@ static void rtc_resetdev(DeviceState *d) } } +static void rtc_build_aml (ISADevice *isadev,Aml *scope) +{ +Aml *dev; +Aml *crs; + + crs =aml_resource_template (); +aml_append (crs,aml_io (AML_DECODE16 ,RTC_ISA_BASE ,RTC_ISA_BASE , +0x10 ,0x02 )); +aml_append (crs,aml_irq_no_flags (RTC_ISA_IRQ )); +aml_append (crs,aml_io (AML_DECODE16 ,RTC_ISA_BASE +2 ,RTC_ISA_BASE +2 , +0x02 ,0x06 )); + + dev =aml_device ("RTC" ); +aml_append (dev,aml_name_decl ("_HID" ,aml_eisaid ("PNP0B00" ))); +aml_append (dev,aml_name_decl ("_CRS" , crs)); + +aml_append (scope, dev); +} +static void rtc_class_initfn (ObjectClass *klass,void *data) {DeviceClass *dc =DEVICE_CLASS (klass); +ISADeviceClass *isa =ISA_DEVICE_CLASS (klass); dc->realize = rtc_realizefn; dc->reset = rtc_resetdev; dc->vmsd = &vmstate_rtc; + isa->build_aml = rtc_build_aml;device_class_set_props (dc, mc146818rtc_properties); }
Signature · 1 line
MST
[PULL 20/56] bios-tables-test: Add Q35/TPM-TIS test
In reply to Michael S. TsirkinFrom: Eric Auger <[email protected]>
Test tables specific to the TPM-TIS instantiation. The TPM2 is added in the framework. Also the DSDT is updated with the TPM. The new function should be be usable for CRB as well, later one.
Message-Id: <[email protected]>
--- tests/qtest/bios-tables-test.c | 58 ++++++++++++++++++++++++++++++++++ tests/qtest/Makefile.include | 1 + 2 files changed, 59 insertions(+)
tests/qtest/bios-tables-test.c +58 -0
@@ -57,6 +57,9 @@#include "qemu/bitmap.h" #include "acpi-utils.h" #include "boot-sector.h" +#include "tpm-emu.h" +#include "hw/acpi/tpm.h" +#define MACHINE_PC "pc"#define MACHINE_Q35 "q35"
@@ -874,6 +877,60 @@ static void test_acpi_piix4_tcg_numamem(void)free_test_data (&data); } +uint64_t tpm_tis_base_addr; + +static void test_acpi_tcg_tpm (const char *machine,const char *tpm_if, +uint64_t base) +{ +gchar *tmp_dir_name =g_strdup_printf ("qemu-test_acpi_%s_tcg_%s.XXXXXX" , + machine, tpm_if); +char *tmp_path =g_dir_make_tmp (tmp_dir_name,NULL ); +TestState test; +test_data data; +GThread *thread; +char *args, *variant =g_strdup_printf (".%s" , tpm_if); + + tpm_tis_base_addr = base; + +module_call_init (MODULE_INIT_QOM ); + + test.addr =g_new0 (SocketAddress,1 ); + test.addr->type =SOCKET_ADDRESS_TYPE_UNIX ; + test.addr->u.q_unix.path =g_build_filename (tmp_path,"sock" ,NULL ); +g_mutex_init (&test.data_mutex); +g_cond_init (&test.data_cond); + test.data_cond_signal = false; + + thread =g_thread_new (NULL , tpm_emu_ctrl_thread, &test); +tpm_emu_test_wait_cond (&test); + +memset (&data,0 ,sizeof (data)); + data.machine = machine; + data.variant = variant; + + args =g_strdup_printf ( +" -chardev socket,id=chr,path=%s" +" -tpmdev emulator,id=dev,chardev=chr" +" -device tpm-%s,tpmdev=dev" , + test.addr->u.q_unix.path, tpm_if); + +test_acpi_one (args, &data); + +g_thread_join (thread); +g_unlink (test.addr->u.q_unix.path); +qapi_free_SocketAddress (test.addr); +g_rmdir (tmp_path); +g_free (variant); +g_free (tmp_path); +g_free (tmp_dir_name); +free_test_data (&data); +} + +static void test_acpi_q35_tcg_tpm_tis (void ) +{ +test_acpi_tcg_tpm ("q35" ,"tis" ,0xFED40000 ); +} +static void test_acpi_tcg_dimm_pxm (const char *machine) {test_data data;
@@ -1037,6 +1094,7 @@ int main(int argc, char *argv[])return ret; } +qtest_add_func ("acpi/q35/tpm-tis" , test_acpi_q35_tcg_tpm_tis);qtest_add_func ("acpi/piix4" , test_acpi_piix4_tcg);qtest_add_func ("acpi/piix4/bridge" , test_acpi_piix4_tcg_bridge);qtest_add_func ("acpi/q35" , test_acpi_q35_tcg);
tests/qtest/Makefile.include +1 -0
@@ -262,6 +262,7 @@ tests/qtest/hd-geo-test$(EXESUF): tests/qtest/hd-geo-test.o $(libqos-obj-y) tests/qtest/boot-order-test$(EXESUF): tests/qtest/boot-order-test.o $(libqos-obj-y) tests/qtest/boot-serial-test$(EXESUF): tests/qtest/boot-serial-test.o $(libqos-obj-y) tests/qtest/bios-tables-test$(EXESUF): tests/qtest/bios-tables-test.o \ + tests/qtest/tpm-emu.o $(test-io-obj-y) \ tests/qtest/boot-sector.o tests/qtest/acpi-utils.o $(libqos-obj-y) tests/qtest/pxe-test$(EXESUF): tests/qtest/pxe-test.o tests/qtest/boot-sector.o $(libqos-obj-y) tests/qtest/microbit-test$(EXESUF): tests/qtest/microbit-test.o
Signature · 1 line
MST
[PULL 15/56] acpi: Move build_tpm2() in the generic part
In reply to Michael S. TsirkinFrom: Eric Auger <[email protected]>
We plan to build the TPM2 table on ARM too. In order to reuse the generation code, let's move build_tpm2() to aml-build.c.
No change in the implementation.
Message-Id: <[email protected]>
--- include/hw/acpi/aml-build.h | 2 ++ hw/acpi/aml-build.c | 44 +++++++++++++++++++++++++++++++++++++ hw/i386/acpi-build.c | 44 ------------------------------------- 3 files changed, 46 insertions(+), 44 deletions(-)
include/hw/acpi/aml-build.h +2 -0
@@ -437,4 +437,6 @@ void build_slit(GArray *table_data, BIOSLinker *linker, MachineState *ms);void build_fadt (GArray *tbl,BIOSLinker *linker,const AcpiFadtData *f,const char *oem_id,const char *oem_table_id); + +void build_tpm2 (GArray *table_data,BIOSLinker *linker,GArray *tcpalog);#endif
hw/acpi/aml-build.c +44 -0
56 lines not on this page · raw message
hw/i386/acpi-build.c +0 -44
50 lines not on this page · raw message
Signature · 1 line
MST
[PULL 08/56] acpi: serial: don't use _STA method
In reply to Michael S. TsirkinFrom: Gerd Hoffmann <[email protected]>
The _STA method dates back to the days where we had a static DSDT. The device is listed in the DSDT table unconditionally and the _STA method checks a bit in the isa bridge pci config space to figure whenever a given is isa device is present or not, then evaluates to 0x0f (present) or 0x00 (absent).
These days the DSDT is generated by qemu anyway, so if a device is not present we can simply drop it from the DSDT instead.
Message-Id: <[email protected]>
--- hw/i386/acpi-build.c | 32 ++++++++------------------------ 1 file changed, 8 insertions(+), 24 deletions(-)
hw/i386/acpi-build.c +8 -24
@@ -1208,50 +1208,34 @@ static Aml *build_lpt_device_aml(void)return dev; } -static Aml *build_com_device_aml (uint8_t uid) +static void build_com_device_aml (Aml *scope,uint8_t uid) {Aml *dev;Aml *crs; -Aml *method; -Aml *if_ctx; -Aml *else_ctx; -Aml *zero =aml_int (0 ); -Aml *is_present =aml_local (0 ); -const char *enabled_field ="CAEN" ;uint8_t irq =4 ;uint16_t io_port =0x03F8 ;assert (uid ==1 || uid ==2 );if (uid ==2 ) { - enabled_field ="CBEN" ; irq =3 ; io_port =0x02F8 ; } +if (!memory_region_present (get_system_io (), io_port)) { +return ; + } dev =aml_device ("COM%d" , uid);aml_append (dev,aml_name_decl ("_HID" ,aml_eisaid ("PNP0501" )));aml_append (dev,aml_name_decl ("_UID" ,aml_int (uid))); - method =aml_method ("_STA" ,0 ,AML_NOTSERIALIZED ); -aml_append (method,aml_store (aml_name ("%s" , enabled_field), is_present)); - if_ctx =aml_if (aml_equal (is_present, zero)); - { -aml_append (if_ctx,aml_return (aml_int (0x00 ))); - } -aml_append (method, if_ctx); - else_ctx =aml_else (); - { -aml_append (else_ctx,aml_return (aml_int (0x0f ))); - } -aml_append (method, else_ctx); -aml_append (dev, method); +aml_append (dev,aml_name_decl ("_STA" ,aml_int (0xf ))); crs =aml_resource_template ();aml_append (crs,aml_io (AML_DECODE16 , io_port, io_port,0x00 ,0x08 ));aml_append (crs,aml_irq_no_flags (irq));aml_append (dev,aml_name_decl ("_CRS" , crs)); -return dev; +aml_append (scope, dev); }static void build_isa_devices_aml (Aml *table)
@@ -1268,8 +1252,8 @@ static void build_isa_devices_aml(Aml *table)aml_append (scope,build_fdc_device_aml (fdc)); }aml_append (scope,build_lpt_device_aml ()); -aml_append (scope,build_com_device_aml (1 )); -aml_append (scope,build_com_device_aml (2 )); +build_com_device_aml (scope,1 ); +build_com_device_aml (scope,2 );if (ambiguous) {error_report ("Multiple ISA busses, unable to define IPMI ACPI data" );
Signature · 1 line
MST
[PULL 07/56] acpi: rtc: use a single crs range
In reply to Michael S. TsirkinFrom: Gerd Hoffmann <[email protected]>
Use a single io range for _CRS instead of two,
following what real hardware does.
Message-Id: <[email protected]>
--- hw/rtc/mc146818rtc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
hw/rtc/mc146818rtc.c +5 -3
@@ -1013,12 +1013,14 @@ static void rtc_build_aml(ISADevice *isadev, Aml *scope)Aml *dev;Aml *crs; +/* +* Reserving 8 io ports here, following what physical hardware +* does, even though qemu only responds to the first two ports. +*/ crs =aml_resource_template ();aml_append (crs,aml_io (AML_DECODE16 ,RTC_ISA_BASE ,RTC_ISA_BASE , -0x10 ,0x02 )); +0x01 ,0x08 ));aml_append (crs,aml_irq_no_flags (RTC_ISA_IRQ )); -aml_append (crs,aml_io (AML_DECODE16 ,RTC_ISA_BASE +2 ,RTC_ISA_BASE +2 , -0x02 ,0x06 )); dev =aml_device ("RTC" );aml_append (dev,aml_name_decl ("_HID" ,aml_eisaid ("PNP0B00" )));
Signature · 1 line
MST
[PULL 28/56] hw/pci/pcie: Move hot plug capability check to pre_plug callback
In reply to Michael S. TsirkinFrom: Julia Suvorova <[email protected]>
Check for hot plug capability earlier to avoid removing devices attached during the initialization process.
Run qemu with an unattached drive:
-drive file=$FILE,if=none,id=drive0 \
-device pcie-root-port,id=rp0,slot=3,bus=pcie.0,hotplug=off
Hotplug a block device:
device_add virtio-blk-pci,id=blk0,drive=drive0,bus=rp0
If hotplug fails on plug_cb, drive0 will be deleted.
Message-Id: <[email protected]>
--- hw/pci/pcie.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
hw/pci/pcie.c +11 -8
@@ -407,6 +407,17 @@ static void pcie_cap_slot_plug_common(PCIDevice *hotplug_dev, DeviceState *dev,void pcie_cap_slot_pre_plug_cb (HotplugHandler *hotplug_dev,DeviceState *dev,Error **errp) { +PCIDevice *hotplug_pdev =PCI_DEVICE (hotplug_dev); +uint8_t *exp_cap = hotplug_pdev->config + hotplug_pdev->exp.exp_cap; +uint32_t sltcap =pci_get_word (exp_cap +PCI_EXP_SLTCAP ); + +/* Check if hot-plug is disabled on the slot */ +if (dev->hotplugged && (sltcap &PCI_EXP_SLTCAP_HPC ) ==0 ) { +error_setg (errp,"Hot-plug failed: unsupported by the port device '%s'" , +DEVICE (hotplug_pdev)->id); +return ; + } +pcie_cap_slot_plug_common (PCI_DEVICE (hotplug_dev), dev, errp); }
@@ -415,7 +426,6 @@ void pcie_cap_slot_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev, {PCIDevice *hotplug_pdev =PCI_DEVICE (hotplug_dev);uint8_t *exp_cap = hotplug_pdev->config + hotplug_pdev->exp.exp_cap; -uint32_t sltcap =pci_get_word (exp_cap +PCI_EXP_SLTCAP );PCIDevice *pci_dev =PCI_DEVICE (dev);/* Don't send event when device is enabled during qemu machine creation:
@@ -431,13 +441,6 @@ void pcie_cap_slot_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,return ; } -/* Check if hot-plug is disabled on the slot */ -if ((sltcap &PCI_EXP_SLTCAP_HPC ) ==0 ) { -error_setg (errp,"Hot-plug failed: unsupported by the port device '%s'" , -DEVICE (hotplug_pdev)->id); -return ; - } -/* To enable multifunction hot-plug, we just ensure the function * 0 added last. When function 0 is added, we set the sltsta and * inform OS via event notification.
Signature · 1 line
MST
[PULL 16/56] arm/acpi: TPM2 ACPI table support
In reply to Michael S. TsirkinFrom: Eric Auger <[email protected]>
Add a TPM2 ACPI table if a TPM2.0 sysbus device has been dynamically instantiated.
Message-Id: <[email protected]>
--- include/sysemu/tpm.h | 2 ++ hw/acpi/aml-build.c | 5 +++-- hw/arm/virt-acpi-build.c | 7 +++++++ 3 files changed, 12 insertions(+), 2 deletions(-)
include/sysemu/tpm.h +2 -0
@@ -50,6 +50,8 @@ typedef struct TPMIfClass {#define TPM_IS_TIS_ISA (chr) \ object_dynamic_cast(OBJECT(chr), TYPE_TPM_TIS_ISA) +#define TPM_IS_TIS_SYSBUS (chr) \ + object_dynamic_cast(OBJECT(chr), TYPE_TPM_TIS_SYSBUS)#define TPM_IS_CRB (chr) \ object_dynamic_cast(OBJECT(chr), TYPE_TPM_CRB)#define TPM_IS_SPAPR (chr) \
hw/acpi/aml-build.c +3 -2
@@ -1885,17 +1885,18 @@ void build_tpm2(GArray *table_data, BIOSLinker *linker, GArray *tcpalog)unsigned log_addr_offset = (char *)&tpm2_ptr->log_area_start_address - table_data->data;uint8_t start_method_params[12 ] = {}; +TPMIf *tpmif =tpm_find ();/* platform class */ build_append_int_noprefix (table_data,TPM2_ACPI_CLASS_CLIENT ,2 );/* reserved */ build_append_int_noprefix (table_data,0 ,2 ); -if (TPM_IS_TIS_ISA (tpm_find ())) { +if (TPM_IS_TIS_ISA (tpmif) ||TPM_IS_TIS_SYSBUS (tpmif)) {/* address of control area */ build_append_int_noprefix (table_data,0 ,8 );/* start method */ build_append_int_noprefix (table_data,TPM2_START_METHOD_MMIO ,4 ); - }else if (TPM_IS_CRB (tpm_find ())) { + }else if (TPM_IS_CRB (tpmif)) {build_append_int_noprefix (table_data,TPM_CRB_ADDR_CTRL ,8 );build_append_int_noprefix (table_data,TPM2_START_METHOD_CRB ,4 ); }else {
hw/arm/virt-acpi-build.c +7 -0
@@ -41,12 +41,14 @@#include "hw/acpi/pci.h" #include "hw/acpi/memory_hotplug.h" #include "hw/acpi/generic_event_device.h" +#include "hw/acpi/tpm.h" #include "hw/pci/pcie_host.h" #include "hw/pci/pci.h" #include "hw/arm/virt.h" #include "hw/mem/nvdimm.h" #include "sysemu/numa.h" #include "sysemu/reset.h" +#include "sysemu/tpm.h" #include "kvm_arm.h" #include "migration/vmstate.h" #include "hw/acpi/ghes.h"
@@ -848,6 +850,11 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTables *tables)build_iort (tables_blob, tables->linker, vms); } +if (tpm_get_version (tpm_find ()) ==TPM_VERSION_2_0 ) { +acpi_add_table (table_offsets, tables_blob); +build_tpm2 (tables_blob, tables->linker, tables->tcpalog); + } +/* XSDT is pointed to by RSDP */ xsdt = tables_blob->len;build_xsdt (tables_blob, tables->linker, table_offsets,NULL ,NULL );
Signature · 1 line
MST
[PULL 10/56] acpi: parallel: don't use _STA method
In reply to Michael S. TsirkinFrom: Gerd Hoffmann <[email protected]>
The _STA method dates back to the days where we had a static DSDT. The device is listed in the DSDT table unconditionally and the _STA method checks a bit in the isa bridge pci config space to figure whenever a given is isa device is present or not, then evaluates to 0x0f (present) or 0x00 (absent).
These days the DSDT is generated by qemu anyway, so if a device is not present we can simply drop it from the DSDT instead.
Message-Id: <[email protected]>
--- hw/i386/acpi-build.c | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-)
hw/i386/acpi-build.c +8 -21
@@ -1173,39 +1173,26 @@ static Aml *build_mouse_device_aml(void)return dev; } -static Aml *build_lpt_device_aml (void ) +static void build_lpt_device_aml (Aml *scope) {Aml *dev;Aml *crs; -Aml *method; -Aml *if_ctx; -Aml *else_ctx; -Aml *zero =aml_int (0 ); -Aml *is_present =aml_local (0 ); + +if (!memory_region_present (get_system_io (),0x0378 )) { +return ; + } dev =aml_device ("LPT" );aml_append (dev,aml_name_decl ("_HID" ,aml_eisaid ("PNP0400" ))); - method =aml_method ("_STA" ,0 ,AML_NOTSERIALIZED ); -aml_append (method,aml_store (aml_name ("LPEN" ), is_present)); - if_ctx =aml_if (aml_equal (is_present, zero)); - { -aml_append (if_ctx,aml_return (aml_int (0x00 ))); - } -aml_append (method, if_ctx); - else_ctx =aml_else (); - { -aml_append (else_ctx,aml_return (aml_int (0x0f ))); - } -aml_append (method, else_ctx); -aml_append (dev, method); +aml_append (dev,aml_name_decl ("_STA" ,aml_int (0xf ))); crs =aml_resource_template ();aml_append (crs,aml_io (AML_DECODE16 ,0x0378 ,0x0378 ,0x08 ,0x08 ));aml_append (crs,aml_irq_no_flags (7 ));aml_append (dev,aml_name_decl ("_CRS" , crs)); -return dev; +aml_append (scope, dev); }static void build_isa_devices_aml (Aml *table)
@@ -1221,7 +1208,7 @@ static void build_isa_devices_aml(Aml *table)if (fdc) {aml_append (scope,build_fdc_device_aml (fdc)); } -aml_append (scope,build_lpt_device_aml ()); +build_lpt_device_aml (scope);if (ambiguous) {error_report ("Multiple ISA busses, unable to define IPMI ACPI data" );
Signature · 1 line
MST
[PULL 12/56] tests/acpi: update DSDT expected files
In reply to Michael S. TsirkinUpdate DSDT after CRS changes and _STA methods dropped.
--- tests/qtest/bios-tables-test-allowed-diff.h | 17 ----------------- tests/data/acpi/pc/DSDT | Bin 5125 -> 5014 bytes tests/data/acpi/pc/DSDT.acpihmat | Bin 6449 -> 6338 bytes tests/data/acpi/pc/DSDT.bridge | Bin 6984 -> 6873 bytes tests/data/acpi/pc/DSDT.cphp | Bin 5588 -> 5477 bytes tests/data/acpi/pc/DSDT.dimmpxm | Bin 6778 -> 6667 bytes tests/data/acpi/pc/DSDT.ipmikcs | Bin 5197 -> 5086 bytes tests/data/acpi/pc/DSDT.memhp | Bin 6484 -> 6373 bytes tests/data/acpi/pc/DSDT.numamem | Bin 5131 -> 5020 bytes tests/data/acpi/q35/DSDT | Bin 7863 -> 7752 bytes tests/data/acpi/q35/DSDT.acpihmat | Bin 9187 -> 9076 bytes tests/data/acpi/q35/DSDT.bridge | Bin 7880 -> 7769 bytes tests/data/acpi/q35/DSDT.cphp | Bin 8326 -> 8215 bytes tests/data/acpi/q35/DSDT.dimmpxm | Bin 9516 -> 9405 bytes tests/data/acpi/q35/DSDT.ipmibt | Bin 7938 -> 7827 bytes tests/data/acpi/q35/DSDT.memhp | Bin 9222 -> 9111 bytes tests/data/acpi/q35/DSDT.mmio64 | Bin 8993 -> 8882 bytes tests/data/acpi/q35/DSDT.numamem | Bin 7869 -> 7758 bytes 18 files changed, 17 deletions(-)
tests/qtest/bios-tables-test-allowed-diff.h +0 -17
@@ -1,18 +1 @@/* List of comma-separated changed AML files to ignore */ -"tests/data/acpi/pc/DSDT" , -"tests/data/acpi/pc/DSDT.acpihmat" , -"tests/data/acpi/pc/DSDT.bridge" , -"tests/data/acpi/pc/DSDT.cphp" , -"tests/data/acpi/pc/DSDT.dimmpxm" , -"tests/data/acpi/pc/DSDT.ipmikcs" , -"tests/data/acpi/pc/DSDT.memhp" , -"tests/data/acpi/pc/DSDT.numamem" , -"tests/data/acpi/q35/DSDT" , -"tests/data/acpi/q35/DSDT.acpihmat" , -"tests/data/acpi/q35/DSDT.bridge" , -"tests/data/acpi/q35/DSDT.cphp" , -"tests/data/acpi/q35/DSDT.dimmpxm" , -"tests/data/acpi/q35/DSDT.ipmibt" , -"tests/data/acpi/q35/DSDT.memhp" , -"tests/data/acpi/q35/DSDT.mmio64" , -"tests/data/acpi/q35/DSDT.numamem",
tests/data/acpi/pc/DSDT binary +0 -0
tests/data/acpi/pc/DSDT.acpihmat binary +0 -0
tests/data/acpi/pc/DSDT.bridge binary +0 -0
tests/data/acpi/pc/DSDT.cphp binary +0 -0
tests/data/acpi/pc/DSDT.dimmpxm binary +0 -0
tests/data/acpi/pc/DSDT.ipmikcs binary +0 -0
tests/data/acpi/pc/DSDT.memhp binary +0 -0
tests/data/acpi/pc/DSDT.numamem binary +0 -0
tests/data/acpi/q35/DSDT binary +0 -0
tests/data/acpi/q35/DSDT.acpihmat binary +0 -0
tests/data/acpi/q35/DSDT.bridge binary +0 -0
tests/data/acpi/q35/DSDT.cphp binary +0 -0
tests/data/acpi/q35/DSDT.dimmpxm binary +0 -0
tests/data/acpi/q35/DSDT.ipmibt binary +0 -0
tests/data/acpi/q35/DSDT.memhp binary +0 -0
tests/data/acpi/q35/DSDT.mmio64 binary +0 -0
tests/data/acpi/q35/DSDT.numamem binary +0 -0
Signature · 1 line
MST
[PULL 34/56] char-socket: return -1 in case of disconnect during tcp_chr_write
In reply to Michael S. TsirkinFrom: Dima Stepanov <[email protected]>
During testing of the vhost-user-blk reconnect functionality the qemu SIGSEGV was triggered:
start qemu as:
x86_64-softmmu/qemu-system-x86_64 -m 1024M -M q35 \
-object memory-backend-file,id=ram-node0,size=1024M,mem-path=/dev/shm/qemu,share=on \
-numa node,cpus=0,memdev=ram-node0 \
-chardev socket,id=chardev0,path=./vhost.sock,noserver,reconnect=1 \
-device vhost-user-blk-pci,chardev=chardev0,num-queues=4 --enable-kvm
start vhost-user-blk daemon:
./vhost-user-blk -s ./vhost.sock -b test-img.raw
If vhost-user-blk will be killed during the vhost initialization process, for instance after getting VHOST_SET_VRING_CALL command, then QEMU will fail with the following backtrace:
Thread 1 "qemu-system-x86" received signal SIGSEGV, Segmentation fault. 0x00005555559272bb in vhost_user_read (dev=0x7fffef2d53e0, msg=0x7fffffffd5b0)
at ./hw/virtio/vhost-user.c:260
260 CharBackend *chr = u->user->chr;
#0 0x00005555559272bb in vhost_user_read (dev=0x7fffef2d53e0, msg=0x7fffffffd5b0)
at ./hw/virtio/vhost-user.c:260
#1 0x000055555592acb8 in vhost_user_get_config (dev=0x7fffef2d53e0, config=0x7fffef2d5394 "", config_len=60)
at ./hw/virtio/vhost-user.c:1645
#2 0x0000555555925525 in vhost_dev_get_config (hdev=0x7fffef2d53e0, config=0x7fffef2d5394 "", config_len=60)
at ./hw/virtio/vhost.c:1490
#3 0x00005555558cc46b in vhost_user_blk_device_realize (dev=0x7fffef2d51a0, errp=0x7fffffffd8f0)
at ./hw/block/vhost-user-blk.c:429
#4 0x0000555555920090 in virtio_device_realize (dev=0x7fffef2d51a0, errp=0x7fffffffd948)
at ./hw/virtio/virtio.c:3615
#5 0x0000555555a9779c in device_set_realized (obj=0x7fffef2d51a0, value=true, errp=0x7fffffffdb88)
at ./hw/core/qdev.c:891
...The problem is that vhost_user_write doesn't get an error after disconnect and try to call vhost_user_read(). The tcp_chr_write() routine should return -1 in case of disconnect. Indicate the EIO error if this routine is called in the disconnected state.
Message-Id: <aeb7806bfc945faadf09f64dcfa30f59de3ac053.1590396396.git.dimastep@yandex-team.ru>
--- chardev/char-socket.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
chardev/char-socket.c +4 -3
@@ -175,15 +175,16 @@ static int tcp_chr_write(Chardev *chr, const uint8_t *buf, int len)if (ret <0 && errno !=EAGAIN ) {if (tcp_chr_read_poll (chr) <=0 ) { +/* Perform disconnect and return error. */ tcp_chr_disconnect_locked (chr); -return len; }/* else let the read handler finish it properly */ }return ret; }else { -/* XXX: indicate an error ? */ -return len; +/* Indicate an error. */ + errno =EIO ; +return -1 ; } }
Signature · 1 line
MST
[PULL 23/56] virtio-balloon: fix free page hinting check on unrealize
In reply to Michael S. TsirkinFrom: David Hildenbrand <[email protected]>
Checking against guest features is wrong. We allocated data structures based on host features. We can rely on "free_page_bh" as an indicator whether to un-do stuff instead.
Message-Id: <[email protected]>
--- hw/virtio/virtio-balloon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/virtio/virtio-balloon.c +1 -1
@@ -818,7 +818,7 @@ static void virtio_balloon_device_unrealize(DeviceState *dev)VirtIODevice *vdev =VIRTIO_DEVICE (dev);VirtIOBalloon *s =VIRTIO_BALLOON (dev); -if (virtio_balloon_free_page_support (s)) { +if (s->free_page_bh) {qemu_bh_delete (s->free_page_bh);virtio_balloon_free_page_stop (s);precopy_remove_notifier (&s->free_page_report_notify);
Signature · 1 line
MST
[PULL 18/56] tests/acpi: Add void tables for Q35/TPM-TIS bios-tables-test
In reply to Michael S. TsirkinFrom: Eric Auger <[email protected]>
Add placeholders for TPM and DSDT reference tables for Q35 TPM-TIS tests and ignore them for the time being.
Message-Id: <[email protected]>
--- tests/qtest/bios-tables-test-allowed-diff.h | 2 ++ tests/data/acpi/q35/DSDT.tis | 0 tests/data/acpi/q35/TPM2.tis | 0 3 files changed, 2 insertions(+) create mode 100644 tests/data/acpi/q35/DSDT.tis create mode 100644 tests/data/acpi/q35/TPM2.tis
tests/qtest/bios-tables-test-allowed-diff.h +2 -0
@@ -1 +1,3 @@/* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/q35/DSDT.tis" , +"tests/data/acpi/q35/TPM2.tis",
tests/data/acpi/q35/DSDT.tis new file +0 -0
tests/data/acpi/q35/TPM2.tis new file +0 -0
Signature · 1 line
MST
[PULL 13/56] acpi: tpm: Do not build TCPA table for TPM 2
In reply to Michael S. TsirkinFrom: Stefan Berger <[email protected]>
Do not build a TCPA table for TPM 2 anymore but create the log area when building the TPM2 table. The TCPA table is only needed for TPM 1.2.
--- hw/i386/acpi-build.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
hw/i386/acpi-build.c +8 -4
@@ -2216,6 +2216,10 @@ build_tpm2(GArray *table_data, BIOSLinker *linker, GArray *tcpalog) tpm2_ptr->log_area_minimum_length =cpu_to_le32 (TPM_LOG_AREA_MINIMUM_SIZE ); +acpi_data_push (tcpalog,le32_to_cpu (tpm2_ptr->log_area_minimum_length)); +bios_linker_loader_alloc (linker,ACPI_BUILD_TPMLOG_FILE , tcpalog,1 , + false); +/* log area start address to be filled by Guest linker */ bios_linker_loader_add_pointer(linker, ACPI_BUILD_TABLE_FILE, log_addr_offset, log_addr_size,
@@ -2752,10 +2756,10 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)build_hpet (tables_blob, tables->linker); }if (misc.tpm_version !=TPM_VERSION_UNSPEC ) { -acpi_add_table (table_offsets, tables_blob); -build_tpm_tcpa (tables_blob, tables->linker, tables->tcpalog); - -if (misc.tpm_version ==TPM_VERSION_2_0 ) { +if (misc.tpm_version ==TPM_VERSION_1_2 ) { +acpi_add_table (table_offsets, tables_blob); +build_tpm_tcpa (tables_blob, tables->linker, tables->tcpalog); + }else {/* TPM_VERSION_2_0 */ acpi_add_table (table_offsets, tables_blob);build_tpm2 (tables_blob, tables->linker, tables->tcpalog); }
Signature · 1 line
MST
[PULL 38/56] Add VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS
In reply to Michael S. TsirkinFrom: Raphael Norwitz <[email protected]>
This change introduces a new feature to the vhost-user protocol allowing a backend device to specify the maximum number of ram slots it supports.
At this point, the value returned by the backend will be capped at the maximum number of ram slots which can be supported by vhost-user, which is currently set to 8 because of underlying protocol limitations.
The returned value will be stored inside the VhostUserState struct so that on device reconnect we can verify that the ram slot limitation has not decreased since the last time the device connected.
Message-Id: <[email protected]>
--- include/hw/virtio/vhost-user.h | 1 + hw/virtio/vhost-user.c | 49 ++++++++++++++++++++++++++++++++-- docs/interop/vhost-user.rst | 16 +++++++++++ 3 files changed, 64 insertions(+), 2 deletions(-)
include/hw/virtio/vhost-user.h +1 -0
@@ -20,6 +20,7 @@ typedef struct VhostUserHostNotifier {typedef struct VhostUserState {CharBackend *chr;VhostUserHostNotifier notifier[VIRTIO_QUEUE_MAX ]; +int memory_slots; }VhostUserState ;bool vhost_user_init (VhostUserState *user,CharBackend *chr,Error **errp);
hw/virtio/vhost-user.c +47 -2
91 lines not on this page · raw message
docs/interop/vhost-user.rst +16 -0
@@ -815,6 +815,7 @@ Protocol features #define VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD 12 #define VHOST_USER_PROTOCOL_F_RESET_DEVICE 13 #define VHOST_USER_PROTOCOL_F_INBAND_NOTIFICATIONS 14 + #define VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS 15 Master message types --------------------
@@ -1263,6 +1264,21 @@ Master message types The state.num field is currently reserved and must be set to 0. +``VHOST_USER_GET_MAX_MEM_SLOTS`` + :id: 36 + :equivalent ioctl: N/A + :slave payload: u64 + + When the ``VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS`` protocol + feature has been successfully negotiated, this message is submitted + by master to the slave. The slave should return the message with a + u64 payload containing the maximum number of memory slots for + QEMU to expose to the guest. At this point, the value returned + by the backend will be capped at the maximum number of ram slots + which can be supported by vhost-user. Currently that limit is set + at VHOST_USER_MAX_RAM_SLOTS = 8 because of underlying protocol + limitations. + Slave message types -------------------
Signature · 1 line
MST
[PULL 24/56] virtio-balloon: unref the iothread when unrealizing
In reply to Michael S. TsirkinFrom: David Hildenbrand <[email protected]>
We took a reference when realizing, so let's drop that reference when unrealizing.
Message-Id: <[email protected]>
--- hw/virtio/virtio-balloon.c | 1 + 1 file changed, 1 insertion(+)
hw/virtio/virtio-balloon.c +1 -0
@@ -820,6 +820,7 @@ static void virtio_balloon_device_unrealize(DeviceState *dev)if (s->free_page_bh) {qemu_bh_delete (s->free_page_bh); +object_unref (OBJECT (s->iothread));virtio_balloon_free_page_stop (s);precopy_remove_notifier (&s->free_page_report_notify); }
Signature · 1 line
MST
[PULL 19/56] tests: tpm-emu: Remove assert on TPM2_ST_NO_SESSIONS
In reply to Michael S. TsirkinFrom: Eric Auger <[email protected]>
bios-tables-test executes SeaBIOS. Indeed FW is needed to fetch tables from QEMU and put them into the guest RAM. Also the FW patches cross table pointers. At some point, SeaBIOS ends up calling the TPM2_CC_HierarchyControl command with TPM2_ST_SESSIONS tag, most probably steming from tpm_set_failure/tpm20_hierarchycontrol SeaBIOS call path. This causes an assert() in the qtest tpm emulation code.
As the goal here is not to boot SeaBIOS completely but just let it grab the ACPI tables and consolidate them, let's just remove the assert().
Message-Id: <[email protected]>
--- tests/qtest/tpm-emu.c | 1 - 1 file changed, 1 deletion(-)
tests/qtest/tpm-emu.c +0 -1
@@ -49,7 +49,6 @@ static void *tpm_emu_tpm_thread(void *data) s->tpm_msg->tag =be16_to_cpu (s->tpm_msg->tag); s->tpm_msg->len =be32_to_cpu (s->tpm_msg->len); g_assert_cmpint(s->tpm_msg->len, >=, minhlen); - g_assert_cmpint(s->tpm_msg->tag, ==, TPM2_ST_NO_SESSIONS); s->tpm_msg =g_realloc (s->tpm_msg, s->tpm_msg->len); qio_channel_read(ioc, (char *)&s->tpm_msg->code,
Signature · 1 line
MST
[PULL 17/56] test/tpm-emu: include sockets and channel headers in tpm-emu header
In reply to Michael S. TsirkinFrom: Eric Auger <[email protected]>
Include sockets and channel headers to that the header is self-contained.
Message-Id: <[email protected]>
--- tests/qtest/tpm-emu.h | 3 +++ 1 file changed, 3 insertions(+)
tests/qtest/tpm-emu.h +3 -0
@@ -16,6 +16,9 @@#define TPM_RC_FAILURE 0x101#define TPM2_ST_NO_SESSIONS 0x8001 +#include "qemu/sockets.h" +#include "io/channel.h" +struct tpm_hdr {uint16_t tag;uint32_t len;
Signature · 1 line
MST
[PULL 45/56] Lift max ram slots limit in libvhost-user
In reply to Michael S. TsirkinFrom: Raphael Norwitz <[email protected]>
Historically, VMs with vhost-user devices could hot-add memory a maximum of 8 times. Now that the VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS protocol feature has been added, VMs with vhost-user backends which support this new feature can support a configurable number of ram slots up to the maximum supported by the target platform.
This change adds VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS support for backends built with libvhost-user, and increases the number of supported ram slots from 8 to 32.
Memory hot-add, hot-remove and postcopy migration were tested with the vhost-user-bridge sample.
Message-Id: <[email protected]>
--- contrib/libvhost-user/libvhost-user.h | 15 +++++++++++---- contrib/libvhost-user/libvhost-user.c | 17 +++++++++-------- 2 files changed, 20 insertions(+), 12 deletions(-)
contrib/libvhost-user/libvhost-user.h +11 -4
@@ -28,7 +28,13 @@#define VIRTQUEUE_MAX_SIZE 1024 -#define VHOST_MEMORY_MAX_NREGIONS 8 +#define VHOST_MEMORY_BASELINE_NREGIONS 8 + +/* +* Set a reasonable maximum number of ram slots, which will be supported by +* any architecture. +*/ +#define VHOST_USER_MAX_RAM_SLOTS 32 typedef enum VhostSetConfigType { VHOST_SET_CONFIG_TYPE_MASTER = 0,
@@ -55,6 +61,7 @@ enum VhostUserProtocolFeature {VHOST_USER_PROTOCOL_F_HOST_NOTIFIER =11 ,VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD =12 ,VHOST_USER_PROTOCOL_F_INBAND_NOTIFICATIONS =14 , +VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS =15 , VHOST_USER_PROTOCOL_F_MAX };
@@ -123,7 +130,7 @@ typedef struct VhostUserMemoryRegion {typedef struct VhostUserMemory {uint32_t nregions;uint32_t padding; -VhostUserMemoryRegion regions[VHOST_MEMORY_MAX_NREGIONS ]; +VhostUserMemoryRegion regions[VHOST_MEMORY_BASELINE_NREGIONS ]; }VhostUserMemory ; typedef struct VhostUserMemRegMsg {
@@ -190,7 +197,7 @@ typedef struct VhostUserMsg {VhostUserInflight inflight; } payload; -int fds[VHOST_MEMORY_MAX_NREGIONS ]; +int fds[VHOST_MEMORY_BASELINE_NREGIONS ];int fd_num;uint8_t *data; }VU_PACKED VhostUserMsg;
@@ -368,7 +375,7 @@ typedef struct VuDevInflightInfo {struct VuDev {int sock;uint32_t nregions; -VuDevRegion regions[VHOST_MEMORY_MAX_NREGIONS ]; +VuDevRegion regions[VHOST_USER_MAX_RAM_SLOTS ];VuVirtq *vq;VuDevInflightInfo inflight_info;int log_call_fd;
contrib/libvhost-user/libvhost-user.c +9 -8
@@ -269,7 +269,7 @@ have_userfault(void)static bool vu_message_read (VuDev *dev,int conn_fd,VhostUserMsg *vmsg) { -char control[CMSG_SPACE (VHOST_MEMORY_MAX_NREGIONS *sizeof (int ))] = { }; +char control[CMSG_SPACE (VHOST_MEMORY_BASELINE_NREGIONS *sizeof (int ))] = {};struct iovec iov = { .iov_base = (char *)vmsg, .iov_len =VHOST_USER_HDR_SIZE ,
@@ -340,7 +340,7 @@ vu_message_write(VuDev *dev, int conn_fd, VhostUserMsg *vmsg) {int rc;uint8_t *p = (uint8_t *)vmsg; -char control[CMSG_SPACE (VHOST_MEMORY_MAX_NREGIONS *sizeof (int ))] = { }; +char control[CMSG_SPACE (VHOST_MEMORY_BASELINE_NREGIONS *sizeof (int ))] = {};struct iovec iov = { .iov_base = (char *)vmsg, .iov_len =VHOST_USER_HDR_SIZE ,
@@ -353,7 +353,7 @@ vu_message_write(VuDev *dev, int conn_fd, VhostUserMsg *vmsg)struct cmsghdr *cmsg;memset (control,0 ,sizeof (control)); -assert (vmsg->fd_num <=VHOST_MEMORY_MAX_NREGIONS ); +assert (vmsg->fd_num <=VHOST_MEMORY_BASELINE_NREGIONS );if (vmsg->fd_num >0 ) {size_t fdsize = vmsg->fd_num *sizeof (int ); msg.msg_controllen =CMSG_SPACE (fdsize);
@@ -780,7 +780,7 @@ static bool vu_rem_mem_reg(VuDev *dev, VhostUserMsg *vmsg) {int i, j;bool found = false; -VuDevRegion shadow_regions[VHOST_MEMORY_MAX_NREGIONS ] = {}; +VuDevRegion shadow_regions[VHOST_USER_MAX_RAM_SLOTS ] = {};VhostUserMemoryRegion m = vmsg->payload.memreg.region, *msg_region = &m;DPRINT ("Removing region:\n" );
@@ -813,7 +813,7 @@ vu_rem_mem_reg(VuDev *dev, VhostUserMsg *vmsg) {if (found) {memcpy (dev->regions, shadow_regions, -sizeof (VuDevRegion) *VHOST_MEMORY_MAX_NREGIONS ); +sizeof (VuDevRegion) *VHOST_USER_MAX_RAM_SLOTS );DPRINT ("Successfully removed a region\n" ); dev->nregions--;vmsg_set_reply_u64 (vmsg,0 );
@@ -1394,7 +1394,8 @@ vu_get_protocol_features_exec(VuDev *dev, VhostUserMsg *vmsg)1ULL <<VHOST_USER_PROTOCOL_F_SLAVE_REQ |1ULL <<VHOST_USER_PROTOCOL_F_HOST_NOTIFIER |1ULL <<VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD | -1ULL <<VHOST_USER_PROTOCOL_F_REPLY_ACK ; +1ULL <<VHOST_USER_PROTOCOL_F_REPLY_ACK | +1ULL <<VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS ;if (have_userfault ()) { features |=1ULL <<VHOST_USER_PROTOCOL_F_PAGEFAULT ;
@@ -1732,14 +1733,14 @@ static bool vu_handle_get_max_memslots(VuDev *dev, VhostUserMsg *vmsg) { vmsg->flags =VHOST_USER_REPLY_MASK |VHOST_USER_VERSION ; vmsg->size =sizeof (vmsg->payload.u64); - vmsg->payload.u64 =VHOST_MEMORY_MAX_NREGIONS ; + vmsg->payload.u64 =VHOST_USER_MAX_RAM_SLOTS ; vmsg->fd_num =0 ;if (!vu_message_write (dev, dev->sock, vmsg)) {vu_panic (dev,"Failed to send max ram slots: %s\n" ,strerror (errno)); } -DPRINT ("u64: 0x%016" PRIx64"\n" , (uint64_t )VHOST_MEMORY_MAX_NREGIONS ); +DPRINT ("u64: 0x%016" PRIx64"\n" , (uint64_t )VHOST_USER_MAX_RAM_SLOTS );return false; }
Signature · 1 line
MST
[PULL 31/56] hw/pci/pci_bridge: Correct pci_bridge_io memory region size
In reply to Michael S. TsirkinFrom: Philippe Mathieu-Daudé <[email protected]>
memory_region_set_size() handle the 16 Exabytes limit by special-casing the UINT64_MAX value. This is not a problem for the 32-bit maximum, 4 GiB.
By using the UINT32_MAX value, the pci_bridge_io MemoryRegion ends up missing 1 byte:
(qemu) info mtree
memory-region: pci_bridge_io
0000000000000000-00000000fffffffe (prio 0, i/o): pci_bridge_io
0000000000000060-0000000000000060 (prio 0, i/o): i8042-data
0000000000000064-0000000000000064 (prio 0, i/o): i8042-cmd
00000000000001ce-00000000000001d1 (prio 0, i/o): vbe
0000000000000378-000000000000037f (prio 0, i/o): parallel
00000000000003b4-00000000000003b5 (prio 0, i/o): vga
...Fix by using the correct value. We now have:
memory-region: pci_bridge_io
0000000000000000-00000000ffffffff (prio 0, i/o): pci_bridge_io
0000000000000060-0000000000000060 (prio 0, i/o): i8042-data
0000000000000064-0000000000000064 (prio 0, i/o): i8042-cmd
...Message-Id: <[email protected]>
--- hw/pci/pci_bridge.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
hw/pci/pci_bridge.c +2 -1
@@ -30,6 +30,7 @@*/ #include "qemu/osdep.h" +#include "qemu/units.h" #include "hw/pci/pci_bridge.h" #include "hw/pci/pci_bus.h" #include "qemu/module.h"
@@ -381,7 +382,7 @@ void pci_bridge_initfn(PCIDevice *dev, const char *typename)memory_region_init (&br->address_space_mem,OBJECT (br),"pci_bridge_pci" ,UINT64_MAX ); sec_bus->address_space_io = &br->address_space_io;memory_region_init (&br->address_space_io,OBJECT (br),"pci_bridge_io" , -UINT32_MAX ); +4 * GiB); br->windows =pci_bridge_region_init (br);QLIST_INIT (&sec_bus->child);QLIST_INSERT_HEAD (&parent->child, sec_bus, sibling);
Signature · 1 line
MST
[PULL 22/56] virtio-balloon: fix free page hinting without an iothread
In reply to Michael S. TsirkinFrom: David Hildenbrand <[email protected]>
In case we don't have an iothread, we mark the feature as abscent but still add the queue. 'free_page_bh' remains set to NULL.
qemu-system-i386 \
-M microvm \
-nographic \
-device virtio-balloon-device,free-page-hint=true \
-nographic \
-display none \
-monitor none \
-serial none \
-qtest stdioDoing a "write 0xc0000e30 0x24 0x030000000300000003000000030000000300000003000000030000000300000003000000"
We will trigger a SEGFAULT. Let's move the check and bail out.
While at it, move the static initializations to instance_init(). free_page_report_status and block_iothread are implicitly set to the right values (0/false) already, so drop the initialization.
Message-Id: <[email protected]>
--- hw/virtio/virtio-balloon.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-)
hw/virtio/virtio-balloon.c +16 -17
@@ -789,6 +789,13 @@ static void virtio_balloon_device_realize(DeviceState *dev, Error **errp)return ; } +if (virtio_has_feature (s->host_features,VIRTIO_BALLOON_F_FREE_PAGE_HINT ) && + !s->iothread) { +error_setg (errp,"'free-page-hint' requires 'iothread' to be set" ); +virtio_cleanup (vdev); +return ; + } + s->ivq =virtio_add_queue (vdev,128 , virtio_balloon_handle_output); s->dvq =virtio_add_queue (vdev,128 , virtio_balloon_handle_output); s->svq =virtio_add_queue (vdev,128 , virtio_balloon_receive_stats);
@@ -797,24 +804,11 @@ static void virtio_balloon_device_realize(DeviceState *dev, Error **errp) VIRTIO_BALLOON_F_FREE_PAGE_HINT)) { s->free_page_vq =virtio_add_queue (vdev,VIRTQUEUE_MAX_SIZE , virtio_balloon_handle_free_page_vq); - s->free_page_report_status =FREE_PAGE_REPORT_S_STOP ; - s->free_page_report_cmd_id = -VIRTIO_BALLOON_FREE_PAGE_REPORT_CMD_ID_MIN ; - s->free_page_report_notify.notify = - virtio_balloon_free_page_report_notify;precopy_add_notifier (&s->free_page_report_notify); -if (s->iothread) { -object_ref (OBJECT (s->iothread)); - s->free_page_bh =aio_bh_new (iothread_get_aio_context (s->iothread), - virtio_ballloon_get_free_page_hints, s); -qemu_mutex_init (&s->free_page_lock); -qemu_cond_init (&s->free_page_cond); - s->block_iothread = false; - }else { -/* Simply disable this feature if the iothread wasn't created. */ - s->host_features &= ~(1 <<VIRTIO_BALLOON_F_FREE_PAGE_HINT ); -virtio_error (vdev,"iothread is missing" ); - } + +object_ref (OBJECT (s->iothread)); + s->free_page_bh =aio_bh_new (iothread_get_aio_context (s->iothread), + virtio_ballloon_get_free_page_hints, s); }reset_stats (s); }
@@ -892,6 +886,11 @@ static void virtio_balloon_instance_init(Object *obj) {VirtIOBalloon *s =VIRTIO_BALLOON (obj); +qemu_mutex_init (&s->free_page_lock); +qemu_cond_init (&s->free_page_cond); + s->free_page_report_cmd_id =VIRTIO_BALLOON_FREE_PAGE_REPORT_CMD_ID_MIN ; + s->free_page_report_notify.notify = virtio_balloon_free_page_report_notify; +object_property_add (obj,"guest-stats" ,"guest statistics" , balloon_stats_get_all,NULL ,NULL , s);
Signature · 1 line
MST
[PULL 25/56] virtio-balloon: Implement support for page poison reporting feature
In reply to Michael S. TsirkinFrom: Alexander Duyck <[email protected]>
We need to make certain to advertise support for page poison reporting if we want to actually get data on if the guest will be poisoning pages.
Add a value for reporting the poison value being used if page poisoning is enabled in the guest. With this we can determine if we will need to skip free page reporting when it is enabled in the future.
The value currently has no impact on existing balloon interfaces. In the case of existing balloon interfaces the onus is on the guest driver to reapply whatever poison is in place.
When we add free page reporting the poison value is used to determine if we can perform in-place page reporting. The expectation is that a reported page will already contain the value specified by the poison, and the reporting of the page should not change that value.
Message-Id: <[email protected]>
--- include/hw/virtio/virtio-balloon.h | 1 + hw/core/machine.c | 4 +++- hw/virtio/virtio-balloon.c | 29 +++++++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-)
include/hw/virtio/virtio-balloon.h +1 -0
@@ -70,6 +70,7 @@ typedef struct VirtIOBalloon {uint32_t host_features;bool qemu_4_0_config_size; + uint32_t poison_val; } VirtIOBalloon;#endif
hw/core/machine.c +3 -1
@@ -28,7 +28,9 @@#include "hw/mem/nvdimm.h" #include "migration/vmstate.h" -GlobalProperty hw_compat_5_0[] = {}; +GlobalProperty hw_compat_5_0[] = { + {"virtio-balloon-device" ,"page-poison" ,"false" }, +};const size_t hw_compat_5_0_len =G_N_ELEMENTS (hw_compat_5_0);GlobalProperty hw_compat_4_2[] = {
hw/virtio/virtio-balloon.c +29 -0
@@ -634,6 +634,7 @@ static void virtio_balloon_get_config(VirtIODevice *vdev, uint8_t *config_data) config.num_pages =cpu_to_le32 (dev->num_pages); config.actual =cpu_to_le32 (dev->actual); + config.poison_val =cpu_to_le32 (dev->poison_val);if (dev->free_page_report_status ==FREE_PAGE_REPORT_S_REQUESTED ) { config.free_page_report_cmd_id =
@@ -683,6 +684,14 @@ static ram_addr_t get_current_ram_size(void)return size; } +static bool virtio_balloon_page_poison_support (void *opaque) +{ +VirtIOBalloon *s = opaque; +VirtIODevice *vdev =VIRTIO_DEVICE (s); + +return virtio_vdev_has_feature (vdev,VIRTIO_BALLOON_F_PAGE_POISON ); +} +static void virtio_balloon_set_config (VirtIODevice *vdev,const uint8_t *config_data) {
@@ -697,6 +706,10 @@ static void virtio_balloon_set_config(VirtIODevice *vdev,qapi_event_send_balloon_change (vm_ram_size - ((ram_addr_t ) dev->actual <<VIRTIO_BALLOON_PFN_SHIFT )); } + dev->poison_val =0 ; +if (virtio_balloon_page_poison_support (dev)) { + dev->poison_val =le32_to_cpu (config.poison_val); + }trace_virtio_balloon_set_config (dev->actual, oldactual); }
@@ -755,6 +768,17 @@ static const VMStateDescription vmstate_virtio_balloon_free_page_report = { } }; +static const VMStateDescription vmstate_virtio_balloon_page_poison = { + .name ="vitio-balloon-device/page-poison" , + .version_id =1 , + .minimum_version_id =1 , + .needed = virtio_balloon_page_poison_support, + .fields = (VMStateField []) { +VMSTATE_UINT32 (poison_val, VirtIOBalloon), +VMSTATE_END_OF_LIST () + } +}; +static const VMStateDescription vmstate_virtio_balloon_device = { .name ="virtio-balloon-device" , .version_id =1 ,
@@ -767,6 +791,7 @@ static const VMStateDescription vmstate_virtio_balloon_device = { }, .subsections = (const VMStateDescription * []) { &vmstate_virtio_balloon_free_page_report, + &vmstate_virtio_balloon_page_poison,NULL } };
@@ -849,6 +874,8 @@ static void virtio_balloon_device_reset(VirtIODevice *vdev)g_free (s->stats_vq_elem); s->stats_vq_elem =NULL ; } + + s->poison_val =0 ; }static void virtio_balloon_set_status (VirtIODevice *vdev,uint8_t status)
@@ -916,6 +943,8 @@ static Property virtio_balloon_properties[] = { VIRTIO_BALLOON_F_DEFLATE_ON_OOM, false),DEFINE_PROP_BIT ("free-page-hint" , VirtIOBalloon, host_features,VIRTIO_BALLOON_F_FREE_PAGE_HINT , false), +DEFINE_PROP_BIT ("page-poison" , VirtIOBalloon, host_features, + VIRTIO_BALLOON_F_PAGE_POISON, true),/* QEMU 4.0 accidentally changed the config size even when free-page-hint * is disabled, resulting in QEMU 3.1 migration incompatibility. This * property retains this quirk for QEMU 4.1 machine types.
Signature · 1 line
MST
[PULL 50/56] virtio: add vhost-user-vsock-pci device
In reply to Michael S. TsirkinFrom: Stefano Garzarella <[email protected]>
Add the PCI version of vhost-user-vsock
Launch QEMU like this:
qemu -chardev socket,path=/tmp/vm.vsock,id=chr0 \
-device vhost-user-vsock-pci,chardev=chr0Message-Id: <[email protected]>
--- hw/virtio/vhost-user-vsock-pci.c | 84 ++++++++++++++++++++++++++++++++ hw/virtio/Makefile.objs | 1 + 2 files changed, 85 insertions(+) create mode 100644 hw/virtio/vhost-user-vsock-pci.c
hw/virtio/vhost-user-vsock-pci.c new file +84 -0
@@ -0,0 +1,84 @@ +/* +* Vhost-user vsock PCI Bindings +* +* Copyright 2020 Red Hat, Inc. +* +* This work is licensed under the terms of the GNU GPL, version 2 or +* (at your option) any later version. See the COPYING file in the +* top-level directory. +*/ + +#include "qemu/osdep.h" + +#include "virtio-pci.h" +#include "hw/qdev-properties.h" +#include "hw/virtio/vhost-user-vsock.h" + +typedef struct VHostUserVSockPCI VHostUserVSockPCI ; + +/* +* vhost-user-vsock-pci: This extends VirtioPCIProxy. +*/ +#define TYPE_VHOST_USER_VSOCK_PCI "vhost-user-vsock-pci-base" +#define VHOST_USER_VSOCK_PCI (obj) \ + OBJECT_CHECK(VHostUserVSockPCI, (obj), TYPE_VHOST_USER_VSOCK_PCI) + +struct VHostUserVSockPCI { +VirtIOPCIProxy parent_obj; +VHostUserVSock vdev; +}; + +/* vhost-user-vsock-pci */ + +static Property vhost_user_vsock_pci_properties[] = { +DEFINE_PROP_UINT32 ("vectors" , VirtIOPCIProxy, nvectors,3 ), +DEFINE_PROP_END_OF_LIST (), +}; + +static void vhost_user_vsock_pci_realize (VirtIOPCIProxy *vpci_dev,Error **errp) +{ +VHostUserVSockPCI *dev =VHOST_USER_VSOCK_PCI (vpci_dev); +DeviceState *vdev =DEVICE (&dev->vdev); + +qdev_set_parent_bus (vdev,BUS (&vpci_dev->bus)); +object_property_set_bool (OBJECT (vdev), true,"realized" , errp); +} + +static void vhost_user_vsock_pci_class_init (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); +VirtioPCIClass *k =VIRTIO_PCI_CLASS (klass); +PCIDeviceClass *pcidev_k =PCI_DEVICE_CLASS (klass); + k->realize = vhost_user_vsock_pci_realize; +set_bit (DEVICE_CATEGORY_MISC , dc->categories); +device_class_set_props (dc, vhost_user_vsock_pci_properties); + pcidev_k->vendor_id =PCI_VENDOR_ID_REDHAT_QUMRANET ; + pcidev_k->device_id =PCI_DEVICE_ID_VIRTIO_VSOCK ; + pcidev_k->revision =0x00 ; + pcidev_k->class_id =PCI_CLASS_COMMUNICATION_OTHER ; +} + +static void vhost_user_vsock_pci_instance_init (Object *obj) +{ +VHostUserVSockPCI *dev =VHOST_USER_VSOCK_PCI (obj); + +virtio_instance_init_common (obj, &dev->vdev,sizeof (dev->vdev), +TYPE_VHOST_USER_VSOCK ); +} + +static const VirtioPCIDeviceTypeInfo vhost_user_vsock_pci_info = { + .base_name =TYPE_VHOST_USER_VSOCK_PCI , + .generic_name ="vhost-user-vsock-pci" , + .transitional_name ="vhost-user-vsock-pci-transitional" , + .non_transitional_name ="vhost-user-vsock-pci-non-transitional" , + .instance_size =sizeof (VHostUserVSockPCI), + .instance_init = vhost_user_vsock_pci_instance_init, + .class_init = vhost_user_vsock_pci_class_init, +}; + +static void virtio_pci_vhost_register (void ) +{ +virtio_pci_types_register (&vhost_user_vsock_pci_info); +} + +type_init (virtio_pci_vhost_register)
hw/virtio/Makefile.objs +1 -0
@@ -22,6 +22,7 @@ obj-$(CONFIG_VHOST_USER_VSOCK) += vhost-vsock-common.o vhost-user-vsock.o ifeq ($(CONFIG_VIRTIO_PCI),y) obj-$(CONFIG_VHOST_VSOCK) += vhost-vsock-pci.o +obj-$(CONFIG_VHOST_USER_VSOCK) += vhost-user-vsock-pci.o obj-$(CONFIG_VHOST_USER_BLK) += vhost-user-blk-pci.o obj-$(CONFIG_VHOST_USER_INPUT) += vhost-user-input-pci.o obj-$(CONFIG_VHOST_USER_SCSI) += vhost-user-scsi-pci.o
Signature · 1 line
MST
[PULL 36/56] Add helper to populate vhost-user message regions
In reply to Michael S. TsirkinFrom: Raphael Norwitz <[email protected]>
When setting vhost-user memory tables, memory region descriptors must be copied from the vhost_dev struct to the vhost-user message. To avoid duplicating code in setting the memory tables, we should use a helper to populate this field. This change adds this helper.
Message-Id: <[email protected]>
--- hw/virtio/vhost-user.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
hw/virtio/vhost-user.c +12 -6
@@ -407,6 +407,15 @@ static int vhost_user_set_log_base(struct vhost_dev *dev, uint64_t base,return 0 ; } +static void vhost_user_fill_msg_region (VhostUserMemoryRegion *dst, +struct vhost_memory_region *src) +{ +assert (src !=NULL && dst !=NULL ); + dst->userspace_addr = src->userspace_addr; + dst->memory_size = src->memory_size; + dst->guest_phys_addr = src->guest_phys_addr; +} + static int vhost_user_fill_set_mem_table_msg(struct vhost_user *u, struct vhost_dev *dev, VhostUserMsg *msg,
@@ -417,6 +426,7 @@ static int vhost_user_fill_set_mem_table_msg(struct vhost_user *u,ram_addr_t offset;MemoryRegion *mr;struct vhost_memory_region *reg; +VhostUserMemoryRegion region_buffer; msg->hdr.request =VHOST_USER_SET_MEM_TABLE ;
@@ -441,12 +451,8 @@ static int vhost_user_fill_set_mem_table_msg(struct vhost_user *u,error_report ("Failed preparing vhost-user memory table msg" );return -1 ; } - msg->payload.memory.regions[*fd_num].userspace_addr = - reg->userspace_addr; - msg->payload.memory.regions[*fd_num].memory_size = - reg->memory_size; - msg->payload.memory.regions[*fd_num].guest_phys_addr = - reg->guest_phys_addr; +vhost_user_fill_msg_region (®ion_buffer, reg); + msg->payload.memory.regions[*fd_num] = region_buffer; msg->payload.memory.regions[*fd_num].mmap_offset = offset; fds[(*fd_num)++] = fd; }else if (track_ramblocks) {
Signature · 1 line
MST
[PULL 21/56] bios-tables-test: Generate reference tables for Q35/TPM-TIS
In reply to Michael S. TsirkinFrom: Eric Auger <[email protected]>
TPM2, DSDT tables were generated usingtests/data/acpi/rebuild-expected-aml.sh
Message-Id: <[email protected]>
--- tests/qtest/bios-tables-test-allowed-diff.h | 2 -- tests/data/acpi/q35/DSDT.tis | Bin 0 -> 8357 bytes tests/data/acpi/q35/TPM2.tis | Bin 0 -> 76 bytes 3 files changed, 2 deletions(-)
tests/qtest/bios-tables-test-allowed-diff.h +0 -2
@@ -1,3 +1 @@/* List of comma-separated changed AML files to ignore */ -"tests/data/acpi/q35/DSDT.tis" , -"tests/data/acpi/q35/TPM2.tis",
tests/data/acpi/q35/DSDT.tis binary +0 -0
tests/data/acpi/q35/TPM2.tis binary +0 -0
Signature · 1 line
MST
[PULL 27/56] MAINTAINERS: Fix the classification of bios-tables-test-allowed-diff.h
In reply to Michael S. TsirkinFrom: Thomas Huth <[email protected]>
The file tests/qtest/bios-tables-test-allowed-diff.h is currently only assigned to the qtest section according MAINTAINERS. However, this file normally only gets updated when the ACPI tables changed - something the qtest maintainers don't have much clue of. Thus this file should rather be assigned to the ACPI maintainers instead.
Message-Id: <[email protected]>
--- MAINTAINERS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
MAINTAINERS +2 -1
@@ -1531,7 +1531,7 @@ F: hw/acpi/* F: hw/smbios/* F: hw/i386/acpi-build.[hc] F: hw/arm/virt-acpi-build.c -F: tests/qtest/bios-tables-test.c +F: tests/qtest/bios-tables-test* F: tests/qtest/acpi-utils.[hc] F: tests/data/acpi/
@@ -2321,6 +2321,7 @@ S: Maintained F: qtest.c F: accel/qtest.c F: tests/qtest/ +X: tests/qtest/bios-tables-test-allowed-diff.h Device Fuzzing M: Alexander Bulekov <[email protected]>
Signature · 1 line
MST
[PULL 11/56] acpi: move aml builder code for parallel device
In reply to Michael S. TsirkinFrom: Gerd Hoffmann <[email protected]>
Also adds support for multiple LPT devices.
Message-Id: <[email protected]>
--- hw/char/parallel.c | 22 ++++++++++++++++++++++ hw/i386/acpi-build.c | 23 ----------------------- 2 files changed, 22 insertions(+), 23 deletions(-)
hw/char/parallel.c +22 -0
@@ -28,6 +28,7 @@#include "qemu/module.h" #include "chardev/char-parallel.h" #include "chardev/char-fe.h" +#include "hw/acpi/aml-build.h" #include "hw/irq.h" #include "hw/isa/isa.h" #include "hw/qdev-properties.h"
@@ -568,6 +569,25 @@ static void parallel_isa_realizefn(DeviceState *dev, Error **errp) s, "parallel"); } +static void parallel_isa_build_aml (ISADevice *isadev,Aml *scope) +{ +ISAParallelState *isa =ISA_PARALLEL (isadev); +Aml *dev; +Aml *crs; + + crs =aml_resource_template (); +aml_append (crs,aml_io (AML_DECODE16 , isa->iobase, isa->iobase,0x08 ,0x08 )); +aml_append (crs,aml_irq_no_flags (isa->isairq)); + + dev =aml_device ("LPT%d" , isa->index +1 ); +aml_append (dev,aml_name_decl ("_HID" ,aml_eisaid ("PNP0400" ))); +aml_append (dev,aml_name_decl ("_UID" ,aml_int (isa->index +1 ))); +aml_append (dev,aml_name_decl ("_STA" ,aml_int (0xf ))); +aml_append (dev,aml_name_decl ("_CRS" , crs)); + +aml_append (scope, dev); +} +/* Memory mapped interface */ static uint64_t parallel_mm_readfn (void *opaque,hwaddr addr,unsigned size) {
@@ -624,9 +644,11 @@ static Property parallel_isa_properties[] = {static void parallel_isa_class_initfn (ObjectClass *klass,void *data) {DeviceClass *dc =DEVICE_CLASS (klass); +ISADeviceClass *isa =ISA_DEVICE_CLASS (klass); dc->realize = parallel_isa_realizefn; dc->vmsd = &vmstate_parallel_isa; + isa->build_aml = parallel_isa_build_aml;device_class_set_props (dc, parallel_isa_properties);set_bit (DEVICE_CATEGORY_INPUT , dc->categories); }
hw/i386/acpi-build.c +0 -23
@@ -1173,28 +1173,6 @@ static Aml *build_mouse_device_aml(void)return dev; } -static void build_lpt_device_aml (Aml *scope) -{ -Aml *dev; -Aml *crs; - -if (!memory_region_present (get_system_io (),0x0378 )) { -return ; - } - - dev =aml_device ("LPT" ); -aml_append (dev,aml_name_decl ("_HID" ,aml_eisaid ("PNP0400" ))); - -aml_append (dev,aml_name_decl ("_STA" ,aml_int (0xf ))); - - crs =aml_resource_template (); -aml_append (crs,aml_io (AML_DECODE16 ,0x0378 ,0x0378 ,0x08 ,0x08 )); -aml_append (crs,aml_irq_no_flags (7 )); -aml_append (dev,aml_name_decl ("_CRS" , crs)); - -aml_append (scope, dev); -} -static void build_isa_devices_aml (Aml *table) {ISADevice *fdc =pc_find_fdc0 ();
@@ -1208,7 +1186,6 @@ static void build_isa_devices_aml(Aml *table)if (fdc) {aml_append (scope,build_fdc_device_aml (fdc)); } -build_lpt_device_aml (scope);if (ambiguous) {error_report ("Multiple ISA busses, unable to define IPMI ACPI data" );
Signature · 1 line
MST
[PULL 42/56] Support ram slot configuration in libvhost-user
In reply to Michael S. TsirkinFrom: Raphael Norwitz <[email protected]>
The VHOST_USER_GET_MAX_MEM_SLOTS message allows a vhost-user backend to specify a maximum number of ram slots it is willing to support. This change adds support for libvhost-user to process this message. For now the backend will reply with 8 as the maximum number of regions supported.
libvhost-user does not yet support the vhost-user protocol feature VHOST_USER_PROTOCOL_F_CONFIGIRE_MEM_SLOTS, so qemu should never send the VHOST_USER_GET_MAX_MEM_SLOTS message. Therefore this new functionality is not currently used.
Message-Id: <[email protected]>
--- contrib/libvhost-user/libvhost-user.h | 1 + contrib/libvhost-user/libvhost-user.c | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+)
contrib/libvhost-user/libvhost-user.h +1 -0
@@ -97,6 +97,7 @@ typedef enum VhostUserRequest {VHOST_USER_SET_INFLIGHT_FD =32 ,VHOST_USER_GPU_SET_SOCKET =33 ,VHOST_USER_VRING_KICK =35 , +VHOST_USER_GET_MAX_MEM_SLOTS =36 , VHOST_USER_MAX } VhostUserRequest;
contrib/libvhost-user/libvhost-user.c +19 -0
@@ -137,6 +137,7 @@ vu_request_to_string(unsigned int req)REQ (VHOST_USER_SET_INFLIGHT_FD ),REQ (VHOST_USER_GPU_SET_SOCKET ),REQ (VHOST_USER_VRING_KICK ), +REQ (VHOST_USER_GET_MAX_MEM_SLOTS ), REQ(VHOST_USER_MAX), };#undef REQ
@@ -1565,6 +1566,22 @@ vu_handle_vring_kick(VuDev *dev, VhostUserMsg *vmsg)return false; } +static bool vu_handle_get_max_memslots (VuDev *dev,VhostUserMsg *vmsg) +{ + vmsg->flags =VHOST_USER_REPLY_MASK |VHOST_USER_VERSION ; + vmsg->size =sizeof (vmsg->payload.u64); + vmsg->payload.u64 =VHOST_MEMORY_MAX_NREGIONS ; + vmsg->fd_num =0 ; + +if (!vu_message_write (dev, dev->sock, vmsg)) { +vu_panic (dev,"Failed to send max ram slots: %s\n" ,strerror (errno)); + } + +DPRINT ("u64: 0x%016" PRIx64"\n" , (uint64_t )VHOST_MEMORY_MAX_NREGIONS ); + +return false; +} +static bool vu_process_message (VuDev *dev,VhostUserMsg *vmsg) {
@@ -1649,6 +1666,8 @@ vu_process_message(VuDev *dev, VhostUserMsg *vmsg)return vu_set_inflight_fd (dev, vmsg);case VHOST_USER_VRING_KICK :return vu_handle_vring_kick (dev, vmsg); +case VHOST_USER_GET_MAX_MEM_SLOTS : +return vu_handle_get_max_memslots (dev, vmsg);default :vmsg_close_fds (vmsg);vu_panic (dev,"Unhandled request: %d" , vmsg->request);
Signature · 1 line
MST
[PULL 32/56] hw/pci/pci_bridge: Use the IEC binary prefix definitions
In reply to Michael S. TsirkinFrom: Philippe Mathieu-Daudé <[email protected]>
IEC binary prefixes ease code review: the unit is explicit.
Message-Id: <[email protected]>
--- hw/pci/pci_bridge.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/pci/pci_bridge.c +2 -2
@@ -423,14 +423,14 @@ int pci_bridge_qemu_reserve_cap_init(PCIDevice *dev, int cap_offset, }if (res_reserve.mem_non_pref != (uint64_t )-1 && - res_reserve.mem_non_pref >= (1ULL <<32 )) { + res_reserve.mem_non_pref >=4 * GiB) {error_setg (errp,"PCI resource reserve cap: mem-reserve must be less than 4G" );return -EINVAL ; }if (res_reserve.mem_pref_32 != (uint64_t )-1 && - res_reserve.mem_pref_32 >= (1ULL <<32 )) { + res_reserve.mem_pref_32 >=4 * GiB) {error_setg (errp,"PCI resource reserve cap: pref32-reserve must be less than 4G" );return -EINVAL ;
Signature · 1 line
MST
[PULL 29/56] pci: assert configuration access is within bounds
In reply to Michael S. TsirkinFrom: Prasad J Pandit <[email protected]>
While accessing PCI configuration bytes, assert that 'address + len' is within PCI configuration space.
Generally it is within bounds. This is more of a defensive assert, in case a buggy device was to send 'address' which may go out of bounds.
Message-Id: <[email protected]>
--- hw/pci/pci.c | 4 ++++ 1 file changed, 4 insertions(+)
hw/pci/pci.c +4 -0
@@ -1381,6 +1381,8 @@ uint32_t pci_default_read_config(PCIDevice *d, {uint32_t val =0 ; +assert (address + len <=pci_config_size (d)); +if (pci_is_express_downstream_port (d) &&ranges_overlap (address, len, d->exp.exp_cap +PCI_EXP_LNKSTA ,2 )) {pcie_sync_bridge_lnk (d);
@@ -1394,6 +1396,8 @@ void pci_default_write_config(PCIDevice *d, uint32_t addr, uint32_t val_in, intint i, was_irq_disabled =pci_irq_disabled (d);uint32_t val = val_in; +assert (addr + l <=pci_config_size (d)); +for (i =0 ; i < l; val >>=8 , ++i) {uint8_t wmask = d->wmask[addr + i];uint8_t w1cmask = d->w1cmask[addr + i];
Signature · 1 line
MST
[PULL 05/56] qtest: allow DSDT acpi table changes
In reply to Michael S. TsirkinFrom: Gerd Hoffmann <[email protected]>
Message-Id: <[email protected]>
--- tests/qtest/bios-tables-test-allowed-diff.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
tests/qtest/bios-tables-test-allowed-diff.h +17 -0
@@ -1 +1,18 @@/* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/pc/DSDT" , +"tests/data/acpi/pc/DSDT.acpihmat" , +"tests/data/acpi/pc/DSDT.bridge" , +"tests/data/acpi/pc/DSDT.cphp" , +"tests/data/acpi/pc/DSDT.dimmpxm" , +"tests/data/acpi/pc/DSDT.ipmikcs" , +"tests/data/acpi/pc/DSDT.memhp" , +"tests/data/acpi/pc/DSDT.numamem" , +"tests/data/acpi/q35/DSDT" , +"tests/data/acpi/q35/DSDT.acpihmat" , +"tests/data/acpi/q35/DSDT.bridge" , +"tests/data/acpi/q35/DSDT.cphp" , +"tests/data/acpi/q35/DSDT.dimmpxm" , +"tests/data/acpi/q35/DSDT.ipmibt" , +"tests/data/acpi/q35/DSDT.memhp" , +"tests/data/acpi/q35/DSDT.mmio64" , +"tests/data/acpi/q35/DSDT.numamem",
Signature · 1 line
MST
[PULL 33/56] hw/pci-host: Use the IEC binary prefix definitions
In reply to Michael S. TsirkinFrom: Philippe Mathieu-Daudé <[email protected]>
IEC binary prefixes ease code review: the unit is explicit.
Message-Id: <[email protected]>
--- hw/pci-host/i440fx.c | 3 ++- hw/pci-host/q35.c | 2 +- hw/pci-host/versatile.c | 5 +++-- 3 files changed, 6 insertions(+), 4 deletions(-)
hw/pci-host/i440fx.c +2 -1
@@ -23,6 +23,7 @@*/ #include "qemu/osdep.h" +#include "qemu/units.h" #include "qemu/range.h" #include "hw/i386/pc.h" #include "hw/pci/pci.h"
@@ -301,7 +302,7 @@ PCIBus *i440fx_init(const char *host_type, const char *pci_type,memory_region_set_enabled (&f->smram_region, true);/* smram, as seen by SMM CPUs */ -memory_region_init (&f->smram,OBJECT (d),"smram" ,1ull <<32 ); +memory_region_init (&f->smram,OBJECT (d),"smram" ,4 * GiB);memory_region_set_enabled (&f->smram, true);memory_region_init_alias (&f->low_smram,OBJECT (d),"smram-low" , f->ram_memory,0xa0000 ,0x20000 );
hw/pci-host/q35.c +1 -1
@@ -589,7 +589,7 @@ static void mch_realize(PCIDevice *d, Error **errp)memory_region_set_enabled (&mch->open_high_smram, false);/* smram, as seen by SMM CPUs */ -memory_region_init (&mch->smram,OBJECT (mch),"smram" ,1ull <<32 ); +memory_region_init (&mch->smram,OBJECT (mch),"smram" ,4 * GiB);memory_region_set_enabled (&mch->smram, true); memory_region_init_alias(&mch->low_smram, OBJECT(mch), "smram-low", mch->ram_memory, MCH_HOST_BRIDGE_SMRAM_C_BASE,
hw/pci-host/versatile.c +3 -2
@@ -8,6 +8,7 @@*/ #include "qemu/osdep.h" +#include "qemu/units.h" #include "hw/sysbus.h" #include "migration/vmstate.h" #include "hw/irq.h"
@@ -399,8 +400,8 @@ static void pci_vpb_realize(DeviceState *dev, Error **errp)pci_map_irq_fn mapfn;int i; -memory_region_init (&s->pci_io_space,OBJECT (s),"pci_io" ,1ULL <<32 ); -memory_region_init (&s->pci_mem_space,OBJECT (s),"pci_mem" ,1ULL <<32 ); +memory_region_init (&s->pci_io_space,OBJECT (s),"pci_io" ,4 * GiB); +memory_region_init (&s->pci_mem_space,OBJECT (s),"pci_mem" ,4 * GiB); pci_root_bus_new_inplace(&s->pci_bus, sizeof(s->pci_bus), dev, "pci", &s->pci_mem_space, &s->pci_io_space,
Signature · 1 line
MST
[PULL 46/56] libvhost-user: advertise vring features
In reply to Michael S. TsirkinFrom: Stefan Hajnoczi <[email protected]>
libvhost-user implements several vring features without advertising them. There is no way for the vhost-user master to detect support for these features.
Things more or less work today because QEMU assumes the vhost-user backend always implements certain feature bits like VIRTIO_RING_F_EVENT_IDX. This is not documented anywhere.
This patch explicitly advertises features implemented in libvhost-user so that the vhost-user master does not need to make undocumented assumptions.
Feature bits that libvhost-user now advertises can be removed from vhost-user-blk.c. Devices should not be responsible for advertising vring feature bits, that is libvhost-user's job.
Message-Id: <[email protected]>
--- contrib/libvhost-user/libvhost-user.c | 10 ++++++++++ contrib/vhost-user-blk/vhost-user-blk.c | 4 +--- 2 files changed, 11 insertions(+), 3 deletions(-)
contrib/libvhost-user/libvhost-user.c +10 -0
@@ -498,6 +498,16 @@ static bool vu_get_features_exec(VuDev *dev, VhostUserMsg *vmsg) { vmsg->payload.u64 = +/* +* The following VIRTIO feature bits are supported by our virtqueue +* implementation: +*/ +1ULL <<VIRTIO_F_NOTIFY_ON_EMPTY | +1ULL <<VIRTIO_RING_F_INDIRECT_DESC | +1ULL <<VIRTIO_RING_F_EVENT_IDX | +1ULL <<VIRTIO_F_VERSION_1 | + +/* vhost-user feature bits */ 1ULL <<VHOST_F_LOG_ALL |1ULL <<VHOST_USER_F_PROTOCOL_FEATURES ;
contrib/vhost-user-blk/vhost-user-blk.c +1 -3
@@ -382,9 +382,7 @@ vub_get_features(VuDev *dev)1ull <<VIRTIO_BLK_F_DISCARD |1ull <<VIRTIO_BLK_F_WRITE_ZEROES | #endif -1ull <<VIRTIO_BLK_F_CONFIG_WCE | -1ull <<VIRTIO_F_VERSION_1 | -1ull <<VHOST_USER_F_PROTOCOL_FEATURES ; +1ull <<VIRTIO_BLK_F_CONFIG_WCE ;if (vdev_blk->enable_ro) { features |=1ull <<VIRTIO_BLK_F_RO ;
Signature · 1 line
MST
[PULL 40/56] Lift max memory slots limit imposed by vhost-user
In reply to Michael S. TsirkinFrom: Raphael Norwitz <[email protected]>
Historically, sending all memory regions to vhost-user backends in a single message imposed a limitation on the number of times memory could be hot-added to a VM with a vhost-user device. Now that backends which support the VHOST_USER_PROTOCOL_F_CONFIGURE_SLOTS send memory regions individually, we no longer need to impose this limitation on devices which support this feature.
With this change, VMs with a vhost-user device which supports the VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS can support a configurable number of memory slots, up to the maximum allowed by the target platform.
Existing backends which do not support VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS are unaffected.
Message-Id: <[email protected]>
--- hw/virtio/vhost-user.c | 56 ++++++++++++++++++++++++------------- docs/interop/vhost-user.rst | 7 ++--- 2 files changed, 40 insertions(+), 23 deletions(-)
hw/virtio/vhost-user.c +37 -19
@@ -35,10 +35,28 @@#include <linux/userfaultfd.h> #endif -#define VHOST_MEMORY_MAX_NREGIONS 8 +#define VHOST_MEMORY_BASELINE_NREGIONS 8#define VHOST_USER_F_PROTOCOL_FEATURES 30#define VHOST_USER_SLAVE_MAX_FDS 8 +/* +* Set maximum number of RAM slots supported to +* the maximum number supported by the target +* hardware plaform. +*/ +#if defined(TARGET_X86 ) || defined(TARGET_X86_64 ) || \ + defined(TARGET_ARM ) || defined(TARGET_ARM_64 ) +#include "hw/acpi/acpi.h" +#define VHOST_USER_MAX_RAM_SLOTS ACPI_MAX_RAM_SLOTS + +#elif defined(TARGET_PPC ) || defined(TARGET_PPC_64 ) +#include "hw/ppc/spapr.h" +#define VHOST_USER_MAX_RAM_SLOTS SPAPR_MAX_RAM_SLOTS + +#else +#define VHOST_USER_MAX_RAM_SLOTS 512 +#endif +/* * Maximum size of virtio device config space */
@@ -127,7 +145,7 @@ typedef struct VhostUserMemoryRegion {typedef struct VhostUserMemory {uint32_t nregions;uint32_t padding; -VhostUserMemoryRegion regions[VHOST_MEMORY_MAX_NREGIONS ]; +VhostUserMemoryRegion regions[VHOST_MEMORY_BASELINE_NREGIONS ]; }VhostUserMemory ; typedef struct VhostUserMemRegMsg {
@@ -222,7 +240,7 @@ struct vhost_user {int slave_fd;NotifierWithReturn postcopy_notifier;struct PostCopyFD postcopy_fd; -uint64_t postcopy_client_bases[VHOST_MEMORY_MAX_NREGIONS ]; +uint64_t postcopy_client_bases[VHOST_USER_MAX_RAM_SLOTS ];/* Length of the region_rb and region_rb_offset arrays */ size_t region_rb_len;/* RAMBlock associated with a given region */
@@ -237,7 +255,7 @@ struct vhost_user {/* Our current regions */ int num_shadow_regions; -struct vhost_memory_region shadow_regions[VHOST_MEMORY_MAX_NREGIONS ]; +struct vhost_memory_region shadow_regions[VHOST_USER_MAX_RAM_SLOTS ]; };struct scrub_regions {
@@ -392,7 +410,7 @@ int vhost_user_gpu_set_socket(struct vhost_dev *dev, int fd)static int vhost_user_set_log_base (struct vhost_dev *dev,uint64_t base,struct vhost_log *log) { -int fds[VHOST_MEMORY_MAX_NREGIONS ]; +int fds[VHOST_USER_MAX_RAM_SLOTS ];size_t fd_num =0 ;bool shmfd =virtio_has_feature (dev->protocol_features,VHOST_USER_PROTOCOL_F_LOG_SHMFD );
@@ -470,7 +488,7 @@ static int vhost_user_fill_set_mem_table_msg(struct vhost_user *u, mr =vhost_user_get_mr_data (reg->userspace_addr, &offset, &fd);if (fd >0 ) {if (track_ramblocks) { -assert (*fd_num <VHOST_MEMORY_MAX_NREGIONS ); +assert (*fd_num <VHOST_MEMORY_BASELINE_NREGIONS ); trace_vhost_user_set_mem_table_withfd(*fd_num, mr->name, reg->memory_size, reg->guest_phys_addr,
@@ -478,7 +496,7 @@ static int vhost_user_fill_set_mem_table_msg(struct vhost_user *u, offset); u->region_rb_offset[i] = offset; u->region_rb[i] = mr->ram_block; - }else if (*fd_num ==VHOST_MEMORY_MAX_NREGIONS ) { + }else if (*fd_num ==VHOST_MEMORY_BASELINE_NREGIONS ) {error_report ("Failed preparing vhost-user memory table msg" );return -1 ; }
@@ -523,7 +541,7 @@ static void scrub_shadow_regions(struct vhost_dev *dev, bool track_ramblocks) {struct vhost_user *u = dev->opaque; -bool found[VHOST_MEMORY_MAX_NREGIONS ] = {}; +bool found[VHOST_USER_MAX_RAM_SLOTS ] = {};struct vhost_memory_region *reg, *shadow_reg;int i, j, fd, add_idx =0 , rm_idx =0 , fd_num =0 ;ram_addr_t offset;
@@ -777,9 +795,9 @@ static int vhost_user_add_remove_regions(struct vhost_dev *dev, bool track_ramblocks) {struct vhost_user *u = dev->opaque; -struct scrub_regions add_reg[VHOST_MEMORY_MAX_NREGIONS ]; -struct scrub_regions rem_reg[VHOST_MEMORY_MAX_NREGIONS ]; -uint64_t shadow_pcb[VHOST_MEMORY_MAX_NREGIONS ] = {}; +struct scrub_regions add_reg[VHOST_USER_MAX_RAM_SLOTS ]; +struct scrub_regions rem_reg[VHOST_USER_MAX_RAM_SLOTS ]; +uint64_t shadow_pcb[VHOST_USER_MAX_RAM_SLOTS ] = {};int nr_add_reg, nr_rem_reg; msg->hdr.size = sizeof(msg->payload.mem_reg.padding) +
@@ -803,7 +821,7 @@ static int vhost_user_add_remove_regions(struct vhost_dev *dev,if (track_ramblocks) {memcpy (u->postcopy_client_bases, shadow_pcb, -sizeof (uint64_t ) *VHOST_MEMORY_MAX_NREGIONS ); +sizeof (uint64_t ) *VHOST_USER_MAX_RAM_SLOTS );/* * Now we've registered this with the postcopy code, we ack to the * client, because now we're in the position to be able to deal with
@@ -823,7 +841,7 @@ static int vhost_user_add_remove_regions(struct vhost_dev *dev, err:if (track_ramblocks) {memcpy (u->postcopy_client_bases, shadow_pcb, -sizeof (uint64_t ) *VHOST_MEMORY_MAX_NREGIONS ); +sizeof (uint64_t ) *VHOST_USER_MAX_RAM_SLOTS ); }return -1 ;
@@ -835,7 +853,7 @@ static int vhost_user_set_mem_table_postcopy(struct vhost_dev *dev, bool config_mem_slots) {struct vhost_user *u = dev->opaque; -int fds[VHOST_MEMORY_MAX_NREGIONS ]; +int fds[VHOST_MEMORY_BASELINE_NREGIONS ];size_t fd_num =0 ;VhostUserMsg msg_reply;int region_i, msg_i;
@@ -893,7 +911,7 @@ static int vhost_user_set_mem_table_postcopy(struct vhost_dev *dev, }memset (u->postcopy_client_bases,0 , -sizeof (uint64_t ) *VHOST_MEMORY_MAX_NREGIONS ); +sizeof (uint64_t ) *VHOST_USER_MAX_RAM_SLOTS );/* * They're in the same order as the regions that were sent
@@ -942,7 +960,7 @@ static int vhost_user_set_mem_table(struct vhost_dev *dev, struct vhost_memory *mem) {struct vhost_user *u = dev->opaque; -int fds[VHOST_MEMORY_MAX_NREGIONS ]; +int fds[VHOST_MEMORY_BASELINE_NREGIONS ];size_t fd_num =0 ;bool do_postcopy = u->postcopy_listen && u->postcopy_fd.handler; bool reply_supported = virtio_has_feature(dev->protocol_features,
@@ -1149,7 +1167,7 @@ static int vhost_set_vring_file(struct vhost_dev *dev,VhostUserRequest request, struct vhost_vring_file *file) { - int fds[VHOST_MEMORY_MAX_NREGIONS]; + int fds[VHOST_USER_MAX_RAM_SLOTS];size_t fd_num =0 ; VhostUserMsg msg = { .hdr.request = request,
@@ -1845,7 +1863,7 @@ static int vhost_user_backend_init(struct vhost_dev *dev, void *opaque)/* get max memory regions if backend supports configurable RAM slots */ if (!virtio_has_feature (dev->protocol_features,VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS )) { - u->user->memory_slots =VHOST_MEMORY_MAX_NREGIONS ; + u->user->memory_slots =VHOST_MEMORY_BASELINE_NREGIONS ; }else { err =vhost_user_get_max_memslots (dev, &ram_slots);if (err <0 ) {
@@ -1860,7 +1878,7 @@ static int vhost_user_backend_init(struct vhost_dev *dev, void *opaque)return -1 ; } - u->user->memory_slots =MIN (ram_slots,VHOST_MEMORY_MAX_NREGIONS ); + u->user->memory_slots =MIN (ram_slots,VHOST_USER_MAX_RAM_SLOTS ); } }
docs/interop/vhost-user.rst +3 -4
@@ -1273,10 +1273,9 @@ Master message types feature has been successfully negotiated, this message is submitted by master to the slave. The slave should return the message with a u64 payload containing the maximum number of memory slots for - QEMU to expose to the guest. At this point, the value returned - by the backend will be capped at the maximum number of ram slots - which can be supported by vhost-user. Currently that limit is set - at VHOST_USER_MAX_RAM_SLOTS = 8. + QEMU to expose to the guest. The value returned by the backend + will be capped at the maximum number of ram slots which can be + supported by the target platform. ``VHOST_USER_ADD_MEM_REG`` :id: 37
Signature · 1 line
MST
[PULL 04/56] tests/acpi: update expected SRAT files
In reply to Michael S. TsirkinFrom: Vishal Verma <[email protected]>
Update expected SRAT files for the change to account for NVDIMM NUMA nodes in the SRAT.
AML diffs:
tests/data/acpi/pc/SRAT.dimmpxm:
Message-Id: <[email protected]>
--- tests/qtest/bios-tables-test-allowed-diff.h | 3 --- tests/data/acpi/pc/SRAT.dimmpxm | Bin 392 -> 392 bytes tests/data/acpi/q35/SRAT.dimmpxm | Bin 392 -> 392 bytes tests/data/acpi/virt/SRAT.memhp | Bin 186 -> 226 bytes 4 files changed, 3 deletions(-)
tests/qtest/bios-tables-test-allowed-diff.h +0 -3
@@ -1,4 +1 @@/* List of comma-separated changed AML files to ignore */ -"tests/data/acpi/pc/SRAT.dimmpxm" , -"tests/data/acpi/q35/SRAT.dimmpxm" , -"tests/data/acpi/virt/SRAT.memhp",
tests/data/acpi/pc/SRAT.dimmpxm binary +0 -0
tests/data/acpi/q35/SRAT.dimmpxm binary +0 -0
tests/data/acpi/virt/SRAT.memhp binary +0 -0
Signature · 1 line
MST
[PULL 55/56] acpi: ged: rename event memory region
In reply to Michael S. TsirkinFrom: Gerd Hoffmann <[email protected]>
Rename memory region and callbacks and ops to carry "evt" in the name because a second region will be added shortly.
Message-Id: <[email protected]>
--- include/hw/acpi/generic_event_device.h | 2 +- hw/acpi/generic_event_device.c | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-)
include/hw/acpi/generic_event_device.h +1 -1
@@ -86,7 +86,7 @@#define ACPI_GED_NVDIMM_HOTPLUG_EVT 0x4typedef struct GEDState { -MemoryRegion io; +MemoryRegion evt;uint32_t sel; }GEDState ;
hw/acpi/generic_event_device.c +8 -8
@@ -142,7 +142,7 @@ void build_ged_aml(Aml *table, const char *name, HotplugHandler *hotplug_dev, }/* Memory read by the GED _EVT AML dynamic method */ -static uint64_t ged_read (void *opaque,hwaddr addr,unsigned size) +static uint64_t ged_evt_read (void *opaque,hwaddr addr,unsigned size) {uint64_t val =0 ;GEDState *ged_st = opaque;
@@ -161,14 +161,14 @@ static uint64_t ged_read(void *opaque, hwaddr addr, unsigned size) }/* Nothing is expected to be written to the GED memory region */ -static void ged_write (void *opaque,hwaddr addr,uint64_t data, -unsigned int size) +static void ged_evt_write (void *opaque,hwaddr addr,uint64_t data, +unsigned int size) { } -static const MemoryRegionOps ged_ops = { - .read = ged_read, - .write = ged_write, +static const MemoryRegionOps ged_evt_ops = { + .read = ged_evt_read, + .write = ged_evt_write, .endianness =DEVICE_LITTLE_ENDIAN , .valid = { .min_access_size =4 ,
@@ -287,9 +287,9 @@ static void acpi_ged_initfn(Object *obj)SysBusDevice *sbd =SYS_BUS_DEVICE (obj);GEDState *ged_st = &s->ged_state; -memory_region_init_io (&ged_st->io, obj, &ged_ops, ged_st, +memory_region_init_io (&ged_st->evt, obj, &ged_evt_ops, ged_st,TYPE_ACPI_GED ,ACPI_GED_EVT_SEL_LEN ); -sysbus_init_mmio (sbd, &ged_st->io); +sysbus_init_mmio (sbd, &ged_st->evt);sysbus_init_irq (sbd, &s->irq);
Signature · 1 line
MST
[PULL 35/56] vhost-user-blk: delay vhost_user_blk_disconnect
In reply to Michael S. TsirkinFrom: Dima Stepanov <[email protected]>
A socket write during vhost-user communication may trigger a disconnect event, calling vhost_user_blk_disconnect() and clearing all the vhost_dev structures holding data that vhost-user functions expect to remain valid to roll back initialization correctly. Delay the cleanup to keep vhost_dev structure valid.
There are two possible states to handle:
1. RUN_STATE_PRELAUNCH: skip bh oneshot call and perform disconnect in the caller routine.
2. RUN_STATE_RUNNING: delay by using bh
BH changes are based on the similar changes for the vhost-user-net device:
commit e7c83a885f865128ae3cf1946f8cb538b63cbfba "vhost-user: delay vhost_user_stop"
Message-Id: <69b73b94dcd066065595266c852810e0863a0895.1590396396.git.dimastep@yandex-team.ru>
--- hw/block/vhost-user-blk.c | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-)
hw/block/vhost-user-blk.c +37 -1
@@ -349,6 +349,19 @@ static void vhost_user_blk_disconnect(DeviceState *dev)vhost_dev_cleanup (&s->dev); } +static void vhost_user_blk_event (void *opaque,QEMUChrEvent event); + +static void vhost_user_blk_chr_closed_bh (void *opaque) +{ +DeviceState *dev = opaque; +VirtIODevice *vdev =VIRTIO_DEVICE (dev); +VHostUserBlk *s =VHOST_USER_BLK (vdev); + +vhost_user_blk_disconnect (dev); +qemu_chr_fe_set_handlers (&s->chardev,NULL ,NULL , vhost_user_blk_event, +NULL , opaque,NULL , true); +} +static void vhost_user_blk_event (void *opaque,QEMUChrEvent event) {DeviceState *dev = opaque;
@@ -363,7 +376,30 @@ static void vhost_user_blk_event(void *opaque, QEMUChrEvent event) }break ;case CHR_EVENT_CLOSED : -vhost_user_blk_disconnect (dev); +/* +* A close event may happen during a read/write, but vhost +* code assumes the vhost_dev remains setup, so delay the +* stop & clear. There are two possible paths to hit this +* disconnect event: +* 1. When VM is in the RUN_STATE_PRELAUNCH state. The +* vhost_user_blk_device_realize() is a caller. +* 2. In tha main loop phase after VM start. +* +* For p2 the disconnect event will be delayed. We can't +* do the same for p1, because we are not running the loop +* at this moment. So just skip this step and perform +* disconnect in the caller function. +* +* TODO: maybe it is a good idea to make the same fix +* for other vhost-user devices. +*/ +if (runstate_is_running ()) { +AioContext *ctx =qemu_get_current_aio_context (); + +qemu_chr_fe_set_handlers (&s->chardev,NULL ,NULL ,NULL ,NULL , +NULL ,NULL , false); +aio_bh_schedule_oneshot (ctx, vhost_user_blk_chr_closed_bh, opaque); + }break ;case CHR_EVENT_BREAK :case CHR_EVENT_MUX_IN :
Signature · 1 line
MST
[PULL 53/56] acpi: madt: skip pci override on pci-less systems.
In reply to Michael S. TsirkinFrom: Gerd Hoffmann <[email protected]>
Needed for microvm.
Message-Id: <[email protected]>
--- hw/i386/acpi-common.h | 3 ++- hw/i386/acpi-build.c | 2 +- hw/i386/acpi-common.c | 26 +++++++++++++++----------- 3 files changed, 18 insertions(+), 13 deletions(-)
hw/i386/acpi-common.h +2 -1
@@ -9,6 +9,7 @@#define ACPI_BUILD_IOAPIC_ID 0x0void acpi_build_madt (GArray *table_data,BIOSLinker *linker, -X86MachineState *x86ms,AcpiDeviceIf *adev); +X86MachineState *x86ms,AcpiDeviceIf *adev, +bool has_pci);#endif
hw/i386/acpi-build.c +1 -1
@@ -2588,7 +2588,7 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)acpi_add_table (table_offsets, tables_blob);acpi_build_madt (tables_blob, tables->linker, x86ms, -ACPI_DEVICE_IF (pcms->acpi_dev)); +ACPI_DEVICE_IF (pcms->acpi_dev), true); vmgenid_dev =find_vmgenid_dev ();if (vmgenid_dev) {
hw/i386/acpi-common.c +15 -11
@@ -72,7 +72,8 @@ void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid, }void acpi_build_madt (GArray *table_data,BIOSLinker *linker, -X86MachineState *x86ms,AcpiDeviceIf *adev) +X86MachineState *x86ms,AcpiDeviceIf *adev, +bool has_pci) {MachineClass *mc =MACHINE_GET_CLASS (x86ms);const CPUArchIdList *apic_ids = mc->possible_cpu_arch_ids (MACHINE (x86ms));
@@ -111,18 +112,21 @@ void acpi_build_madt(GArray *table_data, BIOSLinker *linker, intsrcovr->gsi =cpu_to_le32 (2 ); intsrcovr->flags =cpu_to_le16 (0 );/* conforms to bus specifications */ } -for (i =1 ; i <16 ; i++) { + +if (has_pci) { +for (i =1 ; i <16 ; i++) {#define ACPI_BUILD_PCI_IRQS ((1<<5) | (1<<9) | (1<<10) | (1<<11)) -if (!(ACPI_BUILD_PCI_IRQS & (1 << i))) { -/* No need for a INT source override structure. */ -continue ; +if (!(ACPI_BUILD_PCI_IRQS & (1 << i))) { +/* No need for a INT source override structure. */ +continue ; + } + intsrcovr =acpi_data_push (table_data,sizeof *intsrcovr); + intsrcovr->type =ACPI_APIC_XRUPT_OVERRIDE ; + intsrcovr->length =sizeof (*intsrcovr); + intsrcovr->source = i; + intsrcovr->gsi =cpu_to_le32 (i); + intsrcovr->flags =cpu_to_le16 (0xd );/* active high, level triggered */ } - intsrcovr =acpi_data_push (table_data,sizeof *intsrcovr); - intsrcovr->type =ACPI_APIC_XRUPT_OVERRIDE ; - intsrcovr->length =sizeof (*intsrcovr); - intsrcovr->source = i; - intsrcovr->gsi =cpu_to_le32 (i); - intsrcovr->flags =cpu_to_le16 (0xd );/* active high, level triggered */ }if (x2apic_mode) {
Signature · 1 line
MST
[PULL 41/56] Refactor out libvhost-user fault generation logic
In reply to Michael S. TsirkinFrom: Raphael Norwitz <[email protected]>
In libvhost-user, the incoming postcopy migration path for setting the backend's memory tables has become convolued. In particular, moving the logic which starts generating faults, having received the final ACK from qemu can be moved to a separate function. This simplifies the code substantially.
This logic will also be needed by the postcopy path once the VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS feature is supported.
Message-Id: <[email protected]>
--- contrib/libvhost-user/libvhost-user.c | 147 ++++++++++++++------------ 1 file changed, 79 insertions(+), 68 deletions(-)
contrib/libvhost-user/libvhost-user.c +79 -68
@@ -583,6 +583,84 @@ map_ring(VuDev *dev, VuVirtq *vq)return !(vq->vring.desc && vq->vring.used && vq->vring.avail); } +static bool +generate_faults (VuDev *dev) { +int i; +for (i =0 ; i < dev->nregions; i++) { +VuDevRegion *dev_region = &dev->regions[i]; +int ret; +#ifdef UFFDIO_REGISTER +/* +* We should already have an open ufd. Mark each memory +* range as ufd. +* Discard any mapping we have here; note I can't use MADV_REMOVE +* or fallocate to make the hole since I don't want to lose +* data that's already arrived in the shared process. +* TODO: How to do hugepage +*/ + ret =madvise ((void *)(uintptr_t )dev_region->mmap_addr, + dev_region->size + dev_region->mmap_offset, +MADV_DONTNEED ); +if (ret) { +fprintf (stderr, +"%s: Failed to madvise(DONTNEED) region %d: %s\n" , + __func__, i,strerror (errno)); + } +/* +* Turn off transparent hugepages so we dont get lose wakeups +* in neighbouring pages. +* TODO: Turn this backon later. +*/ + ret =madvise ((void *)(uintptr_t )dev_region->mmap_addr, + dev_region->size + dev_region->mmap_offset, +MADV_NOHUGEPAGE ); +if (ret) { +/* +* Note: This can happen legally on kernels that are configured +* without madvise'able hugepages +*/ +fprintf (stderr, +"%s: Failed to madvise(NOHUGEPAGE) region %d: %s\n" , + __func__, i,strerror (errno)); + } +struct uffdio_register reg_struct; + reg_struct.range.start = (uintptr_t )dev_region->mmap_addr; + reg_struct.range.len = dev_region->size + dev_region->mmap_offset; + reg_struct.mode =UFFDIO_REGISTER_MODE_MISSING ; + +if (ioctl (dev->postcopy_ufd,UFFDIO_REGISTER , ®_struct)) { +vu_panic (dev,"%s: Failed to userfault region %d " +"@%p + size:%zx offset: %zx: (ufd=%d)%s\n" , + __func__, i, + dev_region->mmap_addr, + dev_region->size, dev_region->mmap_offset, + dev->postcopy_ufd,strerror (errno)); +return false; + } +if (!(reg_struct.ioctls & ((__u64 )1 << _UFFDIO_COPY))) { +vu_panic (dev,"%s Region (%d) doesn't support COPY" , + __func__, i); +return false; + } +DPRINT ("%s: region %d: Registered userfault for %" + PRIx64" + %" PRIx64"\n" , __func__, i, + (uint64_t )reg_struct.range.start, + (uint64_t )reg_struct.range.len); +/* Now it's registered we can let the client at it */ +if (mprotect ((void *)(uintptr_t )dev_region->mmap_addr, + dev_region->size + dev_region->mmap_offset, +PROT_READ |PROT_WRITE )) { +vu_panic (dev,"failed to mprotect region %d for postcopy (%s)" , + i,strerror (errno)); +return false; + } +/* TODO: Stash 'zero' support flags somewhere */ +#endif + } + +return true; +} +static bool vu_set_mem_table_exec_postcopy (VuDev *dev,VhostUserMsg *vmsg) {
@@ -655,74 +733,7 @@ vu_set_mem_table_exec_postcopy(VuDev *dev, VhostUserMsg *vmsg) }/* OK, now we can go and register the memory and generate faults */ -for (i =0 ; i < dev->nregions; i++) { -VuDevRegion *dev_region = &dev->regions[i]; -int ret; -#ifdef UFFDIO_REGISTER -/* We should already have an open ufd. Mark each memory -* range as ufd. -* Discard any mapping we have here; note I can't use MADV_REMOVE -* or fallocate to make the hole since I don't want to lose -* data that's already arrived in the shared process. -* TODO: How to do hugepage -*/ - ret =madvise ((void *)(uintptr_t )dev_region->mmap_addr, - dev_region->size + dev_region->mmap_offset, -MADV_DONTNEED ); -if (ret) { -fprintf (stderr, -"%s: Failed to madvise(DONTNEED) region %d: %s\n" , - __func__, i,strerror (errno)); - } -/* Turn off transparent hugepages so we dont get lose wakeups -* in neighbouring pages. -* TODO: Turn this backon later. -*/ - ret =madvise ((void *)(uintptr_t )dev_region->mmap_addr, - dev_region->size + dev_region->mmap_offset, -MADV_NOHUGEPAGE ); -if (ret) { -/* Note: This can happen legally on kernels that are configured -* without madvise'able hugepages -*/ -fprintf (stderr, -"%s: Failed to madvise(NOHUGEPAGE) region %d: %s\n" , - __func__, i,strerror (errno)); - } -struct uffdio_register reg_struct; - reg_struct.range.start = (uintptr_t )dev_region->mmap_addr; - reg_struct.range.len = dev_region->size + dev_region->mmap_offset; - reg_struct.mode =UFFDIO_REGISTER_MODE_MISSING ; - -if (ioctl (dev->postcopy_ufd,UFFDIO_REGISTER , ®_struct)) { -vu_panic (dev,"%s: Failed to userfault region %d " -"@%p + size:%zx offset: %zx: (ufd=%d)%s\n" , - __func__, i, - dev_region->mmap_addr, - dev_region->size, dev_region->mmap_offset, - dev->postcopy_ufd,strerror (errno)); -return false; - } -if (!(reg_struct.ioctls & ((__u64 )1 << _UFFDIO_COPY))) { -vu_panic (dev,"%s Region (%d) doesn't support COPY" , - __func__, i); -return false; - } -DPRINT ("%s: region %d: Registered userfault for %" - PRIx64" + %" PRIx64"\n" , __func__, i, - (uint64_t )reg_struct.range.start, - (uint64_t )reg_struct.range.len); -/* Now it's registered we can let the client at it */ -if (mprotect ((void *)(uintptr_t )dev_region->mmap_addr, - dev_region->size + dev_region->mmap_offset, -PROT_READ |PROT_WRITE )) { -vu_panic (dev,"failed to mprotect region %d for postcopy (%s)" , - i,strerror (errno)); -return false; - } -/* TODO: Stash 'zero' support flags somewhere */ -#endif - } + (void )generate_faults (dev);return false; }
Signature · 1 line
MST
[PULL 56/56] Fix parameter type in vhost migration log path
In reply to Michael S. TsirkinFrom: Raphael Norwitz <[email protected]>
The ‘enable’ parameter to the vhost_migration_log() function is given as an int, but "true"/"false" values are passed in wherever it is invoked. Inside the function itself it is only ever compared with bool values. Therefore the parameter value itself should be changed to bool.
Message-Id: <CAFubqFtqNZw=Y-ar3N=3zTQi6LkKg_G-7W7OOHHbE7Y1fV7HAQ@mail.gmail.com>
--- hw/virtio/vhost.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/virtio/vhost.c +2 -2
@@ -809,12 +809,12 @@ err_features:return r; } -static int vhost_migration_log (MemoryListener *listener,int enable) +static int vhost_migration_log (MemoryListener *listener,bool enable) { struct vhost_dev *dev = container_of(listener, struct vhost_dev, memory_listener);int r; -if (!!enable == dev->log_enabled) { +if (enable == dev->log_enabled) {return 0 ; }if (!dev->started) {
Signature · 1 line
MST
[PULL 39/56] Transmit vhost-user memory regions individually
In reply to Michael S. TsirkinFrom: Raphael Norwitz <[email protected]>
With this change, when the VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS protocol feature has been negotiated, Qemu no longer sends the backend all the memory regions in a single message. Rather, when the memory tables are set or updated, a series of VHOST_USER_ADD_MEM_REG and VHOST_USER_REM_MEM_REG messages are sent to transmit the regions to map and/or unmap instead of sending send all the regions in one fixed size VHOST_USER_SET_MEM_TABLE message.
The vhost_user struct maintains a shadow state of the VM’s memory regions. When the memory tables are modified, the vhost_user_set_mem_table() function compares the new device memory state to the shadow state and only sends regions which need to be unmapped or mapped in. The regions which must be unmapped are sent first, followed by the new regions to be mapped in. After all the messages have been sent, the shadow state is set to the current virtual device state.
Existing backends which do not support VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS are unaffected.
Message-Id: <[email protected]>
--- hw/virtio/vhost-user.c | 516 ++++++++++++++++++++++++++++++------ docs/interop/vhost-user.rst | 33 ++- 2 files changed, 472 insertions(+), 77 deletions(-)
hw/virtio/vhost-user.c +441 -75
@@ -104,6 +104,8 @@ typedef enum VhostUserRequest {VHOST_USER_RESET_DEVICE =34 ,/* Message number 35 reserved for VHOST_USER_VRING_KICK. */ VHOST_USER_GET_MAX_MEM_SLOTS =36 , +VHOST_USER_ADD_MEM_REG =37 , +VHOST_USER_REM_MEM_REG =38 , VHOST_USER_MAX } VhostUserRequest;
@@ -128,6 +130,11 @@ typedef struct VhostUserMemory {VhostUserMemoryRegion regions[VHOST_MEMORY_MAX_NREGIONS ]; } VhostUserMemory; +typedef struct VhostUserMemRegMsg { +uint32_t padding; +VhostUserMemoryRegion region; +}VhostUserMemRegMsg ; + typedef struct VhostUserLog { uint64_t mmap_size; uint64_t mmap_offset;
@@ -186,6 +193,7 @@ typedef union {struct vhost_vring_state state;struct vhost_vring_addr addr;VhostUserMemory memory; +VhostUserMemRegMsg mem_reg;VhostUserLog log;struct vhost_iotlb_msg iotlb;VhostUserConfig config;
@@ -226,6 +234,16 @@ struct vhost_user {/* True once we've entered postcopy_listen */ bool postcopy_listen; + +/* Our current regions */ +int num_shadow_regions; +struct vhost_memory_region shadow_regions[VHOST_MEMORY_MAX_NREGIONS ]; +}; + +struct scrub_regions { +struct vhost_memory_region *region; +int reg_idx; +int fd_idx; };static bool ioeventfd_enabled (void )
@@ -489,8 +507,332 @@ static int vhost_user_fill_set_mem_table_msg(struct vhost_user *u,return 1 ; } +static inline bool reg_equal (struct vhost_memory_region *shadow_reg, +struct vhost_memory_region *vdev_reg) +{ +return shadow_reg->guest_phys_addr == vdev_reg->guest_phys_addr && + shadow_reg->userspace_addr == vdev_reg->userspace_addr && + shadow_reg->memory_size == vdev_reg->memory_size; +} + +static void scrub_shadow_regions (struct vhost_dev *dev, +struct scrub_regions *add_reg, +int *nr_add_reg, +struct scrub_regions *rem_reg, +int *nr_rem_reg,uint64_t *shadow_pcb, +bool track_ramblocks) +{ +struct vhost_user *u = dev->opaque; +bool found[VHOST_MEMORY_MAX_NREGIONS ] = {}; +struct vhost_memory_region *reg, *shadow_reg; +int i, j, fd, add_idx =0 , rm_idx =0 , fd_num =0 ; +ram_addr_t offset; +MemoryRegion *mr; +bool matching; + +/* +* Find memory regions present in our shadow state which are not in +* the device's current memory state. +* +* Mark regions in both the shadow and device state as "found". +*/ +for (i =0 ; i < u->num_shadow_regions; i++) { + shadow_reg = &u->shadow_regions[i]; + matching = false; + +for (j =0 ; j < dev->mem->nregions; j++) { + reg = &dev->mem->regions[j]; + + mr =vhost_user_get_mr_data (reg->userspace_addr, &offset, &fd); + +if (reg_equal (shadow_reg, reg)) { + matching = true; + found[j] = true; +if (track_ramblocks) { +/* +* Reset postcopy client bases, region_rb, and +* region_rb_offset in case regions are removed. +*/ +if (fd >0 ) { + u->region_rb_offset[j] = offset; + u->region_rb[j] = mr->ram_block; + shadow_pcb[j] = u->postcopy_client_bases[i]; + }else { + u->region_rb_offset[j] =0 ; + u->region_rb[j] =NULL ; + } + } +break ; + } + } + +/* +* If the region was not found in the current device memory state +* create an entry for it in the removed list. +*/ +if (!matching) { + rem_reg[rm_idx].region = shadow_reg; + rem_reg[rm_idx++].reg_idx = i; + } + } + +/* +* For regions not marked "found", create entries in the added list. +* +* Note their indexes in the device memory state and the indexes of their +* file descriptors. +*/ +for (i =0 ; i < dev->mem->nregions; i++) { + reg = &dev->mem->regions[i]; + mr =vhost_user_get_mr_data (reg->userspace_addr, &offset, &fd); +if (fd >0 ) { + ++fd_num; + } + +/* +* If the region was in both the shadow and device state we don't +* need to send a VHOST_USER_ADD_MEM_REG message for it. +*/ +if (found[i]) { +continue ; + } + + add_reg[add_idx].region = reg; + add_reg[add_idx].reg_idx = i; + add_reg[add_idx++].fd_idx = fd_num; + } + *nr_rem_reg = rm_idx; + *nr_add_reg = add_idx; + +return ; +} + +static int send_remove_regions (struct vhost_dev *dev, +struct scrub_regions *remove_reg, +int nr_rem_reg,VhostUserMsg *msg, +bool reply_supported) +{ +struct vhost_user *u = dev->opaque; +struct vhost_memory_region *shadow_reg; +int i, fd, shadow_reg_idx, ret; +ram_addr_t offset; +VhostUserMemoryRegion region_buffer; + +/* +* The regions in remove_reg appear in the same order they do in the +* shadow table. Therefore we can minimize memory copies by iterating +* through remove_reg backwards. +*/ +for (i = nr_rem_reg -1 ; i >=0 ; i--) { + shadow_reg = remove_reg[i].region; + shadow_reg_idx = remove_reg[i].reg_idx; + +vhost_user_get_mr_data (shadow_reg->userspace_addr, &offset, &fd); + +if (fd >0 ) { + msg->hdr.request =VHOST_USER_REM_MEM_REG ; +vhost_user_fill_msg_region (®ion_buffer, shadow_reg); + msg->payload.mem_reg.region = region_buffer; + +if (vhost_user_write (dev, msg, &fd,1 ) <0 ) { +return -1 ; + } + +if (reply_supported) { + ret =process_message_reply (dev, msg); +if (ret) { +return ret; + } + } + } + +/* +* At this point we know the backend has unmapped the region. It is now +* safe to remove it from the shadow table. +*/ +memmove (&u->shadow_regions[shadow_reg_idx], + &u->shadow_regions[shadow_reg_idx +1 ], +sizeof (struct vhost_memory_region ) * + (u->num_shadow_regions - shadow_reg_idx)); + u->num_shadow_regions--; + } + +return 0 ; +} + +static int send_add_regions (struct vhost_dev *dev, +struct scrub_regions *add_reg,int nr_add_reg, +VhostUserMsg *msg,uint64_t *shadow_pcb, +bool reply_supported,bool track_ramblocks) +{ +struct vhost_user *u = dev->opaque; +int i, fd, ret, reg_idx, reg_fd_idx; +struct vhost_memory_region *reg; +MemoryRegion *mr; +ram_addr_t offset; +VhostUserMsg msg_reply; +VhostUserMemoryRegion region_buffer; + +for (i =0 ; i < nr_add_reg; i++) { + reg = add_reg[i].region; + reg_idx = add_reg[i].reg_idx; + reg_fd_idx = add_reg[i].fd_idx; + + mr =vhost_user_get_mr_data (reg->userspace_addr, &offset, &fd); + +if (fd >0 ) { +if (track_ramblocks) { +trace_vhost_user_set_mem_table_withfd (reg_fd_idx, mr->name, + reg->memory_size, + reg->guest_phys_addr, + reg->userspace_addr, + offset); + u->region_rb_offset[reg_idx] = offset; + u->region_rb[reg_idx] = mr->ram_block; + } + msg->hdr.request =VHOST_USER_ADD_MEM_REG ; +vhost_user_fill_msg_region (®ion_buffer, reg); + msg->payload.mem_reg.region = region_buffer; + msg->payload.mem_reg.region.mmap_offset = offset; + +if (vhost_user_write (dev, msg, &fd,1 ) <0 ) { +return -1 ; + } + +if (track_ramblocks) { +uint64_t reply_gpa; + +if (vhost_user_read (dev, &msg_reply) <0 ) { +return -1 ; + } + + reply_gpa = msg_reply.payload.mem_reg.region.guest_phys_addr; + +if (msg_reply.hdr.request !=VHOST_USER_ADD_MEM_REG ) { +error_report ("%s: Received unexpected msg type." +"Expected %d received %d" , __func__, +VHOST_USER_ADD_MEM_REG , + msg_reply.hdr.request); +return -1 ; + } + +/* +* We're using the same structure, just reusing one of the +* fields, so it should be the same size. +*/ +if (msg_reply.hdr.size != msg->hdr.size) { +error_report ("%s: Unexpected size for postcopy reply " +"%d vs %d" , __func__, msg_reply.hdr.size, + msg->hdr.size); +return -1 ; + } + +/* Get the postcopy client base from the backend's reply. */ +if (reply_gpa == dev->mem->regions[reg_idx].guest_phys_addr) { + shadow_pcb[reg_idx] = + msg_reply.payload.mem_reg.region.userspace_addr; +trace_vhost_user_set_mem_table_postcopy ( + msg_reply.payload.mem_reg.region.userspace_addr, + msg->payload.mem_reg.region.userspace_addr, + reg_fd_idx, reg_idx); + }else { +error_report ("%s: invalid postcopy reply for region. " +"Got guest physical address %lX, expected " +"%lX" , __func__, reply_gpa, + dev->mem->regions[reg_idx].guest_phys_addr); +return -1 ; + } + }else if (reply_supported) { + ret =process_message_reply (dev, msg); +if (ret) { +return ret; + } + } + }else if (track_ramblocks) { + u->region_rb_offset[reg_idx] =0 ; + u->region_rb[reg_idx] =NULL ; + } + +/* +* At this point, we know the backend has mapped in the new +* region, if the region has a valid file descriptor. +* +* The region should now be added to the shadow table. +*/ + u->shadow_regions[u->num_shadow_regions].guest_phys_addr = + reg->guest_phys_addr; + u->shadow_regions[u->num_shadow_regions].userspace_addr = + reg->userspace_addr; + u->shadow_regions[u->num_shadow_regions].memory_size = + reg->memory_size; + u->num_shadow_regions++; + } + +return 0 ; +} + +static int vhost_user_add_remove_regions (struct vhost_dev *dev, +VhostUserMsg *msg, +bool reply_supported, +bool track_ramblocks) +{ +struct vhost_user *u = dev->opaque; +struct scrub_regions add_reg[VHOST_MEMORY_MAX_NREGIONS ]; +struct scrub_regions rem_reg[VHOST_MEMORY_MAX_NREGIONS ]; +uint64_t shadow_pcb[VHOST_MEMORY_MAX_NREGIONS ] = {}; +int nr_add_reg, nr_rem_reg; + + msg->hdr.size =sizeof (msg->payload.mem_reg.padding) + +sizeof (VhostUserMemoryRegion); + +/* Find the regions which need to be removed or added. */ +scrub_shadow_regions (dev, add_reg, &nr_add_reg, rem_reg, &nr_rem_reg, + shadow_pcb, track_ramblocks); + +if (nr_rem_reg &&send_remove_regions (dev, rem_reg, nr_rem_reg, msg, + reply_supported) <0 ) + { + goto err; + } + +if (nr_add_reg &&send_add_regions (dev, add_reg, nr_add_reg, msg, + shadow_pcb, reply_supported, track_ramblocks) <0 ) + { + goto err; + } + +if (track_ramblocks) { +memcpy (u->postcopy_client_bases, shadow_pcb, +sizeof (uint64_t ) *VHOST_MEMORY_MAX_NREGIONS ); +/* +* Now we've registered this with the postcopy code, we ack to the +* client, because now we're in the position to be able to deal with +* any faults it generates. +*/ +/* TODO: Use this for failure cases as well with a bad value. */ + msg->hdr.size =sizeof (msg->payload.u64); + msg->payload.u64 =0 ;/* OK */ + +if (vhost_user_write (dev, msg,NULL ,0 ) <0 ) { +return -1 ; + } + } + +return 0 ; + +err: +if (track_ramblocks) { +memcpy (u->postcopy_client_bases, shadow_pcb, +sizeof (uint64_t ) *VHOST_MEMORY_MAX_NREGIONS ); + } + +return -1 ; +} +static int vhost_user_set_mem_table_postcopy (struct vhost_dev *dev, -struct vhost_memory *mem) +struct vhost_memory *mem, +bool reply_supported, +bool config_mem_slots) {struct vhost_user *u = dev->opaque;int fds[VHOST_MEMORY_MAX_NREGIONS ];
@@ -513,71 +855,84 @@ static int vhost_user_set_mem_table_postcopy(struct vhost_dev *dev, u->region_rb_len = dev->mem->nregions; } -if (vhost_user_fill_set_mem_table_msg (u, dev, &msg, fds, &fd_num, +if (config_mem_slots) { +if (vhost_user_add_remove_regions (dev, &msg, reply_supported, true) <0 ) { -return -1 ; - } - -if (vhost_user_write (dev, &msg, fds, fd_num) <0 ) { -return -1 ; - } - -if (vhost_user_read (dev, &msg_reply) <0 ) { -return -1 ; - } - -if (msg_reply.hdr.request !=VHOST_USER_SET_MEM_TABLE ) { -error_report ("%s: Received unexpected msg type." -"Expected %d received %d" , __func__, -VHOST_USER_SET_MEM_TABLE , msg_reply.hdr.request); -return -1 ; - } -/* We're using the same structure, just reusing one of the -* fields, so it should be the same size. -*/ -if (msg_reply.hdr.size != msg.hdr.size) { -error_report ("%s: Unexpected size for postcopy reply " -"%d vs %d" , __func__, msg_reply.hdr.size, msg.hdr.size); -return -1 ; - } - -memset (u->postcopy_client_bases,0 , -sizeof (uint64_t ) *VHOST_MEMORY_MAX_NREGIONS ); - -/* They're in the same order as the regions that were sent -* but some of the regions were skipped (above) if they -* didn't have fd's -*/ -for (msg_i =0 , region_i =0 ; - region_i < dev->mem->nregions; - region_i++) { -if (msg_i < fd_num && - msg_reply.payload.memory.regions[msg_i].guest_phys_addr == - dev->mem->regions[region_i].guest_phys_addr) { - u->postcopy_client_bases[region_i] = - msg_reply.payload.memory.regions[msg_i].userspace_addr; -trace_vhost_user_set_mem_table_postcopy ( - msg_reply.payload.memory.regions[msg_i].userspace_addr, - msg.payload.memory.regions[msg_i].userspace_addr, - msg_i, region_i); - msg_i++; +return -1 ; + } + }else { +if (vhost_user_fill_set_mem_table_msg (u, dev, &msg, fds, &fd_num, + true) <0 ) { +return -1 ; + } + +if (vhost_user_write (dev, &msg, fds, fd_num) <0 ) { +return -1 ; + } + +if (vhost_user_read (dev, &msg_reply) <0 ) { +return -1 ; + } + +if (msg_reply.hdr.request !=VHOST_USER_SET_MEM_TABLE ) { +error_report ("%s: Received unexpected msg type." +"Expected %d received %d" , __func__, +VHOST_USER_SET_MEM_TABLE , msg_reply.hdr.request); +return -1 ; + } + +/* +* We're using the same structure, just reusing one of the +* fields, so it should be the same size. +*/ +if (msg_reply.hdr.size != msg.hdr.size) { +error_report ("%s: Unexpected size for postcopy reply " +"%d vs %d" , __func__, msg_reply.hdr.size, + msg.hdr.size); +return -1 ; + } + +memset (u->postcopy_client_bases,0 , +sizeof (uint64_t ) *VHOST_MEMORY_MAX_NREGIONS ); + +/* +* They're in the same order as the regions that were sent +* but some of the regions were skipped (above) if they +* didn't have fd's +*/ +for (msg_i =0 , region_i =0 ; + region_i < dev->mem->nregions; + region_i++) { +if (msg_i < fd_num && + msg_reply.payload.memory.regions[msg_i].guest_phys_addr == + dev->mem->regions[region_i].guest_phys_addr) { + u->postcopy_client_bases[region_i] = + msg_reply.payload.memory.regions[msg_i].userspace_addr; +trace_vhost_user_set_mem_table_postcopy ( + msg_reply.payload.memory.regions[msg_i].userspace_addr, + msg.payload.memory.regions[msg_i].userspace_addr, + msg_i, region_i); + msg_i++; + } + } +if (msg_i != fd_num) { +error_report ("%s: postcopy reply not fully consumed " +"%d vs %zd" , + __func__, msg_i, fd_num); +return -1 ; + } + +/* +* Now we've registered this with the postcopy code, we ack to the +* client, because now we're in the position to be able to deal +* with any faults it generates. +*/ +/* TODO: Use this for failure cases as well with a bad value. */ + msg.hdr.size =sizeof (msg.payload.u64); + msg.payload.u64 =0 ;/* OK */ +if (vhost_user_write (dev, &msg,NULL ,0 ) <0 ) { +return -1 ; } - } -if (msg_i != fd_num) { -error_report ("%s: postcopy reply not fully consumed " -"%d vs %zd" , - __func__, msg_i, fd_num); -return -1 ; - } -/* Now we've registered this with the postcopy code, we ack to the client, -* because now we're in the position to be able to deal with any faults -* it generates. -*/ -/* TODO: Use this for failure cases as well with a bad value */ - msg.hdr.size =sizeof (msg.payload.u64); - msg.payload.u64 =0 ;/* OK */ -if (vhost_user_write (dev, &msg,NULL ,0 ) <0 ) { -return -1 ; }return 0 ;
@@ -592,12 +947,17 @@ static int vhost_user_set_mem_table(struct vhost_dev *dev,bool do_postcopy = u->postcopy_listen && u->postcopy_fd.handler;bool reply_supported =virtio_has_feature (dev->protocol_features,VHOST_USER_PROTOCOL_F_REPLY_ACK ); +bool config_mem_slots = +virtio_has_feature (dev->protocol_features, +VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS );if (do_postcopy) { -/* Postcopy has enough differences that it's best done in it's own +/* +* Postcopy has enough differences that it's best done in it's own * version */ -return vhost_user_set_mem_table_postcopy (dev, mem); +return vhost_user_set_mem_table_postcopy (dev, mem, reply_supported, + config_mem_slots); }VhostUserMsg msg = {
@@ -608,17 +968,23 @@ static int vhost_user_set_mem_table(struct vhost_dev *dev, msg.hdr.flags |=VHOST_USER_NEED_REPLY_MASK ; } -if (vhost_user_fill_set_mem_table_msg (u, dev, &msg, fds, &fd_num, +if (config_mem_slots) { +if (vhost_user_add_remove_regions (dev, &msg, reply_supported, false) <0 ) { -return -1 ; - } +return -1 ; + } + }else { +if (vhost_user_fill_set_mem_table_msg (u, dev, &msg, fds, &fd_num, + false) <0 ) { +return -1 ; + } +if (vhost_user_write (dev, &msg, fds, fd_num) <0 ) { +return -1 ; + } -if (vhost_user_write (dev, &msg, fds, fd_num) <0 ) { -return -1 ; - } - -if (reply_supported) { -return process_message_reply (dev, &msg); +if (reply_supported) { +return process_message_reply (dev, &msg); + } }return 0 ;
docs/interop/vhost-user.rst +31 -2
@@ -1276,8 +1276,37 @@ Master message types QEMU to expose to the guest. At this point, the value returned by the backend will be capped at the maximum number of ram slots which can be supported by vhost-user. Currently that limit is set - at VHOST_USER_MAX_RAM_SLOTS = 8 because of underlying protocol - limitations. + at VHOST_USER_MAX_RAM_SLOTS = 8. + +``VHOST_USER_ADD_MEM_REG`` + :id: 37 + :equivalent ioctl: N/A + :slave payload: memory region + + When the ``VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS`` protocol + feature has been successfully negotiated, this message is submitted + by the master to the slave. The message payload contains a memory + region descriptor struct, describing a region of guest memory which + the slave device must map in. When the + ``VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS`` protocol feature has + been successfully negotiated, along with the + ``VHOST_USER_REM_MEM_REG`` message, this message is used to set and + update the memory tables of the slave device. + +``VHOST_USER_REM_MEM_REG`` + :id: 38 + :equivalent ioctl: N/A + :slave payload: memory region + + When the ``VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS`` protocol + feature has been successfully negotiated, this message is submitted + by the master to the slave. The message payload contains a memory + region descriptor struct, describing a region of guest memory which + the slave device must unmap. When the + ``VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS`` protocol feature has + been successfully negotiated, along with the + ``VHOST_USER_ADD_MEM_REG`` message, this message is used to set and + update the memory tables of the slave device. Slave message types -------------------
Signature · 1 line
MST
[PULL 03/56] hw/acpi/nvdimm: add a helper to augment SRAT generation
In reply to Michael S. TsirkinFrom: Vishal Verma <[email protected]>
NVDIMMs can belong to their own proximity domains, as described by the NFIT. In such cases, the SRAT needs to have Memory Affinity structures in the SRAT for these NVDIMMs, otherwise Linux doesn't populate node data structures properly during NUMA initialization. See the following for an example failure case.
https://lore.kernel.org/linux-nvdimm/[email protected]/
Introduce a new helper, nvdimm_build_srat(), and call it for both the i386 and arm versions of 'build_srat()' to augment the SRAT with memory affinity information for NVDIMMs.
The relevant command line options to exercise this are below. Nodes 0-1 contain CPUs and regular memory, and nodes 2-3 are the NVDIMM address space.
-object memory-backend-ram,id=mem0,size=2048M
-numa node,nodeid=0,memdev=mem0,
-numa cpu,node-id=0,socket-id=0
-object memory-backend-ram,id=mem1,size=2048M
-numa node,nodeid=1,memdev=mem1,
-numa cpu,node-id=1,socket-id=1
-numa node,nodeid=2,
-object memory-backend-file,id=nvmem0,share,mem-path=nvdimm-0,size=16384M,align=1G
-device nvdimm,memdev=nvmem0,id=nv0,label-size=2M,node=2
-numa node,nodeid=3,
-object memory-backend-file,id=nvmem1,share,mem-path=nvdimm-1,size=16384M,align=1G
-device nvdimm,memdev=nvmem1,id=nv1,label-size=2M,node=3Message-Id: <[email protected]>
--- include/hw/mem/nvdimm.h | 1 + hw/acpi/nvdimm.c | 23 +++++++++++++++++++++++ hw/arm/virt-acpi-build.c | 4 ++++ hw/i386/acpi-build.c | 5 +++++ 4 files changed, 33 insertions(+)
include/hw/mem/nvdimm.h +1 -0
@@ -155,6 +155,7 @@ typedef struct NVDIMMState NVDIMMState;void nvdimm_init_acpi_state (NVDIMMState *state,MemoryRegion *io,struct AcpiGenericAddress dsm_io,FWCfgState *fw_cfg,Object *owner); +void nvdimm_build_srat (GArray *table_data);void nvdimm_build_acpi (GArray *table_offsets,GArray *table_data,BIOSLinker *linker,NVDIMMState *state,uint32_t ram_slots);
hw/acpi/nvdimm.c +23 -0
@@ -28,6 +28,7 @@#include "qemu/osdep.h" #include "qemu/uuid.h" +#include "qapi/error.h" #include "hw/acpi/acpi.h" #include "hw/acpi/aml-build.h" #include "hw/acpi/bios-linker-loader.h"
@@ -1334,6 +1335,28 @@ static void nvdimm_build_ssdt(GArray *table_offsets, GArray *table_data,free_aml_allocator (); } +void nvdimm_build_srat (GArray *table_data) +{ +GSList *device_list =nvdimm_get_device_list (); + +for (; device_list; device_list = device_list->next) { +AcpiSratMemoryAffinity *numamem =NULL ; +DeviceState *dev = device_list->data; +Object *obj =OBJECT (dev); +uint64_t addr, size; +int node; + + node =object_property_get_int (obj,PC_DIMM_NODE_PROP , &error_abort); + addr =object_property_get_uint (obj,PC_DIMM_ADDR_PROP , &error_abort); + size =object_property_get_uint (obj,PC_DIMM_SIZE_PROP , &error_abort); + + numamem =acpi_data_push (table_data,sizeof *numamem); +build_srat_memory (numamem, addr, size, node, +MEM_AFFINITY_ENABLED |MEM_AFFINITY_NON_VOLATILE ); + } +g_slist_free (device_list); +} +void nvdimm_build_acpi (GArray *table_offsets,GArray *table_data,BIOSLinker *linker,NVDIMMState *state,uint32_t ram_slots)
hw/arm/virt-acpi-build.c +4 -0
@@ -539,6 +539,10 @@ build_srat(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) } } +if (ms->nvdimms_state->is_enabled) { +nvdimm_build_srat (table_data); + } +if (ms->device_memory) { numamem =acpi_data_push (table_data,sizeof *numamem); build_srat_memory(numamem, ms->device_memory->base,
hw/i386/acpi-build.c +5 -0
@@ -2428,6 +2428,11 @@ build_srat(GArray *table_data, BIOSLinker *linker, MachineState *machine) MEM_AFFINITY_ENABLED); } } + +if (machine->nvdimms_state->is_enabled) { +nvdimm_build_srat (table_data); + } + slots = (table_data->len - numa_start) /sizeof *numamem;for (; slots < pcms->numa_nodes +2 ; slots++) { numamem =acpi_data_push (table_data,sizeof *numamem);
Signature · 1 line
MST
[PULL 37/56] Add vhost-user helper to get MemoryRegion data
In reply to Michael S. TsirkinFrom: Raphael Norwitz <[email protected]>
When setting the memory tables, qemu uses a memory region's userspace address to look up the region's MemoryRegion struct. Among other things, the MemoryRegion contains the region's offset and associated file descriptor, all of which need to be sent to the backend.
With VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS, this logic will be needed in multiple places, so before feature support is added it should be moved to a helper function.
This helper is also used to simplify the vhost_user_can_merge() function.
Message-Id: <[email protected]>
--- hw/virtio/vhost-user.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-)
hw/virtio/vhost-user.c +15 -10
@@ -407,6 +407,18 @@ static int vhost_user_set_log_base(struct vhost_dev *dev, uint64_t base,return 0 ; } +static MemoryRegion *vhost_user_get_mr_data (uint64_t addr,ram_addr_t *offset, +int *fd) +{ +MemoryRegion *mr; + +assert ((uintptr_t )addr == addr); + mr =memory_region_from_host ((void *)(uintptr_t )addr, offset); + *fd =memory_region_get_fd (mr); + +return mr; +} +static void vhost_user_fill_msg_region (VhostUserMemoryRegion *dst,struct vhost_memory_region *src) {
@@ -433,10 +445,7 @@ static int vhost_user_fill_set_mem_table_msg(struct vhost_user *u,for (i =0 ; i < dev->mem->nregions; ++i) { reg = dev->mem->regions + i; -assert ((uintptr_t )reg->userspace_addr == reg->userspace_addr); - mr =memory_region_from_host ((void *)(uintptr_t )reg->userspace_addr, - &offset); - fd =memory_region_get_fd (mr); + mr =vhost_user_get_mr_data (reg->userspace_addr, &offset, &fd);if (fd >0 ) {if (track_ramblocks) {assert (*fd_num <VHOST_MEMORY_MAX_NREGIONS );
@@ -1551,13 +1560,9 @@ static bool vhost_user_can_merge(struct vhost_dev *dev, {ram_addr_t offset;int mfd, rfd; -MemoryRegion *mr; - mr =memory_region_from_host ((void *)(uintptr_t )start1, &offset); - mfd =memory_region_get_fd (mr); - - mr =memory_region_from_host ((void *)(uintptr_t )start2, &offset); - rfd =memory_region_get_fd (mr); + (void )vhost_user_get_mr_data (start1, &offset, &mfd); + (void )vhost_user_get_mr_data (start2, &offset, &rfd);return mfd == rfd; }
Signature · 1 line
MST
[PULL 44/56] Support individual region unmap in libvhost-user
In reply to Michael S. TsirkinFrom: Raphael Norwitz <[email protected]>
When the VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS protocol feature is enabled, on memory hot-unplug qemu will transmit memory regions to remove individually using the new message VHOST_USER_REM_MEM_REG message. With this change, vhost-user backends build with libvhost-user can now unmap individual memory regions when receiving the VHOST_USER_REM_MEM_REG message.
Qemu only sends VHOST_USER_REM_MEM_REG messages when the VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS feature is negotiated, and support for that feature has not yet been added in libvhost-user, this new functionality is not yet used.
Message-Id: <[email protected]>
--- contrib/libvhost-user/libvhost-user.h | 1 + contrib/libvhost-user/libvhost-user.c | 63 +++++++++++++++++++++++++++ 2 files changed, 64 insertions(+)
contrib/libvhost-user/libvhost-user.h +1 -0
@@ -99,6 +99,7 @@ typedef enum VhostUserRequest {VHOST_USER_VRING_KICK =35 ,VHOST_USER_GET_MAX_MEM_SLOTS =36 ,VHOST_USER_ADD_MEM_REG =37 , +VHOST_USER_REM_MEM_REG =38 , VHOST_USER_MAX } VhostUserRequest;
contrib/libvhost-user/libvhost-user.c +63 -0
81 lines not on this page · raw message
Signature · 1 line
MST
[PULL 47/56] hw/pci: Fix crash when running QEMU with "-nic model=rocker"
In reply to Michael S. TsirkinFrom: Thomas Huth <[email protected]>
QEMU currently aborts when being started with "-nic model=rocker" or with "-net nic,model=rocker". This happens because the "rocker" device is not a normal NIC but a switch, which has different properties. Thus we should only consider real NIC devices for "-nic" and "-net". These devices can be identified by the "netdev" property, so check for this property before adding the device to the list.
Message-Id: <[email protected]>
--- hw/pci/pci.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
hw/pci/pci.c +12 -1
@@ -1891,7 +1891,18 @@ PCIDevice *pci_nic_init_nofail(NICInfo *nd, PCIBus *rootbus,if (test_bit (DEVICE_CATEGORY_NETWORK , dc->categories) && dc->user_creatable) {const char *name =object_class_get_name (list->data); -g_ptr_array_add (pci_nic_models, (gpointer )name); +/* +* A network device might also be something else than a NIC, see +* e.g. the "rocker" device. Thus we have to look for the "netdev" +* property, too. Unfortunately, some devices like virtio-net only +* create this property during instance_init, so we have to create +* a temporary instance here to be able to check it. +*/ +Object *obj =object_new_with_class (OBJECT_CLASS (dc)); +if (object_property_find (obj,"netdev" ,NULL )) { +g_ptr_array_add (pci_nic_models, (gpointer )name); + } +object_unref (obj); } next = list->next;g_slist_free_1 (list);
Signature · 1 line
MST
[PULL 26/56] virtio-balloon: Provide an interface for free page reporting
In reply to Michael S. TsirkinFrom: Alexander Duyck <[email protected]>
Add support for free page reporting. The idea is to function very similar to how the balloon works in that we basically end up madvising the page as not being used. However we don't really need to bother with any deflate type logic since the page will be faulted back into the guest when it is read or written to.
This provides a new way of letting the guest proactively report free pages to the hypervisor, so the hypervisor can reuse them. In contrast to inflate/deflate that is triggered via the hypervisor explicitly.
Message-Id: <[email protected]>
--- include/hw/virtio/virtio-balloon.h | 2 +- hw/virtio/virtio-balloon.c | 72 ++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+), 1 deletion(-)
include/hw/virtio/virtio-balloon.h +1 -1
@@ -42,7 +42,7 @@ enum virtio_balloon_free_page_report_status { typedef struct VirtIOBalloon { VirtIODevice parent_obj; - VirtQueue *ivq, *dvq, *svq, *free_page_vq; + VirtQueue *ivq, *dvq, *svq, *free_page_vq, *reporting_vq; uint32_t free_page_report_status; uint32_t num_pages; uint32_t actual;
hw/virtio/virtio-balloon.c +72 -0
96 lines not on this page · raw message
Signature · 1 line
MST
[PULL 30/56] hw/pci-host/prep: Correct RAVEN bus bridge memory region size
In reply to Michael S. TsirkinFrom: Philippe Mathieu-Daudé <[email protected]>
memory_region_set_size() handle the 16 Exabytes limit by special-casing the UINT64_MAX value. This is not a problem for the 32-bit maximum, 4 GiB.
By using the UINT32_MAX value, the bm-raven MemoryRegion ends up missing 1 byte:
$ qemu-system-ppc -M prep -S -monitor stdio -usb
memory-region: bm-raven
0000000000000000-00000000fffffffe (prio 0, i/o): bm-raven
0000000000000000-000000003effffff (prio 0, i/o): alias bm-pci-memory @pci-memory 0000000000000000-000000003effffff
0000000080000000-00000000ffffffff (prio 0, i/o): alias bm-system @system 0000000000000000-000000007fffffffFix by using the correct value. We now have:
memory-region: bm-raven
0000000000000000-00000000ffffffff (prio 0, i/o): bm-raven
0000000000000000-000000003effffff (prio 0, i/o): alias bm-pci-memory @pci-memory 0000000000000000-000000003effffff
0000000080000000-00000000ffffffff (prio 0, i/o): alias bm-system @system 0000000000000000-000000007fffffffMessage-Id: <[email protected]>
--- hw/pci-host/prep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/pci-host/prep.c +1 -1
@@ -294,7 +294,7 @@ static void raven_pcihost_initfn(Object *obj) &s->pci_memory, &s->pci_io, 0, TYPE_PCI_BUS);/* Bus master address space */ -memory_region_init (&s->bm, obj,"bm-raven" ,UINT32_MAX ); +memory_region_init (&s->bm, obj,"bm-raven" ,4 * GiB);memory_region_init_alias (&s->bm_pci_memory_alias, obj,"bm-pci-memory" , &s->pci_memory,0 ,memory_region_size (&s->pci_memory));
Signature · 1 line
MST
[PULL 48/56] vhost-vsock: add vhost-vsock-common abstraction
In reply to Michael S. TsirkinFrom: Stefano Garzarella <[email protected]>
This patch prepares the introduction of vhost-user-vsock, moving the common code usable for both vhost-vsock and vhost-user-vsock devices, in the new vhost-vsock-common parent class.
While moving the code, fixed checkpatch warnings about block comments.
Message-Id: <[email protected]>
--- include/hw/virtio/vhost-vsock-common.h | 47 ++++ include/hw/virtio/vhost-vsock.h | 11 +- hw/virtio/vhost-vsock-common.c | 258 ++++++++++++++++++++++ hw/virtio/vhost-vsock.c | 283 ++++--------------------- hw/virtio/Makefile.objs | 2 +- 5 files changed, 350 insertions(+), 251 deletions(-) create mode 100644 include/hw/virtio/vhost-vsock-common.h create mode 100644 hw/virtio/vhost-vsock-common.c
include/hw/virtio/vhost-vsock-common.h new file +47 -0
@@ -0,0 +1,47 @@ +/* +* Parent class for vhost-vsock devices +* +* Copyright 2015-2020 Red Hat, Inc. +* +* This work is licensed under the terms of the GNU GPL, version 2 or +* (at your option) any later version. See the COPYING file in the +* top-level directory. +*/ + +#ifndef _QEMU_VHOST_VSOCK_COMMON_H +#define _QEMU_VHOST_VSOCK_COMMON_H + +#include "hw/virtio/virtio.h" +#include "hw/virtio/vhost.h" + +#define TYPE_VHOST_VSOCK_COMMON "vhost-vsock-common" +#define VHOST_VSOCK_COMMON (obj) \ + OBJECT_CHECK(VHostVSockCommon, (obj), TYPE_VHOST_VSOCK_COMMON) + +enum { +VHOST_VSOCK_SAVEVM_VERSION =0 , + +VHOST_VSOCK_QUEUE_SIZE =128 , +}; + +typedef struct { +VirtIODevice parent; + +struct vhost_virtqueue vhost_vqs[2 ]; +struct vhost_dev vhost_dev; + +VirtQueue *event_vq; +VirtQueue *recv_vq; +VirtQueue *trans_vq; + +QEMUTimer *post_load_timer; +}VHostVSockCommon ; + +int vhost_vsock_common_start (VirtIODevice *vdev); +void vhost_vsock_common_stop (VirtIODevice *vdev); +int vhost_vsock_common_pre_save (void *opaque); +int vhost_vsock_common_post_load (void *opaque,int version_id); +void vhost_vsock_common_realize (VirtIODevice *vdev,const char *name); +void vhost_vsock_common_unrealize (VirtIODevice *vdev); + +#endif /* _QEMU_VHOST_VSOCK_COMMON_H */
include/hw/virtio/vhost-vsock.h +2 -9
@@ -14,8 +14,7 @@#ifndef QEMU_VHOST_VSOCK_H #define QEMU_VHOST_VSOCK_H -#include "hw/virtio/virtio.h" -#include "hw/virtio/vhost.h" +#include "hw/virtio/vhost-vsock-common.h" #define TYPE_VHOST_VSOCK "vhost-vsock-device"#define VHOST_VSOCK (obj) \
@@ -28,14 +27,8 @@ typedef struct {typedef struct {/*< private >*/ -VirtIODevice parent; +VHostVSockCommon parent;VHostVSockConf conf; -struct vhost_virtqueue vhost_vqs[2 ]; -struct vhost_dev vhost_dev; -VirtQueue *event_vq; -VirtQueue *recv_vq; -VirtQueue *trans_vq; -QEMUTimer *post_load_timer;/*< public >*/ }VHostVSock ;
hw/virtio/vhost-vsock-common.c new file +258 -0
258 lines not on this page · raw message
hw/virtio/vhost-vsock.c +42 -241
409 lines not on this page · raw message
hw/virtio/Makefile.objs +1 -1
@@ -17,7 +17,7 @@ obj-$(CONFIG_VIRTIO_PMEM) += virtio-pmem.o common-obj-$(call land,$(CONFIG_VIRTIO_PMEM),$(CONFIG_VIRTIO_PCI)) += virtio-pmem-pci.o obj-$(call land,$(CONFIG_VHOST_USER_FS),$(CONFIG_VIRTIO_PCI)) += vhost-user-fs-pci.o obj-$(CONFIG_VIRTIO_IOMMU) += virtio-iommu.o -obj-$(CONFIG_VHOST_VSOCK) += vhost-vsock.o +obj-$(CONFIG_VHOST_VSOCK) += vhost-vsock-common.o vhost-vsock.o ifeq ($(CONFIG_VIRTIO_PCI),y) obj-$(CONFIG_VHOST_VSOCK) += vhost-vsock-pci.o
Signature · 1 line
MST
[PULL 43/56] Support adding individual regions in libvhost-user
In reply to Michael S. TsirkinFrom: Raphael Norwitz <[email protected]>
When the VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS is enabled, qemu will transmit memory regions to a backend individually using the new message VHOST_USER_ADD_MEM_REG. With this change vhost-user backends built with libvhost-user can now map in new memory regions when VHOST_USER_ADD_MEM_REG messages are received.
Qemu only sends VHOST_USER_ADD_MEM_REG messages when the VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS feature is negotiated, and since it is not yet supported in libvhost-user, this new functionality is not yet used.
Message-Id: <[email protected]>
--- contrib/libvhost-user/libvhost-user.h | 7 ++ contrib/libvhost-user/libvhost-user.c | 103 ++++++++++++++++++++++++++ 2 files changed, 110 insertions(+)
contrib/libvhost-user/libvhost-user.h +7 -0
@@ -98,6 +98,7 @@ typedef enum VhostUserRequest {VHOST_USER_GPU_SET_SOCKET =33 ,VHOST_USER_VRING_KICK =35 ,VHOST_USER_GET_MAX_MEM_SLOTS =36 , +VHOST_USER_ADD_MEM_REG =37 , VHOST_USER_MAX } VhostUserRequest;
@@ -124,6 +125,11 @@ typedef struct VhostUserMemory {VhostUserMemoryRegion regions[VHOST_MEMORY_MAX_NREGIONS ]; } VhostUserMemory; +typedef struct VhostUserMemRegMsg { +uint32_t padding; +VhostUserMemoryRegion region; +}VhostUserMemRegMsg ; + typedef struct VhostUserLog { uint64_t mmap_size; uint64_t mmap_offset;
@@ -176,6 +182,7 @@ typedef struct VhostUserMsg {struct vhost_vring_state state;struct vhost_vring_addr addr;VhostUserMemory memory; +VhostUserMemRegMsg memreg;VhostUserLog log;VhostUserConfig config;VhostUserVringArea area;
contrib/libvhost-user/libvhost-user.c +103 -0
121 lines not on this page · raw message
Signature · 1 line
MST
[PULL 54/56] acpi: fadt: add hw-reduced sleep register support
In reply to Michael S. TsirkinFrom: Gerd Hoffmann <[email protected]>
Add fields to struct AcpiFadtData and update build_fadt() to properly generate sleep register entries.
Message-Id: <[email protected]>
--- include/hw/acpi/acpi-defs.h | 2 ++ hw/acpi/aml-build.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-)
include/hw/acpi/acpi-defs.h +2 -0
@@ -88,6 +88,8 @@ typedef struct AcpiFadtData {struct AcpiGenericAddress pm_tmr;/* PM_TMR_BLK */ struct AcpiGenericAddress gpe0_blk;/* GPE0_BLK */ struct AcpiGenericAddress reset_reg;/* RESET_REG */ +struct AcpiGenericAddress sleep_ctl;/* SLEEP_CONTROL_REG */ +struct AcpiGenericAddress sleep_sts;/* SLEEP_STATUS_REG */ uint8_t reset_val;/* RESET_VALUE */ uint8_t rev;/* Revision */ uint32_t flags;/* Flags */
hw/acpi/aml-build.c +2 -2
@@ -1866,9 +1866,9 @@ void build_fadt(GArray *tbl, BIOSLinker *linker, const AcpiFadtData *f, }/* SLEEP_CONTROL_REG */ -build_append_gas (tbl,AML_AS_SYSTEM_MEMORY ,0 ,0 ,0 ,0 ); +build_append_gas_from_struct (tbl, &f->sleep_ctl);/* SLEEP_STATUS_REG */ -build_append_gas (tbl,AML_AS_SYSTEM_MEMORY ,0 ,0 ,0 ,0 ); +build_append_gas_from_struct (tbl, &f->sleep_sts);/* TODO: extra fields need to be added to support revisions above rev5 */ assert (f->rev ==5 );
Signature · 1 line
MST
[PULL 52/56] acpi: create acpi-common.c and move madt code
In reply to Michael S. TsirkinFrom: Gerd Hoffmann <[email protected]>
We'll need madt support for microvm.
Message-Id: <[email protected]>
--- hw/i386/acpi-common.h | 14 ++++ hw/i386/acpi-build.c | 126 +--------------------------------- hw/i386/acpi-common.c | 152 ++++++++++++++++++++++++++++++++++++++++++ hw/i386/Makefile.objs | 1 + 4 files changed, 170 insertions(+), 123 deletions(-) create mode 100644 hw/i386/acpi-common.h create mode 100644 hw/i386/acpi-common.c
hw/i386/acpi-common.h new file +14 -0
@@ -0,0 +1,14 @@ +#ifndef HW_I386_ACPI_COMMON_H +#define HW_I386_ACPI_COMMON_H +#include "include/hw/acpi/acpi_dev_interface.h" + +#include "include/hw/acpi/bios-linker-loader.h" +#include "include/hw/i386/x86.h" + +/* Default IOAPIC ID */ +#define ACPI_BUILD_IOAPIC_ID 0x0 + +void acpi_build_madt (GArray *table_data,BIOSLinker *linker, +X86MachineState *x86ms,AcpiDeviceIf *adev); + +#endif
hw/i386/acpi-build.c +3 -123
150 lines not on this page · raw message
hw/i386/acpi-common.c new file +152 -0
152 lines not on this page · raw message
hw/i386/Makefile.objs +1 -0
@@ -16,4 +16,5 @@ obj-$(CONFIG_VMMOUSE) += vmmouse.o obj-$(CONFIG_PC) += port92.o obj-y += kvmvapic.o +obj-$(CONFIG_ACPI) += acpi-common.o obj-$(CONFIG_PC) += acpi-build.o
Signature · 1 line
MST
[PULL 49/56] virtio: add vhost-user-vsock base device
In reply to Michael S. TsirkinFrom: Stefano Garzarella <[email protected]>
This patch introduces a vhost-user device for vsock, using the vhost-vsock-common parent class.
The vhost-user-vsock device can be used to implement the virtio-vsock device emulation in user-space.
Message-Id: <[email protected]>
--- configure | 3 + include/hw/virtio/vhost-user-vsock.h | 36 ++++++ hw/virtio/vhost-user-vsock.c | 181 +++++++++++++++++++++++++++ hw/virtio/Makefile.objs | 1 + 4 files changed, 221 insertions(+) create mode 100644 include/hw/virtio/vhost-user-vsock.h create mode 100644 hw/virtio/vhost-user-vsock.c
configure +3 -0
@@ -7196,6 +7196,9 @@ if test "$vhost_crypto" = "yes" ; then fi if test "$vhost_vsock" = "yes" ; then echo "CONFIG_VHOST_VSOCK=y" >> $config_host_mak + if test "$vhost_user" = "yes" ; then + echo "CONFIG_VHOST_USER_VSOCK=y" >> $config_host_mak + fi fi if test "$vhost_kernel" = "yes" ; then echo "CONFIG_VHOST_KERNEL=y" >> $config_host_mak
include/hw/virtio/vhost-user-vsock.h new file +36 -0
@@ -0,0 +1,36 @@ +/* +* Vhost-user vsock virtio device +* +* Copyright 2020 Red Hat, Inc. +* +* This work is licensed under the terms of the GNU GPL, version 2 or +* (at your option) any later version. See the COPYING file in the +* top-level directory. +*/ + +#ifndef _QEMU_VHOST_USER_VSOCK_H +#define _QEMU_VHOST_USER_VSOCK_H + +#include "hw/virtio/vhost-vsock-common.h" +#include "hw/virtio/vhost-user.h" +#include "standard-headers/linux/virtio_vsock.h" + +#define TYPE_VHOST_USER_VSOCK "vhost-user-vsock-device" +#define VHOST_USER_VSOCK (obj) \ + OBJECT_CHECK(VHostUserVSock, (obj), TYPE_VHOST_USER_VSOCK) + +typedef struct { +CharBackend chardev; +}VHostUserVSockConf ; + +typedef struct { +/*< private >*/ +VHostVSockCommon parent; +VhostUserState vhost_user; +VHostUserVSockConf conf; +struct virtio_vsock_config vsockcfg; + +/*< public >*/ +}VHostUserVSock ; + +#endif /* _QEMU_VHOST_USER_VSOCK_H */
hw/virtio/vhost-user-vsock.c new file +181 -0
181 lines not on this page · raw message
hw/virtio/Makefile.objs +1 -0
@@ -18,6 +18,7 @@ common-obj-$(call land,$(CONFIG_VIRTIO_PMEM),$(CONFIG_VIRTIO_PCI)) += virtio-pme obj-$(call land,$(CONFIG_VHOST_USER_FS),$(CONFIG_VIRTIO_PCI)) += vhost-user-fs-pci.o obj-$(CONFIG_VIRTIO_IOMMU) += virtio-iommu.o obj-$(CONFIG_VHOST_VSOCK) += vhost-vsock-common.o vhost-vsock.o +obj-$(CONFIG_VHOST_USER_VSOCK) += vhost-vsock-common.o vhost-user-vsock.o ifeq ($(CONFIG_VIRTIO_PCI),y) obj-$(CONFIG_VHOST_VSOCK) += vhost-vsock-pci.o
Signature · 1 line
MST
[PULL 51/56] acpi: make build_madt() more generic.
In reply to Michael S. TsirkinFrom: Gerd Hoffmann <[email protected]>
Remove PCMachineState dependency from build_madt(). Pass AcpiDeviceIf as separate argument instead of depending on PCMachineState->acpi_dev.
Message-Id: <[email protected]>
--- hw/i386/acpi-build.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
hw/i386/acpi-build.c +7 -7
@@ -366,14 +366,13 @@ void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid, }static void -build_madt (GArray *table_data,BIOSLinker *linker,PCMachineState *pcms) +build_madt (GArray *table_data,BIOSLinker *linker, +X86MachineState *x86ms,AcpiDeviceIf *adev) { -MachineClass *mc =MACHINE_GET_CLASS (pcms); -X86MachineState *x86ms =X86_MACHINE (pcms); -const CPUArchIdList *apic_ids = mc->possible_cpu_arch_ids (MACHINE (pcms)); +MachineClass *mc =MACHINE_GET_CLASS (x86ms); +const CPUArchIdList *apic_ids = mc->possible_cpu_arch_ids (MACHINE (x86ms));int madt_start = table_data->len; -AcpiDeviceIfClass *adevc =ACPI_DEVICE_IF_GET_CLASS (pcms->acpi_dev); -AcpiDeviceIf *adev =ACPI_DEVICE_IF (pcms->acpi_dev); +AcpiDeviceIfClass *adevc =ACPI_DEVICE_IF_GET_CLASS (adev);bool x2apic_mode = false;AcpiMultipleApicTable *madt;
@@ -2708,7 +2707,8 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine) aml_len += tables_blob->len - fadt;acpi_add_table (table_offsets, tables_blob); -build_madt (tables_blob, tables->linker, pcms); +build_madt (tables_blob, tables->linker, x86ms, +ACPI_DEVICE_IF (pcms->acpi_dev)); vmgenid_dev =find_vmgenid_dev ();if (vmgenid_dev) {
Signature · 1 line
MST
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series seems to have some coding style problems. See output below for more information:
Message-id: [email protected]
Subject: [PULL 00/56] virtio,acpi,pci: features, fixes, cleanups, tests
Type: series
=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===
Switched to a new branch 'test'
d576bce Fix parameter type in vhost migration log path
407b8ba acpi: ged: rename event memory region
16bfa7d acpi: fadt: add hw-reduced sleep register support
ae67c27 acpi: madt: skip pci override on pci-less systems. 11a424a acpi: create acpi-common.c and move madt code
a73a951 acpi: make build_madt() more generic.
099738a virtio: add vhost-user-vsock-pci device
bdcc4e1 virtio: add vhost-user-vsock base device
f93b9d9 vhost-vsock: add vhost-vsock-common abstraction
1d0d2b0 hw/pci: Fix crash when running QEMU with "-nic model=rocker" e97f21b libvhost-user: advertise vring features
c9cbf24 Lift max ram slots limit in libvhost-user
c078553 Support individual region unmap in libvhost-user
6147673 Support adding individual regions in libvhost-user c8397c5 Support ram slot configuration in libvhost-user
9822d5e Refactor out libvhost-user fault generation logic
e921ab7 Lift max memory slots limit imposed by vhost-user
09ca335 Transmit vhost-user memory regions individually
13a3dc9 Add VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS
c91a41b Add vhost-user helper to get MemoryRegion data
2f6982f Add helper to populate vhost-user message regions
19f8b13 vhost-user-blk: delay vhost_user_blk_disconnect
c6557a5 char-socket: return -1 in case of disconnect during tcp_chr_write a79e12d hw/pci-host: Use the IEC binary prefix definitions 8ba0569 hw/pci/pci_bridge: Use the IEC binary prefix definitions 7e178f0 hw/pci/pci_bridge: Correct pci_bridge_io memory region size 41172e1 hw/pci-host/prep: Correct RAVEN bus bridge memory region size 8e9a7fc pci: assert configuration access is within bounds
aee5e22 hw/pci/pcie: Move hot plug capability check to pre_plug callback e3d6bcd MAINTAINERS: Fix the classification of bios-tables-test-allowed-diff.h addb2d8 virtio-balloon: Provide an interface for free page reporting 58e79c3 virtio-balloon: Implement support for page poison reporting feature 9b8c6ad virtio-balloon: unref the iothread when unrealizing 3d3f806 virtio-balloon: fix free page hinting check on unrealize 45da3a2 virtio-balloon: fix free page hinting without an iothread 857aac0 bios-tables-test: Generate reference tables for Q35/TPM-TIS 54c3b28 bios-tables-test: Add Q35/TPM-TIS test
1d2aa0b tests: tpm-emu: Remove assert on TPM2_ST_NO_SESSIONS 643f2af tests/acpi: Add void tables for Q35/TPM-TIS bios-tables-test 8c175a8 test/tpm-emu: include sockets and channel headers in tpm-emu header dbe41ee arm/acpi: TPM2 ACPI table support
6c25384 acpi: Move build_tpm2() in the generic part
e86af8b acpi: Convert build_tpm2() to build_append* API
573d4d1 acpi: tpm: Do not build TCPA table for TPM 2
ed6dea0 tests/acpi: update DSDT expected files
43e78e3 acpi: move aml builder code for parallel device
8b99639 acpi: parallel: don't use _STA method
e988e2c acpi: move aml builder code for serial device
b4fd47f acpi: serial: don't use _STA method
9a41faa acpi: rtc: use a single crs range
db9b47b acpi: move aml builder code for rtc device
8196b48 qtest: allow DSDT acpi table changes
5eb90f3 tests/acpi: update expected SRAT files
2574d08 hw/acpi/nvdimm: add a helper to augment SRAT generation d8bb076 diffs-allowed: add the SRAT AML to diffs-allowed
7f549aa msix: allow qword MSI-X table accesses
=== OUTPUT BEGIN ===
1/56 Checking commit 7f549aaaca77 (msix: allow qword MSI-X table accesses)
2/56 Checking commit d8bb0767f522 (diffs-allowed: add the SRAT AML to diffs-allowed)
3/56 Checking commit 2574d08106f4 (hw/acpi/nvdimm: add a helper to augment SRAT generation)
4/56 Checking commit 5eb90f3537a2 (tests/acpi: update expected SRAT files)
ERROR: Do not add expected files together with tests, follow instructions in tests/qtest/bios-tables-test.c: both tests/data/acpi/virt/SRAT.memhp and tests/qtest/bios-tables-test-allowed-diff.h found
ERROR: Do not add expected files together with tests, follow instructions in tests/qtest/bios-tables-test.c: both tests/data/acpi/virt/SRAT.memhp and tests/qtest/bios-tables-test-allowed-diff.h found
total: 2 errors, 0 warnings, 1 lines checked
Patch 4/56 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
5/56 Checking commit 8196b48faf56 (qtest: allow DSDT acpi table changes)
6/56 Checking commit db9b47b1f65f (acpi: move aml builder code for rtc device)
7/56 Checking commit 9a41faa54f0b (acpi: rtc: use a single crs range)
8/56 Checking commit b4fd47f96aa3 (acpi: serial: don't use _STA method)
9/56 Checking commit e988e2c791df (acpi: move aml builder code for serial device)
10/56 Checking commit 8b99639ecac8 (acpi: parallel: don't use _STA method)
11/56 Checking commit 43e78e3585b1 (acpi: move aml builder code for parallel device)
12/56 Checking commit ed6dea02d93c (tests/acpi: update DSDT expected files)
ERROR: Do not add expected files together with tests, follow instructions in tests/qtest/bios-tables-test.c: both tests/data/acpi/q35/DSDT.numamem and tests/qtest/bios-tables-test-allowed-diff.h found
ERROR: Do not add expected files together with tests, follow instructions in tests/qtest/bios-tables-test.c: both tests/data/acpi/q35/DSDT.numamem and tests/qtest/bios-tables-test-allowed-diff.h found
total: 2 errors, 0 warnings, 1 lines checked
Patch 12/56 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
13/56 Checking commit 573d4d189a62 (acpi: tpm: Do not build TCPA table for TPM 2)
14/56 Checking commit e86af8b32744 (acpi: Convert build_tpm2() to build_append* API) 15/56 Checking commit 6c253844e61a (acpi: Move build_tpm2() in the generic part)
16/56 Checking commit dbe41eea9950 (arm/acpi: TPM2 ACPI table support)
17/56 Checking commit 8c175a85392c (test/tpm-emu: include sockets and channel headers in tpm-emu header) 18/56 Checking commit 643f2af46a3c (tests/acpi: Add void tables for Q35/TPM-TIS bios-tables-test)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#20:
new file mode 100644
ERROR: Do not add expected files together with tests, follow instructions in tests/qtest/bios-tables-test.c: both tests/data/acpi/q35/TPM2.tis and tests/qtest/bios-tables-test-allowed-diff.h found
ERROR: Do not add expected files together with tests, follow instructions in tests/qtest/bios-tables-test.c: both tests/data/acpi/q35/TPM2.tis and tests/qtest/bios-tables-test-allowed-diff.h found
total: 2 errors, 1 warnings, 3 lines checked
Patch 18/56 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
19/56 Checking commit 1d2aa0bd98d4 (tests: tpm-emu: Remove assert on TPM2_ST_NO_SESSIONS)
20/56 Checking commit 54c3b280c4b5 (bios-tables-test: Add Q35/TPM-TIS test)
21/56 Checking commit 857aac054da3 (bios-tables-test: Generate reference tables for Q35/TPM-TIS)
ERROR: Do not add expected files together with tests, follow instructions in tests/qtest/bios-tables-test.c: both tests/data/acpi/q35/TPM2.tis and tests/qtest/bios-tables-test-allowed-diff.h found
ERROR: Do not add expected files together with tests, follow instructions in tests/qtest/bios-tables-test.c: both tests/data/acpi/q35/TPM2.tis and tests/qtest/bios-tables-test-allowed-diff.h found
total: 2 errors, 0 warnings, 1 lines checked
Patch 21/56 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
22/56 Checking commit 45da3a28e701 (virtio-balloon: fix free page hinting without an iothread) 23/56 Checking commit 3d3f80629b86 (virtio-balloon: fix free page hinting check on unrealize) 24/56 Checking commit 9b8c6ad22004 (virtio-balloon: unref the iothread when unrealizing) 25/56 Checking commit 58e79c360bd0 (virtio-balloon: Implement support for page poison reporting feature) 26/56 Checking commit addb2d8b4b40 (virtio-balloon: Provide an interface for free page reporting) 27/56 Checking commit e3d6bcd4da5d (MAINTAINERS: Fix the classification of bios-tables-test-allowed-diff.h) 28/56 Checking commit aee5e22a9e1d (hw/pci/pcie: Move hot plug capability check to pre_plug callback) 29/56 Checking commit 8e9a7fc2ae4d (pci: assert configuration access is within bounds) 30/56 Checking commit 41172e1f19b2 (hw/pci-host/prep: Correct RAVEN bus bridge memory region size) 31/56 Checking commit 7e178f0f9fe6 (hw/pci/pci_bridge: Correct pci_bridge_io memory region size) 32/56 Checking commit 8ba05693bab8 (hw/pci/pci_bridge: Use the IEC binary prefix definitions) 33/56 Checking commit a79e12da3528 (hw/pci-host: Use the IEC binary prefix definitions) 34/56 Checking commit c6557a547f41 (char-socket: return -1 in case of disconnect during tcp_chr_write) 35/56 Checking commit 19f8b130db5b (vhost-user-blk: delay vhost_user_blk_disconnect)
36/56 Checking commit 2f6982f6a91f (Add helper to populate vhost-user message regions) 37/56 Checking commit c91a41b691ea (Add vhost-user helper to get MemoryRegion data)
38/56 Checking commit 13a3dc93e86d (Add VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS)
39/56 Checking commit 09ca3357119e (Transmit vhost-user memory regions individually)
40/56 Checking commit e921ab798d3c (Lift max memory slots limit imposed by vhost-user) 41/56 Checking commit 9822d5e6ce72 (Refactor out libvhost-user fault generation logic) 42/56 Checking commit c8397c5b40b0 (Support ram slot configuration in libvhost-user)
43/56 Checking commit 614767379269 (Support adding individual regions in libvhost-user) 44/56 Checking commit c078553f983c (Support individual region unmap in libvhost-user) 45/56 Checking commit c9cbf242b002 (Lift max ram slots limit in libvhost-user)
46/56 Checking commit e97f21bca095 (libvhost-user: advertise vring features)
47/56 Checking commit 1d0d2b05c136 (hw/pci: Fix crash when running QEMU with "-nic model=rocker") 48/56 Checking commit f93b9d9b5e5c (vhost-vsock: add vhost-vsock-common abstraction)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#33:
new file mode 100644
total: 0 errors, 1 warnings, 746 lines checked
Patch 48/56 has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
49/56 Checking commit bdcc4e100c04 (virtio: add vhost-user-vsock base device)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #46:
new file mode 100644
total: 0 errors, 1 warnings, 233 lines checked
Patch 49/56 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
50/56 Checking commit 099738ae667f (virtio: add vhost-user-vsock-pci device)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #33:
new file mode 100644
total: 0 errors, 1 warnings, 91 lines checked
Patch 50/56 has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
51/56 Checking commit a73a951a0609 (acpi: make build_madt() more generic.) 52/56 Checking commit 11a424ae7ffa (acpi: create acpi-common.c and move madt code)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #186:
new file mode 100644
WARNING: Block comments use a leading /* on a separate line #191: FILE: hw/i386/acpi-common.c:1:
+/* Support for generating ACPI tables and passing them to Guests
WARNING: Block comments use a leading /* on a separate line #231: FILE: hw/i386/acpi-common.c:41:
+ /* ACPI spec says that LAPIC entry for non present
ERROR: spaces required around that '<<' (ctx:VxV)
#305: FILE: hw/i386/acpi-common.c:115:
+#define ACPI_BUILD_PCI_IRQS ((1<<5) | (1<<9) | (1<<10) | (1<<11))
^
ERROR: spaces required around that '<<' (ctx:VxV)
#305: FILE: hw/i386/acpi-common.c:115:
+#define ACPI_BUILD_PCI_IRQS ((1<<5) | (1<<9) | (1<<10) | (1<<11))
^
ERROR: spaces required around that '<<' (ctx:VxV)
#305: FILE: hw/i386/acpi-common.c:115:
+#define ACPI_BUILD_PCI_IRQS ((1<<5) | (1<<9) | (1<<10) | (1<<11))
^
ERROR: spaces required around that '<<' (ctx:VxV)
#305: FILE: hw/i386/acpi-common.c:115:
+#define ACPI_BUILD_PCI_IRQS ((1<<5) | (1<<9) | (1<<10) | (1<<11))
^
total: 4 errors, 3 warnings, 321 lines checked
Patch 52/56 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
53/56 Checking commit ae67c27c1c0e (acpi: madt: skip pci override on pci-less systems.)
WARNING: line over 80 characters
#65: FILE: hw/i386/acpi-common.c:128:
+ intsrcovr->flags = cpu_to_le16(0xd); /* active high, level triggered */
total: 0 errors, 1 warnings, 56 lines checked
Patch 53/56 has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
54/56 Checking commit 16bfa7d84717 (acpi: fadt: add hw-reduced sleep register support) 55/56 Checking commit 407b8ba018f4 (acpi: ged: rename event memory region) 56/56 Checking commit d576bcee3ba3 (Fix parameter type in vhost migration log path) === OUTPUT END ===
Test command exited with code: 1
The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]
Quoted 23 lines · Michael S. Tsirkin
The following changes since commit
49ee11555262a256afec592dfed7c5902d5eefd2:/tmp/par8snSu.parMerge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-5.1-pull-request' into staging (2020-06-08 11:04:57 +0100)
are available in the Git repository at:
git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.gittags/for_upstreamfor you to fetch changes up to
23fe04b63b412276c7c2f67c550961af9d0b4e1e:Fix parameter type in vhost migration log path (2020-06-09 14:18:04 -0400)
----------------------------------------------------------------
virtio,acpi,pci: features, fixes, cleanups, testsMax slots negotiation for vhost-user.
Free page reporting for balloon.
Partial TPM2 ACPI support for ARM.
Support for NVDIMMs having their own proximity domains. New vhost-user-vsock device.
Quoted 4 lines
Fixes, cleanups in ACPI, PCI, virtio. New tests for TPM ACPI.
Signed-off-by Michael S. Tsirkin <[email protected]>
Hi; I'm afraid this has format string issues:
/Users/pm215/src/qemu-for-merges/hw/virtio/vhost-user.c:759:51: error:
format specifies type 'unsigned long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]
"%lX", __func__, reply_gpa,
^~~~~~~~~
/Users/pm215/src/qemu-for-merges/hw/virtio/vhost-user.c:760:34: error:
format specifies type 'unsigned long' but the argument has type
'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]
dev->mem->regions[reg_idx].guest_phys_addr);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/Users/pm215/src/qemu-for-merges/hw/virtio/vhost-user.c:1876:67:
error: format specifies type 'unsigned long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]
"This limit should never decrease.", ram_slots,
^~~~~~~~~
(repros on OSX, OpenBSD, and 32-bit hosts)
thanks
-- PMM
Quoted 47 lines · Peter Maydell
Quoted 23 lines · Michael S. Tsirkin
The following changes since commit
49ee11555262a256afec592dfed7c5902d5eefd2:/tmp/par8snSu.parMerge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-5.1-pull-request' into staging (2020-06-08 11:04:57 +0100)
are available in the Git repository at:
git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.gittags/for_upstreamfor you to fetch changes up to
23fe04b63b412276c7c2f67c550961af9d0b4e1e:Fix parameter type in vhost migration log path (2020-06-09 14:18:04 -0400)
----------------------------------------------------------------
virtio,acpi,pci: features, fixes, cleanups, testsMax slots negotiation for vhost-user.
Free page reporting for balloon.
Partial TPM2 ACPI support for ARM.
Support for NVDIMMs having their own proximity domains. New vhost-user-vsock device.Quoted 4 lines
Fixes, cleanups in ACPI, PCI, virtio. New tests for TPM ACPI.
Signed-off-by Michael S. Tsirkin <[email protected]>Hi; I'm afraid this has format string issues:
/Users/pm215/src/qemu-for-merges/hw/virtio/vhost-user.c:759:51: error:
format specifies type 'unsigned long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]"%lX", __func__, reply_gpa, ^~~~~~~~~ /Users/pm215/src/qemu-for-merges/hw/virtio/vhost-user.c:760:34: error: format specifies type 'unsigned long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat] dev->mem->regions[reg_idx].guest_phys_addr); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/Users/pm215/src/qemu-for-merges/hw/virtio/vhost-user.c:1876:67:
error: format specifies type 'unsigned long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]
"This limit should never decrease.",ram_slots,
^~~~~~~~~
Quoted 4 lines
(repros on OSX, OpenBSD, and 32-bit hosts)
thanks
-- PMM
Fixed and sent v2, thanks!
Signature · 1 line
MST