mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	KVM: VMX: use kvm_fast_pio_in for handling IN I/O
Fast emulation of processor I/O for IN was disabled on x86 (both VMX and SVM) some years ago due to a buggy implementation. The addition of kvm_fast_pio_in(), used by SVM, re-introduced (functional!) fast emulation of IN. Piggyback SVM's work and use kvm_fast_pio_in() on VMX instead of performing full emulation of IN. Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
		
							parent
							
								
									2bb8cafea8
								
							
						
					
					
						commit
						432baf60ee
					
				
					 1 changed files with 6 additions and 3 deletions
				
			
		| 
						 | 
					@ -6270,15 +6270,15 @@ static int handle_io(struct kvm_vcpu *vcpu)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	exit_qualification = vmcs_readl(EXIT_QUALIFICATION);
 | 
						exit_qualification = vmcs_readl(EXIT_QUALIFICATION);
 | 
				
			||||||
	string = (exit_qualification & 16) != 0;
 | 
						string = (exit_qualification & 16) != 0;
 | 
				
			||||||
	in = (exit_qualification & 8) != 0;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	++vcpu->stat.io_exits;
 | 
						++vcpu->stat.io_exits;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (string || in)
 | 
						if (string)
 | 
				
			||||||
		return emulate_instruction(vcpu, 0) == EMULATE_DONE;
 | 
							return emulate_instruction(vcpu, 0) == EMULATE_DONE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	port = exit_qualification >> 16;
 | 
						port = exit_qualification >> 16;
 | 
				
			||||||
	size = (exit_qualification & 7) + 1;
 | 
						size = (exit_qualification & 7) + 1;
 | 
				
			||||||
 | 
						in = (exit_qualification & 8) != 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ret = kvm_skip_emulated_instruction(vcpu);
 | 
						ret = kvm_skip_emulated_instruction(vcpu);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -6286,6 +6286,9 @@ static int handle_io(struct kvm_vcpu *vcpu)
 | 
				
			||||||
	 * TODO: we might be squashing a KVM_GUESTDBG_SINGLESTEP-triggered
 | 
						 * TODO: we might be squashing a KVM_GUESTDBG_SINGLESTEP-triggered
 | 
				
			||||||
	 * KVM_EXIT_DEBUG here.
 | 
						 * KVM_EXIT_DEBUG here.
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
 | 
						if (in)
 | 
				
			||||||
 | 
							return kvm_fast_pio_in(vcpu, size, port) && ret;
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
		return kvm_fast_pio_out(vcpu, size, port) && ret;
 | 
							return kvm_fast_pio_out(vcpu, size, port) && ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue