Re: [PATCH 1/2] CXL/cxl_type3: add first_dvsec_offset() helper

2024-04-01 Thread Zhijian Li (Fujitsu)
On 02/04/2024 12:09, fan wrote: > On Tue, Apr 02, 2024 at 09:46:46AM +0800, Li Zhijian via wrote: >> It helps to figure out where the first dvsec register is located. In >> addition, replace offset and size hardcore with existing macros. >> >> Signed-off-by: Li

[PATCH 1/2] CXL/cxl_type3: add first_dvsec_offset() helper

2024-04-01 Thread Li Zhijian via
It helps to figure out where the first dvsec register is located. In addition, replace offset and size hardcore with existing macros. Signed-off-by: Li Zhijian --- hw/mem/cxl_type3.c | 19 +-- 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/hw/mem/cxl_type3.c b/hw

[PATCH 2/2] CXL/cxl_type3: reset DVSEC CXL Control in ct3d_reset

2024-04-01 Thread Li Zhijian via
ult) value in reboot so that the OS can read its clean status. Signed-off-by: Li Zhijian --- hw/mem/cxl_type3.c | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c index ad2fe7d463fb..3fe136053390 100644 --- a/hw/mem/cxl_typ

Re: [PATCH 26/26] i386/kvm: Move architectural CPUID leaf generation to separate helper

2024-04-01 Thread Xiaoyao Li
this is just a cleanup, so keep the function static. Signed-off-by: Sean Christopherson Signed-off-by: Xiaoyao Li Message-ID: <20240229063726.610065-23-xiaoyao...@intel.com> [Unify error reporting, rename function. - Paolo] Signed-off-by: Paolo Bonzini --- target/i386/kvm/kvm.c

Re: vhost-user-blk reconnect issue

2024-04-01 Thread Li Feng
/a68c0148e9bf105f9e83ff5e763b8fcb6f7ba9be.1697644299.git@redhat.com/ Thanks, Li > 2024年4月1日 10:08,Yajun Wu 写道: > > > On 3/27/2024 6:47 PM, Stefano Garzarella wrote: >> External email: Use caution opening links or attachments >> >> >> Hi Yajun, >> &

Re: [PATCH-for-9.1 v2 2/3] migration: Remove RDMA protocol handling

2024-04-01 Thread Zhijian Li (Fujitsu)
Phil, on 3/29/2024 6:28 PM, Philippe Mathieu-Daudé wrote: >> >> >>> IMHO it's more important to know whether there are still users and >>> whether >>> they would still like to see it around. >> >> Agree. >> I didn't immediately express my opinion in V1 because I'm also >> consulting our >>

[PATCH] migration, docs: mark RDMA migration as deprecated

2024-03-31 Thread Li Zhijian via
...@fujitsu.com [2] https://lore.kernel.org/r/cahecvy7hxswn4ow_kog+q+tn6f_kmeichevz1qgm-fbxbpp...@mail.gmail.com CC: Peter Xu CC: Philippe Mathieu-Daudé CC: Fabiano Rosas CC: Thomas Huth CC: Daniel P. Berrangé CC: Yu Zhang Signed-off-by: Li Zhijian --- docs/about/deprecated.rst | 15

Re: [PATCH-for-9.1 v2 2/3] migration: Remove RDMA protocol handling

2024-03-28 Thread Zhijian Li (Fujitsu)
rdma subsystem") >>> released in v8.2. >>> >>> Remove: >>> - RDMA handling from migration >>> - dependencies on libibumad, libibverbs and librdmacm >>> >>> Keep the RAM_SAVE_FLAG_HOOK definition since it might appears >>&

Re: [PATCH v3 48/49] hw/i386/sev: Use guest_memfd for legacy ROMs

2024-03-27 Thread Xiaoyao Li
On 3/21/2024 2:12 AM, Isaku Yamahata wrote: On Wed, Mar 20, 2024 at 03:39:44AM -0500, Michael Roth wrote: TODO: make this SNP-specific if TDX disables legacy ROMs in general TDX disables pc.rom, not disable isa-bios. IIRC, TDX doesn't need pc pflash. Not TDX doesn't need pc pflash, but

Re: [PATCH for-9.1 v5 2/3] target/i386: add guest-phys-bits cpu property

2024-03-26 Thread Xiaoyao Li
viewed-by: Xiaoyao Li --- v4->v5: - move here all non-KVM parts - add compat property and support for special value "-1" (accelerator defines value) target/i386/cpu.h | 1 + hw/i386/pc.c | 4 +++- target/i386/cpu.c | 22 ++ 3 files changed, 26 insert

Re: [PATCH 12/26] KVM: track whether guest state is encrypted

2024-03-26 Thread Xiaoyao Li
On 3/23/2024 2:11 AM, Paolo Bonzini wrote: So far, KVM has allowed KVM_GET/SET_* ioctls to execute even if the guest state is encrypted, in which case they do nothing. For the new API using VM types, instead, the ioctls will fail which is a safer and more robust approach. The new API will be

Re: [PATCH 21/26] kvm/memory: Make memory type private by default if it has guest memfd backend

2024-03-26 Thread Xiaoyao Li
On 3/23/2024 2:11 AM, Paolo Bonzini wrote: From: Xiaoyao Li KVM side leaves the memory to shared by default, while may incur the /s/while/which/ fix typo from myself. overhead of paging conversion on the first visit of each page. Because the expectation is that page is likely to private

Re: [PATCH 25/26] kvm: handle KVM_EXIT_MEMORY_FAULT

2024-03-26 Thread Xiaoyao Li
, the original shared memory can be discarded via ram_block_discard_range(). Note, shared memory can be discarded only when it's not back'ed by hugetlb because hugetlb is supposed to be pre-allocated and no need for discarding. Signed-off-by: Chao Peng Co-developed-by: Xiaoyao Li Signed-off

Re: [PATCH 3/7] KVM: track whether guest state is encrypted

2024-03-22 Thread Xiaoyao Li
in the future in order to suppor migration). From that point, skip reading registers so that cpu->vcpu_dirty is never true: if it ever becomes true, kvm_arch_put_registers() will fail miserably. Signed-off-by: Paolo Bonzini Reviewed-by: Xiaoyao Li

Re: [PATCH 4/7] KVM: remove kvm_arch_cpu_check_are_resettable

2024-03-22 Thread Xiaoyao Li
Reviewed-by: Xiaoyao Li

Re: [PATCH 5/7] target/i386: introduce x86-confidential-guest

2024-03-22 Thread Xiaoyao Li
On 3/19/2024 9:59 PM, Paolo Bonzini wrote: Introduce a common superclass for x86 confidential guest implementations. It will extend ConfidentialGuestSupportClass with a method that provides the VM type to be passed to KVM_CREATE_VM. Signed-off-by: Paolo Bonzini Reviewed-by: Xiaoyao Li

Re: [PATCH 6/7] target/i386: Implement mc->kvm_type() to get VM type

2024-03-22 Thread Xiaoyao Li
On 3/19/2024 9:59 PM, Paolo Bonzini wrote: From: Xiaoyao Li KVM is introducing a new API to create confidential guests, which will be used by TDX and SEV-SNP but is also available for SEV and SEV-ES. The API uses the VM type argument to KVM_CREATE_VM to identify which confidential computing

Re: [PATCH RFC v3 00/49] Add AMD Secure Nested Paging (SEV-SNP) support

2024-03-20 Thread Xiaoyao Li
On 3/21/2024 1:08 AM, Paolo Bonzini wrote: On Wed, Mar 20, 2024 at 10:59 AM Paolo Bonzini wrote: I will now focus on reviewing patches 6-20. This way we can prepare a common tree for SEV_INIT2/SNP/TDX, for both vendors to build upon. Ok, the attachment is the delta that I have. The only

Re: [PATCH v5 08/65] kvm: handle KVM_EXIT_MEMORY_FAULT

2024-03-20 Thread Xiaoyao Li
On 3/19/2024 10:14 AM, Wang, Lei wrote: On 2/29/2024 14:36, Xiaoyao Li wrote: From: Chao Peng When geeting KVM_EXIT_MEMORY_FAULT exit, it indicates userspace needs to do the memory conversion on the RAMBlock to turn the memory into desired attribute, i.e., private/shared. Currently only

Re: [PATCH v3 13/49] [FIXUP] "kvm: handle KVM_EXIT_MEMORY_FAULT": drop qemu_host_page_size

2024-03-20 Thread Xiaoyao Li
On 3/20/2024 4:39 PM, Michael Roth wrote: TODO: squash into "kvm: handle KVM_EXIT_MEMORY_FAULT" qemu_host_page_size has been superseded by qemu_real_host_page_size() in newer QEMU, so update the patch accordingly. I found it today as well when rebase to qemu v9.0.0-rc0. Fix it locally, will

Re: [PATCH v5 06/65] kvm: Introduce support for memory_attributes

2024-03-20 Thread Xiaoyao Li
On 3/19/2024 10:03 AM, Wang, Lei wrote: On 2/29/2024 14:36, Xiaoyao Li wrote:> 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 dec

Re: [PATCH v3 11/49] physmem: Introduce ram_block_discard_guest_memfd_range()

2024-03-20 Thread Xiaoyao Li
On 3/20/2024 5:37 PM, David Hildenbrand wrote: On 20.03.24 09:39, Michael Roth wrote: From: Xiaoyao Li When memory page is converted from private to shared, the original private memory is back'ed by guest_memfd. Introduce ram_block_discard_guest_memfd_range() for discarding memory

Re: [PATCH v4 1/2] kvm: add support for guest physical bits

2024-03-19 Thread Xiaoyao Li
gt;host_phys_bits && cpu->host_phys_bits_limit && cpu->guest_phys_bits > cpu->host_phys_bits_limt) { } Simpler, we can guard with cpu->phys_bits like below, because cpu->host_phys_bits_limit is used to guard cpu->phys_bits in host_cpu_realizefn() if (cpu-

Re: [PATCH] target/i386: Export RFDS bit to guests

2024-03-19 Thread Xiaoyao Li
On 3/19/2024 11:08 PM, Pawan Gupta wrote: On Tue, Mar 19, 2024 at 12:22:08PM +0800, Xiaoyao Li wrote: On 3/13/2024 10:53 PM, Pawan Gupta wrote: Register File Data Sampling (RFDS) is a CPU side-channel vulnerability that may expose stale register value. CPUs that set RFDS_NO bit in MSR

Re: [PATCH] target/i386: Export RFDS bit to guests

2024-03-18 Thread Xiaoyao Li
On 3/13/2024 10:53 PM, Pawan Gupta wrote: Register File Data Sampling (RFDS) is a CPU side-channel vulnerability that may expose stale register value. CPUs that set RFDS_NO bit in MSR IA32_ARCH_CAPABILITIES indicate that they are not vulnerable to RFDS. Similarly, RFDS_CLEAR indicates that CPU

Re: [PATCH 2/4] i386/sev: Switch to use confidential_guest_kvm_init()

2024-03-18 Thread Xiaoyao Li
On 3/19/2024 5:51 AM, Paolo Bonzini wrote: On Thu, Feb 29, 2024 at 7:01 AM Xiaoyao Li wrote: Use confidential_guest_kvm_init() instead of calling SEV specific sev_kvm_init(). As a bouns, it fits to future TDX when TDX implements its own confidential_guest_support and .kvm_init(). Move

[PATCH V6] target/loongarch: Fix tlb huge page loading issue

2024-03-18 Thread Xianglai Li
interface normally. The lddir and ldpte instruction emulation has a problem with the use of super huge page processing above level 2. The page size is not correctly calculated, resulting in the wrong page size of the table entry found by tlb. Signed-off-by: Xianglai Li --- target/loongarch/cpu

Re: [PATCH v3 2/3] kvm: add support for guest physical bits

2024-03-17 Thread Xiaoyao Li
On 3/13/2024 9:27 PM, Gerd Hoffmann wrote: Query kvm for supported guest physical address bits, in cpuid function 8008, eax[23:16]. Usually this is identical to host physical address bits. With NPT or EPT being used this might be restricted to 48 (max 4-level paging address space size)

Re: [PATCH v5 49/65] i386/tdx: handle TDG.VP.VMCALL

2024-03-15 Thread Xiaoyao Li
On 3/13/2024 11:31 PM, Daniel P. Berrangé wrote: On Tue, Mar 12, 2024 at 03:44:32PM +0800, Xiaoyao Li wrote: On 3/11/2024 5:27 PM, Daniel P. Berrangé wrote: On Thu, Feb 29, 2024 at 01:37:10AM -0500, Xiaoyao Li wrote: From: Isaku Yamahata Add property "quote-generation-socket" to

[PATCH V5] target/loongarch: Fix tlb huge page loading issue

2024-03-15 Thread Xianglai Li
interface normally. The lddir and ldpte instruction emulation has a problem with the use of super huge page processing above level 2. The page size is not correctly calculated, resulting in the wrong page size of the table entry found by tlb. Signed-off-by: Xianglai Li --- target/loongarch/cpu

[PATCH V4] target/loongarch: Fixed tlb huge page loading issue

2024-03-13 Thread Xianglai Li
interface normally. The lddir and ldpte instruction emulation has a problem with the use of super large page processing above level 2. The page size is not correctly calculated, resulting in the wrong page size of the table entry found by tlb. Signed-off-by: Xianglai Li --- target/loongarch/cpu

[PATCH V4 1/1] target/loongarch: Fixed tlb huge page loading issue

2024-03-13 Thread Xianglai Li
Cc: zhaotian...@loongson.cn Cc: yi...@loongson.cn Cc: wuruiy...@loongson.cn Signed-off-by: Xianglai Li --- target/loongarch/cpu-csr.h| 3 + target/loongarch/internals.h | 5 -- target/loongarch/tcg/tlb_helper.c | 105 -- 3 files changed, 74

Re: [PATCH v5 49/65] i386/tdx: handle TDG.VP.VMCALL

2024-03-12 Thread Xiaoyao Li
On 3/11/2024 5:27 PM, Daniel P. Berrangé wrote: On Thu, Feb 29, 2024 at 01:37:10AM -0500, Xiaoyao Li wrote: From: Isaku Yamahata Add property "quote-generation-socket" to tdx-guest, which is a property of type SocketAddress to specify Quote Generation Service(QGS). On request o

Re: [PATCH v5 52/65] i386/tdx: Wire TDX_REPORT_FATAL_ERROR with GuestPanic facility

2024-03-12 Thread Xiaoyao Li
On 3/11/2024 3:29 PM, Markus Armbruster wrote: Xiaoyao Li writes: On 3/7/2024 9:51 PM, Markus Armbruster wrote: Xiaoyao Li writes: On 2/29/2024 4:51 PM, Markus Armbruster wrote: Xiaoyao Li writes: Integrate TDX's TDX_REPORT_FATAL_ERROR into QEMU GuestPanic facility Originated-from

Re: [PATCH v9 06/21] i386/cpu: Use APIC ID info to encode cache topo in CPUID[4]

2024-03-11 Thread Xiaoyao Li
On 3/10/2024 9:38 PM, Zhao Liu wrote: Hi Xiaoyao, case 3: /* L3 cache info */ -die_offset = apicid_die_offset(_info); if (cpu->enable_l3_cache) { +addressable_threads_width = apicid_die_offset(_info); Please get rid of the

Re: [PATCH v9 11/21] i386/cpu: Decouple CPUID[0x1F] subleaf with specific topology level

2024-03-11 Thread Xiaoyao Li
t;module" level in 0x1F, decouple CPUID[0x1F] subleaf with specific topology level. Tested-by: Yongwei Ma Signed-off-by: Zhao Liu Reviewed-by: Xiaoyao Li Besides, some nits below. --- Changes since v7: * Refactored the encode_topo_cpuid1f() to use traversal to search the encoded l

Re: [PATCH v9 09/21] i386/cpu: Introduce bitmap to cache available CPU topology levels

2024-03-11 Thread Xiaoyao Li
to detect without touching the topology details. This is also in preparation for the follow-up to decouple CPUID[0x1F] subleaf with specific topology level. Tested-by: Yongwei Ma Signed-off-by: Zhao Liu Reviewed-by: Xiaoyao Li

Re: [PATCH v5 52/65] i386/tdx: Wire TDX_REPORT_FATAL_ERROR with GuestPanic facility

2024-03-10 Thread Xiaoyao Li
On 3/7/2024 9:51 PM, Markus Armbruster wrote: Xiaoyao Li writes: On 2/29/2024 4:51 PM, Markus Armbruster wrote: Xiaoyao Li writes: Integrate TDX's TDX_REPORT_FATAL_ERROR into QEMU GuestPanic facility Originated-from: Isaku Yamahata Signed-off-by: Xiaoyao Li --- Changes in v5: - mention

Re: [PATCH v5 30/65] i386/tdx: Support user configurable mrconfigid/mrowner/mrownerconfig

2024-03-10 Thread Xiaoyao Li
On 3/7/2024 9:56 PM, Markus Armbruster wrote: Xiaoyao Li writes: On 3/7/2024 4:39 PM, Markus Armbruster wrote: Xiaoyao Li writes: On 2/29/2024 9:25 PM, Markus Armbruster wrote: Xiaoyao Li writes: On 2/29/2024 4:37 PM, Markus Armbruster wrote: Xiaoyao Li writes: From: Isaku

Re: [PATCH v9 08/21] i386/cpu: Consolidate the use of topo_info in cpu_x86_cpuid()

2024-03-09 Thread Xiaoyao Li
On 2/27/2024 6:32 PM, Zhao Liu wrote: From: Zhao Liu In cpu_x86_cpuid(), there are many variables in representing the cpu topology, e.g., topo_info, cs->nr_cores and cs->nr_threads. Since the names of cs->nr_cores/cs->nr_threads does not accurately Again as in v7, please changes to

Re: [PATCH v9 07/21] i386/cpu: Use APIC ID info get NumSharingCache for CPUID[0x8000001D].EAX[bits 25:14]

2024-03-09 Thread Xiaoyao Li
ID to calculate this field. [1]: APM, vol.3, appendix.E.4.15 Function 8000_001Dh--Cache Topology Information Cc: Babu Moger Tested-by: Yongwei Ma Signed-off-by: Zhao Liu Reviewed-by: Xiaoyao Li --- Changes since v7: * Moved this patch after CPUID[4]'s similar change ("i386/cpu: U

Re: [PATCH v9 06/21] i386/cpu: Use APIC ID info to encode cache topo in CPUID[4]

2024-03-09 Thread Xiaoyao Li
not similar to addressable_threads_width, the semantic changes per different cache level. In fact, you want something like bit_width_of_addressable_threads_sharing_this_level_of_cache. So I suggest stop using the variable of "address_therads_width". Instead jus

Re: Problem with migration/rdma

2024-03-07 Thread Zhijian Li (Fujitsu)
On 08/03/2024 14:55, Peter Xu wrote: > On Fri, Mar 08, 2024 at 07:27:59AM +0100, Yu Zhang wrote: >> Hello Zhijian and Peter, >> >> Thank you so much for testing and confirming it. >> I created a patch in the email format, unfortunately got an issue for >> setting up the >> "Application-specific

Re: [PATCH v2 2/2] kvm: add support for guest physical bits

2024-03-07 Thread Xiaoyao Li
On 3/5/2024 6:52 PM, Gerd Hoffmann wrote: Query kvm for supported guest physical address bits, in cpuid function 8008, eax[23:16]. Usually this is identical to host physical address bits. With NPT or EPT being used this might be restricted to 48 (max 4-level paging address space size) even

Re: [PATCH v5 52/65] i386/tdx: Wire TDX_REPORT_FATAL_ERROR with GuestPanic facility

2024-03-07 Thread Xiaoyao Li
On 2/29/2024 4:51 PM, Markus Armbruster wrote: Xiaoyao Li writes: Integrate TDX's TDX_REPORT_FATAL_ERROR into QEMU GuestPanic facility Originated-from: Isaku Yamahata Signed-off-by: Xiaoyao Li --- Changes in v5: - mention additional error information in gpa when it presents; - refine

Re: [PATCH v5 49/65] i386/tdx: handle TDG.VP.VMCALL

2024-03-07 Thread Xiaoyao Li
On 2/29/2024 9:28 PM, Markus Armbruster wrote: Xiaoyao Li writes: On 2/29/2024 4:40 PM, Markus Armbruster wrote: Xiaoyao Li writes: From: Isaku Yamahata Add property "quote-generation-socket" to tdx-guest, which is a property of type SocketAddress to specify Quote Generation S

Re: [PATCH v5 30/65] i386/tdx: Support user configurable mrconfigid/mrowner/mrownerconfig

2024-03-07 Thread Xiaoyao Li
On 3/7/2024 4:39 PM, Markus Armbruster wrote: Xiaoyao Li writes: On 2/29/2024 9:25 PM, Markus Armbruster wrote: Xiaoyao Li writes: On 2/29/2024 4:37 PM, Markus Armbruster wrote: Xiaoyao Li writes: From: Isaku Yamahata Three sha384 hash values, mrconfigid, mrowner and mrownerconfig

[PATCH V3 1/1] target/loongarch: Fixed tlb huge page loading issue

2024-03-06 Thread Xianglai Li
interface normally. The lddir and ldpte instruction emulation has a problem with the use of super large page processing above level 2. The page size is not correctly calculated, resulting in the wrong page size of the table entry found by tlb. Signed-off-by: Xianglai Li Cc: maob...@loongson.cn Cc

[PATCH V3 0/1] target/loongarch: Fixed tlb huge page loading issue

2024-03-06 Thread Xianglai Li
ble LDDIR_PS, and implement lddir and ldpte huge pages by referring to the latest architecture reference manual. V1->V2: Modified the patch title format and Enrich the commit mesg description Cc: maob...@loongson.cn Cc: Song Gao Cc: Xiaojuan Yang Cc: zhaotian...@loongson.cn Xianglai Li (1):

Re: [PATCH v5 08/65] kvm: handle KVM_EXIT_MEMORY_FAULT

2024-03-06 Thread Xiaoyao Li
On 3/5/2024 5:10 PM, Isaku Yamahata wrote: On Thu, Feb 29, 2024 at 01:36:29AM -0500, Xiaoyao Li wrote: From: Chao Peng When geeting KVM_EXIT_MEMORY_FAULT exit, it indicates userspace needs to do the memory conversion on the RAMBlock to turn the memory into desired attribute, i.e., private

Re: Problem with migration/rdma

2024-03-06 Thread Zhijian Li (Fujitsu)
Yu, On 07/03/2024 00:30, Philippe Mathieu-Daudé wrote: > Cc'ing RDMA migration reviewers/maintainers: > > $ ./scripts/get_maintainer.pl -f migration/rdma.c > Li Zhijian (reviewer:RDMA Migration) > Peter Xu (maintainer:Migration) > Fabiano Rosas (maintainer:Migration) >

[PATCH V2 0/1] target/loongarch: Fixed tlb huge page loading issue

2024-03-04 Thread Xianglai Li
mat and Enrich the commit mesg description Cc: maob...@loongson.cn Cc: Song Gao Cc: Xiaojuan Yang Cc: zhaotian...@loongson.cn Xianglai Li (1): target/loongarch: Fixed tlb huge page loading issue target/loongarch/cpu.h| 1 + target/loongarch/tcg/tlb_helper.c |

[PATCH V2 1/1] target/loongarch: Fixed tlb huge page loading issue

2024-03-04 Thread Xianglai Li
interface normally. The lddir and ldpte instruction emulation has a problem with the use of super large page processing above level 2. The page size is not correctly calculated, resulting in the wrong page size of the table entry found by tlb. Signed-off-by: Xianglai Li Cc: maob...@loongson.cn Cc

Re: [PATCH 1/1] kvm: add support for guest physical bits

2024-03-04 Thread Xiaoyao Li
On 3/4/2024 10:58 PM, Gerd Hoffmann wrote: On Mon, Mar 04, 2024 at 09:54:40AM +0800, Xiaoyao Li wrote: On 3/1/2024 6:17 PM, Gerd Hoffmann wrote: query kvm for supported guest physical address bits using KVM_CAP_VM_GPA_BITS. Expose the value to the guest via cpuid (leaf 0x8008, eax, bits

Re: [PATCH 1/1] kvm: add support for guest physical bits

2024-03-03 Thread Xiaoyao Li
On 3/1/2024 6:17 PM, Gerd Hoffmann wrote: query kvm for supported guest physical address bits using KVM_CAP_VM_GPA_BITS. Expose the value to the guest via cpuid (leaf 0x8008, eax, bits 16-23). Signed-off-by: Gerd Hoffmann --- target/i386/cpu.h | 1 + target/i386/cpu.c | 1 +

Re: [PATCH v5 30/65] i386/tdx: Support user configurable mrconfigid/mrowner/mrownerconfig

2024-02-29 Thread Xiaoyao Li
On 2/29/2024 9:25 PM, Markus Armbruster wrote: Xiaoyao Li writes: On 2/29/2024 4:37 PM, Markus Armbruster wrote: Xiaoyao Li writes: From: Isaku Yamahata Three sha384 hash values, mrconfigid, mrowner and mrownerconfig, of a TD can be provided for TDX attestation. Detailed meaning of them

Re: [PATCH v5 49/65] i386/tdx: handle TDG.VP.VMCALL

2024-02-29 Thread Xiaoyao Li
On 2/29/2024 4:40 PM, Markus Armbruster wrote: Xiaoyao Li writes: From: Isaku Yamahata Add property "quote-generation-socket" to tdx-guest, which is a property of type SocketAddress to specify Quote Generation Service(QGS). On request of GetQuote, it connects to the QGS so

Re: [PATCH v5 30/65] i386/tdx: Support user configurable mrconfigid/mrowner/mrownerconfig

2024-02-29 Thread Xiaoyao Li
On 2/29/2024 4:37 PM, Markus Armbruster wrote: Xiaoyao Li writes: 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

[PATCH v5 39/65] i386/tdx: Skip BIOS shadowing setup

2024-02-28 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 v5 40/65] i386/tdx: Don't initialize pc.rom for TDX VMs

2024-02-28 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 v5 52/65] i386/tdx: Wire TDX_REPORT_FATAL_ERROR with GuestPanic facility

2024-02-28 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 v5: - mention additional error information in gpa when it presents; - refine the documentation; (Markus) Changes in v4: - refine the documentation

[PATCH v5 32/65] i386/tdx: Set kvm_readonly_mem_enabled to false for TDX VM

2024-02-28 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 v5 65/65] docs: Add TDX documentation

2024-02-28 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 v5: - Add TD attestation section and update the QEMU parameter; Changes since v1: - Add prerequisite of private gmem; - update example command to launch TD

[PATCH v5 28/65] i386/tdx: Disable pmu for TD guest

2024-02-28 Thread Xiaoyao Li
Current KVM doesn't support PMU for TD guest. It returns error if TD is created with PMU bit being set in attributes. Disable PMU for TD guest on QEMU side. Signed-off-by: Xiaoyao Li --- target/i386/kvm/tdx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/i386/kvm/tdx.c b/target

[PATCH v5 34/65] kvm/tdx: Ignore memory conversion to shared of unassigned region

2024-02-28 Thread Xiaoyao Li
conversion request of non-assigned region to shared and return success. Otherwise OVMF is confused and panics there. Signed-off-by: Isaku Yamahata Signed-off-by: Xiaoyao Li --- accel/kvm/kvm-all.c | 12 1 file changed, 12 insertions(+) diff --git a/accel/kvm/kvm-all.c b/accel/kvm

[PATCH v5 29/65] i386/tdx: Validate TD attributes

2024-02-28 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 v5 35/65] memory: Introduce memory_region_init_ram_guest_memfd()

2024-02-28 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 --- Changes in v5: - drop memory_region_set_default_private() because this function

[PATCH v5 06/65] kvm: Introduce support for memory_attributes

2024-02-28 Thread Xiaoyao Li
memory. Signed-off-by: Xiaoyao Li --- Changes in v4: - move the check of kvm_supported_memory_attributes to the common kvm_set_memory_attributes(); (Wang Wei) - change warn_report() to error_report() in kvm_set_memory_attributes() and drop the __func__; (Daniel) --- accel/kvm/kvm-all.c | 44

[PATCH v5 30/65] i386/tdx: Support user configurable mrconfigid/mrowner/mrownerconfig

2024-02-28 Thread Xiaoyao Li
=ASNFZ4mrze8BI0VniavN7wEjRWeJq83vASNFZ4mrze8BI0VniavN7wEjRWeJq83v Signed-off-by: Isaku Yamahata Co-developed-by: Xiaoyao Li Signed-off-by: Xiaoyao Li --- Changes in v5: - refine the description of QAPI properties and add description of default value when not specified; Changes in v4: - describe more

[PATCH v5 51/65] i386/tdx: Handle TDG.VP.VMCALL

2024-02-28 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 | 39 +++ target/i386/kvm/tdx.h | 1

[PATCH v5 59/65] hw/i386: add eoi_intercept_unsupported member to X86MachineState

2024-02-28 Thread Xiaoyao Li
. Signed-off-by: Xiaoyao Li Acked-by: Gerd Hoffmann --- hw/i386/x86.c | 1 + include/hw/i386/x86.h | 1 + target/i386/kvm/tdx.c | 2 ++ 3 files changed, 4 insertions(+) diff --git a/hw/i386/x86.c b/hw/i386/x86.c index 61c45dfc14dd..6ff2475535bc 100644 --- a/hw/i386/x86.c +++ b/hw/i386

[PATCH v5 18/65] i386/tdx: Make Intel-PT unsupported for TD guest

2024-02-28 Thread Xiaoyao Li
Intel-PT unsupported for TD guest, to avoid the confusing warning. [1] https://lore.kernel.org/qemu-devel/20230531084311.3807277-1-xiaoyao...@intel.com/ Signed-off-by: Xiaoyao Li --- Changes in v4: - newly added patch; --- target/i386/kvm/tdx.c | 5 + 1 file changed, 5 insertions(+) diff

[PATCH v5 17/65] i386/tdx: Adjust the supported CPUID based on TDX restrictions

2024-02-28 Thread Xiaoyao Li
evious step); - add configurable bits (it covers the other part of type #1); - fix the ones in vmm_fixup; (Calculated type is ignored since it's determined at runtime). Co-developed-by: Chenyi Qiang Signed-off-by: Chenyi Qiang Signed-off-by: Xiaoyao Li --- target/i386/cpu.h | 16 +++ t

[PATCH v5 22/65] i386/kvm: Move architectural CPUID leaf generation to separate helper

2024-02-28 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 v5 53/65] pci-host/q35: Move PAM initialization above SMRAM initialization

2024-02-28 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 v5 50/65] i386/tdx: handle TDG.VP.VMCALL hypercall

2024-02-28 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 v5 55/65] i386/tdx: Disable SMM for TDX VMs

2024-02-28 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 v5 47/65] i386/tdx: Finalize TDX VM

2024-02-28 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

[PATCH v5 37/65] i386/tdvf: Introduce function to parse TDVF metadata

2024-02-28 Thread Xiaoyao Li
that is the offset of TDX metadata to the end of firmware file. Select X86_FW_OVMF when TDX is enable to leverage existing functions to parse and search OVMF's GUID-ed structures. Signed-off-by: Isaku Yamahata Co-developed-by: Xiaoyao Li Signed-off-by: Xiaoyao Li Acked-by: Gerd Hoffmann --- Changes

[PATCH v5 19/65] i386/tdx: Update tdx_cpuid_lookup[].tdx_fixed0/1 by tdx_caps.cpuid_config[]

2024-02-28 Thread Xiaoyao Li
fields by removing the bits that reported from TDX module as configurable. This can adapt with the updated TDX (module) automatically. Signed-off-by: Xiaoyao Li --- target/i386/kvm/tdx.c | 34 ++ 1 file changed, 34 insertions(+) diff --git a/target/i386/kvm/tdx.c

[PATCH v5 63/65] i386/tdx: Skip kvm_put_apicbase() for TDs

2024-02-28 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 d23f94b77257..31aed1c9aae0 100644 --- a/target/i386

[PATCH v5 24/65] i386/tdx: Initialize TDX before creating TD vcpus

2024-02-28 Thread Xiaoyao Li
may change the CPUID configuration when creating vCPUs, i.e. punts on refactoring QEMU to provide a stable CPUID config prior to kvm_arch_init(). Signed-off-by: Xiaoyao Li Acked-by: Gerd Hoffmann Acked-by: Markus Armbruster --- Changes in v4: - mark init_vm with g_autofree() and use

[PATCH v5 46/65] i386/tdx: Call KVM_TDX_INIT_VCPU to initialize TDX vcpu

2024-02-28 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

[PATCH v5 33/65] kvm/tdx: Don't complain when converting vMMIO region to shared

2024-02-28 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 | 19 --- 1 file changed

[PATCH v5 49/65] i386/tdx: handle TDG.VP.VMCALL

2024-02-28 Thread Xiaoyao Li
GS. 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. Signed-off-by: Isaku Yamahata Codeveloped-by: Chenyi Qiang Signed-off-by

[PATCH v5 62/65] i386/tdx: Only configure MSR_IA32_UCODE_REV in kvm_init_msrs() for TDs

2024-02-28 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 v5 64/65] i386/tdx: Don't get/put guest state for TDX VMs

2024-02-28 Thread Xiaoyao Li
Christopherson Signed-off-by: Xiaoyao Li Acked-by: Gerd Hoffmann --- target/i386/kvm/kvm.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index 31aed1c9aae0..39113718ea14 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c

[PATCH v5 44/65] i386/tdx: Setup the TD HOB list

2024-02-28 Thread Xiaoyao Li
-by: Isaku Yamahata Co-developed-by: Sean Christopherson Signed-off-by: Sean Christopherson Signed-off-by: Xiaoyao Li Acked-by: Gerd Hoffmann --- Changes in v1: - drop the code of adding mmio resources since OVMF prepares all the MMIO hob itself. --- hw/i386/meson.build | 2 +- hw

[PATCH v5 61/65] i386/tdx: Don't synchronize guest tsc for TDs

2024-02-28 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 v5 41/65] i386/tdx: Track mem_ptr for each firmware entry of TDVF

2024-02-28 Thread Xiaoyao Li
to do the stuff. Signed-off-by: Xiaoyao Li Acked-by: Gerd Hoffmann --- hw/i386/tdvf.c | 1 + include/hw/i386/tdvf.h | 7 +++ target/i386/kvm/tdx.c | 31 +++ 3 files changed, 39 insertions(+) diff --git a/hw/i386/tdvf.c b/hw/i386/tdvf.c index ff51f40088f0

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

2024-02-28 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

[PATCH v5 56/65] i386/tdx: Disable PIC for TDX VMs

2024-02-28 Thread Xiaoyao Li
and error out if user wants PIC. 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/target/i386/kvm/tdx.c index c3fadbc5c58e..0225a9b79b36 100644 --- a/target/i386/kvm/tdx.c +++ b/target/i386/kvm

[PATCH v5 57/65] i386/tdx: Don't allow system reset for TDX VMs

2024-02-28 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 2748086231d5..b1b0384b0c5c

[PATCH v5 43/65] headers: Add definitions from UEFI spec for volumes, resources, etc...

2024-02-28 Thread Xiaoyao Li
.pdf Signed-off-by: Xiaoyao Li Acked-by: Gerd Hoffmann --- include/standard-headers/uefi/uefi.h | 198 +++ 1 file changed, 198 insertions(+) create mode 100644 include/standard-headers/uefi/uefi.h diff --git a/include/standard-headers/uefi/uefi.h b/include/standard

[PATCH v5 45/65] i386/tdx: Populate TDVF private memory via KVM_MEMORY_MAPPING

2024-02-28 Thread Xiaoyao Li
, the original image located in shared ramblock can be discarded. Signed-off-by: Isaku Yamahata Signed-off-by: Xiaoyao Li Acked-by: Gerd Hoffmann --- Changes in v1: - rename variable @metadata to @flags --- target/i386/kvm/tdx.c | 47 +++ 1 file changed

[PATCH v5 31/65] i386/tdx: Implement user specified tsc frequency

2024-02-28 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

[PATCH v5 48/65] i386/tdx: handle TDG.VP.VMCALL

2024-02-28 Thread Xiaoyao Li
-by: Xiaoyao Li --- target/i386/kvm/kvm.c | 8 ++ target/i386/kvm/tdx-stub.c | 5 target/i386/kvm/tdx.c | 53 ++ target/i386/kvm/tdx.h | 14 ++ 4 files changed, 80 insertions(+) diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c

[PATCH v5 42/65] i386/tdx: Track RAM entries for TDX VM

2024-02-28 Thread Xiaoyao Li
TD runs and no need to be accepted runtime. The TdxRamEntries[] are later used to setup the memory TD resource HOB that passes memory info from QEMU to TDVF. Signed-off-by: Xiaoyao Li Acked-by: Gerd Hoffmann --- Changes in v3: - use enum TdxRamType in struct TdxRamEntry; (Isaku) - Fix

[PATCH v5 58/65] i386/tdx: LMCE is not supported for TDX

2024-02-28 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 v5 54/65] q35: Introduce smm_ranges property for q35-pci-host

2024-02-28 Thread Xiaoyao Li
Signed-off-by: Sean Christopherson Signed-off-by: Xiaoyao Li --- hw/i386/pc_q35.c | 2 ++ hw/pci-host/q35.c | 42 +++ include/hw/i386/pc.h | 1 + include/hw/pci-host/q35.h | 1 + 4 files changed, 33 insertions(+), 13 deletions

<    1   2   3   4   5   6   7   8   9   10   >