[PATCH v4 1/2] PCI/P2PDMA: Move CONFIG_X86 #ifdef out of cpu_supports_p2pdma()
From: Pavel Popov
Date: Tue Oct 20 2026 - 13:41:34 EST
cpu_supports_p2pdma() has an #ifdef CONFIG_X86 block inside the
function body. Put the whole function under #ifdef CONFIG_X86 instead,
with a stub returning false for !CONFIG_X86.
No functional change.
Suggested-by: Logan Gunthorpe <logang@xxxxxxxxxxxx>
Signed-off-by: Pavel Popov <pavel.e.popov@xxxxxxxxx>
---
drivers/pci/p2pdma.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c
index 9334eb314663..6b4f0843b404 100644
--- a/drivers/pci/p2pdma.c
+++ b/drivers/pci/p2pdma.c
@@ -519,18 +519,23 @@ static void seq_buf_print_bus_devfn(struct seq_buf *buf, struct pci_dev *pdev)
seq_buf_printf(buf, "%s;", pci_name(pdev));
}
+#ifdef CONFIG_X86
static bool cpu_supports_p2pdma(void)
{
-#ifdef CONFIG_X86
struct cpuinfo_x86 *c = &cpu_data(0);
/* Any AMD CPU whose family ID is Zen or newer supports p2pdma */
if (c->x86_vendor == X86_VENDOR_AMD && c->x86 >= 0x17)
return true;
-#endif
return false;
}
+#else /* !CONFIG_X86 */
+static bool cpu_supports_p2pdma(void)
+{
+ return false;
+}
+#endif /* CONFIG_X86 */
static const struct pci_p2pdma_whitelist_entry {
unsigned short vendor;
--
2.53.0