From patchwork Tue Dec 9 11:26:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 42039 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 EC3B8244AC for ; Tue, 9 Dec 2014 11:36:51 +0000 (UTC) Received: by mail-wg0-f69.google.com with SMTP id x12sf312513wgg.4 for ; Tue, 09 Dec 2014 03:36:51 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :content-type:content-transfer-encoding:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list; bh=c7BEO5hmT/1ZTzGXaFe6sNenAzcJEB/x0tMlZRviDXc=; b=P0T/RCfMnJX2ZrIpoQ3A86mX2mBcD4620rJzbemUVABV5NrRB0w5DvG1HPv9e0fGo1 zX+Zte8D2AkgdFWIMCpCj0p00Q39PEOVvznMKKD3DHS1ijMe62kJ0x3LS/YzSC7gZB6V u5M7uvVsO2tSw3n+YqN5lPeQF5Is/L15a0YwzUYrBFfGzYYL7x1lFG7tFl51M2FpOmev rdVnbnhXtbo8FZciYdl6ZXESBqVuavp/1zUPgqBBL0sYFKK9Z6LEgWErMDbGni2gE9RQ kyWQYFhyGATexcsdfG2tLxDOLq/t1xz/aWsQ27ektA8L5f/l3Ghf1lJc4zB3H1SdTYuV f0zw== X-Gm-Message-State: ALoCoQm0C3dUVA23eubozy10B0JEiZtmYAEyB0ERv6ByTNFSrWPGlerNTiyPbuUnyZXqTw+qNecU X-Received: by 10.112.171.167 with SMTP id av7mr1019580lbc.2.1418125011123; Tue, 09 Dec 2014 03:36:51 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.205.38 with SMTP id ld6ls26799lac.50.gmail; Tue, 09 Dec 2014 03:36:50 -0800 (PST) X-Received: by 10.152.203.137 with SMTP id kq9mr21194827lac.51.1418125010632; Tue, 09 Dec 2014 03:36:50 -0800 (PST) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com. [209.85.215.44]) by mx.google.com with ESMTPS id jb8si1047638lbc.58.2014.12.09.03.36.50 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 09 Dec 2014 03:36:50 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) client-ip=209.85.215.44; Received: by mail-la0-f44.google.com with SMTP id gd6so327311lab.31 for ; Tue, 09 Dec 2014 03:36:50 -0800 (PST) X-Received: by 10.152.87.100 with SMTP id w4mr21334058laz.71.1418125010506; Tue, 09 Dec 2014 03:36:50 -0800 (PST) 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.184.201 with SMTP id ew9csp739187lbc; Tue, 9 Dec 2014 03:36:49 -0800 (PST) X-Received: by 10.70.89.105 with SMTP id bn9mr29414409pdb.155.1418125008958; Tue, 09 Dec 2014 03:36:48 -0800 (PST) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id q8si1507514pds.51.2014.12.09.03.36.48 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Dec 2014 03:36:48 -0800 (PST) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XyIxF-0005wS-0K; Tue, 09 Dec 2014 11:27:45 +0000 Received: from mail-la0-f45.google.com ([209.85.215.45]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XyIvI-0004h4-CG for linux-arm-kernel@lists.infradead.org; Tue, 09 Dec 2014 11:25:45 +0000 Received: by mail-la0-f45.google.com with SMTP id gq15so313846lab.32 for ; Tue, 09 Dec 2014 03:25:21 -0800 (PST) X-Received: by 10.112.170.36 with SMTP id aj4mr21143227lbc.3.1418124321150; Tue, 09 Dec 2014 03:25:21 -0800 (PST) Received: from localhost.localdomain (188-178-240-98-static.dk.customer.tdc.net. [188.178.240.98]) by mx.google.com with ESMTPSA id w3sm279709law.36.2014.12.09.03.25.19 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 09 Dec 2014 03:25:20 -0800 (PST) From: Christoffer Dall To: Paolo Bonzini , kvm@vger.kernel.org Subject: [GIT PULL 2/9] arm/arm64: kvm: drop inappropriate use of kvm_is_mmio_pfn() Date: Tue, 9 Dec 2014 12:26:01 +0100 Message-Id: <1418124368-28418-3-git-send-email-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.1.2.330.g565301e.dirty In-Reply-To: <1418124368-28418-1-git-send-email-christoffer.dall@linaro.org> References: <1418124368-28418-1-git-send-email-christoffer.dall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141209_032544_605712_10BC0EC6 X-CRM114-Status: GOOD ( 10.93 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.215.45 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.215.45 listed in wl.mailspike.net] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders Cc: Marc Zyngier , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, Ard Biesheuvel X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: christoffer.dall@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.44 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 From: Ard Biesheuvel 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 --- 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 57a403a..b007438 100644 --- a/arch/arm/kvm/mmu.c +++ b/arch/arm/kvm/mmu.c @@ -834,6 +834,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 hva, unsigned long fault_status) @@ -904,7 +909,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);