[<prev] [next>] [day] [month] [year] [list]
Message-ID: <e8a87c2b-a29a-ccf9-49c6-3cfceaa208bb@gmail.com>
Date: Mon, 15 May 2023 21:36:05 +0700
From: Bui Quang Minh <minhquangbui99@...il.com>
To: Suravee Suthikulpanit <Suravee.Suthikulpanit@....com>,
Wan Zongshun <vincent.wan@....com>
Cc: Joerg Roedel <joro@...tes.org>,
Suravee Suthikulpanit <suravee.suthikulpanit@....com>,
Will Deacon <will@...nel.org>,
Robin Murphy <robin.murphy@....com>, iommu@...ts.linux.dev,
linux-kernel@...r.kernel.org, "Michael S. Tsirkin" <mst@...hat.com>
Subject: amd-iommu: get_highest_supported_ivhd_type question
Hello everyone,
Since this commit 8c7142f56fedfc6824b5bca56fee1f443e01746b (iommu/amd:
Use the most comprehensive IVHD type that the driver can support),
amd_iommu driver can support IVHD type 0x11 and 0x40 beside old type
0x10. This commit introduces a new function to determine the appropriate
IVHD type
/**
* get_highest_supported_ivhd_type - Look up the appropriate IVHD type
* @ivrs Pointer to the IVRS header
*
* This function search through all IVDB of the maximum supported IVHD
*/
static u8 get_highest_supported_ivhd_type(struct acpi_table_header *ivrs)
{
u8 *base = (u8 *)ivrs;
struct ivhd_header *ivhd = (struct ivhd_header *)
(base + IVRS_HEADER_LENGTH);
u8 last_type = ivhd->type;
u16 devid = ivhd->devid;
while (((u8 *)ivhd - base < ivrs->length) &&
(ivhd->type <= ACPI_IVHD_TYPE_MAX_SUPPORTED)) {
u8 *p = (u8 *) ivhd;
if (ivhd->devid == devid)
last_type = ivhd->type;
ivhd = (struct ivhd_header *)(p + ivhd->length);
}
return last_type;
}
As the name and comment suggest, the driver is intended to use the
highest IVHD type provided in ACPI table. However, looking at the
implementation, I see that it chooses to use the last IVHD type of the
first devid appears in the ACPI table. Are there any reasons behind this
implementation?
Thank you,
Quang Minh.
Powered by blists - more mailing lists