Re: [RFC 04/14] x86/apic: Initialize APIC backing page for Secure AVIC
From: Borislav Petkov
Date: Sat Nov 09 2024 - 11:28:21 EST
On Fri, Nov 08, 2024 at 11:38:15PM +0530, Neeraj Upadhyay wrote:
> As sev_ghcb_msr_read() work with any msr and is not limited to reading
> x2apic msrs, I created a global sev function for it.
That can happen when the functionality is needed somewhere else too.
> Ok sure, I will leave generalizing this to future use cases (if/when they come up)
Yap.
> and provide a secure avic specific function here (will do the same for
> sev_ghcb_msr_write(), which comes later in this series).
>
> "x2avic" terminology is not used in guest code. As this function only has secure
> avic user, does secure_avic_ghcb_msr_read() work?
That or "savic_..."
> >> +enum lapic_lvt_entry {
> >
> > What's that enum for?
>
> It's used in init_backing_page()
Then use it properly:
diff --git a/arch/x86/kernel/apic/x2apic_savic.c b/arch/x86/kernel/apic/x2apic_savic.c
index 99151be4e173..1753c4a71b50 100644
--- a/arch/x86/kernel/apic/x2apic_savic.c
+++ b/arch/x86/kernel/apic/x2apic_savic.c
@@ -200,8 +200,8 @@ static void x2apic_savic_send_IPI_mask_allbutself(const struct cpumask *mask, in
static void init_backing_page(void *backing_page)
{
+ enum lapic_lvt_entry i;
u32 val;
- int i;
val = read_msr_from_hv(APIC_LVR);
set_reg(backing_page, APIC_LVR, val);
> >> + pr_err("Secure AVIC msr (%#llx) read returned error (%d)\n", msr, ret);
> >
> > Prepend "0x" to the format specifier.
> >
>
> Using '#' prepends "0x". Am I missing something here?
Let's use the common thing pls even if the alternate form works too:
$ git grep "\"%#" | wc -l
411
$ git grep "\"0x" | wc -l
112823
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette