mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
iommu: Add IOMMU index concept to IOMMU API
If an IOMMU supports mappings that care about the memory transaction attributes, then it no longer has a unique address -> output mapping, but more than one. We can represent these using an IOMMU index, analogous to TCG's mmu indexes. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Message-id: 20180604152941.20374-2-peter.maydell@linaro.org
This commit is contained in:
parent
2151b044fd
commit
21f402093c
2 changed files with 78 additions and 0 deletions
23
memory.c
23
memory.c
|
@ -1915,6 +1915,29 @@ int memory_region_iommu_get_attr(IOMMUMemoryRegion *iommu_mr,
|
|||
return imrc->get_attr(iommu_mr, attr, data);
|
||||
}
|
||||
|
||||
int memory_region_iommu_attrs_to_index(IOMMUMemoryRegion *iommu_mr,
|
||||
MemTxAttrs attrs)
|
||||
{
|
||||
IOMMUMemoryRegionClass *imrc = IOMMU_MEMORY_REGION_GET_CLASS(iommu_mr);
|
||||
|
||||
if (!imrc->attrs_to_index) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return imrc->attrs_to_index(iommu_mr, attrs);
|
||||
}
|
||||
|
||||
int memory_region_iommu_num_indexes(IOMMUMemoryRegion *iommu_mr)
|
||||
{
|
||||
IOMMUMemoryRegionClass *imrc = IOMMU_MEMORY_REGION_GET_CLASS(iommu_mr);
|
||||
|
||||
if (!imrc->num_indexes) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return imrc->num_indexes(iommu_mr);
|
||||
}
|
||||
|
||||
void memory_region_set_log(MemoryRegion *mr, bool log, unsigned client)
|
||||
{
|
||||
uint8_t mask = 1 << client;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue