From patchwork Mon May 4 01:52:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 47975 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f69.google.com (mail-wg0-f69.google.com [74.125.82.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7A86C2121F for ; Mon, 4 May 2015 01:56:29 +0000 (UTC) Received: by wgin8 with SMTP id n8sf40689124wgi.0 for ; Sun, 03 May 2015 18:56:28 -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=uObXp9WntTN+rjFm6XvJm/bXa7XUKta4Nvl3+0GKyPM=; b=bBwBC1/vzVM7CUQVUt+fuxbgROpJtJBXhuf0cQfhX56bAybScP2Yii4/HkGr3e1LYJ XojPberUgNuqTJuJeu4Z8gz/gclxEEGhA1ijpa/I/uKfxLI26ShaScGouA+//M7FU3QE X7OgjEEwSGJqDpKJ170zyxnXF1EE6XOrI+s2mv/YTxC/TjB8K2q0pTnD8+sB/51M+7Te l9SbBrTScx/Z21HQyltmqlt2Ur4QCXk9DCxd45BdRNp91/3R8+60Kwtwv4nVlsbsCIWj SQTgHXm7tgfk4O6+vy5GbS0eCukDlYeeBNvNQpACWSXek8ZMchjGJGAFK5VbSrNZHGQi Ku/w== X-Gm-Message-State: ALoCoQmvoeENnC2kBeP+fgMfj61UwsHwM9RmuCCHACKwXm7IU3jXuIqHgy697BisVlNcYNHzzv8y X-Received: by 10.180.216.12 with SMTP id om12mr6900669wic.1.1430704588750; Sun, 03 May 2015 18:56:28 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.29.169 with SMTP id l9ls714070lah.52.gmail; Sun, 03 May 2015 18:56:28 -0700 (PDT) X-Received: by 10.112.56.42 with SMTP id x10mr17774328lbp.123.1430704588595; Sun, 03 May 2015 18:56:28 -0700 (PDT) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com. [209.85.217.173]) by mx.google.com with ESMTPS id y5si9075522lay.123.2015.05.03.18.56.28 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 03 May 2015 18:56:28 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) client-ip=209.85.217.173; Received: by lbbzk7 with SMTP id zk7so95774844lbb.0 for ; Sun, 03 May 2015 18:56:28 -0700 (PDT) X-Received: by 10.112.150.100 with SMTP id uh4mr17275882lbb.112.1430704588514; Sun, 03 May 2015 18:56:28 -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 l1csp1413205lbt; Sun, 3 May 2015 18:56:27 -0700 (PDT) X-Received: by 10.68.87.229 with SMTP id bb5mr38166979pbb.131.1430704586702; Sun, 03 May 2015 18:56:26 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ix6si17838787pac.46.2015.05.03.18.56.25; Sun, 03 May 2015 18:56:26 -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 S1751974AbbEDB4Z (ORCPT + 2 others); Sun, 3 May 2015 21:56:25 -0400 Received: from mail-pd0-f174.google.com ([209.85.192.174]:35110 "EHLO mail-pd0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751966AbbEDB4Z (ORCPT ); Sun, 3 May 2015 21:56:25 -0400 Received: by pdbqd1 with SMTP id qd1so150110731pdb.2 for ; Sun, 03 May 2015 18:56:24 -0700 (PDT) X-Received: by 10.68.88.33 with SMTP id bd1mr38552389pbb.124.1430704584719; Sun, 03 May 2015 18:56:24 -0700 (PDT) Received: from localhost ([180.150.153.1]) by mx.google.com with ESMTPSA id ph4sm11041624pdb.43.2015.05.03.18.56.23 (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 03 May 2015 18:56:23 -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 37/47] arm/arm64: kvm: drop inappropriate use of kvm_is_mmio_pfn() Date: Mon, 4 May 2015 09:52:32 +0800 Message-Id: <1430704362-6292-38-git-send-email-shannon.zhao@linaro.org> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1430704362-6292-1-git-send-email-shannon.zhao@linaro.org> References: <1430704362-6292-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.217.173 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 6b30b1b..f8c231d 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);