lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0059c183-eb4f-42f5-8f1e-7eef6b0a4bcd@linux.intel.com>
Date: Mon, 4 Mar 2024 21:56:57 +0800
From: Binbin Wu <binbin.wu@...ux.intel.com>
To: Sagi Shahar <sagis@...gle.com>
Cc: linux-kselftest@...r.kernel.org, Ackerley Tng <ackerleytng@...gle.com>,
 Ryan Afranji <afranji@...gle.com>, Erdem Aktas <erdemaktas@...gle.com>,
 Isaku Yamahata <isaku.yamahata@...el.com>,
 Sean Christopherson <seanjc@...gle.com>, Paolo Bonzini
 <pbonzini@...hat.com>, Shuah Khan <shuah@...nel.org>,
 Peter Gonda <pgonda@...gle.com>, Haibo Xu <haibo1.xu@...el.com>,
 Chao Peng <chao.p.peng@...ux.intel.com>,
 Vishal Annapurve <vannapurve@...gle.com>, Roger Wang <runanwang@...gle.com>,
 Vipin Sharma <vipinsh@...gle.com>, jmattson@...gle.com, dmatlack@...gle.com,
 linux-kernel@...r.kernel.org, kvm@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [RFC PATCH v5 26/29] KVM: selftests: TDX: Add support for
 TDG.VP.VEINFO.GET



On 12/13/2023 4:46 AM, Sagi Shahar wrote:
> From: Ackerley Tng <ackerleytng@...gle.com>
>
> Signed-off-by: Ackerley Tng <ackerleytng@...gle.com>
> Signed-off-by: Ryan Afranji <afranji@...gle.com>
> Signed-off-by: Sagi Shahar <sagis@...gle.com>
> ---
>   .../selftests/kvm/include/x86_64/tdx/tdx.h    | 21 +++++++++++++++++++
>   .../selftests/kvm/lib/x86_64/tdx/tdx.c        | 19 +++++++++++++++++
>   2 files changed, 40 insertions(+)

Reviewed-by: Binbin Wu <binbin.wu@...ux.intel.com>

>
> 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/tools/testing/selftests/kvm/include/x86_64/tdx/tdx.h
> @@ -6,6 +6,7 @@
>   #include "kvm_util_base.h"
>   
>   #define TDG_VP_INFO 1
> +#define TDG_VP_VEINFO_GET 3
>   #define TDG_MEM_PAGE_ACCEPT 6
>   
>   #define TDG_VP_VMCALL_GET_TD_VM_CALL_INFO 0x10000
> @@ -41,4 +42,24 @@ uint64_t tdg_vp_info(uint64_t *rcx, uint64_t *rdx,
>   uint64_t tdg_vp_vmcall_map_gpa(uint64_t address, uint64_t size, uint64_t *data_out);
>   uint64_t tdg_mem_page_accept(uint64_t gpa, uint8_t level);
>   
> +/*
> + * Used by the #VE exception handler to gather the #VE exception
> + * info from the TDX module. This is a software only structure
> + * and not part of the TDX module/VMM ABI.
> + *
> + * Adapted from arch/x86/include/asm/tdx.h
> + */
> +struct ve_info {
> +	uint64_t exit_reason;
> +	uint64_t exit_qual;
> +	/* Guest Linear (virtual) Address */
> +	uint64_t gla;
> +	/* Guest Physical Address */
> +	uint64_t gpa;
> +	uint32_t instr_len;
> +	uint32_t instr_info;
> +};
> +
> +uint64_t tdg_vp_veinfo_get(struct ve_info *ve);
> +
>   #endif // SELFTEST_TDX_TDX_H
> diff --git a/tools/testing/selftests/kvm/lib/x86_64/tdx/tdx.c b/tools/testing/selftests/kvm/lib/x86_64/tdx/tdx.c
> index d8c4ab635c06..71d9f55007f7 100644
> --- a/tools/testing/selftests/kvm/lib/x86_64/tdx/tdx.c
> +++ b/tools/testing/selftests/kvm/lib/x86_64/tdx/tdx.c
> @@ -241,3 +241,22 @@ uint64_t tdg_mem_page_accept(uint64_t gpa, uint8_t level)
>   {
>   	return __tdx_module_call(TDG_MEM_PAGE_ACCEPT, gpa | level, 0, 0, 0, NULL);
>   }
> +
> +uint64_t tdg_vp_veinfo_get(struct ve_info *ve)
> +{
> +	uint64_t ret;
> +	struct tdx_module_output out;
> +
> +	memset(&out, 0, sizeof(struct tdx_module_output));
> +
> +	ret = __tdx_module_call(TDG_VP_VEINFO_GET, 0, 0, 0, 0, &out);
> +
> +	ve->exit_reason = out.rcx;
> +	ve->exit_qual   = out.rdx;
> +	ve->gla         = out.r8;
> +	ve->gpa         = out.r9;
> +	ve->instr_len   = out.r10 & 0xffffffff;
> +	ve->instr_info  = out.r10 >> 32;
> +
> +	return ret;
> +}


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ