From patchwork Fri Apr 24 05:27:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 47538 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2441420553 for ; Fri, 24 Apr 2015 05:34:38 +0000 (UTC) Received: by wghm4 with SMTP id m4sf9148356wgh.2 for ; Thu, 23 Apr 2015 22:34:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=KFMnstGHwBSrUWFOpcpGNZN1QDxWFA1ASa/k6qZ/K7U=; b=VZhx/+HE0BIf+Il+wbXyvpOQzxwAPCI7x3dY1oDP90gY1SWfzXpyshfEdcCiK1spiM ReWXnR/rVEOv3lYyEtuHU7JwnyLrl/tcsuyLxtEtUgOr78YmizxL9gNsRMg/Eahor+rm aKrouez7mchltD+mMbhRZtELgIXO3grCYOdavD1Ri15JjXzqD9mpI0RRMn46hYYTHPfB CWlp1Skos3ElBtcsk4okHNJnaUHn6vzUdRQZZetIqNDHMdYtYJOnUMvKT+sEu76G3Irt klO4onbr7qVYnC0ETL+K3PgU5BerRvhVt6hjpnMiuJg3dfmKd/U29J0PbIoBfSs2VOm6 tlzQ== X-Gm-Message-State: ALoCoQlgwwdKfaKWXKnhtW/wCPpN3K5reZ9DHhM2lV93yi3Bm0BOi24rsYY0wEjiCv3iL6Q3UJ5Y X-Received: by 10.194.47.179 with SMTP id e19mr3226227wjn.4.1429853677377; Thu, 23 Apr 2015 22:34:37 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.22.134 with SMTP id d6ls414304laf.95.gmail; Thu, 23 Apr 2015 22:34:37 -0700 (PDT) X-Received: by 10.153.11.163 with SMTP id ej3mr5382536lad.105.1429853677120; Thu, 23 Apr 2015 22:34:37 -0700 (PDT) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com. [209.85.215.43]) by mx.google.com with ESMTPS id db3si7459592lad.150.2015.04.23.22.34.37 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Apr 2015 22:34:37 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by labbd9 with SMTP id bd9so27587338lab.2 for ; Thu, 23 Apr 2015 22:34:37 -0700 (PDT) X-Received: by 10.112.222.133 with SMTP id qm5mr5459811lbc.86.1429853677017; Thu, 23 Apr 2015 22:34:37 -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.112.67.65 with SMTP id l1csp978830lbt; Thu, 23 Apr 2015 22:34:36 -0700 (PDT) X-Received: by 10.66.117.233 with SMTP id kh9mr11882031pab.103.1429853675308; Thu, 23 Apr 2015 22:34:35 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bd10si15800741pdb.178.2015.04.23.22.34.34; Thu, 23 Apr 2015 22:34:35 -0700 (PDT) Received-SPF: none (google.com: stable-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 S1754567AbbDXFee (ORCPT + 2 others); Fri, 24 Apr 2015 01:34:34 -0400 Received: from mail-oi0-f45.google.com ([209.85.218.45]:34725 "EHLO mail-oi0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754571AbbDXFed (ORCPT ); Fri, 24 Apr 2015 01:34:33 -0400 Received: by oiko83 with SMTP id o83so32511275oik.1 for ; Thu, 23 Apr 2015 22:34:33 -0700 (PDT) X-Received: by 10.182.255.231 with SMTP id at7mr5781580obd.20.1429853673146; Thu, 23 Apr 2015 22:34:33 -0700 (PDT) Received: from localhost ([167.160.116.36]) by mx.google.com with ESMTPSA id y19sm6091869oie.13.2015.04.23.22.34.31 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 23 Apr 2015 22:34:32 -0700 (PDT) From: shannon.zhao@linaro.org To: stable@vger.kernel.org Cc: jslaby@suse.cz, christoffer.dall@linaro.org, shannon.zhao@linaro.org, Ard Biesheuvel , Marc Zyngier Subject: [PATCH for 3.12.y stable 53/63] arm/arm64: kvm: drop inappropriate use of kvm_is_mmio_pfn() Date: Fri, 24 Apr 2015 13:27:51 +0800 Message-Id: <1429853281-6136-54-git-send-email-shannon.zhao@linaro.org> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1429853281-6136-1-git-send-email-shannon.zhao@linaro.org> References: <1429853281-6136-1-git-send-email-shannon.zhao@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: stable@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: shannon.zhao@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 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: , From: Ard Biesheuvel commit 07a9748c78cfc39b54f06125a216b67b9c8f09ed upstream. Instead of using kvm_is_mmio_pfn() to decide whether a host region should be stage 2 mapped with device attributes, add a new static function kvm_is_device_pfn() that disregards RAM pages with the reserved bit set, as those should usually not be mapped as device memory. Signed-off-by: Ard Biesheuvel Signed-off-by: Marc Zyngier Signed-off-by: Shannon Zhao --- arch/arm/kvm/mmu.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c index 90422a5..5c31e3ff 100644 --- a/arch/arm/kvm/mmu.c +++ b/arch/arm/kvm/mmu.c @@ -644,6 +644,11 @@ static bool kvm_is_write_fault(struct kvm_vcpu *vcpu) return kvm_vcpu_dabt_iswrite(vcpu); } +static bool kvm_is_device_pfn(unsigned long pfn) +{ + return !pfn_valid(pfn); +} + static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa, gfn_t gfn, struct kvm_memory_slot *memslot, unsigned long fault_status) @@ -684,7 +689,7 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa, if (is_error_pfn(pfn)) return -EFAULT; - if (kvm_is_mmio_pfn(pfn)) + if (kvm_is_device_pfn(pfn)) mem_type = PAGE_S2_DEVICE; new_pte = pfn_pte(pfn, mem_type);