pc,vhost,virtio fixes, test
[Qemu-devel] [PULL 4/7] qtest: fix vhost-user-test compilation with old GLib
In reply to Michael S. TsirkinFrom: Nikolay Nikolaev <[email protected]>
Mising G_TIME_SPAN_SECOND definition breaks the RHEL6 compilation as GLib version before 2.26 does not have it. In such case just define it.
--- tests/vhost-user-test.c | 4 ++++ 1 file changed, 4 insertions(+)
tests/vhost-user-test.c +4 -0
@@ -22,6 +22,10 @@#include <qemu/sockets.h> /* GLIB version compatibility flags */ +#if !GLIB_CHECK_VERSION (2 ,26 ,0 ) +#define G_TIME_SPAN_SECOND (G_GINT64_CONSTANT(1000000)) +#endif +#if GLIB_CHECK_VERSION (2 ,28 ,0 )#define HAVE_MONOTONIC_TIME #endif
Signature · 1 line
MST
The following changes since commit 3f0838ab8557c6071a5931183b2d7fed568cd35c:
qemu-char: add chr_add_watch support in mux chardev (2014-07-06 09:13:54 +0300)
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 cd98639f673d92836b6b5fd60279b411748f2f1e:
vhost-user: minor cleanups (2014-07-18 02:22:24 +0300)
----------------------------------------------------------------
pc,vhost,virtio fixes, test
Bugfixes all over the place.
There's a non bugfix here: re-enabling the vhost-user test, though the patch just brings back functionality that I disabled earlier to fix mingw build failures. This is now sorted, and keeping the unit test enabled seems important since the feature relies on an external server to work, so isn't easy to test.
----------------------------------------------------------------
Eduardo Habkost (1):
pc_piix: Reuse pc_compat_1_2() for pc-0.1[0123]
Hu Tao (1):
fix typo: apci -> acpi
Igor Mammedov (1):
pc: fix qemu exiting with error when -m X < 128 with old machines types
Michael S. Tsirkin (1):
vhost-user: minor cleanups
Nikolay Nikolaev (3):
qtest: fix vhost-user-test compilation with old GLib
vhost-user: Fix VHOST_SET_MEM_TABLE processing
qtest: Adapt vhost-user-test to latest vhost-user changes
hw/acpi/ich9.c | 4 ++-- hw/i386/pc_piix.c | 13 ++----------- hw/virtio/vhost-user.c | 6 +++++- tests/vhost-user-test.c | 15 +++++++++++++-- vl.c | 1 + 5 files changed, 23 insertions(+), 16 deletions(-)
[Qemu-devel] [PULL 1/7] pc: fix qemu exiting with error when -m X < 128 with old machines types
From: Igor Mammedov <[email protected]>
If machine doesn't support memory hotplug then staring QEMU with initial memory less than default will make QEMU exit with following error message:
$QEMU -m 16 -M isapc
qemu-system-i386: "-memory 'slots|maxmem'" is not supported by: isapc
Set maxram_size to initial memory value before parsing 'maxmem' option allows to keep maxmem in sync with initial memory size if no maxmem option was specified.
--- vl.c | 1 + 1 file changed, 1 insertion(+)
vl.c +1 -0
@@ -3315,6 +3315,7 @@ int main(int argc, char **argv, char **envp)error_report ("ram size too large" );exit (EXIT_FAILURE ); } + maxram_size = ram_size; maxmem_str =qemu_opt_get (opts,"maxmem" ); slots_str =qemu_opt_get (opts,"slots" );
Signature · 1 line
MST
[Qemu-devel] [PULL 2/7] pc_piix: Reuse pc_compat_1_2() for pc-0.1[0123]
In reply to Michael S. TsirkinFrom: Eduardo Habkost <[email protected]>
pc-0.13 and older were missing some compat code that was present on newer machine-types:
* x86_cpu_compat_disable_kvm_features(FEAT_1_ECX, CPUID_EXT_X2APIC); (pc-i440fx-1.7 and older)
(added by commit ef02ef5f4536dba090b12360a6c862ef0e57e3bc)
* x86_cpu_compat_set_features("n270", FEAT_1_ECX, 0, CPUID_EXT_MOVBE); (pc-i440fx-1.4 and older)
(added by commit 4458c23672904fa131e69897007eeb7c953be7e5
* x86_cpu_compat_set_features("Westmere", FEAT_1_ECX, 0, CPUID_EXT_PCLMULQDQ); (pc-i440fx-1.4 and older)
(added by commit 56383703c060777fd01aaf8d63d5f46d660e9fb9)
Instead of duplicating the code from the previous pc_compat_*() functions, we can now reuse pc_compat_1_2() and fix those issues.
--- hw/i386/pc_piix.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-)
hw/i386/pc_piix.c +2 -11
@@ -386,19 +386,10 @@ static void pc_init_pci_1_2(MachineState *machine)pc_init_pci (machine); } -/* PC init function for pc-0.10 to pc-0.13, and reused by xenfv */ +/* PC init function for pc-0.10 to pc-0.13 */ static void pc_init_pci_no_kvmclock (MachineState *machine) { - has_pci_info = false; - has_acpi_build = false; - smbios_defaults = false; - gigabyte_align = false; - smbios_legacy_mode = true; - has_reserved_memory = false; - option_rom_has_mr = true; - rom_file_has_mr = false; -x86_cpu_compat_disable_kvm_features (FEAT_KVM ,KVM_FEATURE_PV_EOI ); -enable_compat_apic_id_mode (); +pc_compat_1_2 (machine);pc_init1 (machine,1 ,0 ); }
Signature · 1 line
MST
[Qemu-devel] [PULL 3/7] fix typo: apci -> acpi
In reply to Michael S. TsirkinFrom: Hu Tao <[email protected]>
MST: rebase
--- hw/acpi/ich9.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/acpi/ich9.c +2 -2
@@ -232,11 +232,11 @@ void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm,acpi_gpe_init (&pm->acpi_regs,ICH9_PMIO_GPE0_LEN );memory_region_init_io (&pm->io_gpe,OBJECT (lpc_pci), &ich9_gpe_ops, pm, -"apci-gpe0" ,ICH9_PMIO_GPE0_LEN ); +"acpi-gpe0" ,ICH9_PMIO_GPE0_LEN );memory_region_add_subregion (&pm->io,ICH9_PMIO_GPE0_STS , &pm->io_gpe);memory_region_init_io (&pm->io_smi,OBJECT (lpc_pci), &ich9_smi_ops, pm, -"apci-smi" ,8 ); +"acpi-smi" ,8 );memory_region_add_subregion (&pm->io,ICH9_PMIO_SMI_EN , &pm->io_smi); pm->irq = sci_irq;
Signature · 1 line
MST
[Qemu-devel] [PULL 6/7] qtest: Adapt vhost-user-test to latest vhost-user changes
In reply to Michael S. TsirkinFrom: Nikolay Nikolaev <[email protected]>
A new field mmap_offset was added in the vhost-user message, we need to reflect this change in the test too.
--- tests/vhost-user-test.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
tests/vhost-user-test.c +9 -2
@@ -76,6 +76,7 @@ typedef struct VhostUserMemoryRegion {uint64_t guest_phys_addr;uint64_t memory_size;uint64_t userspace_addr; +uint64_t mmap_offset; } VhostUserMemoryRegion; typedef struct VhostUserMemory {
@@ -205,6 +206,7 @@ static void read_guest_mem(void)uint32_t *guest_mem;gint64 end_time;int i, j; +size_t size;g_mutex_lock (data_mutex);
@@ -231,8 +233,13 @@ static void read_guest_mem(void) g_assert_cmpint(memory.regions[i].memory_size, >, 1024); - guest_mem =mmap (0 , memory.regions[i].memory_size, -PROT_READ |PROT_WRITE ,MAP_SHARED , fds[i],0 ); + size = memory.regions[i].memory_size + memory.regions[i].mmap_offset; + + guest_mem =mmap (0 , size,PROT_READ |PROT_WRITE , +MAP_SHARED , fds[i],0 ); + +g_assert (guest_mem !=MAP_FAILED ); + guest_mem += (memory.regions[i].mmap_offset /sizeof (*guest_mem));for (j =0 ; j <256 ; j++) {uint32_t a =readl (memory.regions[i].guest_phys_addr + j*4 );
Signature · 1 line
MST
[Qemu-devel] [PULL 7/7] vhost-user: minor cleanups
In reply to Michael S. Tsirkinassert to verify cast does not discard information minor style fixup.
--- hw/virtio/vhost-user.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
hw/virtio/vhost-user.c +3 -1
@@ -217,7 +217,9 @@ static int vhost_user_call(struct vhost_dev *dev, unsigned long int request,for (i =0 ; i < dev->mem->nregions; ++i) {struct vhost_memory_region *reg = dev->mem->regions + i;ram_addr_t ram_addr; -qemu_ram_addr_from_host ((void *)reg->userspace_addr, &ram_addr); + +assert ((uintptr_t )reg->userspace_addr == reg->userspace_addr); +qemu_ram_addr_from_host ((void *)(uintptr_t )reg->userspace_addr, &ram_addr); fd =qemu_get_ram_fd (ram_addr);if (fd >0 ) { msg.memory.regions[fd_num].userspace_addr = reg->userspace_addr;
Signature · 1 line
MST
[Qemu-devel] [PULL 5/7] vhost-user: Fix VHOST_SET_MEM_TABLE processing
In reply to Michael S. TsirkinFrom: Nikolay Nikolaev <[email protected]>
qemu_get_ram_fd doesn't accept a guest physical address. ram_addr_t are opaque values that are assigned in qemu_ram_alloc.
Find the ram_addr_t corresponding to the userspace_addr using qemu_ram_addr_from_host, and then call qemu_get_ram_fd on it.
Thanks to Paolo Bonzini <[email protected]>
--- hw/virtio/vhost-user.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
hw/virtio/vhost-user.c +3 -1
@@ -216,7 +216,9 @@ static int vhost_user_call(struct vhost_dev *dev, unsigned long int request,case VHOST_SET_MEM_TABLE :for (i =0 ; i < dev->mem->nregions; ++i) {struct vhost_memory_region *reg = dev->mem->regions + i; - fd =qemu_get_ram_fd (reg->guest_phys_addr); +ram_addr_t ram_addr; +qemu_ram_addr_from_host ((void *)reg->userspace_addr, &ram_addr); + fd =qemu_get_ram_fd (ram_addr);if (fd >0 ) { msg.memory.regions[fd_num].userspace_addr = reg->userspace_addr; msg.memory.regions[fd_num].memory_size = reg->memory_size;
Signature · 1 line
MST