svn commit: r254540 - in projects/bhyve_npt_pmap: lib/libvmmapi sys/amd64/include usr.sbin/bhyve usr.sbin/bhyvectl usr.sbin/bhyveload
Neel Natu
neel at FreeBSD.org
Mon Aug 19 18:58:00 UTC 2013
Author: neel
Date: Mon Aug 19 18:57:58 2013
New Revision: 254540
URL: http://svnweb.freebsd.org/changeset/base/254540
Log:
Add a parameter to the "get memory segment" ioctl to indicate whether or not
the segment is wired.
In general the memory segments belonging to a virtual machine are not wired
unless the virtual machine is attached to a passthru pci device.
Modified:
projects/bhyve_npt_pmap/lib/libvmmapi/vmmapi.c
projects/bhyve_npt_pmap/lib/libvmmapi/vmmapi.h
projects/bhyve_npt_pmap/sys/amd64/include/vmm_dev.h
projects/bhyve_npt_pmap/usr.sbin/bhyve/pci_emul.c
projects/bhyve_npt_pmap/usr.sbin/bhyvectl/bhyvectl.c
projects/bhyve_npt_pmap/usr.sbin/bhyveload/bhyveload.c
Modified: projects/bhyve_npt_pmap/lib/libvmmapi/vmmapi.c
==============================================================================
--- projects/bhyve_npt_pmap/lib/libvmmapi/vmmapi.c Mon Aug 19 17:44:19 2013 (r254539)
+++ projects/bhyve_npt_pmap/lib/libvmmapi/vmmapi.c Mon Aug 19 18:57:58 2013 (r254540)
@@ -124,7 +124,8 @@ vm_destroy(struct vmctx *vm)
}
int
-vm_get_memory_seg(struct vmctx *ctx, vm_paddr_t gpa, size_t *ret_len)
+vm_get_memory_seg(struct vmctx *ctx, vm_paddr_t gpa, size_t *ret_len,
+ int *wired)
{
int error;
struct vm_memory_segment seg;
@@ -133,6 +134,8 @@ vm_get_memory_seg(struct vmctx *ctx, vm_
seg.gpa = gpa;
error = ioctl(ctx->fd, VM_GET_MEMORY_SEG, &seg);
*ret_len = seg.len;
+ if (wired != NULL)
+ *wired = seg.wired;
return (error);
}
Modified: projects/bhyve_npt_pmap/lib/libvmmapi/vmmapi.h
==============================================================================
--- projects/bhyve_npt_pmap/lib/libvmmapi/vmmapi.h Mon Aug 19 17:44:19 2013 (r254539)
+++ projects/bhyve_npt_pmap/lib/libvmmapi/vmmapi.h Mon Aug 19 18:57:58 2013 (r254540)
@@ -45,7 +45,8 @@ enum vm_mmap_style {
int vm_create(const char *name);
struct vmctx *vm_open(const char *name);
void vm_destroy(struct vmctx *ctx);
-int vm_get_memory_seg(struct vmctx *ctx, vm_paddr_t gpa, size_t *ret_len);
+int vm_get_memory_seg(struct vmctx *ctx, vm_paddr_t gpa, size_t *ret_len,
+ int *wired);
int vm_setup_memory(struct vmctx *ctx, size_t len, enum vm_mmap_style s);
void *vm_map_gpa(struct vmctx *ctx, vm_paddr_t gaddr, size_t len);
int vm_get_gpa_pmap(struct vmctx *, uint64_t gpa, uint64_t *pte, int *num);
Modified: projects/bhyve_npt_pmap/sys/amd64/include/vmm_dev.h
==============================================================================
--- projects/bhyve_npt_pmap/sys/amd64/include/vmm_dev.h Mon Aug 19 17:44:19 2013 (r254539)
+++ projects/bhyve_npt_pmap/sys/amd64/include/vmm_dev.h Mon Aug 19 18:57:58 2013 (r254540)
@@ -36,7 +36,8 @@ int vmmdev_cleanup(void);
struct vm_memory_segment {
vm_paddr_t gpa; /* in */
- size_t len; /* in */
+ size_t len;
+ int wired;
};
struct vm_register {
Modified: projects/bhyve_npt_pmap/usr.sbin/bhyve/pci_emul.c
==============================================================================
--- projects/bhyve_npt_pmap/usr.sbin/bhyve/pci_emul.c Mon Aug 19 17:44:19 2013 (r254539)
+++ projects/bhyve_npt_pmap/usr.sbin/bhyve/pci_emul.c Mon Aug 19 18:57:58 2013 (r254540)
@@ -1039,7 +1039,7 @@ init_pci(struct vmctx *ctx)
* Accesses to memory addresses that are not allocated to system
* memory or PCI devices return 0xff's.
*/
- error = vm_get_memory_seg(ctx, 0, &lowmem);
+ error = vm_get_memory_seg(ctx, 0, &lowmem, NULL);
assert(error == 0);
memset(&memp, 0, sizeof(struct mem_range));
Modified: projects/bhyve_npt_pmap/usr.sbin/bhyvectl/bhyvectl.c
==============================================================================
--- projects/bhyve_npt_pmap/usr.sbin/bhyvectl/bhyvectl.c Mon Aug 19 17:44:19 2013 (r254539)
+++ projects/bhyve_npt_pmap/usr.sbin/bhyvectl/bhyvectl.c Mon Aug 19 18:57:58 2013 (r254540)
@@ -391,6 +391,7 @@ main(int argc, char *argv[])
struct vm_exit vmexit;
uint64_t ctl, eptp, bm, addr, u64, pteval[4], *pte;
struct vmctx *ctx;
+ int wired;
uint64_t cr0, cr3, cr4, dr7, rsp, rip, rflags, efer, pat;
uint64_t rax, rbx, rcx, rdx, rsi, rdi, rbp;
@@ -826,16 +827,18 @@ main(int argc, char *argv[])
if (!error && (get_lowmem || get_all)) {
gpa = 0;
- error = vm_get_memory_seg(ctx, gpa, &len);
+ error = vm_get_memory_seg(ctx, gpa, &len, &wired);
if (error == 0)
- printf("lowmem\t\t0x%016lx/%ld\n", gpa, len);
+ printf("lowmem\t\t0x%016lx/%ld%s\n", gpa, len,
+ wired ? " wired" : "");
}
if (!error && (get_highmem || get_all)) {
gpa = 4 * GB;
- error = vm_get_memory_seg(ctx, gpa, &len);
+ error = vm_get_memory_seg(ctx, gpa, &len, &wired);
if (error == 0)
- printf("highmem\t\t0x%016lx/%ld\n", gpa, len);
+ printf("highmem\t\t0x%016lx/%ld%s\n", gpa, len,
+ wired ? " wired" : "");
}
if (!error && (get_efer || get_all)) {
Modified: projects/bhyve_npt_pmap/usr.sbin/bhyveload/bhyveload.c
==============================================================================
--- projects/bhyve_npt_pmap/usr.sbin/bhyveload/bhyveload.c Mon Aug 19 17:44:19 2013 (r254539)
+++ projects/bhyve_npt_pmap/usr.sbin/bhyveload/bhyveload.c Mon Aug 19 18:57:58 2013 (r254540)
@@ -492,8 +492,8 @@ static void
cb_getmem(void *arg, uint64_t *ret_lowmem, uint64_t *ret_highmem)
{
- vm_get_memory_seg(ctx, 0, ret_lowmem);
- vm_get_memory_seg(ctx, 4 * GB, ret_highmem);
+ vm_get_memory_seg(ctx, 0, ret_lowmem, NULL);
+ vm_get_memory_seg(ctx, 4 * GB, ret_highmem, NULL);
}
static const char *
More information about the svn-src-projects
mailing list