Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 358830
b: refs/heads/master
c: 6935671
h: refs/heads/master
v: v3
  • Loading branch information
Joerg Roedel committed Feb 6, 2013
1 parent 0f1a6fd commit 23da2df
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d7787d579cbef9f8079104759a2259fc916c688c
refs/heads/master: 693567125bde1966a095267a9d8ca1b8d40f59ee
33 changes: 30 additions & 3 deletions trunk/drivers/iommu/iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -891,6 +891,7 @@ int iommu_domain_get_attr(struct iommu_domain *domain,
struct iommu_domain_geometry *geometry;
bool *paging;
int ret = 0;
u32 *count;

switch (attr) {
case DOMAIN_ATTR_GEOMETRY:
Expand All @@ -901,6 +902,15 @@ int iommu_domain_get_attr(struct iommu_domain *domain,
case DOMAIN_ATTR_PAGING:
paging = data;
*paging = (domain->ops->pgsize_bitmap != 0UL);
break;
case DOMAIN_ATTR_WINDOWS:
count = data;

if (domain->ops->domain_get_windows != NULL)
*count = domain->ops->domain_get_windows(domain);
else
ret = -ENODEV;

break;
default:
if (!domain->ops->domain_get_attr)
Expand All @@ -916,9 +926,26 @@ EXPORT_SYMBOL_GPL(iommu_domain_get_attr);
int iommu_domain_set_attr(struct iommu_domain *domain,
enum iommu_attr attr, void *data)
{
if (!domain->ops->domain_set_attr)
return -EINVAL;
int ret = 0;
u32 *count;

switch (attr) {
case DOMAIN_ATTR_WINDOWS:
count = data;

if (domain->ops->domain_set_windows != NULL)
ret = domain->ops->domain_set_windows(domain, *count);
else
ret = -ENODEV;

return domain->ops->domain_set_attr(domain, attr, data);
break;
default:
if (domain->ops->domain_set_attr == NULL)
return -EINVAL;

ret = domain->ops->domain_set_attr(domain, attr, data);
}

return ret;
}
EXPORT_SYMBOL_GPL(iommu_domain_set_attr);
5 changes: 5 additions & 0 deletions trunk/include/linux/iommu.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ struct iommu_domain {
enum iommu_attr {
DOMAIN_ATTR_GEOMETRY,
DOMAIN_ATTR_PAGING,
DOMAIN_ATTR_WINDOWS,
DOMAIN_ATTR_MAX,
};

Expand Down Expand Up @@ -106,6 +107,10 @@ struct iommu_ops {
int (*domain_window_enable)(struct iommu_domain *domain, u32 wnd_nr,
phys_addr_t paddr, u64 size);
void (*domain_window_disable)(struct iommu_domain *domain, u32 wnd_nr);
/* Set the numer of window per domain */
int (*domain_set_windows)(struct iommu_domain *domain, u32 w_count);
/* Get the numer of window per domain */
u32 (*domain_get_windows)(struct iommu_domain *domain);

unsigned long pgsize_bitmap;
};
Expand Down

0 comments on commit 23da2df

Please sign in to comment.