From patchwork Fri Jul 25 09:31:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 4622071 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 73AA99F36A for ; Fri, 25 Jul 2014 09:31:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9EECC201FE for ; Fri, 25 Jul 2014 09:31:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B0521201F4 for ; Fri, 25 Jul 2014 09:31:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759805AbaGYJbm (ORCPT ); Fri, 25 Jul 2014 05:31:42 -0400 Received: from cam-admin0.cambridge.arm.com ([217.140.96.50]:36212 "EHLO cam-admin0.cambridge.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750818AbaGYJbk (ORCPT ); Fri, 25 Jul 2014 05:31:40 -0400 Received: from arm.com (edgewater-inn.cambridge.arm.com [10.1.203.34]) by cam-admin0.cambridge.arm.com (8.12.6/8.12.6) with ESMTP id s6P9VNwo014541; Fri, 25 Jul 2014 10:31:24 +0100 (BST) Date: Fri, 25 Jul 2014 10:31:27 +0100 From: Will Deacon To: Peter Maydell Cc: Paolo Bonzini , "gleb@kernel.org" , "kvmarm@lists.cs.columbia.edu" , kvm-devel , Christoffer Dall , Marc Zyngier , Joel Schopp , Don Dutile , "stable@vger.kernel.org" Subject: Re: [PATCH] kvm: arm64: vgic: fix hyp panic with 64k pages on juno platform Message-ID: <20140725093127.GB5269@arm.com> References: <1406230067-926-1-git-send-email-will.deacon@arm.com> <20140724195528.GC9143@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Peter, On Thu, Jul 24, 2014 at 09:05:39PM +0100, Peter Maydell wrote: > On 24 July 2014 20:55, Will Deacon wrote: > > Again, that can be solved by introduced Marc's attr for determining the > > GICV offset within the 64k page. I don't think that's -stable material. > > Agreed that we don't want to put Marc's patchset in -stable > (and that without it systems with GICV in their host devicetree > at pagebase+60K are unusable, so we're not actually regressing > anything if we put this into stable). But... > > >> I can't think of any way of determining whether a particular > >> system gets this right or wrong automatically, which suggests > >> perhaps we need to allow the device tree to specify that the > >> GICV is 64k-page-safe... > > > > When we support such systems, I also think we'll need a device-tree change. > > My main concern right now is stopping the ability to hose the entire machine > > by trying to instantiate a virtual GIC. > > ...I don't see how your patch prevents instantiating a VGIC > and hosing the machine on a system where the 64K > with the GICV registers in it goes > [GICV registers] [machine blows up if you read this] > 0K 8K 64K True, if such a machine existed, then this patch wouldn't detect it. I don't think we support anything like that in mainline at the moment, but the following additional diff should solve the problem, no? > Whether the 64K page contains Bad Stuff is completely > orthogonal to whether the device tree offset the host has > for the GICV is 0K, 60K or anything in between. What you > should be checking for is "is this system design broken?", > which is probably a device tree attribute. Actually, I think we can just claim that the GICV occupies the full 64k region and allow the offset within that region to be acquired via the new ioctl. Will --- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c index fa9a95b3ed19..476d3bf540a8 100644 --- a/virt/kvm/arm/vgic.c +++ b/virt/kvm/arm/vgic.c @@ -1539,6 +1539,14 @@ int kvm_vgic_hyp_init(void) goto out_unmap; } + 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_unmap; + } + vgic_vcpu_base = vcpu_res.start; kvm_info("%s@%llx IRQ%d\n", vgic_node->name,