Re: [RFC PATCH v5 09/29] KVM: selftests: TDX: Add report_fatal_error test

2024-07-28 Thread Binbin Wu
On 4/23/2024 5:23 AM, Sean Christopherson wrote: On Thu, Apr 18, 2024, Yan Zhao wrote: On Tue, Apr 16, 2024 at 11:50:19AM -0700, Sean Christopherson wrote: On Mon, Apr 15, 2024, Yan Zhao wrote: On Mon, Apr 15, 2024 at 08:05:49AM +, Ackerley Tng wrote: The Intel GHCI Spec says in R12, b

Re: [PATCH] selftests: x86: skip the tests if prerequisites aren't fulfilled

2024-03-11 Thread Binbin Wu
argc, char **argv) if (!cpu_has_lam()) { ksft_print_msg("Unsupported LAM feature!\n"); - return -1; + return KSFT_SKIP; } while ((c = getopt(argc, argv, "ht:")) != -1) { Looks good to me. Reviewed-by: Binbin Wu

Re: [RFC PATCH v5 28/29] KVM: selftests: TDX: Add TDX UPM selftest

2024-03-04 Thread Binbin Wu
On 12/13/2023 4:46 AM, Sagi Shahar wrote: From: Ackerley Tng This tests the use of guest memory with explicit MapGPA calls. Signed-off-by: Ackerley Tng Signed-off-by: Ryan Afranji Signed-off-by: Sagi Shahar --- tools/testing/selftests/kvm/Makefile | 1 + .../selftests/kvm/x

Re: [RFC PATCH v5 26/29] KVM: selftests: TDX: Add support for TDG.VP.VEINFO.GET

2024-03-04 Thread Binbin Wu
+ 2 files changed, 40 insertions(+) Reviewed-by: Binbin Wu diff --git a/tools/testing/selftests/kvm/include/x86_64/tdx/tdx.h b/tools/testing/selftests/kvm/include/x86_64/tdx/tdx.h index b71bcea40b5c..12863a8beaae 100644 --- a/tools/testing/selftests/kvm/include/x86_64/tdx/tdx.h +++ b

Re: [RFC PATCH v5 24/29] KVM: selftests: Expose _vm_vaddr_alloc

2024-03-04 Thread Binbin Wu
On 12/13/2023 4:46 AM, Sagi Shahar wrote: From: Ackerley Tng vm_vaddr_alloc always allocates memory in memslot 0. This allows users of this function to choose which memslot to allocate virtual memory in. Nit: The patch exposes vm_vaddr_alloc() instead of _vm_vaddr_alloc(). Signed-off

Re: [RFC PATCH v5 10/29] KVM: selftests: TDX: Adding test case for TDX port IO

2024-03-04 Thread Binbin Wu
On 3/4/2024 10:19 AM, Yan Zhao wrote: On Tue, Dec 12, 2023 at 12:46:25PM -0800, Sagi Shahar wrote: From: Erdem Aktas Verifies TDVMCALL READ and WRITE operations. Signed-off-by: Erdem Aktas Signed-off-by: Sagi Shahar Signed-off-by: Ackerley Tng Signed-off-by: Ryan Afranji --- .../kvm/

Re: [RFC PATCH v5 18/29] KVM: selftests: TDX: Add TDX MMIO writes test

2024-03-01 Thread Binbin Wu
On 12/13/2023 4:46 AM, Sagi Shahar wrote: The test verifies MMIO writes of various sizes from the guest to the host. Signed-off-by: Sagi Shahar Signed-off-by: Ackerley Tng Signed-off-by: Ryan Afranji Patch 17 and 18 test the part that guest has received the #VE caused by MMIO access, so

Re: [RFC PATCH v5 16/29] KVM: selftests: TDX: Add TDX HLT exit test

2024-03-01 Thread Binbin Wu
On 12/13/2023 4:46 AM, Sagi Shahar wrote: The test verifies that the guest runs TDVMCALL and the guest vCPU enters to the halted state. Signed-off-by: Erdem Aktas Signed-off-by: Sagi Shahar Signed-off-by: Ackerley Tng Signed-off-by: Ryan Afranji --- .../selftests/kvm/include/x86_64/tdx/

Re: [RFC PATCH v5 15/29] KVM: selftests: TDX: Add TDX MSR read/write tests

2024-03-01 Thread Binbin Wu
On 3/1/2024 8:00 PM, Binbin Wu wrote: On 12/13/2023 4:46 AM, Sagi Shahar wrote: The test verifies reads and writes for MSR registers with different access level. Signed-off-by: Sagi Shahar Signed-off-by: Ackerley Tng Signed-off-by: Ryan Afranji ---   .../selftests/kvm/include/x86_64

Re: [RFC PATCH v5 15/29] KVM: selftests: TDX: Add TDX MSR read/write tests

2024-03-01 Thread Binbin Wu
On 12/13/2023 4:46 AM, Sagi Shahar wrote: The test verifies reads and writes for MSR registers with different access level. Signed-off-by: Sagi Shahar Signed-off-by: Ackerley Tng Signed-off-by: Ryan Afranji --- .../selftests/kvm/include/x86_64/tdx/tdx.h| 5 + .../selftests/kvm/lib

Re: [RFC PATCH v5 14/29] KVM: selftests: TDX: Add TDX IO reads test

2024-03-01 Thread Binbin Wu
changed, 87 insertions(+) Reviewed-by: Binbin Wu diff --git a/tools/testing/selftests/kvm/x86_64/tdx_vm_tests.c b/tools/testing/selftests/kvm/x86_64/tdx_vm_tests.c index a2b3e1aef151..699cba36e9ce 100644 --- a/tools/testing/selftests/kvm/x86_64/tdx_vm_tests.c +++ b/tools/testing/selftests/kvm

Re: [RFC PATCH v5 13/29] KVM: selftests: TDX: Add TDX IO writes test

2024-02-29 Thread Binbin Wu
/tdx_vm_tests.c | 91 +++ 2 files changed, 94 insertions(+) Reviewed-by: Binbin Wu diff --git a/tools/testing/selftests/kvm/include/x86_64/tdx/tdcall.h b/tools/testing/selftests/kvm/include/x86_64/tdx/tdcall.h index 78001bfec9c8..b5e94b7c48fa 100644 --- a/tools/testing

Re: [RFC PATCH v5 09/29] KVM: selftests: TDX: Add report_fatal_error test

2024-02-29 Thread Binbin Wu
On 12/13/2023 4:46 AM, Sagi Shahar wrote: The test checks report_fatal_error functionality. Signed-off-by: Sagi Shahar Signed-off-by: Ackerley Tng Signed-off-by: Ryan Afranji --- .../selftests/kvm/include/x86_64/tdx/tdx.h| 6 ++- .../kvm/include/x86_64/tdx/tdx_util.h | 1 +

Re: [RFC PATCH v5 12/29] KVM: selftests: TDX: Add basic get_td_vmcall_info test

2024-02-29 Thread Binbin Wu
: Binbin Wu Also, does it need to add another case for the non-zero value of r12 to test the VMCALL_INVALID_OPERAND path? diff --git a/tools/testing/selftests/kvm/include/x86_64/tdx/tdx.h b/tools/testing/selftests/kvm/include/x86_64/tdx/tdx.h index 1340c1070002..63788012bf94 100644 --- a/tools

Re: [RFC PATCH v5 10/29] KVM: selftests: TDX: Adding test case for TDX port IO

2024-02-29 Thread Binbin Wu
.../selftests/kvm/x86_64/tdx_vm_tests.c | 82 +++ 2 files changed, 116 insertions(+) One nit comment below. Reviewed-by: Binbin Wu diff --git a/tools/testing/selftests/kvm/include/x86_64/tdx/test_util.h b/tools/testing/selftests/kvm/include/x86_64/tdx/test_util.h index

Re: [RFC PATCH v5 09/29] KVM: selftests: TDX: Add report_fatal_error test

2024-02-29 Thread Binbin Wu
On 12/13/2023 4:46 AM, Sagi Shahar wrote: The test checks report_fatal_error functionality. Signed-off-by: Sagi Shahar Signed-off-by: Ackerley Tng Signed-off-by: Ryan Afranji --- .../selftests/kvm/include/x86_64/tdx/tdx.h| 6 ++- .../kvm/include/x86_64/tdx/tdx_util.h | 1 +

Re: [RFC PATCH v5 06/29] KVM: selftests: TDX: Use KVM_TDX_CAPABILITIES to validate TDs' attribute configuration

2024-02-29 Thread Binbin Wu
++- 1 file changed, 66 insertions(+), 3 deletions(-) Nit: Can also dump 'supported_gpaw' in tdx_read_capabilities(). Reviewed-by: Binbin Wu diff --git a/tools/testing/selftests/kvm/lib/x86_64/tdx/tdx_util.c b/tools/testing/selftests/kvm/lib/x86_64/tdx/tdx_ut

Re: [RFC PATCH v5 05/29] KVM: selftests: Add helper functions to create TDX VMs

2024-02-28 Thread Binbin Wu
On 12/13/2023 4:46 AM, Sagi Shahar wrote: From: Erdem Aktas TDX requires additional IOCTLs to initialize VM and vCPUs to add private memory and to finalize the VM memory. Also additional utility functions are provided to manipulate a TD, similar to those that manipulate a VM in the current s

Re: [RFC PATCH v5 04/29] KVM: selftests: Refactor steps in vCPU descriptor table initialization

2024-02-20 Thread Binbin Wu
On 12/13/2023 4:46 AM, Sagi Shahar wrote: From: Ackerley Tng Split the vCPU descriptor table initialization process into a few steps and expose them: + Setting up the IDT + Syncing exception handlers into the guest In kvm_setup_idt(), we conditionally allocate guest memory for vm->idt to a

Re: [RFC PATCH v5 03/29] KVM: selftests: Store initial stack address in struct kvm_vcpu

2024-02-20 Thread Binbin Wu
gs | 0x2; - regs.rsp = stack_vaddr; + regs.rsp = vcpu->initial_stack_addr; Nit: No need to do this change. Reviewed-by: Binbin Wu regs.rip = (unsigned long) guest_code; vcpu_regs_set(vcpu, ®s);

Re: [RFC PATCH v5 02/29] KVM: selftests: Expose function that sets up sregs based on VM's mode

2024-02-20 Thread Binbin Wu
On 12/13/2023 4:46 AM, Sagi Shahar wrote: From: Ackerley Tng This allows initializing sregs without setting vCPU registers in KVM. No functional change intended. Reviewed-by: Binbin Wu Signed-off-by: Ackerley Tng Signed-off-by: Ryan Afranji Signed-off-by: Sagi Shahar

Re: [RFC PATCH v5 01/29] KVM: selftests: Add function to allow one-to-one GVA to GPA mappings

2024-02-20 Thread Binbin Wu
On 12/13/2023 4:46 AM, Sagi Shahar wrote: From: Ackerley Tng One-to-one GVA to GPA mappings can be used in the guest to set up boot sequences during which paging is enabled, hence requiring a transition from using physical to virtual addresses in consecutive instructions. Signed-off-by: Ack

Re: [PATCH v6 3/6] iommu: Add iommu_copy_struct_from_user_array helper

2024-01-08 Thread Binbin Wu
On 11/17/2023 9:07 PM, Yi Liu wrote: + +/** + * iommu_copy_struct_from_user_array - Copy iommu driver specific user space + * data from an iommu_user_data_array + * @kdst: Pointer to an iommu driver specific user data that is defined in + *include/ua

Re: [PATCH v6 1/6] iommu: Add cache_invalidate_user op

2024-01-07 Thread Binbin Wu
On 11/17/2023 9:07 PM, Yi Liu wrote: From: Lu Baolu The updates of the PTEs in the nested page table will be propagated to the hardware caches on both IOMMU (IOTLB) and devices (DevTLB/ATC). Add a new domain op cache_invalidate_user for the userspace to flush the hardware caches for a neste

[PATCH v2] selftests/x86/lam: Zero out buffer for readlink()

2023-10-15 Thread Binbin Wu
dd inherit test cases for linear-address masking") Signed-off-by: Binbin Wu --- v1->v2: - Change the buffer length passed to readlink() to 'PATH_MAX - 1' to ensure the resulting string is always null terminated. [Kirill] tools/testing/selftests/x86/lam.c | 6 +++--- 1 file chan

Re: [PATCH] selftests/x86/lam: Zero out buffer for readlink()

2023-10-10 Thread Binbin Wu
On 10/10/2023 1:46 PM, kirill.shute...@linux.intel.com wrote: On Tue, Oct 10, 2023 at 11:51:32AM +0800, Binbin Wu wrote: On 9/27/2023 7:02 PM, kirill.shute...@linux.intel.com wrote: On Sun, Sep 24, 2023 at 07:33:46AM +0800, Binbin Wu wrote: Zero out the buffer for readlink() since

Re: [PATCH] selftests/x86/lam: Zero out buffer for readlink()

2023-10-09 Thread Binbin Wu
On 9/27/2023 7:02 PM, kirill.shute...@linux.intel.com wrote: On Sun, Sep 24, 2023 at 07:33:46AM +0800, Binbin Wu wrote: Zero out the buffer for readlink() since readlink() does not append a terminating null byte to the buffer. Fixes: 833c12ce0f430 ("selftests/x86/lam: Add inherit test

[PATCH] selftests/x86/lam: Zero out buffer for readlink()

2023-09-26 Thread Binbin Wu
Zero out the buffer for readlink() since readlink() does not append a terminating null byte to the buffer. Fixes: 833c12ce0f430 ("selftests/x86/lam: Add inherit test cases for linear-address masking") Signed-off-by: Binbin Wu --- tools/testing/selftests/x86/lam.c | 2 +- 1 file