Re: [PATCH v3 1/8] ppc/pnv: Add pca9552 to powernv10 for PCIe hotplug power control

2023-11-14 Thread Cédric Le Goater
On 11/14/23 20:56, Glenn Miles wrote: The Power Hypervisor code expects to see a pca9552 device connected to the 3rd PNV I2C engine on port 1 at I2C address 0x63 (or left- justified address of 0xC6). This is used by hypervisor code to control PCIe slot power during hotplug events.

[PATCH v3 54/70] i386/tdx: handle TDG.VP.VMCALL hypercall

2023-11-14 Thread Xiaoyao Li
From: Isaku Yamahata MapGPA is a hypercall to convert GPA from/to private GPA to/from shared GPA. As the conversion function is already implemented as kvm_convert_memory, wire it to TDX hypercall exit. Signed-off-by: Isaku Yamahata Signed-off-by: Xiaoyao Li --- accel/kvm/kvm-all.c | 2 +-

[PATCH v3 53/70] i386/tdx: setup a timer for the qio channel

2023-11-14 Thread Xiaoyao Li
From: Chenyi Qiang To avoid no response from QGS server, setup a timer for the transaction. If timeout, make it an error and interrupt guest. Define the threshold of time to 30s at present, maybe change to other value if not appropriate. Extract the common cleanup code to make it more clear.

[PATCH v3 56/70] i386/tdx: Handle TDG.VP.VMCALL

2023-11-14 Thread Xiaoyao Li
TD guest can use TDG.VP.VMCALL to request termination with error message encoded in GPRs. Parse and print the error message, and terminate the TD guest in the handler. Signed-off-by: Xiaoyao Li --- target/i386/kvm/tdx.c | 40 1 file changed, 40

[PATCH v3 70/70] docs: Add TDX documentation

2023-11-14 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 since v1: - Add prerequisite of private gmem; - update example command to launch TD; Changes since RFC v4: - add the restriction that kernel-irqchip must be

[PATCH v3 64/70] hw/i386: add eoi_intercept_unsupported member to X86MachineState

2023-11-14 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 v3 63/70] i386/tdx: LMCE is not supported for TDX

2023-11-14 Thread Xiaoyao Li
LMCE is not supported TDX since KVM doesn't provide emulation for MSR_IA32_FEAT_CTL. Signed-off-by: Xiaoyao Li --- target/i386/kvm/kvm-cpu.c | 5 + 1 file changed, 5 insertions(+) diff --git a/target/i386/kvm/kvm-cpu.c b/target/i386/kvm/kvm-cpu.c index 9c791b7b0520..8c618869533c 100644 ---

[PATCH v3 65/70] hw/i386: add option to forcibly report edge trigger in acpi tables

2023-11-14 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 Acked-by: Gerd Hoffmann --- hw/i386/acpi-build.c | 99 ---

[PATCH v3 66/70] i386/tdx: Don't synchronize guest tsc for TDs

2023-11-14 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 Acked-by: Gerd Hoffmann

[PATCH v3 60/70] i386/tdx: Disable SMM for TDX VMs

2023-11-14 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

[PATCH v3 69/70] i386/tdx: Don't get/put guest state for TDX VMs

2023-11-14 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 v3 61/70] i386/tdx: Disable PIC for TDX VMs

2023-11-14 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 v3 59/70] q35: Introduce smm_ranges property for q35-pci-host

2023-11-14 Thread Xiaoyao Li
From: Isaku Yamahata Add a q35 property to check whether or not SMM ranges, e.g. SMRAM, TSEG, etc... exist for the target platform. TDX doesn't support SMM and doesn't play nice with QEMU modifying related guest memory ranges. Signed-off-by: Isaku Yamahata Co-developed-by: Sean Christopherson

[PATCH v3 68/70] i386/tdx: Skip kvm_put_apicbase() for TDs

2023-11-14 Thread Xiaoyao Li
KVM doesn't allow wirting to MSR_IA32_APICBASE for TDs. Signed-off-by: Xiaoyao Li Acked-by: Gerd Hoffmann --- 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 12d909d08862..5c5400c51cd1 100644 ---

[PATCH v3 62/70] i386/tdx: Don't allow system reset for TDX VMs

2023-11-14 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 f1c4dd759b3e..a74a0d8e0891

[PATCH v3 52/70] i386/tdx: handle TDG.VP.VMCALL

2023-11-14 Thread Xiaoyao Li
From: Isaku Yamahata For GetQuote, delegate a request to Quote Generation Service. Add property "quote-generation-socket" to tdx-guest, whihc is a property of type SocketAddress to specify Quote Generation Service(QGS). On request, connect to the QGS, read request buffer from shared guest

[PATCH v3 58/70] pci-host/q35: Move PAM initialization above SMRAM initialization

2023-11-14 Thread Xiaoyao Li
From: Isaku Yamahata In mch_realize(), process PAM initialization before SMRAM initialization so that later patch can skill all the SMRAM related with a single check. Signed-off-by: Isaku Yamahata Signed-off-by: Xiaoyao Li --- hw/pci-host/q35.c | 19 ++- 1 file changed, 10

[PATCH v3 67/70] i386/tdx: Only configure MSR_IA32_UCODE_REV in kvm_init_msrs() for TDs

2023-11-14 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

[PATCH v3 55/70] i386/tdx: Limit the range size for MapGPA

2023-11-14 Thread Xiaoyao Li
From: Isaku Yamahata If the range for TDG.VP.VMCALL is too large, process the limited size and return retry error. It's bad for VMM to take too long time, e.g. second order, with blocking vcpu execution. It results in too many missing timer interrupts. Signed-off-by: Isaku Yamahata

[PATCH v3 57/70] i386/tdx: Wire TDX_REPORT_FATAL_ERROR with GuestPanic facility

2023-11-14 Thread Xiaoyao Li
Integrate TDX's TDX_REPORT_FATAL_ERROR into QEMU GuestPanic facility Originated-from: Isaku Yamahata Signed-off-by: Xiaoyao Li --- Changes from v2: - Add docmentation of new type and struct (Daniel) - refine the error message handling (Daniel) --- qapi/run-state.json | 27

[PATCH v3 50/70] i386/tdx: Finalize TDX VM

2023-11-14 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

[PATCH v3 48/70] i386/tdx: register TDVF as private memory

2023-11-14 Thread Xiaoyao Li
From: Chao Peng Allocate private guest memfd memory for BIOS if it's TD VM. Signed-off-by: Chao Peng Co-developed-by: Xiaoyao Li Signed-off-by: Xiaoyao Li --- hw/i386/x86.c | 10 +- target/i386/kvm/tdx.c | 18 ++ target/i386/kvm/tdx.h | 2 ++ 3 files

[PATCH v3 51/70] i386/tdx: handle TDG.VP.VMCALL

2023-11-14 Thread Xiaoyao Li
From: Isaku Yamahata For SetupEventNotifyInterrupt, record interrupt vector and the apic id of the vcpu that received this TDVMCALL. Later it can inject interrupt with given vector to the specific vcpu that received SetupEventNotifyInterrupt. Signed-off-by: Isaku Yamahata Signed-off-by:

[PATCH v3 46/70] i386/tdx: Add TDVF memory via KVM_TDX_INIT_MEM_REGION

2023-11-14 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 in v1: - rename variable @metadata

[PATCH v3 49/70] i386/tdx: Call KVM_TDX_INIT_VCPU to initialize TDX vcpu

2023-11-14 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 v3 47/70] memory: Introduce memory_region_init_ram_guest_memfd()

2023-11-14 Thread Xiaoyao Li
Introduce memory_region_init_ram_guest_memfd() to allocate private guset memfd on the MemoryRegion initialization. It's for the use case of TDVF, which must be private on TDX case. Signed-off-by: Xiaoyao Li --- include/exec/memory.h | 6 ++ system/memory.c | 27

[PATCH v3 45/70] i386/tdx: Setup the TD HOB list

2023-11-14 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

[PATCH v3 44/70] headers: Add definitions from UEFI spec for volumes, resources, etc...

2023-11-14 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 [1], PI spec [2] and TDVF design guide[3]. [1] UEFI

[PATCH v3 43/70] i386/tdx: Track RAM entries for TDX VM

2023-11-14 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 v3 42/70] i386/tdx: Track mem_ptr for each firmware entry of TDVF

2023-11-14 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 v3 41/70] i386/tdx: Don't initialize pc.rom for TDX VMs

2023-11-14 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 v3 39/70] i386/tdx: Parse TDVF metadata for TDX VM

2023-11-14 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 loading TDVF to the address below 4G, it needs parse TDVF metadata. Signed-off-by: Xiaoyao Li Acked-by: Gerd Hoffmann

[PATCH v3 40/70] i386/tdx: Skip BIOS shadowing setup

2023-11-14 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 Acked-by: Gerd Hoffmann --- Changes in v1: - update

[PATCH v3 35/70] i386/tdx: Make memory type private by default

2023-11-14 Thread Xiaoyao Li
By default (due to the recent UPM change), restricted memory attribute is shared. Convert the memory region from shared to private at the memory slot creation time. add kvm region registering function to check the flag and convert the region, and add memory listener to TDX guest code to set the

[PATCH v3 33/70] i386/tdx: Set kvm_readonly_mem_enabled to false for TDX VM

2023-11-14 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 v3 34/70] kvm/memory: Introduce the infrastructure to set the default shared/private value

2023-11-14 Thread Xiaoyao Li
Introduce new flag RAM_DEFAULT_PRIVATE for RAMBlock. It's used to indicate the default attribute, private or not. Set the RAM range to private explicitly when it's default private. Originated-from: Isaku Yamahata Signed-off-by: Xiaoyao Li --- accel/kvm/kvm-all.c | 10 ++

[PATCH v3 16/70] target/i386: Introduce kvm_confidential_guest_init()

2023-11-14 Thread Xiaoyao Li
Introduce a separate function kvm_confidential_guest_init(), which dispatches specific confidential guest initialization function by ms->cgs type. Signed-off-by: Xiaoyao Li Acked-by: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daudé --- target/i386/kvm/kvm.c | 11 ++-

[PATCH v3 36/70] kvm/tdx: Don't complain when converting vMMIO region to shared

2023-11-14 Thread Xiaoyao Li
From: Isaku Yamahata Because vMMIO region needs to be shared region, guest TD may explicitly convert such region from private to shared. Don't complain such conversion. Signed-off-by: Isaku Yamahata Signed-off-by: Xiaoyao Li --- accel/kvm/kvm-all.c | 25 - 1 file

[PATCH v3 28/70] i386/tdx: Make sept_ve_disable set by default

2023-11-14 Thread Xiaoyao Li
From: Isaku Yamahata For TDX KVM use case, Linux guest is the most major one. It requires sept_ve_disable set. Make it default for the main use case. For other use case, it can be enabled/disabled via qemu command line. Signed-off-by: Isaku Yamahata --- target/i386/kvm/tdx.c | 2 +- 1 file

[PATCH v3 38/70] i386/tdvf: Introduce function to parse TDVF metadata

2023-11-14 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

[PATCH v3 37/70] kvm/tdx: Ignore memory conversion to shared of unassigned region

2023-11-14 Thread Xiaoyao Li
From: Isaku Yamahata TDX requires vMMIO region to be shared. For KVM, MMIO region is the region which kvm memslot isn't assigned to (except in-kernel emulation). qemu has the memory region for vMMIO at each device level. While OVMF issues MapGPA(to-shared) conservatively on 32bit PCI MMIO

[PATCH v3 32/70] i386/tdx: Implement user specified tsc frequency

2023-11-14 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 v3 26/70] i386/tdx: Initialize TDX before creating TD vcpus

2023-11-14 Thread Xiaoyao Li
Invoke KVM_TDX_INIT in kvm_arch_pre_create_vcpu() that KVM_TDX_INIT configures global TD configurations, 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. Note, this doesn't address the fact that QEMU

[PATCH v3 31/70] i386/tdx: Allows mrconfigid/mrowner/mrownerconfig for TDX_INIT_VM

2023-11-14 Thread Xiaoyao Li
From: Isaku Yamahata Three sha384 hash values, mrconfigid, mrowner and mrownerconfig, of a TD can be provided for TDX attestation. So far they were hard coded as 0. Now allow user to specify those values via property mrconfigid, mrowner and mrownerconfig. They are all in base64 format. example

[PATCH v3 22/70] i386/tdx: Integrate tdx_caps->xfam_fixed0/1 into tdx_cpuid_lookup

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

[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(+), 1

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

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

[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
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 v3 21/70] i386/tdx: Update tdx_cpuid_lookup[].tdx_fixed0/1 by tdx_caps.cpuid_config[]

2023-11-14 Thread Xiaoyao Li
tdx_cpuid_lookup[].tdx_fixed0/1 is QEMU maintained data which reflects TDX restrictions regrading how some CPUIDs are 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 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
TDX VM requires VM type KVM_X86_TDX_VM to be passed to kvm_ioctl(KVM_CREATE_VM). If tdx-guest object is specified to confidential-guest-support, like, qemu -machine ...,confidential-guest-support=tdx0 \ -object tdx-guest,id=tdx0,... it parses VM type as KVM_X86_TDX_VM. Signed-off-by:

[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_cast with

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

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

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

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

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

2023-11-14 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-guest,id=tdx0 It has only one member 'attributes' with fixed value 0 and not

[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

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

2023-11-14 Thread Xiaoyao Li
Introduce the helper functions to set the attributes of a range of memory to private or shared. This is necessary to notify KVM the private/shared attribute of each gpa range. KVM needs the information to decide the GPA needs to be mapped at hva-based shared memory or guest_memfd based private

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

2023-11-14 Thread Xiaoyao Li
Commit d3a5038c461 ("exec: ram_block_discard_range") introduced ram_block_discard_range() which grabs some code from ram_discard_range(). However, during code movement, it changed alignment check of host_startaddr from qemu_host_page_size to rb->page_size. When ramblock is back'ed by hugepage, it

[PATCH v3 10/70] kvm: handle KVM_EXIT_MEMORY_FAULT

2023-11-14 Thread Xiaoyao Li
From: Chao Peng Currently only KVM_MEMORY_EXIT_FLAG_PRIVATE in flags is valid when KVM_EXIT_MEMORY_FAULT happens. It indicates userspace needs to do the memory conversion on the RAMBlock to turn the memory into desired attribute, i.e., private/shared. Note, KVM_EXIT_MEMORY_FAULT makes sense

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

2023-11-14 Thread Xiaoyao Li
Add a new member "require_guest_memfd" to memory backends. When it's set to true, it enables RAM_GUEST_MEMFD in ram_flags, thus private kvm guest_memfd will be allocated during RAMBlock allocation. Memory backend's @require_guest_memfd is wired with @require_guest_memfd field of MachineState.

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

2023-11-14 Thread Xiaoyao Li
It's used for discarding opposite memory after memory conversion, for confidential guest. When page is converted from shared to private, the original shared memory can be discarded via ram_block_discard_range(); When page is converted from private to shared, the original private memory is

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

2023-11-14 Thread Xiaoyao Li
KVM allows KVM_GUEST_MEMFD_ALLOW_HUGEPAGE for guest memfd. When the flag is set, KVM tries to allocate memory with transparent hugeapge at first and falls back to non-hugepage on failure. However, KVM defines one restriction that size must be hugepage size aligned when

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

2023-11-14 Thread Xiaoyao Li
Add KVM guest_memfd support to RAMBlock so both normal hva based memory and kvm guest memfd based private memory can be associated in one RAMBlock. Introduce new flag RAM_GUEST_MEMFD. When it's set, it calls KVM ioctl to create private guest_memfd during RAMBlock setup. Note, RAM_GUEST_MEMFD is

[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
This v3 series combines previous QEMU gmem series[1] and TDX QEMU series[2]. Because TDX is going to be the first user of gmem (guest memfd) in QEMU, bombining them together can provide us a full picture of how they work. KVM provides guest memfd, which cannot be mapped, read, or written by

Re: [PATCH trivial 17/21] target/riscv/cpu.h: spelling fix: separatly

2023-11-14 Thread Thomas Huth
On 14/11/2023 17.58, Michael Tokarev wrote: Fixes: 40336d5b1d4c "target/riscv: Add HS-mode virtual interrupt and IRQ filtering support." Cc: Rajnesh Kanwal Cc: Alistair Francis Signed-off-by: Michael Tokarev --- target/riscv/cpu.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)

Re: [PATCH trivial 16/21] include/hw/virtio/vhost.h: spelling fix: sate

2023-11-14 Thread Thomas Huth
On 14/11/2023 17.58, Michael Tokarev wrote: Fixes: 4a00d5d7f4b6 "vhost: Add high-level state save/load functions" Cc: Hanna Czenczek Cc: "Michael S. Tsirkin" Signed-off-by: Michael Tokarev --- include/hw/virtio/vhost.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

Re: [PATCH 7/7] target/i386/cpu: Improve error message for property "vendor"

2023-11-14 Thread Markus Armbruster
Philippe Mathieu-Daudé writes: > On 31/10/23 12:10, Markus Armbruster wrote: >> Improve >> $ qemu-system-x86_64 -device max-x86_64-cpu,vendor=me >> qemu-system-x86_64: -device max-x86_64-cpu,vendor=me: Property >> '.vendor' doesn't take value 'me' >> to >> qemu-system-x86_64:

Re: [PATCH trivial 14/21] include/block/ufs.h: spelling fix: setted

2023-11-14 Thread Thomas Huth
On 14/11/2023 17.58, Michael Tokarev wrote: Fixes: bc4e68d362ec "hw/ufs: Initial commit for emulated Universal-Flash-Storage" Cc: Jeuk Kim Signed-off-by: Michael Tokarev --- include/block/ufs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/block/ufs.h

Re: [PATCH trivial 13/21] hw/net/cadence_gem.c: spelling fixes: Octects

2023-11-14 Thread Thomas Huth
On 14/11/2023 17.58, Michael Tokarev wrote: Fixes: c755c943aa2e "hw/net/cadence_gem: use REG32 macro for register definitions" Cc: Luc Michel Cc: Peter Maydell Signed-off-by: Michael Tokarev --- hw/net/cadence_gem.c | 8 1 file changed, 4 insertions(+), 4 deletions(-)

Re: [PATCH trivial 12/21] hw/mem/memory-device.c: spelling fix: ontaining

2023-11-14 Thread Thomas Huth
On 14/11/2023 17.58, Michael Tokarev wrote: Fixes: 6c1b28e9e405 "memory-device: Support empty memory devices" Cc: David Hildenbrand Signed-off-by: Michael Tokarev --- hw/mem/memory-device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/mem/memory-device.c

Re: [PATCH trivial 10/21] migration/rdma.c: spelling fix: asume

2023-11-14 Thread Thomas Huth
On 14/11/2023 17.58, Michael Tokarev wrote: Fixes: 67c31c9c1af1 "migration: Don't abuse qemu_file transferred for RDMA" Cc: Juan Quintela Signed-off-by: Michael Tokarev --- migration/rdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migration/rdma.c

Re: [PATCH trivial 04/21] gdbstub: spelling fix: respectivelly

2023-11-14 Thread Thomas Huth
On 14/11/2023 17.58, Michael Tokarev wrote: Fixes: 761e3c10881b "gdbstub: fixes cases where wrong threads were reported to GDB on SIGINT" Cc: Matheus Branco Borella Cc: "Alex Bennée" Signed-off-by: Michael Tokarev --- gdbstub/gdbstub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)

Re: [PATCH trivial 03/21] hw/cxl: spelling fixes: limitaions, potentialy, intialized

2023-11-14 Thread Thomas Huth
On 14/11/2023 17.58, Michael Tokarev wrote: Fixes: 388d6b574e28 "hw/cxl: Use switch statements for read and write of cachemem registers" Fixes: 3314efd276ad "hw/cxl/mbox: Add Physical Switch Identify command." Fixes: 004e3a93b814 "hw/cxl: Add tunneled command support to mailbox for switch

Re: [PATCH trivial 02/21] linux-user: spelling fixes: othe, necesary

2023-11-14 Thread Thomas Huth
On 14/11/2023 17.58, Michael Tokarev wrote: Fixes: e34136d93059 "linux-user/ppc: Add vdso" Fixes: 86f04735ac20 "linux-user: Fix brk() to release pages" Cc: Richard Henderson Cc: Helge Deller Cc: Laurent Vivier Signed-off-by: Michael Tokarev --- linux-user/ppc/vdso.S | 2 +-

Re: [PATCH 1/7] spapr/pci: Correct "does not support hotplugging error messages

2023-11-14 Thread Markus Armbruster
BALATON Zoltan writes: > On Wed, 1 Nov 2023, Daniel Henrique Barboza wrote: >> On 10/31/23 08:10, Markus Armbruster wrote: >>> When dynamic-reconfiguration is off, hot plug / unplug can fail with >>> "Bus 'spapr-pci-host-bridge' does not support hotplugging". >>> spapr-pci-host-bridge is a

Re: [PATCH trivial 06/21] docs/devel/migration.rst: spelling fix: doen't

2023-11-14 Thread Thomas Huth
On 15/11/2023 07.41, Michael Tokarev wrote: 14.11.2023 22:05, Thomas Huth wrote: On 14/11/2023 17.58, Michael Tokarev wrote: Fixes: 1aefe2ca1423 "migration/doc: Add documentation for backwards compatiblity" Cc: Juan Quintela Signed-off-by: Michael Tokarev ---   docs/devel/migration.rst | 8

Re: [PATCH trivial 06/21] docs/devel/migration.rst: spelling fix: doen't

2023-11-14 Thread Michael Tokarev
14.11.2023 22:05, Thomas Huth wrote: On 14/11/2023 17.58, Michael Tokarev wrote: Fixes: 1aefe2ca1423 "migration/doc: Add documentation for backwards compatiblity" Cc: Juan Quintela Signed-off-by: Michael Tokarev ---   docs/devel/migration.rst | 8   1 file changed, 4 insertions(+), 4

Re: [PATCH] MAINTAINERS: Fully cover target/i386/*

2023-11-14 Thread Markus Armbruster
Thomas addressed this differently in commit d229996b402 (MAINTAINERS: Add a general architecture section for x86). Ignore my patch.

Re: [PATCH] tests/avocado/reverse_debugging: Disable the ppc64 tests by default

2023-11-14 Thread Thomas Huth
On 15/11/2023 02.15, Nicholas Piggin wrote: On Wed Nov 15, 2023 at 4:29 AM AEST, Thomas Huth wrote: On 14/11/2023 17.37, Philippe Mathieu-Daudé wrote: On 14/11/23 17:31, Thomas Huth wrote: The tests seem currently to be broken. Disable them by default until someone fixes them. Signed-off-by:

Re: [PATCH] tests/avocado/intel_iommu: Add asset hashes to avoid warnings

2023-11-14 Thread Thomas Huth
On 14/11/2023 21.42, Eric Auger wrote: Hi Thomas, On 11/14/23 15:35, Thomas Huth wrote: The intel_iommu test is currently succeeding with annoying warnings. nit: you may have precised the nature of the warning or quotes The annoying warnings look like this (in the summary): (031/174)

Re: [PATCH trivial 11/21] contrib/vhost-user-gpu/virgl.c: spelling fix: mesage

2023-11-14 Thread Marc-André Lureau
On Tue, Nov 14, 2023 at 8:58 PM Michael Tokarev wrote: > > Fixes: e3c82fe04f31 "contrib/vhost-user-gpu: add support for sending dmabuf > modifiers" > Cc: Erico Nunes > Cc: "Marc-André Lureau" > Signed-off-by: Michael Tokarev Reviewed-by: Marc-André Lureau > --- >

Re: [PATCH v6 11/21] virtio-net: Return an error when vhost cannot enable RSS

2023-11-14 Thread Akihiko Odaki
On 2023/11/15 7:09, Yuri Benditovich wrote: On Tue, Nov 14, 2023 at 9:03 AM Akihiko Odaki > wrote: On 2023/11/14 2:26, Yuri Benditovich wrote: > > > On Mon, Nov 13, 2023 at 2:44 PM Akihiko Odaki mailto:akihiko.od...@daynix.com>

RE: [PATCH v6 00/21] vfio: Adopt iommufd

2023-11-14 Thread Duan, Zhenzhong
Hi Cédric, >-Original Message- >From: Cédric Le Goater >Sent: Tuesday, November 14, 2023 10:52 PM >Subject: Re: [PATCH v6 00/21] vfio: Adopt iommufd > >Hello Zhenzhong, > >On 11/14/23 11:09, Zhenzhong Duan wrote: >> Hi, >> >> Thanks all for giving guides and comments on previous series,

RE: [PATCH v6 01/21] backends/iommufd: Introduce the iommufd object

2023-11-14 Thread Duan, Zhenzhong
>-Original Message- >From: Cédric Le Goater >Sent: Tuesday, November 14, 2023 9:29 PM >Subject: Re: [PATCH v6 01/21] backends/iommufd: Introduce the iommufd object > >On 11/14/23 11:09, Zhenzhong Duan wrote: >> From: Eric Auger >> >> Introduce an iommufd object which allows the

Re: [PATCH V7 8/8] docs/specs/acpi_hw_reduced_hotplug: Add the CPU Hotplug Event Bit

2023-11-14 Thread Gavin Shan
On 11/14/23 06:12, Salil Mehta wrote: GED interface is used by many hotplug events like memory hotplug, NVDIMM hotplug and non-hotplug events like system power down event. Each of these can be selected using a bit in the 32 bit GED IO interface. A bit has been reserved for the CPU hotplug event.

[PATCH] migration: free 'saddr' since be no longer used

2023-11-14 Thread Zongmin Zhou
Since socket_parse() will allocate memory for 'saddr', and its value will pass to 'addr' that allocated by migrate_uri_parse(),so free 'saddr' to avoid memory leak. Fixes: 72a8192e225c ("migration: convert migration 'uri' into 'MigrateAddress'") Signed-off-by: Zongmin Zhou ---

RE: [PATCH v6 08/21] vfio/pci: Introduce a vfio pci hot reset interface

2023-11-14 Thread Duan, Zhenzhong
>-Original Message- >From: Cédric Le Goater >Sent: Tuesday, November 14, 2023 9:52 PM >Subject: Re: [PATCH v6 08/21] vfio/pci: Introduce a vfio pci hot reset >interface > >On 11/14/23 11:09, Zhenzhong Duan wrote: >> Legacy vfio pci and iommufd cdev have different process to hot reset

RE: [PATCH v6 06/21] vfio/iommufd: Add support for iova_ranges and pgsizes

2023-11-14 Thread Duan, Zhenzhong
>-Original Message- >From: Cédric Le Goater >Sent: Tuesday, November 14, 2023 9:46 PM >Subject: Re: [PATCH v6 06/21] vfio/iommufd: Add support for iova_ranges and >pgsizes > >On 11/14/23 11:09, Zhenzhong Duan wrote: >> Some vIOMMU such as virtio-iommu use IOVA ranges from host side to

Re: [PATCH trivial 19/21] tests/qtest/ufs-test.c: spelling fix: tranfer

2023-11-14 Thread Jeuk Kim
On 14/11/2023 17.58, Michael Tokarev wrote: > Fixes: 631c872614ac "tests/qtest: Introduce tests for UFS" > Cc: Jeuk Kim > Signed-off-by: Michael Tokarev > --- >   tests/qtest/ufs-test.c | 2 +- >   1 file changed, 1 insertion(+), 1 deletion(-) >  > diff --git a/tests/qtest/ufs-test.c

Re: [PATCH trivial 14/21] include/block/ufs.h: spelling fix: setted

2023-11-14 Thread Jeuk Kim
On 14/11/2023 17.58, Michael Tokarev wrote: > Fixes: bc4e68d362ec "hw/ufs: Initial commit for emulated > Universal-Flash-Storage" > Cc: Jeuk Kim > Signed-off-by: Michael Tokarev > --- >  include/block/ufs.h | 2 +- >  1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git

Re: [PATCH v3 4/4] hw/riscv/virt: Add IOPMP support

2023-11-14 Thread Ethan Chen via
On Tue, Nov 14, 2023 at 02:50:21PM -0300, Daniel Henrique Barboza wrote: > > > On 11/14/23 06:47, Ethan Chen wrote: > > - Add 'iopmp=on' option to enable a iopmp device and a dma device > > connect to the iopmp device > > - Add 'iopmp_cascade=on' option to enable iopmp cascading. > > > >

RE: [PATCH v5 03/11] hw/misc: Add qtest for NPCM7xx PCI Mailbox

2023-11-14 Thread kft...@nuvoton.com
-Original Message- From: Peter Maydell Sent: Tuesday, November 14, 2023 6:58 PM To: CS20 KFTing Cc: Nabih Estefan ; qemu-...@nongnu.org; qemu-devel@nongnu.org; wuhao...@google.com; jasonw...@redhat.com; IS20 Avi Fishman ; CS20 KWLiu ; IS20 Tomer Maimon ; IN20 Hila Miranda-Kuzi

  1   2   3   4   5   >