[PATCH v3 30/70] i386/tdx: Validate TD attributes

2023-11-14 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 v3 29/70] i386/tdx: Wire CPU features up with attributes of TD guest

2023-11-14 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 Acked-by: Gerd Hoffmann --- target/i386/kvm/tdx.c | 14 +- 1 file changed, 13 insertions(+)

[PATCH v3 27/70] i386/tdx: Add property sept-ve-disable for tdx-guest object

2023-11-14 Thread Xiaoyao Li
to configure this bit. Signed-off-by: Xiaoyao Li Acked-by: Gerd Hoffmann --- Changes in v3: - update the comment of property @sept-ve-disable to make it more descriptive and use new format. (Daniel and Markus) --- qapi/qom.json | 7 ++- target/i386/kvm/tdx.c | 24

[PATCH v3 25/70] kvm: Introduce kvm_arch_pre_create_vcpu()

2023-11-14 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 Acked-by: Gerd Hoffmann --- Changes in v3: - pass @errp to kvm_arch_pre_create_vcpu(); (Per

[PATCH v3 20/70] i386/tdx: Adjust the supported CPUID based on TDX restrictions

2023-11-14 Thread Xiaoyao Li
overs the other part of type #1); - fix the ones in vmm_fixup; - filter the one has valid .supported field; (Calculated type is ignored since it's determined at runtime). Co-developed-by: Chenyi Qiang Signed-off-by: Chenyi Qiang Signed-off-by: Xiaoyao Li --- target/i386/cpu.h | 16 +++ t

[PATCH v3 21/70] i386/tdx: Update tdx_cpuid_lookup[].tdx_fixed0/1 by tdx_caps.cpuid_config[]

2023-11-14 Thread Xiaoyao Li
by removing the bits that reported from TDX module as configurable. This can adapt with the updated TDX (module) automatically. Signed-off-by: Xiaoyao Li --- target/i386/kvm/tdx.c | 30 ++ 1 file changed, 30 insertions(+) diff --git a/target/i386/kvm/tdx.c b/target/i386/kvm

[PATCH v3 24/70] i386/kvm: Move architectural CPUID leaf generation to separate helper

2023-11-14 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 v3 15/70] target/i386: Parse TDX vm type

2023-11-14 Thread Xiaoyao Li
-by: Xiaoyao Li --- target/i386/kvm/kvm.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index 2e47fda25f95..c4050cbf998e 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -32,6 +32,7 @@ #include "sysemu/runstate.h"

[PATCH v3 19/70] i386/tdx: Introduce is_tdx_vm() helper and cache tdx_guest object

2023-11-14 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 Acked-by: Gerd Hoffmann --- changes in v3: - replace object_dynamic_c

[PATCH v3 11/70] trace/kvm: Add trace for page convertion between shared and private

2023-11-14 Thread Xiaoyao Li
From: Isaku Yamahata Signed-off-by: Isaku Yamahata Signed-off-by: Xiaoyao Li --- accel/kvm/kvm-all.c| 1 + accel/kvm/trace-events | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 58abbcb6926e..082f31446c97 100644

[PATCH v3 23/70] i386/tdx: Integrate tdx_caps->attrs_fixed0/1 to tdx_cpuid_lookup

2023-11-14 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 v3 18/70] i386/tdx: Get tdx_capabilities via KVM_TDX_CAPABILITIES

2023-11-14 Thread Xiaoyao Li
, QEMU chooses to try starting with a known number and abort when it exceeds KVM_MAX_CPUID_ENTRIES. Besides, introduce the interfaces to invoke TDX "ioctls" at different scope (KVM, VM and VCPU) in preparation. Signed-off-by: Xiaoyao Li --- Changes in v3: - rename _

[PATCH v3 12/70] *** HACK *** linux-headers: Update headers to pull in TDX API changes

2023-11-14 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 --- linux-headers/asm-x86/kvm.h | 91

[PATCH v3 08/70] physmem: replace function name with __func__ in ram_block_discard_range()

2023-11-14 Thread Xiaoyao Li
Use __func__ to avoid hard-coded function name. Signed-off-by: Xiaoyao Li --- system/physmem.c | 38 +- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/system/physmem.c b/system/physmem.c index 8a4e42c7cf60..ddfecddefcd6 100644 --- a/system

[PATCH v3 14/70] target/i386: Implement mc->kvm_type() to get VM type

2023-11-14 Thread Xiaoyao Li
Implement mc->kvm_type() for i386 machines. It provides a way for user to create SW_PROTECTE_VM. Also store the vm_type in machinestate to other code to query what the VM type is. Signed-off-by: Xiaoyao Li --- hw/i386/x86.c | 12 include/hw/i386/x86.h |

[PATCH v3 17/70] i386/tdx: Implement tdx_kvm_init() to initialize TDX VM context

2023-11-14 Thread Xiaoyao Li
Introduce tdx_kvm_init() and invoke it in kvm_confidential_guest_init() if it's a TDX VM. Set ms->require_guest_memfd to require kvm guest memfd allocation for any memory backend. More TDX specific initialization will be added later. Signed-off-by: Xiaoyao Li Acked-by: Gerd Hoffm

[PATCH v3 13/70] i386: Introduce tdx-guest object

2023-11-14 Thread Xiaoyao Li
and not configurable so far. Signed-off-by: Xiaoyao Li Acked-by: Gerd Hoffmann Acked-by: Markus Armbruster --- changes in v1 - make @attributes not user-settable --- configs/devices/i386-softmmu/default.mak | 1 + hw/i386/Kconfig | 5 +++ qapi/qom.json| 12

[PATCH v3 05/70] kvm: Enable KVM_SET_USER_MEMORY_REGION2 for memslot

2023-11-14 Thread Xiaoyao Li
From: Chao Peng Switch to KVM_SET_USER_MEMORY_REGION2 when supported by KVM. With KVM_SET_USER_MEMORY_REGION2, QEMU can set up memory region that backend'ed both by hva-based shared memory and guest memfd based private memory. Signed-off-by: Chao Peng Co-developed-by: Xiaoyao Li Signed-off

[PATCH v3 06/70] kvm: Introduce support for memory_attributes

2023-11-14 Thread Xiaoyao Li
memory. Signed-off-by: Xiaoyao Li --- accel/kvm/kvm-all.c | 42 ++ include/sysemu/kvm.h | 3 +++ 2 files changed, 45 insertions(+) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 69afeb47c9c0..76e2404d54d2 100644 --- a/accel/kvm/kvm-all.c

[PATCH v3 07/70] physmem: Relax the alignment check of host_startaddr in ram_block_discard_range()

2023-11-14 Thread Xiaoyao Li
k. So change to alignment check back to qemu_host_page_size. Signed-off-by: Xiaoyao Li --- Changes in v3: - Newly added in v3; --- system/physmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/physmem.c b/system/physmem.c index c56b17e44df6..8a4e42c7cf60 100644 --- a/sys

[PATCH v3 10/70] kvm: handle KVM_EXIT_MEMORY_FAULT

2023-11-14 Thread Xiaoyao Li
only when the RAMBlock has guest_memfd memory backend. Note, KVM_EXIT_MEMORY_FAULT returns with -EFAULT, so special handling is added. Signed-off-by: Chao Peng Co-developed-by: Xiaoyao Li Signed-off-by: Xiaoyao Li --- accel/kvm/kvm-all.c | 76 +++-- 1 file

[PATCH v3 04/70] HostMem: Add mechanism to opt in kvm guest memfd via MachineState

2023-11-14 Thread Xiaoyao Li
chineState. MachineState::require_guest_memfd is supposed to be set by any VMs that requires KVM guest memfd as private memory, e.g., TDX VM. Signed-off-by: Xiaoyao Li --- backends/hostmem-file.c | 1 + backends/hostmem-memfd.c | 1 + backends/hostmem-ram.c | 1 + backends/hostmem.c | 1

[PATCH v3 09/70] physmem: Introduce ram_block_convert_range() for page conversion

2023-11-14 Thread Xiaoyao Li
is back'ed by guest_memfd. Introduce ram_block_discard_guest_memfd_range() for discarding memory in guest_memfd. Originally-from: Isaku Yamahata Codeveloped-by: Xiaoyao Li Signed-off-by: Xiaoyao Li --- include/exec/cpu-common.h | 2 ++ system/physmem.c | 50

[PATCH v3 03/70] RAMBlock/guest_memfd: Enable KVM_GUEST_MEMFD_ALLOW_HUGEPAGE

2023-11-14 Thread Xiaoyao Li
KVM_GUEST_MEMFD_ALLOW_HUGEPAGE is set. Signed-off-by: Xiaoyao Li --- v3: - New one in v3. --- system/physmem.c | 38 -- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/system/physmem.c b/system/physmem.c index 0af2213cbd9c..c56b17e44df6 100644 --- a/system/physmem.c +++ b

[PATCH v3 02/70] RAMBlock: Add support of KVM private guest memfd

2023-11-14 Thread Xiaoyao Li
is supposed to be set for memory backends of confidential guests, such as TDX VM. How and when to set it for memory backends will be implemented in the following patches. Introduce memory_region_has_guest_memfd() to query if the MemoryRegion has KVM guest_memfd allocated. Signed-off-by: Xiaoyao Li

[PATCH v3 01/70] *** HACK *** linux-headers: Update headers to pull in gmem APIs

2023-11-14 Thread Xiaoyao Li
This patch needs to be updated by script scripts/update-linux-headers.sh once gmem fd support is upstreamed in Linux kernel. Signed-off-by: Xiaoyao Li --- linux-headers/asm-x86/kvm.h | 3 +++ linux-headers/linux/kvm.h | 51 + 2 files changed, 54

[PATCH v3 00/70] QEMU Guest memfd + QEMU TDX support

2023-11-14 Thread Xiaoyao Li
-host hw/i386: add option to forcibly report edge trigger in acpi tables i386/tdx: Don't synchronize guest tsc for TDs Sean Christopherson (2): i386/kvm: Move architectural CPUID leaf generation to separate helper i386/tdx: Don't get/put guest state for TDX VMs Xiaoyao Li (49): *** HACK

[PATCH v3 5/6] target/i386: enumerate VMX nested-exception support

2023-11-08 Thread Xin Li
Allow VMX nested-exception support to be exposed in KVM guests, thus nested KVM guests can enumerate it. Tested-by: Shan Kang Signed-off-by: Xin Li --- scripts/kvm/vmxcap | 1 + target/i386/cpu.c | 1 + target/i386/cpu.h | 1 + 3 files changed, 3 insertions(+) diff --git a/scripts/kvm

[PATCH v3 6/6] target/i386: Add get/set/migrate support for FRED MSRs

2023-11-08 Thread Xin Li
FRED CPU states are managed in 9 new FRED MSRs, in addtion to a few existing CPU registers and MSRs, e.g., CR4.FRED and MSR_IA32_PL0_SSP. Save/restore/migrate FRED MSRs if FRED is exposed to the guest. Tested-by: Shan Kang Signed-off-by: Xin Li --- target/i386/cpu.h | 22

[PATCH v3 3/6] target/i386: add the secondary VM exit controls MSR

2023-11-08 Thread Xin Li
Add the secondary VM exit controls MSR to prepare for KVM FRED enabling. Tested-by: Shan Kang Signed-off-by: Xin Li --- scripts/kvm/vmxcap | 9 + target/i386/cpu.c | 2 +- target/i386/cpu.h | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/kvm/vmxcap b

[PATCH v3 4/6] target/i386: add support for VMX FRED controls

2023-11-08 Thread Xin Li
Add VMX FRED controls used to enable save/load of FRED MSRs. Tested-by: Shan Kang Signed-off-by: Xin Li --- scripts/kvm/vmxcap | 3 +++ target/i386/cpu.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/kvm/vmxcap b/scripts/kvm/vmxcap index 7da1e00ca8..44898d73c2

[PATCH v3 0/6] target/i386: add support for FRED

2023-11-08 Thread Xin Li
(Weijiang Yang). Xin Li (6): target/i386: add support for FRED in CPUID enumeration target/i386: mark CR4.FRED not reserved target/i386: add the secondary VM exit controls MSR target/i386: add support for VMX FRED controls target/i386: enumerate VMX nested-exception support target/i386

[PATCH v3 1/6] target/i386: add support for FRED in CPUID enumeration

2023-11-08 Thread Xin Li
] enumerates WRMSRNS. Add CPUID definitions for FRED/LKGS/WRMSRNS, and expose them to KVM guests. Because FRED relies on LKGS and WRMSRNS, add that to feature dependency map. Tested-by: Shan Kang Signed-off-by: Xin Li --- target/i386/cpu.c | 10 +- target/i386/cpu.h | 6 ++ 2

[PATCH v3 2/6] target/i386: mark CR4.FRED not reserved

2023-11-08 Thread Xin Li
The CR4.FRED bit, i.e., CR4[32], is no longer a reserved bit when FRED is exposed to guests, otherwise it is still a reserved bit. Tested-by: Shan Kang Signed-off-by: Xin Li --- target/i386/cpu.h | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/target/i386/cpu.h

[PATCH v1 8/9] target/loongarch: Implement set vcpu intr for kvm

2023-11-07 Thread xianglai li
From: Tianrui Zhao Implement loongarch kvm set vcpu interrupt interface, when a irq is set in vcpu, we use the KVM_INTERRUPT ioctl to set intr into kvm. Signed-off-by: Tianrui Zhao Signed-off-by: xianglai li --- target/loongarch/cpu.c | 18 +- target/loongarch/kvm

[PATCH v1 5/9] target/loongarch: Implement kvm_arch_init function

2023-11-07 Thread xianglai li
From: Tianrui Zhao Implement the kvm_arch_init of loongarch, in the function, the KVM_CAP_MP_STATE cap is checked by kvm ioctl. Signed-off-by: Tianrui Zhao Reviewed-by: Richard Henderson Signed-off-by: xianglai li --- target/loongarch/kvm.c | 1 + 1 file changed, 1 insertion(+) diff --git

[PATCH v1 7/9] target/loongarch: Implement kvm_arch_handle_exit

2023-11-07 Thread xianglai li
-by: xianglai li --- target/loongarch/kvm.c| 24 +++- target/loongarch/trace-events | 1 + 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/target/loongarch/kvm.c b/target/loongarch/kvm.c index 85e7aeb083..d2dab3fef4 100644 --- a/target/loongarch/kvm.c +++ b

[PATCH v1 9/9] target/loongarch: Add loongarch kvm into meson build

2023-11-07 Thread xianglai li
From: Tianrui Zhao Add kvm.c and kvm-stub.c into meson.build to compile it when kvm is configed. Meanwhile in meson.build, we set the kvm_targets to loongarch64-softmmu when the cpu is loongarch. Signed-off-by: Tianrui Zhao Signed-off-by: xianglai li --- meson.build | 2

[PATCH v1 2/9] target/loongarch: Define some kvm_arch interfaces

2023-11-07 Thread xianglai li
-by: Tianrui Zhao Reviewed-by: Richard Henderson Signed-off-by: xianglai li --- target/loongarch/kvm.c | 131 + 1 file changed, 131 insertions(+) create mode 100644 target/loongarch/kvm.c diff --git a/target/loongarch/kvm.c b/target/loongarch/kvm.c new file mode

[PATCH v1 6/9] target/loongarch: Implement kvm_arch_init_vcpu

2023-11-07 Thread xianglai li
be refreshed from kvm. Signed-off-by: Tianrui Zhao Signed-off-by: xianglai li --- target/loongarch/cpu.h| 2 ++ target/loongarch/kvm.c| 23 +++ target/loongarch/trace-events | 2 ++ 3 files changed, 27 insertions(+) diff --git a/target/loongarch/cpu.h b/target

[PATCH v1 4/9] target/loongarch: Implement kvm get/set registers

2023-11-07 Thread xianglai li
From: Tianrui Zhao Implement kvm_arch_get/set_registers interfaces, many regs can be get/set in the function, such as core regs, csr regs, fpu regs, mp state, etc. Signed-off-by: Tianrui Zhao Signed-off-by: xianglai li --- meson.build | 1 + target/loongarch/cpu.c

[PATCH v1 1/9] linux-headers: Add KVM headers for loongarch

2023-11-07 Thread xianglai li
From: zhaotianrui Update linux KVM headers about LoongArch KVM form linux kernel. Mainly contains some KVM structures and macro defines such as LoongArch KVM registers number, LoongArch fpu structure, exit reason of LoongArch IOCSR, etc. Signed-off-by: zhaotianrui Signed-off-by: xianglai li

[PATCH v1 3/9] target/loongarch: Supplement vcpu env initial when vcpu reset

2023-11-07 Thread xianglai li
From: Tianrui Zhao Supplement vcpu env initial when vcpu reset, including init vcpu CSR_CPUID,CSR_TID to cpu->cpu_index. The two regs will be used in kvm_get/set_csr_ioctl. Signed-off-by: Tianrui Zhao Signed-off-by: xianglai li --- target/loongarch/cpu.c | 2 ++ target/loongarch/cpu.h

[PATCH v1 0/9] Add loongarch kvm accel support

2023-11-07 Thread xianglai li
The LoongArch KVM patch series have been merged in Linux kernel, so we remove the RFC flag in this patch series. This series add loongarch kvm support, mainly implement some interfaces used by kvm such as kvm_arch_get/set_regs, kvm_arch_handle_exit, kvm_loongarch_set_interrupt, etc. Currently,

Re: [PATCH v2] block/file-posix: fix update_zones_wp() caller

2023-10-31 Thread Sam Li
Looks good, thanks! Hanna Czenczek 于2023年10月31日 周二17:24写道: > On 25.08.23 06:05, Sam Li wrote: > > When the zoned request fail, it needs to update only the wp of > the target zones for not disrupting the in-flight writes on > these other zones. The wp is updated successfully afte

Re: [PATCH v5 2/4] qcow2: add configurations for zoned format extension

2023-10-30 Thread Sam Li
Hi Eric, Eric Blake 于2023年10月30日周一 22:53写道: > > On Mon, Oct 30, 2023 at 08:18:45PM +0800, Sam Li wrote: > > To configure the zoned format feature on the qcow2 driver, it > > requires settings as: the device size, zone model, zone size, > > zone capacity, number of co

Re: [PATCH v5 1/4] docs/qcow2: add the zoned format feature

2023-10-30 Thread Sam Li
Eric Blake 于2023年10月30日周一 22:05写道: > > On Mon, Oct 30, 2023 at 08:18:44PM +0800, Sam Li wrote: > > Add the specs for the zoned format feature of the qcow2 driver. > > The qcow2 file can be taken as zoned device and passed through by > > virtio-blk device or NVMe ZNS d

[PATCH v5 3/4] qcow2: add zoned emulation capability

2023-10-30 Thread Sam Li
corresponding state changing. Zoned devices have a limit on zone resources, which puts constraints on write operations into zones. It is managed by active zone lists following LRU policy. Signed-off-by: Sam Li --- block/qcow2.c| 731 ++- block

[PATCH v5 4/4] iotests: test the zoned format feature for qcow2 file

2023-10-30 Thread Sam Li
The zoned format feature can be tested by: $ tests/qemu-iotests/check -qcow2 zoned-qcow2 Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi --- tests/qemu-iotests/tests/zoned-qcow2 | 126 +++ tests/qemu-iotests/tests/zoned-qcow2.out | 118 + 2 files

[PATCH v5 2/4] qcow2: add configurations for zoned format extension

2023-10-30 Thread Sam Li
command like this: $ qemu-img create -f qcow2 test.qcow2 -o size=768M -o zone_size=64M -o zone_capacity=64M -o conventional_zones=0 -o max_append_bytes=4096 -o max_open_zones=0 -o max_active_zones=0 -o zone_model=host-managed Signed-off-by: Sam Li fix config? --- block/qcow2.c

[PATCH v5 1/4] docs/qcow2: add the zoned format feature

2023-10-30 Thread Sam Li
Add the specs for the zoned format feature of the qcow2 driver. The qcow2 file can be taken as zoned device and passed through by virtio-blk device or NVMe ZNS device to the guest given zoned information. Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi --- docs/system/qemu-block

[PATCH v5 0/4] Add full zoned storage emulation to qcow2 driver

2023-10-30 Thread Sam Li
ned commands - make zone append change state to full when wp reaches end - add documentation to qcow2 zoned extension header - address review comments (Stefan): * fix zoned_mata allocation size * use bitwise or than addition * fix wp index overflow and locking * cleanups: comments, namin

Update mail account

2023-10-30 Thread Weiwei Li
Hi, all. I'v left my job at Iscas. The old iscas mail acount will be disabled soon. So I'll change to use my personal gmail acount (liwei1...@gmail.com) for future reviewer tasks. Regards, Weiwei Li Weiwei Li (1): MAINTAINERS: update mail address for Weiwei Li MAINTAINERS | 2 +- 1 file

[PATCH 1/1] MAINTAINERS: update mail address for Weiwei Li

2023-10-30 Thread Weiwei Li
My Iscas mail account will be disabled soon, change to my personal gmail account. Signed-off-by: Weiwei Li --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index cd8d6b140f..aa5c5d4bff 100644 --- a/MAINTAINERS +++ b/MAINTAINERS

Re: [PATCH] file-posix: fix over-writing of returning zone_append offset

2023-10-30 Thread Sam Li
iro Aota > --- > block/file-posix.c | 16 +++- > 1 file changed, 7 insertions(+), 9 deletions(-) Thanks! Reviewed-by: Sam Li > > diff --git a/block/file-posix.c b/block/file-posix.c > index 50e2b20d5c45..c39209358909 100644 > --- a/block/file-posix.c >

[PATCH] target/i386: Add support of KVM_FEATURE_ASYNC_PF_VMEXIT for guest

2023-10-24 Thread Xiaoyao Li
KVM_FEATURE_ASYNC_PF_VMEXIT has been introduced for years, however QEMU doesn't support expose it to guest. Add support for it. Signed-off-by: Xiaoyao Li --- target/i386/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index

Re: [PATCH v2 1/2] hw/cxl: Pass CXLComponentState to cache_mem_ops

2023-10-23 Thread Zhijian Li (Fujitsu)
On 19/10/2023 18:50, Jonathan Cameron wrote: > On Wed, 18 Oct 2023 16:24:07 +0800 > Li Zhijian wrote: > >> cache_mem_ops.{read,write}() interprets opaque as >> CXLComponentState(cxl_cstate) instead of ComponentRegisters(cregs). >> >> Fortunately, cregs is t

Re: [PATCH v2 1/4] softmmu/physmem: Warn with ram_block_discard_range() on MAP_PRIVATE file mapping

2023-10-19 Thread Xiaoyao Li
On 10/19/2023 4:26 PM, David Hildenbrand wrote: On 18.10.23 18:27, Xiaoyao Li wrote: On 10/18/2023 5:26 PM, David Hildenbrand wrote: On 18.10.23 11:02, Xiaoyao Li wrote: On 10/18/2023 3:42 PM, David Hildenbrand wrote: On 18.10.23 05:02, Xiaoyao Li wrote: David, On 7/6/2023 3:56 PM, David

Re: [PATCH] i386/pc: Drop pc_machine_kvm_type()

2023-10-18 Thread Xiaoyao Li
On 10/18/2023 9:27 PM, Michael S. Tsirkin wrote: On Sat, Oct 07, 2023 at 02:58:19AM -0400, Xiaoyao Li wrote: pc_machine_kvm_type() was introduced by commit e21be724eaf5 ("i386/xen: add pc_machine_kvm_type to initialize XEN_EMULATE mode") to do Xen specific initialization by utilizin

Re: [PATCH v2 1/4] softmmu/physmem: Warn with ram_block_discard_range() on MAP_PRIVATE file mapping

2023-10-18 Thread Xiaoyao Li
On 10/18/2023 5:26 PM, David Hildenbrand wrote: On 18.10.23 11:02, Xiaoyao Li wrote: On 10/18/2023 3:42 PM, David Hildenbrand wrote: On 18.10.23 05:02, Xiaoyao Li wrote: David, On 7/6/2023 3:56 PM, David Hildenbrand wrote: ram_block_discard_range() cannot possibly do the right thing

Re: [PATCH v2 1/4] softmmu/physmem: Warn with ram_block_discard_range() on MAP_PRIVATE file mapping

2023-10-18 Thread Xiaoyao Li
On 10/18/2023 3:42 PM, David Hildenbrand wrote: On 18.10.23 05:02, Xiaoyao Li wrote: David, On 7/6/2023 3:56 PM, David Hildenbrand wrote: ram_block_discard_range() cannot possibly do the right thing in MAP_PRIVATE file mappings in the general case. To achieve the documented semantics, we

Re: [PATCH v8 0/5] Implement reconnect for vhost-user-scsi

2023-10-18 Thread Li Feng
Hello Guys, Ping… These patches have been waiting for a long time. Can they be merged? Best Regards, li > On 9 Oct 2023, at 12:46 PM, Li Feng wrote: > > Changes for v8: > - [PATCH 3/5] vhost-user-scsi: support reconnect to backend > - Fix code style suggested by Mano

Re: [PATCH] hw/cxl: Fix opaque type interpret wrongly

2023-10-18 Thread Zhijian Li (Fujitsu)
On 13/10/2023 16:52, Philippe Mathieu-Daudé wrote: > On 13/10/23 03:55, Li Zhijian wrote: >> void cxl_component_register_block_init(Object *obj, >>     CXLComponentState *cxl_cstate, >>    

[PATCH v2 1/2] hw/cxl: Pass CXLComponentState to cache_mem_ops

2023-10-18 Thread Li Zhijian
Signed-off-by: Li Zhijian --- V2: change the source side since cache_mem_ops.{read,write}() will use cxl_cstate. --- hw/cxl/cxl-component-utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/cxl/cxl-component-utils.c b/hw/cxl/cxl-component-utils.c index f3bbf0fd131..6214dcdc

[PATCH v2 2/2] hw/cxl: Pass NULL for a NULL MemoryRegionOps

2023-10-18 Thread Li Zhijian
a NULL parameter is enough for a NULL MemoryRegionOps Signed-off-by: Li Zhijian --- hw/cxl/cxl-component-utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/cxl/cxl-component-utils.c b/hw/cxl/cxl-component-utils.c index 6214dcdcc12..010ed82edab 100644 --- a/hw/cxl/cxl

Re: [PATCH v2 1/4] softmmu/physmem: Warn with ram_block_discard_range() on MAP_PRIVATE file mapping

2023-10-17 Thread Xiaoyao Li
David, On 7/6/2023 3:56 PM, David Hildenbrand wrote: ram_block_discard_range() cannot possibly do the right thing in MAP_PRIVATE file mappings in the general case. To achieve the documented semantics, we also have to punch a hole into the file, possibly messing with other

Re: [PATCH 39/52] migration/rdma: Convert qemu_rdma_write_one() to Error

2023-10-16 Thread Zhijian Li (Fujitsu)
On 16/10/2023 20:11, Jason Gunthorpe wrote: > On Sat, Oct 07, 2023 at 03:40:50AM +, Zhijian Li (Fujitsu) wrote: >> +rdma-core >> >> >> Is global variable *errno* reliable when the documentation only states >> "returns 0 on success, or the valu

Re: [PATCH v2] block/file-posix: fix update_zones_wp() caller

2023-10-16 Thread Sam Li
Sam Li 于2023年8月25日周五 12:06写道: > > When the zoned request fail, it needs to update only the wp of > the target zones for not disrupting the in-flight writes on > these other zones. The wp is updated successfully after the > request completes. > > Fixed the callers with righ

Re: [PATCH v3 13/13] migration/rdma: Remove all "ret" variables that are used only once

2023-10-13 Thread Zhijian Li (Fujitsu)
On 12/10/2023 04:35, Juan Quintela wrote: > Change code that is: > > int ret; > ... > > ret = foo(); > if (ret[ < 0]?) { > > to: > > if (foo()[ < 0]) { > > Signed-off-by: Juan Quintela Reviewed-by: Li Zhijian

Re: [PATCH v3 02/13] migration/rdma: Unfold ram_control_before_iterate()

2023-10-13 Thread Zhijian Li (Fujitsu)
eter Xu > Signed-off-by: Juan Quintela Reviewed-by: Li Zhijian > > -- > > initilazize rioc after checknig that rdma is enabled. > > Signed-off-by: Juan Quintela > --- > migration/qemu-file.h | 2 -- > migration/rdma.h | 7 +++ > migrat

Re: [PATCH v3 12/13] migration/rdma: Declare for index variables local

2023-10-13 Thread Zhijian Li (Fujitsu)
On 12/10/2023 04:35, Juan Quintela wrote: > Declare all variables that are only used inside a for loop inside the > for statement. > > This makes clear that they are not used outside of the for loop. > > Signed-off-by: Juan Quintela Reviewed-by: Li Zhijian

Re: [PATCH v3 11/13] migration/rdma: Use i as for index instead of idx

2023-10-13 Thread Zhijian Li (Fujitsu)
On 12/10/2023 04:35, Juan Quintela wrote: > Once there, all the uses are local to the for, so declare the variable > inside the for statement. > > Signed-off-by: Juan Quintela Reviewed-by: Li Zhijian > --- > migration/rdma.c | 49 ++---

Re: [PATCH v3 05/13] migration/rdma: Unfold hook_ram_load()

2023-10-13 Thread Zhijian Li (Fujitsu)
On 12/10/2023 04:35, Juan Quintela wrote: > There is only one flag called with: RAM_CONTROL_BLOCK_REG. > > Reviewed-by: Peter Xu > Signed-off-by: Juan Quintela Reviewed-by: Li Zhijian > --- > migration/qemu-file.h | 11 --- > migration/rdma.h | 3 +

Re: [PATCH v3 09/13] migration/rdma: Remove qemu_ prefix from exported functions

2023-10-13 Thread Zhijian Li (Fujitsu)
On 12/10/2023 04:35, Juan Quintela wrote: > Functions are long enough even without this. > > Reviewed-by: Peter Xu > Signed-off-by: Juan Quintela Reviewed-by: Li Zhijian > --- > migration/rdma.h | 12 ++-- > migration/ram.c| 14 +++---

Re: [PATCH v3 06/13] migration/rdma: Create rdma_control_save_page()

2023-10-13 Thread Zhijian Li (Fujitsu)
ock_offset, offset, size); > + > +if (ret != RAM_SAVE_CONTROL_DELAYED && > +ret != RAM_SAVE_CONTROL_NOT_SUPP) { > +if (ret < 0) { > +qemu_file_set_error(f, ret); > +} > +} > +return ret; > +} > + > + Redundant new line

Re: [PATCH v3 08/13] migration/rdma: Move rdma constants from qemu-file.h to rdma.h

2023-10-13 Thread Zhijian Li (Fujitsu)
On 12/10/2023 04:35, Juan Quintela wrote: > Reviewed-by: Peter Xu > Signed-off-by: Juan Quintela Reviewed-by: Li Zhijian > --- > migration/qemu-file.h | 17 - > migration/rdma.h | 16 > migration/ram.c | 2 +- >

Re: [PATCH v3 03/13] migration/rdma: Unfold ram_control_after_iterate()

2023-10-13 Thread Zhijian Li (Fujitsu)
eter Xu > Signed-off-by: Juan Quintela Reviewed-by: Li Zhijian > > --- > > This function has goto's. So I don't change the place where we > declare variables, althought I think that it is correct, just don't > start that discussion. > --- > migration/qe

Re: [PATCH v3 07/13] qemu-file: Remove QEMUFileHooks

2023-10-13 Thread Zhijian Li (Fujitsu)
On 12/10/2023 04:35, Juan Quintela wrote: > The only user was rdma, and its use is gone. > > Reviewed-by: Peter Xu > Signed-off-by: Juan Quintela Reviewed-by: Li Zhijian > --- > migration/qemu-file.h | 4 > migration/qemu-file.c | 6 -- > m

Re: [PATCH v3 04/13] migration/rdma: Remove all uses of RAM_CONTROL_HOOK

2023-10-13 Thread Zhijian Li (Fujitsu)
On 12/10/2023 04:35, Juan Quintela wrote: > Instead of going trhough ram_control_load_hook(), call > qemu_rdma_registration_handle() directly. > s/trhough/through Reviewed-by: Li Zhijian > Reviewed-by: Peter Xu > Signed-off-by: Juan Quintela > --- > migra

Re: [PATCH v3 10/13] migration/rdma: Check sooner if we are in postcopy for save_page()

2023-10-13 Thread Zhijian Li (Fujitsu)
On 12/10/2023 04:35, Juan Quintela wrote: > Reviewed-by: Peter Xu > Signed-off-by: Juan Quintela Reviewed-by: Li Zhijian > --- > migration/rdma.c | 6 +- > 1 file changed, 1 insertion(+), 5 deletions(-) > > diff --git a/migration/rdma.c b/migration/rdma

Re: [PATCH v3 01/13] migration: Create migrate_rdma()

2023-10-13 Thread Zhijian Li (Fujitsu)
On 12/10/2023 04:35, Juan Quintela wrote: > Helper to say if we are doing a migration over rdma. > > Reviewed-by: Peter Xu > Signed-off-by: Juan Quintela Reviewed-by: Li Zhijian > --- > migration/migration.h | 2 ++ > migration/options.h | 1 + > m

[PATCH] hw/cxl: Fix opaque type interpret wrongly

2023-10-12 Thread Li Zhijian
, 8.2.5)") Signed-off-by: Li Zhijian --- hw/cxl/cxl-component-utils.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/cxl/cxl-component-utils.c b/hw/cxl/cxl-component-utils.c index f3bbf0fd131..f27a9d3cf60 100644 --- a/hw/cxl/cxl-component-utils.c +++ b/hw

Re: [PATCH 1/1] migration: Non multifd migration don't care about multifd flushes

2023-10-11 Thread Zhijian Li (Fujitsu)
biano Rosas Fixes: 294e5a4034e81b3d8db03b4e0f691386f20d6ed3 > multifd: Only flush once each full round of memory Shouldn't the Fixes tag be like[1] Fixes: 294e5a4034e ("multifd: Only flush once each full round of memory") [1] https://www.qemu.org/docs/master/devel/submitting-a-patch.html#id37 > Reported-by:

[PATCH] targer/i386/cpu: Fix CPUID_HT exposure

2023-10-10 Thread Xiaoyao Li
e CPUID_HT to guest when "-cpu host/max" with only 1 vcpu. To fix this, need mark CPUID_HT as the no_autoenable_flags. Signed-off-by: Xiaoyao Li --- target/i386/cpu.c | 1 + target/i386/kvm/kvm.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/target/i386/cpu.c b/target/i386/cpu.

Re: [PATCH v2 08/58] i386/tdx: Adjust the supported CPUID based on TDX restrictions

2023-10-09 Thread Xiaoyao Li
On 10/10/2023 9:02 AM, Tina Zhang wrote: Hi, On 8/18/23 17:49, Xiaoyao Li wrote: According to Chapter "CPUID Virtualization" in TDX module spec, CPUID bits of TD can be classified into 6 types: 1 | As

Re: [PATCH v4 2/4] qcow2: add configurations for zoned format extension

2023-10-09 Thread Sam Li
Hello Eric, Eric Blake 于2023年9月28日周四 23:15写道: > > On Mon, Sep 18, 2023 at 05:53:11PM +0800, Sam Li wrote: > > To configure the zoned format feature on the qcow2 driver, it > > requires settings as: the device size, zone model, zone size, > > zone capacity, number of co

[PATCH RFC v4 0/9] Add loongarch kvm accel support

2023-10-09 Thread xianglai li
This series add loongarch kvm support, mainly implement some interfaces used by kvm such as kvm_arch_get/set_regs, kvm_arch_handle_exit, kvm_loongarch_set_interrupt, etc. Currently, we are able to boot LoongArch KVM Linux Guests. In loongarch VM, mmio devices and iocsr devices are emulated in

[PATCH RFC v4 7/9] target/loongarch: Implement kvm_arch_handle_exit

2023-10-09 Thread xianglai li
Cc: "Marc-André Lureau" Cc: "Daniel P. Berrangé" Cc: Thomas Huth Cc: "Philippe Mathieu-Daudé" Cc: Richard Henderson Cc: Peter Maydell Cc: Bibo Mao Cc: Song Gao Cc: Xiaojuan Yang Cc: Tianrui Zhao Signed-off-by: Tianrui Zhao Reviewed-by: Richard Henderson

[PATCH RFC v4 1/9] linux-headers: Add KVM headers for loongarch

2023-10-09 Thread xianglai li
lo Bonzini Cc: "Marc-André Lureau" Cc: "Daniel P. Berrangé" Cc: Thomas Huth Cc: "Philippe Mathieu-Daudé" Cc: Richard Henderson Cc: Peter Maydell Cc: Bibo Mao Cc: Song Gao Cc: Xiaojuan Yang Cc: Tianrui Zhao Signed-off-by: Tianrui Zhao Signed-off-by: xiang

[PATCH RFC v4 3/9] target/loongarch: Supplement vcpu env initial when vcpu reset

2023-10-09 Thread xianglai li
quot;Daniel P. Berrangé" Cc: Thomas Huth Cc: "Philippe Mathieu-Daudé" Cc: Richard Henderson Cc: Peter Maydell Cc: Bibo Mao Cc: Song Gao Cc: Xiaojuan Yang Cc: Tianrui Zhao Signed-off-by: Tianrui Zhao Signed-off-by: xianglai li --- target/loongarch/cpu.c | 2 ++ target

[PATCH RFC v4 4/9] target/loongarch: Implement kvm get/set registers

2023-10-09 Thread xianglai li
errangé" Cc: Thomas Huth Cc: "Philippe Mathieu-Daudé" Cc: Richard Henderson Cc: Peter Maydell Cc: Bibo Mao Cc: Song Gao Cc: Xiaojuan Yang Cc: Tianrui Zhao Signed-off-by: Tianrui Zhao Signed-off-by: xianglai li --- meson.build | 1 + target/loongarc

[PATCH RFC v4 9/9] target/loongarch: Add loongarch kvm into meson build

2023-10-09 Thread xianglai li
dré Lureau" Cc: "Daniel P. Berrangé" Cc: Thomas Huth Cc: "Philippe Mathieu-Daudé" Cc: Richard Henderson Cc: Peter Maydell Cc: Bibo Mao Cc: Song Gao Cc: Xiaojuan Yang Cc: Tianrui Zhao Signed-off-by: Tianrui Zhao Signed-off-by: xianglai li --- meson.build

[PATCH RFC v4 8/9] target/loongarch: Implement set vcpu intr for kvm

2023-10-09 Thread xianglai li
ngé" Cc: Thomas Huth Cc: "Philippe Mathieu-Daudé" Cc: Richard Henderson Cc: Peter Maydell Cc: Bibo Mao Cc: Song Gao Cc: Xiaojuan Yang Cc: Tianrui Zhao Signed-off-by: Tianrui Zhao Signed-off-by: xianglai li --- target/loongarch/cpu.c | 18 +

[PATCH RFC v4 5/9] target/loongarch: Implement kvm_arch_init function

2023-10-09 Thread xianglai li
: "Philippe Mathieu-Daudé" Cc: Richard Henderson Cc: Peter Maydell Cc: Bibo Mao Cc: Song Gao Cc: Xiaojuan Yang Cc: Tianrui Zhao Signed-off-by: Tianrui Zhao Reviewed-by: Richard Henderson Signed-off-by: xianglai li --- target/loongarch/kvm.c | 1 + 1 file changed, 1 insertion(+

[PATCH RFC v4 6/9] target/loongarch: Implement kvm_arch_init_vcpu

2023-10-09 Thread xianglai li
juan Yang Cc: Tianrui Zhao Signed-off-by: Tianrui Zhao Signed-off-by: xianglai li --- target/loongarch/cpu.h| 2 ++ target/loongarch/kvm.c| 23 +++ target/loongarch/trace-events | 2 ++ 3 files changed, 27 insertions(+) diff --git a/target/loongarch/cpu.h b

[PATCH RFC v4 2/9] target/loongarch: Define some kvm_arch interfaces

2023-10-09 Thread xianglai li
Signed-off-by: Tianrui Zhao Reviewed-by: Richard Henderson Signed-off-by: xianglai li --- target/loongarch/kvm.c | 131 + 1 file changed, 131 insertions(+) create mode 100644 target/loongarch/kvm.c diff --git a/target/loongarch/kvm.c b/target/loongarch/kvm

Re: [PATCH v4 3/4] qcow2: add zoned emulation capability

2023-10-09 Thread Sam Li
Eric Blake 于2023年9月29日周五 03:17写道: > > On Mon, Sep 18, 2023 at 05:53:12PM +0800, Sam Li wrote: > > By adding zone operations and zoned metadata, the zoned emulation > > capability enables full emulation support of zoned device using > > a qcow2 file. The zoned device met

[PATCH v8 3/5] vhost-user-scsi: support reconnect to backend

2023-10-08 Thread Li Feng
If the backend crashes and restarts, the device is broken. This patch adds reconnect for vhost-user-scsi. This patch also improves the error messages, and reports some silent errors. Tested with spdk backend. Signed-off-by: Li Feng --- hw/scsi/vhost-scsi-common.c | 16 +- hw/scsi

[PATCH v8 5/5] vhost-user: fix lost reconnect

2023-10-08 Thread Li Feng
a07d ("hw/virtio: generalise CHR_EVENT_CLOSED handling") Signed-off-by: Li Feng Reviewed-by: Raphael Norwitz --- hw/block/vhost-user-blk.c | 2 +- hw/scsi/vhost-user-scsi.c | 3 ++- hw/virtio/vhost-user-gpio.c| 2 +- hw/virtio/vhost-user.c | 10 -- incl

[PATCH v8 1/5] vhost-user-common: send get_inflight_fd once

2023-10-08 Thread Li Feng
. This patch is a preparation for the following patches. Signed-off-by: Li Feng Reviewed-by: Raphael Norwitz --- hw/scsi/vhost-scsi-common.c | 37 ++--- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/hw/scsi/vhost-scsi-common.c b/hw/scsi/vhost-scsi

<    1   2   3   4   5   6   7   8   9   10   >