lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2fee888a-4f81-40aa-9545-617a49a7fb30@linux.microsoft.com>
Date: Thu, 27 Feb 2025 16:21:14 -0800
From: Nuno Das Neves <nunodasneves@...ux.microsoft.com>
To: Easwar Hariharan <eahariha@...ux.microsoft.com>
Cc: linux-hyperv@...r.kernel.org, x86@...nel.org,
 linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
 linux-arch@...r.kernel.org, linux-acpi@...r.kernel.org, kys@...rosoft.com,
 haiyangz@...rosoft.com, wei.liu@...nel.org, mhklinux@...look.com,
 decui@...rosoft.com, catalin.marinas@....com, will@...nel.org,
 tglx@...utronix.de, mingo@...hat.com, bp@...en8.de,
 dave.hansen@...ux.intel.com, hpa@...or.com, daniel.lezcano@...aro.org,
 joro@...tes.org, robin.murphy@....com, arnd@...db.de,
 jinankjain@...ux.microsoft.com, muminulrussell@...il.com,
 skinsburskii@...ux.microsoft.com, mrathor@...ux.microsoft.com,
 ssengar@...ux.microsoft.com, apais@...ux.microsoft.com,
 Tianyu.Lan@...rosoft.com, stanislav.kinsburskiy@...il.com,
 gregkh@...uxfoundation.org, vkuznets@...hat.com, prapal@...ux.microsoft.com,
 muislam@...rosoft.com, anrayabh@...ux.microsoft.com, rafael@...nel.org,
 lenb@...nel.org, corbet@....net
Subject: Re: [PATCH v5 03/10] arm64/hyperv: Add some missing functions to
 arm64

On 2/26/2025 9:56 PM, Easwar Hariharan wrote:
> On 2/26/2025 3:07 PM, Nuno Das Neves wrote:
>> These non-nested msr and fast hypercall functions are present in x86,
>> but they must be available in both architetures for the root partition
> 
> nit: *architectures*
> 
> 
Thanks!

>> driver code.
>>
>> Signed-off-by: Nuno Das Neves <nunodasneves@...ux.microsoft.com>
>> ---
>>  arch/arm64/hyperv/hv_core.c       | 17 +++++++++++++++++
>>  arch/arm64/include/asm/mshyperv.h | 12 ++++++++++++
>>  include/asm-generic/mshyperv.h    |  2 ++
>>  3 files changed, 31 insertions(+)
>>
>> diff --git a/arch/arm64/hyperv/hv_core.c b/arch/arm64/hyperv/hv_core.c
>> index 69004f619c57..e33a9e3c366a 100644
>> --- a/arch/arm64/hyperv/hv_core.c
>> +++ b/arch/arm64/hyperv/hv_core.c
>> @@ -53,6 +53,23 @@ u64 hv_do_fast_hypercall8(u16 code, u64 input)
>>  }
>>  EXPORT_SYMBOL_GPL(hv_do_fast_hypercall8);
>>  
>> +/*
>> + * hv_do_fast_hypercall16 -- Invoke the specified hypercall
>> + * with arguments in registers instead of physical memory.
>> + * Avoids the overhead of virt_to_phys for simple hypercalls.
>> + */
>> +u64 hv_do_fast_hypercall16(u16 code, u64 input1, u64 input2)
>> +{
>> +	struct arm_smccc_res	res;
>> +	u64			control;
>> +
>> +	control = (u64)code | HV_HYPERCALL_FAST_BIT;
>> +
>> +	arm_smccc_1_1_hvc(HV_FUNC_ID, control, input1, input2, &res);
>> +	return res.a0;
>> +}
>> +EXPORT_SYMBOL_GPL(hv_do_fast_hypercall16);
>> +
> 
> I'd like this to have been in arch/arm64/include/asm/mshyperv.h like its x86
> counterpart, but that's just my personal liking of symmetry. I see why it's here
> with its slow and 8-byte brethren.
> 
Good point, I don't see a good reason this can't be in the header.

>>  /*
>>   * Set a single VP register to a 64-bit value.
>>   */
>> diff --git a/arch/arm64/include/asm/mshyperv.h b/arch/arm64/include/asm/mshyperv.h
>> index 2e2f83bafcfb..2a900ba00622 100644
>> --- a/arch/arm64/include/asm/mshyperv.h
>> +++ b/arch/arm64/include/asm/mshyperv.h
>> @@ -40,6 +40,18 @@ static inline u64 hv_get_msr(unsigned int reg)
>>  	return hv_get_vpreg(reg);
>>  }
>>  
>> +/*
>> + * Nested is not supported on arm64
>> + */
>> +static inline void hv_set_non_nested_msr(unsigned int reg, u64 value)
>> +{
>> +	hv_set_msr(reg, value);
>> +}
> 
> empty line preferred here, also reported by checkpatch
> 
Good point, missed that one...

>> +static inline u64 hv_get_non_nested_msr(unsigned int reg)
>> +{
>> +	return hv_get_msr(reg);
>> +}
>> +
>>  /* SMCCC hypercall parameters */
>>  #define HV_SMCCC_FUNC_NUMBER	1
>>  #define HV_FUNC_ID	ARM_SMCCC_CALL_VAL(			\
>> diff --git a/include/asm-generic/mshyperv.h b/include/asm-generic/mshyperv.h
>> index c020d5d0ec2a..258034dfd829 100644
>> --- a/include/asm-generic/mshyperv.h
>> +++ b/include/asm-generic/mshyperv.h
>> @@ -72,6 +72,8 @@ extern void * __percpu *hyperv_pcpu_output_arg;
>>  
>>  extern u64 hv_do_hypercall(u64 control, void *inputaddr, void *outputaddr);
>>  extern u64 hv_do_fast_hypercall8(u16 control, u64 input8);
>> +extern u64 hv_do_fast_hypercall16(u16 control, u64 input1, u64 input2);
>> +
> 
> checkpatch warns against putting externs in header files, and FWIW, if hv_do_fast_hypercall16()
> for arm64 were in arch/arm64/include/asm/mshyperv.h like its x86 counterpart, you probably
> wouldn't need this?
> 
Yes I wondered about that warning. That's true, if I just put it in the arm64 header
then this won't be needed at all, so I might just do that!

>>  bool hv_isolation_type_snp(void);
>>  bool hv_isolation_type_tdx(void);
>>  


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ