linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeremi Piotrowski <jpiotrowski@linux.microsoft.com>
To: Borislav Petkov <bp@alien8.de>, Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org,
	Brijesh Singh <brijesh.singh@amd.com>,
	Tom Lendacky <thomas.lendacky@amd.com>,
	"Kalra, Ashish" <ashish.kalra@amd.com>,
	linux-crypto@vger.kernel.org,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Len Brown <lenb@kernel.org>,
	linux-acpi@vger.kernel.org, Ingo Molnar <mingo@redhat.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org
Subject: Re: [PATCH v3 0/8] Support ACPI PSP on Hyper-V
Date: Fri, 24 Mar 2023 18:10:09 +0100	[thread overview]
Message-ID: <c8458bfa-0985-f6a5-52a3-ef96c7669fe6@linux.microsoft.com> (raw)
In-Reply-To: <20230323163450.GGZBx/qpnclFnMaf7e@fat_crate.local>

On 3/23/2023 5:34 PM, Borislav Petkov wrote:
> On Thu, Mar 23, 2023 at 05:11:26PM +0100, Jeremi Piotrowski wrote:
>> That same interface is exposed by physical hardware+firmware to the underlying
>> Hyper-V.
> 
> Let me see if I understand it correctly: Hyper-V *baremetal* is using
> the same ASPT spec to to talk to the *physical* PSP device?
> 

Yes

> Is that ASPT interface to talk to the PSP used by the L0 hypervisor?
> 

Yes (unless I am mistaken, this is the same statement as above).

> Or does the L0 HV have a normal driver, similar to the Linux one,
> without the functionality this ASPT spec provides?
> 
The L0 HV relies on the ASPT spec/interface to map registers and setup
interrupts and then uses a protocol driver to handle the PSP command set
(like the Linux one).

>> So it wasn't a matter of Microsoft architects coming up with a
>> guest-host interface but rather exposing the virtual hardware in the same
>> way as on a physical server.
> 
> So if you want to expose the same interface to the L1 guest, why isn't
> Hyper-V emulating an ACPI device just like any other functionality? Why
> does it need to reach into the interrupt handling internals?
> 

The primary stack for nested SNP support is Hyper-V-on-Hyper-V. 
By exposing the PSP device to the L1 guest in the same way (as the L0),
everything can done in the exact same way as on bare-metal.

I just really want nested SNP support to work in KVM-on-Hyper-V as well so
that's why I'm adding support for these things.

Also: if Linux were to run bare-metal on that hardware it would need to be
able to handle the PSP through the ASPT interface as well.

> I'd expect that the L0 HV would emulate a PSP device, the L1 would
> simply load the Linux PSP device driver and everything should just work.
> 
> What's the point of that alternate access at all?
> 

So it's actually great that you made me ask around because I learned something that
will help:

Since the AMD PSP is a privileged device, there is a desire to not have to trust the
ACPI stack, and instead rely fully on static ACPI tables for discovery and configuration.
This also applies to the AMD IOMMU. If you look at iommu_setup_intcapxt() in
drivers/iommu/amd/init.c, it does exactly the things that are needed to setup the
PSP interrupt too. Here's a link to the patch that added that:
https://lore.kernel.org/all/20201111144322.1659970-3-dwmw2@infradead.org/#t

So my plan now is to post a v4 with proper irq_domain handling.
Ok Thomas?

Best wishes,
Jeremi

  reply	other threads:[~2023-03-24 17:10 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-20 19:19 [PATCH v3 0/8] Support ACPI PSP on Hyper-V Jeremi Piotrowski
2023-03-20 19:19 ` [PATCH v3 1/8] include/acpi: add definition of ASPT table Jeremi Piotrowski
2023-03-20 19:19 ` [PATCH v3 2/8] ACPI: ASPT: Add helper to parse table Jeremi Piotrowski
2023-03-20 19:19 ` [PATCH v3 3/8] x86/psp: Register PSP platform device when ASP table is present Jeremi Piotrowski
2023-03-20 19:25   ` Borislav Petkov
2023-03-20 19:37     ` Jeremi Piotrowski
2023-03-20 20:03       ` Borislav Petkov
2023-03-20 20:18         ` Jeremi Piotrowski
2023-03-20 21:03           ` Borislav Petkov
2023-03-21 14:15             ` Jeremi Piotrowski
2023-03-20 19:19 ` [PATCH v3 4/8] x86/psp: Add IRQ support Jeremi Piotrowski
2023-03-21 10:31   ` Thomas Gleixner
2023-03-21 19:16     ` Jeremi Piotrowski
2023-03-22 10:07       ` Thomas Gleixner
2023-03-28 18:29         ` Jeremi Piotrowski
2023-03-20 19:19 ` [PATCH v3 5/8] crypto: cpp - Bind to psp platform device on x86 Jeremi Piotrowski
2023-03-20 19:19 ` [PATCH v3 6/8] crypto: ccp - Add vdata for platform device Jeremi Piotrowski
2023-03-20 19:19 ` [PATCH v3 7/8] crypto: ccp - Skip DMA coherency check for platform psp Jeremi Piotrowski
2023-03-20 19:19 ` [PATCH v3 8/8] crypto: ccp - Allow platform device to be psp master device Jeremi Piotrowski
2023-03-22 15:46 ` [PATCH v3 0/8] Support ACPI PSP on Hyper-V Borislav Petkov
2023-03-22 17:33   ` Jeremi Piotrowski
2023-03-22 18:15     ` Borislav Petkov
2023-03-23 14:46       ` Jeremi Piotrowski
2023-03-23 15:23         ` Borislav Petkov
2023-03-23 16:11           ` Jeremi Piotrowski
2023-03-23 16:34             ` Borislav Petkov
2023-03-24 17:10               ` Jeremi Piotrowski [this message]
2023-04-02 15:44                 ` Borislav Petkov
2023-04-03  6:20                   ` Thomas Gleixner
2023-04-05  7:56                     ` Jeremi Piotrowski
2023-04-11 15:10                       ` Jeremi Piotrowski
2023-04-13 21:53                       ` Thomas Gleixner
2023-04-05  8:10                     ` Jeremi Piotrowski
2023-04-05  8:50                   ` Jeremi Piotrowski

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=c8458bfa-0985-f6a5-52a3-ef96c7669fe6@linux.microsoft.com \
    --to=jpiotrowski@linux.microsoft.com \
    --cc=ashish.kalra@amd.com \
    --cc=bp@alien8.de \
    --cc=brijesh.singh@amd.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rafael@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=thomas.lendacky@amd.com \
    --cc=x86@kernel.org \
    /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).