2019-06-04 08:11:36 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2007-12-03 21:30:23 +00:00
|
|
|
|
|
|
|
#ifndef __KVM_TYPES_H__
|
|
|
|
#define __KVM_TYPES_H__
|
|
|
|
|
2014-08-29 12:01:17 +00:00
|
|
|
struct kvm;
|
|
|
|
struct kvm_async_pf;
|
|
|
|
struct kvm_device_ops;
|
|
|
|
struct kvm_interrupt;
|
|
|
|
struct kvm_irq_routing_table;
|
|
|
|
struct kvm_memory_slot;
|
|
|
|
struct kvm_one_reg;
|
|
|
|
struct kvm_run;
|
|
|
|
struct kvm_userspace_memory_region;
|
|
|
|
struct kvm_vcpu;
|
|
|
|
struct kvm_vcpu_init;
|
2015-05-17 19:26:08 +00:00
|
|
|
struct kvm_memslots;
|
2014-08-29 12:01:17 +00:00
|
|
|
|
|
|
|
enum kvm_mr_change;
|
|
|
|
|
2007-12-03 21:30:23 +00:00
|
|
|
#include <asm/types.h>
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Address types:
|
|
|
|
*
|
|
|
|
* gva - guest virtual address
|
|
|
|
* gpa - guest physical address
|
|
|
|
* gfn - guest frame number
|
|
|
|
* hva - host virtual address
|
|
|
|
* hpa - host physical address
|
|
|
|
* hfn - host frame number
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef unsigned long gva_t;
|
|
|
|
typedef u64 gpa_t;
|
2010-07-01 14:00:12 +00:00
|
|
|
typedef u64 gfn_t;
|
2007-12-03 21:30:23 +00:00
|
|
|
|
|
|
|
typedef unsigned long hva_t;
|
|
|
|
typedef u64 hpa_t;
|
2010-07-01 14:00:12 +00:00
|
|
|
typedef u64 hfn_t;
|
2007-12-03 21:30:23 +00:00
|
|
|
|
kvm: rename pfn_t to kvm_pfn_t
To date, we have implemented two I/O usage models for persistent memory,
PMEM (a persistent "ram disk") and DAX (mmap persistent memory into
userspace). This series adds a third, DAX-GUP, that allows DAX mappings
to be the target of direct-i/o. It allows userspace to coordinate
DMA/RDMA from/to persistent memory.
The implementation leverages the ZONE_DEVICE mm-zone that went into
4.3-rc1 (also discussed at kernel summit) to flag pages that are owned
and dynamically mapped by a device driver. The pmem driver, after
mapping a persistent memory range into the system memmap via
devm_memremap_pages(), arranges for DAX to distinguish pfn-only versus
page-backed pmem-pfns via flags in the new pfn_t type.
The DAX code, upon seeing a PFN_DEV+PFN_MAP flagged pfn, flags the
resulting pte(s) inserted into the process page tables with a new
_PAGE_DEVMAP flag. Later, when get_user_pages() is walking ptes it keys
off _PAGE_DEVMAP to pin the device hosting the page range active.
Finally, get_page() and put_page() are modified to take references
against the device driver established page mapping.
Finally, this need for "struct page" for persistent memory requires
memory capacity to store the memmap array. Given the memmap array for a
large pool of persistent may exhaust available DRAM introduce a
mechanism to allocate the memmap from persistent memory. The new
"struct vmem_altmap *" parameter to devm_memremap_pages() enables
arch_add_memory() to use reserved pmem capacity rather than the page
allocator.
This patch (of 18):
The core has developed a need for a "pfn_t" type [1]. Move the existing
pfn_t in KVM to kvm_pfn_t [2].
[1]: https://lists.01.org/pipermail/linux-nvdimm/2015-September/002199.html
[2]: https://lists.01.org/pipermail/linux-nvdimm/2015-September/002218.html
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Acked-by: Christoffer Dall <christoffer.dall@linaro.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-01-16 00:56:11 +00:00
|
|
|
typedef hfn_t kvm_pfn_t;
|
2008-04-02 19:46:56 +00:00
|
|
|
|
2010-10-18 13:22:23 +00:00
|
|
|
struct gfn_to_hva_cache {
|
|
|
|
u64 generation;
|
|
|
|
gpa_t gpa;
|
|
|
|
unsigned long hva;
|
2013-03-29 16:35:21 +00:00
|
|
|
unsigned long len;
|
2010-10-18 13:22:23 +00:00
|
|
|
struct kvm_memory_slot *memslot;
|
|
|
|
};
|
|
|
|
|
2007-12-03 21:30:23 +00:00
|
|
|
#endif /* __KVM_TYPES_H__ */
|