lkml.org 
[lkml]   [2022]   [Oct]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v5 5/13] virt: gunyah: Add hypercalls to identify Gunyah
From
On 11. 10. 22, 2:08, Elliot Berman wrote:
> Add hypercalls to identify when Linux is running a virtual machine under
> Gunyah.
>
> There are two calls to help identify Gunyah:
>
> 1. gh_hypercall_get_uid() returns a UID when running under a Gunyah
> hypervisor.
> 2. gh_hypercall_hyp_identify() returns build information and a set of
> feature flags that are supported by Gunyah.
...
> --- /dev/null
> +++ b/arch/arm64/gunyah/hypercall.c
> @@ -0,0 +1,71 @@
...
> +/**
> + * gh_hypercall_get_uid() - Returns a UID when running under a Gunyah hypervisor.
> + * @uid: An array of 4 u32's (u32 uid[4];)
> + *
> + * The UID will be either QC_HYP_UID or GUNYAH_UID defined in include/asm-generic/gunyah.h.
> + * QC_HYP_UID is returned on platforms using Qualcomm's version of Gunyah.
> + * GUNYAH_UID is returned on platforms using open source version of Gunyah.
> + * If the uid is not one of the above two UIDs, then it is assumed that the hypervisor or firmware
> + * is not Gunyah.
> + */
> +void gh_hypercall_get_uid(u32 *uid)

So why this isn't u32 uid[4], or u32 uid[static 4] to aid the compiler
(and limit users)?

> +{
> + struct arm_smccc_res res;
> +
> + arm_smccc_1_1_hvc(GH_HYPERCALL_CALL_UID, &res);
> +
> + uid[0] = res.a0;
> + uid[1] = res.a1;
> + uid[2] = res.a2;
> + uid[3] = res.a3;
> +}
> +EXPORT_SYMBOL_GPL(gh_hypercall_get_uid);

...

> --- a/include/asm-generic/gunyah.h
> +++ b/include/asm-generic/gunyah.h
> @@ -71,4 +71,40 @@ static inline int gh_remap_error(int gh_error)
...
> +#define GH_API_INFO_API_VERSION(x) (((x) >> 0) & 0x3fff)
> +#define GH_API_INFO_BIG_ENDIAN(x) (((x) >> 14) & 1)
> +#define GH_API_INFO_IS_64BIT(x) (((x) >> 15) & 1)
> +#define GH_API_INFO_VARIANT(x) (((x) >> 56) & 0xff)

Use GET_FIELD()?

regards,
--
--
js
suse labs

\
 
 \ /
  Last update: 2022-10-11 08:24    [W:0.395 / U:0.240 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site