18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * Freescale hypervisor call interface
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Copyright 2008-2010 Freescale Semiconductor, Inc.
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * Author: Timur Tabi <timur@freescale.com>
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * This file is provided under a dual BSD/GPL license.  When using or
98c2ecf20Sopenharmony_ci * redistributing this file, you may do so under either license.
108c2ecf20Sopenharmony_ci *
118c2ecf20Sopenharmony_ci * Redistribution and use in source and binary forms, with or without
128c2ecf20Sopenharmony_ci * modification, are permitted provided that the following conditions are met:
138c2ecf20Sopenharmony_ci *     * Redistributions of source code must retain the above copyright
148c2ecf20Sopenharmony_ci *       notice, this list of conditions and the following disclaimer.
158c2ecf20Sopenharmony_ci *     * Redistributions in binary form must reproduce the above copyright
168c2ecf20Sopenharmony_ci *       notice, this list of conditions and the following disclaimer in the
178c2ecf20Sopenharmony_ci *       documentation and/or other materials provided with the distribution.
188c2ecf20Sopenharmony_ci *     * Neither the name of Freescale Semiconductor nor the
198c2ecf20Sopenharmony_ci *       names of its contributors may be used to endorse or promote products
208c2ecf20Sopenharmony_ci *       derived from this software without specific prior written permission.
218c2ecf20Sopenharmony_ci *
228c2ecf20Sopenharmony_ci *
238c2ecf20Sopenharmony_ci * ALTERNATIVELY, this software may be distributed under the terms of the
248c2ecf20Sopenharmony_ci * GNU General Public License ("GPL") as published by the Free Software
258c2ecf20Sopenharmony_ci * Foundation, either version 2 of that License or (at your option) any
268c2ecf20Sopenharmony_ci * later version.
278c2ecf20Sopenharmony_ci *
288c2ecf20Sopenharmony_ci * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
298c2ecf20Sopenharmony_ci * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
308c2ecf20Sopenharmony_ci * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
318c2ecf20Sopenharmony_ci * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
328c2ecf20Sopenharmony_ci * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
338c2ecf20Sopenharmony_ci * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
348c2ecf20Sopenharmony_ci * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
358c2ecf20Sopenharmony_ci * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
368c2ecf20Sopenharmony_ci * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
378c2ecf20Sopenharmony_ci * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
388c2ecf20Sopenharmony_ci */
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci#ifndef _FSL_HCALLS_H
418c2ecf20Sopenharmony_ci#define _FSL_HCALLS_H
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci#include <linux/types.h>
448c2ecf20Sopenharmony_ci#include <linux/errno.h>
458c2ecf20Sopenharmony_ci#include <asm/byteorder.h>
468c2ecf20Sopenharmony_ci#include <asm/epapr_hcalls.h>
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci#define FH_API_VERSION			1
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci#define FH_ERR_GET_INFO			1
518c2ecf20Sopenharmony_ci#define FH_PARTITION_GET_DTPROP		2
528c2ecf20Sopenharmony_ci#define FH_PARTITION_SET_DTPROP		3
538c2ecf20Sopenharmony_ci#define FH_PARTITION_RESTART		4
548c2ecf20Sopenharmony_ci#define FH_PARTITION_GET_STATUS		5
558c2ecf20Sopenharmony_ci#define FH_PARTITION_START		6
568c2ecf20Sopenharmony_ci#define FH_PARTITION_STOP		7
578c2ecf20Sopenharmony_ci#define FH_PARTITION_MEMCPY		8
588c2ecf20Sopenharmony_ci#define FH_DMA_ENABLE			9
598c2ecf20Sopenharmony_ci#define FH_DMA_DISABLE			10
608c2ecf20Sopenharmony_ci#define FH_SEND_NMI			11
618c2ecf20Sopenharmony_ci#define FH_VMPIC_GET_MSIR		12
628c2ecf20Sopenharmony_ci#define FH_SYSTEM_RESET			13
638c2ecf20Sopenharmony_ci#define FH_GET_CORE_STATE		14
648c2ecf20Sopenharmony_ci#define FH_ENTER_NAP			15
658c2ecf20Sopenharmony_ci#define FH_EXIT_NAP			16
668c2ecf20Sopenharmony_ci#define FH_CLAIM_DEVICE			17
678c2ecf20Sopenharmony_ci#define FH_PARTITION_STOP_DMA		18
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ci/* vendor ID: Freescale Semiconductor */
708c2ecf20Sopenharmony_ci#define FH_HCALL_TOKEN(num)		_EV_HCALL_TOKEN(EV_FSL_VENDOR_ID, num)
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ci/*
738c2ecf20Sopenharmony_ci * We use "uintptr_t" to define a register because it's guaranteed to be a
748c2ecf20Sopenharmony_ci * 32-bit integer on a 32-bit platform, and a 64-bit integer on a 64-bit
758c2ecf20Sopenharmony_ci * platform.
768c2ecf20Sopenharmony_ci *
778c2ecf20Sopenharmony_ci * All registers are either input/output or output only.  Registers that are
788c2ecf20Sopenharmony_ci * initialized before making the hypercall are input/output.  All
798c2ecf20Sopenharmony_ci * input/output registers are represented with "+r".  Output-only registers
808c2ecf20Sopenharmony_ci * are represented with "=r".  Do not specify any unused registers.  The
818c2ecf20Sopenharmony_ci * clobber list will tell the compiler that the hypercall modifies those
828c2ecf20Sopenharmony_ci * registers, which is good enough.
838c2ecf20Sopenharmony_ci */
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_ci/**
868c2ecf20Sopenharmony_ci * fh_send_nmi - send NMI to virtual cpu(s).
878c2ecf20Sopenharmony_ci * @vcpu_mask: send NMI to virtual cpu(s) specified by this mask.
888c2ecf20Sopenharmony_ci *
898c2ecf20Sopenharmony_ci * Returns 0 for success, or EINVAL for invalid vcpu_mask.
908c2ecf20Sopenharmony_ci */
918c2ecf20Sopenharmony_cistatic inline unsigned int fh_send_nmi(unsigned int vcpu_mask)
928c2ecf20Sopenharmony_ci{
938c2ecf20Sopenharmony_ci	register uintptr_t r11 __asm__("r11");
948c2ecf20Sopenharmony_ci	register uintptr_t r3 __asm__("r3");
958c2ecf20Sopenharmony_ci
968c2ecf20Sopenharmony_ci	r11 = FH_HCALL_TOKEN(FH_SEND_NMI);
978c2ecf20Sopenharmony_ci	r3 = vcpu_mask;
988c2ecf20Sopenharmony_ci
998c2ecf20Sopenharmony_ci	asm volatile("bl	epapr_hypercall_start"
1008c2ecf20Sopenharmony_ci		: "+r" (r11), "+r" (r3)
1018c2ecf20Sopenharmony_ci		: : EV_HCALL_CLOBBERS1
1028c2ecf20Sopenharmony_ci	);
1038c2ecf20Sopenharmony_ci
1048c2ecf20Sopenharmony_ci	return r3;
1058c2ecf20Sopenharmony_ci}
1068c2ecf20Sopenharmony_ci
1078c2ecf20Sopenharmony_ci/* Arbitrary limits to avoid excessive memory allocation in hypervisor */
1088c2ecf20Sopenharmony_ci#define FH_DTPROP_MAX_PATHLEN 4096
1098c2ecf20Sopenharmony_ci#define FH_DTPROP_MAX_PROPLEN 32768
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_ci/**
1128c2ecf20Sopenharmony_ci * fh_partition_get_dtprop - get a property from a guest device tree.
1138c2ecf20Sopenharmony_ci * @handle: handle of partition whose device tree is to be accessed
1148c2ecf20Sopenharmony_ci * @dtpath_addr: physical address of device tree path to access
1158c2ecf20Sopenharmony_ci * @propname_addr: physical address of name of property
1168c2ecf20Sopenharmony_ci * @propvalue_addr: physical address of property value buffer
1178c2ecf20Sopenharmony_ci * @propvalue_len: length of buffer on entry, length of property on return
1188c2ecf20Sopenharmony_ci *
1198c2ecf20Sopenharmony_ci * Returns zero on success, non-zero on error.
1208c2ecf20Sopenharmony_ci */
1218c2ecf20Sopenharmony_cistatic inline unsigned int fh_partition_get_dtprop(int handle,
1228c2ecf20Sopenharmony_ci						   uint64_t dtpath_addr,
1238c2ecf20Sopenharmony_ci						   uint64_t propname_addr,
1248c2ecf20Sopenharmony_ci						   uint64_t propvalue_addr,
1258c2ecf20Sopenharmony_ci						   uint32_t *propvalue_len)
1268c2ecf20Sopenharmony_ci{
1278c2ecf20Sopenharmony_ci	register uintptr_t r11 __asm__("r11");
1288c2ecf20Sopenharmony_ci	register uintptr_t r3 __asm__("r3");
1298c2ecf20Sopenharmony_ci	register uintptr_t r4 __asm__("r4");
1308c2ecf20Sopenharmony_ci	register uintptr_t r5 __asm__("r5");
1318c2ecf20Sopenharmony_ci	register uintptr_t r6 __asm__("r6");
1328c2ecf20Sopenharmony_ci	register uintptr_t r7 __asm__("r7");
1338c2ecf20Sopenharmony_ci	register uintptr_t r8 __asm__("r8");
1348c2ecf20Sopenharmony_ci	register uintptr_t r9 __asm__("r9");
1358c2ecf20Sopenharmony_ci	register uintptr_t r10 __asm__("r10");
1368c2ecf20Sopenharmony_ci
1378c2ecf20Sopenharmony_ci	r11 = FH_HCALL_TOKEN(FH_PARTITION_GET_DTPROP);
1388c2ecf20Sopenharmony_ci	r3 = handle;
1398c2ecf20Sopenharmony_ci
1408c2ecf20Sopenharmony_ci#ifdef CONFIG_PHYS_64BIT
1418c2ecf20Sopenharmony_ci	r4 = dtpath_addr >> 32;
1428c2ecf20Sopenharmony_ci	r6 = propname_addr >> 32;
1438c2ecf20Sopenharmony_ci	r8 = propvalue_addr >> 32;
1448c2ecf20Sopenharmony_ci#else
1458c2ecf20Sopenharmony_ci	r4 = 0;
1468c2ecf20Sopenharmony_ci	r6 = 0;
1478c2ecf20Sopenharmony_ci	r8 = 0;
1488c2ecf20Sopenharmony_ci#endif
1498c2ecf20Sopenharmony_ci	r5 = (uint32_t)dtpath_addr;
1508c2ecf20Sopenharmony_ci	r7 = (uint32_t)propname_addr;
1518c2ecf20Sopenharmony_ci	r9 = (uint32_t)propvalue_addr;
1528c2ecf20Sopenharmony_ci	r10 = *propvalue_len;
1538c2ecf20Sopenharmony_ci
1548c2ecf20Sopenharmony_ci	asm volatile("bl	epapr_hypercall_start"
1558c2ecf20Sopenharmony_ci		: "+r" (r11),
1568c2ecf20Sopenharmony_ci		  "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6), "+r" (r7),
1578c2ecf20Sopenharmony_ci		  "+r" (r8), "+r" (r9), "+r" (r10)
1588c2ecf20Sopenharmony_ci		: : EV_HCALL_CLOBBERS8
1598c2ecf20Sopenharmony_ci	);
1608c2ecf20Sopenharmony_ci
1618c2ecf20Sopenharmony_ci	*propvalue_len = r4;
1628c2ecf20Sopenharmony_ci	return r3;
1638c2ecf20Sopenharmony_ci}
1648c2ecf20Sopenharmony_ci
1658c2ecf20Sopenharmony_ci/**
1668c2ecf20Sopenharmony_ci * Set a property in a guest device tree.
1678c2ecf20Sopenharmony_ci * @handle: handle of partition whose device tree is to be accessed
1688c2ecf20Sopenharmony_ci * @dtpath_addr: physical address of device tree path to access
1698c2ecf20Sopenharmony_ci * @propname_addr: physical address of name of property
1708c2ecf20Sopenharmony_ci * @propvalue_addr: physical address of property value
1718c2ecf20Sopenharmony_ci * @propvalue_len: length of property
1728c2ecf20Sopenharmony_ci *
1738c2ecf20Sopenharmony_ci * Returns zero on success, non-zero on error.
1748c2ecf20Sopenharmony_ci */
1758c2ecf20Sopenharmony_cistatic inline unsigned int fh_partition_set_dtprop(int handle,
1768c2ecf20Sopenharmony_ci						   uint64_t dtpath_addr,
1778c2ecf20Sopenharmony_ci						   uint64_t propname_addr,
1788c2ecf20Sopenharmony_ci						   uint64_t propvalue_addr,
1798c2ecf20Sopenharmony_ci						   uint32_t propvalue_len)
1808c2ecf20Sopenharmony_ci{
1818c2ecf20Sopenharmony_ci	register uintptr_t r11 __asm__("r11");
1828c2ecf20Sopenharmony_ci	register uintptr_t r3 __asm__("r3");
1838c2ecf20Sopenharmony_ci	register uintptr_t r4 __asm__("r4");
1848c2ecf20Sopenharmony_ci	register uintptr_t r6 __asm__("r6");
1858c2ecf20Sopenharmony_ci	register uintptr_t r8 __asm__("r8");
1868c2ecf20Sopenharmony_ci	register uintptr_t r5 __asm__("r5");
1878c2ecf20Sopenharmony_ci	register uintptr_t r7 __asm__("r7");
1888c2ecf20Sopenharmony_ci	register uintptr_t r9 __asm__("r9");
1898c2ecf20Sopenharmony_ci	register uintptr_t r10 __asm__("r10");
1908c2ecf20Sopenharmony_ci
1918c2ecf20Sopenharmony_ci	r11 = FH_HCALL_TOKEN(FH_PARTITION_SET_DTPROP);
1928c2ecf20Sopenharmony_ci	r3 = handle;
1938c2ecf20Sopenharmony_ci
1948c2ecf20Sopenharmony_ci#ifdef CONFIG_PHYS_64BIT
1958c2ecf20Sopenharmony_ci	r4 = dtpath_addr >> 32;
1968c2ecf20Sopenharmony_ci	r6 = propname_addr >> 32;
1978c2ecf20Sopenharmony_ci	r8 = propvalue_addr >> 32;
1988c2ecf20Sopenharmony_ci#else
1998c2ecf20Sopenharmony_ci	r4 = 0;
2008c2ecf20Sopenharmony_ci	r6 = 0;
2018c2ecf20Sopenharmony_ci	r8 = 0;
2028c2ecf20Sopenharmony_ci#endif
2038c2ecf20Sopenharmony_ci	r5 = (uint32_t)dtpath_addr;
2048c2ecf20Sopenharmony_ci	r7 = (uint32_t)propname_addr;
2058c2ecf20Sopenharmony_ci	r9 = (uint32_t)propvalue_addr;
2068c2ecf20Sopenharmony_ci	r10 = propvalue_len;
2078c2ecf20Sopenharmony_ci
2088c2ecf20Sopenharmony_ci	asm volatile("bl	epapr_hypercall_start"
2098c2ecf20Sopenharmony_ci		: "+r" (r11),
2108c2ecf20Sopenharmony_ci		  "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6), "+r" (r7),
2118c2ecf20Sopenharmony_ci		  "+r" (r8), "+r" (r9), "+r" (r10)
2128c2ecf20Sopenharmony_ci		: : EV_HCALL_CLOBBERS8
2138c2ecf20Sopenharmony_ci	);
2148c2ecf20Sopenharmony_ci
2158c2ecf20Sopenharmony_ci	return r3;
2168c2ecf20Sopenharmony_ci}
2178c2ecf20Sopenharmony_ci
2188c2ecf20Sopenharmony_ci/**
2198c2ecf20Sopenharmony_ci * fh_partition_restart - reboot the current partition
2208c2ecf20Sopenharmony_ci * @partition: partition ID
2218c2ecf20Sopenharmony_ci *
2228c2ecf20Sopenharmony_ci * Returns an error code if reboot failed.  Does not return if it succeeds.
2238c2ecf20Sopenharmony_ci */
2248c2ecf20Sopenharmony_cistatic inline unsigned int fh_partition_restart(unsigned int partition)
2258c2ecf20Sopenharmony_ci{
2268c2ecf20Sopenharmony_ci	register uintptr_t r11 __asm__("r11");
2278c2ecf20Sopenharmony_ci	register uintptr_t r3 __asm__("r3");
2288c2ecf20Sopenharmony_ci
2298c2ecf20Sopenharmony_ci	r11 = FH_HCALL_TOKEN(FH_PARTITION_RESTART);
2308c2ecf20Sopenharmony_ci	r3 = partition;
2318c2ecf20Sopenharmony_ci
2328c2ecf20Sopenharmony_ci	asm volatile("bl	epapr_hypercall_start"
2338c2ecf20Sopenharmony_ci		: "+r" (r11), "+r" (r3)
2348c2ecf20Sopenharmony_ci		: : EV_HCALL_CLOBBERS1
2358c2ecf20Sopenharmony_ci	);
2368c2ecf20Sopenharmony_ci
2378c2ecf20Sopenharmony_ci	return r3;
2388c2ecf20Sopenharmony_ci}
2398c2ecf20Sopenharmony_ci
2408c2ecf20Sopenharmony_ci#define FH_PARTITION_STOPPED	0
2418c2ecf20Sopenharmony_ci#define FH_PARTITION_RUNNING	1
2428c2ecf20Sopenharmony_ci#define FH_PARTITION_STARTING	2
2438c2ecf20Sopenharmony_ci#define FH_PARTITION_STOPPING	3
2448c2ecf20Sopenharmony_ci#define FH_PARTITION_PAUSING	4
2458c2ecf20Sopenharmony_ci#define FH_PARTITION_PAUSED	5
2468c2ecf20Sopenharmony_ci#define FH_PARTITION_RESUMING	6
2478c2ecf20Sopenharmony_ci
2488c2ecf20Sopenharmony_ci/**
2498c2ecf20Sopenharmony_ci * fh_partition_get_status - gets the status of a partition
2508c2ecf20Sopenharmony_ci * @partition: partition ID
2518c2ecf20Sopenharmony_ci * @status: returned status code
2528c2ecf20Sopenharmony_ci *
2538c2ecf20Sopenharmony_ci * Returns 0 for success, or an error code.
2548c2ecf20Sopenharmony_ci */
2558c2ecf20Sopenharmony_cistatic inline unsigned int fh_partition_get_status(unsigned int partition,
2568c2ecf20Sopenharmony_ci	unsigned int *status)
2578c2ecf20Sopenharmony_ci{
2588c2ecf20Sopenharmony_ci	register uintptr_t r11 __asm__("r11");
2598c2ecf20Sopenharmony_ci	register uintptr_t r3 __asm__("r3");
2608c2ecf20Sopenharmony_ci	register uintptr_t r4 __asm__("r4");
2618c2ecf20Sopenharmony_ci
2628c2ecf20Sopenharmony_ci	r11 = FH_HCALL_TOKEN(FH_PARTITION_GET_STATUS);
2638c2ecf20Sopenharmony_ci	r3 = partition;
2648c2ecf20Sopenharmony_ci
2658c2ecf20Sopenharmony_ci	asm volatile("bl	epapr_hypercall_start"
2668c2ecf20Sopenharmony_ci		: "+r" (r11), "+r" (r3), "=r" (r4)
2678c2ecf20Sopenharmony_ci		: : EV_HCALL_CLOBBERS2
2688c2ecf20Sopenharmony_ci	);
2698c2ecf20Sopenharmony_ci
2708c2ecf20Sopenharmony_ci	*status = r4;
2718c2ecf20Sopenharmony_ci
2728c2ecf20Sopenharmony_ci	return r3;
2738c2ecf20Sopenharmony_ci}
2748c2ecf20Sopenharmony_ci
2758c2ecf20Sopenharmony_ci/**
2768c2ecf20Sopenharmony_ci * fh_partition_start - boots and starts execution of the specified partition
2778c2ecf20Sopenharmony_ci * @partition: partition ID
2788c2ecf20Sopenharmony_ci * @entry_point: guest physical address to start execution
2798c2ecf20Sopenharmony_ci *
2808c2ecf20Sopenharmony_ci * The hypervisor creates a 1-to-1 virtual/physical IMA mapping, so at boot
2818c2ecf20Sopenharmony_ci * time, guest physical address are the same as guest virtual addresses.
2828c2ecf20Sopenharmony_ci *
2838c2ecf20Sopenharmony_ci * Returns 0 for success, or an error code.
2848c2ecf20Sopenharmony_ci */
2858c2ecf20Sopenharmony_cistatic inline unsigned int fh_partition_start(unsigned int partition,
2868c2ecf20Sopenharmony_ci	uint32_t entry_point, int load)
2878c2ecf20Sopenharmony_ci{
2888c2ecf20Sopenharmony_ci	register uintptr_t r11 __asm__("r11");
2898c2ecf20Sopenharmony_ci	register uintptr_t r3 __asm__("r3");
2908c2ecf20Sopenharmony_ci	register uintptr_t r4 __asm__("r4");
2918c2ecf20Sopenharmony_ci	register uintptr_t r5 __asm__("r5");
2928c2ecf20Sopenharmony_ci
2938c2ecf20Sopenharmony_ci	r11 = FH_HCALL_TOKEN(FH_PARTITION_START);
2948c2ecf20Sopenharmony_ci	r3 = partition;
2958c2ecf20Sopenharmony_ci	r4 = entry_point;
2968c2ecf20Sopenharmony_ci	r5 = load;
2978c2ecf20Sopenharmony_ci
2988c2ecf20Sopenharmony_ci	asm volatile("bl	epapr_hypercall_start"
2998c2ecf20Sopenharmony_ci		: "+r" (r11), "+r" (r3), "+r" (r4), "+r" (r5)
3008c2ecf20Sopenharmony_ci		: : EV_HCALL_CLOBBERS3
3018c2ecf20Sopenharmony_ci	);
3028c2ecf20Sopenharmony_ci
3038c2ecf20Sopenharmony_ci	return r3;
3048c2ecf20Sopenharmony_ci}
3058c2ecf20Sopenharmony_ci
3068c2ecf20Sopenharmony_ci/**
3078c2ecf20Sopenharmony_ci * fh_partition_stop - stops another partition
3088c2ecf20Sopenharmony_ci * @partition: partition ID
3098c2ecf20Sopenharmony_ci *
3108c2ecf20Sopenharmony_ci * Returns 0 for success, or an error code.
3118c2ecf20Sopenharmony_ci */
3128c2ecf20Sopenharmony_cistatic inline unsigned int fh_partition_stop(unsigned int partition)
3138c2ecf20Sopenharmony_ci{
3148c2ecf20Sopenharmony_ci	register uintptr_t r11 __asm__("r11");
3158c2ecf20Sopenharmony_ci	register uintptr_t r3 __asm__("r3");
3168c2ecf20Sopenharmony_ci
3178c2ecf20Sopenharmony_ci	r11 = FH_HCALL_TOKEN(FH_PARTITION_STOP);
3188c2ecf20Sopenharmony_ci	r3 = partition;
3198c2ecf20Sopenharmony_ci
3208c2ecf20Sopenharmony_ci	asm volatile("bl	epapr_hypercall_start"
3218c2ecf20Sopenharmony_ci		: "+r" (r11), "+r" (r3)
3228c2ecf20Sopenharmony_ci		: : EV_HCALL_CLOBBERS1
3238c2ecf20Sopenharmony_ci	);
3248c2ecf20Sopenharmony_ci
3258c2ecf20Sopenharmony_ci	return r3;
3268c2ecf20Sopenharmony_ci}
3278c2ecf20Sopenharmony_ci
3288c2ecf20Sopenharmony_ci/**
3298c2ecf20Sopenharmony_ci * struct fh_sg_list: definition of the fh_partition_memcpy S/G list
3308c2ecf20Sopenharmony_ci * @source: guest physical address to copy from
3318c2ecf20Sopenharmony_ci * @target: guest physical address to copy to
3328c2ecf20Sopenharmony_ci * @size: number of bytes to copy
3338c2ecf20Sopenharmony_ci * @reserved: reserved, must be zero
3348c2ecf20Sopenharmony_ci *
3358c2ecf20Sopenharmony_ci * The scatter/gather list for fh_partition_memcpy() is an array of these
3368c2ecf20Sopenharmony_ci * structures.  The array must be guest physically contiguous.
3378c2ecf20Sopenharmony_ci *
3388c2ecf20Sopenharmony_ci * This structure must be aligned on 32-byte boundary, so that no single
3398c2ecf20Sopenharmony_ci * strucuture can span two pages.
3408c2ecf20Sopenharmony_ci */
3418c2ecf20Sopenharmony_cistruct fh_sg_list {
3428c2ecf20Sopenharmony_ci	uint64_t source;   /**< guest physical address to copy from */
3438c2ecf20Sopenharmony_ci	uint64_t target;   /**< guest physical address to copy to */
3448c2ecf20Sopenharmony_ci	uint64_t size;     /**< number of bytes to copy */
3458c2ecf20Sopenharmony_ci	uint64_t reserved; /**< reserved, must be zero */
3468c2ecf20Sopenharmony_ci} __attribute__ ((aligned(32)));
3478c2ecf20Sopenharmony_ci
3488c2ecf20Sopenharmony_ci/**
3498c2ecf20Sopenharmony_ci * fh_partition_memcpy - copies data from one guest to another
3508c2ecf20Sopenharmony_ci * @source: the ID of the partition to copy from
3518c2ecf20Sopenharmony_ci * @target: the ID of the partition to copy to
3528c2ecf20Sopenharmony_ci * @sg_list: guest physical address of an array of &fh_sg_list structures
3538c2ecf20Sopenharmony_ci * @count: the number of entries in @sg_list
3548c2ecf20Sopenharmony_ci *
3558c2ecf20Sopenharmony_ci * Returns 0 for success, or an error code.
3568c2ecf20Sopenharmony_ci */
3578c2ecf20Sopenharmony_cistatic inline unsigned int fh_partition_memcpy(unsigned int source,
3588c2ecf20Sopenharmony_ci	unsigned int target, phys_addr_t sg_list, unsigned int count)
3598c2ecf20Sopenharmony_ci{
3608c2ecf20Sopenharmony_ci	register uintptr_t r11 __asm__("r11");
3618c2ecf20Sopenharmony_ci	register uintptr_t r3 __asm__("r3");
3628c2ecf20Sopenharmony_ci	register uintptr_t r4 __asm__("r4");
3638c2ecf20Sopenharmony_ci	register uintptr_t r5 __asm__("r5");
3648c2ecf20Sopenharmony_ci	register uintptr_t r6 __asm__("r6");
3658c2ecf20Sopenharmony_ci	register uintptr_t r7 __asm__("r7");
3668c2ecf20Sopenharmony_ci
3678c2ecf20Sopenharmony_ci	r11 = FH_HCALL_TOKEN(FH_PARTITION_MEMCPY);
3688c2ecf20Sopenharmony_ci	r3 = source;
3698c2ecf20Sopenharmony_ci	r4 = target;
3708c2ecf20Sopenharmony_ci	r5 = (uint32_t) sg_list;
3718c2ecf20Sopenharmony_ci
3728c2ecf20Sopenharmony_ci#ifdef CONFIG_PHYS_64BIT
3738c2ecf20Sopenharmony_ci	r6 = sg_list >> 32;
3748c2ecf20Sopenharmony_ci#else
3758c2ecf20Sopenharmony_ci	r6 = 0;
3768c2ecf20Sopenharmony_ci#endif
3778c2ecf20Sopenharmony_ci	r7 = count;
3788c2ecf20Sopenharmony_ci
3798c2ecf20Sopenharmony_ci	asm volatile("bl	epapr_hypercall_start"
3808c2ecf20Sopenharmony_ci		: "+r" (r11),
3818c2ecf20Sopenharmony_ci		  "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6), "+r" (r7)
3828c2ecf20Sopenharmony_ci		: : EV_HCALL_CLOBBERS5
3838c2ecf20Sopenharmony_ci	);
3848c2ecf20Sopenharmony_ci
3858c2ecf20Sopenharmony_ci	return r3;
3868c2ecf20Sopenharmony_ci}
3878c2ecf20Sopenharmony_ci
3888c2ecf20Sopenharmony_ci/**
3898c2ecf20Sopenharmony_ci * fh_dma_enable - enable DMA for the specified device
3908c2ecf20Sopenharmony_ci * @liodn: the LIODN of the I/O device for which to enable DMA
3918c2ecf20Sopenharmony_ci *
3928c2ecf20Sopenharmony_ci * Returns 0 for success, or an error code.
3938c2ecf20Sopenharmony_ci */
3948c2ecf20Sopenharmony_cistatic inline unsigned int fh_dma_enable(unsigned int liodn)
3958c2ecf20Sopenharmony_ci{
3968c2ecf20Sopenharmony_ci	register uintptr_t r11 __asm__("r11");
3978c2ecf20Sopenharmony_ci	register uintptr_t r3 __asm__("r3");
3988c2ecf20Sopenharmony_ci
3998c2ecf20Sopenharmony_ci	r11 = FH_HCALL_TOKEN(FH_DMA_ENABLE);
4008c2ecf20Sopenharmony_ci	r3 = liodn;
4018c2ecf20Sopenharmony_ci
4028c2ecf20Sopenharmony_ci	asm volatile("bl	epapr_hypercall_start"
4038c2ecf20Sopenharmony_ci		: "+r" (r11), "+r" (r3)
4048c2ecf20Sopenharmony_ci		: : EV_HCALL_CLOBBERS1
4058c2ecf20Sopenharmony_ci	);
4068c2ecf20Sopenharmony_ci
4078c2ecf20Sopenharmony_ci	return r3;
4088c2ecf20Sopenharmony_ci}
4098c2ecf20Sopenharmony_ci
4108c2ecf20Sopenharmony_ci/**
4118c2ecf20Sopenharmony_ci * fh_dma_disable - disable DMA for the specified device
4128c2ecf20Sopenharmony_ci * @liodn: the LIODN of the I/O device for which to disable DMA
4138c2ecf20Sopenharmony_ci *
4148c2ecf20Sopenharmony_ci * Returns 0 for success, or an error code.
4158c2ecf20Sopenharmony_ci */
4168c2ecf20Sopenharmony_cistatic inline unsigned int fh_dma_disable(unsigned int liodn)
4178c2ecf20Sopenharmony_ci{
4188c2ecf20Sopenharmony_ci	register uintptr_t r11 __asm__("r11");
4198c2ecf20Sopenharmony_ci	register uintptr_t r3 __asm__("r3");
4208c2ecf20Sopenharmony_ci
4218c2ecf20Sopenharmony_ci	r11 = FH_HCALL_TOKEN(FH_DMA_DISABLE);
4228c2ecf20Sopenharmony_ci	r3 = liodn;
4238c2ecf20Sopenharmony_ci
4248c2ecf20Sopenharmony_ci	asm volatile("bl	epapr_hypercall_start"
4258c2ecf20Sopenharmony_ci		: "+r" (r11), "+r" (r3)
4268c2ecf20Sopenharmony_ci		: : EV_HCALL_CLOBBERS1
4278c2ecf20Sopenharmony_ci	);
4288c2ecf20Sopenharmony_ci
4298c2ecf20Sopenharmony_ci	return r3;
4308c2ecf20Sopenharmony_ci}
4318c2ecf20Sopenharmony_ci
4328c2ecf20Sopenharmony_ci
4338c2ecf20Sopenharmony_ci/**
4348c2ecf20Sopenharmony_ci * fh_vmpic_get_msir - returns the MPIC-MSI register value
4358c2ecf20Sopenharmony_ci * @interrupt: the interrupt number
4368c2ecf20Sopenharmony_ci * @msir_val: returned MPIC-MSI register value
4378c2ecf20Sopenharmony_ci *
4388c2ecf20Sopenharmony_ci * Returns 0 for success, or an error code.
4398c2ecf20Sopenharmony_ci */
4408c2ecf20Sopenharmony_cistatic inline unsigned int fh_vmpic_get_msir(unsigned int interrupt,
4418c2ecf20Sopenharmony_ci	unsigned int *msir_val)
4428c2ecf20Sopenharmony_ci{
4438c2ecf20Sopenharmony_ci	register uintptr_t r11 __asm__("r11");
4448c2ecf20Sopenharmony_ci	register uintptr_t r3 __asm__("r3");
4458c2ecf20Sopenharmony_ci	register uintptr_t r4 __asm__("r4");
4468c2ecf20Sopenharmony_ci
4478c2ecf20Sopenharmony_ci	r11 = FH_HCALL_TOKEN(FH_VMPIC_GET_MSIR);
4488c2ecf20Sopenharmony_ci	r3 = interrupt;
4498c2ecf20Sopenharmony_ci
4508c2ecf20Sopenharmony_ci	asm volatile("bl	epapr_hypercall_start"
4518c2ecf20Sopenharmony_ci		: "+r" (r11), "+r" (r3), "=r" (r4)
4528c2ecf20Sopenharmony_ci		: : EV_HCALL_CLOBBERS2
4538c2ecf20Sopenharmony_ci	);
4548c2ecf20Sopenharmony_ci
4558c2ecf20Sopenharmony_ci	*msir_val = r4;
4568c2ecf20Sopenharmony_ci
4578c2ecf20Sopenharmony_ci	return r3;
4588c2ecf20Sopenharmony_ci}
4598c2ecf20Sopenharmony_ci
4608c2ecf20Sopenharmony_ci/**
4618c2ecf20Sopenharmony_ci * fh_system_reset - reset the system
4628c2ecf20Sopenharmony_ci *
4638c2ecf20Sopenharmony_ci * Returns 0 for success, or an error code.
4648c2ecf20Sopenharmony_ci */
4658c2ecf20Sopenharmony_cistatic inline unsigned int fh_system_reset(void)
4668c2ecf20Sopenharmony_ci{
4678c2ecf20Sopenharmony_ci	register uintptr_t r11 __asm__("r11");
4688c2ecf20Sopenharmony_ci	register uintptr_t r3 __asm__("r3");
4698c2ecf20Sopenharmony_ci
4708c2ecf20Sopenharmony_ci	r11 = FH_HCALL_TOKEN(FH_SYSTEM_RESET);
4718c2ecf20Sopenharmony_ci
4728c2ecf20Sopenharmony_ci	asm volatile("bl	epapr_hypercall_start"
4738c2ecf20Sopenharmony_ci		: "+r" (r11), "=r" (r3)
4748c2ecf20Sopenharmony_ci		: : EV_HCALL_CLOBBERS1
4758c2ecf20Sopenharmony_ci	);
4768c2ecf20Sopenharmony_ci
4778c2ecf20Sopenharmony_ci	return r3;
4788c2ecf20Sopenharmony_ci}
4798c2ecf20Sopenharmony_ci
4808c2ecf20Sopenharmony_ci
4818c2ecf20Sopenharmony_ci/**
4828c2ecf20Sopenharmony_ci * fh_err_get_info - get platform error information
4838c2ecf20Sopenharmony_ci * @queue id:
4848c2ecf20Sopenharmony_ci * 0 for guest error event queue
4858c2ecf20Sopenharmony_ci * 1 for global error event queue
4868c2ecf20Sopenharmony_ci *
4878c2ecf20Sopenharmony_ci * @pointer to store the platform error data:
4888c2ecf20Sopenharmony_ci * platform error data is returned in registers r4 - r11
4898c2ecf20Sopenharmony_ci *
4908c2ecf20Sopenharmony_ci * Returns 0 for success, or an error code.
4918c2ecf20Sopenharmony_ci */
4928c2ecf20Sopenharmony_cistatic inline unsigned int fh_err_get_info(int queue, uint32_t *bufsize,
4938c2ecf20Sopenharmony_ci	uint32_t addr_hi, uint32_t addr_lo, int peek)
4948c2ecf20Sopenharmony_ci{
4958c2ecf20Sopenharmony_ci	register uintptr_t r11 __asm__("r11");
4968c2ecf20Sopenharmony_ci	register uintptr_t r3 __asm__("r3");
4978c2ecf20Sopenharmony_ci	register uintptr_t r4 __asm__("r4");
4988c2ecf20Sopenharmony_ci	register uintptr_t r5 __asm__("r5");
4998c2ecf20Sopenharmony_ci	register uintptr_t r6 __asm__("r6");
5008c2ecf20Sopenharmony_ci	register uintptr_t r7 __asm__("r7");
5018c2ecf20Sopenharmony_ci
5028c2ecf20Sopenharmony_ci	r11 = FH_HCALL_TOKEN(FH_ERR_GET_INFO);
5038c2ecf20Sopenharmony_ci	r3 = queue;
5048c2ecf20Sopenharmony_ci	r4 = *bufsize;
5058c2ecf20Sopenharmony_ci	r5 = addr_hi;
5068c2ecf20Sopenharmony_ci	r6 = addr_lo;
5078c2ecf20Sopenharmony_ci	r7 = peek;
5088c2ecf20Sopenharmony_ci
5098c2ecf20Sopenharmony_ci	asm volatile("bl	epapr_hypercall_start"
5108c2ecf20Sopenharmony_ci		: "+r" (r11), "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6),
5118c2ecf20Sopenharmony_ci		  "+r" (r7)
5128c2ecf20Sopenharmony_ci		: : EV_HCALL_CLOBBERS5
5138c2ecf20Sopenharmony_ci	);
5148c2ecf20Sopenharmony_ci
5158c2ecf20Sopenharmony_ci	*bufsize = r4;
5168c2ecf20Sopenharmony_ci
5178c2ecf20Sopenharmony_ci	return r3;
5188c2ecf20Sopenharmony_ci}
5198c2ecf20Sopenharmony_ci
5208c2ecf20Sopenharmony_ci
5218c2ecf20Sopenharmony_ci#define FH_VCPU_RUN	0
5228c2ecf20Sopenharmony_ci#define FH_VCPU_IDLE	1
5238c2ecf20Sopenharmony_ci#define FH_VCPU_NAP	2
5248c2ecf20Sopenharmony_ci
5258c2ecf20Sopenharmony_ci/**
5268c2ecf20Sopenharmony_ci * fh_get_core_state - get the state of a vcpu
5278c2ecf20Sopenharmony_ci *
5288c2ecf20Sopenharmony_ci * @handle: handle of partition containing the vcpu
5298c2ecf20Sopenharmony_ci * @vcpu: vcpu number within the partition
5308c2ecf20Sopenharmony_ci * @state:the current state of the vcpu, see FH_VCPU_*
5318c2ecf20Sopenharmony_ci *
5328c2ecf20Sopenharmony_ci * Returns 0 for success, or an error code.
5338c2ecf20Sopenharmony_ci */
5348c2ecf20Sopenharmony_cistatic inline unsigned int fh_get_core_state(unsigned int handle,
5358c2ecf20Sopenharmony_ci	unsigned int vcpu, unsigned int *state)
5368c2ecf20Sopenharmony_ci{
5378c2ecf20Sopenharmony_ci	register uintptr_t r11 __asm__("r11");
5388c2ecf20Sopenharmony_ci	register uintptr_t r3 __asm__("r3");
5398c2ecf20Sopenharmony_ci	register uintptr_t r4 __asm__("r4");
5408c2ecf20Sopenharmony_ci
5418c2ecf20Sopenharmony_ci	r11 = FH_HCALL_TOKEN(FH_GET_CORE_STATE);
5428c2ecf20Sopenharmony_ci	r3 = handle;
5438c2ecf20Sopenharmony_ci	r4 = vcpu;
5448c2ecf20Sopenharmony_ci
5458c2ecf20Sopenharmony_ci	asm volatile("bl	epapr_hypercall_start"
5468c2ecf20Sopenharmony_ci		: "+r" (r11), "+r" (r3), "+r" (r4)
5478c2ecf20Sopenharmony_ci		: : EV_HCALL_CLOBBERS2
5488c2ecf20Sopenharmony_ci	);
5498c2ecf20Sopenharmony_ci
5508c2ecf20Sopenharmony_ci	*state = r4;
5518c2ecf20Sopenharmony_ci	return r3;
5528c2ecf20Sopenharmony_ci}
5538c2ecf20Sopenharmony_ci
5548c2ecf20Sopenharmony_ci/**
5558c2ecf20Sopenharmony_ci * fh_enter_nap - enter nap on a vcpu
5568c2ecf20Sopenharmony_ci *
5578c2ecf20Sopenharmony_ci * Note that though the API supports entering nap on a vcpu other
5588c2ecf20Sopenharmony_ci * than the caller, this may not be implmented and may return EINVAL.
5598c2ecf20Sopenharmony_ci *
5608c2ecf20Sopenharmony_ci * @handle: handle of partition containing the vcpu
5618c2ecf20Sopenharmony_ci * @vcpu: vcpu number within the partition
5628c2ecf20Sopenharmony_ci *
5638c2ecf20Sopenharmony_ci * Returns 0 for success, or an error code.
5648c2ecf20Sopenharmony_ci */
5658c2ecf20Sopenharmony_cistatic inline unsigned int fh_enter_nap(unsigned int handle, unsigned int vcpu)
5668c2ecf20Sopenharmony_ci{
5678c2ecf20Sopenharmony_ci	register uintptr_t r11 __asm__("r11");
5688c2ecf20Sopenharmony_ci	register uintptr_t r3 __asm__("r3");
5698c2ecf20Sopenharmony_ci	register uintptr_t r4 __asm__("r4");
5708c2ecf20Sopenharmony_ci
5718c2ecf20Sopenharmony_ci	r11 = FH_HCALL_TOKEN(FH_ENTER_NAP);
5728c2ecf20Sopenharmony_ci	r3 = handle;
5738c2ecf20Sopenharmony_ci	r4 = vcpu;
5748c2ecf20Sopenharmony_ci
5758c2ecf20Sopenharmony_ci	asm volatile("bl	epapr_hypercall_start"
5768c2ecf20Sopenharmony_ci		: "+r" (r11), "+r" (r3), "+r" (r4)
5778c2ecf20Sopenharmony_ci		: : EV_HCALL_CLOBBERS2
5788c2ecf20Sopenharmony_ci	);
5798c2ecf20Sopenharmony_ci
5808c2ecf20Sopenharmony_ci	return r3;
5818c2ecf20Sopenharmony_ci}
5828c2ecf20Sopenharmony_ci
5838c2ecf20Sopenharmony_ci/**
5848c2ecf20Sopenharmony_ci * fh_exit_nap - exit nap on a vcpu
5858c2ecf20Sopenharmony_ci * @handle: handle of partition containing the vcpu
5868c2ecf20Sopenharmony_ci * @vcpu: vcpu number within the partition
5878c2ecf20Sopenharmony_ci *
5888c2ecf20Sopenharmony_ci * Returns 0 for success, or an error code.
5898c2ecf20Sopenharmony_ci */
5908c2ecf20Sopenharmony_cistatic inline unsigned int fh_exit_nap(unsigned int handle, unsigned int vcpu)
5918c2ecf20Sopenharmony_ci{
5928c2ecf20Sopenharmony_ci	register uintptr_t r11 __asm__("r11");
5938c2ecf20Sopenharmony_ci	register uintptr_t r3 __asm__("r3");
5948c2ecf20Sopenharmony_ci	register uintptr_t r4 __asm__("r4");
5958c2ecf20Sopenharmony_ci
5968c2ecf20Sopenharmony_ci	r11 = FH_HCALL_TOKEN(FH_EXIT_NAP);
5978c2ecf20Sopenharmony_ci	r3 = handle;
5988c2ecf20Sopenharmony_ci	r4 = vcpu;
5998c2ecf20Sopenharmony_ci
6008c2ecf20Sopenharmony_ci	asm volatile("bl	epapr_hypercall_start"
6018c2ecf20Sopenharmony_ci		: "+r" (r11), "+r" (r3), "+r" (r4)
6028c2ecf20Sopenharmony_ci		: : EV_HCALL_CLOBBERS2
6038c2ecf20Sopenharmony_ci	);
6048c2ecf20Sopenharmony_ci
6058c2ecf20Sopenharmony_ci	return r3;
6068c2ecf20Sopenharmony_ci}
6078c2ecf20Sopenharmony_ci/**
6088c2ecf20Sopenharmony_ci * fh_claim_device - claim a "claimable" shared device
6098c2ecf20Sopenharmony_ci * @handle: fsl,hv-device-handle of node to claim
6108c2ecf20Sopenharmony_ci *
6118c2ecf20Sopenharmony_ci * Returns 0 for success, or an error code.
6128c2ecf20Sopenharmony_ci */
6138c2ecf20Sopenharmony_cistatic inline unsigned int fh_claim_device(unsigned int handle)
6148c2ecf20Sopenharmony_ci{
6158c2ecf20Sopenharmony_ci	register uintptr_t r11 __asm__("r11");
6168c2ecf20Sopenharmony_ci	register uintptr_t r3 __asm__("r3");
6178c2ecf20Sopenharmony_ci
6188c2ecf20Sopenharmony_ci	r11 = FH_HCALL_TOKEN(FH_CLAIM_DEVICE);
6198c2ecf20Sopenharmony_ci	r3 = handle;
6208c2ecf20Sopenharmony_ci
6218c2ecf20Sopenharmony_ci	asm volatile("bl	epapr_hypercall_start"
6228c2ecf20Sopenharmony_ci		: "+r" (r11), "+r" (r3)
6238c2ecf20Sopenharmony_ci		: : EV_HCALL_CLOBBERS1
6248c2ecf20Sopenharmony_ci	);
6258c2ecf20Sopenharmony_ci
6268c2ecf20Sopenharmony_ci	return r3;
6278c2ecf20Sopenharmony_ci}
6288c2ecf20Sopenharmony_ci
6298c2ecf20Sopenharmony_ci/**
6308c2ecf20Sopenharmony_ci * Run deferred DMA disabling on a partition's private devices
6318c2ecf20Sopenharmony_ci *
6328c2ecf20Sopenharmony_ci * This applies to devices which a partition owns either privately,
6338c2ecf20Sopenharmony_ci * or which are claimable and still actively owned by that partition,
6348c2ecf20Sopenharmony_ci * and which do not have the no-dma-disable property.
6358c2ecf20Sopenharmony_ci *
6368c2ecf20Sopenharmony_ci * @handle: partition (must be stopped) whose DMA is to be disabled
6378c2ecf20Sopenharmony_ci *
6388c2ecf20Sopenharmony_ci * Returns 0 for success, or an error code.
6398c2ecf20Sopenharmony_ci */
6408c2ecf20Sopenharmony_cistatic inline unsigned int fh_partition_stop_dma(unsigned int handle)
6418c2ecf20Sopenharmony_ci{
6428c2ecf20Sopenharmony_ci	register uintptr_t r11 __asm__("r11");
6438c2ecf20Sopenharmony_ci	register uintptr_t r3 __asm__("r3");
6448c2ecf20Sopenharmony_ci
6458c2ecf20Sopenharmony_ci	r11 = FH_HCALL_TOKEN(FH_PARTITION_STOP_DMA);
6468c2ecf20Sopenharmony_ci	r3 = handle;
6478c2ecf20Sopenharmony_ci
6488c2ecf20Sopenharmony_ci	asm volatile("bl	epapr_hypercall_start"
6498c2ecf20Sopenharmony_ci		: "+r" (r11), "+r" (r3)
6508c2ecf20Sopenharmony_ci		: : EV_HCALL_CLOBBERS1
6518c2ecf20Sopenharmony_ci	);
6528c2ecf20Sopenharmony_ci
6538c2ecf20Sopenharmony_ci	return r3;
6548c2ecf20Sopenharmony_ci}
6558c2ecf20Sopenharmony_ci#endif
656