xref: /illumos-gate/usr/src/uts/common/xen/os/hypercall.c (revision 86ef0a63)
1843e1988Sjohnlev /*
2843e1988Sjohnlev  * CDDL HEADER START
3843e1988Sjohnlev  *
4843e1988Sjohnlev  * The contents of this file are subject to the terms of the
5843e1988Sjohnlev  * Common Development and Distribution License (the "License").
6843e1988Sjohnlev  * You may not use this file except in compliance with the License.
7843e1988Sjohnlev  *
8843e1988Sjohnlev  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9843e1988Sjohnlev  * or http://www.opensolaris.org/os/licensing.
10843e1988Sjohnlev  * See the License for the specific language governing permissions
11843e1988Sjohnlev  * and limitations under the License.
12843e1988Sjohnlev  *
13843e1988Sjohnlev  * When distributing Covered Code, include this CDDL HEADER in each
14843e1988Sjohnlev  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15843e1988Sjohnlev  * If applicable, add the following below this CDDL HEADER, with the
16843e1988Sjohnlev  * fields enclosed by brackets "[]" replaced with your own identifying
17843e1988Sjohnlev  * information: Portions Copyright [yyyy] [name of copyright owner]
18843e1988Sjohnlev  *
19843e1988Sjohnlev  * CDDL HEADER END
20843e1988Sjohnlev  */
21843e1988Sjohnlev 
22843e1988Sjohnlev /*
23349b53ddSStuart Maybee  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24843e1988Sjohnlev  * Use is subject to license terms.
25843e1988Sjohnlev  */
26843e1988Sjohnlev 
27843e1988Sjohnlev /*
28843e1988Sjohnlev  * Provides basic C wrappers around hypervisor invocation.
29843e1988Sjohnlev  *
30843e1988Sjohnlev  * i386: eax = vector: ebx, ecx, edx, esi, edi = args 1-5
31843e1988Sjohnlev  *	 eax = return value
32843e1988Sjohnlev  *	 (argument registers may be clobbered on return)
33843e1988Sjohnlev  *
34843e1988Sjohnlev  * amd64:rax = vector: rdi, rsi, rdx, r10, r8, r9 = args 1-6
35843e1988Sjohnlev  *	 rax = return value
36843e1988Sjohnlev  *	 (arguments registers not clobbered on return; rcx, r11 are)
37843e1988Sjohnlev  */
38843e1988Sjohnlev 
39843e1988Sjohnlev #include <sys/types.h>
403c4c5929SGordon Ross #include <sys/errno.h>
41349b53ddSStuart Maybee #ifndef __xpv
42551bc2a6Smrj #include <sys/xpv_support.h>
43349b53ddSStuart Maybee #else
44349b53ddSStuart Maybee #include <sys/xpv_user.h>
45551bc2a6Smrj #endif
46843e1988Sjohnlev 
47843e1988Sjohnlev #include <sys/hypervisor.h>
48843e1988Sjohnlev #include <xen/public/sched.h>
49843e1988Sjohnlev #include <sys/debug.h>
50843e1988Sjohnlev #include <sys/archsystm.h>
51843e1988Sjohnlev 
52843e1988Sjohnlev long
HYPERVISOR_set_trap_table(trap_info_t * table)53843e1988Sjohnlev HYPERVISOR_set_trap_table(trap_info_t *table)
54843e1988Sjohnlev {
55843e1988Sjohnlev 	return (__hypercall1(__HYPERVISOR_set_trap_table, (ulong_t)table));
56843e1988Sjohnlev }
57843e1988Sjohnlev 
58843e1988Sjohnlev int
HYPERVISOR_mmu_update(mmu_update_t * req,int count,int * success_count,domid_t domain_id)59843e1988Sjohnlev HYPERVISOR_mmu_update(mmu_update_t *req, int count, int *success_count,
60843e1988Sjohnlev     domid_t domain_id)
61843e1988Sjohnlev {
62843e1988Sjohnlev 	return (__hypercall4_int(__HYPERVISOR_mmu_update,
63843e1988Sjohnlev 	    (ulong_t)req, (long)count, (ulong_t)success_count,
64843e1988Sjohnlev 	    (ulong_t)domain_id));
65843e1988Sjohnlev }
66843e1988Sjohnlev 
67843e1988Sjohnlev long
HYPERVISOR_set_gdt(ulong_t * frame_list,int entries)68843e1988Sjohnlev HYPERVISOR_set_gdt(ulong_t *frame_list, int entries)
69843e1988Sjohnlev {
70843e1988Sjohnlev 	return (__hypercall2(
71843e1988Sjohnlev 	    __HYPERVISOR_set_gdt, (ulong_t)frame_list, (long)entries));
72843e1988Sjohnlev }
73843e1988Sjohnlev 
74843e1988Sjohnlev /*
75843e1988Sjohnlev  * XXPV Seems like "sp" would be a better name for both amd64 and i386?
76843e1988Sjohnlev  * For now stay consistent with xen project source.
77843e1988Sjohnlev  */
78843e1988Sjohnlev long
HYPERVISOR_stack_switch(ulong_t ss,ulong_t esp)79843e1988Sjohnlev HYPERVISOR_stack_switch(ulong_t ss, ulong_t esp)
80843e1988Sjohnlev {
81843e1988Sjohnlev 	return (__hypercall2(__HYPERVISOR_stack_switch, ss, esp));
82843e1988Sjohnlev }
83843e1988Sjohnlev 
84843e1988Sjohnlev #if defined(__amd64)
85843e1988Sjohnlev 
86843e1988Sjohnlev long
HYPERVISOR_set_callbacks(ulong_t event_address,ulong_t failsafe_address,ulong_t syscall_address)87843e1988Sjohnlev HYPERVISOR_set_callbacks(ulong_t event_address, ulong_t failsafe_address,
88843e1988Sjohnlev     ulong_t syscall_address)
89843e1988Sjohnlev {
90843e1988Sjohnlev 	return (__hypercall3(__HYPERVISOR_set_callbacks,
91843e1988Sjohnlev 	    event_address, failsafe_address, syscall_address));
92843e1988Sjohnlev }
93843e1988Sjohnlev 
94843e1988Sjohnlev #endif	/* __amd64 */
95843e1988Sjohnlev 
96843e1988Sjohnlev long
HYPERVISOR_fpu_taskswitch(int set)97843e1988Sjohnlev HYPERVISOR_fpu_taskswitch(int set)
98843e1988Sjohnlev {
99843e1988Sjohnlev 	return (__hypercall1(__HYPERVISOR_fpu_taskswitch, (long)set));
100843e1988Sjohnlev }
101843e1988Sjohnlev 
102843e1988Sjohnlev /* *** __HYPERVISOR_sched_op_compat *** OBSOLETED */
103843e1988Sjohnlev 
104843e1988Sjohnlev long
HYPERVISOR_platform_op(xen_platform_op_t * platform_op)105843e1988Sjohnlev HYPERVISOR_platform_op(xen_platform_op_t *platform_op)
106843e1988Sjohnlev {
107843e1988Sjohnlev 	return (__hypercall1(__HYPERVISOR_platform_op, (ulong_t)platform_op));
108843e1988Sjohnlev }
109843e1988Sjohnlev 
110843e1988Sjohnlev /* *** __HYPERVISOR_set_debugreg *** NOT IMPLEMENTED */
111843e1988Sjohnlev 
112843e1988Sjohnlev /* *** __HYPERVISOR_get_debugreg *** NOT IMPLEMENTED */
113843e1988Sjohnlev 
114843e1988Sjohnlev long
HYPERVISOR_update_descriptor(maddr_t ma,uint64_t desc)115843e1988Sjohnlev HYPERVISOR_update_descriptor(maddr_t ma, uint64_t desc)
116843e1988Sjohnlev {
117843e1988Sjohnlev #if defined(__amd64)
118843e1988Sjohnlev 
119843e1988Sjohnlev 	return (__hypercall2(__HYPERVISOR_update_descriptor, ma, desc));
120843e1988Sjohnlev 
121843e1988Sjohnlev #endif
122843e1988Sjohnlev }
123843e1988Sjohnlev 
124843e1988Sjohnlev long
HYPERVISOR_memory_op(int cmd,void * arg)125843e1988Sjohnlev HYPERVISOR_memory_op(int cmd, void *arg)
126843e1988Sjohnlev {
127843e1988Sjohnlev 	return (__hypercall2(__HYPERVISOR_memory_op, (long)cmd,
128843e1988Sjohnlev 	    (ulong_t)arg));
129843e1988Sjohnlev }
130843e1988Sjohnlev 
131843e1988Sjohnlev long
HYPERVISOR_multicall(void * call_list,uint_t nr_calls)132843e1988Sjohnlev HYPERVISOR_multicall(void *call_list, uint_t nr_calls)
133843e1988Sjohnlev {
134843e1988Sjohnlev 	return (__hypercall2(__HYPERVISOR_multicall,
135843e1988Sjohnlev 	    (ulong_t)call_list, (ulong_t)nr_calls));
136843e1988Sjohnlev }
137843e1988Sjohnlev 
138843e1988Sjohnlev int
HYPERVISOR_update_va_mapping(ulong_t va,uint64_t new_pte,ulong_t flags)139843e1988Sjohnlev HYPERVISOR_update_va_mapping(ulong_t va, uint64_t new_pte, ulong_t flags)
140843e1988Sjohnlev {
141843e1988Sjohnlev #if !defined(_BOOT)
142843e1988Sjohnlev 	if (IN_XPV_PANIC())
143843e1988Sjohnlev 		return (0);
144843e1988Sjohnlev #endif
145843e1988Sjohnlev #if defined(__amd64)
146843e1988Sjohnlev 
147843e1988Sjohnlev 	return (__hypercall3_int(__HYPERVISOR_update_va_mapping, va,
148843e1988Sjohnlev 	    new_pte, flags));
149843e1988Sjohnlev 
150*86ef0a63SRichard Lowe #endif	/* __amd64 */
151843e1988Sjohnlev }
152843e1988Sjohnlev 
153843e1988Sjohnlev /*
154843e1988Sjohnlev  * Note: this timeout must be the Xen system time not hrtime (see
155843e1988Sjohnlev  * xpv_timestamp.c).
156843e1988Sjohnlev  */
157843e1988Sjohnlev long
HYPERVISOR_set_timer_op(uint64_t timeout)158843e1988Sjohnlev HYPERVISOR_set_timer_op(uint64_t timeout)
159843e1988Sjohnlev {
160843e1988Sjohnlev #if defined(__amd64)
161843e1988Sjohnlev 
162843e1988Sjohnlev 	return (__hypercall1(__HYPERVISOR_set_timer_op, timeout));
163843e1988Sjohnlev 
164*86ef0a63SRichard Lowe #endif	/* __amd64 */
165843e1988Sjohnlev }
166843e1988Sjohnlev 
167843e1988Sjohnlev /* *** __HYPERVISOR_event_channel_op_compat *** OBSOLETED */
168843e1988Sjohnlev 
169843e1988Sjohnlev long
HYPERVISOR_xen_version(int cmd,void * arg)170843e1988Sjohnlev HYPERVISOR_xen_version(int cmd, void *arg)
171843e1988Sjohnlev {
172843e1988Sjohnlev 	return (__hypercall2(__HYPERVISOR_xen_version, (long)cmd,
173843e1988Sjohnlev 	    (ulong_t)arg));
174843e1988Sjohnlev }
175843e1988Sjohnlev 
176843e1988Sjohnlev long
HYPERVISOR_console_io(int cmd,int count,char * str)177843e1988Sjohnlev HYPERVISOR_console_io(int cmd, int count, char *str)
178843e1988Sjohnlev {
179843e1988Sjohnlev 	return (__hypercall3(__HYPERVISOR_console_io, (long)cmd, (long)count,
180843e1988Sjohnlev 	    (ulong_t)str));
181843e1988Sjohnlev }
182843e1988Sjohnlev 
183843e1988Sjohnlev /* *** __HYPERVISOR_physdev_op_compat *** OBSOLETED */
184843e1988Sjohnlev 
1857eea693dSMark Johnson /*
1867eea693dSMark Johnson  * ****
1877eea693dSMark Johnson  * NOTE: this hypercall should not be called directly for a
1887eea693dSMark Johnson  * GNTTABOP_map_grant_ref. Instead xen_map_gref() should be called.
1897eea693dSMark Johnson  * ****
1907eea693dSMark Johnson  */
191843e1988Sjohnlev long
HYPERVISOR_grant_table_op(uint_t cmd,void * uop,uint_t count)192843e1988Sjohnlev HYPERVISOR_grant_table_op(uint_t cmd, void *uop, uint_t count)
193843e1988Sjohnlev {
194843e1988Sjohnlev 	int ret_val;
195843e1988Sjohnlev 	ret_val = __hypercall3(__HYPERVISOR_grant_table_op,
196843e1988Sjohnlev 	    (long)cmd, (ulong_t)uop, (ulong_t)count);
197843e1988Sjohnlev 	return (ret_val);
198843e1988Sjohnlev }
199843e1988Sjohnlev 
200843e1988Sjohnlev long
HYPERVISOR_vm_assist(uint_t cmd,uint_t type)201843e1988Sjohnlev HYPERVISOR_vm_assist(uint_t cmd, uint_t type)
202843e1988Sjohnlev {
203843e1988Sjohnlev 	return (__hypercall2(__HYPERVISOR_vm_assist,
204843e1988Sjohnlev 	    (ulong_t)cmd, (ulong_t)type));
205843e1988Sjohnlev }
206843e1988Sjohnlev 
207843e1988Sjohnlev int
HYPERVISOR_update_va_mapping_otherdomain(ulong_t va,uint64_t new_pte,ulong_t flags,domid_t domain_id)208843e1988Sjohnlev HYPERVISOR_update_va_mapping_otherdomain(ulong_t va,
209843e1988Sjohnlev     uint64_t new_pte, ulong_t flags, domid_t domain_id)
210843e1988Sjohnlev {
211843e1988Sjohnlev #if defined(__amd64)
212843e1988Sjohnlev 
213843e1988Sjohnlev 	return (__hypercall4_int(__HYPERVISOR_update_va_mapping_otherdomain,
214843e1988Sjohnlev 	    va, new_pte, flags, (ulong_t)domain_id));
215843e1988Sjohnlev 
216*86ef0a63SRichard Lowe #endif	/* __amd64 */
217843e1988Sjohnlev }
218843e1988Sjohnlev 
219843e1988Sjohnlev /*
220843e1988Sjohnlev  * *** __HYPERVISOR_iret ***
221843e1988Sjohnlev  *   see HYPERVISOR_IRET() macro in i86xpv/sys/machprivregs.h
222843e1988Sjohnlev  */
223843e1988Sjohnlev 
224843e1988Sjohnlev long
HYPERVISOR_vcpu_op(int cmd,int vcpuid,void * extra_args)225843e1988Sjohnlev HYPERVISOR_vcpu_op(int cmd, int vcpuid, void *extra_args)
226843e1988Sjohnlev {
227843e1988Sjohnlev 	return (__hypercall3(__HYPERVISOR_vcpu_op, (long)cmd, (long)vcpuid,
228843e1988Sjohnlev 	    (ulong_t)extra_args));
229843e1988Sjohnlev }
230843e1988Sjohnlev 
231843e1988Sjohnlev #if defined(__amd64)
232843e1988Sjohnlev 
233843e1988Sjohnlev long
HYPERVISOR_set_segment_base(int reg,ulong_t value)234843e1988Sjohnlev HYPERVISOR_set_segment_base(int reg, ulong_t value)
235843e1988Sjohnlev {
236843e1988Sjohnlev 	return (__hypercall2(__HYPERVISOR_set_segment_base, (long)reg, value));
237843e1988Sjohnlev }
238843e1988Sjohnlev 
239843e1988Sjohnlev #endif	/* __amd64 */
240843e1988Sjohnlev 
241843e1988Sjohnlev int
HYPERVISOR_mmuext_op(struct mmuext_op * req,int count,uint_t * success_count,domid_t domain_id)242843e1988Sjohnlev HYPERVISOR_mmuext_op(struct mmuext_op *req, int count, uint_t *success_count,
243843e1988Sjohnlev     domid_t domain_id)
244843e1988Sjohnlev {
245843e1988Sjohnlev 	return (__hypercall4_int(__HYPERVISOR_mmuext_op,
246843e1988Sjohnlev 	    (ulong_t)req, (long)count, (ulong_t)success_count,
247843e1988Sjohnlev 	    (ulong_t)domain_id));
248843e1988Sjohnlev }
249843e1988Sjohnlev 
250843e1988Sjohnlev long
HYPERVISOR_nmi_op(int cmd,void * arg)251843e1988Sjohnlev HYPERVISOR_nmi_op(int cmd, void *arg)
252843e1988Sjohnlev {
253843e1988Sjohnlev 	return (__hypercall2(__HYPERVISOR_nmi_op, (long)cmd, (ulong_t)arg));
254843e1988Sjohnlev }
255843e1988Sjohnlev 
256843e1988Sjohnlev long
HYPERVISOR_sched_op(int cmd,void * arg)257843e1988Sjohnlev HYPERVISOR_sched_op(int cmd, void *arg)
258843e1988Sjohnlev {
259843e1988Sjohnlev 	return (__hypercall2(__HYPERVISOR_sched_op,
260843e1988Sjohnlev 	    (ulong_t)cmd, (ulong_t)arg));
261843e1988Sjohnlev }
262843e1988Sjohnlev 
263843e1988Sjohnlev long
HYPERVISOR_callback_op(int cmd,void * arg)264843e1988Sjohnlev HYPERVISOR_callback_op(int cmd, void *arg)
265843e1988Sjohnlev {
266843e1988Sjohnlev 	return (__hypercall2(__HYPERVISOR_callback_op,
267843e1988Sjohnlev 	    (ulong_t)cmd, (ulong_t)arg));
268843e1988Sjohnlev }
269843e1988Sjohnlev 
270843e1988Sjohnlev /* *** __HYPERVISOR_xenoprof_op *** NOT IMPLEMENTED */
271843e1988Sjohnlev 
272843e1988Sjohnlev long
HYPERVISOR_event_channel_op(int cmd,void * arg)273843e1988Sjohnlev HYPERVISOR_event_channel_op(int cmd, void *arg)
274843e1988Sjohnlev {
275843e1988Sjohnlev 	return (__hypercall2(__HYPERVISOR_event_channel_op, (long)cmd,
276843e1988Sjohnlev 	    (ulong_t)arg));
277843e1988Sjohnlev }
278843e1988Sjohnlev 
279843e1988Sjohnlev long
HYPERVISOR_physdev_op(int cmd,void * arg)280843e1988Sjohnlev HYPERVISOR_physdev_op(int cmd, void *arg)
281843e1988Sjohnlev {
282843e1988Sjohnlev 	return (__hypercall2(__HYPERVISOR_physdev_op, (long)cmd,
283843e1988Sjohnlev 	    (ulong_t)arg));
284843e1988Sjohnlev }
285843e1988Sjohnlev 
286843e1988Sjohnlev long
HYPERVISOR_hvm_op(int cmd,void * arg)287843e1988Sjohnlev HYPERVISOR_hvm_op(int cmd, void *arg)
288843e1988Sjohnlev {
289843e1988Sjohnlev 	return (__hypercall2(__HYPERVISOR_hvm_op, (long)cmd, (ulong_t)arg));
290843e1988Sjohnlev }
291843e1988Sjohnlev 
292349b53ddSStuart Maybee #if defined(__xpv)
293349b53ddSStuart Maybee long
HYPERVISOR_xsm_op(struct xen_acmctl * arg)294349b53ddSStuart Maybee HYPERVISOR_xsm_op(struct xen_acmctl *arg)
295349b53ddSStuart Maybee {
296349b53ddSStuart Maybee 	return (__hypercall1(__HYPERVISOR_xsm_op, (ulong_t)arg));
297349b53ddSStuart Maybee }
298349b53ddSStuart Maybee 
299843e1988Sjohnlev long
HYPERVISOR_sysctl(xen_sysctl_t * sysctl)300843e1988Sjohnlev HYPERVISOR_sysctl(xen_sysctl_t *sysctl)
301843e1988Sjohnlev {
302843e1988Sjohnlev 	return (__hypercall1(__HYPERVISOR_sysctl, (ulong_t)sysctl));
303843e1988Sjohnlev }
304843e1988Sjohnlev 
305843e1988Sjohnlev long
HYPERVISOR_domctl(xen_domctl_t * domctl)306843e1988Sjohnlev HYPERVISOR_domctl(xen_domctl_t *domctl)
307843e1988Sjohnlev {
308843e1988Sjohnlev 	return (__hypercall1(__HYPERVISOR_domctl, (ulong_t)domctl));
309843e1988Sjohnlev }
310349b53ddSStuart Maybee #endif /* __xpv */
311843e1988Sjohnlev 
312843e1988Sjohnlev /* *** __HYPERVISOR_kexec_op *** NOT IMPLEMENTED */
313843e1988Sjohnlev 
314843e1988Sjohnlev /*
315843e1988Sjohnlev  *
316843e1988Sjohnlev  * HYPERCALL HELPER ROUTINES
317843e1988Sjohnlev  *    These don't have there own unique hypercalls.
318843e1988Sjohnlev  *
319843e1988Sjohnlev  */
320843e1988Sjohnlev 
321843e1988Sjohnlev long
HYPERVISOR_yield(void)322843e1988Sjohnlev HYPERVISOR_yield(void)
323843e1988Sjohnlev {
324843e1988Sjohnlev 	return (HYPERVISOR_sched_op(SCHEDOP_yield, NULL));
325843e1988Sjohnlev }
326843e1988Sjohnlev 
327843e1988Sjohnlev long
HYPERVISOR_block(void)328843e1988Sjohnlev HYPERVISOR_block(void)
329843e1988Sjohnlev {
330843e1988Sjohnlev 	return (HYPERVISOR_sched_op(SCHEDOP_block, NULL));
331843e1988Sjohnlev }
332843e1988Sjohnlev 
333843e1988Sjohnlev long
HYPERVISOR_shutdown(uint_t reason)334843e1988Sjohnlev HYPERVISOR_shutdown(uint_t reason)
335843e1988Sjohnlev {
336843e1988Sjohnlev 	struct sched_shutdown sched_shutdown;
337843e1988Sjohnlev 
338843e1988Sjohnlev 	sched_shutdown.reason = reason;
339843e1988Sjohnlev 
340843e1988Sjohnlev 	return (HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown));
341843e1988Sjohnlev }
342843e1988Sjohnlev 
343843e1988Sjohnlev /*
344843e1988Sjohnlev  * Poll one or more event-channel ports, and return when pending.
345843e1988Sjohnlev  * An optional timeout (in nanoseconds, absolute time since boot) may be
346843e1988Sjohnlev  * specified. Note: this timeout must be the Xen system time not hrtime (see
347843e1988Sjohnlev  * xpv_timestamp.c).
348843e1988Sjohnlev  */
349843e1988Sjohnlev long
HYPERVISOR_poll(evtchn_port_t * ports,uint_t nr_ports,uint64_t timeout)350843e1988Sjohnlev HYPERVISOR_poll(evtchn_port_t *ports, uint_t nr_ports, uint64_t timeout)
351843e1988Sjohnlev {
352843e1988Sjohnlev 	struct sched_poll sched_poll;
353843e1988Sjohnlev 
354843e1988Sjohnlev 	/*LINTED: constant in conditional context*/
355843e1988Sjohnlev 	set_xen_guest_handle(sched_poll.ports, ports);
356843e1988Sjohnlev 	sched_poll.nr_ports = nr_ports;
357843e1988Sjohnlev 	sched_poll.timeout = timeout;
358843e1988Sjohnlev 
359843e1988Sjohnlev 	return (HYPERVISOR_sched_op(SCHEDOP_poll, &sched_poll));
360843e1988Sjohnlev }
361843e1988Sjohnlev 
362843e1988Sjohnlev long
HYPERVISOR_suspend(ulong_t start_info_mfn)363843e1988Sjohnlev HYPERVISOR_suspend(ulong_t start_info_mfn)
364843e1988Sjohnlev {
365843e1988Sjohnlev 	struct sched_shutdown sched_shutdown;
366843e1988Sjohnlev 
367843e1988Sjohnlev 	sched_shutdown.reason = SHUTDOWN_suspend;
368843e1988Sjohnlev 
369843e1988Sjohnlev 	return (__hypercall3(__HYPERVISOR_sched_op, SCHEDOP_shutdown,
370843e1988Sjohnlev 	    (ulong_t)&sched_shutdown, start_info_mfn));
371843e1988Sjohnlev }
372e4b86885SCheng Sean Ye 
373e4b86885SCheng Sean Ye long
HYPERVISOR_mca(uint32_t cmd,xen_mc_t * xmcp)374ad09f8b8SMark Johnson HYPERVISOR_mca(uint32_t cmd, xen_mc_t *xmcp)
375e4b86885SCheng Sean Ye {
376e4b86885SCheng Sean Ye 	long rv;
377e4b86885SCheng Sean Ye 
378e4b86885SCheng Sean Ye 	switch (cmd) {
379349b53ddSStuart Maybee 	case XEN_MC_fetch:
380349b53ddSStuart Maybee 	case XEN_MC_physcpuinfo:
381349b53ddSStuart Maybee 	case XEN_MC_msrinject:
382349b53ddSStuart Maybee 	case XEN_MC_mceinject:
383e4b86885SCheng Sean Ye 		break;
384e4b86885SCheng Sean Ye 
385349b53ddSStuart Maybee 	case XEN_MC_notifydomain:
386e4b86885SCheng Sean Ye 		return (ENOTSUP);
387e4b86885SCheng Sean Ye 
388e4b86885SCheng Sean Ye 	default:
389e4b86885SCheng Sean Ye 		return (EINVAL);
390e4b86885SCheng Sean Ye 	}
391e4b86885SCheng Sean Ye 
392ad09f8b8SMark Johnson 	xmcp->interface_version = XEN_MCA_INTERFACE_VERSION;
393ad09f8b8SMark Johnson 	xmcp->cmd = cmd;
394e4b86885SCheng Sean Ye 
395ad09f8b8SMark Johnson 	rv = __hypercall1(__HYPERVISOR_mca, (ulong_t)xmcp);
396e4b86885SCheng Sean Ye 
397e4b86885SCheng Sean Ye 	return (rv);
398e4b86885SCheng Sean Ye }
399