mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-07 15:18:15 +00:00
iommu/ipmmu-vmsa: Use fwspec on both 32 and 64-bit ARM
Consolidate the 32-bit and 64-bit code to make use of fwspec instead of archdata for the 32-bit ARM case. This is a simplified version of the fwspec handling code from Robin posted as [PATCH] iommu/ipmmu-vmsa: Convert to iommu_fwspec Signed-off-by: Robin Murphy <robin.murphy@arm.com> Signed-off-by: Magnus Damm <damm+renesas@opensource.se> Signed-off-by: Joerg Roedel <jroedel@suse.de>
This commit is contained in:
parent
49558da030
commit
3c49ed322b
1 changed files with 3 additions and 18 deletions
|
@ -73,22 +73,9 @@ static struct ipmmu_vmsa_domain *to_vmsa_domain(struct iommu_domain *dom)
|
||||||
return container_of(dom, struct ipmmu_vmsa_domain, io_domain);
|
return container_of(dom, struct ipmmu_vmsa_domain, io_domain);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static struct ipmmu_vmsa_iommu_priv *to_priv(struct device *dev)
|
static struct ipmmu_vmsa_iommu_priv *to_priv(struct device *dev)
|
||||||
{
|
{
|
||||||
#if defined(CONFIG_ARM)
|
return dev->iommu_fwspec ? dev->iommu_fwspec->iommu_priv : NULL;
|
||||||
return dev->archdata.iommu;
|
|
||||||
#else
|
|
||||||
return dev->iommu_fwspec->iommu_priv;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
static void set_priv(struct device *dev, struct ipmmu_vmsa_iommu_priv *p)
|
|
||||||
{
|
|
||||||
#if defined(CONFIG_ARM)
|
|
||||||
dev->archdata.iommu = p;
|
|
||||||
#else
|
|
||||||
dev->iommu_fwspec->iommu_priv = p;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define TLB_LOOP_TIMEOUT 100 /* 100us */
|
#define TLB_LOOP_TIMEOUT 100 /* 100us */
|
||||||
|
@ -726,7 +713,7 @@ static int ipmmu_init_platform_device(struct device *dev)
|
||||||
priv->utlbs = utlbs;
|
priv->utlbs = utlbs;
|
||||||
priv->num_utlbs = num_utlbs;
|
priv->num_utlbs = num_utlbs;
|
||||||
priv->dev = dev;
|
priv->dev = dev;
|
||||||
set_priv(dev, priv);
|
dev->iommu_fwspec->iommu_priv = priv;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
@ -887,14 +874,12 @@ static void ipmmu_domain_free_dma(struct iommu_domain *io_domain)
|
||||||
|
|
||||||
static int ipmmu_add_device_dma(struct device *dev)
|
static int ipmmu_add_device_dma(struct device *dev)
|
||||||
{
|
{
|
||||||
struct iommu_fwspec *fwspec = dev->iommu_fwspec;
|
|
||||||
struct iommu_group *group;
|
struct iommu_group *group;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Only let through devices that have been verified in xlate()
|
* Only let through devices that have been verified in xlate()
|
||||||
* We may get called with dev->iommu_fwspec set to NULL.
|
|
||||||
*/
|
*/
|
||||||
if (!fwspec || !fwspec->iommu_priv)
|
if (!to_priv(dev))
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
group = iommu_group_get_for_dev(dev);
|
group = iommu_group_get_for_dev(dev);
|
||||||
|
|
Loading…
Add table
Reference in a new issue