Skip to content

Commit

Permalink
KVM: hide KVM_MEMSLOT_INVALID from userspace
Browse files Browse the repository at this point in the history
Quote Avi's comment:
| KVM_MEMSLOT_INVALID is actually an internal symbol, not used by
| userspace.  Please move it to kvm_host.h.

Also, we divide the memlsot->flags into two parts, the lower 16 bits
are visible for userspace, the higher 16 bits are internally used in
kvm

Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
  • Loading branch information
Xiao Guangrong authored and Avi Kivity committed Aug 22, 2012
1 parent a50d64d commit 67b2920
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 5 additions & 2 deletions include/linux/kvm.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,12 @@ struct kvm_userspace_memory_region {
__u64 userspace_addr; /* start of the userspace allocated memory */
};

/* for kvm_memory_region::flags */
/*
* The bit 0 ~ bit 15 of kvm_memory_region::flags are visible for userspace,
* other bits are reserved for kvm internal use which are defined in
* include/linux/kvm_host.h.
*/
#define KVM_MEM_LOG_DIRTY_PAGES 1UL
#define KVM_MEMSLOT_INVALID (1UL << 1)

/* for KVM_IRQ_LINE */
struct kvm_irq_level {
Expand Down
7 changes: 7 additions & 0 deletions include/linux/kvm_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@
#define KVM_MMIO_SIZE 8
#endif

/*
* The bit 16 ~ bit 31 of kvm_memory_region::flags are internally used
* in kvm, other bits are visible for userspace which are defined in
* include/linux/kvm_h.
*/
#define KVM_MEMSLOT_INVALID (1UL << 16)

/*
* If we support unaligned MMIO, at most one fragment will be split into two:
*/
Expand Down

0 comments on commit 67b2920

Please sign in to comment.