Patch "KVM: x86: add read_phys to x86_emulate_ops" has been added to the 4.2-stable tree
Subsystems (3)
This is a note to let you know that I've just added the patch titled
KVM: x86: add read_phys to x86_emulate_ops
to the 4.2-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
kvm-x86-add-read_phys-to-x86_emulate_ops.patch
and it can be found in the queue-4.2 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
7a036a6f670f63b32c5ee126425f9109271ca13fMon Sep 17 00:00:00 2001
From: =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= <[email protected]>
Date: Fri, 30 Oct 2015 16:36:24 +0100
Subject: KVM: x86: add read_phys to x86_emulate_ops
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= <[email protected]>
commit 7a036a6f670f63b32c5ee126425f9109271ca13f upstream.
We want to read the physical memory when emulating RSM.
X86EMUL_IO_NEEDED is returned on all errors for consistency with other helpers.
--- arch/x86/include/asm/kvm_emulate.h | 10 ++++++++++ arch/x86/kvm/x86.c | 10 ++++++++++ 2 files changed, 20 insertions(+)
arch/x86/include/asm/kvm_emulate.h +10 -0
@@ -112,6 +112,16 @@ struct x86_emulate_ops { struct x86_exception *fault);/* +* read_phys: Read bytes of standard (non-emulated/special) memory. +* Used for descriptor reading. +* @addr: [IN ] Physical address from which to read. +* @val: [OUT] Value read from memory. +* @bytes: [IN ] Number of bytes to read from memory. +*/ +int (*read_phys)(struct x86_emulate_ctxt *ctxt,unsigned long addr, +void *val,unsigned int bytes); + +/* * write_std: Write bytes of standard (non-emulated/special) memory. * Used for descriptor writing. * @addr: [IN ] Linear address to which to write.
arch/x86/kvm/x86.c +10 -0
@@ -4260,6 +4260,15 @@ static int kvm_read_guest_virt_system(streturn kvm_read_guest_virt_helper (addr, val, bytes, vcpu,0 , exception); } +static int kvm_read_guest_phys_system (struct x86_emulate_ctxt *ctxt, +unsigned long addr,void *val,unsigned int bytes) +{ +struct kvm_vcpu *vcpu =emul_to_vcpu (ctxt); +int r =kvm_vcpu_read_guest (vcpu, addr, val, bytes); + +return r <0 ?X86EMUL_IO_NEEDED :X86EMUL_CONTINUE ; +} + int kvm_write_guest_virt_system(struct x86_emulate_ctxt *ctxt, gva_t addr, void *val, unsigned int bytes,
@@ -4995,6 +5004,7 @@ static const struct x86_emulate_ops emul .write_gpr = emulator_write_gpr, .read_std = kvm_read_guest_virt_system, .write_std = kvm_write_guest_virt_system, + .read_phys = kvm_read_guest_phys_system, .fetch = kvm_fetch_guest_virt, .read_emulated = emulator_read_emulated, .write_emulated = emulator_write_emulated,
Patches currently in stable-queue which might be from [email protected] are
queue-4.2/kvm-x86-set-kvm_req_event-when-updating-irr.patch queue-4.2/kvm-x86-handle-smbase-as-physical-address-in-rsm.patch queue-4.2/kvm-x86-allow-rsm-from-64-bit-mode.patch queue-4.2/kvm-x86-add-read_phys-to-x86_emulate_ops.patch