From: marc.zyngier@arm.com (Marc Zyngier)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v6 13/15] KVM: ARM: Handle I/O aborts
Date: Thu, 17 Jan 2013 16:37:00 +0000 [thread overview]
Message-ID: <50F828AC.2050307@arm.com> (raw)
In-Reply-To: <20130116175911.29147.40578.stgit@ubuntu>
On 16/01/13 17:59, Christoffer Dall wrote:
> When the guest accesses I/O memory this will create data abort
> exceptions and they are handled by decoding the HSR information
> (physical address, read/write, length, register) and forwarding reads
> and writes to QEMU which performs the device emulation.
>
> Certain classes of load/store operations do not support the syndrome
> information provided in the HSR. We don't support decoding these (patches
> are available elsewhere), so we report an error to user space in this case.
>
> This requires changing the general flow somewhat since new calls to run
> the VCPU must check if there's a pending MMIO load and perform the write
> after userspace has made the data available.
>
> Reviewed-by: Will Deacon <will.deacon@arm.com>
> Reviewed-by: Marcelo Tosatti <mtosatti@redhat.com>
> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
> Signed-off-by: Christoffer Dall <c.dall@virtualopensystems.com>
[...]
> diff --git a/arch/arm/kvm/interrupts.S b/arch/arm/kvm/interrupts.S
> index 04a9705..702743e 100644
> --- a/arch/arm/kvm/interrupts.S
> +++ b/arch/arm/kvm/interrupts.S
> @@ -192,6 +192,44 @@ after_vfp_restore:
> mov r0, r1 @ Return the return code
> bx lr @ return to IOCTL
>
> +
> +/********************************************************************
> + * Translate VA to PA
> + *
> + * u64 __kvm_va_to_pa(struct kvm_vcpu *vcpu, u32 va, bool priv)
> + *
> + * Arguments:
> + * r0: pointer to vcpu struct
> + * r1: virtual address to map (rounded to page)
> + * r2: 1 = P1 (read) mapping, 0 = P0 (read) mapping.
> + * Returns 64 bit PAR value.
> + */
> +ENTRY(__kvm_va_to_pa)
> + push {r4-r12}
> +
> + @ Fold flag into r1, easier than using stack.
> + cmp r2, #0
> + movne r2, #1
> + orr r1, r1, r2
> +
> + @ This swaps too many registers, but we're in the slow path anyway.
> + read_cp15_state store_to_vcpu = 0
> + write_cp15_state read_from_vcpu = 1
> +
> + ands r2, r1, #1
> + bic r1, r1, r2
> + mcrne p15, 0, r1, c7, c8, 0 @ VA to PA, ATS1CPR
> + mcreq p15, 0, r1, c7, c8, 2 @ VA to PA, ATS1CUR
> + isb
> +
> + @ Restore host state.
> + read_cp15_state store_to_vcpu = 1
> + write_cp15_state read_from_vcpu = 0
> +
> + mrrc p15, 0, r0, r1, c7 @ PAR
> + pop {r4-r12}
> + bx lr
> +
Do we still need this function? Now that the MMIO emulation is gone,
there should be no need to perform a manual translation.
I can't even find a caller for it either.
M.
--
Jazz is not dead. It just smells funny...
WARNING: multiple messages have this Message-ID (diff)
From: Marc Zyngier <marc.zyngier@arm.com>
To: Christoffer Dall <c.dall@virtualopensystems.com>
Cc: "kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"kvmarm@lists.cs.columbia.edu" <kvmarm@lists.cs.columbia.edu>,
Rusty Russell <rusty@rustcorp.com.au>,
Marcelo Tosatti <mtosatti@redhat.com>,
Will Deacon <Will.Deacon@arm.com>
Subject: Re: [PATCH v6 13/15] KVM: ARM: Handle I/O aborts
Date: Thu, 17 Jan 2013 16:37:00 +0000 [thread overview]
Message-ID: <50F828AC.2050307@arm.com> (raw)
In-Reply-To: <20130116175911.29147.40578.stgit@ubuntu>
On 16/01/13 17:59, Christoffer Dall wrote:
> When the guest accesses I/O memory this will create data abort
> exceptions and they are handled by decoding the HSR information
> (physical address, read/write, length, register) and forwarding reads
> and writes to QEMU which performs the device emulation.
>
> Certain classes of load/store operations do not support the syndrome
> information provided in the HSR. We don't support decoding these (patches
> are available elsewhere), so we report an error to user space in this case.
>
> This requires changing the general flow somewhat since new calls to run
> the VCPU must check if there's a pending MMIO load and perform the write
> after userspace has made the data available.
>
> Reviewed-by: Will Deacon <will.deacon@arm.com>
> Reviewed-by: Marcelo Tosatti <mtosatti@redhat.com>
> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
> Signed-off-by: Christoffer Dall <c.dall@virtualopensystems.com>
[...]
> diff --git a/arch/arm/kvm/interrupts.S b/arch/arm/kvm/interrupts.S
> index 04a9705..702743e 100644
> --- a/arch/arm/kvm/interrupts.S
> +++ b/arch/arm/kvm/interrupts.S
> @@ -192,6 +192,44 @@ after_vfp_restore:
> mov r0, r1 @ Return the return code
> bx lr @ return to IOCTL
>
> +
> +/********************************************************************
> + * Translate VA to PA
> + *
> + * u64 __kvm_va_to_pa(struct kvm_vcpu *vcpu, u32 va, bool priv)
> + *
> + * Arguments:
> + * r0: pointer to vcpu struct
> + * r1: virtual address to map (rounded to page)
> + * r2: 1 = P1 (read) mapping, 0 = P0 (read) mapping.
> + * Returns 64 bit PAR value.
> + */
> +ENTRY(__kvm_va_to_pa)
> + push {r4-r12}
> +
> + @ Fold flag into r1, easier than using stack.
> + cmp r2, #0
> + movne r2, #1
> + orr r1, r1, r2
> +
> + @ This swaps too many registers, but we're in the slow path anyway.
> + read_cp15_state store_to_vcpu = 0
> + write_cp15_state read_from_vcpu = 1
> +
> + ands r2, r1, #1
> + bic r1, r1, r2
> + mcrne p15, 0, r1, c7, c8, 0 @ VA to PA, ATS1CPR
> + mcreq p15, 0, r1, c7, c8, 2 @ VA to PA, ATS1CUR
> + isb
> +
> + @ Restore host state.
> + read_cp15_state store_to_vcpu = 1
> + write_cp15_state read_from_vcpu = 0
> +
> + mrrc p15, 0, r0, r1, c7 @ PAR
> + pop {r4-r12}
> + bx lr
> +
Do we still need this function? Now that the MMIO emulation is gone,
there should be no need to perform a manual translation.
I can't even find a caller for it either.
M.
--
Jazz is not dead. It just smells funny...
next prev parent reply other threads:[~2013-01-17 16:37 UTC|newest]
Thread overview: 92+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-16 17:57 [PATCH v6 00/15] KVM/ARM Implementation Christoffer Dall
2013-01-16 17:57 ` Christoffer Dall
2013-01-16 17:57 ` [PATCH v6 01/15] ARM: Add page table and page defines needed by KVM Christoffer Dall
2013-01-16 17:57 ` Christoffer Dall
2013-01-24 11:39 ` Catalin Marinas
2013-01-24 11:39 ` Catalin Marinas
2013-01-24 16:05 ` Christoffer Dall
2013-01-24 16:05 ` Christoffer Dall
2013-01-24 17:02 ` Catalin Marinas
2013-01-24 17:02 ` Catalin Marinas
2013-01-24 17:04 ` Christoffer Dall
2013-01-24 17:04 ` Christoffer Dall
2013-01-24 17:13 ` Catalin Marinas
2013-01-24 17:13 ` Catalin Marinas
2013-01-24 17:25 ` Christoffer Dall
2013-01-24 17:25 ` Christoffer Dall
2013-01-16 17:57 ` [PATCH v6 02/15] ARM: Section based HYP idmap Christoffer Dall
2013-01-16 17:57 ` Christoffer Dall
2013-01-24 14:32 ` Catalin Marinas
2013-01-24 14:32 ` Catalin Marinas
2013-01-24 16:36 ` Christoffer Dall
2013-01-24 16:36 ` Christoffer Dall
2013-01-24 17:05 ` Catalin Marinas
2013-01-24 17:05 ` Catalin Marinas
2013-01-24 17:10 ` Christoffer Dall
2013-01-24 17:10 ` Christoffer Dall
2013-01-16 17:57 ` [PATCH v6 03/15] KVM: ARM: Initial skeleton to compile KVM support Christoffer Dall
2013-01-16 17:57 ` Christoffer Dall
2013-01-16 17:57 ` [PATCH v6 04/15] KVM: ARM: Hypervisor initialization Christoffer Dall
2013-01-16 17:57 ` Christoffer Dall
2013-01-24 15:45 ` Catalin Marinas
2013-01-24 15:45 ` Catalin Marinas
2013-01-24 16:52 ` Christoffer Dall
2013-01-24 16:52 ` Christoffer Dall
2013-01-16 17:57 ` [PATCH v6 05/15] KVM: ARM: Memory virtualization setup Christoffer Dall
2013-01-16 17:57 ` Christoffer Dall
2013-01-16 17:58 ` [PATCH v6 06/15] KVM: ARM: Inject IRQs and FIQs from userspace Christoffer Dall
2013-01-16 17:58 ` Christoffer Dall
2013-01-16 17:58 ` [PATCH v6 07/15] KVM: ARM: World-switch implementation Christoffer Dall
2013-01-16 17:58 ` Christoffer Dall
2013-01-16 17:58 ` [PATCH v6 08/15] KVM: ARM: Emulation framework and CP15 emulation Christoffer Dall
2013-01-16 17:58 ` Christoffer Dall
2013-01-16 17:58 ` [PATCH v6 09/15] trom: Christoffer Dall <c.dall@virtualopensystems.com> Christoffer Dall
2013-01-16 17:58 ` Christoffer Dall
2013-01-16 18:14 ` [RESEND PATCH v6 09/15] KVM: ARM: User space API for getting/setting co-proc registers Christoffer Dall
2013-01-16 18:14 ` Christoffer Dall
2013-01-16 17:58 ` [PATCH v6 10/15] KVM: ARM: Demux CCSIDR in the userspace API Christoffer Dall
2013-01-16 17:58 ` Christoffer Dall
2013-01-16 17:58 ` [PATCH v6 11/15] KVM: ARM: VFP userspace interface Christoffer Dall
2013-01-16 17:58 ` Christoffer Dall
2013-01-16 17:59 ` [PATCH v6 12/15] KVM: ARM: Handle guest faults in KVM Christoffer Dall
2013-01-16 17:59 ` Christoffer Dall
2013-01-16 17:59 ` [PATCH v6 13/15] KVM: ARM: Handle I/O aborts Christoffer Dall
2013-01-16 17:59 ` Christoffer Dall
2013-01-17 16:37 ` Marc Zyngier [this message]
2013-01-17 16:37 ` Marc Zyngier
2013-01-17 17:07 ` Christoffer Dall
2013-01-17 17:07 ` Christoffer Dall
2013-01-16 17:59 ` [PATCH v6 14/15] KVM: ARM: Power State Coordination Interface implementation Christoffer Dall
2013-01-16 17:59 ` Christoffer Dall
2013-01-17 15:55 ` Marc Zyngier
2013-01-17 15:55 ` Marc Zyngier
2013-01-20 23:35 ` Christoffer Dall
2013-01-20 23:35 ` Christoffer Dall
2013-01-21 10:04 ` [kvmarm] " Marc Zyngier
2013-01-21 10:04 ` Marc Zyngier
2013-01-21 14:50 ` Christoffer Dall
2013-01-21 14:50 ` Christoffer Dall
2013-01-21 17:43 ` Marc Zyngier
2013-01-21 17:43 ` Marc Zyngier
2013-01-21 17:54 ` Christoffer Dall
2013-01-21 17:54 ` Christoffer Dall
2013-01-21 18:08 ` Marc Zyngier
2013-01-21 18:08 ` Marc Zyngier
2013-01-21 18:17 ` Peter Maydell
2013-01-21 18:17 ` Peter Maydell
2013-01-21 18:20 ` Christoffer Dall
2013-01-21 18:20 ` Christoffer Dall
2013-01-21 13:52 ` Gleb Natapov
2013-01-21 13:52 ` Gleb Natapov
2013-01-16 17:59 ` [PATCH v6 15/15] KVM: ARM: Add maintainer entry for KVM/ARM Christoffer Dall
2013-01-16 17:59 ` Christoffer Dall
2013-01-17 16:26 ` Will Deacon
2013-01-17 16:26 ` Will Deacon
2013-01-20 22:57 ` Christoffer Dall
2013-01-20 22:57 ` Christoffer Dall
2013-01-24 16:26 ` [PATCH v6 00/15] KVM/ARM Implementation Catalin Marinas
2013-01-24 16:26 ` Catalin Marinas
2013-01-24 16:36 ` Christoffer Dall
2013-01-24 16:36 ` Christoffer Dall
2013-01-24 17:14 ` Gleb Natapov
2013-01-24 17:14 ` Gleb Natapov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50F828AC.2050307@arm.com \
--to=marc.zyngier@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.