[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v5 04/10] AMD/IOMMU: introduce a "valid" flag for IVRS mappings
For us to no longer blindly allocate interrupt remapping tables for everything the ACPI tables name, we can't use struct ivrs_mappings' intremap_table field anymore to also have the meaning of "this entry is valid". Add a separate boolean field instead. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> --- v5: New. --- a/xen/drivers/passthrough/amd/iommu_acpi.c +++ b/xen/drivers/passthrough/amd/iommu_acpi.c @@ -88,6 +88,8 @@ static void __init add_ivrs_mapping_entr } }+ ivrs_mappings[alias_id].valid = true; + /* Assign IOMMU hardware. */ ivrs_mappings[bdf].iommu = iommu; } --- a/xen/drivers/passthrough/amd/iommu_init.c +++ b/xen/drivers/passthrough/amd/iommu_init.c @@ -1244,7 +1244,6 @@ static int __init amd_iommu_setup_device u16 seg, struct ivrs_mappings *ivrs_mappings) { unsigned int bdf; - void *intr_tb, *dte;BUG_ON( (ivrs_bdf_entries == 0) ); @@ -1264,16 +1263,17 @@ static int __init amd_iommu_setup_device /* Add device table entries */ for ( bdf = 0; bdf < ivrs_bdf_entries; bdf++ ) { - intr_tb = ivrs_mappings[bdf].intremap_table; - - if ( intr_tb ) + if ( ivrs_mappings[bdf].valid ) { + void *dte; + /* add device table entry */ dte = device_table.buffer + (bdf * IOMMU_DEV_TABLE_ENTRY_SIZE); iommu_dte_add_device_entry(dte, &ivrs_mappings[bdf]);amd_iommu_set_intremap_table( - dte, (u64)virt_to_maddr(intr_tb), iommu_intremap); + dte, virt_to_maddr(ivrs_mappings[bdf].intremap_table), + iommu_intremap); } }--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c +++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c @@ -69,8 +69,8 @@ struct amd_iommu *find_iommu_for_device( * table and I/O page table respectively. Such devices will have * both alias entry and select entry in IVRS structure. * - * Return original device id, if device has valid interrupt remapping - * table setup for both select entry and alias entry. + * Return original device id if both the specific entry and the alias entry + * have been marked valid. */ int get_dma_requestor_id(uint16_t seg, uint16_t bdf) { @@ -79,8 +79,7 @@ int get_dma_requestor_id(uint16_t seg, uBUG_ON ( bdf >= ivrs_bdf_entries ); req_id = ivrs_mappings[bdf].dte_requestor_id; - if ( (ivrs_mappings[bdf].intremap_table != NULL) && - (ivrs_mappings[req_id].intremap_table != NULL) ) + if ( ivrs_mappings[bdf].valid && ivrs_mappings[req_id].valid ) req_id = bdf;return req_id; --- a/xen/include/asm-x86/amd-iommu.h +++ b/xen/include/asm-x86/amd-iommu.h @@ -111,6 +111,7 @@ struct ivrs_mappings { u8 unity_map_enable; u8 write_permission; u8 read_permission; + bool valid; unsigned long addr_range_start; unsigned long addr_range_length; struct amd_iommu *iommu; _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |