Re: Inquiry About PC-Relative Code Generation in QEMU

2024-11-04 Thread Yip Coekjan
Thank you for your response. On 11/4/24 20:51:40, Richard Henderson wrote: > User emulation does not have multiple mappings of the same physical page > like system mode does. This is because in user emulation we have only one > process to emulate. To clarify, is the reason QEMU does not use `CF

Re: [PATCH v3 2/2] vfio/migration: Add vfio_save_block_precopy_empty_hit trace event

2024-11-04 Thread Cédric Le Goater
On 11/4/24 22:29, Maciej S. Szmigiero wrote: From: "Maciej S. Szmigiero" This way it is clearly known when there's no more data to send for that device. Signed-off-by: Maciej S. Szmigiero --- hw/vfio/migration.c | 8 hw/vfio/trace-events | 1 + include/hw/vfio/

Re: [PULL 00/50] riscv-to-apply queue

2024-11-04 Thread Michael Tokarev
05.11.2024 10:45, Michael Tokarev wrote: target/riscv/csr.c: Fix an access to VXSAT hw/intc: Don't clear pending bits on IRQ lowering target/riscv: Set vtype.vill on CPU reset hw/intc/riscv_aplic: Check and update pending when write sourcecfg target/riscv/kvm: set 'aia_mode' to default in error

Re: [PATCH v4 15/26] hw/net/fsl_etsec/miim: Reuse MII constants

2024-11-04 Thread Akihiko Odaki
On 2024/11/03 22:34, Bernhard Beschow wrote: Instead of defining redundant constants and using magic numbers reuse the existing MII constants. Signed-off-by: Bernhard Beschow cc: Akihiko Odaki Reviewed-by: Akihiko Odaki

[PATCH v6 49/60] i386/tdx: Mask off CPUID bits by unsupported TD Attributes

2024-11-04 Thread Xiaoyao Li
For TDX, some CPUID feature bit is configured via TD attributes. Adjust the supported CPUID to mask off the bit if its matched attribute is unsupported. Signed-off-by: Xiaoyao Li --- target/i386/cpu.h | 4 target/i386/kvm/tdx.c | 54 +++ 2 files

RE: [PATCH 2/3] intel_iommu: Add missed sanity check for 256-bit invalidation queue

2024-11-04 Thread Duan, Zhenzhong
>-Original Message- >From: CLEMENT MATHIEU--DRIF >Sent: Tuesday, November 5, 2024 2:36 PM >Subject: Re: [PATCH 2/3] intel_iommu: Add missed sanity check for 256-bit >invalidation queue > >I saw the pull request, just a few questions/comments in case there is a >new spin. >These are not h

Re: [PULL 04/50] target/riscv: Correct SXL return value for RV32 in RV64 QEMU

2024-11-04 Thread Michael Tokarev
31.10.2024 06:52, Alistair Francis wrote: From: TANG Tiancheng ... diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index 1619c3acb6..a63a29744c 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -709,8 +709,11 @@ static inline RISCVMXL riscv_cpu_sxl(CPURISCVState *env) #ifdef C

RE: [PATCH v4 13/17] intel_iommu: piotlb invalidation should notify unmap

2024-11-04 Thread Duan, Zhenzhong
>-Original Message- >From: Liu, Yi L >Sent: Tuesday, November 5, 2024 2:30 PM >Subject: Re: [PATCH v4 13/17] intel_iommu: piotlb invalidation should notify >unmap > >On 2024/11/4 16:15, Duan, Zhenzhong wrote: >> >>> vtd_piotlb_page_invalidate(IntelIOMMUState *s, uint16_t domain_id,

[PATCH v6 04/60] i386/tdx: Implement tdx_kvm_init() to initialize TDX VM context

2024-11-04 Thread Xiaoyao Li
Implement TDX specific ConfidentialGuestSupportClass::kvm_init() callback, tdx_kvm_init(). Mark guest state is proctected for TDX VM. More TDX specific initialization will be added later. Signed-off-by: Xiaoyao Li --- Changes in v6: - remove Acked-by from Gerd since the patch changed due to us

[PATCH v6 38/60] i386/tdx: Disable SMM for TDX VMs

2024-11-04 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 | 9 + 1 file changed, 9 inser

Re: [PATCH 1/3] intel_iommu: Send IQE event when setting reserved bit in IQT_TAIL

2024-11-04 Thread CLEMENT MATHIEU--DRIF
Hi, lgtm Thanks cmd On 04/11/2024 13:55, Zhenzhong Duan wrote: > Caution: External email. Do not open attachments or click links, unless this > email comes from a known sender and you know the content is safe. > > > According to VTD spec, Figure 11-22, Invalidation Queue Tail Register, > "When

[PATCH v6 26/60] i386/tdx: Call KVM_TDX_INIT_VCPU to initialize TDX vcpu

2024-11-04 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 v6 54/60] i386/cgs: Introduce x86_confidential_guest_check_features()

2024-11-04 Thread Xiaoyao Li
To do cgs specific feature checking. Note the feature checking in x86_cpu_filter_features() is valid for non-cgs VMs. For cgs VMs like TDX, what features can be supported has more restrictions. Signed-off-by: Xiaoyao Li --- target/i386/confidential-guest.h | 13 + target/i386/kvm/kvm

Re: [PATCH 3/3] intel_iommu: Add missed reserved bit check for IEC descriptor

2024-11-04 Thread Yi Liu
On 2024/11/4 20:55, Zhenzhong Duan wrote: IEC descriptor is 128-bit invalidation descriptor, must be padded with 128-bits of 0s in the upper bytes to create a 256-bit descriptor when the invalidation queue is configured for 256-bit descriptors (IQA_REG.DW=1). Fixes: 02a2cbc872df ("x86-iommu: int

[PATCH v6 10/60] i386/tdx: Add property sept-ve-disable for tdx-guest object

2024-11-04 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 c

Re: [PATCH 1/3] intel_iommu: Send IQE event when setting reserved bit in IQT_TAIL

2024-11-04 Thread Yi Liu
On 2024/11/4 20:55, Zhenzhong Duan wrote: According to VTD spec, Figure 11-22, Invalidation Queue Tail Register, "When Descriptor Width (DW) field in Invalidation Queue Address Register (IQA_REG) is Set (256-bit descriptors), hardware treats bit-4 as reserved and a value of 1 in the bit will resu

[PATCH v6 53/60] i386/cpu: introduce mark_forced_on_features()

2024-11-04 Thread Xiaoyao Li
Signed-off-by: Xiaoyao Li --- target/i386/cpu.c | 29 + target/i386/cpu.h | 5 + 2 files changed, 34 insertions(+) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index e728fb6b9f10..472ab206d8fe 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -5507,

[PATCH v6 56/60] i386/tdx: Don't treat SYSCALL as unavailable

2024-11-04 Thread Xiaoyao Li
Signed-off-by: Xiaoyao Li --- target/i386/kvm/tdx.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/target/i386/kvm/tdx.c b/target/i386/kvm/tdx.c index 9cb099e160e4..05475edf72bd 100644 --- a/target/i386/kvm/tdx.c +++ b/target/i386/kvm/tdx.c @@ -734,6 +734,13 @@ static int tdx_check_fe

Re: [PATCH 2/3] intel_iommu: Add missed sanity check for 256-bit invalidation queue

2024-11-04 Thread Yi Liu
On 2024/11/5 14:12, Duan, Zhenzhong wrote: -Original Message- From: Liu, Yi L Sent: Tuesday, November 5, 2024 1:05 PM Subject: Re: [PATCH 2/3] intel_iommu: Add missed sanity check for 256-bit invalidation queue On 2024/11/4 20:55, Zhenzhong Duan wrote: According to VTD spec, a 256-b

[PATCH v6 13/60] i386/tdx: Validate TD attributes

2024-11-04 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 Ac

[PATCH v6 52/60] i386/cpu: Expose mark_unavailable_features() for TDX

2024-11-04 Thread Xiaoyao Li
Expose mark_unavailable_features() out of cpu.c so that it can be used by TDX when features are masked off. Signed-off-by: Xiaoyao Li --- target/i386/cpu.c | 4 ++-- target/i386/cpu.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c ind

[PATCH v6 46/60] i386/cgs: Rename *mask_cpuid_features() to *adjust_cpuid_features()

2024-11-04 Thread Xiaoyao Li
Because for TDX case, there are also fixed-1 bits that enfored by TDX module. Signed-off-by: Xiaoyao Li --- target/i386/confidential-guest.h | 20 ++-- target/i386/kvm/kvm.c| 2 +- target/i386/sev.c| 4 ++-- 3 files changed, 13 insertions(+), 13 dele

[PATCH v6 43/60] i386/tdx: Only configure MSR_IA32_UCODE_REV in kvm_init_msrs() for TDs

2024-11-04 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

[PATCH v6 44/60] i386/tdx: Skip kvm_put_apicbase() for TDs

2024-11-04 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 8909fce14909..c39e879a77e9 100644 --- a/target/i386/kv

[PATCH v6 37/60] i386/tdx: Set kvm_readonly_mem_enabled to false for TDX VM

2024-11-04 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 v6 28/60] i386/tdx: Enable user exit on KVM_HC_MAP_GPA_RANGE

2024-11-04 Thread Xiaoyao Li
KVM translates TDG.VP.VMCALL to KVM_HC_MAP_GPA_RANGE, and QEMU needs to enable user exit on KVM_HC_MAP_GPA_RANGE in order to handle the memory conversion requested by TD guest. Signed-off-by: Xiaoyao Li --- changes in v6: - new patch; --- target/i386/kvm/tdx.c | 7 +++ 1 file changed, 7 ins

[PATCH v6 06/60] i386/tdx: Introduce is_tdx_vm() helper and cache tdx_guest object

2024-11-04 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 Reviewed-by: Isaku Yamahata --- changes in v3: - replace

[PATCH v6 51/60] i386/tdx: Mask off CPUID bits by unsupported XFAM

2024-11-04 Thread Xiaoyao Li
Mask off the CPUID bits as unsupported if its matched XFAM bit is not supported. Otherwise, it might fail the check in setup_td_xfam() as unsupported XFAM being requested. Signed-off-by: Xiaoyao Li --- target/i386/kvm/tdx.c | 38 ++ 1 file changed, 38 insertio

[PATCH v6 36/60] i386/tdx: Force exposing CPUID 0x1f

2024-11-04 Thread Xiaoyao Li
TDX uses CPUID 0x1f to configure TD guest's CPU topology. So set enable_cpuid_0x1f for TDs. Signed-off-by: Xiaoyao Li --- target/i386/kvm/tdx.c | 4 1 file changed, 4 insertions(+) diff --git a/target/i386/kvm/tdx.c b/target/i386/kvm/tdx.c index 289722a129ce..19ce90df4143 100644 --- a/targ

[PATCH v6 45/60] i386/tdx: Don't get/put guest state for TDX VMs

2024-11-04 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 v6 58/60] cpu: Introduce qemu_early_init_vcpu()

2024-11-04 Thread Xiaoyao Li
Currently cpu->nr_cores and cpu->nr_threads are initialized in qemu_init_vcpu(), which is called a bit late in *cpu_realizefn() for each ARCHes. x86 arch would like to set CPUID_HT in env->features[FEAT_1_EDX] based on the value of cpu->nr_threads * cpu->nr_cores. It requires nr_cores and nr_threa

[PATCH v6 07/60] kvm: Introduce kvm_arch_pre_create_vcpu()

2024-11-04 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 Da

[PATCH v6 24/60] i386/tdx: Setup the TD HOB list

2024-11-04 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 v6 35/60] i386/cpu: Introduce enable_cpuid_0x1f to force exposing CPUID 0x1f

2024-11-04 Thread Xiaoyao Li
Currently, QEMU exposes CPUID 0x1f to guest only when necessary, i.e., when topology level that cannot be enumerated by leaf 0xB, e.g., die or module level, are configured for the guest, e.g., -smp xx,dies=2. However, TDX architecture forces to require CPUID 0x1f to configure CPU topology. Introd

[PATCH v6 19/60] i386/tdx: Parse TDVF metadata for TDX VM

2024-11-04 Thread Xiaoyao Li
After TDVF is loaded to bios MemoryRegion, it needs parse TDVF metadata. Signed-off-by: Xiaoyao Li Acked-by: Gerd Hoffmann --- hw/i386/pc_sysfw.c | 7 +++ target/i386/kvm/tdx-stub.c | 5 + target/i386/kvm/tdx.c | 5 + target/i386/kvm/tdx.h | 3 +++ 4 files changed,

[PATCH v6 18/60] i386/tdvf: Introduce function to parse TDVF metadata

2024-11-04 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 v6 42/60] i386/tdx: Don't synchronize guest tsc for TDs

2024-11-04 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 v6 60/60] docs: Add TDX documentation

2024-11-04 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 v6: - Add more information of "Feature configuration" - Mark TD Attestation as future work because KVM now drops the support of it. Changes in v5: - Add TD a

[PATCH v6 33/60] i386/cpu: introduce x86_confidenetial_guest_cpu_realizefn()

2024-11-04 Thread Xiaoyao Li
To execute confidential guest specific cpu realize operations. Signed-off-by: Xiaoyao Li --- changes in v6: - new patch; --- target/i386/confidential-guest.h | 12 target/i386/cpu.c| 13 - 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/ta

[PATCH v6 30/60] i386/tdx: Wire TDX_REPORT_FATAL_ERROR with GuestPanic facility

2024-11-04 Thread Xiaoyao Li
Integrate TDX's TDX_REPORT_FATAL_ERROR into QEMU GuestPanic facility Originated-from: Isaku Yamahata Signed-off-by: Xiaoyao Li --- Changes in v6: - change error_code of GuestPanicInformationTdx from uint64_t to uint32_t, to only contains the bit 31:0 returned in r12. Changes in v5: - mention

[PATCH v6 22/60] i386/tdx: Track RAM entries for TDX VM

2024-11-04 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 v6 50/60] i386/cpu: Move CPUID_XSTATE_XSS_MASK to header file and introduce CPUID_XSTATE_MASK

2024-11-04 Thread Xiaoyao Li
They will be used by TDX. Signed-off-by: Xiaoyao Li --- target/i386/cpu.c | 3 --- target/i386/cpu.h | 5 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 119b38bcb0c1..8c507ad406e7 100644 --- a/target/i386/cpu.c +++ b/target/i386/c

[PATCH v6 27/60] i386/tdx: Finalize TDX VM

2024-11-04 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 v6 47/60] i386/tdx: Implement adjust_cpuid_features() for TDX

2024-11-04 Thread Xiaoyao Li
1. QEMU's support for Intel PT is borken in general, thus doesn't support for TDX. 2. Only limited KVM PV features are supported for TD guest. 3. Drop the AMD specific bits that are reserved on Intel platform. Signed-off-by: Xiaoyao Li --- target/i386/kvm/tdx.c | 44

[PATCH v6 25/60] i386/tdx: Add TDVF memory via KVM_TDX_INIT_MEM_REGION

2024-11-04 Thread Xiaoyao Li
From: Isaku Yamahata TDVF firmware (CODE and VARS) needs to be copied to TD's private memory via KVM_TDX_INIT_MEM_REGION, as well as TD HOB and TEMP memory. If the TDVF section has TDVF_SECTION_ATTRIBUTES_MR_EXTEND set in the flag, calling KVM_TDX_EXTEND_MEMORY to extend the measurement. After

[PATCH v6 34/60] i386/tdx: implement tdx_cpu_realizefn()

2024-11-04 Thread Xiaoyao Li
For TDX guest, KVM doesn't allow phys_bits configuration and the phys_bits can only be native/host value. Add the logic to set cpu->phys_bits to host value when user doesn't give a explicit one and error out when user desires a different one than host value. Signed-off-by: Xiaoyao Li --- Changes

[PATCH v6 57/60] i386/tdx: Make invtsc default on

2024-11-04 Thread Xiaoyao Li
Because it's fixed1 bit that enforced by TDX module. Signed-off-by: Xiaoyao Li --- target/i386/kvm/tdx.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/i386/kvm/tdx.c b/target/i386/kvm/tdx.c index 05475edf72bd..4cb1f4ac3479 100644 --- a/target/i386/kvm/tdx.c +++ b/target/i386/kvm/

[PATCH v6 40/60] hw/i386: add eoi_intercept_unsupported member to X86MachineState

2024-11-04 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 v6 41/60] hw/i386: add option to forcibly report edge trigger in acpi tables

2024-11-04 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 --- hw/i386/acpi-commo

[PATCH v6 02/60] i386: Introduce tdx-guest object

2024-11-04 Thread Xiaoyao Li
Introduce tdx-guest object which inherits X86_CONFIDENTIAL_GUEST, and will be used to create TDX VMs (TDs) by qemu -machine ...,confidential-guest-support=tdx0 \ -object tdx-guest,id=tdx0 It has one QAPI member 'attributes' defined, which allows user to set TD's attributes directly.

[PATCH v6 14/60] i386/tdx: Support user configurable mrconfigid/mrowner/mrownerconfig

2024-11-04 Thread Xiaoyao Li
From: Isaku Yamahata Three sha384 hash values, mrconfigid, mrowner and mrownerconfig, of a TD can be provided for TDX attestation. Detailed meaning of them can be found: https://lore.kernel.org/qemu-devel/31d6dbc1-f453-4cef-ab08-4813f4e0f...@intel.com/ Allow user to specify those values via pro

[PATCH v6 39/60] i386/tdx: Disable PIC for TDX VMs

2024-11-04 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

[PATCH v6 29/60] i386/tdx: Handle KVM_SYSTEM_EVENT_TDX_FATAL

2024-11-04 Thread Xiaoyao Li
TD guest can use TDG.VP.VMCALL to request termination. KVM translates such request into KVM_EXIT_SYSTEM_EVENT with type of KVM_SYSTEM_EVENT_TDX_FATAL. Add hanlder for such exit. Parse and print the error message, and terminate the TD guest in the handler. Signed-off-by: Xiaoyao Li --- Changes in

[PATCH v6 31/60] i386/cpu: introduce x86_confidential_guest_cpu_instance_init()

2024-11-04 Thread Xiaoyao Li
To allow execute confidential guest specific cpu init operations. Signed-off-by: Xiaoyao Li --- Changes in v6: - new patch; --- target/i386/confidential-guest.h | 11 +++ target/i386/cpu.c| 10 ++ 2 files changed, 21 insertions(+) diff --git a/target/i386/confid

[PATCH v6 21/60] i386/tdx: Track mem_ptr for each firmware entry of TDVF

2024-11-04 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 v6 23/60] headers: Add definitions from UEFI spec for volumes, resources, etc...

2024-11-04 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 Specificat

[PATCH v6 03/60] i386/tdx: Implement tdx_kvm_type() for TDX

2024-11-04 Thread Xiaoyao Li
TDX VM requires VM type to be KVM_X86_TDX_VM. Implement tdx_kvm_type() as X86ConfidentialGuestClass->kvm_type. Signed-off-by: Xiaoyao Li --- Changes in v6: - new added patch; --- target/i386/kvm/kvm.c | 1 + target/i386/kvm/tdx.c | 12 2 files changed, 13 insertions(+) diff --git

[PATCH v6 05/60] i386/tdx: Get tdx_capabilities via KVM_TDX_CAPABILITIES

2024-11-04 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 v6 12/60] i386/tdx: Wire CPU features up with attributes of TD guest

2024-11-04 Thread Xiaoyao Li
For QEMU VMs, - PKS is configured via CPUID_7_0_ECX_PKS, e.g., -cpu xxx,+pks and - PMU is configured by x86cpu->enable_pmu, e.g., -cpu xxx,pmu=on While the bit 30 (PKS) and bit 63 (PERFMON) of TD's attributes are also used to configure the PKS and PERFMON/PMU of TD, reuse the existing configu

[PATCH v6 16/60] i386/tdx: Implement user specified tsc frequency

2024-11-04 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 Acked-by

Re: [PATCH 3/3] intel_iommu: Add missed reserved bit check for IEC descriptor

2024-11-04 Thread CLEMENT MATHIEU--DRIF
Hi, lgtm Thanks cmd On 04/11/2024 13:55, Zhenzhong Duan wrote: > Caution: External email. Do not open attachments or click links, unless this > email comes from a known sender and you know the content is safe. > > > IEC descriptor is 128-bit invalidation descriptor, must be padded with > 128-

Re: [PATCH 2/3] intel_iommu: Add missed sanity check for 256-bit invalidation queue

2024-11-04 Thread CLEMENT MATHIEU--DRIF
I saw the pull request, just a few questions/comments in case there is a new spin. These are not hard requirements, the current version looks good as well. On 04/11/2024 13:55, Zhenzhong Duan wrote: > Caution: External email. Do not open attachments or click links, unless this > email comes from

[PATCH v6 17/60] i386/tdx: load TDVF for TD guest

2024-11-04 Thread Xiaoyao Li
From: Chao Peng TDVF(OVMF) needs to run at private memory for TD guest. TDX cannot support pflash device since it doesn't support read-only private memory. Thus load TDVF(OVMF) with -bios option for TDs. Use memory_region_init_ram_guest_memfd() to allocate the MemoryRegion for TDVF because it ne

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

2024-11-04 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 | 70 ++

[PATCH v6 00/60] QEMU TDX support

2024-11-04 Thread Xiaoyao Li
This is the v6 series of TDX QEMU enabling. The matching KVM is https://github.com/intel/tdx/tree/tdx_kvm_dev-2024-10-30 This series is also available in github: https://github.com/intel-staging/qemu-tdx/tree/tdx-qemu-upstream-v6.1 Note, to boot a TD, it requires 1)TDX module 1.5.06.00.0744[0], o

Re: [PATCH v4 15/17] intel_iommu: Introduce a property x-fls for scalable modern mode

2024-11-04 Thread Yi Liu
On 2024/11/5 14:03, Duan, Zhenzhong wrote: -Original Message- From: Liu, Yi L Sent: Tuesday, November 5, 2024 1:56 PM Subject: Re: [PATCH v4 15/17] intel_iommu: Introduce a property x-fls for scalable modern mode On 2024/11/5 11:11, Duan, Zhenzhong wrote: +DEFINE_PROP_BOOL("x-f

RE: [PATCH 2/3] intel_iommu: Add missed sanity check for 256-bit invalidation queue

2024-11-04 Thread Duan, Zhenzhong
>-Original Message- >From: Liu, Yi L >Sent: Tuesday, November 5, 2024 1:05 PM >Subject: Re: [PATCH 2/3] intel_iommu: Add missed sanity check for 256-bit >invalidation queue > >On 2024/11/4 20:55, Zhenzhong Duan wrote: >> According to VTD spec, a 256-bit descriptor will result in an inval

RE: [PATCH v4 15/17] intel_iommu: Introduce a property x-fls for scalable modern mode

2024-11-04 Thread Duan, Zhenzhong
>-Original Message- >From: Liu, Yi L >Sent: Tuesday, November 5, 2024 1:56 PM >Subject: Re: [PATCH v4 15/17] intel_iommu: Introduce a property x-fls for >scalable modern mode > >On 2024/11/5 11:11, Duan, Zhenzhong wrote: > >> +DEFINE_PROP_BOOL("x-fls", IntelIOMMUState, scalable_m

[PATCH] vhost: fail device start if iotlb update fails

2024-11-04 Thread Prasad Pandit
From: Prasad Pandit While starting a vhost device, updating iotlb entries via 'vhost_device_iotlb_miss' may return an error. qemu-kvm: vhost_device_iotlb_miss: 700871,700871: Fail to update device iotlb Fail device start when such an error occurs. Signed-off-by: Prasad Pandit --- hw/vi

Re: [PATCH v4 15/17] intel_iommu: Introduce a property x-fls for scalable modern mode

2024-11-04 Thread Yi Liu
On 2024/11/5 11:11, Duan, Zhenzhong wrote: +DEFINE_PROP_BOOL("x-fls", IntelIOMMUState, scalable_modern, FALSE), DEFINE_PROP_BOOL("snoop-control", IntelIOMMUState, snoop_control, false), a question: is there any requirement on the layout of this array? Should new fields added in the

Re: [PATCH 2/3] intel_iommu: Add missed sanity check for 256-bit invalidation queue

2024-11-04 Thread Yi Liu
On 2024/11/4 20:55, Zhenzhong Duan wrote: According to VTD spec, a 256-bit descriptor will result in an invalid descriptor error if submitted in an IQ that is setup to provide hardware with 128-bit descriptors (IQA_REG.DW=0). Meanwhile, there are old inv desc types (e.g. iotlb_inv_desc) that can

Re: [PATCH] plugins: add plugin API to get args passed to binary

2024-11-04 Thread Pierrick Bouvier
On 11/4/24 19:53, Demin Han wrote: It seems that you already have a wrapper script (qemu-risv64.sh). You can replace it and read command line from $@, which contains the command passed to it. In the case of llvm-test-suite, you can set TEST_SUITE_RUN_UNDER to a wrapper adding a specific plugi

Re: [PATCH v2] hw/riscv: fix build error with clang

2024-11-04 Thread Pierrick Bouvier
Thanks for the review. Feel free to pull the patch in your next PR, so it can be available for release 9.2. Regards, Pierrick On 11/4/24 18:37, Alistair Francis wrote: On Tue, Nov 5, 2024 at 8:23 AM Pierrick Bouvier wrote: Introduced in 0c54ac, "hw/riscv: add RISC-V IOMMU base emulation"

RE: [PATCH] plugins: add plugin API to get args passed to binary

2024-11-04 Thread Demin Han
> > It seems that you already have a wrapper script (qemu-risv64.sh). You can > replace it and read command line from $@, which contains the command > passed to it. > >> In the case of llvm-test-suite, you can set TEST_SUITE_RUN_UNDER to a > >> wrapper adding a specific plugin, its options, and g

Re: [PATCH] plugins: add plugin API to get args passed to binary

2024-11-04 Thread Pierrick Bouvier
On 11/4/24 19:31, Demin Han wrote: -Original Message- From: Pierrick Bouvier Sent: 2024年11月5日 10:50 To: Demin Han ; qemu-devel@nongnu.org Cc: alex.ben...@linaro.org; erdn...@crans.org; ma.mando...@gmail.com Subject: Re: [PATCH] plugins: add plugin API to get args passed to binary On

[PULL 1/3] bsd-user/x86_64/target_arch_thread.h: Align stack

2024-11-04 Thread Warner Losh
From: Ilya Leoshkevich bsd-user qemu-x86_64 almost immediately dies with: qemu: 0x4002201a68: unhandled CPU exception 0xd - aborting on FreeBSD 14.1-RELEASE. This is an instruction that requires alignment: (gdb) x/i 0x4002201a68 0x4002201a68:movaps %xmm0,-0x40(%rbp) and

[PULL 3/3] bsd-user: Set TaskState ts_tid for initial threads

2024-11-04 Thread Warner Losh
From: Jessica Clarke Currently we only set it on fork. Note: Upstream (blitz) commit also did new threads, but that code isn't in qemu project repo yet. Signed-off-by: Jessica Clarke Pull-Request: https://github.com/qemu-bsd-user/qemu-bsd-user/pull/52 Reviewed-by: Warner Losh Signed-off-by: W

[PULL 0/3] Bsd user 2024q4 patches

2024-11-04 Thread Warner Losh
The following changes since commit daaf51001a13da007d7dde72e1ed3b06bc490791: Merge tag 'seabios-hppa-v17-pull-request' of https://github.com/hdeller/qemu-hppa into staging (2024-11-04 16:01:23 +) are available in the Git repository at: g...@gitlab.com:bsdimp/qemu.git tags/bsd-user-2024q

[PULL 2/3] bsd-user/main: Allow setting tb-size

2024-11-04 Thread Warner Losh
From: Ilya Leoshkevich While qemu-system can set tb-size using -accel tcg,tb-size=n, there is no similar knob for qemu-bsd-user. Add one in a way similar to how one-insn-per-tb is already handled. Suggested-by: Philippe Mathieu-Daudé Signed-off-by: Ilya Leoshkevich Reviewed-by: Philippe Mathie

test regression - qemu:block-slow+slow / io-raw-055

2024-11-04 Thread Pierrick Bouvier
Hi, this test was recently broken by 34a889 (migration: Drop migration_is_idle()). Reproduce with: meson test -C build -t 1 --setup slow --num-processes 1 --print-errorlogs io-raw-055 --verbose 1/1 qemu:block-slow+slow / io-raw-055RUNNING >>> ASAN_OPTIONS=halt_on_error=1:abort_on_e

Re: [PATCH v6 0/7] Improve the performance of RISC-V vector unit-stride/whole register ld/st instructions

2024-11-04 Thread Alistair Francis
On Thu, Sep 19, 2024 at 3:15 AM Max Chou wrote: > > Hi, > > This version fixes several issues in v5 > - The cross page bound checking issue > - The mismatch vl comparison in the early exit checking of vext_ldst_us > - The endian issue when host is big endian > > Thank for Richard Henderson's sugge

Re: [PATCH] hw/intc/arm-gicv3*: Refactor GICv3 CPU reginfo to have common invocation

2024-11-04 Thread Gavin Shan
On 11/4/24 1:26 AM, Salil Mehta wrote: Refactor GICv3 code for TCG and KVM to initialize the GIC CPU interface register information by introducing a new common hook `ARMGICv3CommonClass::init_cpu_reginfo`. This hook can be assigned to the respective TCG or KVM variants during the GICv3 initializa

RE: [PATCH] plugins: add plugin API to get args passed to binary

2024-11-04 Thread Demin Han
> -Original Message- > From: Pierrick Bouvier > Sent: 2024年11月5日 10:50 > To: Demin Han ; qemu-devel@nongnu.org > Cc: alex.ben...@linaro.org; erdn...@crans.org; ma.mando...@gmail.com > Subject: Re: [PATCH] plugins: add plugin API to get args passed to binary > > On 11/4/24 18:29, Demin H

RE: [PATCH v4 15/17] intel_iommu: Introduce a property x-fls for scalable modern mode

2024-11-04 Thread Duan, Zhenzhong
>-Original Message- >From: Liu, Yi L >Sent: Monday, November 4, 2024 3:23 PM >Subject: Re: [PATCH v4 15/17] intel_iommu: Introduce a property x-fls for >scalable modern mode > >On 2024/11/4 14:25, Duan, Zhenzhong wrote: >> >> >>> -Original Message- >>> From: Liu, Yi L >>> Sent:

Re: [PATCH v2] hw/riscv: fix build error with clang

2024-11-04 Thread LIU Zhiwei
On 2024/11/5 06:22, Pierrick Bouvier wrote: Introduced in 0c54ac, "hw/riscv: add RISC-V IOMMU base emulation" ../hw/riscv/riscv-iommu.c:187:17: error: redefinition of '_pext_u64' 187 | static uint64_t _pext_u64(uint64_t val, uint64_t ext) | ^ D:/a/_temp/msys64/clan

Re: [PATCH] plugins: add plugin API to get args passed to binary

2024-11-04 Thread Pierrick Bouvier
On 11/4/24 18:29, Demin Han wrote: -Original Message- From: Pierrick Bouvier Sent: 2024年11月5日 5:22 To: Demin Han ; qemu-devel@nongnu.org Cc: alex.ben...@linaro.org; erdn...@crans.org; ma.mando...@gmail.com Subject: Re: [PATCH] plugins: add plugin API to get args passed to binary On 11

RE: [PATCH 2/3] intel_iommu: Add missed sanity check for 256-bit invalidation queue

2024-11-04 Thread Duan, Zhenzhong
>-Original Message- >From: Michael S. Tsirkin >Subject: Re: [PATCH 2/3] intel_iommu: Add missed sanity check for 256-bit >invalidation queue > >On Mon, Nov 04, 2024 at 08:55:35PM +0800, Zhenzhong Duan wrote: >> According to VTD spec, a 256-bit descriptor will result in an invalid >> des

Re: [PATCH v2] hw/riscv: fix build error with clang

2024-11-04 Thread Alistair Francis
On Tue, Nov 5, 2024 at 8:23 AM Pierrick Bouvier wrote: > > Introduced in 0c54ac, "hw/riscv: add RISC-V IOMMU base emulation" > > ../hw/riscv/riscv-iommu.c:187:17: error: redefinition of '_pext_u64' > > 187 | static uint64_t _pext_u64(uint64_t val, uint64_t ext) > > | ^ > >

Re: [PATCH net-next] ptp: Remove 'default y' for VMCLOCK PTP device

2024-11-04 Thread patchwork-bot+netdevbpf
Hello: This patch was applied to netdev/net-next.git (main) by Jakub Kicinski : On Sat, 02 Nov 2024 16:52:17 -0500 you wrote: > From: David Woodhouse > > The VMCLOCK device gives support for accurate timekeeping even across > live migration, unlike the KVM PTP clock. To help ensure that users c

RE: [PATCH] plugins: add plugin API to get args passed to binary

2024-11-04 Thread Demin Han
> -Original Message- > From: Pierrick Bouvier > Sent: 2024年11月5日 5:22 > To: Demin Han ; qemu-devel@nongnu.org > Cc: alex.ben...@linaro.org; erdn...@crans.org; ma.mando...@gmail.com > Subject: Re: [PATCH] plugins: add plugin API to get args passed to binary > > On 11/1/24 22:10, Demin Han

[PATCH] ui/gtk: Consider the scaling factor when getting the root coordinates

2024-11-04 Thread dongwon . kim
From: Vivek Kasireddy Since gdk_window_get_root_coords() expects a position within the window, we need to translate Guest's cooridinates to window local coordinates by multiplying them with the scaling factor. Cc: Marc-André Lureau Signed-off-by: Vivek Kasireddy Signed-off-by: Dongwon Kim ---

Re: [PATCH net-next] ptp: Remove 'default y' for VMCLOCK PTP device

2024-11-04 Thread Jakub Kicinski
On Sat, 02 Nov 2024 16:52:17 -0500 David Woodhouse wrote: > From: David Woodhouse > > The VMCLOCK device gives support for accurate timekeeping even across > live migration, unlike the KVM PTP clock. To help ensure that users can > always use ptp_vmclock where it's available in preference to ptp

Re: [PATCH 15/23] rust: introduce alternative implementation of offset_of!

2024-11-04 Thread Junjie Mao
Paolo Bonzini writes: > On 11/3/24 10:54, Junjie Mao wrote: >> Paolo Bonzini writes: >> >>> diff --git a/rust/qemu-api-macros/src/lib.rs >>> b/rust/qemu-api-macros/src/lib.rs >>> index a4bc5d01ee8..c2ea22101e4 100644 >>> --- a/rust/qemu-api-macros/src/lib.rs >>> +++ b/rust/qemu-api-macros/src

Re: [PATCH] arm/virt: Extract common code to wire GICC<->vCPU IRQs for reuse

2024-11-04 Thread Gavin Shan
On 11/4/24 1:24 AM, Salil Mehta wrote: Extract common GIC and CPU interrupt wiring code to improve code readability and modularity, supporting reuse in future patch sets. This refactor is benign and introduces *no* functional changes. Note: This patch has been isolated from a larger patch set to

Re: [PATCH] arm/virt: Extract common code to wire GICC<->vCPU IRQs for reuse

2024-11-04 Thread Gavin Shan
On 11/4/24 11:26 PM, Peter Maydell wrote: On Sun, 3 Nov 2024 at 15:25, Salil Mehta wrote: Extract common GIC and CPU interrupt wiring code to improve code readability and modularity, supporting reuse in future patch sets. This refactor is benign and introduces *no* functional changes. Note: T

Re: [PATCH] hw/arm/virt: Move common vCPU properties in a function

2024-11-04 Thread Gavin Shan
On 11/4/24 1:22 AM, Salil Mehta wrote: Refactor vCPU properties code from the `machvirt_init()` main loop with the following goals: 1. Enable code reuse in future patch sets. 2. Improve code readability. 3. Separate out the one-time initialization of (secure-)Tagged memory, handling potentia

Re: [PATCH] hw/char/sifive_uart: Fix broken UART on big endian hosts

2024-11-04 Thread Alistair Francis
On Tue, Nov 5, 2024 at 2:35 AM Thomas Huth wrote: > > Casting a "uint32_t *" to a "uint8_t *" to get to the lowest 8-bit > part of the value does not work on big endian hosts. We've got to > take the proper detour through an 8-bit variable. > > Fixes: 53c1557b23 ("hw/char: sifive_uart: Print uart

Re: [PATCH 2/2] hw/riscv/riscv-iommu: fix riscv_iommu_validate_process_ctx() check

2024-11-04 Thread Alistair Francis
On Mon, Nov 4, 2024 at 10:40 PM Daniel Henrique Barboza wrote: > > 'mode' will never be RISCV_IOMMU_CAP_SV32. We are erroring out in the > 'switch' right before it if 'mode' isn't 0, 8, 9 or 10. > > 'mode' should be check with RISCV_IOMMU_DC_FSC_IOSATP_MODE_SV32. > > Reported by Coverity via a "DE

Re: [PATCH 1/2] hw/riscv/riscv-iommu: change 'depth' to int

2024-11-04 Thread Alistair Francis
On Mon, Nov 4, 2024 at 10:41 PM Daniel Henrique Barboza wrote: > > Coverity reports an unsigned overflow when doing: > > for (; depth-- > 0; ) { > > When depth = 0 inside riscv_iommu_ctx_fetch(). > > Building it with a recent GCC the code doesn't actually break with depth > = 0, i.e. the compa

Re: [PATCH] target/riscv/kvm: Fix leak of reg list

2024-11-04 Thread Alistair Francis
On Tue, Nov 5, 2024 at 3:36 AM Andrew Jones wrote: > > Free the temporary register list. > > Fixes: 608bdebb6075 ("target/riscv/kvm: support KVM_GET_REG_LIST") > Signed-off-by: Andrew Jones Thanks! Applied to riscv-to-apply.next Alistair > --- > target/riscv/kvm/kvm-cpu.c | 2 ++ > 1 file ch

  1   2   3   4   5   >