Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4212014ybi; Tue, 11 Jun 2019 02:53:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqzTK6zylK4vGLjtV5VvM5fEAsq76NwFVWeKiJJ482XnyFdJlFjG2fBIaWKTGebbh6X2Ns7T X-Received: by 2002:a63:eb0d:: with SMTP id t13mr20093435pgh.37.1560246821454; Tue, 11 Jun 2019 02:53:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560246821; cv=none; d=google.com; s=arc-20160816; b=ccqQPvosiWyuwV4wgOUmyy5W9m5FONxRSKg5mPJK60HHWVFjR/IySrXLL7TT1Zhie/ Fj1y9Hkpc5Dlv0cC/7uJrjxC1ukTF3NIDn80uLBYerEyjM2T4kzTRVBRJqRVlATTzmIm wYj4VMSKRZDqGJ8GZN0i5WVSVeyOaiW7RBklyU7CzpJm+ZZJ0lHvEhe0L/EHNs5bK6ym ViQbeBYeI/dQqgJ8apeNvQXVFeRa0Ns41aTu+h3b9wgPfMLsQWcFpAM/GxpuUEZzP7GI J6X1K1Pije1I0YAwpOyxG1a7EhgDhzxD2xIQBDhKsZwbkERn6vHY68YdCXStrXhuC2iZ oGLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=PSgvUYuqouAW0Ylg7VCEfFpM0qCc+f/8VYxPGsiRFT8=; b=ZbxcSsg76gNuoUoi6TfiB52XMHXqNYUkWfhZfoJeF3CFygGjvzvSmXTeIH16/GXjvl QyNls9WekN/TOfPXyv/NEs4ULlLJRMyvMQyVpLlyA0pynAYDuCeL4u+arf5lynI6SGla hhgEh7oFJddwKIgwfqLbx/Qmo+ARqbw0s9ul8Y5Rk4C5vy9aiURrtwm7FHVLBXjl3F9E uZli/KuSWi6YgnqQ5eYYHRL4KnawGJgR6Ew62RwW739Nu8NUFf2uCnaLMRPuxL/bzqmT hyGkS0GSXWebmir4TbIDAIMJ8j27CYHdIWFirE63KXnvuxYvq4K2JeodeY7zWDtAi/C/ 4Xyw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n19si8173475pgl.2.2019.06.11.02.53.25; Tue, 11 Jun 2019 02:53:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404195AbfFKJma (ORCPT + 99 others); Tue, 11 Jun 2019 05:42:30 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:55520 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2391206AbfFKJma (ORCPT ); Tue, 11 Jun 2019 05:42:30 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id DE189CF4700FAD13C19D; Tue, 11 Jun 2019 17:42:27 +0800 (CST) Received: from localhost (10.202.226.61) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.439.0; Tue, 11 Jun 2019 17:42:26 +0800 Date: Tue, 11 Jun 2019 10:42:14 +0100 From: Jonathan Cameron To: Jean-Philippe Brucker CC: , , , , , , , Subject: Re: [PATCH 3/8] iommu/arm-smmu-v3: Support platform SSID Message-ID: <20190611104214.00001f2c@huawei.com> In-Reply-To: <20190610184714.6786-4-jean-philippe.brucker@arm.com> References: <20190610184714.6786-1-jean-philippe.brucker@arm.com> <20190610184714.6786-4-jean-philippe.brucker@arm.com> Organization: Huawei X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; i686-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.202.226.61] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 10 Jun 2019 19:47:09 +0100 Jean-Philippe Brucker wrote: > For platform devices that support SubstreamID (SSID), firmware provides > the number of supported SSID bits. Restrict it to what the SMMU supports > and cache it into master->ssid_bits. > > Signed-off-by: Jean-Philippe Brucker Missing kernel-doc. Thanks, Jonathan > --- > drivers/iommu/arm-smmu-v3.c | 11 +++++++++++ > drivers/iommu/of_iommu.c | 6 +++++- > include/linux/iommu.h | 1 + > 3 files changed, 17 insertions(+), 1 deletion(-) > > diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c > index 4d5a694f02c2..3254f473e681 100644 > --- a/drivers/iommu/arm-smmu-v3.c > +++ b/drivers/iommu/arm-smmu-v3.c > @@ -604,6 +604,7 @@ struct arm_smmu_master { > struct list_head domain_head; > u32 *sids; > unsigned int num_sids; > + unsigned int ssid_bits; > bool ats_enabled :1; > }; > > @@ -2097,6 +2098,16 @@ static int arm_smmu_add_device(struct device *dev) > } > } > > + master->ssid_bits = min(smmu->ssid_bits, fwspec->num_pasid_bits); > + > + /* > + * If the SMMU doesn't support 2-stage CD, limit the linear > + * tables to a reasonable number of contexts, let's say > + * 64kB / sizeof(ctx_desc) = 1024 = 2^10 > + */ > + if (!(smmu->features & ARM_SMMU_FEAT_2_LVL_CDTAB)) > + master->ssid_bits = min(master->ssid_bits, 10U); > + > group = iommu_group_get_for_dev(dev); > if (!IS_ERR(group)) { > iommu_group_put(group); > diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c > index f04a6df65eb8..04f4f6b95d82 100644 > --- a/drivers/iommu/of_iommu.c > +++ b/drivers/iommu/of_iommu.c > @@ -206,8 +206,12 @@ const struct iommu_ops *of_iommu_configure(struct device *dev, > if (err) > break; > } > - } > > + fwspec = dev_iommu_fwspec_get(dev); > + if (!err && fwspec) > + of_property_read_u32(master_np, "pasid-num-bits", > + &fwspec->num_pasid_bits); > + } > > /* > * Two success conditions can be represented by non-negative err here: > diff --git a/include/linux/iommu.h b/include/linux/iommu.h > index 519e40fb23ce..b91df613385f 100644 > --- a/include/linux/iommu.h > +++ b/include/linux/iommu.h > @@ -536,6 +536,7 @@ struct iommu_fwspec { > struct fwnode_handle *iommu_fwnode; > void *iommu_priv; > u32 flags; > + u32 num_pasid_bits; This structure has kernel doc so you need to add something for this. > unsigned int num_ids; > u32 ids[1]; > };