Re: [PATCH v3 3/8] x86/psp: Register PSP platform device when ASP table is present

From: Jeremi Piotrowski
Date: Mon Mar 20 2023 - 16:18:41 EST


On 20/03/2023 21:03, Borislav Petkov wrote:
> On Mon, Mar 20, 2023 at 08:37:56PM +0100, Jeremi Piotrowski wrote:
>> Because of patch 4. My thinking was that the irq setup requires poking
>> at intimate architectural details (init_irq_alloc_info etc.) so it seems
>> like it fits in arch/x86.
>
> arch/x86/platform/uv/uv_irq.c:193: init_irq_alloc_info(&info, cpumask_of(cpu));
> drivers/iommu/amd/init.c:2391: init_irq_alloc_info(&info, NULL);
>
> Also, what patch 4's commit message says, sounds hacky to me. A simple
> driver should not need the x86_vector_domain. Especially if it is some
> ACPI wrapper around the PSP hw.

I agree with you here. The irq config of this thing requires specifying
passing a CPU vector, this follows the hardware spec which I linked in the
first 2 commits, pages 13-15 here:

https://www.amd.com/system/files/TechDocs/58028_1.00-PUB.pdf

The only way I found to get this to work was going through x86_vector_domain
or statically defining a system vector (the latter felt worse).

>
> But I'd leave that to tglx.
>>> I also drew inspiration from the sev-guest device in the arch/x86/kernel/sev.c,
>
> Yeah, we've designed another mess there considering we already have
>
> drivers/virt/coco/sev-guest/sev-guest.c
>
> That sev guest thing has no place in sev.c and it should go away from
> there.
>
>> which is used in a similar context (the PSP device I am registering here is
>> for SNP-host support).
>>
>> Would you prefer it in drivers/platform/x86?
>
> drivers/hv/?
>
> Seeing how hyperv is the only thing that's going to use it, AFAICT.
>

That could work, let me try that.