From: Marc Zyngier <marc.zyngier@arm.com>
To: Christoffer Dall <christofferdall@christofferdall.dk>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>,
"linux-next@vger.kernel.org" <linux-next@vger.kernel.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
Will Deacon <Will.Deacon@arm.com>
Subject: Re: linux-next: manual merge of the kvm-arm tree with Linus' tree
Date: Thu, 31 Jul 2014 13:15:40 +0100 [thread overview]
Message-ID: <87mwbpiv0z.fsf@approximate.cambridge.arm.com> (raw)
In-Reply-To: <CAEDV+gJ1oSPzgZMO=kdFDNPnzy-EOHGuLxHqTB8KO6d_8yPrxQ@mail.gmail.com> (Christoffer Dall's message of "Thu, 31 Jul 2014 12:53:03 +0100")
On Thu, Jul 31 2014 at 12:53:03 pm BST, Christoffer Dall <christofferdall@christofferdall.dk> wrote:
Hi Christoffer,
> On Thu, Jul 31, 2014 at 8:30 AM, Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> Hi all,
>
> Today's linux-next merge of the kvm-arm tree got a conflict in
> virt/kvm/arm/vgic.c between commit 63afbe7a0ac1 ("kvm: arm64: vgic: fix
> hyp panic with 64k pages on juno platform") from Linus' tree and commit
> 8f186d522c69 ("KVM: ARM: vgic: split GICv2 backend from the main vgic
> code") and others from the kvm-arm tree.
>
> I fixed it up (the latter extensively rewrites the function, so I just
> used that) and can carry the fix as necessary (no action is required).
>
> Hmm that doesn't look correct, the checks for
> PAGE_ALIGNED(vcpu_res.start) and PAGE_ALIGNED(resource_size(vcpu_res))
> still need to be enforced for both vgic-v2 and vgic-v3. How do we
> provide a correct fix for Linux-next?
I've provided a resolution for GICv2 in a separate email. For GICv3, I
have the following patch in my tree, which can be added at a later time.
Thanks,
M.
From 3eedf1d172230a117ec90832748879e88d9c3471 Mon Sep 17 00:00:00 2001
From: Marc Zyngier <marc.zyngier@arm.com>
Date: Thu, 31 Jul 2014 11:42:18 +0100
Subject: [PATCH] KVM: arm64: GICv3: mandate page-aligned GICV region
Just like GICv2 was fixed in 63afbe7a0ac1
(kvm: arm64: vgic: fix hyp panic with 64k pages on juno platform),
mandate the GICV region to be both aligned on a page boundary and
its size to be a multiple of page size.
This prevents a guest from being able to poke at regions where we
have no idea what is sitting there.
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
virt/kvm/arm/vgic-v3.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/virt/kvm/arm/vgic-v3.c b/virt/kvm/arm/vgic-v3.c
index f01d446..1c2c8ee 100644
--- a/virt/kvm/arm/vgic-v3.c
+++ b/virt/kvm/arm/vgic-v3.c
@@ -215,6 +215,22 @@ int vgic_v3_probe(struct device_node *vgic_node,
ret = -ENXIO;
goto out;
}
+
+ if (!PAGE_ALIGNED(vcpu_res.start)) {
+ kvm_err("GICV physical address 0x%llx not page aligned\n",
+ (unsigned long long)vcpu_res.start);
+ ret = -ENXIO;
+ goto out;
+ }
+
+ if (!PAGE_ALIGNED(resource_size(&vcpu_res))) {
+ kvm_err("GICV size 0x%llx not a multiple of page size 0x%lx\n",
+ (unsigned long long)resource_size(&vcpu_res),
+ PAGE_SIZE);
+ ret = -ENXIO;
+ goto out;
+ }
+
vgic->vcpu_base = vcpu_res.start;
vgic->vctrl_base = NULL;
vgic->type = VGIC_V3;
--
2.0.0
--
Jazz is not dead. It just smells funny.
next prev parent reply other threads:[~2014-07-31 12:15 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-31 6:30 linux-next: manual merge of the kvm-arm tree with Linus' tree Stephen Rothwell
2014-07-31 12:10 ` Marc Zyngier
[not found] ` <CAEDV+gJ1oSPzgZMO=kdFDNPnzy-EOHGuLxHqTB8KO6d_8yPrxQ@mail.gmail.com>
2014-07-31 12:15 ` Marc Zyngier [this message]
2014-07-31 14:23 ` Christoffer Dall
2014-07-31 14:30 ` Marc Zyngier
2014-08-01 5:21 ` Stephen Rothwell
2014-07-31 12:17 ` Stephen Rothwell
2014-07-31 12:41 ` Stephen Rothwell
2014-10-17 1:47 Stephen Rothwell
2015-03-18 3:41 Stephen Rothwell
2015-03-18 7:55 ` Christoffer Dall
2015-04-07 16:20 ` Paolo Bonzini
2015-04-08 8:15 ` Marc Zyngier
2015-04-08 10:57 ` Christoffer Dall
2015-04-16 19:10 ` Christoffer Dall
2015-04-16 19:39 ` Paolo Bonzini
2015-04-16 20:16 ` Christoffer Dall
2017-04-10 4:02 Stephen Rothwell
2017-04-10 8:02 ` Christoffer Dall
2017-11-06 2:52 Stephen Rothwell
2017-11-06 2:56 Stephen Rothwell
2018-01-03 2:38 Stephen Rothwell
2018-01-03 9:50 ` Christoffer Dall
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=87mwbpiv0z.fsf@approximate.cambridge.arm.com \
--to=marc.zyngier@arm.com \
--cc=Will.Deacon@arm.com \
--cc=christofferdall@christofferdall.dk \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=sfr@canb.auug.org.au \
/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).