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