From patchwork Sat Sep 13 10:17:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 37369 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 96D2C206A5 for ; Sat, 13 Sep 2014 10:20:09 +0000 (UTC) Received: by mail-wi0-f198.google.com with SMTP id cc10sf919047wib.1 for ; Sat, 13 Sep 2014 03:20:08 -0700 (PDT) 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:cc :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:mime-version:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list :content-type:content-transfer-encoding; bh=WtvmhF6Eb50RQ+3nIyL9BO1ywOEHCnU6gE6FYVfHPrw=; b=XKNfSQNVFUnrDq0ppIqDGLy6p4RLnLxIb5TRu+FbzL0iR5G53uYbUkit3NcMZto/Jg EZasYZrWCPNZUe0ZPnEbHCMbp7rwR/NNN+zlKnurtOdT7gGPyUvgPV5k3FySYUX0vvSb L2JFg/GR65SOmHwDrWyvIQYdBpBXp9WlzFnh834jdMl1NuiG+exr7FHYFocdninQhNVj 70i7onLecvK3VDkmvvRPuhiqp7UNTtWQ0jipIObtpfB0xMCJC3OSh7rHa1Fnin5blPqi nlMywDMH/MUCLJ5Ql0PJQ/7LQGn+9ylA0m5HjSMoTMQ1F2WKzGW+PstvMmNM9kofr3xX RGZw== X-Gm-Message-State: ALoCoQle1asl44NZH6k2M7yxYcxvubMq7C0t4OE+sh5i+DSONHRTFghG6T3zm4SX4K2V8b2xh81k X-Received: by 10.194.203.40 with SMTP id kn8mr4052212wjc.4.1410603608811; Sat, 13 Sep 2014 03:20:08 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.28.134 with SMTP id b6ls242274lah.42.gmail; Sat, 13 Sep 2014 03:20:08 -0700 (PDT) X-Received: by 10.152.1.6 with SMTP id 6mr15188728lai.22.1410603608494; Sat, 13 Sep 2014 03:20:08 -0700 (PDT) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com [209.85.217.179]) by mx.google.com with ESMTPS id se3si10608235lbb.22.2014.09.13.03.20.08 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 13 Sep 2014 03:20:08 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) client-ip=209.85.217.179; Received: by mail-lb0-f179.google.com with SMTP id p9so2101861lbv.24 for ; Sat, 13 Sep 2014 03:20:08 -0700 (PDT) X-Received: by 10.112.33.74 with SMTP id p10mr14185959lbi.0.1410603607981; Sat, 13 Sep 2014 03:20:07 -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.141.42 with SMTP id rl10csp869117lbb; Sat, 13 Sep 2014 03:20:07 -0700 (PDT) X-Received: by 10.66.146.35 with SMTP id sz3mr20470745pab.148.1410603606449; Sat, 13 Sep 2014 03:20:06 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id u3si12974404pdm.128.2014.09.13.03.20.05 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 13 Sep 2014 03:20:06 -0700 (PDT) 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 1XSkPO-0000h8-CJ; Sat, 13 Sep 2014 10:18:22 +0000 Received: from mail-wi0-f179.google.com ([209.85.212.179]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XSkPL-0000eY-OZ for linux-arm-kernel@lists.infradead.org; Sat, 13 Sep 2014 10:18:20 +0000 Received: by mail-wi0-f179.google.com with SMTP id hi2so1889550wib.6 for ; Sat, 13 Sep 2014 03:17:56 -0700 (PDT) X-Received: by 10.194.203.73 with SMTP id ko9mr18661093wjc.101.1410603476070; Sat, 13 Sep 2014 03:17:56 -0700 (PDT) Received: from ards-macbook-pro.local (cag06-7-83-153-85-71.fbx.proxad.net. [83.153.85.71]) by mx.google.com with ESMTPSA id kw2sm7321444wjb.30.2014.09.13.03.17.54 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 13 Sep 2014 03:17:55 -0700 (PDT) From: Ard Biesheuvel To: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, christoffer.dall@linaro.org, marc.zyngier@arm.com, linux@arm.linux.org.uk, will.deacon@arm.com, catalin.marinas@arm.com Subject: [PATCH 1/2] ARM: kvm: define PAGE_S2_DEVICE as read-only by default Date: Sat, 13 Sep 2014 12:17:41 +0200 Message-Id: <1410603462-28900-1-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140913_031819_955608_AABCD0AD X-CRM114-Status: UNSURE ( 9.27 ) X-CRM114-Notice: Please train this message. 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.212.179 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.212.179 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders Cc: 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: ard.biesheuvel@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.179 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 Now that we support read-only memslots, we need to make sure that pass-through device mappings are not mapped writable if the guest has requested them to be read-only. The existing implementation already honours this by calling kvm_set_s2pte_writable() on the new pte in case of writable mappings, so all we need to do is define the default pgprot_t value used for devices to be PTE_S2_RDONLY. Signed-off-by: Ard Biesheuvel --- arch/arm/include/asm/pgtable.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h index 01baef07cd0c..92b2fbe18868 100644 --- a/arch/arm/include/asm/pgtable.h +++ b/arch/arm/include/asm/pgtable.h @@ -100,7 +100,7 @@ extern pgprot_t pgprot_s2_device; #define PAGE_HYP _MOD_PROT(pgprot_kernel, L_PTE_HYP) #define PAGE_HYP_DEVICE _MOD_PROT(pgprot_hyp_device, L_PTE_HYP) #define PAGE_S2 _MOD_PROT(pgprot_s2, L_PTE_S2_RDONLY) -#define PAGE_S2_DEVICE _MOD_PROT(pgprot_s2_device, L_PTE_S2_RDWR) +#define PAGE_S2_DEVICE _MOD_PROT(pgprot_s2_device, L_PTE_S2_RDONLY) #define __PAGE_NONE __pgprot(_L_PTE_DEFAULT | L_PTE_RDONLY | L_PTE_XN | L_PTE_NONE) #define __PAGE_SHARED __pgprot(_L_PTE_DEFAULT | L_PTE_USER | L_PTE_XN)