License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.
By default all files without license information are under the default
license of the kernel, which is GPL version 2.
Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.
This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.
How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,
Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.
The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.
The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.
Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if <5
lines).
All documentation files were explicitly excluded.
The following heuristics were used to determine which SPDX license
identifiers to apply.
- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.
For non */uapi/* files that summary was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139
and resulted in the first patch in this series.
If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930
and resulted in the second patch in this series.
- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:
SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1
and that resulted in the third patch in this series.
- when the two scanners agreed on the detected license(s), that became
the concluded license(s).
- when there was disagreement between the two scanners (one detected a
license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.
- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply (and
which scanner probably needed to revisit its heuristics).
- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.
- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.
In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.
Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights. The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.
Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.
In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.
Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
- a full scancode scan run, collecting the matched texts, detected
license ids and scores
- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct
- reviewing anything where there was no detection but the patch license
was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
SPDX license was correct
This produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.
These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-01 21:07:57 +07:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2016-01-16 07:56:19 +07:00
|
|
|
#ifndef _LINUX_MEMREMAP_H_
|
|
|
|
#define _LINUX_MEMREMAP_H_
|
2016-01-16 07:56:49 +07:00
|
|
|
#include <linux/ioport.h>
|
|
|
|
#include <linux/percpu-refcount.h>
|
2016-01-16 07:56:19 +07:00
|
|
|
|
2017-09-09 06:11:43 +07:00
|
|
|
#include <asm/pgtable.h>
|
|
|
|
|
2016-01-16 07:56:19 +07:00
|
|
|
struct resource;
|
|
|
|
struct device;
|
2016-01-16 07:56:22 +07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* struct vmem_altmap - pre-allocated storage for vmemmap_populate
|
|
|
|
* @base_pfn: base of the entire dev_pagemap mapping
|
|
|
|
* @reserve: pages mapped, but reserved for driver use (relative to @base)
|
|
|
|
* @free: free pages set aside in the mapping for memmap storage
|
|
|
|
* @align: pages reserved to meet allocation alignments
|
|
|
|
* @alloc: track pages consumed, private to vmemmap_populate()
|
|
|
|
*/
|
|
|
|
struct vmem_altmap {
|
|
|
|
const unsigned long base_pfn;
|
|
|
|
const unsigned long reserve;
|
|
|
|
unsigned long free;
|
|
|
|
unsigned long align;
|
|
|
|
unsigned long alloc;
|
|
|
|
};
|
|
|
|
|
2017-09-09 06:11:43 +07:00
|
|
|
/*
|
|
|
|
* Specialize ZONE_DEVICE memory into multiple types each having differents
|
|
|
|
* usage.
|
|
|
|
*
|
|
|
|
* MEMORY_DEVICE_PRIVATE:
|
|
|
|
* Device memory that is not directly addressable by the CPU: CPU can neither
|
|
|
|
* read nor write private memory. In this case, we do still have struct pages
|
|
|
|
* backing the device memory. Doing so simplifies the implementation, but it is
|
|
|
|
* important to remember that there are certain points at which the struct page
|
|
|
|
* must be treated as an opaque object, rather than a "normal" struct page.
|
|
|
|
*
|
|
|
|
* A more complete discussion of unaddressable memory may be found in
|
2018-03-22 02:22:47 +07:00
|
|
|
* include/linux/hmm.h and Documentation/vm/hmm.rst.
|
2017-09-09 06:12:24 +07:00
|
|
|
*
|
|
|
|
* MEMORY_DEVICE_PUBLIC:
|
|
|
|
* Device memory that is cache coherent from device and CPU point of view. This
|
|
|
|
* is use on platform that have an advance system bus (like CAPI or CCIX). A
|
|
|
|
* driver can hotplug the device memory using ZONE_DEVICE and with that memory
|
|
|
|
* type. Any page of a process can be migrated to such memory. However no one
|
|
|
|
* should be allow to pin such memory so that it can always be evicted.
|
2018-05-17 01:46:08 +07:00
|
|
|
*
|
|
|
|
* MEMORY_DEVICE_FS_DAX:
|
|
|
|
* Host memory that has similar access semantics as System RAM i.e. DMA
|
|
|
|
* coherent and supports page pinning. In support of coordinating page
|
|
|
|
* pinning vs other operations MEMORY_DEVICE_FS_DAX arranges for a
|
|
|
|
* wakeup event whenever a page is unpinned and becomes idle. This
|
|
|
|
* wakeup is used to coordinate physical address space management (ex:
|
|
|
|
* fs truncate/hole punch) vs pinned pages (ex: device dma).
|
PCI/P2PDMA: Support peer-to-peer memory
Some PCI devices may have memory mapped in a BAR space that's intended for
use in peer-to-peer transactions. To enable such transactions the memory
must be registered with ZONE_DEVICE pages so it can be used by DMA
interfaces in existing drivers.
Add an interface for other subsystems to find and allocate chunks of P2P
memory as necessary to facilitate transfers between two PCI peers:
struct pci_dev *pci_p2pmem_find[_many]();
int pci_p2pdma_distance[_many]();
void *pci_alloc_p2pmem();
The new interface requires a driver to collect a list of client devices
involved in the transaction then call pci_p2pmem_find() to obtain any
suitable P2P memory. Alternatively, if the caller knows a device which
provides P2P memory, they can use pci_p2pdma_distance() to determine if it
is usable. With a suitable p2pmem device, memory can then be allocated
with pci_alloc_p2pmem() for use in DMA transactions.
Depending on hardware, using peer-to-peer memory may reduce the bandwidth
of the transfer but can significantly reduce pressure on system memory.
This may be desirable in many cases: for example a system could be designed
with a small CPU connected to a PCIe switch by a small number of lanes
which would maximize the number of lanes available to connect to NVMe
devices.
The code is designed to only utilize the p2pmem device if all the devices
involved in a transfer are behind the same PCI bridge. This is because we
have no way of knowing whether peer-to-peer routing between PCIe Root Ports
is supported (PCIe r4.0, sec 1.3.1). Additionally, the benefits of P2P
transfers that go through the RC is limited to only reducing DRAM usage
and, in some cases, coding convenience. The PCI-SIG may be exploring
adding a new capability bit to advertise whether this is possible for
future hardware.
This commit includes significant rework and feedback from Christoph
Hellwig.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
[bhelgaas: fold in fix from Keith Busch <keith.busch@intel.com>:
https://lore.kernel.org/linux-pci/20181012155920.15418-1-keith.busch@intel.com,
to address comment from Dan Carpenter <dan.carpenter@oracle.com>, fold in
https://lore.kernel.org/linux-pci/20181017160510.17926-1-logang@deltatee.com]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
2018-10-05 04:27:35 +07:00
|
|
|
*
|
|
|
|
* MEMORY_DEVICE_PCI_P2PDMA:
|
|
|
|
* Device memory residing in a PCI BAR intended for use with Peer-to-Peer
|
|
|
|
* transactions.
|
2017-09-09 06:11:43 +07:00
|
|
|
*/
|
|
|
|
enum memory_type {
|
2018-05-17 01:46:08 +07:00
|
|
|
MEMORY_DEVICE_PRIVATE = 1,
|
2017-09-09 06:12:24 +07:00
|
|
|
MEMORY_DEVICE_PUBLIC,
|
2018-05-17 01:46:08 +07:00
|
|
|
MEMORY_DEVICE_FS_DAX,
|
PCI/P2PDMA: Support peer-to-peer memory
Some PCI devices may have memory mapped in a BAR space that's intended for
use in peer-to-peer transactions. To enable such transactions the memory
must be registered with ZONE_DEVICE pages so it can be used by DMA
interfaces in existing drivers.
Add an interface for other subsystems to find and allocate chunks of P2P
memory as necessary to facilitate transfers between two PCI peers:
struct pci_dev *pci_p2pmem_find[_many]();
int pci_p2pdma_distance[_many]();
void *pci_alloc_p2pmem();
The new interface requires a driver to collect a list of client devices
involved in the transaction then call pci_p2pmem_find() to obtain any
suitable P2P memory. Alternatively, if the caller knows a device which
provides P2P memory, they can use pci_p2pdma_distance() to determine if it
is usable. With a suitable p2pmem device, memory can then be allocated
with pci_alloc_p2pmem() for use in DMA transactions.
Depending on hardware, using peer-to-peer memory may reduce the bandwidth
of the transfer but can significantly reduce pressure on system memory.
This may be desirable in many cases: for example a system could be designed
with a small CPU connected to a PCIe switch by a small number of lanes
which would maximize the number of lanes available to connect to NVMe
devices.
The code is designed to only utilize the p2pmem device if all the devices
involved in a transfer are behind the same PCI bridge. This is because we
have no way of knowing whether peer-to-peer routing between PCIe Root Ports
is supported (PCIe r4.0, sec 1.3.1). Additionally, the benefits of P2P
transfers that go through the RC is limited to only reducing DRAM usage
and, in some cases, coding convenience. The PCI-SIG may be exploring
adding a new capability bit to advertise whether this is possible for
future hardware.
This commit includes significant rework and feedback from Christoph
Hellwig.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
[bhelgaas: fold in fix from Keith Busch <keith.busch@intel.com>:
https://lore.kernel.org/linux-pci/20181012155920.15418-1-keith.busch@intel.com,
to address comment from Dan Carpenter <dan.carpenter@oracle.com>, fold in
https://lore.kernel.org/linux-pci/20181017160510.17926-1-logang@deltatee.com]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
2018-10-05 04:27:35 +07:00
|
|
|
MEMORY_DEVICE_PCI_P2PDMA,
|
2017-09-09 06:11:43 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* For MEMORY_DEVICE_PRIVATE we use ZONE_DEVICE and extend it with two
|
|
|
|
* callbacks:
|
|
|
|
* page_fault()
|
|
|
|
* page_free()
|
|
|
|
*
|
|
|
|
* Additional notes about MEMORY_DEVICE_PRIVATE may be found in
|
2018-03-22 02:22:47 +07:00
|
|
|
* include/linux/hmm.h and Documentation/vm/hmm.rst. There is also a brief
|
2017-09-09 06:11:43 +07:00
|
|
|
* explanation in include/linux/memory_hotplug.h.
|
|
|
|
*
|
|
|
|
* The page_fault() callback must migrate page back, from device memory to
|
|
|
|
* system memory, so that the CPU can access it. This might fail for various
|
|
|
|
* reasons (device issues, device have been unplugged, ...). When such error
|
|
|
|
* conditions happen, the page_fault() callback must return VM_FAULT_SIGBUS and
|
|
|
|
* set the CPU page table entry to "poisoned".
|
|
|
|
*
|
|
|
|
* Note that because memory cgroup charges are transferred to the device memory,
|
|
|
|
* this should never fail due to memory restrictions. However, allocation
|
|
|
|
* of a regular system page might still fail because we are out of memory. If
|
|
|
|
* that happens, the page_fault() callback must return VM_FAULT_OOM.
|
|
|
|
*
|
|
|
|
* The page_fault() callback can also try to migrate back multiple pages in one
|
|
|
|
* chunk, as an optimization. It must, however, prioritize the faulting address
|
|
|
|
* over all the others.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* The page_free() callback is called once the page refcount reaches 1
|
|
|
|
* (ZONE_DEVICE pages never reach 0 refcount unless there is a refcount bug.
|
|
|
|
* This allows the device driver to implement its own memory management.)
|
2017-09-09 06:12:24 +07:00
|
|
|
*
|
|
|
|
* For MEMORY_DEVICE_PUBLIC only the page_free() callback matter.
|
2017-09-09 06:11:43 +07:00
|
|
|
*/
|
|
|
|
typedef int (*dev_page_fault_t)(struct vm_area_struct *vma,
|
|
|
|
unsigned long addr,
|
|
|
|
const struct page *page,
|
|
|
|
unsigned int flags,
|
|
|
|
pmd_t *pmdp);
|
|
|
|
typedef void (*dev_page_free_t)(struct page *page, void *data);
|
|
|
|
|
2016-01-16 07:56:19 +07:00
|
|
|
/**
|
|
|
|
* struct dev_pagemap - metadata for ZONE_DEVICE mappings
|
2017-09-09 06:11:43 +07:00
|
|
|
* @page_fault: callback when CPU fault on an unaddressable device page
|
|
|
|
* @page_free: free page callback when page refcount reaches 1
|
2016-01-16 07:56:22 +07:00
|
|
|
* @altmap: pre-allocated/reserved memory for vmemmap allocations
|
2016-01-16 07:56:49 +07:00
|
|
|
* @res: physical address range covered by @ref
|
|
|
|
* @ref: reference count that pins the devm_memremap_pages() mapping
|
mm, devm_memremap_pages: fix shutdown handling
The last step before devm_memremap_pages() returns success is to allocate
a release action, devm_memremap_pages_release(), to tear the entire setup
down. However, the result from devm_add_action() is not checked.
Checking the error from devm_add_action() is not enough. The api
currently relies on the fact that the percpu_ref it is using is killed by
the time the devm_memremap_pages_release() is run. Rather than continue
this awkward situation, offload the responsibility of killing the
percpu_ref to devm_memremap_pages_release() directly. This allows
devm_memremap_pages() to do the right thing relative to init failures and
shutdown.
Without this change we could fail to register the teardown of
devm_memremap_pages(). The likelihood of hitting this failure is tiny as
small memory allocations almost always succeed. However, the impact of
the failure is large given any future reconfiguration, or disable/enable,
of an nvdimm namespace will fail forever as subsequent calls to
devm_memremap_pages() will fail to setup the pgmap_radix since there will
be stale entries for the physical address range.
An argument could be made to require that the ->kill() operation be set in
the @pgmap arg rather than passed in separately. However, it helps code
readability, tracking the lifetime of a given instance, to be able to grep
the kill routine directly at the devm_memremap_pages() call site.
Link: http://lkml.kernel.org/r/154275558526.76910.7535251937849268605.stgit@dwillia2-desk3.amr.corp.intel.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Fixes: e8d513483300 ("memremap: change devm_memremap_pages interface...")
Reviewed-by: "Jérôme Glisse" <jglisse@redhat.com>
Reported-by: Logan Gunthorpe <logang@deltatee.com>
Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Cc: Balbir Singh <bsingharora@gmail.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-12-28 15:34:57 +07:00
|
|
|
* @kill: callback to transition @ref to the dead state
|
2016-01-16 07:56:19 +07:00
|
|
|
* @dev: host device of the mapping for debug
|
2017-09-09 06:11:43 +07:00
|
|
|
* @data: private data pointer for page_free()
|
|
|
|
* @type: memory type: see MEMORY_* in memory_hotplug.h
|
2016-01-16 07:56:19 +07:00
|
|
|
*/
|
|
|
|
struct dev_pagemap {
|
2017-09-09 06:11:43 +07:00
|
|
|
dev_page_fault_t page_fault;
|
|
|
|
dev_page_free_t page_free;
|
2017-12-29 14:54:04 +07:00
|
|
|
struct vmem_altmap altmap;
|
|
|
|
bool altmap_valid;
|
|
|
|
struct resource res;
|
2016-01-16 07:56:49 +07:00
|
|
|
struct percpu_ref *ref;
|
mm, devm_memremap_pages: fix shutdown handling
The last step before devm_memremap_pages() returns success is to allocate
a release action, devm_memremap_pages_release(), to tear the entire setup
down. However, the result from devm_add_action() is not checked.
Checking the error from devm_add_action() is not enough. The api
currently relies on the fact that the percpu_ref it is using is killed by
the time the devm_memremap_pages_release() is run. Rather than continue
this awkward situation, offload the responsibility of killing the
percpu_ref to devm_memremap_pages_release() directly. This allows
devm_memremap_pages() to do the right thing relative to init failures and
shutdown.
Without this change we could fail to register the teardown of
devm_memremap_pages(). The likelihood of hitting this failure is tiny as
small memory allocations almost always succeed. However, the impact of
the failure is large given any future reconfiguration, or disable/enable,
of an nvdimm namespace will fail forever as subsequent calls to
devm_memremap_pages() will fail to setup the pgmap_radix since there will
be stale entries for the physical address range.
An argument could be made to require that the ->kill() operation be set in
the @pgmap arg rather than passed in separately. However, it helps code
readability, tracking the lifetime of a given instance, to be able to grep
the kill routine directly at the devm_memremap_pages() call site.
Link: http://lkml.kernel.org/r/154275558526.76910.7535251937849268605.stgit@dwillia2-desk3.amr.corp.intel.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Fixes: e8d513483300 ("memremap: change devm_memremap_pages interface...")
Reviewed-by: "Jérôme Glisse" <jglisse@redhat.com>
Reported-by: Logan Gunthorpe <logang@deltatee.com>
Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Cc: Balbir Singh <bsingharora@gmail.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-12-28 15:34:57 +07:00
|
|
|
void (*kill)(struct percpu_ref *ref);
|
2016-01-16 07:56:19 +07:00
|
|
|
struct device *dev;
|
2017-09-09 06:11:43 +07:00
|
|
|
void *data;
|
|
|
|
enum memory_type type;
|
2018-10-05 04:27:37 +07:00
|
|
|
u64 pci_p2pdma_bus_offset;
|
2016-01-16 07:56:19 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
#ifdef CONFIG_ZONE_DEVICE
|
2017-12-29 14:54:05 +07:00
|
|
|
void *devm_memremap_pages(struct device *dev, struct dev_pagemap *pgmap);
|
2017-12-29 14:54:00 +07:00
|
|
|
struct dev_pagemap *get_dev_pagemap(unsigned long pfn,
|
|
|
|
struct dev_pagemap *pgmap);
|
2017-09-09 06:11:46 +07:00
|
|
|
|
2017-12-29 14:53:50 +07:00
|
|
|
unsigned long vmem_altmap_offset(struct vmem_altmap *altmap);
|
|
|
|
void vmem_altmap_free(struct vmem_altmap *altmap, unsigned long nr_pfns);
|
2016-01-16 07:56:19 +07:00
|
|
|
#else
|
|
|
|
static inline void *devm_memremap_pages(struct device *dev,
|
2017-12-29 14:54:05 +07:00
|
|
|
struct dev_pagemap *pgmap)
|
2016-01-16 07:56:19 +07:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Fail attempts to call devm_memremap_pages() without
|
|
|
|
* ZONE_DEVICE support enabled, this requires callers to fall
|
|
|
|
* back to plain devm_memremap() based on config
|
|
|
|
*/
|
|
|
|
WARN_ON_ONCE(1);
|
|
|
|
return ERR_PTR(-ENXIO);
|
|
|
|
}
|
|
|
|
|
2017-12-29 14:54:00 +07:00
|
|
|
static inline struct dev_pagemap *get_dev_pagemap(unsigned long pfn,
|
|
|
|
struct dev_pagemap *pgmap)
|
2016-01-16 07:56:19 +07:00
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
2017-12-29 14:53:50 +07:00
|
|
|
|
|
|
|
static inline unsigned long vmem_altmap_offset(struct vmem_altmap *altmap)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void vmem_altmap_free(struct vmem_altmap *altmap,
|
|
|
|
unsigned long nr_pfns)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
#endif /* CONFIG_ZONE_DEVICE */
|
2017-09-09 06:11:46 +07:00
|
|
|
|
2016-01-16 07:56:49 +07:00
|
|
|
static inline void put_dev_pagemap(struct dev_pagemap *pgmap)
|
|
|
|
{
|
|
|
|
if (pgmap)
|
|
|
|
percpu_ref_put(pgmap->ref);
|
|
|
|
}
|
2016-01-16 07:56:19 +07:00
|
|
|
#endif /* _LINUX_MEMREMAP_H_ */
|