From: james.morse@arm.com (James Morse)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arm64: vgic-v2: Fix proxying of cpuif access
Date: Fri, 4 May 2018 16:19:16 +0100 [thread overview]
Message-ID: <c6406079-78eb-aa7d-dde4-2676aa27b91e@arm.com> (raw)
In-Reply-To: <20180427145102.5645-1-marc.zyngier@arm.com>
Hi Marc,
On 27/04/18 15:51, Marc Zyngier wrote:
> Proxying the cpuif accesses at EL2 makes use of vcpu_data_guest_to_host
> and co, which check the endianness, which call into vcpu_read_sys_reg...
> which isn't mapped at EL2 (it was inlined before, and got moved OoL
> with the VHE optimizations).
>
> The result is of course a nice panic. Let's add some specialized
> cruft to keep the broken platforms that require this hack alive.
> I'd rather kill BE support, but hey, just in case...
I have this a spin on Juno with a big-endian host and 64K pages:
Trying to boot a BE guest hangs.
Trying to boot a LE guest hangs.
> @@ -64,14 +88,11 @@ int __hyp_text __vgic_v2_perform_cpuif_access(struct kvm_vcpu *vcpu)
> addr += fault_ipa - vgic->vgic_cpu_base;
>
> if (kvm_vcpu_dabt_iswrite(vcpu)) {
> - u32 data = vcpu_data_guest_to_host(vcpu,
> - vcpu_get_reg(vcpu, rd),
> - sizeof(u32));
> + u32 data = __guest_to_host_u32(vcpu, vcpu_get_reg(vcpu, rd));
> writel_relaxed(data, addr);
> } else {
> - u32 data = readl_relaxed(addr);
> - vcpu_set_reg(vcpu, rd, vcpu_data_host_to_guest(vcpu, data,
> - sizeof(u32)));
> + u32 data = __host_to_guest_u32(vcpu, readl_relaxed(addr));
> + vcpu_set_reg(vcpu, rd, data);
> }
This happens because readl()/writel() are doing their own swabbing on
big-endian, even if the guest had already done this.
As I've trampled all over this patch, I'll post a v2...
Thanks,
James
prev parent reply other threads:[~2018-05-04 15:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-27 14:51 [PATCH] arm64: vgic-v2: Fix proxying of cpuif access Marc Zyngier
2018-04-29 12:34 ` Christoffer Dall
2018-04-29 13:05 ` Marc Zyngier
2018-04-29 14:00 ` Christoffer Dall
2018-05-25 16:09 ` Andrew Jones
2018-05-04 15:19 ` James Morse [this message]
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=c6406079-78eb-aa7d-dde4-2676aa27b91e@arm.com \
--to=james.morse@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