From patchwork Tue Jun 2 14:48:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 49397 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1A1B620BD1 for ; Tue, 2 Jun 2015 14:51:23 +0000 (UTC) Received: by lbbqq2 with SMTP id qq2sf42653679lbb.0 for ; Tue, 02 Jun 2015 07:51:22 -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=bmwD8pO6EVeHZlLjy29uLzcgrOJQiN+JIP+cOGvgHbQ1Od9MYoyTaU0Ws2mQtP1tNU ZIyGXHXppWGUh4GvTChfnBBJQgwn5m/iO1FAeHqvwEP1Q+HjVTXm/7ZvtyiUGWc4SWyD vuBnezB352g8duSSv3sds3L1xrp0tmYpctNWRwxQxwzZMg3o69SxOIwNFHDUERDZwGaV cdgUDvuKNaA5BiTCPybU/4iF4KC0YpYObUZtjh6KL6+Tz+TLsuVqgn3eGyGZQyVXVqZH i8GltQfqfNpmPbZ1fOo12TJTmkKKK+I9usQJ224FrdW+2GbNVuOwLx/4Jv4A8yOS5aWe Io9w== X-Gm-Message-State: ALoCoQnOf7S4cexINd9bXFOkyTKkhMpaVLvHVXysNhA2mrNpa8bBzqysu/Huq1PvCT6lS95H7XQN X-Received: by 10.152.4.230 with SMTP id n6mr26180166lan.2.1433256682010; Tue, 02 Jun 2015 07:51:22 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.1.105 with SMTP id 9ls154742lal.17.gmail; Tue, 02 Jun 2015 07:51:21 -0700 (PDT) X-Received: by 10.152.5.164 with SMTP id t4mr26476126lat.16.1433256681865; Tue, 02 Jun 2015 07:51:21 -0700 (PDT) Received: from mail-lb0-f180.google.com (mail-lb0-f180.google.com. [209.85.217.180]) by mx.google.com with ESMTPS id bq3si15265800lbb.128.2015.06.02.07.51.21 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Jun 2015 07:51:21 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.180 as permitted sender) client-ip=209.85.217.180; Received: by lbcue7 with SMTP id ue7so106101797lbc.0 for ; Tue, 02 Jun 2015 07:51:21 -0700 (PDT) X-Received: by 10.152.4.137 with SMTP id k9mr26271508lak.29.1433256681764; Tue, 02 Jun 2015 07:51:21 -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 hn6csp3129662lbb; Tue, 2 Jun 2015 07:51:20 -0700 (PDT) X-Received: by 10.70.34.176 with SMTP id a16mr51073389pdj.66.1433256680051; Tue, 02 Jun 2015 07:51:20 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id po1si26750474pac.52.2015.06.02.07.51.19; Tue, 02 Jun 2015 07:51:20 -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 S1758907AbbFBOvS (ORCPT + 2 others); Tue, 2 Jun 2015 10:51:18 -0400 Received: from mail-ob0-f176.google.com ([209.85.214.176]:34490 "EHLO mail-ob0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753802AbbFBOvS (ORCPT ); Tue, 2 Jun 2015 10:51:18 -0400 Received: by obew15 with SMTP id w15so130030013obe.1 for ; Tue, 02 Jun 2015 07:51:17 -0700 (PDT) X-Received: by 10.182.68.13 with SMTP id r13mr23183942obt.20.1433256677863; Tue, 02 Jun 2015 07:51:17 -0700 (PDT) Received: from localhost ([167.160.116.34]) by mx.google.com with ESMTPSA id y123sm9603981oia.27.2015.06.02.07.51.15 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 02 Jun 2015 07:51:17 -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 22/32] arm/arm64: kvm: drop inappropriate use of kvm_is_mmio_pfn() Date: Tue, 2 Jun 2015 22:48:17 +0800 Message-Id: <1433256507-7856-23-git-send-email-shannon.zhao@linaro.org> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1433256507-7856-1-git-send-email-shannon.zhao@linaro.org> References: <1433256507-7856-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.180 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);