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: Auger Eric X-Patchwork-Id: 67115 Delivered-To: patches@linaro.org Received: by 10.140.92.199 with SMTP id b65csp129523qge; Wed, 4 May 2016 04:40:23 -0700 (PDT) X-Received: by 10.194.189.231 with SMTP id gl7mr8705478wjc.129.1462362019267; Wed, 04 May 2016 04:40:19 -0700 (PDT) Return-Path: Received: from mail-wm0-x233.google.com (mail-wm0-x233.google.com. [2a00:1450:400c:c09::233]) by mx.google.com with ESMTPS id gh2si4319575wjb.232.2016.05.04.04.40.18 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 May 2016 04:40:19 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 2a00:1450:400c:c09::233 as permitted sender) client-ip=2a00:1450:400c:c09::233; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: domain of eric.auger@linaro.org designates 2a00:1450:400c:c09::233 as permitted sender) smtp.mailfrom=eric.auger@linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by mail-wm0-x233.google.com with SMTP id n129so184765902wmn.1 for ; Wed, 04 May 2016 04:40:18 -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=IH8p5aQxLA8BiEDdT0vWUU9GCVAnLyB72e/DFesy3CRpRh4jvvMIemEdnVj+t5fi3O 5mIpuATlbS3zrWuAHowV1VykTBj9F0L3Ame3jLWEw/l5F8n1unt9Dn5b9yIGBVW+Fm1T GNCDWvKh48Ggpquf+apzOhbOvfx2zQRDWoJv6cOWrn/kpuQGv2ogtlAfyVVYxlfe4/pv tPpn7/51Z+uXGJhTkeArrwU2V7y+AtzGhdxCyzhLlI5wI6p3/IoCJKl9NaBA48dGLVBO 8Rv8A999pdZZ7USu8yB5ORJOShijNmSvofX4ZDP+M/bdtUVB4OegBKIDlDUe77RQ/AGG CDMw== X-Gm-Message-State: AOPr4FU04lXNO05InR/tB6TkeG81+d5v+EGj0b8630whtWjCUFTwy1zJ2H4qnVB2rHOjM+4DHOQ= X-Received: by 10.194.108.197 with SMTP id hm5mr8210007wjb.167.1462362018756; Wed, 04 May 2016 04:40:18 -0700 (PDT) Return-Path: 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 Cc: patches@linaro.org, linux-kernel@vger.kernel.org, Bharat.Bhushan@freescale.com, pranav.sawargaonkar@gmail.com, p.fedin@samsung.com, iommu@lists.linux-foundation.org, Jean-Philippe.Brucker@arm.com, julien.grall@arm.com, yehuday@marvell.com 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> 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(+) -- 1.9.1 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);