mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 21:05:08 +00:00
7e0fa79412
libvmmapi leaves a hole at [3GB, 4GB) in the guest physical address space. This hole is not used in the arm64 port, which maps everything above 4GB. This change makes the code a bit more general to accomodate arm64 more naturally. In particular: - Remove vm_set_lowmem_limit(): it is unused and doesn't have well-defined constraints, e.g., nothing prevents a consumer from setting a lowmem limit above the highmem base. - Define a constant for the highmem base and use that everywhere that the base is currently hard-coded. - Make the lowmem limit a compile-time constant instead of a vmctx field. - Store segment info in an array. - Add vm_get_highmem_base(), for use in bhyve since the current value is hard-coded in some places. No functional change intended. Reviewed by: corvink, jhb MFC after: 2 weeks Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D41004
85 lines
1.5 KiB
C
85 lines
1.5 KiB
C
/*-
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*
|
|
* Copyright (c) 2022 John Baldwin <jhb@FreeBSD.org>
|
|
*/
|
|
|
|
#ifndef __VMMAPI_INTERNAL_H__
|
|
#define __VMMAPI_INTERNAL_H__
|
|
|
|
#include <sys/types.h>
|
|
|
|
enum {
|
|
VM_MEMSEG_LOW,
|
|
VM_MEMSEG_HIGH,
|
|
VM_MEMSEG_COUNT,
|
|
};
|
|
|
|
struct vmctx {
|
|
int fd;
|
|
struct {
|
|
vm_paddr_t base;
|
|
vm_size_t size;
|
|
} memsegs[VM_MEMSEG_COUNT];
|
|
int memflags;
|
|
char *baseaddr;
|
|
char *name;
|
|
};
|
|
|
|
struct vcpu {
|
|
struct vmctx *ctx;
|
|
int vcpuid;
|
|
};
|
|
|
|
int vcpu_ioctl(struct vcpu *vcpu, u_long cmd, void *arg);
|
|
|
|
extern const char *vm_capstrmap[];
|
|
|
|
#define VM_COMMON_IOCTLS \
|
|
VM_RUN, \
|
|
VM_SUSPEND, \
|
|
VM_REINIT, \
|
|
VM_ALLOC_MEMSEG, \
|
|
VM_GET_MEMSEG, \
|
|
VM_MMAP_MEMSEG, \
|
|
VM_MMAP_MEMSEG, \
|
|
VM_MMAP_GETNEXT, \
|
|
VM_MUNMAP_MEMSEG, \
|
|
VM_SET_REGISTER, \
|
|
VM_GET_REGISTER, \
|
|
VM_SET_REGISTER_SET, \
|
|
VM_GET_REGISTER_SET, \
|
|
VM_INJECT_EXCEPTION, \
|
|
VM_SET_CAPABILITY, \
|
|
VM_GET_CAPABILITY, \
|
|
VM_STATS, \
|
|
VM_STAT_DESC, \
|
|
VM_GET_GPA_PMAP, \
|
|
VM_GLA2GPA, \
|
|
VM_GLA2GPA_NOFAULT, \
|
|
VM_ACTIVATE_CPU, \
|
|
VM_GET_CPUS, \
|
|
VM_SUSPEND_CPU, \
|
|
VM_RESUME_CPU, \
|
|
VM_SET_INTINFO, \
|
|
VM_GET_INTINFO, \
|
|
VM_RESTART_INSTRUCTION, \
|
|
VM_SET_TOPOLOGY, \
|
|
VM_GET_TOPOLOGY, \
|
|
VM_SNAPSHOT_REQ, \
|
|
VM_RESTORE_TIME
|
|
|
|
#define VM_PPT_IOCTLS \
|
|
VM_BIND_PPTDEV, \
|
|
VM_UNBIND_PPTDEV, \
|
|
VM_MAP_PPTDEV_MMIO, \
|
|
VM_PPTDEV_MSI, \
|
|
VM_PPTDEV_MSIX, \
|
|
VM_UNMAP_PPTDEV_MMIO, \
|
|
VM_PPTDEV_DISABLE_MSIX
|
|
|
|
extern const cap_ioctl_t vm_ioctl_cmds[];
|
|
extern size_t vm_ioctl_ncmds;
|
|
|
|
#endif /* !__VMMAPI_INTERNAL_H__ */
|