[PATCH] target/i386: disable VMX features if nested=0

2019-12-06 Thread Yang Zhong
f->nmsrs' failed. Signed-off-by: Yang Zhong --- target/i386/kvm.c | 8 1 file changed, 8 insertions(+) diff --git a/target/i386/kvm.c b/target/i386/kvm.c index bf1655645b..e8841dcdb9 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -2572,6 +2572,14 @@ static void kvm_msr_entr

Re: [RESEND PATCH v2] target/i386: Switch back XFRM value

2023-04-05 Thread Yang Zhong
previous patch wrongly replaced FEAT_XSAVE_XCR0_{LO|HI} with > > > > FEAT_XSAVE_XSS_{LO|HI} in CPUID(EAX=12,ECX=1):{ECX,EDX}, which made > > > > SGX enclave only supported SSE and x87 feature(xfrm=0x3). > > > > > > > > Fixes: 301e90675c3f ("target

[PATCH v3] target/i386: Change wrong XFRM value

2023-04-05 Thread Yang Zhong
The previous patch wrongly replaced FEAT_XSAVE_XCR0_{LO|HI} with FEAT_XSAVE_XSS_{LO|HI} in CPUID(EAX=12,ECX=1):{ECX,EDX}, which made SGX enclave only supported SSE and x87 feature(xfrm=0x3). Fixes: 301e90675c3f ("target/i386: Enable support for XSAVES based features") Signed-off-by:

Re: [PATCH v3] target/i386: Change wrong XFRM value

2023-04-07 Thread Yang Zhong
On Thu, Apr 06, 2023 at 02:05:06PM +0200, Paolo Bonzini wrote: > Queued, thanks. > Paolo, thanks! Yang > Paolo > >

Re: [PATCH v3] target/i386: Change wrong XFRM value

2023-04-09 Thread Yang Zhong
On Sun, Apr 09, 2023 at 04:40:50PM +0300, Michael Tokarev wrote: > 06.04.2023 09:40, Yang Zhong wrote: > > The previous patch wrongly replaced FEAT_XSAVE_XCR0_{LO|HI} with > > FEAT_XSAVE_XSS_{LO|HI} in CPUID(EAX=12,ECX=1):{ECX,EDX}, which made > > SGX enclave only supporte

Re: [PATCH v3 3/5] numa: Support SGX numa in the monitor and Libvirt interfaces

2021-11-10 Thread Yang Zhong
On Wed, Nov 10, 2021 at 10:55:40AM -0600, Eric Blake wrote: > On Mon, Nov 01, 2021 at 12:20:07PM -0400, Yang Zhong wrote: > > Add the SGXEPCSection list into SGXInfo to show the multiple > > SGX EPC sections detailed info, not the total size like before. > > This patch can en

Re: [PATCH v3 0/5] SGX NUMA support plus vepc reset

2021-11-10 Thread Yang Zhong
On Wed, Nov 10, 2021 at 05:07:40PM +0100, Paolo Bonzini wrote: > On 11/10/21 13:56, Yang Zhong wrote: > > Paolo, thanks! > > > > No other maintainers to review numa patches, so i will send the numa > > patches again? thanks! > > The patch look good, but th

Re: [PATCH v3 3/5] numa: Support SGX numa in the monitor and Libvirt interfaces

2021-11-11 Thread Yang Zhong
On Thu, Nov 11, 2021 at 08:55:35AM +0100, Philippe Mathieu-Daudé wrote: > On 11/11/21 07:18, Yang Zhong wrote: > > On Wed, Nov 10, 2021 at 10:55:40AM -0600, Eric Blake wrote: > >> On Mon, Nov 01, 2021 at 12:20:07PM -0400, Yang Zhong wrote: > >>> Add the SGXEPCSection

unable to execute QEMU command 'qom-get': Property 'sgx-epc.unavailable-features' not found

2021-11-25 Thread Yang Zhong
Hello Paolo, Our customer used the Libvirt XML to start a SGX VM, but failed. libvirt.libvirtError: internal error: unable to execute QEMU command 'qom-get': Property 'sgx-epc.unavailable-features' not found The XML file, The new compound property command shou

Re: [PULL 00/68] i386, build system, KVM changes for 2023-05-18

2023-05-18 Thread Yang Zhong
Paolo, please help add below queued sgx fix into this PULL request, which was missed from last time, thanks a lot! https://lists.nongnu.org/archive/html/qemu-devel/2023-04/msg00841.html https://lists.nongnu.org/archive/html/qemu-devel/2023-04/msg00896.html Regards, Yang

Re: [PULL 00/68] i386, build system, KVM changes for 2023-05-18

2023-05-22 Thread Yang Zhong
On Fri, May 19, 2023 at 10:29:47AM +0200, Paolo Bonzini wrote: > On 5/19/23 05:06, Yang Zhong wrote: > > > > Paolo, please help add below queued sgx fix into this PULL request, which > > was > > missed from last time, thanks a lot! > > https://lists.nongnu.or

About the instance_finalize callback in VFIO PCI

2023-03-20 Thread Yang Zhong
Hello Alex and Paolo, There is one instance_finalize callback definition in hw/vfio/pci.c, but i find this callback(vfio_instance_finalize()) never be called during the VM shutdown with close VM or "init 0" command in guest. The Qemu related command: .. -device vfio-pci,host=d9:00.0

Re: About the instance_finalize callback in VFIO PCI

2023-03-22 Thread Yang Zhong
On Tue, Mar 21, 2023 at 06:30:14PM +0100, Cédric Le Goater wrote: > On 3/20/23 10:31, Yang Zhong wrote: > > Hello Alex and Paolo, > > > > There is one instance_finalize callback definition in hw/vfio/pci.c, but > > i find this callback(vfio_instance_finalize()) never

Re: About the instance_finalize callback in VFIO PCI

2023-03-22 Thread Yang Zhong
On Tue, Mar 21, 2023 at 09:44:18PM +0100, Paolo Bonzini wrote: > Il mar 21 mar 2023, 18:30 Cédric Le Goater ha scritto: > > > I would have thought that user_creatable_cleanup would have taken care > > of it. But it's not. This needs some digging. > > > > user_creatable_cleanup is only for -objec

Re: About the instance_finalize callback in VFIO PCI

2023-03-22 Thread Yang Zhong
On Wed, Mar 22, 2023 at 01:56:13PM +0100, Cédric Le Goater wrote: > On 3/22/23 13:28, Yang Zhong wrote: > > On Tue, Mar 21, 2023 at 06:30:14PM +0100, Cédric Le Goater wrote: > > > On 3/20/23 10:31, Yang Zhong wrote: > > > > Hello Alex and Paolo, > > > &g

Re: About the instance_finalize callback in VFIO PCI

2023-03-22 Thread Yang Zhong
On Wed, Mar 22, 2023 at 12:22:27PM -0600, Alex Williamson wrote: > On Wed, 22 Mar 2023 09:10:20 -0400 > Yang Zhong wrote: > > > On Wed, Mar 22, 2023 at 01:56:13PM +0100, Cédric Le Goater wrote: > > > On 3/22/23 13:28, Yang Zhong wrote: > > > > On Tue, Mar

Re: [PATCH v2 4/8] x86: Add XFD faulting bit for state components

2022-02-24 Thread Yang Zhong
On Mon, Feb 21, 2022 at 01:00:41PM +, David Edmondson wrote: > On Wednesday, 2022-02-16 at 22:04:30 -08, Yang Zhong wrote: > > > From: Jing Liu > > > > Intel introduces XFD faulting mechanism for extended > > XSAVE features to dynamically enable the features in

Re: [PATCH v2 6/8] x86: add support for KVM_CAP_XSAVE2 and AMX state migration

2022-02-24 Thread Yang Zhong
On Mon, Feb 21, 2022 at 01:25:53PM +, David Edmondson wrote: > On Wednesday, 2022-02-16 at 22:04:32 -08, Yang Zhong wrote: > > > From: Jing Liu > > > > When dynamic xfeatures (e.g. AMX) are used by the guest, the xsave > > area would be larger than 4KB. KV

Re: [PATCH v2 3/8] x86: Grant AMX permission for guest

2022-02-25 Thread Yang Zhong
On Thu, Feb 17, 2022 at 02:44:10PM +0100, Paolo Bonzini wrote: > On 2/17/22 06:58, Yang Zhong wrote: > >>+ > >>+if ((mask & XSTATE_XTILE_DATA_MASK) == XSTATE_XTILE_DATA_MASK) { > >>+bitmask = kvm_arch_get_supported_cpuid(s, 0xd, 0,

[PATCH v3 4/8] x86: Add XFD faulting bit for state components

2022-02-28 Thread Yang Zhong
From: Jing Liu Intel introduces XFD faulting mechanism for extended XSAVE features to dynamically enable the features in runtime. If CPUID (EAX=0Dh, ECX=n, n>1).ECX[2] is set as 1, it indicates support for XFD faulting of this state component. Signed-off-by: Jing Liu Signed-off-by: Yang Zh

[PATCH v3 3/8] x86: Grant AMX permission for guest

2022-02-28 Thread Yang Zhong
to get host side supported_xcr0 and Qemu can decide if it can request dynamically enabled XSAVE features permission. https://lore.kernel.org/all/20220126152210.3044876-1-pbonz...@redhat.com/ Suggested-by: Paolo Bonzini Signed-off-by: Yang Zhong Signed-off-by: Jing Liu --- target/i386/cpu.h

[PATCH v3 0/8] AMX support in Qemu

2022-02-28 Thread Yang Zhong
(5): x86: Fix the 64-byte boundary enumeration for extended state x86: Add AMX XTILECFG and XTILEDATA components x86: Add XFD faulting bit for state components x86: Add AMX CPUIDs enumeration x86: Add support for KVM_CAP_XSAVE2 and AMX state migration Yang Zhong (2): x86: Grant AMX permissio

[PATCH v3 1/8] x86: Fix the 64-byte boundary enumeration for extended state

2022-02-28 Thread Yang Zhong
no supported component needed the bit to be set, but the upcoming AMX feature will use it. Fix the subleaves value according to KVM's supported cpuid. Signed-off-by: Jing Liu Signed-off-by: Yang Zhong Reviewed-by: David Edmondson --- target/i386/cpu.h | 6 ++ target/i386/cpu.c

[PATCH v3 2/8] x86: Add AMX XTILECFG and XTILEDATA components

2022-02-28 Thread Yang Zhong
of AMX XSAVE areas and use QEMU_BUILD_BUG_ON to validate the structs sizes. Signed-off-by: Jing Liu Signed-off-by: Yang Zhong Reviewed-by: David Edmondson --- target/i386/cpu.h | 18 +- target/i386/cpu.c | 8 2 files changed, 25 insertions(+), 1 deletion(-) diff

[PATCH v3 6/8] x86: Add support for KVM_CAP_XSAVE2 and AMX state migration

2022-02-28 Thread Yang Zhong
: Jing Liu Signed-off-by: Zeng Guang Signed-off-by: Wei Wang Signed-off-by: Yang Zhong --- target/i386/cpu.h | 4 target/i386/kvm/kvm.c | 42 -- target/i386/xsave_helper.c | 33 ++ 3 files changed, 64 insertions

[PATCH v3 5/8] x86: Add AMX CPUIDs enumeration

2022-02-28 Thread Yang Zhong
From: Jing Liu Add AMX primary feature bits XFD and AMX_TILE to enumerate the CPU's AMX capability. Meanwhile, add AMX TILE and TMUL CPUID leaf and subleaves which exist when AMX TILE is present to provide the maximum capability of TILE and TMUL. Signed-off-by: Jing Liu Signed-off-by:

[PATCH v3 8/8] linux-header: Sync the linux headers

2022-02-28 Thread Yang Zhong
This patch will be dropped once Qemu sync linux 5.17 header. Making all linux-headers changes here are only for maintainers to easily remove those changes once those patches are queued. Signed-off-by: Yang Zhong --- linux-headers/asm-x86/kvm.h | 3 +++ linux-headers/linux/kvm.h | 1 + 2 files

[PATCH v3 7/8] x86: Support XFD and AMX xsave data migration

2022-02-28 Thread Yang Zhong
. Signed-off-by: Zeng Guang Signed-off-by: Wei Wang Signed-off-by: Yang Zhong Reviewed-by: David Edmondson --- target/i386/cpu.h | 9 + target/i386/kvm/kvm.c | 18 ++ target/i386/machine.c | 42 ++ 3 files changed, 69 insertions

Re: [PATCH v5 04/26] qom: Add memory-backend-epc ObjectOptions support

2021-09-26 Thread Yang Zhong
On Fri, Sep 24, 2021 at 08:56:40AM -0500, Eric Blake wrote: > On Fri, Sep 24, 2021 at 01:24:47PM +0200, Paolo Bonzini wrote: > > From: Yang Zhong > > > > Add the new 'memory-backend-epc' user creatable QOM object in > > the ObjectOptions to support SGX sinc

Re: unable to execute QEMU command 'qom-get': Property 'sgx-epc.unavailable-features' not found

2022-01-16 Thread Yang Zhong
On Mon, Jan 17, 2022 at 04:53:45AM +0200, Jarkko Sakkinen wrote: > On Tue, Nov 30, 2021 at 08:15:36PM +0800, Yang Zhong wrote: > > On Thu, Nov 25, 2021 at 08:47:22PM +0800, Yang Zhong wrote: > > > Hello Paolo, > > > > > > Our customer used the Libvi

Re: [PULL 11/13] numa: Support SGX numa in the monitor and Libvirt interfaces

2022-01-17 Thread Yang Zhong
On Thu, Jan 13, 2022 at 04:15:10PM +, Daniel P. Berrangé wrote: > On Wed, Dec 15, 2021 at 09:25:13PM +0100, Paolo Bonzini wrote: > > From: Yang Zhong > > > > Add the SGXEPCSection list into SGXInfo to show the multiple > > SGX EPC sections detailed info, not

Re: [PATCH 1/2] hw/i386/x86: Attach CPUs to machine

2022-01-17 Thread Yang Zhong
On Mon, Jan 17, 2022 at 01:48:46PM +, Daniel P. Berrangé wrote: > On Mon, Jan 17, 2022 at 12:53:30AM +0100, Philippe Mathieu-Daudé via wrote: > > Avoid having CPUs objects dangling as unattached QOM ones, > > directly attach them to the machine. > > Lets be more explicit here > > [quote] >

Re: [RFC PATCH 2/2] hw/i386/sgx: Attach SGX-EPC to its memory backend

2022-01-17 Thread Yang Zhong
On Mon, Jan 17, 2022 at 12:48:10PM +0100, Paolo Bonzini wrote: > On 1/17/22 00:53, Philippe Mathieu-Daudé via wrote: > >We have one SGX-EPC address/size/node per memory backend, > >make it child of the backend in the QOM composition tree. > > > >Cc: Yang Zhong > &g

[PATCH] qapi: Cleanup SGX related comments

2022-01-18 Thread Yang Zhong
The SGX NUMA patches were merged into Qemu 7.0 release, we need clarify detailed version history information and also change some related comments, which make SGX related comments clearer. Signed-off-by: Yang Zhong --- qapi/machine.json | 4 ++-- qapi/misc-target.json | 14

Re: [PATCH] qapi: Cleanup SGX related comments

2022-01-19 Thread Yang Zhong
On Wed, Jan 19, 2022 at 09:16:46AM +, Daniel P. Berrangé wrote: > On Wed, Jan 19, 2022 at 07:00:14AM -0500, Yang Zhong wrote: > > The SGX NUMA patches were merged into Qemu 7.0 release, we need > > clarify detailed version history information and also change > > some re

[PATCH v2] qapi: Cleanup SGX related comments and restore @section-size

2022-01-19 Thread Yang Zhong
-size", which can avoid incompatible API breakage. The "@section-size" will be deprecated in 7.2 version. Suggested-by: Daniel P. Berrangé Signed-off-by: Yang Zhong Reviewed-by: Daniel P. Berrangé --- qapi/machine.json | 4 ++-- qapi/misc-target.json | 17

Re: [PATCH v2] qapi: Cleanup SGX related comments and restore @section-size

2022-01-20 Thread Yang Zhong
On Thu, Jan 20, 2022 at 09:10:34AM +, Daniel P. Berrangé wrote: > On Wed, Jan 19, 2022 at 06:57:20PM -0500, Yang Zhong wrote: > > The SGX NUMA patches were merged into Qemu 7.0 release, we need > > clarify detailed version history information and also change > > some re

Re: [PATCH v2] qapi: Cleanup SGX related comments and restore @section-size

2022-01-20 Thread Yang Zhong
On Thu, Jan 20, 2022 at 09:44:34AM +, Daniel P. Berrangé wrote: > On Thu, Jan 20, 2022 at 05:16:01PM +0800, Yang Zhong wrote: > > On Thu, Jan 20, 2022 at 09:10:34AM +, Daniel P. Berrangé wrote: > > > On Wed, Jan 19, 2022 at 06:57:20PM -0500, Yang Zhong wrote: > >

[PATCH v3] qapi: Cleanup SGX related comments and restore @section-size

2022-01-20 Thread Yang Zhong
-size", which can avoid incompatible API breakage. The "@section-size" will be deprecated in 7.2 version. Suggested-by: Daniel P. Berrangé Signed-off-by: Yang Zhong Reviewed-by: Daniel P. Berrangé --- docs/about/deprecated.rst | 13 + qapi/machine.json

Re: [RFC PATCH 1/7] x86: Fix the 64-byte boundary enumeration for extended state

2022-01-21 Thread Yang Zhong
On Tue, Jan 18, 2022 at 01:37:20PM +0100, Paolo Bonzini wrote: > On 1/11/22 03:22, Yang Zhong wrote: > > Thanks Kevin, I will update this in next version. > > Also: > > The extended state subleaves (EAX=0Dh, ECX=n, n>1).ECX[1] > indicate whether the exten

Re: [RFC PATCH 2/7] x86: Add AMX XTILECFG and XTILEDATA components

2022-01-21 Thread Yang Zhong
On Tue, Jan 18, 2022 at 01:39:59PM +0100, Paolo Bonzini wrote: > On 1/10/22 09:23, Tian, Kevin wrote: > >> > >>AMX XTILECFG and XTILEDATA are managed by XSAVE feature > >>set. State component 17 is used for 64-byte TILECFG register > >>(XTILECFG state) and component 18 is used for 8192 bytes > >>of

Re: [RFC PATCH 4/7] x86: Add XFD faulting bit for state components

2022-01-21 Thread Yang Zhong
On Tue, Jan 18, 2022 at 01:52:51PM +0100, Paolo Bonzini wrote: > On 1/7/22 10:31, Yang Zhong wrote: > >-uint32_t need_align; > >+uint32_t need_align, support_xfd; > > These can be replaced by a single field "uint32_t ecx". > > You

Re: [RFC PATCH 3/7] x86: Grant AMX permission for guest

2022-01-21 Thread Yang Zhong
On Tue, Jan 18, 2022 at 02:06:55PM +0100, Paolo Bonzini wrote: > Sorry, hit send on the wrong window. This is the only patch that > will require a bit more work. > > On 1/18/22 13:52, Paolo Bonzini wrote: > >>@@ -124,6 +150,8 @@ void x86_cpus_init(X86MachineState *x86ms, > >>int default_cpu_versi

Re: [RFC PATCH 2/2] hw/i386/sgx: Attach SGX-EPC to its memory backend

2022-01-23 Thread Yang Zhong
On Mon, Jan 17, 2022 at 12:48:10PM +0100, Paolo Bonzini wrote: > On 1/17/22 00:53, Philippe Mathieu-Daudé via wrote: > >We have one SGX-EPC address/size/node per memory backend, > >make it child of the backend in the QOM composition tree. > > > >Cc: Yang Zhong > &g

[PATCH 0/7] AMX support in Qemu

2022-01-24 Thread Yang Zhong
dd support for KVM_CAP_XSAVE2 and AMX state migration Yang Zhong (1): x86: Grant AMX permission for guest Zeng Guang (1): x86: Support XFD and AMX xsave data migration linux-headers/asm-x86/kvm.h | 14 ++ linux-headers/linux/kvm.h | 2 + target/i386/cpu.h | 46 +

[PATCH 3/7] x86: Grant AMX permission for guest

2022-01-24 Thread Yang Zhong
xfeatures). There are separate permissions for native tasks and guests. Qemu should request the guest permissions for dynamic xfeatures which will be exposed to the guest. This only needs to be done once before the first vcpu is created. Suggested-by: Paolo Bonzini Signed-off-by: Yang Zhong Signed

[PATCH 1/7] x86: Fix the 64-byte boundary enumeration for extended state

2022-01-24 Thread Yang Zhong
no supported component needed the bit to be set, but the upcoming AMX feature will use it. Fix the subleaves value according to KVM's supported cpuid. Signed-off-by: Jing Liu Signed-off-by: Yang Zhong --- target/i386/cpu.h | 6 ++ target/i386/cpu.c | 1 + target/i386/kvm/kvm-c

[PATCH 2/7] x86: Add AMX XTILECFG and XTILEDATA components

2022-01-24 Thread Yang Zhong
of AMX XSAVE areas and use QEMU_BUILD_BUG_ON to validate the structs sizes. Signed-off-by: Jing Liu Signed-off-by: Yang Zhong --- target/i386/cpu.h | 18 +- target/i386/cpu.c | 8 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/target/i386/cpu.h b/target

[PATCH 4/7] x86: Add XFD faulting bit for state components

2022-01-24 Thread Yang Zhong
From: Jing Liu Intel introduces XFD faulting mechanism for extended XSAVE features to dynamically enable the features in runtime. If CPUID (EAX=0Dh, ECX=n, n>1).ECX[2] is set as 1, it indicates support for XFD faulting of this state component. Signed-off-by: Jing Liu Signed-off-by: Yang Zh

[PATCH 6/7] x86: add support for KVM_CAP_XSAVE2 and AMX state migration

2022-01-24 Thread Yang Zhong
: Jing Liu Signed-off-by: Zeng Guang Signed-off-by: Wei Wang Signed-off-by: Yang Zhong --- linux-headers/asm-x86/kvm.h | 14 + linux-headers/linux/kvm.h | 2 ++ target/i386/cpu.h | 4 target/i386/kvm/kvm.c | 42 - target/i386

[PATCH 5/7] x86: Add AMX CPUIDs enumeration

2022-01-24 Thread Yang Zhong
From: Jing Liu Add AMX primary feature bits XFD and AMX_TILE to enumerate the CPU's AMX capability. Meanwhile, add AMX TILE and TMUL CPUID leaf and subleaves which exist when AMX TILE is present to provide the maximum capability of TILE and TMUL. Signed-off-by: Jing Liu Signed-off-by:

[PATCH 7/7] x86: Support XFD and AMX xsave data migration

2022-01-24 Thread Yang Zhong
. Signed-off-by: Zeng Guang Signed-off-by: Wei Wang Signed-off-by: Yang Zhong --- target/i386/cpu.h | 9 + target/i386/kvm/kvm.c | 18 ++ target/i386/machine.c | 42 ++ 3 files changed, 69 insertions(+) diff --git a/target/i386

Re: [PATCH 3/7] x86: Grant AMX permission for guest

2022-01-27 Thread Yang Zhong
On Mon, Jan 24, 2022 at 11:16:36AM +0100, Paolo Bonzini wrote: > On 1/24/22 08:55, Yang Zhong wrote: > >Kernel allocates 4K xstate buffer by default. For XSAVE features > >which require large state component (e.g. AMX), Linux kernel > >dynamically expands the xstate buffer o

Re: [PATCH 5/7] x86: Add AMX CPUIDs enumeration

2022-01-27 Thread Yang Zhong
On Mon, Jan 24, 2022 at 11:13:07AM +0100, Paolo Bonzini wrote: > On 1/24/22 08:55, Yang Zhong wrote: > >diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c > >index caf1388d8b..25d26a15f8 100644 > >--- a/target/i386/kvm/kvm.c > >+++ b/target/i386/kvm/kvm.c &

Re: [PATCH 6/7] x86: add support for KVM_CAP_XSAVE2 and AMX state migration

2022-01-27 Thread Yang Zhong
On Mon, Jan 24, 2022 at 11:15:25AM +0100, Paolo Bonzini wrote: > On 1/24/22 08:55, Yang Zhong wrote: > > > >+if (buflen > sizeof(struct kvm_xsave)) { > >+e = &x86_ext_save_areas[XSTATE_XTILE_DATA_BIT]; > >+ > >+if (e->size &&

[PATCH v3 2/5] monitor: Support 'info numa' command

2021-11-01 Thread Yang Zhong
Add the MEMORY_DEVICE_INFO_KIND_SGX_EPC case for SGX numa info with 'info numa' command in the monitor. Signed-off-by: Yang Zhong --- hw/core/numa.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/hw/core/numa.c b/hw/core/numa.c index 510d096a88..1aa05dcf42 100644 --- a/hw/c

[PATCH v3 0/5] SGX NUMA support plus vepc reset

2021-11-01 Thread Yang Zhong
d the previous patch 4 and patch 5 into patch 3.(Paolo) - added reset patch(patch 5) into this version. Yang Zhong (5): numa: Enable numa for SGX EPC sections monitor: Support 'info numa' command numa: Support SGX numa in the monitor and Libvirt interfaces doc: Add the SGX numa des

[PATCH v3 1/5] numa: Enable numa for SGX EPC sections

2021-11-01 Thread Yang Zhong
,id=mem1,size=28M,prealloc=on,host-nodes=1,policy=bind \ -numa node,nodeid=1,cpus=2-3,memdev=node1 \ -M sgx-epc.0.memdev=mem0,sgx-epc.0.node=0,sgx-epc.1.memdev=mem1,sgx-epc.1.node=1 \ .. Signed-off-by: Yang Zhong --- qapi/machine.json | 10 - include/hw/i386/sgx-epc.h | 3

[PATCH v3 3/5] numa: Support SGX numa in the monitor and Libvirt interfaces

2021-11-01 Thread Yang Zhong
quot;return": {"sgx": true, "sgx2": true, "sgx1": true, "sections": \ [{"node": 0, "size": 17070817280}, {"node": 1, "size": 17079205888}], "flc": true}} Signed-off-by: Yang Zhong --- qapi/misc-target.json |

[PATCH v3 4/5] doc: Add the SGX numa description

2021-11-01 Thread Yang Zhong
Add the SGX numa reference command and how to check if SGX numa is support or not with multiple EPC sections. Signed-off-by: Yang Zhong --- docs/system/i386/sgx.rst | 31 +++ 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/docs/system/i386/sgx.rst b

[PATCH v3 5/5] sgx: Reset the vEPC regions during VM reboot

2021-11-01 Thread Yang Zhong
returns the number of EREMOVE failures, telling Qemu to try the ioctl again after it's done with all vEPC regions. The related kernel patches: Link: https://lkml.kernel.org/r/20211021201155.1523989-3-pbonz...@redhat.com Signed-off-by: Yang Zhong --- include/hw/i386/x86.h | 1 + linux-he

Re: [PULL 05/33] i386: Add 'sgx-epc' device to expose EPC sections to guest

2021-11-09 Thread Yang Zhong
On Tue, Nov 09, 2021 at 06:48:59PM +0100, Paolo Bonzini wrote: > On 11/9/21 15:25, Thomas Huth wrote: > >Our device-crash-test script reports that this new device can be > >used to crash QEMU: > > > >$ ./qemu-system-x86_64 -M none -device sgx-epc > >/home/thuth/devel/qemu/include/hw/i386/pc.h:128:P

Re: [PATCH v3 0/5] SGX NUMA support plus vepc reset

2021-11-10 Thread Yang Zhong
On Wed, Nov 10, 2021 at 01:52:09PM +0100, Paolo Bonzini wrote: > On 11/1/21 17:20, Yang Zhong wrote: > >The basic SGX patches were merged into Qemu release, the left NUMA > >function for SGX should be enabled. The patch1 implemented the SGX NUMA > >ACPI to enable NUMA in

Re: [PATCH 1/6] numa: Enable numa for SGX EPC sections

2021-10-20 Thread Yang Zhong
On Mon, Oct 11, 2021 at 11:32:39AM -0500, Eric Blake wrote: > On Mon, Oct 11, 2021 at 07:15:49PM +0800, Yang Zhong wrote: > > The basic SGX did not enable numa for SGX EPC sections, which > > result in all EPC sections located in numa node 0. This patch > > enable SGX numa

Re: [PATCH 4/6] monitor: numa support for 'info sgx' command

2021-10-20 Thread Yang Zhong
On Tue, Oct 12, 2021 at 12:59:17PM +0200, Paolo Bonzini wrote: > On 11/10/21 13:15, Yang Zhong wrote: > >This patch can enable numa support for 'info sgx' command > >in the monitor, which can show detailed SGX EPC sections > >info. > > > >(qemu) info sgx

Re: [PATCH 3/6] numa: Add SGXEPCSection list for multiple sections

2021-10-20 Thread Yang Zhong
On Mon, Oct 11, 2021 at 12:03:24PM -0500, Eric Blake wrote: > On Mon, Oct 11, 2021 at 07:15:51PM +0800, Yang Zhong wrote: > > The SGXEPCSection list added into SGXInfo to show the multiple > > SGX EPC sections detailed info, not the total size like before. > > > >

Re: [PATCH 3/6] numa: Add SGXEPCSection list for multiple sections

2021-10-20 Thread Yang Zhong
On Tue, Oct 12, 2021 at 01:01:34PM +0200, Paolo Bonzini wrote: > On 11/10/21 13:15, Yang Zhong wrote: > >The SGXEPCSection list added into SGXInfo to show the multiple > >SGX EPC sections detailed info, not the total size like before. > > > >Signed-off-by: Yang Z

[PATCH v2 0/5] SGX NUMA support plus vepc reset

2021-10-22 Thread Yang Zhong
...@redhat.com/ Thanks! Yang Changes from V1: - added documents for new members.(Eric) - changed the "index" to "node" in struct SGXEPCSection.(Eric, Paolo) - squashed the previous patch 4 and patch 5 into patch 3.(Paolo) - added reset patch(patch 5) into this version. Ya

[PATCH v2 4/5] doc: Add the SGX numa description

2021-10-22 Thread Yang Zhong
Add the SGX numa reference command and how to check if SGX numa is support or not with multiple EPC sections. Signed-off-by: Yang Zhong --- docs/system/i386/sgx.rst | 31 +++ 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/docs/system/i386/sgx.rst b

[PATCH v2 2/5] monitor: Support 'info numa' command

2021-10-22 Thread Yang Zhong
Add the MEMORY_DEVICE_INFO_KIND_SGX_EPC case for SGX numa info with 'info numa' command in the monitor. Signed-off-by: Yang Zhong --- hw/core/numa.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/hw/core/numa.c b/hw/core/numa.c index 510d096a88..1aa05dcf42 100644 --- a/hw/c

[PATCH v2 1/5] numa: Enable numa for SGX EPC sections

2021-10-22 Thread Yang Zhong
,id=mem1,size=28M,prealloc=on,host-nodes=1,policy=bind \ -numa node,nodeid=1,cpus=2-3,memdev=node1 \ -M sgx-epc.0.memdev=mem0,sgx-epc.0.node=0,sgx-epc.1.memdev=mem1,sgx-epc.1.node=1 \ .. Signed-off-by: Yang Zhong --- qapi/machine.json | 10 - include/hw/i386/sgx-epc.h | 3

[PATCH v2 3/5] numa: Support SGX numa in the monitor and Libvirt interfaces

2021-10-22 Thread Yang Zhong
quot;return": {"sgx": true, "sgx2": true, "sgx1": true, "sections": \ [{"node": 0, "size": 17070817280}, {"node": 1, "size": 17079205888}], "flc": true}} Signed-off-by: Yang Zhong --- qapi/misc-target.json |

[PATCH v2 5/5] sgx: Reset the vEPC regions during VM reboot

2021-10-22 Thread Yang Zhong
erged, the kernel commit ids will be updated here. Signed-off-by: Yang Zhong --- include/hw/i386/x86.h | 1 + linux-headers/linux/kvm.h | 6 + hw/i386/sgx.c | 53 +++ hw/i386/x86.c | 4 +++ 4 files changed, 64 insertions(+)

Re: [PATCH v2 5/5] sgx: Reset the vEPC regions during VM reboot

2021-10-26 Thread Yang Zhong
On Fri, Oct 22, 2021 at 11:46:30PM +0200, Paolo Bonzini wrote: > On 22/10/21 21:27, Yang Zhong wrote: > >+ > >+for (j = 0; j < num; j++) { > >+epc = pcms->sgx_epc.sections[j]; > >+hostmem = MEMORY_BACKEND(epc->hostmem); &

[RFC PATCH 5/7] x86: Add AMX CPUIDs enumeration

2022-01-07 Thread Yang Zhong
From: Jing Liu Add AMX primary feature bits XFD and AMX_TILE to enumerate the CPU's AMX capability. Meanwhile, add AMX TILE and TMUL CPUID leaf and subleaves which exist when AMX TILE is present to provide the maximum capability of TILE and TMUL. Signed-off-by: Jing Liu Signed-off-by:

[RFC PATCH 1/7] x86: Fix the 64-byte boundary enumeration for extended state

2022-01-07 Thread Yang Zhong
AVE area is used. Fix the subleaves value according to the host supported cpuid. The upcoming AMX feature would be the first one using it. Signed-off-by: Jing Liu Signed-off-by: Yang Zhong --- target/i386/cpu.h | 1 + target/i386/cpu.c | 1 + target/i386/kvm/kvm-cpu.c | 3 +++ 3 fi

[RFC PATCH 0/7] AMX support in Qemu

2022-01-07 Thread Yang Zhong
ml Thanks, Yang Jing Liu (5): x86: Fix the 64-byte boundary enumeration for extended state x86: Add AMX XTILECFG and XTILEDATA components x86: Add XFD faulting bit for state components x86: Add AMX CPUIDs enumeration x86: Use new XSAVE ioctls handling Yang Zhong (1): x86:

[RFC PATCH 3/7] x86: Grant AMX permission for guest

2022-01-07 Thread Yang Zhong
guest only once before the first vCPU is created. KVM checks the guest permission when Qemu advertises the features, and the advertising operation fails w/o permission. Signed-off-by: Yang Zhong Signed-off-by: Jing Liu --- target/i386/cpu.h | 7 +++ hw/i386/x86.c | 28

[RFC PATCH 4/7] x86: Add XFD faulting bit for state components

2022-01-07 Thread Yang Zhong
From: Jing Liu Intel introduces XFD faulting mechanism for extended XSAVE features to dynamically enable the features in runtime. If CPUID (EAX=0Dh, ECX=n, n>1).ECX[2] is set as 1, it indicates support for XFD faulting of this state component. Signed-off-by: Jing Liu Signed-off-by: Yang Zh

[RFC PATCH 2/7] x86: Add AMX XTILECFG and XTILEDATA components

2022-01-07 Thread Yang Zhong
. Add structs that define the layout of AMX XSAVE areas and use QEMU_BUILD_BUG_ON to validate the structs sizes. Signed-off-by: Jing Liu Signed-off-by: Yang Zhong --- target/i386/cpu.h | 16 +++- target/i386/cpu.c | 8 2 files changed, 23 insertions(+), 1 deletion(-) diff

[RFC PATCH 6/7] x86: Use new XSAVE ioctls handling

2022-01-07 Thread Yang Zhong
From: Jing Liu Extended feature has large state while current kvm_xsave only allows 4KB. Use new XSAVE ioctls if the xstate size is large than kvm_xsave. Signed-off-by: Jing Liu Signed-off-by: Zeng Guang Signed-off-by: Wei Wang Signed-off-by: Yang Zhong --- linux-headers/asm-x86/kvm.h | 14

[RFC PATCH 7/7] x86: Support XFD and AMX xsave data migration

2022-01-07 Thread Yang Zhong
. Signed-off-by: Zeng Guang Signed-off-by: Wei Wang Signed-off-by: Yang Zhong --- target/i386/cpu.h | 9 + target/i386/kvm/kvm.c | 18 ++ target/i386/machine.c | 42 ++ 3 files changed, 69 insertions(+) diff --git a/target/i386

Re: [RFC PATCH 2/7] x86: Add AMX XTILECFG and XTILEDATA components

2022-01-10 Thread Yang Zhong
; up AMX components. Add structs that define the layout of > > AMX XSAVE areas and use QEMU_BUILD_BUG_ON to validate the > > structs sizes. > > > > Signed-off-by: Jing Liu > > Signed-off-by: Yang Zhong > > --- > > target/i386/cpu.h | 16 ++

Re: [RFC PATCH 1/7] x86: Fix the 64-byte boundary enumeration for extended state

2022-01-10 Thread Yang Zhong
On Mon, Jan 10, 2022 at 04:20:41PM +0800, Tian, Kevin wrote: > > From: Zhong, Yang > > Sent: Friday, January 7, 2022 5:31 PM > > > > From: Jing Liu > > > > The extended state subleaves (EAX=0Dh, ECX=n, n>1).ECX[1] > > are all zero, while spec actually introduces that bit 01 > > should indicate if

Re: [RFC PATCH 4/7] x86: Add XFD faulting bit for state components

2022-01-10 Thread Yang Zhong
features in > > runtime. If CPUID (EAX=0Dh, ECX=n, n>1).ECX[2] is set > > as 1, it indicates support for XFD faulting of this > > state component. > > > > Signed-off-by: Jing Liu > > Signed-off-by: Yang Zhong > > --- > > target/i386/cpu.h

Re: [RFC PATCH 3/7] x86: Grant AMX permission for guest

2022-01-10 Thread Yang Zhong
here are separate permissions for native tasks and guests. > > Qemu should request the guest permissions for dynamic xfeatures > which will be exposed to the guest. This only needs to be done > once before the first vcpu is created." This is clearer. Will update this in new vers

[PATCH] sgx: Move sgx object from /machine/unattached to /machine

2022-01-12 Thread Yang Zhong
ice[0] is occupied by sgx-epc device, which fail to get the unvailable-features from /machine/unattached/device[0]. This patch make one new /machine/sgx object to avoid this issue. (qemu) qom-list /machine/unattached/ device[0] (child) (qemu) qom-list /machine/sgx device[0] (child) Signed-off-by:

Re: [PATCH] sgx: Move sgx object from /machine/unattached to /machine

2022-01-12 Thread Yang Zhong
Hi Daniel, On Wed, Jan 12, 2022 at 10:11:35AM +, Daniel P. Berrangé wrote: > On Wed, Jan 12, 2022 at 11:55:17AM -0500, Yang Zhong wrote: > > When Libvirt start, it get the vcpu's unavailable-features from > > /machine/unattached/device[0] path by qom-get command, but in

Re: [PATCH v4 4/4] hw/i386/sgx: Attach SGX-EPC objects to machine

2022-02-13 Thread Yang Zhong
this patch can move sgx virtual device from /machine/unattached/device[nn] to /machine/sgx-epc[nn], which seems more clear. Thanks! Yang > > > > > Reported-by: Yang Zhong > > Suggested-by: Paolo Bonzini > > Reviewed-by: Daniel P. Berrangé > > Signed-

Re: [PATCH v4 4/4] hw/i386/sgx: Attach SGX-EPC objects to machine

2022-02-13 Thread Yang Zhong
where the 'nn' varies depending on what devices were already created. > > > > With this change the SGX-EPC objects are now at > > > > /machine/sgx-epc[nn] > > > > where the 'nn' of the first SGX-EPC object is always zero. > >

[PATCH v2 3/8] x86: Grant AMX permission for guest

2022-02-16 Thread Yang Zhong
to get host side supported_xcr0 and Qemu can decide if it can request dynamically enabled XSAVE features permission. https://lore.kernel.org/all/20220126152210.3044876-1-pbonz...@redhat.com/ Suggested-by: Paolo Bonzini Signed-off-by: Yang Zhong Signed-off-by: Jing Liu --- target/i386/cpu.h

[PATCH v2 0/8] AMX support in Qemu

2022-02-16 Thread Yang Zhong
kvm_arch_init_vcpu() to make the request permission before KVM_CAP_XSAVE2 extension check(Paolo). - Removed RFC prefix. Jing Liu (5): x86: Fix the 64-byte boundary enumeration for extended state x86: Add AMX XTILECFG and XTILEDATA components x86: Add XFD faulting bit for state component

[PATCH v2 1/8] x86: Fix the 64-byte boundary enumeration for extended state

2022-02-16 Thread Yang Zhong
no supported component needed the bit to be set, but the upcoming AMX feature will use it. Fix the subleaves value according to KVM's supported cpuid. Signed-off-by: Jing Liu Signed-off-by: Yang Zhong --- target/i386/cpu.h | 6 ++ target/i386/cpu.c | 1 + target/i386/kvm/kvm-c

[PATCH v2 4/8] x86: Add XFD faulting bit for state components

2022-02-16 Thread Yang Zhong
From: Jing Liu Intel introduces XFD faulting mechanism for extended XSAVE features to dynamically enable the features in runtime. If CPUID (EAX=0Dh, ECX=n, n>1).ECX[2] is set as 1, it indicates support for XFD faulting of this state component. Signed-off-by: Jing Liu Signed-off-by: Yang Zh

[PATCH v2 5/8] x86: Add AMX CPUIDs enumeration

2022-02-16 Thread Yang Zhong
From: Jing Liu Add AMX primary feature bits XFD and AMX_TILE to enumerate the CPU's AMX capability. Meanwhile, add AMX TILE and TMUL CPUID leaf and subleaves which exist when AMX TILE is present to provide the maximum capability of TILE and TMUL. Signed-off-by: Jing Liu Signed-off-by:

[PATCH v2 2/8] x86: Add AMX XTILECFG and XTILEDATA components

2022-02-16 Thread Yang Zhong
of AMX XSAVE areas and use QEMU_BUILD_BUG_ON to validate the structs sizes. Signed-off-by: Jing Liu Signed-off-by: Yang Zhong --- target/i386/cpu.h | 18 +- target/i386/cpu.c | 8 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/target/i386/cpu.h b/target

[PATCH v2 6/8] x86: add support for KVM_CAP_XSAVE2 and AMX state migration

2022-02-16 Thread Yang Zhong
: Jing Liu Signed-off-by: Zeng Guang Signed-off-by: Wei Wang Signed-off-by: Yang Zhong --- target/i386/cpu.h | 4 target/i386/kvm/kvm.c | 42 -- target/i386/xsave_helper.c | 33 ++ 3 files changed, 64 insertions

[PATCH v2 7/8] x86: Support XFD and AMX xsave data migration

2022-02-16 Thread Yang Zhong
. Signed-off-by: Zeng Guang Signed-off-by: Wei Wang Signed-off-by: Yang Zhong --- target/i386/cpu.h | 9 + target/i386/kvm/kvm.c | 18 ++ target/i386/machine.c | 42 ++ 3 files changed, 69 insertions(+) diff --git a/target/i386

[PATCH v2 8/8] linux-header: Sync the linux headers

2022-02-16 Thread Yang Zhong
This patch will be dropped once Qemu sync linux 5.17 header. Making all linux-headers changes here are only for maintainers to easily remove those changes once those patches are queued. Signed-off-by: Yang Zhong --- linux-headers/asm-x86/kvm.h | 17 + linux-headers/linux/kvm.h

Re: [PATCH v2 3/8] x86: Grant AMX permission for guest

2022-02-16 Thread Yang Zhong
On Wed, Feb 16, 2022 at 10:04:29PM -0800, Yang Zhong wrote: > Kernel allocates 4K xstate buffer by default. For XSAVE features > which require large state component (e.g. AMX), Linux kernel > dynamically expands the xstate buffer only after the process has > acquired the necessary

  1   2   3   4   5   6   7   8   >