Re: [PATCH v3 3/3] iommu/amd: Rename unity_map_entry and unit_map to ivmd_entry and ivhd_entry_map

From: Sairaj Kodilkar

Date: Mon Nov 09 2026 - 01:35:52 EST




On 11/6/2026 3:45 PM, Jindal, Akshay wrote:
>
>
> On 06-11-2026 09:46, Sairaj Kodilkar wrote:
>> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
>>
>>
>> From: Suravee Suthikulpanit <suravee.suthikulpanit@xxxxxxx>
>>
>> Also, rename struct list_head unity_map to ivmd_entry_map along with
>> renaming the unity-map helper functions and add error message when
>> handling invalid IVMD entry.
>>
>> No functional change intended.
> Reviewed-by: Akshay Jindal <Akshay.Jindal@xxxxxxx>
>>
>> Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@xxxxxxx>
>> Signed-off-by: Sairaj Kodilkar <sarunkod@xxxxxxx>
>> Tested-by: Adam Pelka <adampelka26@xxxxxxxxx>
>> ---
>> drivers/iommu/amd/amd_iommu_types.h | 6 +++---
>> drivers/iommu/amd/init.c | 22 +++++++++++-----------
>> drivers/iommu/amd/iommu.c | 7 ++++---
>> 3 files changed, 18 insertions(+), 17 deletions(-)
>>
>> diff --git a/drivers/iommu/amd/amd_iommu_types.h b/drivers/iommu/amd/amd_iommu_types.h
>> index bcb88b476167..033cabc5b73a 100644
>> --- a/drivers/iommu/amd/amd_iommu_types.h
>> +++ b/drivers/iommu/amd/amd_iommu_types.h
>> @@ -609,11 +609,11 @@ struct amd_iommu_pci_seg {
>> u16 *alias_table;
>>
>> /*
>> - * A list of required unity mappings we find in ACPI. It is not locked
>> + * A list of required IVMD mappings we find in ACPI. It is not locked
>> * because as runtime it is only read. It is created at ACPI table
>> * parsing time.
>> */
>> - struct list_head unity_map;
>> + struct list_head ivmd_entry_map;
> nit:
> IMO unity_map term was based on spec, which was synonymous with identity mappings.
> If unity_map term is not being used, then I would suggest keeping it as ivmd_entry_list
> instead of _map, since it is simply a collection of ivmd entries

Sure.

Thanks
Sairaj

>> };
>>
>> /*
>> @@ -869,7 +869,7 @@ struct ivhd_dte_flags {
>> /*
>> * One entry for unity mappings parsed out of the ACPI table.
>> */
>> -struct unity_map_entry {
>> +struct ivmd_entry {
>> struct list_head list;
>>
>> /* starting device id this entry is used for (including) */
>> diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c
>> index 1f0ca675df1c..9356efe14b3e 100644
>> --- a/drivers/iommu/amd/init.c
>> +++ b/drivers/iommu/amd/init.c
>> @@ -132,7 +132,7 @@ int amd_iommu_pprlog_size = PPRLOG_SIZE_DEF;
>>
>> /*
>> * An AMD IOMMU memory definition structure. It defines things like exclusion
>> - * ranges for devices and regions that should be unity mapped.
>> + * ranges, unity mapping for device and regions.
>> */
>> struct ivmd_header {
>> u8 type;
>> @@ -1726,7 +1726,7 @@ static struct amd_iommu_pci_seg *__init alloc_pci_segment(u16 id,
>>
>> pci_seg->id = id;
>> init_llist_head(&pci_seg->dev_data_list);
>> - INIT_LIST_HEAD(&pci_seg->unity_map);
>> + INIT_LIST_HEAD(&pci_seg->ivmd_entry_map);
>> list_add_tail(&pci_seg->list, &amd_iommu_pci_seg_list);
>>
>> if (alloc_dev_table(pci_seg))
>> @@ -2319,8 +2319,8 @@ static int __init amd_iommu_init_pci(void)
>> }
>>
>> /*
>> - * Order is important here to make sure any unity map requirements are
>> - * fulfilled. The unity mappings are created and written to the device
>> + * Order is important here to make sure any ivmd map requirements are
>> + * fulfilled. The ivmd mappings are created and written to the device
>> * table during the iommu_init_pci() call.
>> *
>> * After that we call init_device_table_dma() to make sure any
>> @@ -2606,17 +2606,17 @@ static int iommu_init_irq(struct amd_iommu *iommu)
>> *
>> * The next functions belong to the third pass of parsing the ACPI
>> * table. In this last pass the memory mapping requirements are
>> - * gathered (like exclusion and unity mapping ranges).
>> + * gathered (like exclusion and ivmd mapping ranges).
>> *
>> ****************************************************************************/
>>
>> -static void __init free_unity_maps(void)
>> +static void __init free_ivmd_maps(void)
>> {
>> - struct unity_map_entry *entry, *next;
>> + struct ivmd_entry *entry, *next;
>> struct amd_iommu_pci_seg *p, *pci_seg;
>>
>> for_each_pci_segment_safe(pci_seg, p) {
>> - list_for_each_entry_safe(entry, next, &pci_seg->unity_map, list) {
>> + list_for_each_entry_safe(entry, next, &pci_seg->ivmd_entry_map, list) {
>> list_del(&entry->list);
>> kfree(entry);
>> }
>> @@ -2627,7 +2627,7 @@ static void __init free_unity_maps(void)
>> static int __init init_unity_map_range(struct ivmd_header *m,
>> struct acpi_table_header *ivrs_base)
>> {
>> - struct unity_map_entry *e = NULL;
>> + struct ivmd_entry *e = NULL;
>> struct amd_iommu_pci_seg *pci_seg;
>> char *s;
>>
>> @@ -2678,7 +2678,7 @@ static int __init init_unity_map_range(struct ivmd_header *m,
>> PCI_SLOT(e->devid_end), PCI_FUNC(e->devid_end),
>> e->address_start, e->address_end, m->flags);
>>
>> - list_add_tail(&e->list, &pci_seg->unity_map);
>> + list_add_tail(&e->list, &pci_seg->ivmd_entry_map);
>>
>> return 0;
>> }
>> @@ -3178,7 +3178,7 @@ static bool __init check_ioapic_information(void)
>> static void __init free_dma_resources(void)
>> {
>> amd_iommu_pdom_id_destroy();
>> - free_unity_maps();
>> + free_ivmd_maps();
>> }
>>
>> static void __init ivinfo_init(void *ivrs)
>> diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
>> index 699b5f530f11..d0308fbceac6 100644
>> --- a/drivers/iommu/amd/iommu.c
>> +++ b/drivers/iommu/amd/iommu.c
>> @@ -3100,7 +3100,7 @@ static void amd_iommu_get_resv_regions(struct device *dev,
>> struct list_head *head)
>> {
>> struct iommu_resv_region *region;
>> - struct unity_map_entry *entry;
>> + struct ivmd_entry *entry;
>> struct amd_iommu *iommu;
>> struct amd_iommu_pci_seg *pci_seg;
>> int devid, sbdf;
>> @@ -3113,7 +3113,7 @@ static void amd_iommu_get_resv_regions(struct device *dev,
>> iommu = get_amd_iommu_from_dev(dev);
>> pci_seg = iommu->pci_seg;
>>
>> - list_for_each_entry(entry, &pci_seg->unity_map, list) {
>> + list_for_each_entry(entry, &pci_seg->ivmd_entry_map, list) {
>> int type, prot = 0;
>> size_t length;
>>
>> @@ -3148,7 +3148,8 @@ static void amd_iommu_get_resv_regions(struct device *dev,
>> length, prot, type,
>> GFP_KERNEL);
>> if (!region) {
>> - dev_err(dev, "Out of memory allocating dm-regions\n");
>> + pr_err("%s: Out of memory allocating reserved regions for sbdf=%#x\n",
>> + __func__, sbdf);
>> return;
>> }
>> list_add_tail(&region->list, head);
>> --
>> 2.34.1
>>
>>