From patchwork Wed May 4 11:40:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 9012511 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A9737BF29F for ; Wed, 4 May 2016 11:42:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CE2FF2039D for ; Wed, 4 May 2016 11:42:03 +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 E56CD2039C for ; Wed, 4 May 2016 11:42:02 +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 1axvAU-0001YV-TR; Wed, 04 May 2016 11:40:38 +0000 Received: from mail-wm0-x22e.google.com ([2a00:1450:400c:c09::22e]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1axvAR-0001U0-IS for linux-arm-kernel@lists.infradead.org; Wed, 04 May 2016 11:40:36 +0000 Received: by mail-wm0-x22e.google.com with SMTP id a17so88923575wme.0 for ; Wed, 04 May 2016 04:40:19 -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=i801V8zMMWJV3bLygoCI9dN3U7Fbq7CChgEOob4xi0E=; b=OpTQk2E+i8qADMShWBlfCBQb/1ZFNyNdnj5aq01e8of97006Lav5Zu6IrVxb6BrgaC U03wP/zNJK2n+YJwqPIedjzx4xQDt35ChCrJC33cw/rtnyvuQxFQ3zUWRE8c0eOYQbp0 zrQZRYtuD8yAWakfldIf6j0t82qF/oPnJRuL4= 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=i801V8zMMWJV3bLygoCI9dN3U7Fbq7CChgEOob4xi0E=; b=TwX/iP4UV9extEHCz3zUZrcRFNDB71ela7JPSGYLaFeM6VRvWCf9lOT3eabfChaCmv /KvoNhSDtN7wRxKMOXdeIrueRaYQxsaLL9W6jP4C6Q7qBsHN26cUiuF6dCrGWyzhWaCt pClw+PfKVsrJmtBTZIGBYT836dI/Fo+2h74O5TssDzua1f8KbDr/8tglwjyfrvRxS1y5 pOt2GZQtLvRdPw8h8Q/QLMyudXeUhIiKCWYvx4b0ZggWGdUOy+jzEmKxFG8LZCWT3O4X f4FajCie4X9LHTZ7qpyNiZk4yzs8AnS6UnjVhfLzVjyMZCJ/Qf6ymG/op4LTGjw1K3bU vlvA== X-Gm-Message-State: AOPr4FX0ZVn1md5WKguqAVwsflcQFnECxiyagojxmd2zW2pxfsHW1X2GElwlP3UnyEqUMPRi X-Received: by 10.194.108.197 with SMTP id hm5mr8210007wjb.167.1462362018756; Wed, 04 May 2016 04:40:18 -0700 (PDT) Received: from new-host-61.home (LMontsouris-657-1-37-90.w80-11.abo.wanadoo.fr. [80.11.198.90]) by smtp.gmail.com with ESMTPSA id u6sm3766963wjh.2.2016.05.04.04.40.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 04 May 2016 04:40:17 -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 v9 2/8] iommu/arm-smmu: initialize the msi geometry and advertise iommu-msi support Date: Wed, 4 May 2016 11:40:01 +0000 Message-Id: <1462362007-2753-3-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1462362007-2753-1-git-send-email-eric.auger@linaro.org> References: <1462362007-2753-1-git-send-email-eric.auger@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160504_044035_768484_4FBDFB2C X-CRM114-Status: GOOD ( 11.75 ) 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, yehuday@marvell.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=-6.2 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 the support of the IOMMU-MSI API. Signed-off-by: Eric Auger --- v8 -> v9: - reword the title and patch description 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);