From patchwork Tue Jun 30 10:49:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 50460 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E123C229DF for ; Tue, 30 Jun 2015 10:50:59 +0000 (UTC) Received: by wiar9 with SMTP id r9sf5159835wia.1 for ; Tue, 30 Jun 2015 03:50:59 -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=1E9S7g8BZmCzlVHR7g8OXCT2zmudc3SeAelpPHLB+9M=; b=FVRGKTXZJKQEM9mhpocVSJzMU1OAO0/ZDoDQ0JRnxVaYAXhhfUXmu8rtzR2iBhuQW4 L34fSSfI/z29uEo/N9/YX3r1i7aMGRx1VpChCwLMsLNAYYbQO1+q4VtmE5x7K3tErbEK M0ZeGHeSoACpavxOOumc8E0EIUTxfHR9Sun0HNx9GuC9b/5ZVm/vL9rSqrilHO7k9pdX FOkhtOtHZIwb/Sr4ruKD64u/BSRwe6sYfUIHloRYGpTq4EVgsI26XD0povxV3uvGJNm9 gdyMIiYRsAxhKkSYTR7d+kky9FPKl9LF4xs1G0ZcyUJms5b85WMNis+d8tEs8xD/CRN4 HiPg== X-Gm-Message-State: ALoCoQlvkgzkW9ENFfHBWZJ5tJM2Nej64WzyhWEPbMDhv37dguPqOQj9YuPBEZlWE9eQ3RJZIrjj X-Received: by 10.112.13.200 with SMTP id j8mr13716022lbc.14.1435661459192; Tue, 30 Jun 2015 03:50:59 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.37.196 with SMTP id a4ls22840lak.27.gmail; Tue, 30 Jun 2015 03:50:59 -0700 (PDT) X-Received: by 10.152.37.136 with SMTP id y8mr18918546laj.21.1435661459027; Tue, 30 Jun 2015 03:50:59 -0700 (PDT) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com. [209.85.215.50]) by mx.google.com with ESMTPS id l9si37754114laf.165.2015.06.30.03.50.59 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Jun 2015 03:50:59 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by lagh6 with SMTP id h6so8108250lag.2 for ; Tue, 30 Jun 2015 03:50:58 -0700 (PDT) X-Received: by 10.152.37.228 with SMTP id b4mr18799133lak.117.1435661458935; Tue, 30 Jun 2015 03:50:58 -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.108.230 with SMTP id hn6csp2353018lbb; Tue, 30 Jun 2015 03:50:57 -0700 (PDT) X-Received: by 10.68.250.194 with SMTP id ze2mr42729452pbc.24.1435661457094; Tue, 30 Jun 2015 03:50:57 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y5si66313267par.87.2015.06.30.03.50.56; Tue, 30 Jun 2015 03:50:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751124AbbF3Kuz (ORCPT + 2 others); Tue, 30 Jun 2015 06:50:55 -0400 Received: from mail-pd0-f172.google.com ([209.85.192.172]:35066 "EHLO mail-pd0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750821AbbF3Kuz (ORCPT ); Tue, 30 Jun 2015 06:50:55 -0400 Received: by pdbci14 with SMTP id ci14so4270260pdb.2 for ; Tue, 30 Jun 2015 03:50:54 -0700 (PDT) X-Received: by 10.70.90.103 with SMTP id bv7mr42828947pdb.160.1435661454816; Tue, 30 Jun 2015 03:50:54 -0700 (PDT) Received: from localhost ([120.136.36.232]) by mx.google.com with ESMTPSA id x7sm2988723pbt.16.2015.06.30.03.50.52 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 30 Jun 2015 03:50:53 -0700 (PDT) From: shannon.zhao@linaro.org To: stable@vger.kernel.org Cc: gregkh@linuxfoundation.org, christoffer.dall@linaro.org, shannon.zhao@linaro.org, Ard Biesheuvel , Marc Zyngier Subject: [PATCH for 3.14.y stable 12/22] arm/arm64: kvm: drop inappropriate use of kvm_is_mmio_pfn() Date: Tue, 30 Jun 2015 18:49:00 +0800 Message-Id: <1435661350-8060-13-git-send-email-shannon.zhao@linaro.org> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1435661350-8060-1-git-send-email-shannon.zhao@linaro.org> References: <1435661350-8060-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.50 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 f574732..5b12c49 100644 --- a/arch/arm/kvm/mmu.c +++ b/arch/arm/kvm/mmu.c @@ -755,6 +755,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, struct kvm_memory_slot *memslot, unsigned long fault_status) @@ -825,7 +830,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; spin_lock(&kvm->mmu_lock);