Re: [RFC 01/14] x86/apic: Add new driver for Secure AVIC

From: Neeraj Upadhyay
Date: Thu Nov 21 2024 - 03:04:05 EST




On 11/21/2024 11:11 AM, Borislav Petkov wrote:
> On Thu, Nov 21, 2024 at 10:35:35AM +0530, Neeraj Upadhyay wrote:
>> APIC common code (arch/x86/kernel/apic/apic.c) and other parts of the
>> x86 code use X86_X2APIC config to enable x2apic related initialization
>> and functionality. So, dependency on X2APIC need to be there.
>
> Have you actually tried to remove the dependency and see how it looks?
>

No, I didn't try it previously, as based on checking the code below
is what I understand how the code is layered:

- Common x2APIC code in arch/x86/... initializes the x2APIC
architecture sequence and other parts of common x2apic initialization:

* Disable and enable x2apic (...kernel/apic/apic.c).
* max_apicid setting in (...kernel/apic/init.c)
* acpi_parse_x2apic() registration of APIC ID in early
topo maps (kernel/acpi/boot.c)
* Enable x2apic in startup code (...kernel/head_64.S).


- Each x2apic driver in arch/x86/kernel/apic provides callbacks for implementation
specific (x2apic_uv_x.c, apic_numachip.c) or a particular mode
specific (x2apic_phys.c, x2apic_cluster.c) functionality.

As SAVIC's guest APIC register accesses match x2avic (which uses x2APIC MSR
interface in guest), the x2apic common flow need to be executed in the
guest.


- Neeraj

> Thx.
>