From: marc.zyngier@arm.com (Marc Zyngier)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 07/15] KVM: arm-vgic: Make vgic mmio functions more generic
Date: Sat, 28 Dec 2013 11:15:39 +0000 [thread overview]
Message-ID: <1388229347-24185-8-git-send-email-marc.zyngier@arm.com> (raw)
In-Reply-To: <1388229347-24185-1-git-send-email-marc.zyngier@arm.com>
From: Christoffer Dall <christoffer.dall@linaro.org>
Rename the vgic_ranges array to vgic_dist_ranges to be more specific and
to prepare for handling CPU interface register access as well (for
save/restore of VGIC state).
Pass offset from distributor or interface MMIO base to
find_matching_range function instead of the physical address of the
access in the VM memory map. This allows other callers unaware of the
VM specifics, but with generic VGIC knowledge to reuse the function.
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
---
virt/kvm/arm/vgic.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c
index 45db48d..e2596f6 100644
--- a/virt/kvm/arm/vgic.c
+++ b/virt/kvm/arm/vgic.c
@@ -602,7 +602,7 @@ struct mmio_range {
phys_addr_t offset);
};
-static const struct mmio_range vgic_ranges[] = {
+static const struct mmio_range vgic_dist_ranges[] = {
{
.base = GIC_DIST_CTRL,
.len = 12,
@@ -669,14 +669,13 @@ static const struct mmio_range vgic_ranges[] = {
static const
struct mmio_range *find_matching_range(const struct mmio_range *ranges,
struct kvm_exit_mmio *mmio,
- phys_addr_t base)
+ phys_addr_t offset)
{
const struct mmio_range *r = ranges;
- phys_addr_t addr = mmio->phys_addr - base;
while (r->len) {
- if (addr >= r->base &&
- (addr + mmio->len) <= (r->base + r->len))
+ if (offset >= r->base &&
+ (offset + mmio->len) <= (r->base + r->len))
return r;
r++;
}
@@ -713,7 +712,8 @@ bool vgic_handle_mmio(struct kvm_vcpu *vcpu, struct kvm_run *run,
return true;
}
- range = find_matching_range(vgic_ranges, mmio, base);
+ offset = mmio->phys_addr - base;
+ range = find_matching_range(vgic_dist_ranges, mmio, offset);
if (unlikely(!range || !range->handle_mmio)) {
pr_warn("Unhandled access %d %08llx %d\n",
mmio->is_write, mmio->phys_addr, mmio->len);
--
1.8.5.1
next prev parent reply other threads:[~2013-12-28 11:15 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-28 11:15 [PULL 00/15] KVM/{arm,arm64} updates for 3.14 Marc Zyngier
2013-12-28 11:15 ` [PATCH 01/15] arm/arm64: KVM: arch_timer: Initialize cntvoff at kvm_init Marc Zyngier
2013-12-28 11:15 ` [PATCH 02/15] ARM/KVM: save and restore generic timer registers Marc Zyngier
2013-12-28 11:15 ` [PATCH 03/15] ARM: KVM: Allow creating the VGIC after VCPUs Marc Zyngier
2013-12-28 11:15 ` [PATCH 04/15] KVM: arm-vgic: Support KVM_CREATE_DEVICE for VGIC Marc Zyngier
2013-12-28 11:15 ` [PATCH 05/15] KVM: arm-vgic: Set base addr through device API Marc Zyngier
2013-12-28 11:15 ` [PATCH 06/15] irqchip: arm-gic: Define additional MMIO offsets and masks Marc Zyngier
2013-12-28 11:15 ` Marc Zyngier [this message]
2013-12-28 11:15 ` [PATCH 08/15] arm/arm64: kvm: Set vcpu->cpu to -1 on vcpu_put Marc Zyngier
2013-12-28 11:15 ` [PATCH 09/15] KVM: arm-vgic: Add vgic reg access from dev attr Marc Zyngier
2013-12-28 11:15 ` [PATCH 10/15] KVM: arm-vgic: Support unqueueing of LRs to the dist Marc Zyngier
2013-12-28 11:15 ` [PATCH 11/15] KVM: arm-vgic: Add GICD_SPENDSGIR and GICD_CPENDSGIR handlers Marc Zyngier
2013-12-28 11:15 ` [PATCH 12/15] KVM: arm-vgic: Support CPU interface reg access Marc Zyngier
2013-12-28 11:15 ` [PATCH 13/15] arm64: KVM: Add Kconfig option for max VCPUs per-Guest Marc Zyngier
2013-12-28 11:15 ` [PATCH 14/15] arm64: KVM: Support X-Gene guest VCPU on APM X-Gene host Marc Zyngier
2013-12-28 11:15 ` [PATCH 15/15] arm64: KVM: Force undefined exception for Guest SMC intructions Marc Zyngier
2013-12-31 19:25 ` [PULL 00/15] KVM/{arm,arm64} updates for 3.14 Marcelo Tosatti
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=1388229347-24185-8-git-send-email-marc.zyngier@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).