[PATCH v7 11/12] multifd: Zero pages transmission

2022-08-02 Thread Juan Quintela
This implements the zero page dection and handling. Signed-off-by: Juan Quintela --- Add comment for offset (dave) Use local variables for offset/block to have shorter lines --- migration/multifd.h | 5 + migration/multifd.c | 41 +++-- 2 files

[PATCH for-7.1] Revert "migration: Simplify unqueue_page()"

2022-08-02 Thread Thomas Huth
This reverts commit cfd66f30fb0f735df06ff4220e5000290a43dad3. The simplification of unqueue_page() introduced a bug that sometimes breaks migration on s390x hosts. Seems like there are still pages here that do not have their dirty bit set. The problem is not fully understood yet, but since we are

[PATCH v7 10/12] multifd: Support for zero pages transmission

2022-08-02 Thread Juan Quintela
This patch adds counters and similar. Logic will be added on the following patch. Signed-off-by: Juan Quintela --- Added counters for duplicated/non duplicated pages. Removed reviewed by from David. Add total_zero_pages --- migration/multifd.h| 17 - migration/multifd.c

[PATCH v7 07/12] multifd: Prepare to send a packet without the mutex held

2022-08-02 Thread Juan Quintela
We do the send_prepare() and the fill of the head packet without the mutex held. It will help a lot for compression and later in the series for zero pages. Notice that we can use p->pages without holding p->mutex because p->pending_job == 1. Signed-off-by: Juan Quintela ---

[PATCH v7 12/12] So we use multifd to transmit zero pages.

2022-08-02 Thread Juan Quintela
Signed-off-by: Juan Quintela --- - Check zero_page property before using new code (Dave) --- migration/migration.c | 4 +--- migration/multifd.c | 6 +++--- migration/ram.c | 33 - 3 files changed, 36 insertions(+), 7 deletions(-) diff --git

Re: [PATCH for-7.1] hw/mips/malta: turn off x86 specific features of PIIX4_PM

2022-08-02 Thread Philippe Mathieu-Daudé via
On 28/7/22 15:16, Igor Mammedov wrote: On Thu, 28 Jul 2022 13:29:07 +0100 Peter Maydell wrote: On Thu, 28 Jul 2022 at 12:50, Igor Mammedov wrote: QEMU crashes trying to save VMSTATE when only MIPS target are compiled in $ qemu-system-mips -monitor stdio (qemu) migrate "exec:gzip -c >

[PATCH v7 00/12] Migration: Transmit and detect zero pages in the multifd threads

2022-08-02 Thread Juan Quintela
Hi In this version: - rebase to latest upstream - convert multifd-zero-pages property into main-zero-page capability, because: * libvirt handles capabilities way easiert * capabilities are off by default, so I have to change the name * this way one can check if zero_page is enabled or not

Re: [PATCH v5 2/3] job: introduce dump guest memory job

2022-08-02 Thread Markus Armbruster
Hogan Wang writes: > There's no way to cancel the current executing dump process, lead to the > virtual machine manager daemon((e.g. libvirtd) cannot restore the dump > job after daemon restart. > > Introduce dump guest memory job type, and add an optional 'job-id' > argument for

Re: [PATCH 1/2] linux-user: Introduce stubs for ELF AT_BASE_PLATFORM

2022-08-02 Thread Philippe Mathieu-Daudé via
On 1/8/22 22:09, Jiaxun Yang wrote: AT_BASE_PLATFORM is a elf auxiliary vector pointing to a string to pass some architecture information. We can be more specific. "See getauxval(3) man-page." Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Jiaxun Yang --- linux-user/elfload.c | 29

[PATCH v7 08/12] multifd: Add capability to enable/disable zero_page

2022-08-02 Thread Juan Quintela
We have to enable it by default until we introduce the new code. Signed-off-by: Juan Quintela --- Change it to a capability. As capabilities are off by default, have to change MULTIFD_ZERO_PAGE to MAIN_ZERO_PAGE, so it is false for default, and true for older versions. ---

[PATCH v7 06/12] multifd: Make flags field thread local

2022-08-02 Thread Juan Quintela
Use of flags with respect to locking was incensistant. For the sending side: - it was set to 0 with mutex held on the multifd channel. - MULTIFD_FLAG_SYNC was set with mutex held on the migration thread. - Everything else was done without the mutex held on the multifd channel. On the reception

Re: [PATCH] target/mips: Advance pc after semihosting exception

2022-08-02 Thread Philippe Mathieu-Daudé via
Hi Richard, On 30/7/22 04:18, Richard Henderson wrote: Delay generating the exception until after we know the insn length, and record that length in env->error_code. Fixes: 8ec7e3c53d4 ("target/mips: Use an exception for semihosting") Resolves:

[PATCH v7 09/12] migration: Export ram_release_page()

2022-08-02 Thread Juan Quintela
Signed-off-by: Juan Quintela --- migration/ram.h | 1 + migration/ram.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/migration/ram.h b/migration/ram.h index e844966f69..038d52f49f 100644 --- a/migration/ram.h +++ b/migration/ram.h @@ -66,6 +66,7 @@ int

Re: [PATCH 0/2] linux-user: AT_BASE_PLATFORM for MIPS

2022-08-02 Thread Philippe Mathieu-Daudé via
On 1/8/22 22:09, Jiaxun Yang wrote: Hi all, This series properly filled AT_BASE_PLATFORM of MIPS. There is a checkpatch error about braces after if statement, I intentionally left it for style consistency. Thanks. - Jiaxun Jiaxun Yang (2): linux-user: Introduce stubs for ELF

[PATCH v7 01/12] multifd: Create page_size fields into both MultiFD{Recv, Send}Params

2022-08-02 Thread Juan Quintela
We were calling qemu_target_page_size() left and right. Signed-off-by: Juan Quintela --- migration/multifd.h | 4 migration/multifd-zlib.c | 14 ++ migration/multifd-zstd.c | 12 +--- migration/multifd.c | 18 -- 4 files changed, 23

[PATCH v7 03/12] migration: Export ram_transferred_ram()

2022-08-02 Thread Juan Quintela
Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert Reviewed-by: David Edmondson Signed-off-by: Juan Quintela --- migration/ram.h | 2 ++ migration/ram.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/migration/ram.h b/migration/ram.h index

Re: [PATCH 2/2] linux-user: Set ELF_BASE_PLATFORM for MIPS

2022-08-02 Thread Philippe Mathieu-Daudé via
On 1/8/22 22:09, Jiaxun Yang wrote: "On MIPS, AT_BASE_PLATFORM identifies the ISA level (since Linux 5.7)." Match most appropriate base platform string based on insn_flags. Logic is aligned with arch/mips/kernel/cpu-probe.c in Linux kernel. "... aligned with set_isa() from ..." Reviewed-by:

Re: [PATCH v3 1/1] monitor: Support specified vCPU registers

2022-08-02 Thread Markus Armbruster
zhenwei pi writes: > Originally we have to get all the vCPU registers and parse the > specified one. To improve the performance of this usage, allow user > specified vCPU id to query registers. > > Run a VM with 16 vCPU, use bcc tool to track the latency of > 'hmp_info_registers': > 'info

[PATCH v7 04/12] multifd: Count the number of bytes sent correctly

2022-08-02 Thread Juan Quintela
Current code asumes that all pages are whole. That is not true for example for compression already. Fix it for creating a new field ->sent_bytes that includes it. All ram_counters are used only from the migration thread, so we have two options: - put a mutex and fill everything when we sent it

[PATCH v7 02/12] multifd: Create page_count fields into both MultiFD{Recv, Send}Params

2022-08-02 Thread Juan Quintela
We were recalculating it left and right. We plan to change that values on next patches. Signed-off-by: Juan Quintela --- migration/multifd.h | 4 migration/multifd.c | 7 --- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/migration/multifd.h b/migration/multifd.h index

Re: [PATCH] hw/nvme: Add helper functions for qid-db conversion

2022-08-02 Thread Klaus Jensen
On Jul 28 16:07, Jinhao Fan wrote: > With the introduction of shadow doorbell and ioeventfd, we need to do > frequent conversion between qid and its doorbell offset. The original > hard-coded calculation is confusing and error-prone. Add several helper > functions to do this task. > >

[PATCH v7 05/12] migration: Make ram_save_target_page() a pointer

2022-08-02 Thread Juan Quintela
We are going to create a new function for multifd latest in the series. Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Juan Quintela --- migration/ram.c | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/migration/ram.c

[PATCH v1 09/40] i386/tdx: Update tdx_fixed0/1 bits by tdx_caps.cpuid_config[]

2022-08-02 Thread Xiaoyao Li
tdx_cpuid_lookup[].tdx_fixed0/1 is the QEMU maintained data which reflects TDX restrictions regrading how some CPUID is virtualized by TDX. It's retrieved from TDX spec. However, TDX may change some fixed fields to configurable in the future. Update tdx_cpuid.lookup[].tdx_fixed0/1 fields by

[PATCH v1 07/40] i386/tdx: Introduce is_tdx_vm() helper and cache tdx_guest object

2022-08-02 Thread Xiaoyao Li
It will need special handling for TDX VMs all around the QEMU. Introduce is_tdx_vm() helper to query if it's a TDX VM. Cache tdx_guest object thus no need to cast from ms->cgs every time. Signed-off-by: Xiaoyao Li --- target/i386/kvm/tdx.c | 13 + target/i386/kvm/tdx.h | 10

[PATCH v1 13/40] KVM: Introduce kvm_arch_pre_create_vcpu()

2022-08-02 Thread Xiaoyao Li
Introduce kvm_arch_pre_create_vcpu(), to perform arch-dependent work prior to create any vcpu. This is for i386 TDX because it needs call TDX_INIT_VM before creating any vcpu. Signed-off-by: Xiaoyao Li --- accel/kvm/kvm-all.c | 12 include/sysemu/kvm.h | 1 + 2 files changed, 13

[PATCH v1 14/40] i386/tdx: Initialize TDX before creating TD vcpus

2022-08-02 Thread Xiaoyao Li
Invoke KVM_TDX_INIT in kvm_arch_pre_create_vcpu() that KVM_TDX_INIT configures global TD state, e.g. the canonical CPUID config, and must be executed prior to creating vCPUs. Use kvm_x86_arch_cpuid() to setup the CPUID settings for TDX VM and tie x86cpu->enable_pmu with TD's attributes. Note,

[PATCH v4 2/4] util/qemu-sockets: Enable unix socket support on Windows

2022-08-02 Thread Bin Meng
From: Bin Meng Support for the unix socket has existed both in BSD and Linux for the longest time, but not on Windows. Since Windows 10 build 17063 [1], the native support for the unix socket has come to Windows. Starting this build, two Win32 processes can use the AF_UNIX address family over

Re: [PATCH v7 05/14] qapi: net: add stream and dgram netdevs

2022-08-02 Thread Markus Armbruster
Laurent Vivier writes: > Copied from socket netdev file and modified to use SocketAddress > to be able to introduce new features like unix socket. > > "udp" and "mcast" are squashed into dgram netdev, multicast is detected > according to the IP address type. > "listen" and "connect" modes are

[PATCH v4 3/4] chardev/char-socket: Update AF_UNIX for Windows

2022-08-02 Thread Bin Meng
From: Bin Meng Now that AF_UNIX has come to Windows, update the existing logic in qemu_chr_compute_filename() and qmp_chardev_open_socket() for Windows. Signed-off-by: Bin Meng Reviewed-by: Marc-André Lureau --- Changes in v4: - drop CONFIG_AF_UNIX Changes in v2: - drop #include as it is

Re: [PATCH] hw/nvme: Add helper functions for qid-db conversion

2022-08-02 Thread Jinhao Fan
at 2:02 PM, Klaus Jensen wrote: > On Jul 28 16:07, Jinhao Fan wrote: >> With the introduction of shadow doorbell and ioeventfd, we need to do >> frequent conversion between qid and its doorbell offset. The original >> hard-coded calculation is confusing and error-prone. Add several helper >>

[PATCH v1 36/40] i386/tdx: Don't synchronize guest tsc for TDs

2022-08-02 Thread Xiaoyao Li
From: Isaku Yamahata TSC of TDs is not accessible and KVM doesn't allow access of MSR_IA32_TSC for TDs. To avoid the assert() in kvm_get_tsc, make kvm_synchronize_all_tsc() noop for TDs, Signed-off-by: Isaku Yamahata Reviewed-by: Connor Kuehl Signed-off-by: Xiaoyao Li ---

Re: [PATCH v2 0/3] Fix some coverity issues on VDUSE

2022-08-02 Thread Kevin Wolf
Am 06.07.2022 um 11:56 hat Xie Yongji geschrieben: > This series fixes some issues reported by coverity. > > Patch 1 fixes a incorrect function name. > > Patch 2 fixes Coverity CID 1490224. > > Patch 3 fixes Coverity CID 1490226, 1490223. > > V1 to V2: > - Drop the patch to fix Coverity CID

Re: [PATCH] main loop: add missing documentation links to GS/IO macros

2022-08-02 Thread Kevin Wolf
Am 09.06.2022 um 14:22 hat Emanuele Giuseppe Esposito geschrieben: > If we go directly to GLOBAL_STATE_CODE, IO_CODE or IO_OR_GS_CODE > definition, we just find that they "mark and check that the function > is part of the {category} API". > However, ther is no definition on what {category} API is,

[PATCH v4 22/22] tests/qtest: enable tests for virtio-gpio

2022-08-02 Thread Alex Bennée
We don't have a virtio-gpio implementation in QEMU and only support a vhost-user backend. The QEMU side of the code is minimal so it should be enough to instantiate the device and pass some vhost-user messages over the control socket. To do this we hook into the existing vhost-user-test code and

Re: [PATCH] virtiofsd: Disable killpriv_v2 by default

2022-08-02 Thread Dr. David Alan Gilbert
* Vivek Goyal (vgo...@redhat.com) wrote: > We are having bunch of issues with killpriv_v2 enabled by default. First > of all it relies on clearing suid/sgid bits as needed by dropping > capability CAP_FSETID. This does not work for remote filesystems like > NFS (and possibly others). > >

Re: [PATCH] hw/nvme: Add helper functions for qid-db conversion

2022-08-02 Thread Klaus Jensen
On Aug 2 10:54, Klaus Jensen wrote: > On Aug 2 16:31, Jinhao Fan wrote: > > at 2:02 PM, Klaus Jensen wrote: > > > > > On Jul 28 16:07, Jinhao Fan wrote: > > >> With the introduction of shadow doorbell and ioeventfd, we need to do > > >> frequent conversion between qid and its doorbell offset.

[PATCH] tests/avocado: fix replay-linux test

2022-08-02 Thread Pavel Dovgalyuk
Last line of the test is missing by accident. This patch fixes the script. Signed-off-by: Pavel Dovgalyuk --- tests/avocado/replay_linux.py |1 + 1 file changed, 1 insertion(+) diff --git a/tests/avocado/replay_linux.py b/tests/avocado/replay_linux.py index 40e4f6908e..e1f9981a34 100644

[PATCH 2/2] vdpa: Merge all net_init_vhost_vdpa error goto

2022-08-02 Thread Eugenio Pérez
Few steps allocate new resources, and all of the allocated can be checked to avoid trying to free an invalid one. Signed-off-by: Eugenio Pérez --- net/vhost-vdpa.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index

Re: [PATCH 2/2] vdpa: Merge all net_init_vhost_vdpa error goto

2022-08-02 Thread Laurent Vivier
On 02/08/2022 13:24, Eugenio Pérez wrote: Few steps allocate new resources, and all of the allocated can be checked to avoid trying to free an invalid one. Signed-off-by: Eugenio Pérez --- net/vhost-vdpa.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git

[PATCH v1 03/40] target/i386: Implement mc->kvm_type() to get VM type

2022-08-02 Thread Xiaoyao Li
TDX VM requires VM type KVM_X86_TDX_VM to be passed to kvm_ioctl(KVM_CREATE_VM). Hence implement mc->kvm_type() for i386 architecture. If tdx-guest object is specified to confidential-guest-support, like, qemu -machine ...,confidential-guest-support=tdx0 \ -object tdx-guest,id=tdx0,...

[PATCH v1 04/40] target/i386: Introduce kvm_confidential_guest_init()

2022-08-02 Thread Xiaoyao Li
Introduce a separate function kvm_confidential_guest_init() for SEV (and future TDX). Signed-off-by: Xiaoyao Li Acked-by: Gerd Hoffmann --- target/i386/kvm/kvm.c | 11 ++- target/i386/sev.c | 1 - target/i386/sev.h | 2 ++ 3 files changed, 12 insertions(+), 2 deletions(-)

[PATCH v1 11/40] i386/tdx: Integrate tdx_caps->attrs_fixed0/1 to tdx_cpuid_lookup

2022-08-02 Thread Xiaoyao Li
Some bits in TD attributes have corresponding CPUID feature bits. Reflect the fixed0/1 restriction on TD attributes to their corresponding CPUID bits in tdx_cpuid_lookup[] as well. Signed-off-by: Xiaoyao Li --- target/i386/cpu-internal.h | 9 + target/i386/cpu.c | 9 -

[PATCH v1 23/40] i386/tdx: Don't initialize pc.rom for TDX VMs

2022-08-02 Thread Xiaoyao Li
For TDX, the address below 1MB are entirely general RAM. No need to initialize pc.rom memory region for TDs. Signed-off-by: Xiaoyao Li --- This is more as a workaround of the issue that for q35 machine type, the real memslot update (which requires memslot deletion )for pc.rom happens after

[PATCH v1 38/40] i386/tdx: Skip kvm_put_apicbase() for TDs

2022-08-02 Thread Xiaoyao Li
KVM doesn't allow wirting to MSR_IA32_APICBASE for TDs. Signed-off-by: Xiaoyao Li --- target/i386/kvm/kvm.c | 5 + 1 file changed, 5 insertions(+) diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index 53ab539e7e4d..948c87ebdb97 100644 --- a/target/i386/kvm/kvm.c +++

[PATCH v1 24/40] i386/tdx: Track mem_ptr for each firmware entry of TDVF

2022-08-02 Thread Xiaoyao Li
For each TDVF sections, QEMU needs to copy the content to guest private memory via KVM API (KVM_TDX_INIT_MEM_REGION). Introduce a field @mem_ptr for TdxFirmwareEntry to track the memory pointer of each TDVF sections. So that QEMU can add/copy them to guest private memory later. TDVF sections can

[PATCH v4 0/4] Enable unix socket support on Windows

2022-08-02 Thread Bin Meng
Support for the unix socket has existed both in BSD and Linux for the longest time, but not on Windows. Since Windows 10 build 17063 [1], the native support for the unix socket has come to Windows. Starting this build, two Win32 processes can use the AF_UNIX address family over Winsock API to

[PATCH v1 34/40] hw/i386: add eoi_intercept_unsupported member to X86MachineState

2022-08-02 Thread Xiaoyao Li
Add a new bool member, eoi_intercept_unsupported, to X86MachineState with default value false. Set true for TDX VM. Inability to intercept eoi causes impossibility to emulate level triggered interrupt to be re-injected when level is still kept active. which affects interrupt controller emulation.

Re: [PATCH for-7.1] icount: Take iothread lock when running QEMU timers

2022-08-02 Thread Pavel Dovgalyuk
Tested-by: Pavel Dovgalyuk On 01.08.2022 19:45, Peter Maydell wrote: The function icount_prepare_for_run() is called with the iothread unlocked, but it can call icount_notify_aio_contexts() which will run qemu timer handlers. Those are supposed to be run only with the iothread lock held, so

[PATCH v1 30/40] i386/tdx: Finalize TDX VM

2022-08-02 Thread Xiaoyao Li
Invoke KVM_TDX_FINALIZE_VM to finalize the TD's measurement and make the TD vCPUs runnable once machine initialization is complete. Signed-off-by: Xiaoyao Li Acked-by: Gerd Hoffmann --- target/i386/kvm/tdx.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/target/i386/kvm/tdx.c

Re: [PATCH for-7.1] Revert "migration: Simplify unqueue_page()"

2022-08-02 Thread Dr. David Alan Gilbert
* Thomas Huth (th...@redhat.com) wrote: > On 02/08/2022 10.47, Dr. David Alan Gilbert wrote: > > * Thomas Huth (th...@redhat.com) wrote: > > > This reverts commit cfd66f30fb0f735df06ff4220e5000290a43dad3. > > > > > > The simplification of unqueue_page() introduced a bug that sometimes > > >

[PATCH v4 03/22] hw/virtio: handle un-configured shutdown in virtio-pci

2022-08-02 Thread Alex Bennée
The assert() protecting against leakage is a little aggressive and causes needless crashes if a device is shutdown without having been configured. In this case no descriptors are lost because none have been assigned. Signed-off-by: Alex Bennée Message-Id:

[PATCH v4 13/22] hw/virtio: add vhost-user-gpio-pci boilerplate

2022-08-02 Thread Alex Bennée
From: Viresh Kumar This allows is to instantiate a vhost-user-gpio device as part of a PCI bus. It is mostly boilerplate which looks pretty similar to the vhost-user-fs-pci device. Signed-off-by: Viresh Kumar Reviewed-by: Alex Bennée Message-Id:

[PATCH v4 16/22] tests/qtest: use qos_printf instead of g_test_message

2022-08-02 Thread Alex Bennée
The vhost-user tests respawn qos-test as a standalone process. As a result the gtester framework squashes all messages coming out of it which make it hard to debug. As the test does not care about asserting certain messages just convert the tests to use the direct qos_printf. Signed-off-by: Alex

[PATCH v4 20/22] tests/qtest: implement stub for VHOST_USER_GET_CONFIG

2022-08-02 Thread Alex Bennée
We don't implement the full solution because frankly none of the tests need to at the moment. We may end up re-implementing libvhostuser in the end. Signed-off-by: Alex Bennée --- tests/qtest/vhost-user-test.c | 13 + 1 file changed, 13 insertions(+) diff --git

Re: [PATCH v4 1/1] monitor: Support specified vCPU registers

2022-08-02 Thread Darren Kenny
This looks good to me... On Tuesday, 2022-08-02 at 15:37:20 +08, zhenwei pi wrote: > Originally we have to get all the vCPU registers and parse the > specified one. To improve the performance of this usage, allow user > specified vCPU id to query registers. > > Run a VM with 16 vCPU, use bcc tool

Re: [PATCH v4 4/4] tests/unit: Update test-io-channel-socket.c for Windows

2022-08-02 Thread Marc-André Lureau
Hi On Tue, Aug 2, 2022 at 1:21 PM Bin Meng wrote: > From: Bin Meng > > Change to dynamically include the test cases by checking AF_UNIX > availability using a new helper socket_check_afunix_support(). > With such changes testing on a Windows host can be covered as well. > > Signed-off-by: Bin

[PATCH v4 1/1] monitor: Support specified vCPU registers

2022-08-02 Thread zhenwei pi
Originally we have to get all the vCPU registers and parse the specified one. To improve the performance of this usage, allow user specified vCPU id to query registers. Run a VM with 16 vCPU, use bcc tool to track the latency of 'hmp_info_registers': 'info registers -a' uses about 3ms; 'info

[PATCH v1 08/40] i386/tdx: Adjust the supported CPUID based on TDX restrictions

2022-08-02 Thread Xiaoyao Li
According to Chapter "CPUID Virtualization" in TDX module spec, CPUID bits of TD can be classified into 6 types: 1 | As configured | configurable by VMM, independent of native value;

[PATCH v1 19/40] i386/tdx: Set kvm_readonly_mem_enabled to false for TDX VM

2022-08-02 Thread Xiaoyao Li
TDX only supports readonly for shared memory but not for private memory. In the view of QEMU, it has no idea whether a memslot is used as shared memory of private. Thus just mark kvm_readonly_mem_enabled to false to TDX VM for simplicity. Signed-off-by: Xiaoyao Li Acked-by: Gerd Hoffmann ---

[PATCH v1 39/40] i386/tdx: Don't get/put guest state for TDX VMs

2022-08-02 Thread Xiaoyao Li
From: Sean Christopherson Don't get/put state of TDX VMs since accessing/mutating guest state of production TDs is not supported. Note, it will be allowed for a debug TD. Corresponding support will be introduced when debug TD support is implemented in the future. Signed-off-by: Sean

[PATCH v1 16/40] i386/tdx: Wire CPU features up with attributes of TD guest

2022-08-02 Thread Xiaoyao Li
For QEMU VMs, PKS is configured via CPUID_7_0_ECX_PKS and PMU is configured by x86cpu->enable_pmu. Reuse the existing configuration interface for TDX VMs. Signed-off-by: Xiaoyao Li --- target/i386/kvm/tdx.c | 13 + 1 file changed, 13 insertions(+) diff --git a/target/i386/kvm/tdx.c

Re: [PATCH for-7.1] Revert "migration: Simplify unqueue_page()"

2022-08-02 Thread Dr. David Alan Gilbert
* Thomas Huth (th...@redhat.com) wrote: > This reverts commit cfd66f30fb0f735df06ff4220e5000290a43dad3. > > The simplification of unqueue_page() introduced a bug that sometimes > breaks migration on s390x hosts. Seems like there are still pages here > that do not have their dirty bit set. I

[PATCH v1 32/40] i386/tdx: Disable PIC for TDX VMs

2022-08-02 Thread Xiaoyao Li
Legacy PIC (8259) cannot be supported for TDX VMs since TDX module doesn't allow directly interrupt injection. Using posted interrupts for the PIC is not a viable option as the guest BIOS/kernel will not do EOI for PIC IRQs, i.e. will leave the vIRR bit set. Hence disable PIC for TDX VMs and

[PATCH] net/colo.c: Fix the pointer issuse reported by Coverity.

2022-08-02 Thread Zhang Chen
When enable the virtio-net-pci, guest network packet will load the vnet_hdr. In COLO status, the primary VM's network packet maybe redirect to another VM, it need filter-redirect enable the vnet_hdr flag at the same time, COLO-proxy will correctly parse the original network packet. If have any

[PATCH v1 33/40] i386/tdx: Don't allow system reset for TDX VMs

2022-08-02 Thread Xiaoyao Li
TDX CPU state is protected and thus vcpu state cann't be reset by VMM. Signed-off-by: Xiaoyao Li Acked-by: Gerd Hoffmann --- target/i386/kvm/kvm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index 1545b6f870f5..8c282122ed67

[PATCH v4 1/4] util/qemu-sockets: Replace the call to close a socket with closesocket()

2022-08-02 Thread Bin Meng
From: Bin Meng close() is a *nix function. It works on any file descriptor, and sockets in *nix are an example of a file descriptor. closesocket() is a Windows-specific function, which works only specifically with sockets. Sockets on Windows do not use *nix-style file descriptors, and socket()

[PATCH] docs/about/removed-features: Move the -soundhw into the right section

2022-08-02 Thread Thomas Huth
The note about the removal of '-soundhw' has been accidentally added to the section of removed "linux-user mode CPUs" ... it should reside in the section about removed "System emulator command line arguments" instead. Fixes: 039a68373c ("introduce -audio as a replacement for -soundhw")

Re: [PATCH 1/2] hw/arm/virt: Improve address assignment for highmem IO regions

2022-08-02 Thread Eric Auger
Hi Gavin, On 8/2/22 08:45, Gavin Shan wrote: > There are 3 highmem IO regions as below. They can be disabled in > two situations: (a) The specific region is disabled by user. (b) > The specific region doesn't fit in the PA space. However, the base > address and highest_gpa are still updated no

[PATCH v4 10/22] hw/virtio: move vm_running check to virtio_device_started

2022-08-02 Thread Alex Bennée
All the boilerplate virtio code does the same thing (or should at least) of checking to see if the VM is running before attempting to start VirtIO. Push the logic up to the common function to avoid getting a copy and paste wrong. Signed-off-by: Alex Bennée --- include/hw/virtio/virtio.h | 5

RE: [PATCH 0/1] Update vfio-user module to the latest

2022-08-02 Thread Zhang, Chen
> -Original Message- > From: Qemu-devel bounces+chen.zhang=intel@nongnu.org> On Behalf Of Jagannathan > Raman > Sent: Tuesday, August 2, 2022 9:24 AM > To: qemu-devel@nongnu.org > Cc: stefa...@gmail.com; berra...@redhat.com > Subject: [PATCH 0/1] Update vfio-user module to the

[PATCH v4 11/22] hw/virtio: move vhd->started check into helper and add FIXME

2022-08-02 Thread Alex Bennée
The `started` field is manipulated internally within the vhost code except for one place, vhost-user-blk via f5b22d06fb (vhost: recheck dev state in the vhost_migration_log routine). Mark that as a FIXME because it introduces a potential race. I think the referenced fix should be tracking its

[PATCH v4 15/22] tests/qtest: add a timeout for subprocess_run_one_test

2022-08-02 Thread Alex Bennée
Hangs have been observed in the tests and currently we don't timeout if a subprocess hangs. Rectify that. Signed-off-by: Alex Bennée Reviewed-by: Thomas Huth --- v3 - expand timeout to 180 at Thomas' suggestion v4 - fix merge conflict with earlier patch --- tests/qtest/qos-test.c | 2 +-

Re: [PATCH v1 01/40] *** HACK *** linux-headers: Update headers to pull in TDX API changes

2022-08-02 Thread Xiaoyao Li
On 8/2/2022 5:47 PM, Daniel P. Berrangé wrote: On Tue, Aug 02, 2022 at 03:47:11PM +0800, Xiaoyao Li wrote: Pull in recent TDX updates, which are not backwards compatible. It's just to make this series runnable. It will be updated by script scripts/update-linux-headers.sh once TDX

Re: [PATCH v2 06/15] qapi: move QEMU-specific dispatch code in monitor

2022-08-02 Thread Marc-André Lureau
Hi On Tue, Aug 2, 2022 at 3:04 PM Markus Armbruster wrote: > marcandre.lur...@redhat.com writes: > > > From: Marc-André Lureau > > > > Make QMP-dispatch code free from QEMU-specific OOB dispatch/async > > coroutine handling. This will allow to move the base code to > > qemu-common, and clear

Re: [PATCH v4 2/4] util/qemu-sockets: Enable unix socket support on Windows

2022-08-02 Thread Marc-André Lureau
On Tue, Aug 2, 2022 at 12:39 PM Bin Meng wrote: > From: Bin Meng > > Support for the unix socket has existed both in BSD and Linux for the > longest time, but not on Windows. Since Windows 10 build 17063 [1], > the native support for the unix socket has come to Windows. Starting > this build,

Re: Guest reboot issues since QEMU 6.0 and Linux 5.11

2022-08-02 Thread Fiona Ebner
Am 28.07.22 um 12:13 schrieb Yan Vugenfirer: > Hi Fabian, > > Can you save the dump file with QEMU monitor using dump-guest-memory or with > virsh dump? > Then you can use elf2dmp (compiled with QEMU and is found in “contrib” > folder) to covert the dump file to WinDbg format and examine the

[PATCH v4 0/1] monitor: Support specified vCPU registers

2022-08-02 Thread zhenwei pi
v3 -> v4: - Tweake a few document and output '\n' prefix. v2 -> v3: - Add more document in help info. - Use 'qemu_get_cpu()' to simplify code. v1 -> v2: - Typo fix in commit message. - Suggested by Darren, use '[-a|vcpu]' instead of '[-a] [vcpu]', becase only one of these may be specified

[PATCH v1 29/40] i386/tdx: Call KVM_TDX_INIT_VCPU to initialize TDX vcpu

2022-08-02 Thread Xiaoyao Li
TDX vcpu needs to be initialized by SEAMCALL(TDH.VP.INIT) and KVM provides vcpu level IOCTL KVM_TDX_INIT_VCPU for it. KVM_TDX_INIT_VCPU needs the address of the HOB as input. Invoke it for each vcpu after HOB list is created. Signed-off-by: Xiaoyao Li Acked-by: Gerd Hoffmann ---

[PATCH v1 21/40] i386/tdx: Parse TDVF metadata for TDX VM

2022-08-02 Thread Xiaoyao Li
TDX cannot support pflash device since it doesn't support read-only memslot and doesn't support emulation. Load TDVF(OVMF) with -bios option for TDs. When boot a TD, besides load TDVF to the address below 4G, it needs parse TDVF metadata. Signed-off-by: Xiaoyao Li Acked-by: Gerd Hoffmann ---

[PATCH v1 28/40] i386/tdx: Add TDVF memory via KVM_TDX_INIT_MEM_REGION

2022-08-02 Thread Xiaoyao Li
From: Isaku Yamahata TDVF firmware (CODE and VARS) needs to be added/copied to TD's private memory via KVM_TDX_INIT_MEM_REGION, as well as TD HOB and TEMP memory. Signed-off-by: Isaku Yamahata Signed-off-by: Xiaoyao Li Acked-by: Gerd Hoffmann --- Changes from RFC v4: - rename variable

Re: [PATCH for-7.1] Revert "migration: Simplify unqueue_page()"

2022-08-02 Thread Thomas Huth
On 02/08/2022 10.47, Dr. David Alan Gilbert wrote: * Thomas Huth (th...@redhat.com) wrote: This reverts commit cfd66f30fb0f735df06ff4220e5000290a43dad3. The simplification of unqueue_page() introduced a bug that sometimes breaks migration on s390x hosts. Seems like there are still pages here

Re: [PATCH v7 05/14] qapi: net: add stream and dgram netdevs

2022-08-02 Thread Laurent Vivier
On 02/08/2022 10:37, Markus Armbruster wrote: Laurent Vivier writes: ... diff --git a/qemu-options.hx b/qemu-options.hx index 79e00916a11f..170117e1adf0 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -2726,6 +2726,18 @@ DEF("netdev", HAS_ARG, QEMU_OPTION_netdev, "-netdev

Re: [PATCH] hw/block/hd-geometry: Do not override specified bios-chs-trans

2022-08-02 Thread Kevin Wolf
Am 07.07.2022 um 22:40 hat Lev Kujawski geschrieben: > For small disk images (<4 GiB), QEMU and SeaBIOS default to the > LARGE/ECHS disk translation method, but it is not uncommon for other > BIOS software to use LBA in these cases as well. Some operating > system boot loaders (e.g., NT 4) do not

[PATCH v4 07/22] hw/virtio: fix some coding style issues

2022-08-02 Thread Alex Bennée
Signed-off-by: Alex Bennée Acked-by: Jason Wang --- hw/virtio/vhost-user.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index c0b50deaf2..b7c13e7e16 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@

Re: [PATCH v1 00/40] TDX QEMU support

2022-08-02 Thread Daniel P . Berrangé
On Tue, Aug 02, 2022 at 03:47:10PM +0800, Xiaoyao Li wrote: > This is the first version that removes RFC tag since last RFC gots > several acked-by. Hope more people and reviewers can help review it. > > > This patch series aims to enable TDX support to allow creating and booting a > TD (TDX VM)

[PATCH v4 02/22] hw/virtio: gracefully handle unset vhost_dev vdev

2022-08-02 Thread Alex Bennée
I've noticed asserts firing because we query the status of vdev after a vhost connection is closed down. Rather than faulting on the NULL indirect just quietly reply false. Signed-off-by: Alex Bennée Message-Id: <20220726192150.2435175-8-alex.ben...@linaro.org> --- hw/virtio/vhost.c | 10

Re: [PATCH] qemu-iotests: Discard stderr when probing devices

2022-08-02 Thread Kevin Wolf
Am 05.06.2022 um 16:57 hat Cole Robinson geschrieben: > ./configure --enable-modules --enable-smartcard \ > --target-list=x86_64-softmmu,s390x-softmmu > make > cd build > QEMU_PROG=`pwd`/s390x-softmmu/qemu-system-s390x \ > ../tests/check-block.sh qcow2 > ... > ---

[PATCH v4 17/22] tests/qtest: catch unhandled vhost-user messages

2022-08-02 Thread Alex Bennée
We don't need to action every message but lets document the ones we are expecting to consume so future tests don't get confused about unhandled bits. Signed-off-by: Alex Bennée --- v1 - drop g_test_fail() when we get unexpected result, that just hangs v4 - include ring addresses in

Re: [PATCH] docs/about/removed-features: Move the -soundhw into the right section

2022-08-02 Thread Daniel P . Berrangé
On Tue, Aug 02, 2022 at 09:56:11AM +0200, Thomas Huth wrote: > The note about the removal of '-soundhw' has been accidentally added > to the section of removed "linux-user mode CPUs" ... it should reside > in the section about removed "System emulator command line arguments" > instead. > > Fixes:

Re: [PATCH v2 06/15] qapi: move QEMU-specific dispatch code in monitor

2022-08-02 Thread Markus Armbruster
marcandre.lur...@redhat.com writes: > From: Marc-André Lureau > > Make QMP-dispatch code free from QEMU-specific OOB dispatch/async > coroutine handling. This will allow to move the base code to > qemu-common, and clear other users from potential mis-ususe (QGA doesn't > have OOB or coroutine).

Re: [PATCH 1/2] vdpa: Fix file descriptor leak on get features error

2022-08-02 Thread Laurent Vivier
On 02/08/2022 13:24, Eugenio Pérez wrote: File descriptor vdpa_device_fd is not free in the case of returning error from vhost_vdpa_get_features. Fixing it by making all errors go to the same error path. Resolves: Coverity CID 1490785 Fixes: 8170ab3f43 ("vdpa: Extract get features part from

[PATCH v1 01/40] *** HACK *** linux-headers: Update headers to pull in TDX API changes

2022-08-02 Thread Xiaoyao Li
Pull in recent TDX updates, which are not backwards compatible. It's just to make this series runnable. It will be updated by script scripts/update-linux-headers.sh once TDX support is upstreamed in linux kernel. Signed-off-by: Xiaoyao Li Co-developed-by: Sean Christopherson

[PATCH v1 00/40] TDX QEMU support

2022-08-02 Thread Xiaoyao Li
This is the first version that removes RFC tag since last RFC gots several acked-by. Hope more people and reviewers can help review it. This patch series aims to enable TDX support to allow creating and booting a TD (TDX VM) with QEMU. It needs to work with corresponding KVM patch [1]. TDX

[PATCH v1 40/40] docs: Add TDX documentation

2022-08-02 Thread Xiaoyao Li
Add docs/system/i386/tdx.rst for TDX support, and add tdx in confidential-guest-support.rst Signed-off-by: Xiaoyao Li --- changes in v5: - add the restriction that kernel-irqchip must be split --- docs/system/confidential-guest-support.rst | 1 + docs/system/i386/tdx.rst |

[PATCH v1 18/40] i386/tdx: Implement user specified tsc frequency

2022-08-02 Thread Xiaoyao Li
Reuse "-cpu,tsc-frequency=" to get user wanted tsc frequency and call VM scope VM_SET_TSC_KHZ to set the tsc frequency of TD before KVM_TDX_INIT_VM. Besides, sanity check the tsc frequency to be in the legal range and legal granularity (required by TDX module). Signed-off-by: Xiaoyao Li ---

[PATCH v1 25/40] i386/tdx: Track RAM entries for TDX VM

2022-08-02 Thread Xiaoyao Li
The RAM of TDX VM can be classified into two types: - TDX_RAM_UNACCEPTED: default type of TDX memory, which needs to be accepted by TDX guest before it can be used and will be all-zeros after being accepted. - TDX_RAM_ADDED: the RAM that is ADD'ed to TD guest before running, and can

[PATCH v1 37/40] i386/tdx: Only configure MSR_IA32_UCODE_REV in kvm_init_msrs() for TDs

2022-08-02 Thread Xiaoyao Li
For TDs, only MSR_IA32_UCODE_REV in kvm_init_msrs() can be configured by VMM, while the features enumerated/controlled by other MSRs except MSR_IA32_UCODE_REV in kvm_init_msrs() are not under control of VMM. Only configure MSR_IA32_UCODE_REV for TDs. Signed-off-by: Xiaoyao Li Acked-by: Gerd

Re: [PATCH] hw/nvme: Add helper functions for qid-db conversion

2022-08-02 Thread Klaus Jensen
On Aug 2 16:31, Jinhao Fan wrote: > at 2:02 PM, Klaus Jensen wrote: > > > On Jul 28 16:07, Jinhao Fan wrote: > >> With the introduction of shadow doorbell and ioeventfd, we need to do > >> frequent conversion between qid and its doorbell offset. The original > >> hard-coded calculation is

[PATCH v1 31/40] i386/tdx: Disable SMM for TDX VMs

2022-08-02 Thread Xiaoyao Li
TDX doesn't support SMM and VMM cannot emulate SMM for TDX VMs because VMM cannot manipulate TDX VM's memory. Disable SMM for TDX VMs and error out if user requests to enable SMM. Signed-off-by: Xiaoyao Li Acked-by: Gerd Hoffmann --- target/i386/kvm/tdx.c | 8 1 file changed, 8

Re: [PATCH 1/1] vfio-user: update submodule to latest

2022-08-02 Thread Daniel P . Berrangé
On Mon, Aug 01, 2022 at 09:24:04PM -0400, Jagannathan Raman wrote: > Update libvfio-user submodule to the latest > > Signed-off-by: Jagannathan Raman > --- > subprojects/libvfio-user | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/subprojects/libvfio-user

  1   2   3   >