From patchwork Thu Apr 30 09:25:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 47780 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1C0CB20553 for ; Thu, 30 Apr 2015 09:25:48 +0000 (UTC) Received: by lbos2 with SMTP id s2sf12903181lbo.2 for ; Thu, 30 Apr 2015 02:25:47 -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=vJVIoa5JGtJZqya8El+DbbjDzKszBqYTGXIHj3ULZ78=; b=Rqjj9dF50qPNpwMi2emhJPZtAAk567QrwQ00ps5KAvqFL6sNK0RGWoCJSie0dWAUIe jL4OUXb1+YOOIrCZYZpNH2siwZunh8+NMQG3JeDy/bdY3+GKbtwEgNPkSQxbroumNdJg PXMq6DxDIzMl5FPzJ0C02g8iYCchhjZlDRBqqQfz533yyME11bto0JR7lKwEk0lDjiqT 1O069RgJJvZBVaLi3NTcuuudpzgSvF/tS69j9g0GYsMVFdZaN6DfZbytFid9tYEp6FxY dIzRkh58x+8ydS3KddYjZV+SMplSHXALkHfMW3FDYLHeW0tZEqZDvqCqfRifTgGUcy27 Qo2A== X-Gm-Message-State: ALoCoQl8u82KsghM5SAlTUTkHUg5RyL+qrLezurVst/WD9yHeZgQNNMbsiCc2yAGkaXJFzgkkTm5 X-Received: by 10.112.26.5 with SMTP id h5mr2056131lbg.4.1430385947111; Thu, 30 Apr 2015 02:25:47 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.178.195 with SMTP id da3ls353982lac.43.gmail; Thu, 30 Apr 2015 02:25:47 -0700 (PDT) X-Received: by 10.152.115.173 with SMTP id jp13mr2910960lab.119.1430385946998; Thu, 30 Apr 2015 02:25:46 -0700 (PDT) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id l8si1340457lah.54.2015.04.30.02.25.46 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Apr 2015 02:25:46 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by labbd9 with SMTP id bd9so39603869lab.2 for ; Thu, 30 Apr 2015 02:25:46 -0700 (PDT) X-Received: by 10.112.198.74 with SMTP id ja10mr3001271lbc.19.1430385946885; Thu, 30 Apr 2015 02:25:46 -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 l1csp2995460lbt; Thu, 30 Apr 2015 02:25:46 -0700 (PDT) X-Received: by 10.68.229.136 with SMTP id sq8mr6587514pbc.160.1430385931415; Thu, 30 Apr 2015 02:25:31 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id nf2si2640288pbc.149.2015.04.30.02.25.30; Thu, 30 Apr 2015 02:25:31 -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 S1751152AbbD3JZ0 (ORCPT + 2 others); Thu, 30 Apr 2015 05:25:26 -0400 Received: from ip4-83-240-67-251.cust.nbox.cz ([83.240.67.251]:52967 "EHLO ip4-83-240-18-248.cust.nbox.cz" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751281AbbD3JZO (ORCPT ); Thu, 30 Apr 2015 05:25:14 -0400 Received: from ku by ip4-83-240-18-248.cust.nbox.cz with local (Exim 4.85) (envelope-from ) id 1YnkiW-0005PJ-Dm; Thu, 30 Apr 2015 11:25:12 +0200 From: Jiri Slaby To: stable@vger.kernel.org Cc: Ard Biesheuvel , Marc Zyngier , Shannon Zhao , Jiri Slaby Subject: [patch added to the 3.12 stable tree] arm/arm64: kvm: drop inappropriate use of kvm_is_mmio_pfn() Date: Thu, 30 Apr 2015 11:25:01 +0200 Message-Id: <1430385911-20480-53-git-send-email-jslaby@suse.cz> X-Mailer: git-send-email 2.3.5 In-Reply-To: <1430385911-20480-1-git-send-email-jslaby@suse.cz> References: <1430385911-20480-1-git-send-email-jslaby@suse.cz> 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: patch@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.54 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 This patch has been added to the 3.12 stable tree. If you have any objections, please let us 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);