In stable v6.6.161 there is a build error with ppc64 when
CONFIG_IOMMU_API is not enabled:
arch/powerpc/platforms/pseries/iommu.c: In function 'iommu_take_ownership':
arch/powerpc/platforms/pseries/iommu.c:69:25: error: 'struct
iommu_table_ops' has no member named 'xchg_no_kill'
69 | if (!tbl->it_ops->xchg_no_kill)
| ^~
AS arch/powerpc/lib/copy_mc_64.o
arch/powerpc/platforms/pseries/iommu.c: At top level:
arch/powerpc/platforms/pseries/iommu.c:1787:37: error:
'spapr_tce_table_group_ops' defined but not used [-Werror=unused-variable]
1787 | static struct iommu_table_group_ops spapr_tce_table_group_ops = {
| ^~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
This is due to stable v6.6.161 commit 1e9dfe15404d ("powerpc/iommu: Move
pSeries specific functions to pseries/iommu.c"). It was included as a
stable-dep-of commit 8f70caad82e9 ("powerpc/pseries/iommu: IOMMU
incorrectly marks MMIO range in DDW").
It was backported without its associated fix: commit af199e6ca29c
("powerpc/pseries/iommu: Define spapr_tce_table_group_ops only with
CONFIG_IOMMU_API").
The code was supposed to only build under CONFIG_IOMMU_API, but the new
location doesn't have this condition. Unfortunately, the fixing commit
comes after a fairly large refactor, and doesn't apply on v6.16.161.
Instead, apply the ifdefs where they would belong prior to the refactor.
Signed-off-by: Stephen Brennan <[email protected]>
---
arch/powerpc/platforms/pseries/iommu.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/powerpc/platforms/pseries/iommu.c
b/arch/powerpc/platforms/pseries/iommu.c
index 6a45e3e86f79b..a79927e870a87 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -54,6 +54,7 @@ enum {
DDW_EXT_QUERY_OUT_SIZE = 2
};
+#ifdef CONFIG_IOMMU_API
static int iommu_take_ownership(struct iommu_table *tbl)
{
unsigned long flags, i, sz = (tbl->it_size + 7) >> 3;
@@ -104,6 +105,7 @@ static void iommu_release_ownership(struct iommu_table *tbl)
spin_unlock(&tbl->pools[i].lock);
spin_unlock_irqrestore(&tbl->large_pool.lock, flags);
}
+#endif
static struct iommu_table *iommu_pseries_alloc_table(int node)
{
@@ -118,7 +120,9 @@ static struct iommu_table *iommu_pseries_alloc_table(int
node)
return tbl;
}
+#ifdef CONFIG_IOMMU_API
static struct iommu_table_group_ops spapr_tce_table_group_ops;
+#endif
static struct iommu_table_group *iommu_pseries_alloc_group(int node)
{
@@ -1702,6 +1706,7 @@ static bool iommu_bypass_supported_pSeriesLP(struct
pci_dev *pdev, u64 dma_mask)
return false;
}
+#ifdef CONFIG_IOMMU_API
/*
* A simple iommu_table_group_ops which only allows reusing the existing
* iommu_table. This handles VFIO for POWER7 or the nested KVM.
@@ -1792,6 +1797,7 @@ static struct iommu_table_group_ops
spapr_tce_table_group_ops = {
.take_ownership = spapr_tce_take_ownership,
.release_ownership = spapr_tce_release_ownership,
};
+#endif
static int iommu_mem_notifier(struct notifier_block *nb, unsigned long action,
void *data)
--
2.52.0