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: 37545 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f199.google.com (mail-we0-f199.google.com [74.125.82.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C031E2054D for ; Wed, 17 Sep 2014 21:58:47 +0000 (UTC) Received: by mail-we0-f199.google.com with SMTP id q58sf1241901wes.2 for ; Wed, 17 Sep 2014 14:58:46 -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=WtvmhF6Eb50RQ+3nIyL9BO1ywOEHCnU6gE6FYVfHPrw=; b=kUpi3Q30RH+rjmWSTB7rkFV3lVoX7ECDEP2lFmZZuAyZBMVdV4SdK4idFodF8jD38z KJmCAn66XAUfpckEjbUX7l8m++lDafxajvtEisB6D+V5yBQOm6868u6tE0IV8OYeoQbf QxJZZkdLsfC2iIqHwBLI6QYYLmdLcUJdy8MNLwtneN/ppzL1Vqo1imSiHpnje+Jh5IY/ cL6VvwnCJNrLMBqeqOu4eczF5b9ds0gZpLl0aKBLU4Vt9AWK4G8zRbiV4tZPME+hirCt cg/QgFt2tpJXJ6Kjc11lunIRFrELoJ0BA1uAWA7pDPGYm8yk9Cxv+qgyRmqN7vZfjB8H LcNA== X-Gm-Message-State: ALoCoQnOf/amLPne3aRJFxUZp6s1jT1KNTJCGalC3xkTBOan/H3MgMo0SUIjNNz38DErByrv2h85 X-Received: by 10.180.81.226 with SMTP id d2mr8181619wiy.5.1410991126648; Wed, 17 Sep 2014 14:58:46 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.183.201 with SMTP id eo9ls175590lac.20.gmail; Wed, 17 Sep 2014 14:58:46 -0700 (PDT) X-Received: by 10.152.36.37 with SMTP id n5mr370722laj.93.1410991126299; Wed, 17 Sep 2014 14:58:46 -0700 (PDT) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com [209.85.215.46]) by mx.google.com with ESMTPS id od10si30315782lbc.20.2014.09.17.14.58.46 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 17 Sep 2014 14:58:46 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by mail-la0-f46.google.com with SMTP id el20so2720361lab.5 for ; Wed, 17 Sep 2014 14:58:46 -0700 (PDT) X-Received: by 10.112.163.103 with SMTP id yh7mr59084lbb.73.1410991126218; Wed, 17 Sep 2014 14:58: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.130.169 with SMTP id of9csp661947lbb; Wed, 17 Sep 2014 14:58:45 -0700 (PDT) X-Received: by 10.70.88.198 with SMTP id bi6mr353521pdb.64.1410991124494; Wed, 17 Sep 2014 14:58:44 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id jd10si27705344pbd.104.2014.09.17.14.58.43 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Sep 2014 14:58:44 -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 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-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 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.192.174 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.2 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.192.174 listed in wl.mailspike.net] 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+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.46 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 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)