Re: [PATCH V3 2/2] drivers/perf: hisi: add driver for HNS3 PMU

From: John Garry
Date: Mon Apr 25 2022 - 04:15:38 EST

+F:    drivers/perf/hisilicon/hns3_pmu.c
  M:    Zhou Wang <wangzhou1@xxxxxxxxxxxxx>
  L:    linux-crypto@xxxxxxxxxxxxxxx
diff --git a/drivers/perf/hisilicon/Kconfig b/drivers/perf/hisilicon/Kconfig
index 5546218b5598..171bfc1b6bc2 100644
--- a/drivers/perf/hisilicon/Kconfig
+++ b/drivers/perf/hisilicon/Kconfig
@@ -14,3 +14,13 @@ config HISI_PCIE_PMU
        RCiEP devices.
        Adds the PCIe PMU into perf events system for monitoring latency,
        bandwidth etc.
+config HNS3_PMU
+    tristate "HNS3 PERF PMU"
+    depends on ARM64 || COMPILE_TEST

is see hns3_pmu_readq() below, so you need to ensure the arch supports readq - so I think that you need to depend on 64b. I assume that you never built this for a 32b arch

Our CPU arch is just arm64, so I set it to depend on ARM64. Yeah, I never built this for a 32b arch because we would never run this driver on 32b CPU.
Are you mean that hns3_pmu_readq() will be compiled failed for 32b arch?

Yes. That is the point of COMPILE_TEST - we may compile for other architectures (even though in they will never been seen in reality on other architectures). For me I find it useful to test compile drivers for HW only seen on arm machines from my x86 machine without cross compiling.

> So I think that I need to delete COMPILE_TEST to prevent from this case.

No, please keep it. So I think you have 2x options:
- Add additional Kconfig dependency on CONFIG_64BIT
- include io-64-nonatomic-hi-lo.h