Skip to content

Commit 1ce018d

Browse files
committed
iommu/amd: Fix compile error for unused function
Recent changes introduced a compile error: drivers/iommu/amd/iommu.c:1285:13: error: ‘iommu_flush_irt_and_complete’ defined but not used [-Werror=unused-function] 1285 | static void iommu_flush_irt_and_complete(struct amd_iommu *iommu, u16 devid) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ This happens with defconfig-x86_64 because AMD IOMMU is enabled but CONFIG_IRQ_REMAP is disabled. Move the function under #ifdef CONFIG_IRQ_REMAP to fix the error. Signed-off-by: Joerg Roedel <[email protected]>
1 parent bccc37a commit 1ce018d

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

drivers/iommu/amd/iommu.c

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1275,32 +1275,6 @@ static void amd_iommu_flush_irt_all(struct amd_iommu *iommu)
12751275
iommu_completion_wait(iommu);
12761276
}
12771277

1278-
static void iommu_flush_irt_and_complete(struct amd_iommu *iommu, u16 devid)
1279-
{
1280-
int ret;
1281-
u64 data;
1282-
unsigned long flags;
1283-
struct iommu_cmd cmd, cmd2;
1284-
1285-
if (iommu->irtcachedis_enabled)
1286-
return;
1287-
1288-
build_inv_irt(&cmd, devid);
1289-
data = atomic64_add_return(1, &iommu->cmd_sem_val);
1290-
build_completion_wait(&cmd2, iommu, data);
1291-
1292-
raw_spin_lock_irqsave(&iommu->lock, flags);
1293-
ret = __iommu_queue_command_sync(iommu, &cmd, true);
1294-
if (ret)
1295-
goto out;
1296-
ret = __iommu_queue_command_sync(iommu, &cmd2, false);
1297-
if (ret)
1298-
goto out;
1299-
wait_on_sem(iommu, data);
1300-
out:
1301-
raw_spin_unlock_irqrestore(&iommu->lock, flags);
1302-
}
1303-
13041278
void iommu_flush_all_caches(struct amd_iommu *iommu)
13051279
{
13061280
if (iommu_feature(iommu, FEATURE_IA)) {
@@ -2831,6 +2805,32 @@ EXPORT_SYMBOL(amd_iommu_device_info);
28312805
static struct irq_chip amd_ir_chip;
28322806
static DEFINE_SPINLOCK(iommu_table_lock);
28332807

2808+
static void iommu_flush_irt_and_complete(struct amd_iommu *iommu, u16 devid)
2809+
{
2810+
int ret;
2811+
u64 data;
2812+
unsigned long flags;
2813+
struct iommu_cmd cmd, cmd2;
2814+
2815+
if (iommu->irtcachedis_enabled)
2816+
return;
2817+
2818+
build_inv_irt(&cmd, devid);
2819+
data = atomic64_add_return(1, &iommu->cmd_sem_val);
2820+
build_completion_wait(&cmd2, iommu, data);
2821+
2822+
raw_spin_lock_irqsave(&iommu->lock, flags);
2823+
ret = __iommu_queue_command_sync(iommu, &cmd, true);
2824+
if (ret)
2825+
goto out;
2826+
ret = __iommu_queue_command_sync(iommu, &cmd2, false);
2827+
if (ret)
2828+
goto out;
2829+
wait_on_sem(iommu, data);
2830+
out:
2831+
raw_spin_unlock_irqrestore(&iommu->lock, flags);
2832+
}
2833+
28342834
static void set_dte_irq_entry(struct amd_iommu *iommu, u16 devid,
28352835
struct irq_remap_table *table)
28362836
{

0 commit comments

Comments
 (0)