From bc918de501e9fc3b67156cd84b4bbec99ad8b4f1 Mon Sep 17 00:00:00 2001 From: Andre Richter Date: Mon, 27 May 2019 16:26:32 +0200 Subject: Linux Kernel: Uart relay sysfs node. Bug 2461581 Change-Id: Ia2fd3cc72459a6d18781ae9ea6c2a3973947f2d6 Signed-off-by: Andre Richter (cherry picked from commit 91064c5aa574fc3e719a643f24079cddb36c53de) Reviewed-on: https://git-master.nvidia.com/r/2119540 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Hardik T Shah Reviewed-by: Phoenix Jung Reviewed-by: mobile promotions Tested-by: mobile promotions --- include/soc/tegra/virt/syscalls.h | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/soc/tegra/virt/syscalls.h b/include/soc/tegra/virt/syscalls.h index bacef2471..f673b7911 100644 --- a/include/soc/tegra/virt/syscalls.h +++ b/include/soc/tegra/virt/syscalls.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014-2017, NVIDIA CORPORATION. All rights reserved. + * Copyright (C) 2014-2019, NVIDIA CORPORATION. All rights reserved. * * Hypervisor interfaces * @@ -46,6 +46,7 @@ #define HVC_NR_READ_HYP_INFO 9 #define HVC_NR_GUEST_RESET 10 #define HVC_NR_SYSINFO_IPA 13 +#define HVC_NR_UART_RELAY_INFO 518 #define GUEST_PRIMARY 0 #define GUEST_IVC_SERVER 0 @@ -181,6 +182,10 @@ struct hyp_server_page { #define _X4_X17 "x4", "x5", "x6", "x7", "x8", "x9", "x10", "x11", "x12", \ "x13", "x14", "x15", "x16", "x17" +#define _X5_X17 "x5", "x6", "x7", "x8", "x9", "x10", "x11", "x12", \ +"x13", "x14", "x15", "x16", "x17" + + static inline int hyp_read_gid(unsigned int *gid) { register uint64_t r0 asm("x0"); @@ -320,6 +325,31 @@ static inline uint64_t hyp_sysinfo_ipa(void) return r0; } +static inline int hyp_read_uart_relay_info(uint64_t *ipa, uint64_t *size, + uint64_t *num_channels, + uint64_t *max_msg_size) +{ + register uint64_t x0 asm("x0"); + register uint64_t x1 asm("x1"); + register uint64_t x2 asm("x2"); + register uint64_t x3 asm("x3"); + register uint64_t x4 asm("x4"); + + asm("hvc %5" + : "=r"(x0), "=r"(x1), + "=r"(x2), "=r"(x3), + "=r"(x4) + : "i"(HVC_NR_UART_RELAY_INFO) + : _X5_X17); + + *ipa = x1; + *size = x2; + *num_channels = x3; + *max_msg_size = x4; + + return (int)x0; +} + #undef _X3_X17 #undef _X4_X17 -- cgit v1.2.2