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: <1b14e3de-4d3e-420c-819c-31ffb2d448bd@app.fastmail.com>
Date: Wed, 12 Feb 2025 07:54:47 +0100
From: "Arnd Bergmann" <arnd@...db.de>
To: "Roman Kisel" <romank@...ux.microsoft.com>, bhelgaas@...gle.com,
 "Borislav Petkov" <bp@...en8.de>,
 "Catalin Marinas" <catalin.marinas@....com>,
 "Conor Dooley" <conor+dt@...nel.org>,
 "Dave Hansen" <dave.hansen@...ux.intel.com>,
 "Dexuan Cui" <decui@...rosoft.com>,
 "Haiyang Zhang" <haiyangz@...rosoft.com>,
 "H. Peter Anvin" <hpa@...or.com>, krzk+dt@...nel.org,
 Krzysztof WilczyƄski <kw@...ux.com>,
 "K. Y. Srinivasan" <kys@...rosoft.com>,
 "Lorenzo Pieralisi" <lpieralisi@...nel.org>,
 "Manivannan Sadhasivam" <manivannan.sadhasivam@...aro.org>,
 "Ingo Molnar" <mingo@...hat.com>, "Rob Herring" <robh@...nel.org>,
 ssengar@...ux.microsoft.com, "Thomas Gleixner" <tglx@...utronix.de>,
 "Wei Liu" <wei.liu@...nel.org>, "Will Deacon" <will@...nel.org>,
 devicetree@...r.kernel.org, Linux-Arch <linux-arch@...r.kernel.org>,
 linux-arm-kernel@...ts.infradead.org, linux-hyperv@...r.kernel.org,
 linux-kernel@...r.kernel.org, linux-pci@...r.kernel.org, x86@...nel.org
Cc: benhill@...rosoft.com, bperkins@...rosoft.com, sunilmut@...rosoft.com
Subject: Re: [PATCH hyperv-next v4 1/6] arm64: hyperv: Use SMCCC to detect hypervisor
 presence

On Wed, Feb 12, 2025, at 02:43, Roman Kisel wrote:
> +static bool hyperv_detect_via_smccc(void)
> +{
> +	struct arm_smccc_res res = {};
> +
> +	if (arm_smccc_1_1_get_conduit() != SMCCC_CONDUIT_HVC)
> +		return false;
> +	arm_smccc_1_1_hvc(ARM_SMCCC_VENDOR_HYP_CALL_UID_FUNC_ID, &res);
> +	if (res.a0 == SMCCC_RET_NOT_SUPPORTED)
> +		return false;
> +
> +	return res.a0 == ARM_SMCCC_VENDOR_HYP_UID_HYPERV_REG_0 &&
> +		res.a1 == ARM_SMCCC_VENDOR_HYP_UID_HYPERV_REG_1 &&
> +		res.a2 == ARM_SMCCC_VENDOR_HYP_UID_HYPERV_REG_2 &&
> +		res.a3 == ARM_SMCCC_VENDOR_HYP_UID_HYPERV_REG_3;
> +}

I had to double-check that this function is safe to call on
other hypervisors, at least when they follow the smccc spec.

Seeing that we have the same helper function checking for
ARM_SMCCC_VENDOR_HYP_UID_KVM_REG_* and there was another
patch set adding a copy for gunyah, I wonder if we can
put this into a drivers/firmware/smccc/smccc.c directly
the same way we handle soc_id, and make it return a uuid_t,
or perhaps take a constant uuid_t to compare against.

      Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ