summaryrefslogtreecommitdiffstats
path: root/sys/amd64/vmm/vmm_host.h
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2014-02-08 16:37:54 +0000
committerjhb <jhb@FreeBSD.org>2014-02-08 16:37:54 +0000
commit0cdfc370bf87313609affb63dbea6683ea11a928 (patch)
treefd49cf1b4fce6e5d303e3b692d2f6382e0eb2016 /sys/amd64/vmm/vmm_host.h
parent52f7777fcfc08b50517f7cdf01e965dca1b08463 (diff)
downloadFreeBSD-src-0cdfc370bf87313609affb63dbea6683ea11a928.zip
FreeBSD-src-0cdfc370bf87313609affb63dbea6683ea11a928.tar.gz
Add virtualized XSAVE support to bhyve which permits guests to use XSAVE and
XSAVE-enabled features like AVX. - Store a per-cpu guest xcr0 register. When switching to the guest FPU state, switch to the guest xcr0 value. Note that the guest FPU state is saved and restored using the host's xcr0 value and xcr0 is saved/restored "inside" of saving/restoring the guest FPU state. - Handle VM exits for the xsetbv instruction by updating the guest xcr0. - Expose the XSAVE feature to the guest only if the host has enabled XSAVE, and only advertise XSAVE features enabled by the host to the guest. This ensures that the guest will only adjust FPU state that is a subset of the guest FPU state saved and restored by the host. Reviewed by: grehan
Diffstat (limited to 'sys/amd64/vmm/vmm_host.h')
-rw-r--r--sys/amd64/vmm/vmm_host.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/amd64/vmm/vmm_host.h b/sys/amd64/vmm/vmm_host.h
index 839f54a..95618ff 100644
--- a/sys/amd64/vmm/vmm_host.h
+++ b/sys/amd64/vmm/vmm_host.h
@@ -33,17 +33,25 @@
#error "no user-servicable parts inside"
#endif
+struct xsave_limits {
+ int xsave_enabled;
+ uint64_t xcr0_allowed;
+ uint32_t xsave_max_size;
+};
+
void vmm_host_state_init(void);
uint64_t vmm_get_host_pat(void);
uint64_t vmm_get_host_efer(void);
uint64_t vmm_get_host_cr0(void);
uint64_t vmm_get_host_cr4(void);
+uint64_t vmm_get_host_xcr0(void);
uint64_t vmm_get_host_datasel(void);
uint64_t vmm_get_host_codesel(void);
uint64_t vmm_get_host_tsssel(void);
uint64_t vmm_get_host_fsbase(void);
uint64_t vmm_get_host_idtrbase(void);
+const struct xsave_limits *vmm_get_xsave_limits(void);
/*
* Inline access to host state that is used on every VM entry
OpenPOWER on IntegriCloud