iommu: Introduce direct mapped region handling
Add two new functions to the IOMMU-API to allow the IOMMU drivers to export the requirements for direct mapped regions per device. This is useful for exporting the information in Intel VT-d's RMRR entries or AMD-Vi's unity mappings. Change-Id: Iab55341a8526084a5110dc5a2d4448fd46e3296a Signed-off-by: Joerg Roedel <jroedel@suse.de> [pdaly@codeaurora.org Resolve minor conflicts]
This commit is contained in:
parent
2944c708c9
commit
ef3a0f2227
2 changed files with 47 additions and 0 deletions
|
@ -1570,3 +1570,19 @@ int iommu_dma_supported(struct iommu_domain *domain, struct device *dev,
|
|||
return domain->ops->dma_supported(domain, dev, mask);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void iommu_get_dm_regions(struct device *dev, struct list_head *list)
|
||||
{
|
||||
const struct iommu_ops *ops = dev->bus->iommu_ops;
|
||||
|
||||
if (ops && ops->get_dm_regions)
|
||||
ops->get_dm_regions(dev, list);
|
||||
}
|
||||
|
||||
void iommu_put_dm_regions(struct device *dev, struct list_head *list)
|
||||
{
|
||||
const struct iommu_ops *ops = dev->bus->iommu_ops;
|
||||
|
||||
if (ops && ops->put_dm_regions)
|
||||
ops->put_dm_regions(dev, list);
|
||||
}
|
||||
|
|
|
@ -131,6 +131,20 @@ enum iommu_attr {
|
|||
|
||||
extern struct dentry *iommu_debugfs_top;
|
||||
|
||||
/**
|
||||
* struct iommu_dm_region - descriptor for a direct mapped memory region
|
||||
* @list: Linked list pointers
|
||||
* @start: System physical start address of the region
|
||||
* @length: Length of the region in bytes
|
||||
* @prot: IOMMU Protection flags (READ/WRITE/...)
|
||||
*/
|
||||
struct iommu_dm_region {
|
||||
struct list_head list;
|
||||
phys_addr_t start;
|
||||
size_t length;
|
||||
int prot;
|
||||
};
|
||||
|
||||
#ifdef CONFIG_IOMMU_API
|
||||
|
||||
/**
|
||||
|
@ -182,6 +196,10 @@ struct iommu_ops {
|
|||
int (*domain_set_attr)(struct iommu_domain *domain,
|
||||
enum iommu_attr attr, void *data);
|
||||
|
||||
/* Request/Free a list of direct mapping requirements for a device */
|
||||
void (*get_dm_regions)(struct device *dev, struct list_head *list);
|
||||
void (*put_dm_regions)(struct device *dev, struct list_head *list);
|
||||
|
||||
/* Window handling functions */
|
||||
int (*domain_window_enable)(struct iommu_domain *domain, u32 wnd_nr,
|
||||
phys_addr_t paddr, u64 size, int prot);
|
||||
|
@ -245,6 +263,9 @@ extern unsigned long iommu_reg_read(struct iommu_domain *domain,
|
|||
extern void iommu_reg_write(struct iommu_domain *domain, unsigned long offset,
|
||||
unsigned long val);
|
||||
|
||||
extern void iommu_get_dm_regions(struct device *dev, struct list_head *list);
|
||||
extern void iommu_put_dm_regions(struct device *dev, struct list_head *list);
|
||||
|
||||
extern int iommu_attach_group(struct iommu_domain *domain,
|
||||
struct iommu_group *group);
|
||||
extern void iommu_detach_group(struct iommu_domain *domain,
|
||||
|
@ -454,6 +475,16 @@ static inline void iommu_reg_write(struct iommu_domain *domain,
|
|||
{
|
||||
}
|
||||
|
||||
static inline void iommu_get_dm_regions(struct device *dev,
|
||||
struct list_head *list)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void iommu_put_dm_regions(struct device *dev,
|
||||
struct list_head *list)
|
||||
{
|
||||
}
|
||||
|
||||
static inline int iommu_attach_group(struct iommu_domain *domain,
|
||||
struct iommu_group *group)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue