* [PATCH] ARM: KVM: Handle loads from I/O addresses to PC
@ 2013-05-12 18:58 Christoffer Dall
2013-05-13 9:08 ` Marc Zyngier
2013-05-13 9:18 ` Catalin Marinas
0 siblings, 2 replies; 3+ messages in thread
From: Christoffer Dall @ 2013-05-12 18:58 UTC (permalink / raw)
To: linux-arm-kernel
If a VM does something like this:
ldr pc, [r0] @ r0 is an I/O address
Then simply let that value load into the PC on kvm_handle_mmio_return
overwriting the PC value set from kvm_skip_instr.
Signed-off-by: Christoffer Dall <cdall@cs.columbia.edu>
---
arch/arm/kvm/mmio.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/arch/arm/kvm/mmio.c b/arch/arm/kvm/mmio.c
index 72a12f2..b8e06b7 100644
--- a/arch/arm/kvm/mmio.c
+++ b/arch/arm/kvm/mmio.c
@@ -86,12 +86,6 @@ static int decode_hsr(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
sign_extend = kvm_vcpu_dabt_issext(vcpu);
rt = kvm_vcpu_dabt_get_rd(vcpu);
- if (kvm_vcpu_reg_is_pc(vcpu, rt)) {
- /* IO memory trying to read/write pc */
- kvm_inject_pabt(vcpu, kvm_vcpu_get_hfar(vcpu));
- return 1;
- }
-
mmio->is_write = is_write;
mmio->phys_addr = fault_ipa;
mmio->len = len;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH] ARM: KVM: Handle loads from I/O addresses to PC
2013-05-12 18:58 [PATCH] ARM: KVM: Handle loads from I/O addresses to PC Christoffer Dall
@ 2013-05-13 9:08 ` Marc Zyngier
2013-05-13 9:18 ` Catalin Marinas
1 sibling, 0 replies; 3+ messages in thread
From: Marc Zyngier @ 2013-05-13 9:08 UTC (permalink / raw)
To: linux-arm-kernel
On 12/05/13 19:58, Christoffer Dall wrote:
> If a VM does something like this:
>
> ldr pc, [r0] @ r0 is an I/O address
>
> Then simply let that value load into the PC on kvm_handle_mmio_return
> overwriting the PC value set from kvm_skip_instr.
>
> Signed-off-by: Christoffer Dall <cdall@cs.columbia.edu>
I've had a slightly more complete patch in my tree for a while (look at
bef0ef01ae75 on the kvm-arm64/kvm-3.10-rc0 branch).
> ---
> arch/arm/kvm/mmio.c | 6 ------
> 1 file changed, 6 deletions(-)
>
> diff --git a/arch/arm/kvm/mmio.c b/arch/arm/kvm/mmio.c
> index 72a12f2..b8e06b7 100644
> --- a/arch/arm/kvm/mmio.c
> +++ b/arch/arm/kvm/mmio.c
> @@ -86,12 +86,6 @@ static int decode_hsr(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
> sign_extend = kvm_vcpu_dabt_issext(vcpu);
> rt = kvm_vcpu_dabt_get_rd(vcpu);
>
> - if (kvm_vcpu_reg_is_pc(vcpu, rt)) {
> - /* IO memory trying to read/write pc */
> - kvm_inject_pabt(vcpu, kvm_vcpu_get_hfar(vcpu));
> - return 1;
> - }
> -
> mmio->is_write = is_write;
> mmio->phys_addr = fault_ipa;
> mmio->len = len;
>
Otherwise looks good to me.
M.
--
Jazz is not dead. It just smells funny...
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH] ARM: KVM: Handle loads from I/O addresses to PC
2013-05-12 18:58 [PATCH] ARM: KVM: Handle loads from I/O addresses to PC Christoffer Dall
2013-05-13 9:08 ` Marc Zyngier
@ 2013-05-13 9:18 ` Catalin Marinas
1 sibling, 0 replies; 3+ messages in thread
From: Catalin Marinas @ 2013-05-13 9:18 UTC (permalink / raw)
To: linux-arm-kernel
On Sun, May 12, 2013 at 07:58:55PM +0100, Christoffer Dall wrote:
> If a VM does something like this:
>
> ldr pc, [r0] @ r0 is an I/O address
>
> Then simply let that value load into the PC on kvm_handle_mmio_return
> overwriting the PC value set from kvm_skip_instr.
>
> Signed-off-by: Christoffer Dall <cdall@cs.columbia.edu>
> ---
> arch/arm/kvm/mmio.c | 6 ------
> 1 file changed, 6 deletions(-)
>
> diff --git a/arch/arm/kvm/mmio.c b/arch/arm/kvm/mmio.c
> index 72a12f2..b8e06b7 100644
> --- a/arch/arm/kvm/mmio.c
> +++ b/arch/arm/kvm/mmio.c
> @@ -86,12 +86,6 @@ static int decode_hsr(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
> sign_extend = kvm_vcpu_dabt_issext(vcpu);
> rt = kvm_vcpu_dabt_get_rd(vcpu);
>
> - if (kvm_vcpu_reg_is_pc(vcpu, rt)) {
> - /* IO memory trying to read/write pc */
> - kvm_inject_pabt(vcpu, kvm_vcpu_get_hfar(vcpu));
> - return 1;
I haven't checked Marc's patch yet but I would get rid of
kvm_vcpu_reg_is_pc() as well, that's the only place where it is used.
--
Catalin
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-05-13 9:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-12 18:58 [PATCH] ARM: KVM: Handle loads from I/O addresses to PC Christoffer Dall
2013-05-13 9:08 ` Marc Zyngier
2013-05-13 9:18 ` Catalin Marinas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox