[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241101121022.GT10193@nvidia.com>
Date: Fri, 1 Nov 2024 09:10:22 -0300
From: Jason Gunthorpe <jgg@...dia.com>
To: Suravee Suthikulpanit <suravee.suthikulpanit@....com>
Cc: linux-kernel@...r.kernel.org, iommu@...ts.linux.dev, joro@...tes.org,
robin.murphy@....com, vasant.hegde@....com, kevin.tian@...el.com,
jon.grimm@....com, santosh.shukla@....com, pandoh@...gle.com,
kumaranand@...gle.com
Subject: Re: [PATCH v8 06/10] iommu/amd: Modify set_dte_entry() to use
256-bit DTE helpers
On Thu, Oct 31, 2024 at 06:42:39PM +0000, Suravee Suthikulpanit wrote:
> +struct dev_table_entry *amd_iommu_get_ivhd_dte_flags(u16 segid, u16 devid)
> +{
> + struct ivhd_dte_flags *e;
> + unsigned int best_len = UINT_MAX;
> + struct dev_table_entry *dte = NULL;
> +
> + for_each_ivhd_dte_flags(e) {
> + /*
> + * Need to go through the whole list to find the smallest range,
> + * which contains the devid.
> + */
> + if ((e->segid == segid) &&
> + (e->devid_first >= devid) &&
> + (e->devid_last <= devid)) {
Again, I don't know much about this format, but are you sure about
this logic? Consider:
e->devid_first = 10
devid = 12
e->devid_last = 15
(e->devid_first >= devid) == 10 >= 12 == FALSE
(e->devid_last <= devid) == 15 <= 12 == FALSE
FALSE && FALSE == FALSE
It seems to me it does not do what the comment says? Compare to the
version I sent in my last email
Jason
Powered by blists - more mailing lists