lkml.org 
[lkml]   [2019]   [Nov]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 04/13] KVM: x86: Refactor R/W page helper to take the emulation context
Date
Invert the vcpu->context derivation in emulator_read_write_onepage() in
preparation for dynamically allocating the emulation context.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
---
arch/x86/kvm/x86.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index c3992ed1568a..a0e87f13af82 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -5648,14 +5648,14 @@ static const struct read_write_emulator_ops write_emultor = {
static int emulator_read_write_onepage(unsigned long addr, void *val,
unsigned int bytes,
struct x86_exception *exception,
- struct kvm_vcpu *vcpu,
+ struct x86_emulate_ctxt *ctxt,
const struct read_write_emulator_ops *ops)
{
gpa_t gpa;
int handled, ret;
bool write = ops->write;
struct kvm_mmio_fragment *frag;
- struct x86_emulate_ctxt *ctxt = &vcpu->arch.emulate_ctxt;
+ struct kvm_vcpu *vcpu = emul_to_vcpu(ctxt);

/*
* If the exit was due to a NPF we may already have a GPA.
@@ -5719,7 +5719,7 @@ static int emulator_read_write(struct x86_emulate_ctxt *ctxt,

now = -addr & ~PAGE_MASK;
rc = emulator_read_write_onepage(addr, val, now, exception,
- vcpu, ops);
+ ctxt, ops);

if (rc != X86EMUL_CONTINUE)
return rc;
@@ -5731,7 +5731,7 @@ static int emulator_read_write(struct x86_emulate_ctxt *ctxt,
}

rc = emulator_read_write_onepage(addr, val, bytes, exception,
- vcpu, ops);
+ ctxt, ops);
if (rc != X86EMUL_CONTINUE)
return rc;

--
2.24.0
\
 
 \ /
  Last update: 2019-11-22 23:41    [W:0.061 / U:0.348 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site