Skip to content

Commit f9b4df7

Browse files
ssuthiku-amdjoergroedel
authored andcommitted
iommu/amd: Declare functions as extern
And move declaration to header file so that they can be included across multiple files. There is no functional change. Signed-off-by: Suravee Suthikulpanit <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent 1f58553 commit f9b4df7

File tree

2 files changed

+22
-20
lines changed

2 files changed

+22
-20
lines changed

drivers/iommu/amd/amd_iommu.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ extern int amd_iommu_domain_enable_v2(struct iommu_domain *dom, int pasids);
5757
extern int amd_iommu_flush_page(struct iommu_domain *dom, u32 pasid,
5858
u64 address);
5959
extern void amd_iommu_update_and_flush_device_table(struct protection_domain *domain);
60+
extern void amd_iommu_domain_update(struct protection_domain *domain);
61+
extern void amd_iommu_domain_flush_complete(struct protection_domain *domain);
62+
extern void amd_iommu_domain_flush_tlb_pde(struct protection_domain *domain);
6063
extern int amd_iommu_flush_tlb(struct iommu_domain *dom, u32 pasid);
6164
extern int amd_iommu_domain_set_gcr3(struct iommu_domain *dom, u32 pasid,
6265
unsigned long cr3);

drivers/iommu/amd/iommu.c

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ struct iommu_cmd {
8686

8787
struct kmem_cache *amd_iommu_irq_cache;
8888

89-
static void update_domain(struct protection_domain *domain);
9089
static void detach_device(struct device *dev);
9190

9291
/****************************************************************************
@@ -1313,12 +1312,12 @@ static void domain_flush_pages(struct protection_domain *domain,
13131312
}
13141313

13151314
/* Flush the whole IO/TLB for a given protection domain - including PDE */
1316-
static void domain_flush_tlb_pde(struct protection_domain *domain)
1315+
void amd_iommu_domain_flush_tlb_pde(struct protection_domain *domain)
13171316
{
13181317
__domain_flush_pages(domain, 0, CMD_INV_IOMMU_ALL_PAGES_ADDRESS, 1);
13191318
}
13201319

1321-
static void domain_flush_complete(struct protection_domain *domain)
1320+
void amd_iommu_domain_flush_complete(struct protection_domain *domain)
13221321
{
13231322
int i;
13241323

@@ -1343,7 +1342,7 @@ static void domain_flush_np_cache(struct protection_domain *domain,
13431342

13441343
spin_lock_irqsave(&domain->lock, flags);
13451344
domain_flush_pages(domain, iova, size);
1346-
domain_flush_complete(domain);
1345+
amd_iommu_domain_flush_complete(domain);
13471346
spin_unlock_irqrestore(&domain->lock, flags);
13481347
}
13491348
}
@@ -1500,7 +1499,7 @@ static bool increase_address_space(struct protection_domain *domain,
15001499
pgtable.root = pte;
15011500
pgtable.mode += 1;
15021501
amd_iommu_update_and_flush_device_table(domain);
1503-
domain_flush_complete(domain);
1502+
amd_iommu_domain_flush_complete(domain);
15041503

15051504
/*
15061505
* Device Table needs to be updated and flushed before the new root can
@@ -1753,8 +1752,8 @@ static int iommu_map_page(struct protection_domain *dom,
17531752
* Updates and flushing already happened in
17541753
* increase_address_space().
17551754
*/
1756-
domain_flush_tlb_pde(dom);
1757-
domain_flush_complete(dom);
1755+
amd_iommu_domain_flush_tlb_pde(dom);
1756+
amd_iommu_domain_flush_complete(dom);
17581757
spin_unlock_irqrestore(&dom->lock, flags);
17591758
}
17601759

@@ -1997,10 +1996,10 @@ static void do_detach(struct iommu_dev_data *dev_data)
19971996
device_flush_dte(dev_data);
19981997

19991998
/* Flush IOTLB */
2000-
domain_flush_tlb_pde(domain);
1999+
amd_iommu_domain_flush_tlb_pde(domain);
20012000

20022001
/* Wait for the flushes to finish */
2003-
domain_flush_complete(domain);
2002+
amd_iommu_domain_flush_complete(domain);
20042003

20052004
/* decrease reference counters - needs to happen after the flushes */
20062005
domain->dev_iommu[iommu->index] -= 1;
@@ -2133,9 +2132,9 @@ static int attach_device(struct device *dev,
21332132
* left the caches in the IOMMU dirty. So we have to flush
21342133
* here to evict all dirty stuff.
21352134
*/
2136-
domain_flush_tlb_pde(domain);
2135+
amd_iommu_domain_flush_tlb_pde(domain);
21372136

2138-
domain_flush_complete(domain);
2137+
amd_iommu_domain_flush_complete(domain);
21392138

21402139
out:
21412140
spin_unlock(&dev_data->lock);
@@ -2297,7 +2296,7 @@ void amd_iommu_update_and_flush_device_table(struct protection_domain *domain)
22972296
domain_flush_devices(domain);
22982297
}
22992298

2300-
static void update_domain(struct protection_domain *domain)
2299+
void amd_iommu_domain_update(struct protection_domain *domain)
23012300
{
23022301
struct domain_pgtable pgtable;
23032302

@@ -2306,8 +2305,8 @@ static void update_domain(struct protection_domain *domain)
23062305
amd_iommu_update_and_flush_device_table(domain);
23072306

23082307
/* Flush domain TLB(s) and wait for completion */
2309-
domain_flush_tlb_pde(domain);
2310-
domain_flush_complete(domain);
2308+
amd_iommu_domain_flush_tlb_pde(domain);
2309+
amd_iommu_domain_flush_complete(domain);
23112310
}
23122311

23132312
int __init amd_iommu_init_api(void)
@@ -2695,8 +2694,8 @@ static void amd_iommu_flush_iotlb_all(struct iommu_domain *domain)
26952694
unsigned long flags;
26962695

26972696
spin_lock_irqsave(&dom->lock, flags);
2698-
domain_flush_tlb_pde(dom);
2699-
domain_flush_complete(dom);
2697+
amd_iommu_domain_flush_tlb_pde(dom);
2698+
amd_iommu_domain_flush_complete(dom);
27002699
spin_unlock_irqrestore(&dom->lock, flags);
27012700
}
27022701

@@ -2786,7 +2785,7 @@ void amd_iommu_domain_direct_map(struct iommu_domain *dom)
27862785
amd_iommu_domain_clr_pt_root(domain);
27872786

27882787
/* Make changes visible to IOMMUs */
2789-
update_domain(domain);
2788+
amd_iommu_domain_update(domain);
27902789

27912790
/* Page-table is not visible to IOMMU anymore, so free it */
27922791
free_pagetable(&pgtable);
@@ -2830,7 +2829,7 @@ int amd_iommu_domain_enable_v2(struct iommu_domain *dom, int pasids)
28302829
domain->glx = levels;
28312830
domain->flags |= PD_IOMMUV2_MASK;
28322831

2833-
update_domain(domain);
2832+
amd_iommu_domain_update(domain);
28342833

28352834
ret = 0;
28362835

@@ -2867,7 +2866,7 @@ static int __flush_pasid(struct protection_domain *domain, u32 pasid,
28672866
}
28682867

28692868
/* Wait until IOMMU TLB flushes are complete */
2870-
domain_flush_complete(domain);
2869+
amd_iommu_domain_flush_complete(domain);
28712870

28722871
/* Now flush device TLBs */
28732872
list_for_each_entry(dev_data, &domain->dev_list, list) {
@@ -2893,7 +2892,7 @@ static int __flush_pasid(struct protection_domain *domain, u32 pasid,
28932892
}
28942893

28952894
/* Wait until all device TLBs are flushed */
2896-
domain_flush_complete(domain);
2895+
amd_iommu_domain_flush_complete(domain);
28972896

28982897
ret = 0;
28992898

0 commit comments

Comments
 (0)