KVM: x86 emulator: add get_cached_segment_base() callback to x86_emulate_ops
On VMX it is expensive to call get_cached_descriptor() just to get segment base since multiple vmcs_reads are done instead of only one. Introduce new call back get_cached_segment_base() for efficiency. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
This commit is contained in:
@ -3714,6 +3714,12 @@ static void emulator_get_gdt(struct desc_ptr *dt, struct kvm_vcpu *vcpu)
|
||||
kvm_x86_ops->get_gdt(vcpu, dt);
|
||||
}
|
||||
|
||||
static unsigned long emulator_get_cached_segment_base(int seg,
|
||||
struct kvm_vcpu *vcpu)
|
||||
{
|
||||
return get_segment_base(vcpu, seg);
|
||||
}
|
||||
|
||||
static bool emulator_get_cached_descriptor(struct desc_struct *desc, int seg,
|
||||
struct kvm_vcpu *vcpu)
|
||||
{
|
||||
@ -3804,6 +3810,7 @@ static struct x86_emulate_ops emulate_ops = {
|
||||
.set_cached_descriptor = emulator_set_cached_descriptor,
|
||||
.get_segment_selector = emulator_get_segment_selector,
|
||||
.set_segment_selector = emulator_set_segment_selector,
|
||||
.get_cached_segment_base = emulator_get_cached_segment_base,
|
||||
.get_gdt = emulator_get_gdt,
|
||||
.get_cr = emulator_get_cr,
|
||||
.set_cr = emulator_set_cr,
|
||||
|
Reference in New Issue
Block a user