From patchwork Wed Sep 17 21:56:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 4927311 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 22495BEEA5 for ; Wed, 17 Sep 2014 21:59:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 539B720179 for ; Wed, 17 Sep 2014 21:59:33 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3E67F2015E for ; Wed, 17 Sep 2014 21:59:32 +0000 (UTC) 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 1XUNE3-0001zZ-9r; Wed, 17 Sep 2014 21:57:23 +0000 Received: from mail-pd0-f174.google.com ([209.85.192.174]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XUNDd-0001l2-3s for linux-arm-kernel@lists.infradead.org; Wed, 17 Sep 2014 21:56:57 +0000 Received: by mail-pd0-f174.google.com with SMTP id v10so2943547pde.5 for ; Wed, 17 Sep 2014 14:56:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=4MkD1lfApyl9YTbQ8iOO+pVgovWLRZMxwX4XGVFLA2I=; b=IU3gFURzCavw0IwTvy+kH8wGr4MK7IDMeB9CN7ULRT/MP3/LhzVT3TzKZtkj7olGLQ YhOsT3LNMAZHc6HYxv3dJG6HASn6+bOOiSbe+Ec0soctiRI/D0Uw0U7Xkklfl1Ip1GGm Y/CDsmGbYZUTwqldz3DoWhSVEhYJYrg3GS3fQnyz4c0y0jzSyOe3KfK1CVtGANL5jvCk MZQqpGEbNmlMAL5I1qCYNgDZYxXlT9zp0tz0+8j61QXdLo4v30Y6pG2OISEoJyYKUiHx +sBr2Rc+3BaHIiqiD1q5/jBIfffP4nJFv7FpPTYBeMbfYgg6rkPs9J7xbaotO7x/UXaN Jugw== X-Gm-Message-State: ALoCoQn1xN8R2PaZeR4ke5VPwKQha3D4oAfQaD6MgIMPDLmQOOjdACjYeGcg5WrAahZms15Jwfxt X-Received: by 10.70.125.165 with SMTP id mr5mr274923pdb.102.1410990996210; Wed, 17 Sep 2014 14:56:36 -0700 (PDT) Received: from ards-macbook-pro.swisscom.com (70-35-38-154.static.wiline.com. [70.35.38.154]) by mx.google.com with ESMTPSA id v1sm17771310pdn.93.2014.09.17.14.56.34 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 17 Sep 2014 14:56:35 -0700 (PDT) From: Ard Biesheuvel To: christoffer.dall@linaro.org, marc.zyngier@arm.com, linux@arm.linux.org.uk, catalin.marinas@arm.com Subject: [PATCH 4/6] ARM: kvm: define PAGE_S2_DEVICE as read-only by default Date: Wed, 17 Sep 2014 14:56:19 -0700 Message-Id: <1410990981-665-5-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1410990981-665-1-git-send-email-ard.biesheuvel@linaro.org> References: <1410990981-665-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140917_145657_211447_3FAEA512 X-CRM114-Status: UNSURE ( 9.59 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.9 (/) Cc: 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+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Acked-by: Christoffer Dall Acked-by: Marc Zyngier --- 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)