From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f202.google.com (mail-pg1-f202.google.com [209.85.215.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 325601C5499 for ; Tue, 30 Jun 2026 00:42:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782780128; cv=none; b=ICRpwiHImnR4LJ3VRstBhHxl6bhbtVP7kJPwuwnldlqwGUbdMyJchbcHccpsErEyeNhiZsRc8cEkgDwdwc+3NGVZPdJKpe7gQCDnOYGgRMn/kH6pcPpwt5hdhghs5mBSltY+8plqssgRHpZGNMiJQYrUy5Vw/zHFMnjNDkVMHGM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782780128; c=relaxed/simple; bh=cshAbN6D5LTzAQCSGrGvu9YTiIKTGytpePf2gXb3rXw=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=EincKxb1sAiiTH5BjHIevO6wmex+T8ZAYQEgjpSCrrTEocg4HB7t9TMGQo1K2x7brGtro/mLysxUbSMVfmRUQGzr+ahW7CWvizs3Ma4Q4T/aNJ5Yq2ecelkiTBey0cmSknpDbGgd9ye7v0MQze60noLx8OYM0AKEeIIud8h48c8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=lKUshsct; arc=none smtp.client-ip=209.85.215.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="lKUshsct" Received: by mail-pg1-f202.google.com with SMTP id 41be03b00d2f7-c88aab7c1fcso2018910a12.3 for ; Mon, 29 Jun 2026 17:42:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1782780125; x=1783384925; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=/Gh6LWY0rzUQKB9FLNPeE5dt4Ox2OdfcTUONU/T6FNY=; b=lKUshsctRuAaDyX1NUON6w0x3Wg1N8qrJPd1xpf6pjlxm1fprEEjaEDnCW5cVq/Iag pmO90Q32c7MR2B/bRGhyccwGBOFMhcXBuqTOFSZoLydcIITTwo3g7ggVFKEIkVCG2Nvi K3Pxw1c/UvVwhZD+MBVISXTG7a8+1zIabaOTjx8zX8qgiGrhtpVjjKFib5K24WdHP3q6 tCMh0FKbBEYLBI7Eghb0P0Tw7pdk2w7t1UGb4JqstdSIRRku47bQm/Dxy6o8wG1SlBAo KqCxu9/AfpTaKVGDt4AlOefGWkqgIqpYgGuBV2WYdgAuFc1BPIzqP2+LaqbDYJsN5Hkj Mq6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782780125; x=1783384925; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=/Gh6LWY0rzUQKB9FLNPeE5dt4Ox2OdfcTUONU/T6FNY=; b=TULHr8ixlAcV7zKmVQxMO2WMF5oahr/EZa39dynE/WutGVKYw+HKGEjFlB+RdTgJFC 8ZI7+rxj56UMy9fFEZqKQYzQYFmDxZEctRlq/E3VeizKrSfIjuaZ592RWFjuINon6JAJ MkKflEI3a2U6p6xJO9onB0yT0nbRdEiaueTjrGaue+GUn1dGoSDayGHavSvzVEBE9KeT tghp5btXFgr01ho3EelHJJAuWEUqD6yqheNaWqtoQ2xAeZywA/84nJBpYNfFlG6odOT2 LilrnLcNJLK7TvmYAErGdSYALolPOQAohLATrZY5mTohwxuTDkUkrCnmO5XcjO4RrIoV MxBg== X-Forwarded-Encrypted: i=1; AFNElJ90W4vVIDWgobkqDNteInnIyHKXJBSh17CEz4oraLacsAk4cggkjaMj5aQ7oAhB6hlG6OJzk1H4OpMAnI0=@vger.kernel.org X-Gm-Message-State: AOJu0Yx14bjpdB9712nLRj2As5MjIVa4pMq7M7LzlDO36ST1I5GRmGBD zS4gqgiU4XQDYhM9jvLV7Rx78XMH9iS8COlXoY+mkCJTSxHWwCjj2plNqwbh/gdDIsI6vrFDsRt XEb3DYg== X-Received: from pgge11.prod.google.com ([2002:a63:db0b:0:b0:c94:ebb:92dc]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6300:6713:b0:3bf:b3d5:ce2d with SMTP id adf61e73a8af0-3bfc50b8944mr1267082637.7.1782780125319; Mon, 29 Jun 2026 17:42:05 -0700 (PDT) Date: Mon, 29 Jun 2026 17:42:04 -0700 In-Reply-To: <20260629100301.GA1743876@pedri> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260618081355.3253581-1-yilun.xu@linux.intel.com> <20260618081355.3253581-17-yilun.xu@linux.intel.com> <20260629100301.GA1743876@pedri> Message-ID: Subject: Re: [PATCH v2 16/17] KVM: TDX: Add in-kernel Quote generation From: Sean Christopherson To: Peter Fang Cc: Xu Yilun , x86@kernel.org, kvm@vger.kernel.org, linux-coco@lists.linux.dev, linux-kernel@vger.kernel.org, djbw@kernel.org, kas@kernel.org, rick.p.edgecombe@intel.com, yilun.xu@intel.com, xiaoyao.li@intel.com, sohil.mehta@intel.com, adrian.hunter@intel.com, kishen.maloor@intel.com, tony.lindgren@linux.intel.com, baolu.lu@linux.intel.com, zhenzhong.duan@intel.com, dave.hansen@intel.com, dave.hansen@linux.intel.com Content-Type: text/plain; charset="us-ascii" On Mon, Jun 29, 2026, Peter Fang wrote: > On Thu, Jun 25, 2026 at 11:01:58AM -0700, Sean Christopherson wrote: > > On Thu, Jun 18, 2026, Xu Yilun wrote: > > > From: Peter Fang > > > > > > Provide an in-kernel path for Quote generation when handling > > > TDG.VP.VMCALL, without requiring an exit to userspace. > > > > Why? > > > > Hi Sean, > > This is mainly to avoid a round trip to userspace for the GetQuote flow. Again, why? > New TDX modules can now get a Quote directly via an "extension SEAMCALL" > instead of exiting to userspace and using an SGX enclave. Exiting to > userspace for GetQuote no longer seems worth the overhead/complexity. I dunno, from a kernel perspective, this is more complexity, not less: Documentation/arch/x86/tdx.rst | 19 ++--- Documentation/virt/kvm/api.rst | 3 + arch/x86/include/asm/tdx.h | 9 +++ arch/x86/kvm/vmx/tdx.h | 6 ++ arch/x86/kvm/vmx/tdx.c | 135 ++++++++++++++++++++++++++++++++- virt/kvm/kvm_main.c | 1 + 6 files changed, 163 insertions(+), 10 deletions(-) > The first half of the series enables extension SEAMCALLs. They implement > simple APIs for higher-order security protocols that would otherwise need > to be broken into smaller routines. For Quoting, this allows KVM to get > a Quote directly through TDH.QUOTE.GET. The TDX module needs only the > input data from TDG.VP.VMCALL for that call. Answering my own question (though probably poorly), IIUC the answer is that DICE-based quoting is done through the TDX Module, whereas existing quoting is done through an SGX enclave and so was routed through userspace. If that's all there is too this, then why is KVM involved? I.e. why doesn't the TDX Module provide the quote directly to the guest?