iommu/amd: Pass struct iommu_dev_data to set_dte_entry()
Pass iommu_dev_data structure instead of passing indivisual variables. No functional changes intended. Signed-off-by: Vasant Hegde <vasant.hegde@amd.com> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Link: https://lore.kernel.org/r/20240205115615.6053-2-vasant.hegde@amd.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
This commit is contained in:
committed by
Joerg Roedel
parent
108042db53
commit
a6ffb9b3d7
@@ -1700,12 +1700,14 @@ static int setup_gcr3_table(struct protection_domain *domain, int pasids)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void set_dte_entry(struct amd_iommu *iommu, u16 devid,
|
||||
struct protection_domain *domain, bool ats, bool ppr)
|
||||
static void set_dte_entry(struct amd_iommu *iommu,
|
||||
struct iommu_dev_data *dev_data)
|
||||
{
|
||||
u64 pte_root = 0;
|
||||
u64 flags = 0;
|
||||
u32 old_domid;
|
||||
u16 devid = dev_data->devid;
|
||||
struct protection_domain *domain = dev_data->domain;
|
||||
struct dev_table_entry *dev_table = get_dev_table(iommu);
|
||||
|
||||
if (domain->iop.mode != PAGE_MODE_NONE)
|
||||
@@ -1725,10 +1727,10 @@ static void set_dte_entry(struct amd_iommu *iommu, u16 devid,
|
||||
|
||||
flags = dev_table[devid].data[1];
|
||||
|
||||
if (ats)
|
||||
if (dev_data->ats_enabled)
|
||||
flags |= DTE_FLAG_IOTLB;
|
||||
|
||||
if (ppr)
|
||||
if (dev_data->ppr)
|
||||
pte_root |= 1ULL << DEV_ENTRY_PPR;
|
||||
|
||||
if (domain->dirty_tracking)
|
||||
@@ -1804,12 +1806,10 @@ static void do_attach(struct iommu_dev_data *dev_data,
|
||||
struct protection_domain *domain)
|
||||
{
|
||||
struct amd_iommu *iommu;
|
||||
bool ats;
|
||||
|
||||
iommu = rlookup_amd_iommu(dev_data->dev);
|
||||
if (!iommu)
|
||||
return;
|
||||
ats = dev_data->ats_enabled;
|
||||
|
||||
/* Update data structures */
|
||||
dev_data->domain = domain;
|
||||
@@ -1824,8 +1824,7 @@ static void do_attach(struct iommu_dev_data *dev_data,
|
||||
domain->dev_cnt += 1;
|
||||
|
||||
/* Update device table */
|
||||
set_dte_entry(iommu, dev_data->devid, domain,
|
||||
ats, dev_data->ppr);
|
||||
set_dte_entry(iommu, dev_data);
|
||||
clone_aliases(iommu, dev_data->dev);
|
||||
|
||||
device_flush_dte(dev_data);
|
||||
@@ -2008,8 +2007,7 @@ static void update_device_table(struct protection_domain *domain)
|
||||
|
||||
if (!iommu)
|
||||
continue;
|
||||
set_dte_entry(iommu, dev_data->devid, domain,
|
||||
dev_data->ats_enabled, dev_data->ppr);
|
||||
set_dte_entry(iommu, dev_data);
|
||||
clone_aliases(iommu, dev_data->dev);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user