[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231211173826.GE1489931@ziepe.ca>
Date: Mon, 11 Dec 2023 13:38:26 -0400
From: Jason Gunthorpe <jgg@...pe.ca>
To: Lu Baolu <baolu.lu@...ux.intel.com>
Cc: Joerg Roedel <joro@...tes.org>, Will Deacon <will@...nel.org>,
Robin Murphy <robin.murphy@....com>,
Kevin Tian <kevin.tian@...el.com>, iommu@...ts.linux.dev,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/6] iommu/vt-d: Setup scalable mode context entry in
probe path
On Tue, Dec 05, 2023 at 09:21:58AM +0800, Lu Baolu wrote:
> +/*
> + * Get the PASID directory size for scalable mode context entry.
> + * Value of X in the PDTS field of a scalable mode context entry
> + * indicates PASID directory with 2^(X + 7) entries.
> + */
> +static unsigned long context_get_sm_pds(struct pasid_table *table)
> +{
> + unsigned long pds, max_pde;
> +
> + max_pde = table->max_pasid >> PASID_PDE_SHIFT;
> + pds = find_first_bit(&max_pde, MAX_NR_PASID_BITS);
> + if (pds < 7)
> + return 0;
> +
> + return pds - 7;
This seems like a convoluted way to write
max(ilog2(table-max_pasid) - 7,0)
?
Jason
Powered by blists - more mailing lists