public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Chenyi Qiang <chenyi.qiang@intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
	<linux-kernel@vger.kernel.org>, <kvm@vger.kernel.org>
Cc: <seanjc@google.com>, Yan Zhao <yan.y.zhao@intel.com>,
	Rick Edgecombe <rick.p.edgecombe@intel.com>,
	Zhiming Hu <zhiming.hu@intel.com>,
	"Isaku Yamahata" <isaku.yamahata@intel.com>
Subject: Re: [PATCH 33/33] KVM: TDX: Register TDX host key IDs to cgroup misc controller
Date: Fri, 28 Feb 2025 09:56:03 +0800	[thread overview]
Message-ID: <e86039e7-b3e5-4581-9701-06fcd0ebda20@intel.com> (raw)
In-Reply-To: <20250226181453.2311849-34-pbonzini@redhat.com>



On 2/27/2025 2:14 AM, Paolo Bonzini wrote:
> From: Zhiming Hu <zhiming.hu@intel.com>
> 
> TDX host key IDs (HKID) are limit resources in a machine, and the misc
> cgroup lets the machine owner track their usage and limits the possibility
> of abusing them outside the owner's control.
> 
> The cgroup v2 miscellaneous subsystem was introduced to control the
> resource of AMD SEV & SEV-ES ASIDs.  Likewise introduce HKIDs as a misc
> resource.
> 
> Signed-off-by: Zhiming Hu <zhiming.hu@intel.com>
> Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  arch/x86/include/asm/tdx.h  |  2 ++
>  arch/x86/kvm/vmx/tdx.c      | 14 ++++++++++++++
>  arch/x86/kvm/vmx/tdx.h      |  1 +
>  arch/x86/virt/vmx/tdx/tdx.c |  6 ++++++
>  include/linux/misc_cgroup.h |  4 ++++
>  kernel/cgroup/misc.c        |  4 ++++
>  6 files changed, 31 insertions(+)
> 
> diff --git a/arch/x86/include/asm/tdx.h b/arch/x86/include/asm/tdx.h
> index 52a21075c0a6..7dd71ca3eb57 100644
> --- a/arch/x86/include/asm/tdx.h
> +++ b/arch/x86/include/asm/tdx.h
> @@ -124,6 +124,7 @@ const char *tdx_dump_mce_info(struct mce *m);
>  const struct tdx_sys_info *tdx_get_sysinfo(void);
>  
>  int tdx_guest_keyid_alloc(void);
> +u32 tdx_get_nr_guest_keyids(void);
>  void tdx_guest_keyid_free(unsigned int keyid);
>  
>  struct tdx_td {
> @@ -179,6 +180,7 @@ u64 tdh_phymem_page_wbinvd_tdr(struct tdx_td *td);
>  static inline void tdx_init(void) { }
>  static inline int tdx_cpu_enable(void) { return -ENODEV; }
>  static inline int tdx_enable(void)  { return -ENODEV; }
> +static u32 tdx_get_nr_guest_keyids(void) { return 0; }

static inline ...

Otherwise will trigger build error when !TDX_HOST

>  static inline const char *tdx_dump_mce_info(struct mce *m) { return NULL; }
>  static inline const struct tdx_sys_info *tdx_get_sysinfo(void) { return NULL; }
>  #endif	/* CONFIG_INTEL_TDX_HOST */



      reply	other threads:[~2025-02-28  1:56 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-26 18:14 [PATCH v4 00/33] TDX initialization + vCPU/VM creation Paolo Bonzini
2025-02-26 18:14 ` [PATCH 01/33] KVM: x86: Free vCPUs before freeing VM state Paolo Bonzini
2025-02-26 18:14 ` [PATCH 02/33] KVM: x86: move vm_destroy callback at end of kvm_arch_destroy_vm Paolo Bonzini
2025-02-26 18:14 ` [PATCH 03/33] KVM: x86: Don't load/put vCPU when unloading its MMU during teardown Paolo Bonzini
2025-02-26 18:14 ` [PATCH 04/33] x86/virt/tdx: Add SEAMCALL wrappers for TDX KeyID management Paolo Bonzini
2025-02-26 18:14 ` [PATCH 05/33] x86/virt/tdx: Add SEAMCALL wrappers for TDX TD creation Paolo Bonzini
2025-02-26 18:14 ` [PATCH 06/33] x86/virt/tdx: Add SEAMCALL wrappers for TDX vCPU creation Paolo Bonzini
2025-02-26 18:14 ` [PATCH 07/33] x86/virt/tdx: Add SEAMCALL wrappers for TDX page cache management Paolo Bonzini
2025-03-03  0:22   ` Chenyi Qiang
2025-02-26 18:14 ` [PATCH 08/33] x86/virt/tdx: Add SEAMCALL wrappers for TDX VM/vCPU field access Paolo Bonzini
2025-02-26 18:14 ` [PATCH 09/33] x86/virt/tdx: Add SEAMCALL wrappers for TDX flush operations Paolo Bonzini
2025-02-26 18:14 ` [PATCH 10/33] x86/virt/tdx: allocate tdx_sys_info in static memory Paolo Bonzini
2025-02-26 18:14 ` [PATCH 11/33] x86/virt/tdx: Read essential global metadata for KVM Paolo Bonzini
2025-02-26 18:14 ` [PATCH 12/33] x86/virt/tdx: Add tdx_guest_keyid_alloc/free() to alloc and free TDX guest KeyID Paolo Bonzini
2025-02-26 18:14 ` [PATCH 13/33] KVM: Export hardware virtualization enabling/disabling functions Paolo Bonzini
2025-02-26 18:14 ` [PATCH 14/33] KVM: VMX: Refactor VMX module init/exit functions Paolo Bonzini
2025-02-26 18:14 ` [PATCH 15/33] KVM: VMX: Initialize TDX during KVM module load Paolo Bonzini
2025-02-26 18:14 ` [PATCH 16/33] KVM: TDX: Get TDX global information Paolo Bonzini
2025-02-26 18:14 ` [PATCH 17/33] KVM: TDX: Add placeholders for TDX VM/vCPU structures Paolo Bonzini
2025-02-26 18:14 ` [PATCH 18/33] KVM: TDX: Define TDX architectural definitions Paolo Bonzini
2025-02-26 18:14 ` [PATCH 19/33] KVM: TDX: Add TDX "architectural" error codes Paolo Bonzini
2025-02-26 18:14 ` [PATCH 20/33] KVM: TDX: Add helper functions to print TDX SEAMCALL error Paolo Bonzini
2025-02-26 18:14 ` [PATCH 21/33] KVM: TDX: Add place holder for TDX VM specific mem_enc_op ioctl Paolo Bonzini
2025-02-26 18:14 ` [PATCH 22/33] KVM: TDX: Get system-wide info about TDX module on initialization Paolo Bonzini
2025-02-26 18:14 ` [PATCH 23/33] KVM: TDX: create/destroy VM structure Paolo Bonzini
2025-06-25 15:46   ` Dave Hansen
2025-06-25 16:12     ` Sean Christopherson
2025-02-26 18:14 ` [PATCH 24/33] KVM: TDX: Support per-VM KVM_CAP_MAX_VCPUS extension check Paolo Bonzini
2025-02-26 18:14 ` [PATCH 25/33] KVM: x86: expose cpuid_entry2_find for TDX Paolo Bonzini
2025-02-26 22:03   ` Huang, Kai
2025-02-26 18:14 ` [PATCH 26/33] KVM: TDX: add ioctl to initialize VM with TDX specific parameters Paolo Bonzini
2025-02-26 18:14 ` [PATCH 27/33] KVM: TDX: Make pmu_intel.c ignore guest TD case Paolo Bonzini
2025-02-26 18:14 ` [PATCH 28/33] KVM: TDX: Don't offline the last cpu of one package when there's TDX guest Paolo Bonzini
2025-02-26 18:14 ` [PATCH 29/33] KVM: TDX: create/free TDX vcpu structure Paolo Bonzini
2025-02-26 18:14 ` [PATCH 30/33] KVM: TDX: Do TDX specific vcpu initialization Paolo Bonzini
2025-02-26 18:14 ` [PATCH 31/33] KVM: x86: Introduce KVM_TDX_GET_CPUID Paolo Bonzini
2025-02-26 18:14 ` [PATCH 32/33] KVM: x86/mmu: Taking guest pa into consideration when calculate tdp level Paolo Bonzini
2025-02-26 18:14 ` [PATCH 33/33] KVM: TDX: Register TDX host key IDs to cgroup misc controller Paolo Bonzini
2025-02-28  1:56   ` Chenyi Qiang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e86039e7-b3e5-4581-9701-06fcd0ebda20@intel.com \
    --to=chenyi.qiang@intel.com \
    --cc=isaku.yamahata@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=rick.p.edgecombe@intel.com \
    --cc=seanjc@google.com \
    --cc=yan.y.zhao@intel.com \
    --cc=zhiming.hu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox