From: Nicolin Chen <nicolinc@nvidia.com>
To: "thunder.leizhen@huaweicloud.com" <thunder.leizhen@huaweicloud.com>
Cc: Will Deacon <will@kernel.org>,
Robin Murphy <robin.murphy@arm.com>,
"Joerg Roedel" <joro@8bytes.org>,
"iommu@lists.linux.dev" <iommu@lists.linux.dev>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Zhen Lei <thunder.leizhen@huawei.com>,
Tanmay Jagdale <tanmay@marvell.com>,
"Jonathan Cameron" <Jonathan.Cameron@Huawei.com>
Subject: Re: [PATCH v2 1/2] iommu/arm-smmu-v3: Add support for ECMDQ register mode
Date: Thu, 10 Aug 2023 12:58:56 -0700 [thread overview]
Message-ID: <ZNVBgCb5w0daExIL@Asurada-Nvidia> (raw)
In-Reply-To: <20230809131303.1355-2-thunder.leizhen@huaweicloud.com>
Hi Zhen,
On Wed, Aug 09, 2023 at 06:13:02AM -0700, thunder.leizhen@huaweicloud.com wrote:
> +static int arm_smmu_ecmdq_layout(struct arm_smmu_device *smmu)
> +{
> + int cpu;
> + struct arm_smmu_ecmdq __percpu *ecmdq;
> +
> + if (num_possible_cpus() <= smmu->nr_ecmdq) {
Does the nr_ecmdq always physically match with the number of CPUs?
I saw the spec saying "up to 256 pages", but not sure if they are
always physically present, even if CPU number is smaller i.e. some
of them would be unassigned/wasted.
> + ecmdq = devm_alloc_percpu(smmu->dev, *ecmdq);
> + if (!ecmdq)
> + return -ENOMEM;
> +
> + for_each_possible_cpu(cpu)
> + *per_cpu_ptr(smmu->ecmdqs, cpu) = per_cpu_ptr(ecmdq, cpu);
> +
> + /* A core requires at most one ECMDQ */
> + smmu->nr_ecmdq = num_possible_cpus();
> +
> + return 0;
> + }
> +
> + return -ENOSPC;
This ENOSPC is a software limitation, isn't it? How about using
"smp_processor_id() % smmu->nr_ecmdq" to select a queue?
> + shift_increment = order_base_2(num_possible_cpus() / smmu->nr_ecmdq);
> +
> + offset = 0;
> + for_each_possible_cpu(cpu) {
> + struct arm_smmu_ecmdq *ecmdq;
> + struct arm_smmu_queue *q;
> +
> + ecmdq = *per_cpu_ptr(smmu->ecmdqs, cpu);
> + ecmdq->base = cp_base + offset;
> +
> + q = &ecmdq->cmdq.q;
> +
> + q->llq.max_n_shift = ECMDQ_MAX_SZ_SHIFT + shift_increment;
> + ret = arm_smmu_init_one_queue(smmu, q, ecmdq->base, ARM_SMMU_ECMDQ_PROD,
> + ARM_SMMU_ECMDQ_CONS, CMDQ_ENT_DWORDS, "ecmdq");
Not getting why max_n_shift increases by shift_increment. Mind
elaborating?
Thanks
Nicolin
next prev parent reply other threads:[~2023-08-10 19:59 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-09 13:13 [PATCH v2 0/2] iommu/arm-smmu-v3: Add support for ECMDQ register mode thunder.leizhen
2023-08-09 13:13 ` [PATCH v2 1/2] " thunder.leizhen
2023-08-10 19:58 ` Nicolin Chen [this message]
2023-08-11 6:23 ` Leizhen (ThunderTown)
2023-08-09 13:13 ` [PATCH v2 2/2] iommu/arm-smmu-v3: Ensure that a set of associated commands are inserted in the same ECMDQ thunder.leizhen
2023-08-09 13:56 ` [PATCH v2 0/2] iommu/arm-smmu-v3: Add support for ECMDQ register mode Will Deacon
2023-08-10 2:18 ` Leizhen (ThunderTown)
2023-08-11 5:00 ` Nicolin Chen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZNVBgCb5w0daExIL@Asurada-Nvidia \
--to=nicolinc@nvidia.com \
--cc=Jonathan.Cameron@Huawei.com \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robin.murphy@arm.com \
--cc=tanmay@marvell.com \
--cc=thunder.leizhen@huawei.com \
--cc=thunder.leizhen@huaweicloud.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.