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 registe

[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 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 changed,

[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 a/migratio

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 dump-guest-memor

[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 at

[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 regis

[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 Signed-of

[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 relate

[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(-) dif

[PATCH v1 10/40] i386/tdx: Integrate tdx_caps->xfam_fixed0/1 into tdx_cpuid_lookup

2022-08-02 Thread Xiaoyao Li
KVMM requires userspace to pass XFAM configuration via CPUID leaves 0xDs. Convert tdx_caps->xfam_fixed0/1 into corresponding tdx_cpuid_lookup[].tdx_fixed0/1 field of CPUID leaves 0xD. Thus the requirement can applied naturally. Signed-off-by: Xiaoyao Li --- target/i386/cpu.c | 3 --- targe

[PATCH v1 02/40] i386: Introduce tdx-guest object

2022-08-02 Thread Xiaoyao Li
Introduce tdx-guest object which implements the interface of CONFIDENTIAL_GUEST_SUPPORT, and will be used to create TDX VMs (TDs) by qemu -machine ...,confidential-guest-support=tdx0 \ -object tdx-guset,id=tdx0 It has only one property 'attributes' with fixed value 0 and not configur

[PATCH v1 05/40] i386/tdx: Implement tdx_kvm_init() to initialize TDX VM context

2022-08-02 Thread Xiaoyao Li
Introduce tdx_kvm_init() and invoke it in kvm_confidential_guest_init() if it's a TDX VM. More initialization will be added later. Signed-off-by: Xiaoyao Li Acked-by: Gerd Hoffmann --- target/i386/kvm/kvm.c | 15 ++- target/i386/kvm/meson.build | 2 +- target/i386/kvm/tdx-stu

[PATCH v1 06/40] i386/tdx: Get tdx_capabilities via KVM_TDX_CAPABILITIES

2022-08-02 Thread Xiaoyao Li
KVM provides TDX capabilities via sub command KVM_TDX_CAPABILITIES of IOCTL(KVM_MEMORY_ENCRYPT_OP). Get the capabilities when initializing TDX context. It will be used to validate user's setting later. Since there is no interface reporting how many cpuid configs contains in KVM_TDX_CAPABILITIES, Q

[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 removin

[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 12/40] i386/kvm: Move architectural CPUID leaf generation to separate helper

2022-08-02 Thread Xiaoyao Li
From: Sean Christopherson Move the architectural (for lack of a better term) CPUID leaf generation to a separate helper so that the generation code can be reused by TDX, which needs to generate a canonical VM-scoped configuration. Signed-off-by: Sean Christopherson Signed-off-by: Xiaoyao Li --

[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 --- t

[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 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 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 i

[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, thi

[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 --- target/i386/kv

[PATCH v1 20/40] i386/tdvf: Introduce function to parse TDVF metadata

2022-08-02 Thread Xiaoyao Li
From: Isaku Yamahata TDX VM needs to boot with its specialized firmware, Trusted Domain Virtual Firmware (TDVF). QEMU needs to parse TDVF and map it in TD guest memory prior to running the TDX VM. A TDVF Metadata in TDVF image describes the structure of firmware. QEMU refers to it to setup memor

[PATCH v1 15/40] i386/tdx: Add property sept-ve-disable for tdx-guest object

2022-08-02 Thread Xiaoyao Li
Bit 28, named SEPT_VE_DISABLE, disables EPT violation conversion to #VE on guest TD access of PENDING pages when set to 1. Some guest OS (e.g., Linux TD guest) may require this bit set as 1. Otherwise refuse to boot. Add sept-ve-disable property for tdx-guest object, for user to configure this bit

[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 Christopher

[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

[PATCH v1 17/40] i386/tdx: Validate TD attributes

2022-08-02 Thread Xiaoyao Li
Validate TD attributes with tdx_caps that fixed-0 bits must be zero and fixed-1 bits must be set. Besides, sanity check the attribute bits that have not been supported by QEMU yet. e.g., debug bit, it will be allowed in the future when debug TD support lands in QEMU. Signed-off-by: Xiaoyao Li --

[PATCH v1 27/40] i386/tdx: Setup the TD HOB list

2022-08-02 Thread Xiaoyao Li
The TD HOB list is used to pass the information from VMM to TDVF. The TD HOB must include PHIT HOB and Resource Descriptor HOB. More details can be found in TDVF specification and PI specification. Build the TD HOB in TDX's machine_init_done callback. Co-developed-by: Isaku Yamahata Signed-off-b

[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 --- Chan

[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 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 tdx_in

[PATCH v1 22/40] i386/tdx: Skip BIOS shadowing setup

2022-08-02 Thread Xiaoyao Li
TDX doesn't support map different GPAs to same private memory. Thus, aliasing top 128KB of BIOS as isa-bios is not supported. On the other hand, TDX guest cannot go to real mode, it can work fine without isa-bios. Signed-off-by: Xiaoyao Li --- Changes from RFC v4: - update commit message and co

[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 --- h

[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 +++ b/target/i386

[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 commu

[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 Win

[PATCH v1 26/40] headers: Add definitions from UEFI spec for volumes, resources, etc...

2022-08-02 Thread Xiaoyao Li
Add UEFI definitions for literals, enums, structs, GUIDs, etc... that will be used by TDX to build the UEFI Hand-Off Block (HOB) that is passed to the Trusted Domain Virtual Firmware (TDVF). All values come from the UEFI specification and TDVF design guide. [1] Note, EFI_RESOURCE_MEMORY_UNACCEPTE

[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.

[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 be

[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 @met

[PATCH v1 35/40] hw/i386: add option to forcibly report edge trigger in acpi tables

2022-08-02 Thread Xiaoyao Li
From: Isaku Yamahata When level trigger isn't supported on x86 platform, forcibly report edge trigger in acpi tables. Signed-off-by: Isaku Yamahata Signed-off-by: Xiaoyao Li --- hw/i386/acpi-build.c | 99 --- hw/i386/acpi-common.c | 50

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 don't

[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 Hoff

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 man

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 tak

[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 b/targ

[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 no

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 confus

[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 insert

Re: [PATCH v2 2/7] multifd: modifying 'migrate' qmp command to add multifd socket on particular src and dest pair

2022-08-02 Thread Markus Armbruster
Het Gala writes: > On 26/07/22 4:43 pm, Daniel P. Berrangé wrote: >> On Thu, Jul 21, 2022 at 07:56:15PM +, Het Gala wrote: >>> i) Modified the format of the qemu monitor command : 'migrate' by adding a >>> list, >>> each element in the list consisting of multifd connection parameters: >

[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 erro

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 th

[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 1

[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 misc

[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 --- target/i386/kvm/kvm

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 >> func

[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() r

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

2022-08-02 Thread Bin Meng
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 Meng --- Changes in v4: - introduce a new helper socket_check_af

[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") Signed-off-

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 > > > breaks

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 149

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 socket,i

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 mat

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 b/subprojects/

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

Re: [PATCH 2/2] hw/arm/virt: Warn when high memory region is disabled

2022-08-02 Thread Eric Auger
Hi Gavin, On 8/2/22 08:45, Gavin Shan wrote: > When one specific high memory region is disabled due to the PA > limit, it'd better to warn user about that. The warning messages > help to identify the cause in some cases. For example, PCIe device > that has large MMIO bar, to be covered by PCIE_MMI

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

2022-08-02 Thread Daniel P . Berrangé
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 support is upstreamed in linux kernel. I

[PATCH v4 for 7.2 00/22] virtio-gpio and various virtio cleanups

2022-08-02 Thread Alex Bennée
Hi, This is an update to the previous series which fixes the last few niggling CI failures I was seeing. Subject: [PATCH v3 for 7.2 00/21] virtio-gpio and various virtio cleanups Date: Tue, 26 Jul 2022 20:21:29 +0100 Message-Id: <20220726192150.2435175-1-alex.ben...@linaro.org> The CI f

[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: <20220726192150.2435175-9-alex.ben...@lin

[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 +++

[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 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 ++

[PATCH v4 09/22] hw/virtio: add some vhost-user trace events

2022-08-02 Thread Alex Bennée
These are useful for tracing the lifetime of vhost-user connections. Signed-off-by: Alex Bennée --- hw/virtio/vhost.c | 6 ++ hw/virtio/trace-events | 4 2 files changed, 10 insertions(+) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index f758f177bb..5185c15295 100644 --- a/

[PATCH v4 04/22] hw/virtio: fix vhost_user_read tracepoint

2022-08-02 Thread Alex Bennée
As reads happen in the callback we were never seeing them. We only really care about the header so move the tracepoint to when the header is complete. Fixes: 6ca6d8ee9d (hw/virtio: add vhost_user_[read|write] trace points) Signed-off-by: Alex Bennée Acked-by: Jason Wang Message-Id: <202207261921

[PATCH v4 05/22] include/hw/virtio: more comment for VIRTIO_F_BAD_FEATURE

2022-08-02 Thread Alex Bennée
When debugging a new vhost user you may be surprised to see VHOST_USER_F_PROTOCOL getting squashed in the maze of backend_features, acked_features and guest_features. Expand the description here to help the next poor soul trying to work through this. Signed-off-by: Alex Bennée --- v3 - s/vhost

[PATCH v4 06/22] include/hw: document vhost_dev feature life-cycle

2022-08-02 Thread Alex Bennée
Try and explicitly document the various state of feature bits as related to the vhost_dev structure. Importantly the backend_features can advertise things like VHOST_USER_F_PROTOCOL_FEATURES which is never exposed to the driver and is only present in the vhost-user feature negotiation. Signed-off-

[PATCH v4 18/22] tests/qtest: plain g_assert for VHOST_USER_F_PROTOCOL_FEATURES

2022-08-02 Thread Alex Bennée
checkpatch.pl warns that non-plain asserts should be avoided so convert the check to a plain g_assert. Signed-off-by: Alex Bennée --- tests/qtest/vhost-user-test.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c

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 > ... > --- /home/crobinso/src/qemu/te

[PATCH v4 08/22] hw/virtio: log potentially buggy guest drivers

2022-08-02 Thread Alex Bennée
If the guest driver attempts to use the UNUSED(30) bit it is potentially buggy as 6.3 Legacy Interface: Reserved Feature Bits states it "SHOULD NOT be negotiated". For now just log this guest error. Signed-off-by: Alex Bennée Acked-by: Jason Wang --- hw/virtio/virtio.c | 7 +++ 1 file chang

[PATCH v4 14/22] tests/qtest: pass stdout/stderr down to subtests

2022-08-02 Thread Alex Bennée
When trying to work out what the virtio-net-tests where doing it was hard because the g_test_trap_subprocess redirects all output to /dev/null. Lift this restriction by using the appropriate flags so you can see something similar to what the vhost-user-blk tests show when running. Signed-off-by: A

[PATCH v4 01/22] hw/virtio: incorporate backend features in features

2022-08-02 Thread Alex Bennée
There are some extra bits used over a vhost-user connection which are hidden from the device itself. We need to set them here to ensure we enable things like the protocol extensions. Currently net/vhost-user.c has it's own inscrutable way of persisting this data but it really should live in the co

[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 set_vring

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:

[PATCH v4 21/22] tests/qtest: add a get_features op to vhost-user-test

2022-08-02 Thread Alex Bennée
As we expand this test for more virtio devices we will need to support different feature sets. Add a mandatory op field to fetch the list of features needed for the test itself. Signed-off-by: Alex Bennée --- tests/qtest/vhost-user-test.c | 37 +-- 1 file changed,

[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: <5f560cab92d0d789b1c94295ec74b9952907d69d.16419

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 lates

[PATCH v4 12/22] hw/virtio: add boilerplate for vhost-user-gpio device

2022-08-02 Thread Alex Bennée
From: Viresh Kumar This creates the QEMU side of the vhost-user-gpio device which connects to the remote daemon. It is based of vhost-user-i2c code. Signed-off-by: Viresh Kumar Reviewed-by: Alex Bennée Message-Id: <5390324a748194a21bc99b1538e19761a8c64092.1641987128.git.viresh.ku...@linaro.or

[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 B

[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 state

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 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 a/tests/qtest/vhost-u

[PATCH v4 19/22] tests/qtest: add assert to catch bad features

2022-08-02 Thread Alex Bennée
No device driver (which is what the qvirtio_ access functions represent) should be setting UNUSED(30) in the feature space. Although existing libqos users mask it out lets ensure nothing sneaks through. Signed-off-by: Alex Bennée --- tests/qtest/libqos/virtio.c | 2 ++ 1 file changed, 2 insertio

[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 +- 1

[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 ju

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). > > Secondly

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 supp

  1   2   3   >