Re: [PATCH RESEND v4 23/23] KVM: x86: smm: preserve interrupt shadow in SMRAM

From: Maxim Levitsky
Date: Sun Oct 30 2022 - 04:24:48 EST


On Fri, 2022-10-28 at 12:35 +0200, Paolo Bonzini wrote:
> On 10/25/22 14:47, Maxim Levitsky wrote:
> > @@ -19,7 +19,8 @@ struct kvm_smram_state_32 {
> >         u32 reserved1[62];
> >         u32 smbase;
> >         u32 smm_revision;
> > -       u32 reserved2[5];
> > +       u32 reserved2[4];
> > +       u32 int_shadow; /* KVM extension */
> >         u32 cr4; /* CR4 is not present in Intel/AMD SMRAM image */
> >         u32 reserved3[5];
>
> Of course the placement of KVM-specific fields is somewhat arbitrary,
> but based on sandpile.org data I would place it at 0xFF1A ("reserved",
> you have to search for 7F1Ah in the web page).
>
> > @@ -86,7 +87,7 @@ struct kvm_smram_state_64 {
> >         u64 io_restart_rsi;
> >         u64 io_restart_rdi;
> >         u32 io_restart_dword;
> > -       u32 reserved1;
> > +       u32 int_shadow;
> >         u8 io_inst_restart;
> >         u8 auto_hlt_restart;
> >         u8 reserved2[6];
>
> Likewise, based on AMD BKDG I would place this at 0xFECB after the "NMI
> Mask" field (which unfortunately I learnt about only after "inventing"
> HF_SMM_INSIDE_NMI_MASK).

I don't see any problem with this, makes sense.

I wish AMD would keep on releaseing the BKDG - I haven't looked there
because last public version is very old.


Thanks!
Best regards,
Maxim Levitsky

>
> I can do the changes myself, but please ack.
>
> Paolo
>