From patchwork Sat Sep 13 10:17:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 37370 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 931AE206A5 for ; Sat, 13 Sep 2014 10:20:15 +0000 (UTC) Received: by mail-lb0-f199.google.com with SMTP id z11sf1042951lbi.10 for ; Sat, 13 Sep 2014 03:20:12 -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 :in-reply-to:references: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=aSXSYvTUDYbAnBa+Yv8OG4a/1mrQGBMBIQ3wmBS+f18=; b=Ry2q6nKyxziScpwIrbDxEuc15Fn+9ALZfIZOq1XXKlV/2eYqslXpiZjbutfouqJIdk 0HzLmCV2UsiZX4NnoC2iVBVGbKVRU+0OHqLgam2tyvGZvhBAZ3WtXy+YlzVWaLOSKMeD tPlmT7V7imZ/giA/EITGywM5LA/zDJ0eXUdznZusNt4jgOd1Gc+Gl+2ep0hbwe5DGkcC Reh9mL20nG/sQKmc3glPAmaIZKU0NNtgsgEoX5na4Ftu85kF8u26EDn46QpMzt9uGrGn +h2vRxnuMSMvV88kHk2k1So7kWqeZP4rO3384bsXqPy7lKL5IM3ROtBvq5nVlloPNY59 /Hcw== X-Gm-Message-State: ALoCoQldWkq8chNwCBE+b2vbt621AKJX9sUBS97KyHKWISAQKUB2jmpi7nfyBLHrMqCH6EQ2nvCV X-Received: by 10.180.37.211 with SMTP id a19mr2449315wik.6.1410603612801; Sat, 13 Sep 2014 03:20:12 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.225 with SMTP id w1ls264757lag.2.gmail; Sat, 13 Sep 2014 03:20:12 -0700 (PDT) X-Received: by 10.152.87.170 with SMTP id az10mr15166595lab.20.1410603612490; Sat, 13 Sep 2014 03:20:12 -0700 (PDT) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com [209.85.215.42]) by mx.google.com with ESMTPS id u9si6252319laj.8.2014.09.13.03.20.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 13 Sep 2014 03:20:12 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by mail-la0-f42.google.com with SMTP id hz20so2320869lab.1 for ; Sat, 13 Sep 2014 03:20:12 -0700 (PDT) X-Received: by 10.152.22.137 with SMTP id d9mr15069941laf.29.1410603612161; Sat, 13 Sep 2014 03:20:12 -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 rl10csp869124lbb; Sat, 13 Sep 2014 03:20:11 -0700 (PDT) X-Received: by 10.68.225.133 with SMTP id rk5mr20620376pbc.101.1410603609734; Sat, 13 Sep 2014 03:20:09 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id kt9si12969224pab.127.2014.09.13.03.20.09 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 13 Sep 2014 03:20:09 -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 1XSkPT-0000iP-QD; Sat, 13 Sep 2014 10:18:27 +0000 Received: from mail-wg0-f50.google.com ([74.125.82.50]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XSkPN-0000ex-6K for linux-arm-kernel@lists.infradead.org; Sat, 13 Sep 2014 10:18:21 +0000 Received: by mail-wg0-f50.google.com with SMTP id x13so1736464wgg.21 for ; Sat, 13 Sep 2014 03:17:58 -0700 (PDT) X-Received: by 10.180.212.78 with SMTP id ni14mr9570348wic.44.1410603478248; Sat, 13 Sep 2014 03:17:58 -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.56 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 13 Sep 2014 03:17:57 -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 2/2] arm64: kvm: define PAGE_S2_DEVICE as read-only by default Date: Sat, 13 Sep 2014 12:17:42 +0200 Message-Id: <1410603462-28900-2-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1410603462-28900-1-git-send-email-ard.biesheuvel@linaro.org> References: <1410603462-28900-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140913_031821_418058_3697DEA1 X-CRM114-Status: UNSURE ( 9.65 ) 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 [74.125.82.50 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [74.125.82.50 listed in wl.mailspike.net] -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.215.42 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/arm64/include/asm/pgtable.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index ffe1ba0506d1..51f6f5284ce5 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -79,7 +79,7 @@ extern void __pgd_error(const char *file, int line, unsigned long val); #define PAGE_HYP_DEVICE __pgprot(PROT_DEVICE_nGnRE | PTE_HYP) #define PAGE_S2 __pgprot(PROT_DEFAULT | PTE_S2_MEMATTR(MT_S2_NORMAL) | PTE_S2_RDONLY) -#define PAGE_S2_DEVICE __pgprot(PROT_DEFAULT | PTE_S2_MEMATTR(MT_S2_DEVICE_nGnRE) | PTE_S2_RDWR | PTE_UXN) +#define PAGE_S2_DEVICE __pgprot(PROT_DEFAULT | PTE_S2_MEMATTR(MT_S2_DEVICE_nGnRE) | PTE_S2_RDONLY | PTE_UXN) #define PAGE_NONE __pgprot(((_PAGE_DEFAULT) & ~PTE_TYPE_MASK) | PTE_PROT_NONE | PTE_PXN | PTE_UXN) #define PAGE_SHARED __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN | PTE_UXN | PTE_WRITE)