Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp599074ybi; Wed, 19 Jun 2019 04:54:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqyKvhh93QB1EMVtAdn9tB0/AqaCmsxDl9xw4desm6ZT6+3OsSjqJ6EQ4ZQJSpuzaQYy45RC X-Received: by 2002:a17:90a:dd42:: with SMTP id u2mr10875993pjv.118.1560945288485; Wed, 19 Jun 2019 04:54:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560945288; cv=none; d=google.com; s=arc-20160816; b=LtiyQqXtJ3L0VFtwoqUcurSaK9qpMYeNLLOXfr5AKhg0NzHff+VTfafICwiIcBJtFM hcmgpnup+/ZB7wZuz1K0MepJNqLlzjXLMHL7raKVkCI4tbe36D0hgkxNQ97EC+RYkvEU qiNc3m2OyDW5JN//G6mbicEzrDTKEZlhsq8UKSXOZVq15O4IqUGNS5ePyi34FiXZNSS7 YVdOV84EWzceCrM0AQrU2bEIvsTL7s0xo+MNVCJVU3NpDJCm5j7N2ibMSs3VTumxbyHZ se1pdvovW3RX7khjbxeCzTRo7dnugGLEV2acnV6xq1jvAFXvrraWgeuYfah88Myfg8wB Oe9A== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=V02fR7v8vGd6rM4Uwyb5FTBylAVvE0yoQbIOxeuuaOw=; b=p5RO88MROjgJU+ml5JBgqgCL5Z5G3Ti7mv6aIHTJUmoB21fXS5pplvcEpOaqT4K8DA fM4eLzG3r1+KcADo033rJp1BF/PlULPO91NLXYrAYX0TuAbUKPPLLKUZGJdzbGLCWgUM kuqeuQwhZGziLJE6+UoloxgLYdnyZzle+CVdwVotx5Yi7YdtPGA2LwJNRVmT3aRVhj/j KyP3G4Bni2yy9kpuCuRrL/KGDezr88NDS/cKFr8pZUJ2lzltKN4pMYZ8kUAgDrxxO2So +m2W3HTT7EEM5m8ThayN1TJV83BkbFQVrKaZUNPvnOxqq0V60Kz/ADk2BTvo2+r7UhOf hsRw== 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 a7si16617778pfc.54.2019.06.19.04.54.32; Wed, 19 Jun 2019 04:54:48 -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 S1731587AbfFSLyR (ORCPT + 99 others); Wed, 19 Jun 2019 07:54:17 -0400 Received: from foss.arm.com ([217.140.110.172]:35630 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727067AbfFSLyR (ORCPT ); Wed, 19 Jun 2019 07:54:17 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 89DB6360; Wed, 19 Jun 2019 04:54:16 -0700 (PDT) Received: from [10.1.196.129] (ostrya.cambridge.arm.com [10.1.196.129]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 71F893F738; Wed, 19 Jun 2019 04:56:01 -0700 (PDT) Subject: Re: [PATCH 3/8] iommu/arm-smmu-v3: Support platform SSID To: Will Deacon Cc: "joro@8bytes.org" , "robh+dt@kernel.org" , Mark Rutland , Robin Murphy , "jacob.jun.pan@linux.intel.com" , "iommu@lists.linux-foundation.org" , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "eric.auger@redhat.com" References: <20190610184714.6786-1-jean-philippe.brucker@arm.com> <20190610184714.6786-4-jean-philippe.brucker@arm.com> <20190618180851.GK4270@fuggles.cambridge.arm.com> From: Jean-Philippe Brucker Message-ID: <73cfb797-5ae7-b9d9-01ea-fe98a1bed5c3@arm.com> Date: Wed, 19 Jun 2019 12:53:46 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <20190618180851.GK4270@fuggles.cambridge.arm.com> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 18/06/2019 19:08, Will Deacon wrote: >> + /* >> + * 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); > > Please introduce a #define for the 10, so that it is computed in the way > you describe in the comment (a bit like we do for things like queue sizes). Ok >> + >> 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); >> + } > > Hmm. Do you know if there's anything in ACPI for this? Yes, IORT version D introduced a "substream width" field for the Named component node (platform device). I don't think it existed last time I checked, so I'll see about supporting it. Thanks, Jean