From patchwork Thu Jun 5 17:03:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonios Motakis X-Patchwork-Id: 4307461 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DAC5F9F387 for ; Thu, 5 Jun 2014 17:06:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 23069201E4 for ; Thu, 5 Jun 2014 17:06:40 +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 39611201B9 for ; Thu, 5 Jun 2014 17:06:39 +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 1Wsb5j-0002Hh-2y; Thu, 05 Jun 2014 17:04:39 +0000 Received: from mail-wi0-f182.google.com ([209.85.212.182]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Wsb5f-0002Ab-Vw for linux-arm-kernel@lists.infradead.org; Thu, 05 Jun 2014 17:04:37 +0000 Received: by mail-wi0-f182.google.com with SMTP id r20so3922196wiv.9 for ; Thu, 05 Jun 2014 10:04:10 -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=dU7IUKe6xyPfu7UtVsZbXY3HLQIMG3/ch+4l2Wa2xlQ=; b=TzFSPINc4SGgItDTWiL62QTRYGS+a5WKVFC2asxooBKS1Q8BrI2CMapbc9n1CCYqt1 z/VPUiPgoDzB1u3j7PnGe3jMpPIS4LqVSxZk7bAsNJIcQnmQ2zBgeFerqJfc8sTenFNr 2SjIiZXBrZjFV0c4VcTG+LdGLzW48KJN1LUC9EnuP87DI2mxxr/79cOMmMVr7thr1tG7 CCFFvSapUUj75jBu9jBfj5SMoq1E4uDM2u/G7YrQXNpG/hKBFt4ZlDrZ3NOVov1xZ3g5 dJvc5x6p/2FvmJyxVk/9SZAqaiITtmR3FC6bZu8gQbtNUdSYePIov5nSXkylcv8YuAL9 Wwyg== X-Gm-Message-State: ALoCoQmsrmc3ujL2NHB+PMLQ19mXLPpmQXI/sey8P6mWCDrL4oF6bXHLFyCHGCgXcMGs5M2sXXYv X-Received: by 10.180.149.240 with SMTP id ud16mr17851555wib.3.1401987849829; Thu, 05 Jun 2014 10:04:09 -0700 (PDT) Received: from localhost.localdomain (home.tvelocity.eu. [82.67.68.96]) by mx.google.com with ESMTPSA id ch16sm8777323wjb.25.2014.06.05.10.04.06 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 05 Jun 2014 10:04:08 -0700 (PDT) From: Antonios Motakis To: alex.williamson@redhat.com, kvmarm@lists.cs.columbia.edu, iommu@lists.linux-foundation.org Subject: [RFC PATCH v6 01/20] iommu/arm-smmu: change IOMMU_EXEC to IOMMU_NOEXEC Date: Thu, 5 Jun 2014 19:03:09 +0200 Message-Id: <1401987808-23596-2-git-send-email-a.motakis@virtualopensystems.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1401987808-23596-1-git-send-email-a.motakis@virtualopensystems.com> References: <1401987808-23596-1-git-send-email-a.motakis@virtualopensystems.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140605_100436_171785_CCFED97B X-CRM114-Status: GOOD ( 12.68 ) X-Spam-Score: -0.7 (/) Cc: Shuah Khan , kim.phillips@freescale.com, "Upinder Malhi \(umalhi\)" , kvm@vger.kernel.org, eric.auger@linaro.org, Alexey Kardashevskiy , open list , Joerg Roedel , will.deacon@arm.com, a.rigo@virtualopensystems.com, stuart.yoder@freescale.com, "moderated list:ARM SMMU DRIVER" , Varun Sethi , Antonios Motakis , tech@virtualopensystems.com, christoffer.dall@linaro.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 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.5 required=5.0 tests=BAYES_00,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 Exposing the XN flag of the SMMU driver as IOMMU_NOEXEC instead of IOMMU_EXEC makes it enforceable, since for IOMMUs that don't support the XN flag pages will always be executable. Signed-off-by: Antonios Motakis --- drivers/iommu/arm-smmu.c | 2 +- include/linux/iommu.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 647c3c7..d5a2200 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -1294,7 +1294,7 @@ static int arm_smmu_alloc_init_pte(struct arm_smmu_device *smmu, pmd_t *pmd, } /* If no access, create a faulting entry to avoid TLB fills */ - if (prot & IOMMU_EXEC) + if (!(prot & IOMMU_NOEXEC)) pteval &= ~ARM_SMMU_PTE_XN; else if (!(prot & (IOMMU_READ | IOMMU_WRITE))) pteval &= ~ARM_SMMU_PTE_PAGE; diff --git a/include/linux/iommu.h b/include/linux/iommu.h index b96a5b2..fc464d2 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -27,7 +27,7 @@ #define IOMMU_READ (1 << 0) #define IOMMU_WRITE (1 << 1) #define IOMMU_CACHE (1 << 2) /* DMA cache coherency */ -#define IOMMU_EXEC (1 << 3) +#define IOMMU_NOEXEC (1 << 3) struct iommu_ops; struct iommu_group;