lkml.org 
[lkml]   [2022]   [Jul]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 07/11] KVM: x86: emulator/smm: add structs for KVM's smram layout
On Tue, Jun 21, 2022, Maxim Levitsky wrote:
> Those structs will be used to read/write the smram state image.
>
> Also document the differences between KVM's SMRAM layout and SMRAM
> layout that is used by real Intel/AMD cpus.
>
> Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
> ---
> arch/x86/kvm/kvm_emulate.h | 139 +++++++++++++++++++++++++++++++++++++
> 1 file changed, 139 insertions(+)
>
> diff --git a/arch/x86/kvm/kvm_emulate.h b/arch/x86/kvm/kvm_emulate.h
> index 89246446d6aa9d..7015728da36d5f 100644
> --- a/arch/x86/kvm/kvm_emulate.h
> +++ b/arch/x86/kvm/kvm_emulate.h
> @@ -503,6 +503,145 @@ enum x86_intercept {
> nr_x86_intercepts
> };
>
> +
> +/*
> + * 32 bit KVM's emulated SMM layout
> + * Loosely based on Intel's layout
> + */
> +
> +struct kvm_smm_seg_state_32 {
> + u32 flags;
> + u32 limit;
> + u32 base;
> +} __packed;
> +
> +struct kvm_smram_state_32 {
> +
> + u32 reserved1[62]; /* FE00 - FEF7 */
> + u32 smbase; /* FEF8 */
> + u32 smm_revision; /* FEFC */
> + u32 reserved2[5]; /* FF00-FF13 */
> + /* CR4 is not present in Intel/AMD SMRAM image*/
> + u32 cr4; /* FF14 */
> + u32 reserved3[5]; /* FF18 */

Again, I love this approach, but we should have compile-time asserts to verify
the layout, e.g. see vmx_check_vmcs12_offsets().

\
 
 \ /
  Last update: 2022-07-21 02:42    [W:0.371 / U:0.484 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site