Skip to content

Commit d30ddca

Browse files
eaugerwildea01
authored andcommitted
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: Eric Auger <eric.auger@redhat.com> Tested-by: Tomasz Nowicki <tomasz.nowicki@caviumnetworks.com> Tested-by: Bharat Bhushan <bharat.bhushan@nxp.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
1 parent e5b5234 commit d30ddca

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

drivers/iommu/amd_iommu.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3186,6 +3186,7 @@ static void amd_iommu_get_resv_regions(struct device *dev,
31863186

31873187
region->start = entry->address_start;
31883188
region->length = entry->address_end - entry->address_start;
3189+
region->type = IOMMU_RESV_DIRECT;
31893190
if (entry->prot & IOMMU_PROT_IR)
31903191
region->prot |= IOMMU_READ;
31913192
if (entry->prot & IOMMU_PROT_IW)

include/linux/iommu.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,18 +117,25 @@ enum iommu_attr {
117117
DOMAIN_ATTR_MAX,
118118
};
119119

120+
/* These are the possible reserved region types */
121+
#define IOMMU_RESV_DIRECT (1 << 0)
122+
#define IOMMU_RESV_RESERVED (1 << 1)
123+
#define IOMMU_RESV_MSI (1 << 2)
124+
120125
/**
121126
* struct iommu_resv_region - descriptor for a reserved memory region
122127
* @list: Linked list pointers
123128
* @start: System physical start address of the region
124129
* @length: Length of the region in bytes
125130
* @prot: IOMMU Protection flags (READ/WRITE/...)
131+
* @type: Type of the reserved region
126132
*/
127133
struct iommu_resv_region {
128134
struct list_head list;
129135
phys_addr_t start;
130136
size_t length;
131137
int prot;
138+
int type;
132139
};
133140

134141
#ifdef CONFIG_IOMMU_API

0 commit comments

Comments
 (0)