From patchwork Thu Jul 31 12:15:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 34604 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f71.google.com (mail-pa0-f71.google.com [209.85.220.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BAC6C20792 for ; Thu, 31 Jul 2014 12:15:48 +0000 (UTC) Received: by mail-pa0-f71.google.com with SMTP id et14sf17004541pad.10 for ; Thu, 31 Jul 2014 05:15:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:in-reply-to :organization:references:user-agent:date:message-id:mime-version :sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe:content-type :content-transfer-encoding; bh=5+at0C+n4t+i9nJdFEzCsF2YlxsGBo7eW2hTsEa7MJg=; b=TPBQwEcwrbLzJ0eJV1cbdCEUZwDvWZBP0UHymLhRTYHUU1xVGPVqYkbwxr8mxmGTSI HkkgJrmZZvQ4fcQHR8d80JboM0PyY3eNoEkinLSsG2fpdQvl1u2edvS5f8ukK4r5qLrF S73kvSJt5LTW96Uj8WQpR/SkNu8oDw6f6KQeUd21Wxi9jNWA6KRTAIL7yxlB0j+kwS4V S+Yco2tKzop6pWaEe4o3pXpD/PveOKA/4vyRHQjI2tbMOwis8yD7KEaffF2K5NrntBgY MByOHllUkx3r2PxQqgQ+2Vyii+V8WBpB+quUeiBcxgFTMhMgEBHZoSKtKx9lSxryyYyd 5sZA== X-Gm-Message-State: ALoCoQkDbzOxh6DrTCdM3HZQMAM4Qjaw1gjhJItatHUfwCQTvJOmnLxrg7Dkacmup3GIvdp8BASq X-Received: by 10.70.102.205 with SMTP id fq13mr4493889pdb.6.1406808947880; Thu, 31 Jul 2014 05:15:47 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.97.52 with SMTP id l49ls890972qge.69.gmail; Thu, 31 Jul 2014 05:15:47 -0700 (PDT) X-Received: by 10.52.144.14 with SMTP id si14mr124858vdb.95.1406808947670; Thu, 31 Jul 2014 05:15:47 -0700 (PDT) Received: from mail-vc0-f169.google.com (mail-vc0-f169.google.com [209.85.220.169]) by mx.google.com with ESMTPS id dk6si4180292veb.20.2014.07.31.05.15.47 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 31 Jul 2014 05:15:47 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.169 as permitted sender) client-ip=209.85.220.169; Received: by mail-vc0-f169.google.com with SMTP id le20so3971941vcb.0 for ; Thu, 31 Jul 2014 05:15:47 -0700 (PDT) X-Received: by 10.220.97.5 with SMTP id j5mr11925848vcn.16.1406808947533; Thu, 31 Jul 2014 05:15:47 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp13355vcb; Thu, 31 Jul 2014 05:15:47 -0700 (PDT) X-Received: by 10.68.192.106 with SMTP id hf10mr3830705pbc.30.1406808946507; Thu, 31 Jul 2014 05:15:46 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u6si898798pdp.70.2014.07.31.05.15.45 for ; Thu, 31 Jul 2014 05:15:46 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751266AbaGaMPo (ORCPT + 20 others); Thu, 31 Jul 2014 08:15:44 -0400 Received: from fw-tnat.austin.arm.com ([217.140.110.23]:27619 "EHLO collaborate-mta1.arm.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750782AbaGaMPn convert rfc822-to-8bit (ORCPT ); Thu, 31 Jul 2014 08:15:43 -0400 Received: from approximate.cambridge.arm.com (approximate.cambridge.arm.com [10.1.209.43]) by collaborate-mta1.arm.com (Postfix) with ESMTPS id 16A6C13FAA1; Thu, 31 Jul 2014 07:15:41 -0500 (CDT) From: Marc Zyngier To: Christoffer Dall Cc: Stephen Rothwell , "linux-next\@vger.kernel.org" , linux-kernel , Will Deacon Subject: Re: linux-next: manual merge of the kvm-arm tree with Linus' tree In-Reply-To: (Christoffer Dall's message of "Thu, 31 Jul 2014 12:53:03 +0100") Organization: ARM Ltd References: <20140731163004.474501fb@canb.auug.org.au> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Date: Thu, 31 Jul 2014 13:15:40 +0100 Message-ID: <87mwbpiv0z.fsf@approximate.cambridge.arm.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: marc.zyngier@arm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.169 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , On Thu, Jul 31 2014 at 12:53:03 pm BST, Christoffer Dall wrote: Hi Christoffer, > On Thu, Jul 31, 2014 at 8:30 AM, Stephen Rothwell 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 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 --- 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;