blob: a343ddca17673febec4beaedf54c1ba1b05fd5db [file] [log] [blame]
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef __ASM_PKVM_PROXY_H
#define __ASM_PKVM_PROXY_H
#include <linux/kvm_host.h>
#define HPROX_HVC_TYPE 0
#define HPROX_STRUCTS_TYPE 1
#define HPROX_ALLOC_TYPE 2
#define HVC_PROXY_IOCTL(hvcnum, numarg) \
_IOC(_IOC_WRITE, HPROX_HVC_TYPE, hvcnum, 8 * numarg)
#define HPROX_STRUCT_KVM_GET_SIZE _IO(HPROX_STRUCTS_TYPE, 0)
#define HPROX_STRUCT_KVM_GET_OFFSET _IO(HPROX_STRUCTS_TYPE, 1)
#define HPROX_HYP_VM_GET_SIZE _IO(HPROX_STRUCTS_TYPE, 2)
#define HPROX_PGD_GET_SIZE _IO(HPROX_STRUCTS_TYPE, 3)
enum struct_kvm_fields {
HPROX_NR_MEM_SLOT_PAGES,
HPROX_VCPU_ARRAY,
HPROX_MAX_VCPUS,
HPROX_CREATED_VCPUS,
HPROX_ARCH_PKVM_ENABLED,
HPROX_ARCH_PKVM_TEARDOWN_MC,
};
// Need to match up kvm_hyp_memcache
struct hprox_hyp_memcache {
unsigned long head; // kernel address, might not be accessible, if not
// donated from a hprox_alloc region.
unsigned long nr_pages;
};
enum hprox_alloc_type { HPROX_VMALLOC, HPROX_PAGES_EXACT };
#define HPROX_ALLOC(alloc) _IO(HPROX_ALLOC_TYPE, alloc)
#define HPROX_ALLOC_PAGES HPROX_ALLOC(HPROX_PAGES_EXACT)
// ioctl on the mmapable fd from the HPROX_ALLOC ioctl
#define HPROX_ALLOC_KADDR _IOR(0,0, void*)
#define HPROX_ALLOC_PHYS _IOR(0, 1, void *)
#endif /* __ASM_PKVM_PROXY_H */