From patchwork Mon Jun 30 10:52:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 32689 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qg0-f72.google.com (mail-qg0-f72.google.com [209.85.192.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6EC6A203F4 for ; Mon, 30 Jun 2014 10:54:24 +0000 (UTC) Received: by mail-qg0-f72.google.com with SMTP id q107sf4692042qgd.3 for ; Mon, 30 Jun 2014 03:54:24 -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=alg2nWpgItCgcGPlmFTNpk3Ni3FVmBG9FPvpUbrbQCo=; b=bc/DnK2SxbGoP4pkZ67GTTHJG+l228iwZgICq3S3f0SQgGo9N7F+h79tvZFMa4s6nr NkTiv9UORMrdzPf4Y1krVhShIpmeZ05f+EawgTTD0+dV4kicIH4M/e6IktmXRq5Pq5WT YQnb3YuMqRgisTMFQQHgswCHABAtJYEpQzpupPaeCixqeJG1jgKMvOqev7YHHjNZeiDX v4r+hO5poOkQS8zkvqD9YX5tgl4vGNjTQlK/SrS57gb8BFLNgHebAZClor9eu9X7zvZz hJy0nWGIADsrEq/Vt5NhUvYgaTRkNM1gYlQuuAKmEW0e2lu/VrbdE3gpBSlIS2hFgEcL Vh4g== X-Gm-Message-State: ALoCoQmSCaPs2unWsQHM9MBWjFXejtc1soxS5Z3Avv2HShbQWDj6z8uOzm2D7bEr5fccVzHjPxqp X-Received: by 10.58.172.5 with SMTP id ay5mr22396383vec.37.1404125664288; Mon, 30 Jun 2014 03:54:24 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.46.99 with SMTP id j90ls1405879qga.49.gmail; Mon, 30 Jun 2014 03:54:24 -0700 (PDT) X-Received: by 10.52.92.82 with SMTP id ck18mr31320901vdb.6.1404125664206; Mon, 30 Jun 2014 03:54:24 -0700 (PDT) Received: from mail-ve0-f171.google.com (mail-ve0-f171.google.com [209.85.128.171]) by mx.google.com with ESMTPS id yk7si9865994vec.98.2014.06.30.03.54.24 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 30 Jun 2014 03:54:24 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.171 as permitted sender) client-ip=209.85.128.171; Received: by mail-ve0-f171.google.com with SMTP id jz11so7929220veb.16 for ; Mon, 30 Jun 2014 03:54:24 -0700 (PDT) X-Received: by 10.220.250.203 with SMTP id mp11mr37331330vcb.2.1404125664122; Mon, 30 Jun 2014 03:54:24 -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.221.37.5 with SMTP id tc5csp126696vcb; Mon, 30 Jun 2014 03:54:23 -0700 (PDT) X-Received: by 10.66.141.109 with SMTP id rn13mr51784381pab.117.1404125663419; Mon, 30 Jun 2014 03:54:23 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id ei3si22692836pbb.219.2014.06.30.03.54.23 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Jun 2014 03:54:23 -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 1X1ZDB-0002GP-2b; Mon, 30 Jun 2014 10:53:25 +0000 Received: from cam-admin0.cambridge.arm.com ([217.140.96.50]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X1ZCT-0001dq-J1 for linux-arm-kernel@lists.infradead.org; Mon, 30 Jun 2014 10:52:43 +0000 Received: from edgewater-inn.cambridge.arm.com (edgewater-inn.cambridge.arm.com [10.1.203.161]) by cam-admin0.cambridge.arm.com (8.12.6/8.12.6) with ESMTP id s5UAq8wo016226; Mon, 30 Jun 2014 11:52:08 +0100 (BST) Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id A01B01AE0041; Mon, 30 Jun 2014 11:52:14 +0100 (BST) From: Will Deacon To: linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org Subject: [PATCH 5/5] iommu/arm-smmu: prefer stage-1 mappings where we have a choice Date: Mon, 30 Jun 2014 11:52:10 +0100 Message-Id: <1404125530-17984-6-git-send-email-will.deacon@arm.com> X-Mailer: git-send-email 2.0.0 In-Reply-To: <1404125530-17984-1-git-send-email-will.deacon@arm.com> References: <1404125530-17984-1-git-send-email-will.deacon@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140630_035242_027609_5142F91C X-CRM114-Status: GOOD ( 11.05 ) X-Spam-Score: -5.0 (-----) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-5.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [217.140.96.50 listed in list.dnswl.org] -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record Cc: ohaugan@codeaurora.org, arnd@arndb.de, marc.zyngier@arm.com, joro@8bytes.org, Will Deacon , thierry.reding@gmail.com, a.motakis@virtualopensystems.com, Varun.Sethi@freescale.com 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: will.deacon@arm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.171 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 For an SMMU that supports both Stage-1 and Stage-2 mappings (but not nested translation), then we should prefer stage-1 mappings as we otherwise rely on the memory attributes of the incoming transactions for IOMMU_CACHE mappings. Signed-off-by: Will Deacon --- drivers/iommu/arm-smmu.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 60986de3ada8..a6e38982d09c 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -876,12 +876,12 @@ static int arm_smmu_init_domain_context(struct iommu_domain *domain, */ cfg->cbar = CBAR_TYPE_S1_TRANS_S2_BYPASS; start = smmu->num_s2_context_banks; - } else if (smmu->features & ARM_SMMU_FEAT_TRANS_S2) { - cfg->cbar = CBAR_TYPE_S2_TRANS; - start = 0; - } else { + } else if (smmu->features & ARM_SMMU_FEAT_TRANS_S1) { cfg->cbar = CBAR_TYPE_S1_TRANS_S2_BYPASS; start = smmu->num_s2_context_banks; + } else { + cfg->cbar = CBAR_TYPE_S2_TRANS; + start = 0; } ret = __arm_smmu_alloc_bitmap(smmu->context_map, start,