[CI 07/44] mm: Add an empty implementation of zone_device_page_init
Oak Zeng
oak.zeng at intel.com
Fri Jun 14 21:57:40 UTC 2024
Add an empty implementation of zone_device_page_init when
CONFIG_ZONE_DEVICE is not enabled and print a warning message
in this empty implementation.
This is to fix some kunit test as showed below. On some architecture
such as um, ZONE_DEVICE can't be enabled and calling to
zone_device_page_int would trigger below error:
[szeng at szeng-desk kernel]$ ./tools/testing/kunit/kunit.py run --kunitconfig ./drivers/gpu/drm/xe/.kunitconfig
[11:42:42] Configuring KUnit Kernel ...
[11:42:42] Building KUnit Kernel ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig
Building with:
$ make ARCH=um O=.kunit --jobs=24
ERROR:root:../drivers/gpu/drm/./drm_svm.c: In function ‘__drm_svm_init_device_pages’:
../drivers/gpu/drm/./drm_svm.c:978:3: error: implicit declaration of function ‘zone_device_page_init’ [-Werror=implicit-function-declaration]
978 | zone_device_page_init(page);
| ^~~~~~~~~~~~~~~~~~~~~
Cc: Alistair Popple <apopple at nvidia.com>
Cc: Michael J. Ruhl <michael.j.ruhl at intel.com>
Cc: Lucas Demarchi <lucas.demarchi at intel.com>
Cc: Himal Prasad Ghimiray <himal.prasad.ghimiray at intel.com>
Signed-off-by: Oak Zeng <oak.zeng at intel.com>
---
include/linux/memremap.h | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/include/linux/memremap.h b/include/linux/memremap.h
index 3f7143ade32c..bf7727915a68 100644
--- a/include/linux/memremap.h
+++ b/include/linux/memremap.h
@@ -199,6 +199,16 @@ bool pgmap_pfn_valid(struct dev_pagemap *pgmap, unsigned long pfn);
unsigned long memremap_compat_align(void);
#else
+static inline void zone_device_page_init(struct page *page)
+{
+ /*
+ * Fail attempts to call zone_device_page_init without
+ * ZONE_DEVICE support enabled.
+ */
+ WARN_ON_ONCE(1);
+ return;
+}
+
static inline void *devm_memremap_pages(struct device *dev,
struct dev_pagemap *pgmap)
{
--
2.26.3
More information about the Intel-xe
mailing list