mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-28 09:31:14 +00:00
x86/xen/time: setup vcpu 0 time info page
In order to support pvclock vdso on xen we need to setup the time info page for vcpu 0 and register the page with Xen using the VCPUOP_register_vcpu_time_memory_area hypercall. This hypercall will also forcefully update the pvti which will set some of the necessary flags for vdso. Afterwards we check if it supports the PVCLOCK_TSC_STABLE_BIT flag which is mandatory for having vdso/vsyscall support. And if so, it will set the cpu 0 pvti that will be later on used when mapping the vdso image. The xen headers are also updated to include the new hypercall for registering the secondary vcpu_time_info struct. Signed-off-by: Joao Martins <joao.m.martins@oracle.com> Reviewed-by: Juergen Gross <jgross@suse.com> Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
This commit is contained in:
parent
b888808093
commit
2229f70b5b
4 changed files with 137 additions and 1 deletions
|
@ -178,4 +178,46 @@ DEFINE_GUEST_HANDLE_STRUCT(vcpu_register_vcpu_info);
|
|||
|
||||
/* Send an NMI to the specified VCPU. @extra_arg == NULL. */
|
||||
#define VCPUOP_send_nmi 11
|
||||
|
||||
/*
|
||||
* Get the physical ID information for a pinned vcpu's underlying physical
|
||||
* processor. The physical ID informmation is architecture-specific.
|
||||
* On x86: id[31:0]=apic_id, id[63:32]=acpi_id.
|
||||
* This command returns -EINVAL if it is not a valid operation for this VCPU.
|
||||
*/
|
||||
#define VCPUOP_get_physid 12 /* arg == vcpu_get_physid_t */
|
||||
struct vcpu_get_physid {
|
||||
uint64_t phys_id;
|
||||
};
|
||||
DEFINE_GUEST_HANDLE_STRUCT(vcpu_get_physid);
|
||||
#define xen_vcpu_physid_to_x86_apicid(physid) ((uint32_t)(physid))
|
||||
#define xen_vcpu_physid_to_x86_acpiid(physid) ((uint32_t)((physid) >> 32))
|
||||
|
||||
/*
|
||||
* Register a memory location to get a secondary copy of the vcpu time
|
||||
* parameters. The master copy still exists as part of the vcpu shared
|
||||
* memory area, and this secondary copy is updated whenever the master copy
|
||||
* is updated (and using the same versioning scheme for synchronisation).
|
||||
*
|
||||
* The intent is that this copy may be mapped (RO) into userspace so
|
||||
* that usermode can compute system time using the time info and the
|
||||
* tsc. Usermode will see an array of vcpu_time_info structures, one
|
||||
* for each vcpu, and choose the right one by an existing mechanism
|
||||
* which allows it to get the current vcpu number (such as via a
|
||||
* segment limit). It can then apply the normal algorithm to compute
|
||||
* system time from the tsc.
|
||||
*
|
||||
* @extra_arg == pointer to vcpu_register_time_info_memory_area structure.
|
||||
*/
|
||||
#define VCPUOP_register_vcpu_time_memory_area 13
|
||||
DEFINE_GUEST_HANDLE_STRUCT(vcpu_time_info);
|
||||
struct vcpu_register_time_memory_area {
|
||||
union {
|
||||
GUEST_HANDLE(vcpu_time_info) h;
|
||||
struct pvclock_vcpu_time_info *v;
|
||||
uint64_t p;
|
||||
} addr;
|
||||
};
|
||||
DEFINE_GUEST_HANDLE_STRUCT(vcpu_register_time_memory_area);
|
||||
|
||||
#endif /* __XEN_PUBLIC_VCPU_H__ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue