Re: [PATCH v2] KVM: VMX: drop I/O permission bitmaps

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/12/2017 09:44, Quan Xu wrote:
> From: Quan Xu <quan.xu0@xxxxxxxxx>
> 
> Since KVM removes the only I/O port 0x80 bypass on Intel hosts,
> clear CPU_BASED_USE_IO_BITMAPS and set CPU_BASED_UNCOND_IO_EXITING
> bit. Then these I/O permission bitmaps are not used at all, so
> drop I/O permission bitmaps.
> 
> Signed-off-by: Jim Mattson <jmattson@xxxxxxxxxx>
> Signed-off-by: Radim Krčmář <rkrcmar@xxxxxxxxxx>
> Signed-off-by: Quan Xu <quan.xu0@xxxxxxxxx>
> ---
>  arch/x86/kvm/vmx.c |   15 +--------------
>  1 files changed, 1 insertions(+), 14 deletions(-)
> 
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index 2fd9a8c..41aaf5e 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -943,8 +943,6 @@ static bool nested_vmx_is_page_fault_vmexit(struct vmcs12 *vmcs12,
>  static DEFINE_PER_CPU(spinlock_t, blocked_vcpu_on_cpu_lock);
>  
>  enum {
> -	VMX_IO_BITMAP_A,
> -	VMX_IO_BITMAP_B,
>  	VMX_MSR_BITMAP_LEGACY,
>  	VMX_MSR_BITMAP_LONGMODE,
>  	VMX_MSR_BITMAP_LEGACY_X2APIC_APICV,
> @@ -958,8 +956,6 @@ enum {
>  
>  static unsigned long *vmx_bitmap[VMX_BITMAP_NR];
>  
> -#define vmx_io_bitmap_a                      (vmx_bitmap[VMX_IO_BITMAP_A])
> -#define vmx_io_bitmap_b                      (vmx_bitmap[VMX_IO_BITMAP_B])
>  #define vmx_msr_bitmap_legacy                (vmx_bitmap[VMX_MSR_BITMAP_LEGACY])
>  #define vmx_msr_bitmap_longmode              (vmx_bitmap[VMX_MSR_BITMAP_LONGMODE])
>  #define vmx_msr_bitmap_legacy_x2apic_apicv   (vmx_bitmap[VMX_MSR_BITMAP_LEGACY_X2APIC_APICV])
> @@ -3632,7 +3628,7 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf)
>  #endif
>  	      CPU_BASED_CR3_LOAD_EXITING |
>  	      CPU_BASED_CR3_STORE_EXITING |
> -	      CPU_BASED_USE_IO_BITMAPS |
> +	      CPU_BASED_UNCOND_IO_EXITING |
>  	      CPU_BASED_MOV_DR_EXITING |
>  	      CPU_BASED_USE_TSC_OFFSETING |
>  	      CPU_BASED_INVLPG_EXITING |
> @@ -5445,10 +5441,6 @@ static void vmx_vcpu_setup(struct vcpu_vmx *vmx)
>  #endif
>  	int i;
>  
> -	/* I/O */
> -	vmcs_write64(IO_BITMAP_A, __pa(vmx_io_bitmap_a));
> -	vmcs_write64(IO_BITMAP_B, __pa(vmx_io_bitmap_b));
> -
>  	if (enable_shadow_vmcs) {
>  		vmcs_write64(VMREAD_BITMAP, __pa(vmx_vmread_bitmap));
>  		vmcs_write64(VMWRITE_BITMAP, __pa(vmx_vmwrite_bitmap));
> @@ -6751,14 +6743,9 @@ static __init int hardware_setup(void)
>  			goto out;
>  	}
>  
> -	vmx_io_bitmap_b = (unsigned long *)__get_free_page(GFP_KERNEL);
>  	memset(vmx_vmread_bitmap, 0xff, PAGE_SIZE);
>  	memset(vmx_vmwrite_bitmap, 0xff, PAGE_SIZE);
>  
> -	memset(vmx_io_bitmap_a, 0xff, PAGE_SIZE);
> -
> -	memset(vmx_io_bitmap_b, 0xff, PAGE_SIZE);
> -
>  	memset(vmx_msr_bitmap_legacy, 0xff, PAGE_SIZE);
>  	memset(vmx_msr_bitmap_longmode, 0xff, PAGE_SIZE);
>  
> 

Squashing this for documentation:

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 51967236486e..b016cf1b9f77 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -10551,8 +10551,8 @@ static int prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12,
 	}
 
 	/*
-	 * Merging of IO bitmap not currently supported.
-	 * Rather, exit every time.
+	 * A vmexit (to either L1 hypervisor or L0 userspace) is always needed
+	 * for I/O port accesses.
 	 */
 	exec_control &= ~CPU_BASED_USE_IO_BITMAPS;
 	exec_control |= CPU_BASED_UNCOND_IO_EXITING;

Thanks,

Paolo



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux