x86/tss: Fix and move VMX BUILD_BUG_ON()
authorThomas Gleixner <tglx@linutronix.de>
Mon, 11 Nov 2019 22:03:18 +0000 (23:03 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Sat, 16 Nov 2019 10:24:00 +0000 (11:24 +0100)
commit6b546e1c9ad2a25f874f8bc6077d0f55f9446414
tree86a938e9727f3cc7e5a8c8a135de3d70bc04b78d
parent505b789996f64bdbfcc5847dd4b5076fc7c50274
x86/tss: Fix and move VMX BUILD_BUG_ON()

The BUILD_BUG_ON(IO_BITMAP_OFFSET - 1 == 0x67) in the VMX code is bogus in
two aspects:

1) This wants to be in generic x86 code simply to catch issues even when
   VMX is disabled in Kconfig.

2) The IO_BITMAP_OFFSET is not the right thing to check because it makes
   asssumptions about the layout of tss_struct. Nothing requires that the
   I/O bitmap is placed right after x86_tss, which is the hardware mandated
   tss structure. It pointlessly makes restrictions on the struct
   tss_struct layout.

The proper thing to check is:

    - Offset of x86_tss in tss_struct is 0
    - Size of x86_tss == 0x68

Move it to the other build time TSS checks and make it do the right thing.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Andy Lutomirski <luto@kernel.org>
arch/x86/kvm/vmx/vmx.c
arch/x86/mm/cpu_entry_area.c