[AMD Official Use Only - General]
[AMD Official Use Only - General]
From: Dave Hansen <dave.hansen@xxxxxxxxx>
Sent: Wednesday, June 22, 2022 1:43 PM
To: Kalra, Ashish <Ashish.Kalra@xxxxxxx>; x86@xxxxxxxxxx <x86@xxxxxxxxxx>; linux-kernel@xxxxxxxxxxxxxxx <linux-kernel@xxxxxxxxxxxxxxx>; kvm@xxxxxxxxxxxxxxx <kvm@xxxxxxxxxxxxxxx>; linux-coco@xxxxxxxxxxxxxxx <linux-coco@xxxxxxxxxxxxxxx>; linux-mm@xxxxxxxxx <linux-mm@xxxxxxxxx>; linux-crypto@xxxxxxxxxxxxxxx <linux-crypto@xxxxxxxxxxxxxxx>
Cc: tglx@xxxxxxxxxxxxx <tglx@xxxxxxxxxxxxx>; mingo@xxxxxxxxxx <mingo@xxxxxxxxxx>; jroedel@xxxxxxx <jroedel@xxxxxxx>; Lendacky, Thomas <Thomas.Lendacky@xxxxxxx>; hpa@xxxxxxxxx <hpa@xxxxxxxxx>; ardb@xxxxxxxxxx <ardb@xxxxxxxxxx>; pbonzini@xxxxxxxxxx <pbonzini@xxxxxxxxxx>; seanjc@xxxxxxxxxx <seanjc@xxxxxxxxxx>; vkuznets@xxxxxxxxxx <vkuznets@xxxxxxxxxx>; jmattson@xxxxxxxxxx <jmattson@xxxxxxxxxx>; luto@xxxxxxxxxx <luto@xxxxxxxxxx>; dave.hansen@xxxxxxxxxxxxxxx <dave.hansen@xxxxxxxxxxxxxxx>; slp@xxxxxxxxxx <slp@xxxxxxxxxx>; pgonda@xxxxxxxxxx <pgonda@xxxxxxxxxx>; peterz@xxxxxxxxxxxxx <peterz@xxxxxxxxxxxxx>; srinivas.pandruvada@xxxxxxxxxxxxxxx <srinivas.pandruvada@xxxxxxxxxxxxxxx>; rientjes@xxxxxxxxxx <rientjes@xxxxxxxxxx>; dovmurik@xxxxxxxxxxxxx <dovmurik@xxxxxxxxxxxxx>; tobin@xxxxxxx <tobin@xxxxxxx>; bp@xxxxxxxxx <bp@xxxxxxxxx>; Roth, Michael <Michael.Roth@xxxxxxx>; vbabka@xxxxxxx <vbabka@xxxxxxx>; kirill@xxxxxxxxxxxxx <kirill@xxxxxxxxxxxxx>; ak@xxxxxxxxxxxxxxx <ak@xxxxxxxxxxxxxxx>; tony.luck@xxxxxxxxx <tony.luck@xxxxxxxxx>; marcorr@xxxxxxxxxx <marcorr@xxxxxxxxxx>; sathyanarayanan.kuppuswamy@xxxxxxxxxxxxxxx <sathyanarayanan.kuppuswamy@xxxxxxxxxxxxxxx>; alpergun@xxxxxxxxxx <alpergun@xxxxxxxxxx>; dgilbert@xxxxxxxxxx <dgilbert@xxxxxxxxxx>; jarkko@xxxxxxxxxx <jarkko@xxxxxxxxxx>
Subject: Re: [PATCH Part2 v6 05/49] x86/sev: Add RMP entry lookup helpers
Sent: Wednesday, June 22, 2022 1:43 PM
To: Kalra, Ashish <Ashish.Kalra@xxxxxxx>; x86@xxxxxxxxxx <x86@xxxxxxxxxx>; linux-kernel@xxxxxxxxxxxxxxx <linux-kernel@xxxxxxxxxxxxxxx>; kvm@xxxxxxxxxxxxxxx <kvm@xxxxxxxxxxxxxxx>; linux-coco@xxxxxxxxxxxxxxx <linux-coco@xxxxxxxxxxxxxxx>; linux-mm@xxxxxxxxx <linux-mm@xxxxxxxxx>; linux-crypto@xxxxxxxxxxxxxxx <linux-crypto@xxxxxxxxxxxxxxx>
Cc: tglx@xxxxxxxxxxxxx <tglx@xxxxxxxxxxxxx>; mingo@xxxxxxxxxx <mingo@xxxxxxxxxx>; jroedel@xxxxxxx <jroedel@xxxxxxx>; Lendacky, Thomas <Thomas.Lendacky@xxxxxxx>; hpa@xxxxxxxxx <hpa@xxxxxxxxx>; ardb@xxxxxxxxxx <ardb@xxxxxxxxxx>; pbonzini@xxxxxxxxxx <pbonzini@xxxxxxxxxx>; seanjc@xxxxxxxxxx <seanjc@xxxxxxxxxx>; vkuznets@xxxxxxxxxx <vkuznets@xxxxxxxxxx>; jmattson@xxxxxxxxxx <jmattson@xxxxxxxxxx>; luto@xxxxxxxxxx <luto@xxxxxxxxxx>; dave.hansen@xxxxxxxxxxxxxxx <dave.hansen@xxxxxxxxxxxxxxx>; slp@xxxxxxxxxx <slp@xxxxxxxxxx>; pgonda@xxxxxxxxxx <pgonda@xxxxxxxxxx>; peterz@xxxxxxxxxxxxx <peterz@xxxxxxxxxxxxx>; srinivas.pandruvada@xxxxxxxxxxxxxxx <srinivas.pandruvada@xxxxxxxxxxxxxxx>; rientjes@xxxxxxxxxx <rientjes@xxxxxxxxxx>; dovmurik@xxxxxxxxxxxxx <dovmurik@xxxxxxxxxxxxx>; tobin@xxxxxxx <tobin@xxxxxxx>; bp@xxxxxxxxx <bp@xxxxxxxxx>; Roth, Michael <Michael.Roth@xxxxxxx>; vbabka@xxxxxxx <vbabka@xxxxxxx>; kirill@xxxxxxxxxxxxx <kirill@xxxxxxxxxxxxx>; ak@xxxxxxxxxxxxxxx <ak@xxxxxxxxxxxxxxx>; tony.luck@xxxxxxxxx <tony.luck@xxxxxxxxx>; marcorr@xxxxxxxxxx <marcorr@xxxxxxxxxx>; sathyanarayanan.kuppuswamy@xxxxxxxxxxxxxxx <sathyanarayanan.kuppuswamy@xxxxxxxxxxxxxxx>; alpergun@xxxxxxxxxx <alpergun@xxxxxxxxxx>; dgilbert@xxxxxxxxxx <dgilbert@xxxxxxxxxx>; jarkko@xxxxxxxxxx <jarkko@xxxxxxxxxx>
Subject: Re: [PATCH Part2 v6 05/49] x86/sev: Add RMP entry lookup helpers
On 6/22/22 11:34, Kalra, Ashish wrote:
>> So, if the RMP entry format changes in future processors, how do we
>> make sure that the kernel does not try to use *this* code on those
>> processors?
> Functions snp_lookup_rmpentry() and dump_rmpentry() which rely on
> this structure definition will need to handle it accordingly.
>In other words, old kernels will break on new >hardware?
>I think that needs to be fixed. It should be as >simple as a
>model/family check, though. If someone (for >example) attempts to use
>SNP (and thus snp_lookup_rmpentry() and >dump_rmpentry()) code on a newer
>CPU, the kernel should refuse.
>> So, if the RMP entry format changes in future processors, how do we
>> make sure that the kernel does not try to use *this* code on those
>> processors?
> Functions snp_lookup_rmpentry() and dump_rmpentry() which rely on
> this structure definition will need to handle it accordingly.
>In other words, old kernels will break on new >hardware?
>I think that needs to be fixed. It should be as >simple as a
>model/family check, though. If someone (for >example) attempts to use
>SNP (and thus snp_lookup_rmpentry() and >dump_rmpentry()) code on a newer
>CPU, the kernel should refuse.
More specifically I am thinking of adding RMP entry field accessors so that they can do this cpu model/family check and return the correct field as per processor architecture.
Thanks,
Ashish