}
}
+ ivrs_mappings[alias_id].valid = true;
+
/* Assign IOMMU hardware. */
ivrs_mappings[bdf].iommu = iommu;
}
u16 seg, struct ivrs_mappings *ivrs_mappings)
{
unsigned int bdf;
- void *intr_tb, *dte;
BUG_ON( (ivrs_bdf_entries == 0) );
/* 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);
}
}
* 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)
{
BUG_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;
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;