[v2,2/5] iommu/amd: Remove the unused struct amd_ir_data.ref
Commit Message
Since the amd_iommu_update_ga() has been switched to use the
modify_irte_ga() helper function to update the IRTE, the parameter
is no longer needed.
Suggested-by: Vasant Hegde <vasant.hegde@amd.com>
Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
---
drivers/iommu/amd/amd_iommu_types.h | 1 -
drivers/iommu/amd/iommu.c | 17 +++++++----------
2 files changed, 7 insertions(+), 11 deletions(-)
Comments
On Thu, May 18, 2023 at 08:55:26PM -0400, Suravee Suthikulpanit wrote:
> Since the amd_iommu_update_ga() has been switched to use the
> modify_irte_ga() helper function to update the IRTE, the parameter
> is no longer needed.
>
> Suggested-by: Vasant Hegde <vasant.hegde@amd.com>
> Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com>
> ---
> drivers/iommu/amd/amd_iommu_types.h | 1 -
> drivers/iommu/amd/iommu.c | 17 +++++++----------
> 2 files changed, 7 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/iommu/amd/amd_iommu_types.h b/drivers/iommu/amd/amd_iommu_types.h
> index 3d684190b4d5..a0ff1e852efc 100644
> --- a/drivers/iommu/amd/amd_iommu_types.h
> +++ b/drivers/iommu/amd/amd_iommu_types.h
> @@ -993,7 +993,6 @@ struct amd_ir_data {
> struct irq_2_irte irq_2_irte;
> struct msi_msg msi_entry;
> void *entry; /* Pointer to union irte or struct irte_ga */
> - void *ref; /* Pointer to the actual irte */
>
> /**
> * Store information for activate/de-activate
> diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
> index 4a3a7346ab21..0c4a2796bb0a 100644
> --- a/drivers/iommu/amd/iommu.c
> +++ b/drivers/iommu/amd/iommu.c
> @@ -2999,7 +2999,7 @@ static int alloc_irq_index(struct amd_iommu *iommu, u16 devid, int count,
> }
>
> static int modify_irte_ga(struct amd_iommu *iommu, u16 devid, int index,
> - struct irte_ga *irte, struct amd_ir_data *data)
> + struct irte_ga *irte)
> {
> bool ret;
> struct irq_remap_table *table;
> @@ -3026,9 +3026,6 @@ static int modify_irte_ga(struct amd_iommu *iommu, u16 devid, int index,
> */
> WARN_ON(!ret);
>
> - if (data)
> - data->ref = entry;
> -
> raw_spin_unlock_irqrestore(&table->lock, flags);
>
> iommu_flush_irt(iommu, devid);
> @@ -3117,7 +3114,7 @@ static void irte_ga_activate(struct amd_iommu *iommu, void *entry, u16 devid, u1
> struct irte_ga *irte = (struct irte_ga *) entry;
>
> irte->lo.fields_remap.valid = 1;
> - modify_irte_ga(iommu, devid, index, irte, NULL);
> + modify_irte_ga(iommu, devid, index, irte);
> }
>
> static void irte_deactivate(struct amd_iommu *iommu, void *entry, u16 devid, u16 index)
> @@ -3133,7 +3130,7 @@ static void irte_ga_deactivate(struct amd_iommu *iommu, void *entry, u16 devid,
> struct irte_ga *irte = (struct irte_ga *) entry;
>
> irte->lo.fields_remap.valid = 0;
> - modify_irte_ga(iommu, devid, index, irte, NULL);
> + modify_irte_ga(iommu, devid, index, irte);
> }
>
> static void irte_set_affinity(struct amd_iommu *iommu, void *entry, u16 devid, u16 index,
> @@ -3157,7 +3154,7 @@ static void irte_ga_set_affinity(struct amd_iommu *iommu, void *entry, u16 devid
> APICID_TO_IRTE_DEST_LO(dest_apicid);
> irte->hi.fields.destination =
> APICID_TO_IRTE_DEST_HI(dest_apicid);
> - modify_irte_ga(iommu, devid, index, irte, NULL);
> + modify_irte_ga(iommu, devid, index, irte);
> }
> }
>
> @@ -3508,7 +3505,7 @@ int amd_iommu_activate_guest_mode(void *data)
> entry->lo.fields_vapic.ga_tag = ir_data->ga_tag;
>
> return modify_irte_ga(ir_data->iommu, ir_data->irq_2_irte.devid,
> - ir_data->irq_2_irte.index, entry, ir_data);
> + ir_data->irq_2_irte.index, entry);
> }
> EXPORT_SYMBOL(amd_iommu_activate_guest_mode);
>
> @@ -3538,7 +3535,7 @@ int amd_iommu_deactivate_guest_mode(void *data)
> APICID_TO_IRTE_DEST_HI(cfg->dest_apicid);
>
> return modify_irte_ga(ir_data->iommu, ir_data->irq_2_irte.devid,
> - ir_data->irq_2_irte.index, entry, ir_data);
> + ir_data->irq_2_irte.index, entry);
> }
> EXPORT_SYMBOL(amd_iommu_deactivate_guest_mode);
>
> @@ -3719,7 +3716,7 @@ int amd_iommu_update_ga(int cpu, bool is_run, void *data)
> entry->lo.fields_vapic.is_run = is_run;
>
> return modify_irte_ga(ir_data->iommu, ir_data->irq_2_irte.devid,
> - ir_data->irq_2_irte.index, entry, ir_data);
> + ir_data->irq_2_irte.index, entry);
> }
> EXPORT_SYMBOL(amd_iommu_update_ga);
> #endif
> --
> 2.31.1
>
@@ -993,7 +993,6 @@ struct amd_ir_data {
struct irq_2_irte irq_2_irte;
struct msi_msg msi_entry;
void *entry; /* Pointer to union irte or struct irte_ga */
- void *ref; /* Pointer to the actual irte */
/**
* Store information for activate/de-activate
@@ -2999,7 +2999,7 @@ static int alloc_irq_index(struct amd_iommu *iommu, u16 devid, int count,
}
static int modify_irte_ga(struct amd_iommu *iommu, u16 devid, int index,
- struct irte_ga *irte, struct amd_ir_data *data)
+ struct irte_ga *irte)
{
bool ret;
struct irq_remap_table *table;
@@ -3026,9 +3026,6 @@ static int modify_irte_ga(struct amd_iommu *iommu, u16 devid, int index,
*/
WARN_ON(!ret);
- if (data)
- data->ref = entry;
-
raw_spin_unlock_irqrestore(&table->lock, flags);
iommu_flush_irt(iommu, devid);
@@ -3117,7 +3114,7 @@ static void irte_ga_activate(struct amd_iommu *iommu, void *entry, u16 devid, u1
struct irte_ga *irte = (struct irte_ga *) entry;
irte->lo.fields_remap.valid = 1;
- modify_irte_ga(iommu, devid, index, irte, NULL);
+ modify_irte_ga(iommu, devid, index, irte);
}
static void irte_deactivate(struct amd_iommu *iommu, void *entry, u16 devid, u16 index)
@@ -3133,7 +3130,7 @@ static void irte_ga_deactivate(struct amd_iommu *iommu, void *entry, u16 devid,
struct irte_ga *irte = (struct irte_ga *) entry;
irte->lo.fields_remap.valid = 0;
- modify_irte_ga(iommu, devid, index, irte, NULL);
+ modify_irte_ga(iommu, devid, index, irte);
}
static void irte_set_affinity(struct amd_iommu *iommu, void *entry, u16 devid, u16 index,
@@ -3157,7 +3154,7 @@ static void irte_ga_set_affinity(struct amd_iommu *iommu, void *entry, u16 devid
APICID_TO_IRTE_DEST_LO(dest_apicid);
irte->hi.fields.destination =
APICID_TO_IRTE_DEST_HI(dest_apicid);
- modify_irte_ga(iommu, devid, index, irte, NULL);
+ modify_irte_ga(iommu, devid, index, irte);
}
}
@@ -3508,7 +3505,7 @@ int amd_iommu_activate_guest_mode(void *data)
entry->lo.fields_vapic.ga_tag = ir_data->ga_tag;
return modify_irte_ga(ir_data->iommu, ir_data->irq_2_irte.devid,
- ir_data->irq_2_irte.index, entry, ir_data);
+ ir_data->irq_2_irte.index, entry);
}
EXPORT_SYMBOL(amd_iommu_activate_guest_mode);
@@ -3538,7 +3535,7 @@ int amd_iommu_deactivate_guest_mode(void *data)
APICID_TO_IRTE_DEST_HI(cfg->dest_apicid);
return modify_irte_ga(ir_data->iommu, ir_data->irq_2_irte.devid,
- ir_data->irq_2_irte.index, entry, ir_data);
+ ir_data->irq_2_irte.index, entry);
}
EXPORT_SYMBOL(amd_iommu_deactivate_guest_mode);
@@ -3719,7 +3716,7 @@ int amd_iommu_update_ga(int cpu, bool is_run, void *data)
entry->lo.fields_vapic.is_run = is_run;
return modify_irte_ga(ir_data->iommu, ir_data->irq_2_irte.devid,
- ir_data->irq_2_irte.index, entry, ir_data);
+ ir_data->irq_2_irte.index, entry);
}
EXPORT_SYMBOL(amd_iommu_update_ga);
#endif