mm/hmm: add a helper function that fault pages and map them to a device

This is a all in one helper that fault pages in a range and map them to a
device so that every single device driver do not have to re-implement this
common pattern.

This is taken from ODP RDMA in preparation of ODP RDMA convertion.  It
will be use by nouveau and other drivers.

[ Was using wrong field and wrong enum]
Signed-off-by: Jérôme Glisse <>
Cc: Ralph Campbell <>
Cc: John Hubbard <>
Cc: Dan Williams <>
Cc: Souptick Joarder <>
Cc: Arnd Bergmann <>
Cc: Balbir Singh <>
Cc: Dan Carpenter <>
Cc: Ira Weiny <>
Cc: Matthew Wilcox <>
Signed-off-by: Andrew Morton <>
Signed-off-by: Linus Torvalds <>
2 files changed