mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jeremi Piotrowski <jpiotrowski@linux.microsoft.com>
To: Thomas Gleixner <tglx@linutronix.de>, Borislav Petkov <bp@alien8.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: Wed, 5 Apr 2023 10:10:57 +0200	[thread overview]
Message-ID: <35f6b321-1668-2b62-cb47-3f3760be2e1d@linux.microsoft.com> (raw)
In-Reply-To: <877cutsczn.ffs@tglx>

On 4/3/2023 8:20 AM, Thomas Gleixner wrote:
> On Sun, Apr 02 2023 at 17:44, Borislav Petkov wrote:
>> On Fri, Mar 24, 2023 at 06:10:09PM +0100, Jeremi Piotrowski wrote:
>>> Since the AMD PSP is a privileged device, there is a desire to not have to trust the
>>> ACPI stack,
>>
>> And yet you do:
>>
>> +	err = acpi_parse_aspt(&res[0], &pdata);
>> +	if (err)
>> +		return err;
>>
>> You don't trust the ACPI stack, and yet you're parsing an ACPI table?!?!
>> You have to make up your mind here.

I gave you background on why Microsoft system designers like to use the ASPT on
*physical hardware* in our datacenters. It is because it allows them to setup a
highly privileged system component through an isolated ACPI table, without
needing to depend on the *rest of the ACPI stack* (other ACPI tables and/or the
ACPI interpreter). The same reason they use IVRS for AMD IOMMU.

I thought it might be good to write this down, as this shows that the ASPT is a
hardware interface that has *some* value. I don't think further discussion on
this point helps us make forward progress.

We're trying to adhere to a specification for a physical device when modeling
that same device in a virtual environment. Yes, this requires parsing an ACPI
table.

>> 
>> Btw, you still haven't answered my question about doing:
>>
>> 	devm_request_irq(dev, 9, ..)
>>
>> where 9 is the default ACPI interrupt.
>>
>> You can have some silly table tell you what to map or you can simply map
>> IRQ 9 and be done with it. In this second case you can *really* not
>> trust ACPI because you know which IRQ it is.
> 

So I originally thought I answered when i said "because we're trying to not
deviate from the hardware specification for the PSP". Interrupt configuration
is part of that specification.

But when I think about what you're suggesting, I can interpret it two ways:

1. Configure the PSP to raise the vector corresponding to ACPI IRQ 9.
This might work and would look similar to the first version I posted.
I'd fetch 'struct irq_cfg' for acpi_sci_irq, write the corresponding
APIC-ID/vector into the PSP, enable PSP interrupt generation and then
probe the "ccp" driver so that it can call "devm_request_irq(9)".
I assume this would also require registering an irq affinity notifier,
much like drivers/iommu/amd/init.c did before commit d1adcfbb520c.

2. Deviate from the hardware specification.
From reading acpi code (not at all an expert on this), that "9" does not
look like a static value to me, so it requires either:
a) passing a GSI number in an ACPI table
b) defining it as being the same interrupt as the SCI, which comes from
   the FADT table.
c) using the GPE mechanism of the ACPI SCI interrupt.

So I'd need to define a third way for the PSP to interrupt the OS, one that
would only be supported on Hyper-V. Work with our hypervisor and/or virtual
firmware teams to make sure that the PSP model supports generating the interrupt
in this way. Work with the Windows team to make Windows support it
(the same virtual hardware model/virtual firmware is used regardless of the OS).

I have no objection to doing "1." if it works. I don't see it as a big win over
using an irq_domain.

I don't think "2." is a reasonable thing to ask. We do regularly make suggestions
to hypervisor/firmware teams on how to make things better supported in Linux
without requiring hacks. But modelling a piece of hardware in a custom way to avoid
following hardware specs is questionable.

I also think that soon, when other people deploy more SEV-SNP hardware in their
datacenters, they will also want to rely on the ASPT for the reasons listed at the
top of the email, so we'll be adding support for it anyway.

Which way do you suggest we go Boris? I'm not attached to the code at all but I am
attached to adhering to hardware specifications. I can try to do "1." or stick with
the irq_domain approach that i posted.

Thanks,
Jeremi

  parent reply	other threads:[~2023-04-05  8:11 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-20 19:19 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
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 [this message]
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=35f6b321-1668-2b62-cb47-3f3760be2e1d@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

Powered by JetHome