mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-15 08:44:14 +08:00
iommu: remove DOMAIN_ATTR_GEOMETRY
The geometry information can be trivially queried from the iommu_domain struture. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Will Deacon <will@kernel.org> Acked-by: Li Yang <leoyang.li@nxp.com> Link: https://lore.kernel.org/r/20210401155256.298656-16-hch@lst.de Signed-off-by: Joerg Roedel <jroedel@suse.de>
This commit is contained in:
parent
9fb5fad562
commit
bc9a05eef1
@ -2667,23 +2667,9 @@ core_initcall(iommu_init);
|
|||||||
int iommu_domain_get_attr(struct iommu_domain *domain,
|
int iommu_domain_get_attr(struct iommu_domain *domain,
|
||||||
enum iommu_attr attr, void *data)
|
enum iommu_attr attr, void *data)
|
||||||
{
|
{
|
||||||
struct iommu_domain_geometry *geometry;
|
if (!domain->ops->domain_get_attr)
|
||||||
int ret = 0;
|
return -EINVAL;
|
||||||
|
return domain->ops->domain_get_attr(domain, attr, data);
|
||||||
switch (attr) {
|
|
||||||
case DOMAIN_ATTR_GEOMETRY:
|
|
||||||
geometry = data;
|
|
||||||
*geometry = domain->geometry;
|
|
||||||
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if (!domain->ops->domain_get_attr)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
ret = domain->ops->domain_get_attr(domain, attr, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(iommu_domain_get_attr);
|
EXPORT_SYMBOL_GPL(iommu_domain_get_attr);
|
||||||
|
|
||||||
|
@ -2252,7 +2252,7 @@ static int vfio_iommu_type1_attach_group(void *iommu_data,
|
|||||||
int ret;
|
int ret;
|
||||||
bool resv_msi, msi_remap;
|
bool resv_msi, msi_remap;
|
||||||
phys_addr_t resv_msi_base = 0;
|
phys_addr_t resv_msi_base = 0;
|
||||||
struct iommu_domain_geometry geo;
|
struct iommu_domain_geometry *geo;
|
||||||
LIST_HEAD(iova_copy);
|
LIST_HEAD(iova_copy);
|
||||||
LIST_HEAD(group_resv_regions);
|
LIST_HEAD(group_resv_regions);
|
||||||
|
|
||||||
@ -2333,10 +2333,9 @@ static int vfio_iommu_type1_attach_group(void *iommu_data,
|
|||||||
goto out_domain;
|
goto out_domain;
|
||||||
|
|
||||||
/* Get aperture info */
|
/* Get aperture info */
|
||||||
iommu_domain_get_attr(domain->domain, DOMAIN_ATTR_GEOMETRY, &geo);
|
geo = &domain->domain->geometry;
|
||||||
|
if (vfio_iommu_aper_conflict(iommu, geo->aperture_start,
|
||||||
if (vfio_iommu_aper_conflict(iommu, geo.aperture_start,
|
geo->aperture_end)) {
|
||||||
geo.aperture_end)) {
|
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto out_detach;
|
goto out_detach;
|
||||||
}
|
}
|
||||||
@ -2359,8 +2358,8 @@ static int vfio_iommu_type1_attach_group(void *iommu_data,
|
|||||||
if (ret)
|
if (ret)
|
||||||
goto out_detach;
|
goto out_detach;
|
||||||
|
|
||||||
ret = vfio_iommu_aper_resize(&iova_copy, geo.aperture_start,
|
ret = vfio_iommu_aper_resize(&iova_copy, geo->aperture_start,
|
||||||
geo.aperture_end);
|
geo->aperture_end);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto out_detach;
|
goto out_detach;
|
||||||
|
|
||||||
@ -2493,7 +2492,6 @@ static void vfio_iommu_aper_expand(struct vfio_iommu *iommu,
|
|||||||
struct list_head *iova_copy)
|
struct list_head *iova_copy)
|
||||||
{
|
{
|
||||||
struct vfio_domain *domain;
|
struct vfio_domain *domain;
|
||||||
struct iommu_domain_geometry geo;
|
|
||||||
struct vfio_iova *node;
|
struct vfio_iova *node;
|
||||||
dma_addr_t start = 0;
|
dma_addr_t start = 0;
|
||||||
dma_addr_t end = (dma_addr_t)~0;
|
dma_addr_t end = (dma_addr_t)~0;
|
||||||
@ -2502,12 +2500,12 @@ static void vfio_iommu_aper_expand(struct vfio_iommu *iommu,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
list_for_each_entry(domain, &iommu->domain_list, next) {
|
list_for_each_entry(domain, &iommu->domain_list, next) {
|
||||||
iommu_domain_get_attr(domain->domain, DOMAIN_ATTR_GEOMETRY,
|
struct iommu_domain_geometry *geo = &domain->domain->geometry;
|
||||||
&geo);
|
|
||||||
if (geo.aperture_start > start)
|
if (geo->aperture_start > start)
|
||||||
start = geo.aperture_start;
|
start = geo->aperture_start;
|
||||||
if (geo.aperture_end < end)
|
if (geo->aperture_end < end)
|
||||||
end = geo.aperture_end;
|
end = geo->aperture_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Modify aperture limits. The new aper is either same or bigger */
|
/* Modify aperture limits. The new aper is either same or bigger */
|
||||||
|
@ -826,18 +826,14 @@ static void vhost_vdpa_free_domain(struct vhost_vdpa *v)
|
|||||||
static void vhost_vdpa_set_iova_range(struct vhost_vdpa *v)
|
static void vhost_vdpa_set_iova_range(struct vhost_vdpa *v)
|
||||||
{
|
{
|
||||||
struct vdpa_iova_range *range = &v->range;
|
struct vdpa_iova_range *range = &v->range;
|
||||||
struct iommu_domain_geometry geo;
|
|
||||||
struct vdpa_device *vdpa = v->vdpa;
|
struct vdpa_device *vdpa = v->vdpa;
|
||||||
const struct vdpa_config_ops *ops = vdpa->config;
|
const struct vdpa_config_ops *ops = vdpa->config;
|
||||||
|
|
||||||
if (ops->get_iova_range) {
|
if (ops->get_iova_range) {
|
||||||
*range = ops->get_iova_range(vdpa);
|
*range = ops->get_iova_range(vdpa);
|
||||||
} else if (v->domain &&
|
} else if (v->domain && v->domain->geometry.force_aperture) {
|
||||||
!iommu_domain_get_attr(v->domain,
|
range->first = v->domain->geometry.aperture_start;
|
||||||
DOMAIN_ATTR_GEOMETRY, &geo) &&
|
range->last = v->domain->geometry.aperture_end;
|
||||||
geo.force_aperture) {
|
|
||||||
range->first = geo.aperture_start;
|
|
||||||
range->last = geo.aperture_end;
|
|
||||||
} else {
|
} else {
|
||||||
range->first = 0;
|
range->first = 0;
|
||||||
range->last = ULLONG_MAX;
|
range->last = ULLONG_MAX;
|
||||||
|
@ -107,7 +107,6 @@ enum iommu_cap {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
enum iommu_attr {
|
enum iommu_attr {
|
||||||
DOMAIN_ATTR_GEOMETRY,
|
|
||||||
DOMAIN_ATTR_NESTING, /* two stages of translation */
|
DOMAIN_ATTR_NESTING, /* two stages of translation */
|
||||||
DOMAIN_ATTR_DMA_USE_FLUSH_QUEUE,
|
DOMAIN_ATTR_DMA_USE_FLUSH_QUEUE,
|
||||||
DOMAIN_ATTR_IO_PGTABLE_CFG,
|
DOMAIN_ATTR_IO_PGTABLE_CFG,
|
||||||
|
Loading…
Reference in New Issue
Block a user