From patchwork Thu Apr 30 12:12:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 47822 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 5A9D32121F for ; Thu, 30 Apr 2015 12:18:21 +0000 (UTC) Received: by wghm4 with SMTP id m4sf14556869wgh.2 for ; Thu, 30 Apr 2015 05:18:20 -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: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=rHCW9zxGGJM5ImjE4feUPnkIDLFc5//NJNS7MmvAGvI=; b=G/bT7ZJ2RKMvF08wleCoUhnuzBnZNxRT6mz0aNaAPOvKQHzx93H48yen8dW9Ohb3fk +oTIhBbLLg7y45TUq6rkDmkcgh1ngSiXiQ+yJ+Oa8rlYV9xtzw1MUOywwV7yzaGw6bXC Jvp05Z5QW1TUtubzjn8ajJmgCeHi8OOzJ3kIrsseJxDR+RWo7XEecV9ID4SnYDHVCQWt TQMDqmGYmocaH86p6iimY/0FQXMpq3HtbHFRWBudtsnLM5g7Mnn1NiEcnAkLUUFzgQp4 eMvgkgine4bdZQN81bYBFAujTf8+4oq7/cru0a+JxsT1k110WKiBb8yHVaifn27mUTbW SEgw== X-Gm-Message-State: ALoCoQkJCxm4Bc4BwVLs2t+L4tTda3f+bXNhx8iD/AeGNwWQy17/3tKMQ0vV4LqjaZ0q+bKzBV4v X-Received: by 10.194.143.98 with SMTP id sd2mr2390509wjb.6.1430396300729; Thu, 30 Apr 2015 05:18:20 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.196 with SMTP id u4ls371436lau.6.gmail; Thu, 30 Apr 2015 05:18:20 -0700 (PDT) X-Received: by 10.152.120.106 with SMTP id lb10mr3479381lab.92.1430396300551; Thu, 30 Apr 2015 05:18:20 -0700 (PDT) Received: from mail-la0-f53.google.com (mail-la0-f53.google.com. [209.85.215.53]) by mx.google.com with ESMTPS id uf6si1614353lac.168.2015.04.30.05.18.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Apr 2015 05:18:20 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) client-ip=209.85.215.53; Received: by laat2 with SMTP id t2so42674610laa.1 for ; Thu, 30 Apr 2015 05:18:20 -0700 (PDT) X-Received: by 10.112.125.138 with SMTP id mq10mr3641087lbb.35.1430396300452; Thu, 30 Apr 2015 05:18:20 -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 l1csp3077548lbt; Thu, 30 Apr 2015 05:18:19 -0700 (PDT) X-Received: by 10.70.109.131 with SMTP id hs3mr7865317pdb.40.1430396283863; Thu, 30 Apr 2015 05:18:03 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id pt2si3298787pbb.51.2015.04.30.05.18.01; Thu, 30 Apr 2015 05:18:03 -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 S1752192AbbD3MR7 (ORCPT + 28 others); Thu, 30 Apr 2015 08:17:59 -0400 Received: from ip4-83-240-67-251.cust.nbox.cz ([83.240.67.251]:53675 "EHLO ip4-83-240-18-248.cust.nbox.cz" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751437AbbD3MMf (ORCPT ); Thu, 30 Apr 2015 08:12:35 -0400 Received: from ku by ip4-83-240-18-248.cust.nbox.cz with local (Exim 4.85) (envelope-from ) id 1YnnKT-0008DY-DT; Thu, 30 Apr 2015 14:12:33 +0200 From: Jiri Slaby To: stable@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Ard Biesheuvel , Marc Zyngier , Shannon Zhao , Jiri Slaby Subject: [PATCH 3.12 53/63] arm/arm64: kvm: drop inappropriate use of kvm_is_mmio_pfn() Date: Thu, 30 Apr 2015 14:12:22 +0200 Message-Id: <529ad12b779bb522563156ba02fa67ec55c0de99.1430387326.git.jslaby@suse.cz> X-Mailer: git-send-email 2.3.5 In-Reply-To: <45aaf85687dd6ac119c55c5ec0dbe0bef0e62235.1430387326.git.jslaby@suse.cz> References: <45aaf85687dd6ac119c55c5ec0dbe0bef0e62235.1430387326.git.jslaby@suse.cz> In-Reply-To: References: 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: linux-kernel-owner@vger.kernel.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.53 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 3.12-stable review patch. If anyone has any objections, please let me know. =============== 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 Signed-off-by: Jiri Slaby --- 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 90422a536083..5c31e3fff597 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);