Skip to content

Commit ee34b32

Browse files
Suresh SiddhaDavid Woodhouse
authored andcommitted
dmar: support for parsing Remapping Hardware Static Affinity structure
Add support for parsing Remapping Hardware Static Affinity (RHSA) structure. This enables identifying the association between remapping hardware units and the corresponding proximity domain. This enables to allocate transalation structures closer to the remapping hardware unit. Signed-off-by: Suresh Siddha <[email protected]> Signed-off-by: David Woodhouse <[email protected]>
1 parent e0fc7e0 commit ee34b32

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

drivers/pci/dmar.c

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,26 @@ int dmar_find_matched_atsr_unit(struct pci_dev *dev)
348348
}
349349
#endif
350350

351+
static int __init
352+
dmar_parse_one_rhsa(struct acpi_dmar_header *header)
353+
{
354+
struct acpi_dmar_rhsa *rhsa;
355+
struct dmar_drhd_unit *drhd;
356+
357+
rhsa = (struct acpi_dmar_rhsa *)header;
358+
for_each_drhd_unit(drhd)
359+
if (drhd->reg_base_addr == rhsa->base_address) {
360+
int node = acpi_map_pxm_to_node(rhsa->proximity_domain);
361+
362+
if (!node_online(node))
363+
node = -1;
364+
drhd->iommu->node = node;
365+
return 0;
366+
}
367+
368+
return -ENODEV;
369+
}
370+
351371
static void __init
352372
dmar_table_print_dmar_entry(struct acpi_dmar_header *header)
353373
{
@@ -467,7 +487,7 @@ parse_dmar_table(void)
467487
#endif
468488
break;
469489
case ACPI_DMAR_HARDWARE_AFFINITY:
470-
/* We don't do anything with RHSA (yet?) */
490+
ret = dmar_parse_one_rhsa(entry_header);
471491
break;
472492
default:
473493
printk(KERN_WARNING PREFIX
@@ -677,6 +697,8 @@ int alloc_iommu(struct dmar_drhd_unit *drhd)
677697
iommu->agaw = agaw;
678698
iommu->msagaw = msagaw;
679699

700+
iommu->node = -1;
701+
680702
/* the registers might be more than one page */
681703
map_size = max_t(int, ecap_max_iotlb_offset(iommu->ecap),
682704
cap_max_fault_reg_offset(iommu->cap));

include/linux/intel-iommu.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@ struct intel_iommu {
332332
#ifdef CONFIG_INTR_REMAP
333333
struct ir_table *ir_table; /* Interrupt remapping info */
334334
#endif
335+
int node;
335336
};
336337

337338
static inline void __iommu_flush_cache(

0 commit comments

Comments
 (0)