linux-coco.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: James Bottomley <jejb@linux.ibm.com>
To: Jeremi Piotrowski <jpiotrowski@linux.microsoft.com>,
	"Yao, Jiewen" <jiewen.yao@intel.com>,
	"linux-coco@lists.linux.dev" <linux-coco@lists.linux.dev>
Cc: Claudio Siqueira de Carvalho <cclaudio@ibm.com>,
	Joerg Roedel <jroedel@suse.com>,
	"Lange, Jon" <jlange@microsoft.com>,
	"Dong, Eddie" <eddie.dong@intel.com>,
	"Johnson, Simon P" <simon.p.johnson@intel.com>,
	"Reshetova, Elena" <elena.reshetova@intel.com>,
	"Nakajima, Jun" <jun.nakajima@intel.com>
Subject: Re: question on vTPM interface in coconut-svsm
Date: Thu, 28 Mar 2024 09:54:49 -0400	[thread overview]
Message-ID: <900e624ab5ff2ad8c1a69662450b42a442baa828.camel@linux.ibm.com> (raw)
In-Reply-To: <a8536552-c523-47ab-84e6-b2a1210bd366@linux.microsoft.com>

On Thu, 2024-03-28 at 14:41 +0100, Jeremi Piotrowski wrote:
> On 28/03/2024 13:33, James Bottomley wrote:
> > On Thu, 2024-03-28 at 13:22 +0100, Jeremi Piotrowski wrote:
> > [...]
> > > Azure ships the configuration described above for SEV-SNP (and
> > > TDX).
> > > The TPM is implemented in an "SVSM"(paravisor), exposed through
> > > TPM
> > > CRB MMIO. The kernel has a callback informing ioremap which MMIO
> > > addresses should be considered shared/private [1]. This is the
> > > Hyper-
> > > v implementation of that callback: [2].
> > > 
> > > So it can work if you detect it like this:
> > > 
> > > if (SEV_SNP_GUEST && SVSM_PRESENT && SVSM_PROVIDES_VTPM)
> > >    // vtpm should be mapped private
> > 
> > Well, yes, it's pretty much identical to the detection mechanism
> > used
> > to activate the platform TPM driver:
> > 
> > https://lore.kernel.org/all/83bcfc398d885f9e42d5aae42359fe02ab12d306.camel@linux.ibm.com/
> > 
> > The SVSM_PROVIDES_VTPM is actually a dynamic probe to find the vTPM
> > protocol inside the SVSM.
> > 
> > So what's the mechanism hyper-v uses to start a CRB command?
> > 
> > James
> > 
> 
> Do you mean start method? The VTPM uses ACPI_TPM2_COMMAND_BUFFER, the
> guest sees a TPM2 ACPI table, maps the control address as private and
> then the tpm_crb driver just works.

Not without help.  The usual method of starting a CRB command is to
write the command buffer and length into the CRB registers and then set
the start bit (a real CRB device monitors the control area).  Since
they're all in the same page, you can emulate what a real device does
by unmapping this area in the guest kernel and getting the SVSM to
intercept the writes, in which case you see a lot to fix up and quite a
number of VMEXITs per command, or you can ignore this region and use
some type of ASL start mechanism instead, which means only one VMEXIT.
What does hyper-v do?

James


  reply	other threads:[~2024-03-28 13:54 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <MW4PR11MB5872CE9BEF8361203F72EDFD8C3B2@MW4PR11MB5872.namprd11.prod.outlook.com>
2024-03-28  6:29 ` question on vTPM interface in coconut-svsm Yao, Jiewen
2024-03-28  8:11   ` Reshetova, Elena
2024-03-28  9:11     ` Joerg Roedel
2024-03-28 12:03   ` James Bottomley
2024-03-28 12:22     ` Jeremi Piotrowski
2024-03-28 12:33       ` James Bottomley
2024-03-28 13:41         ` Jeremi Piotrowski
2024-03-28 13:54           ` James Bottomley [this message]
2024-03-28 14:09             ` Jeremi Piotrowski
2024-07-04  3:07             ` Coconut-SVSM - vTPM support for Intel TD Partitioning Yao, Jiewen
2024-08-01 22:38               ` Yao, Jiewen
2024-08-02  5:23                 ` Dionna Amalie Glaze
2024-08-02 10:02                   ` Yao, Jiewen
2024-08-02 12:27                 ` James Bottomley
2024-08-02 15:40                 ` James Bottomley
2024-08-03  1:54                   ` Dionna Amalie Glaze
2024-08-03  2:19                     ` James Bottomley
2024-08-05  9:55                       ` Reshetova, Elena
2024-08-05 15:21                         ` James Bottomley
2024-08-06  8:21                           ` Reshetova, Elena
2024-08-06 15:51                             ` Claudio Siqueira de Carvalho
2024-08-06 16:23                               ` James Bottomley
2024-08-07 11:28                                 ` Reshetova, Elena
2024-08-07 12:21                                   ` James Bottomley
2024-08-07 16:04                                     ` Reshetova, Elena
2024-08-16  3:38                                       ` Yao, Jiewen
2024-08-16 16:13                                         ` Dionna Amalie Glaze
2024-08-19  5:54                                           ` Yao, Jiewen
2024-08-06 16:19                             ` James Bottomley
2024-08-07  8:46                               ` Reshetova, Elena
2024-08-16  3:09                                 ` Yao, Jiewen
2024-08-16  3:27                   ` Yao, Jiewen
2024-04-08  8:50   ` question on vTPM interface in coconut-svsm Joerg Roedel
2024-04-08 15:05     ` Yao, Jiewen

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=900e624ab5ff2ad8c1a69662450b42a442baa828.camel@linux.ibm.com \
    --to=jejb@linux.ibm.com \
    --cc=cclaudio@ibm.com \
    --cc=eddie.dong@intel.com \
    --cc=elena.reshetova@intel.com \
    --cc=jiewen.yao@intel.com \
    --cc=jlange@microsoft.com \
    --cc=jpiotrowski@linux.microsoft.com \
    --cc=jroedel@suse.com \
    --cc=jun.nakajima@intel.com \
    --cc=linux-coco@lists.linux.dev \
    --cc=simon.p.johnson@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;
as well as URLs for NNTP newsgroup(s).