From patchwork Thu Apr 28 08:15:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 8966141 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1A6AE9F1C1 for ; Thu, 28 Apr 2016 08:17:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 436FE2022A for ; Thu, 28 Apr 2016 08:17:28 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 74A8E20225 for ; Thu, 28 Apr 2016 08:17:27 +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 1avh7N-0000VP-H7; Thu, 28 Apr 2016 08:16:13 +0000 Received: from mail-wm0-x233.google.com ([2a00:1450:400c:c09::233]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1avh78-0000Io-AO for linux-arm-kernel@lists.infradead.org; Thu, 28 Apr 2016 08:15:59 +0000 Received: by mail-wm0-x233.google.com with SMTP id n129so55526203wmn.1 for ; Thu, 28 Apr 2016 01:15:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=fM6Akdk7IP0VZTdAd5hWXNvztJbfa8UfrSZudx4WGPc=; b=FqtP+y5A8od3sYbxwBkSVXMvJczuCb/XEcFoXP6ik/a9vyG8/gr0ldX2nA/Kn3Q6Rd p+FoFrPkjRDIQhaW5qQxjGxgg2kyukaoboPI7ybpeeFjJfYPCegEuuxG9pLn/7PTUMzP H1Ydnrw7By40nznu/8SMA6dOe8oomhqCCrn4I= 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=fM6Akdk7IP0VZTdAd5hWXNvztJbfa8UfrSZudx4WGPc=; b=Cwpb7YFhAN4gIeZGJTaYd9nVWdvCHLJhffomb6dDpcTmR4gwWrzNH8YYcwX3E/XY4x HeH16HvtYCMRjeFW9+Papqkb1vwqIBJ92vVvoPodkRsZoGoQcg8pq9/gwQQlikl3T318 wB+F1TbGeQ3zNbCQibdqvdKgqdxXROxzUHEbFlv5YJASC2r7kmhaLDE6Sq3/rNTZwvyw VJ81OkATbSh9OP5bchxlUtAut+bl+Jxm52IXuQisbDfwLCq0MQkfKzJ5Z5hVU6C6ba33 enT2U6XebDEqJFHkoL54THEUcAzHrCeBDQ4Ne7YZkzwl+rmtCqdDmPn4+2FYYQelfjKT LLVA== X-Gm-Message-State: AOPr4FWna+xJ13J8i7tlAJaaGYGZR7eT30jxvWBzNoBq0l7lqsTbYCVt4+PjjWahZ74IjuOH X-Received: by 10.194.0.113 with SMTP id 17mr13844305wjd.128.1461831336656; Thu, 28 Apr 2016 01:15:36 -0700 (PDT) Received: from new-host-46.home (LMontsouris-657-1-37-90.w80-11.abo.wanadoo.fr. [80.11.198.90]) by smtp.gmail.com with ESMTPSA id h8sm12749860wmd.2.2016.04.28.01.15.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 Apr 2016 01:15:35 -0700 (PDT) From: Eric Auger To: eric.auger@st.com, eric.auger@linaro.org, robin.murphy@arm.com, alex.williamson@redhat.com, will.deacon@arm.com, joro@8bytes.org, tglx@linutronix.de, jason@lakedaemon.net, marc.zyngier@arm.com, christoffer.dall@linaro.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v8 2/8] iommu/arm-smmu: sets the MSI geometry to programmable Date: Thu, 28 Apr 2016 08:15:17 +0000 Message-Id: <1461831323-5480-3-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1461831323-5480-1-git-send-email-eric.auger@linaro.org> References: <1461831323-5480-1-git-send-email-eric.auger@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160428_011558_533785_042C88AF X-CRM114-Status: GOOD ( 11.03 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: julien.grall@arm.com, patches@linaro.org, Jean-Philippe.Brucker@arm.com, p.fedin@samsung.com, linux-kernel@vger.kernel.org, Bharat.Bhushan@freescale.com, iommu@lists.linux-foundation.org, pranav.sawargaonkar@gmail.com 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=-5.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,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 On ARM, MSI write transactions from device upstream to the smmu are conveyed through the iommu. Therefore target physical addresses must be mapped and DOMAIN_ATTR_MSI_GEOMETRY advertises a programmable MSI IOVA region. Signed-off-by: Eric Auger --- v7 -> v8: - use DOMAIN_ATTR_MSI_GEOMETRY v4 -> v5: - don't handle fsl_pamu_domain anymore - handle arm-smmu-v3 --- drivers/iommu/arm-smmu-v3.c | 2 ++ drivers/iommu/arm-smmu.c | 3 +++ 2 files changed, 5 insertions(+) diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index 4ff73ff..bf222b5 100644 --- a/drivers/iommu/arm-smmu-v3.c +++ b/drivers/iommu/arm-smmu-v3.c @@ -1396,6 +1396,7 @@ static bool arm_smmu_capable(enum iommu_cap cap) static struct iommu_domain *arm_smmu_domain_alloc(unsigned type) { struct arm_smmu_domain *smmu_domain; + struct iommu_domain_msi_geometry msi_geometry = {0, 0, true}; if (type != IOMMU_DOMAIN_UNMANAGED && type != IOMMU_DOMAIN_DMA) return NULL; @@ -1414,6 +1415,7 @@ static struct iommu_domain *arm_smmu_domain_alloc(unsigned type) kfree(smmu_domain); return NULL; } + smmu_domain->domain.msi_geometry = msi_geometry; mutex_init(&smmu_domain->init_mutex); spin_lock_init(&smmu_domain->pgtbl_lock); diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 7c39ac4..55f429d 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -976,6 +976,7 @@ static void arm_smmu_destroy_domain_context(struct iommu_domain *domain) static struct iommu_domain *arm_smmu_domain_alloc(unsigned type) { struct arm_smmu_domain *smmu_domain; + struct iommu_domain_msi_geometry msi_geometry = {0, 0, true}; if (type != IOMMU_DOMAIN_UNMANAGED && type != IOMMU_DOMAIN_DMA) return NULL; @@ -994,6 +995,8 @@ static struct iommu_domain *arm_smmu_domain_alloc(unsigned type) return NULL; } + smmu_domain->domain.msi_geometry = msi_geometry; + mutex_init(&smmu_domain->init_mutex); spin_lock_init(&smmu_domain->pgtbl_lock);