[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <a1e63536-9450-4081-9a3a-dae387d939d6@amd.com>
Date: Fri, 1 Nov 2024 22:02:44 +0700
From: "Suthikulpanit, Suravee" <suravee.suthikulpanit@....com>
To: Jason Gunthorpe <jgg@...dia.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 11/1/2024 7:10 PM, Jason Gunthorpe wrote:
> 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
Ah, sorry again for this stupid mistake. You are correct. Thank you very
much for catching this. I am sending V9 with only the fix for this.
Thanks,
Suravee
Powered by blists - more mailing lists