Commit d30ddcaa authored by Eric Auger's avatar Eric Auger Committed by Will Deacon

iommu: Add a new type field in iommu_resv_region

We introduce a new field to differentiate the reserved region
types and specialize the apply_resv_region implementation.

Legacy direct mapped regions have IOMMU_RESV_DIRECT type.
We introduce 2 new reserved memory types:
- IOMMU_RESV_MSI will characterize MSI regions that are mapped
- IOMMU_RESV_RESERVED characterize regions that cannot by mapped.
Signed-off-by: default avatarEric Auger <eric.auger@redhat.com>
Tested-by: default avatarTomasz Nowicki <tomasz.nowicki@caviumnetworks.com>
Tested-by: default avatarBharat Bhushan <bharat.bhushan@nxp.com>
Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
parent e5b5234a
...@@ -3186,6 +3186,7 @@ static void amd_iommu_get_resv_regions(struct device *dev, ...@@ -3186,6 +3186,7 @@ static void amd_iommu_get_resv_regions(struct device *dev,
region->start = entry->address_start; region->start = entry->address_start;
region->length = entry->address_end - entry->address_start; region->length = entry->address_end - entry->address_start;
region->type = IOMMU_RESV_DIRECT;
if (entry->prot & IOMMU_PROT_IR) if (entry->prot & IOMMU_PROT_IR)
region->prot |= IOMMU_READ; region->prot |= IOMMU_READ;
if (entry->prot & IOMMU_PROT_IW) if (entry->prot & IOMMU_PROT_IW)
......
...@@ -117,18 +117,25 @@ enum iommu_attr { ...@@ -117,18 +117,25 @@ enum iommu_attr {
DOMAIN_ATTR_MAX, DOMAIN_ATTR_MAX,
}; };
/* These are the possible reserved region types */
#define IOMMU_RESV_DIRECT (1 << 0)
#define IOMMU_RESV_RESERVED (1 << 1)
#define IOMMU_RESV_MSI (1 << 2)
/** /**
* struct iommu_resv_region - descriptor for a reserved memory region * struct iommu_resv_region - descriptor for a reserved memory region
* @list: Linked list pointers * @list: Linked list pointers
* @start: System physical start address of the region * @start: System physical start address of the region
* @length: Length of the region in bytes * @length: Length of the region in bytes
* @prot: IOMMU Protection flags (READ/WRITE/...) * @prot: IOMMU Protection flags (READ/WRITE/...)
* @type: Type of the reserved region
*/ */
struct iommu_resv_region { struct iommu_resv_region {
struct list_head list; struct list_head list;
phys_addr_t start; phys_addr_t start;
size_t length; size_t length;
int prot; int prot;
int type;
}; };
#ifdef CONFIG_IOMMU_API #ifdef CONFIG_IOMMU_API
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment