mm/hmm/devmem: dummy HMM device for ZONE_DEVICE memory
Subsystems (2)
[email protected]
maintainerPATCH 22/126 mm/hmm/devmem: dummy HMM device for ZONE_DEVICE memory
From: Jérôme Glisse <[email protected]>
Subject: mm/hmm/devmem: dummy HMM device for ZONE_DEVICE memory
This introduce a dummy HMM device class so device driver can use it to create hmm_device for the sole purpose of registering device memory. It is useful to device driver that want to manage multiple physical device memory under same struct device umbrella.
Signed-off-by Jérôme Glisse <[email protected]>
Signed-off-by Evgeny Baskakov <[email protected]>
Signed-off-by John Hubbard <[email protected]>
Signed-off-by Mark Hairgrove <[email protected]>
Signed-off-by Sherry Cheung <[email protected]>
Signed-off-by Subhash Gutti <[email protected]>
Cc Aneesh Kumar <[email protected]>
Cc Balbir Singh <[email protected]>
Cc Benjamin Herrenschmidt <[email protected]>
Cc Dan Williams <[email protected]>
Cc David Nellans <[email protected]>
Cc Johannes Weiner <[email protected]>
Cc Kirill A. Shutemov <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Paul E. McKenney <[email protected]>
Cc Ross Zwisler <[email protected]>
Cc Vladimir Davydov <[email protected]>
Cc Bob Liu <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
include/linux/hmm.h | 22 ++++++++++- mm/hmm.c | 81 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+), 1 deletion(-)
include/linux/hmm.h renamed from include/linux/hmm.h~mm-hmm-devmem-dummy-hmm-device-for-zone_device-memory-v3 +21 -1
@@ -72,11 +72,11 @@#if IS_ENABLED (CONFIG_HMM ) +#include <linux/device.h> #include <linux/migrate.h> #include <linux/memremap.h> #include <linux/completion.h> -struct hmm ;/*
@@ -474,6 +474,26 @@ static inline unsigned long hmm_devmem_p return drvdata[1]; } + + +/* +* struct hmm_device - fake device to hang device memory onto +* +* @device: device struct +* @minor: device minor number +*/ +struct hmm_device { +struct device device; +unsigned int minor; +}; + +/* +* A device driver that wants to handle multiple devices memory through a +* single fake device can use hmm_device to do so. This is purely a helper and +* it is not strictly needed, in order to make use of any HMM functionality. +*/ +struct hmm_device *hmm_device_new (void *drvdata); +void hmm_device_put (struct hmm_device *hmm_device);#endif /* IS_ENABLED(CONFIG_DEVICE_PRIVATE) */
mm/hmm.c renamed from mm/hmm.c~mm-hmm-devmem-dummy-hmm-device-for-zone_device-memory-v3 +81 -0
91 lines not on this page · raw message
_