Skip to content

Commit 02b9902

Browse files
hegdevasantjoergroedel
authored andcommitted
iommu/amd: Remove unused flush pasid functions
We have removed iommu_v2 module and converted v2 page table to use common flush functions. Also we have moved GCR3 table to per device. PASID related functions are not used. Hence remove these unused functions. Signed-off-by: Vasant Hegde <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent cf70873 commit 02b9902

File tree

2 files changed

+0
-103
lines changed

2 files changed

+0
-103
lines changed

drivers/iommu/amd/amd_iommu.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ int amd_iommu_set_gcr3(struct iommu_dev_data *dev_data,
4949
ioasid_t pasid, unsigned long gcr3);
5050
int amd_iommu_clear_gcr3(struct iommu_dev_data *dev_data, ioasid_t pasid);
5151

52-
int amd_iommu_flush_page(struct iommu_domain *dom, u32 pasid, u64 address);
5352
/*
5453
* This function flushes all internal caches of
5554
* the IOMMU used by this driver.
@@ -65,8 +64,6 @@ void amd_iommu_dev_flush_pasid_pages(struct iommu_dev_data *dev_data,
6564
void amd_iommu_dev_flush_pasid_all(struct iommu_dev_data *dev_data,
6665
ioasid_t pasid);
6766

68-
int amd_iommu_flush_tlb(struct iommu_domain *dom, u32 pasid);
69-
7067
#ifdef CONFIG_IRQ_REMAP
7168
int amd_iommu_create_irq_domain(struct amd_iommu *iommu);
7269
#else

drivers/iommu/amd/iommu.c

Lines changed: 0 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -2747,106 +2747,6 @@ const struct iommu_ops amd_iommu_ops = {
27472747
}
27482748
};
27492749

2750-
static int __flush_pasid(struct protection_domain *domain, u32 pasid,
2751-
u64 address, size_t size)
2752-
{
2753-
struct iommu_dev_data *dev_data;
2754-
struct iommu_cmd cmd;
2755-
int i, ret;
2756-
2757-
if (!(domain->flags & PD_IOMMUV2_MASK))
2758-
return -EINVAL;
2759-
2760-
build_inv_iommu_pages(&cmd, address, size, domain->id, pasid, true);
2761-
2762-
/*
2763-
* IOMMU TLB needs to be flushed before Device TLB to
2764-
* prevent device TLB refill from IOMMU TLB
2765-
*/
2766-
for (i = 0; i < amd_iommu_get_num_iommus(); ++i) {
2767-
if (domain->dev_iommu[i] == 0)
2768-
continue;
2769-
2770-
ret = iommu_queue_command(amd_iommus[i], &cmd);
2771-
if (ret != 0)
2772-
goto out;
2773-
}
2774-
2775-
/* Wait until IOMMU TLB flushes are complete */
2776-
amd_iommu_domain_flush_complete(domain);
2777-
2778-
/* Now flush device TLBs */
2779-
list_for_each_entry(dev_data, &domain->dev_list, list) {
2780-
struct amd_iommu *iommu;
2781-
int qdep;
2782-
2783-
/*
2784-
There might be non-IOMMUv2 capable devices in an IOMMUv2
2785-
* domain.
2786-
*/
2787-
if (!dev_data->ats_enabled)
2788-
continue;
2789-
2790-
qdep = dev_data->ats_qdep;
2791-
iommu = rlookup_amd_iommu(dev_data->dev);
2792-
if (!iommu)
2793-
continue;
2794-
build_inv_iotlb_pages(&cmd, dev_data->devid, qdep,
2795-
address, size, pasid, true);
2796-
2797-
ret = iommu_queue_command(iommu, &cmd);
2798-
if (ret != 0)
2799-
goto out;
2800-
}
2801-
2802-
/* Wait until all device TLBs are flushed */
2803-
amd_iommu_domain_flush_complete(domain);
2804-
2805-
ret = 0;
2806-
2807-
out:
2808-
2809-
return ret;
2810-
}
2811-
2812-
static int __amd_iommu_flush_page(struct protection_domain *domain, u32 pasid,
2813-
u64 address)
2814-
{
2815-
return __flush_pasid(domain, pasid, address, PAGE_SIZE);
2816-
}
2817-
2818-
int amd_iommu_flush_page(struct iommu_domain *dom, u32 pasid,
2819-
u64 address)
2820-
{
2821-
struct protection_domain *domain = to_pdomain(dom);
2822-
unsigned long flags;
2823-
int ret;
2824-
2825-
spin_lock_irqsave(&domain->lock, flags);
2826-
ret = __amd_iommu_flush_page(domain, pasid, address);
2827-
spin_unlock_irqrestore(&domain->lock, flags);
2828-
2829-
return ret;
2830-
}
2831-
2832-
static int __amd_iommu_flush_tlb(struct protection_domain *domain, u32 pasid)
2833-
{
2834-
return __flush_pasid(domain, pasid, 0, CMD_INV_IOMMU_ALL_PAGES_ADDRESS);
2835-
}
2836-
2837-
int amd_iommu_flush_tlb(struct iommu_domain *dom, u32 pasid)
2838-
{
2839-
struct protection_domain *domain = to_pdomain(dom);
2840-
unsigned long flags;
2841-
int ret;
2842-
2843-
spin_lock_irqsave(&domain->lock, flags);
2844-
ret = __amd_iommu_flush_tlb(domain, pasid);
2845-
spin_unlock_irqrestore(&domain->lock, flags);
2846-
2847-
return ret;
2848-
}
2849-
28502750
int amd_iommu_complete_ppr(struct pci_dev *pdev, u32 pasid,
28512751
int status, int tag)
28522752
{

0 commit comments

Comments
 (0)