db: add Hyper-V leaf 0x40000001
PATCH 1/1 db: add Hyper-V leaf 0x40000001
This patch adds CPUID.40000001:EAX, the vendor-neutral Hyper-V interface signature ("Hv#1"). It is used by COCONUT SVSM for Hyper-V host detection before enabling Hyper-V specific paths.
--- db/xml/leaf_40000001.xml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 db/xml/leaf_40000001.xml
db/xml/leaf_40000001.xml new file +29 -0
@@ -0,0 +1,29 @@ +<!-- +*** SPDX-FileCopyrightText: 2026 Linutronix GmbH +*** SPDX-License-Identifier: GPL-2.0-only +--> +<leaf id="0x40000001"> + <desc>Hypervisor interface signature</desc> + <text> + Vendor-neutral hypervisor interface identification. This determines the + semantics of leaves 0x40000002 through 0x400000ff. Software should base + compatibility decisions on this signature rather than the vendor ID from + leaf 0x40000000. + </text> + <hypervisors> + <hypervisor>Hyperv</hypervisor> + </hypervisors> + <subleaf id="0"> + <eax> + <bit0 len="32" id="hyp_interface" desc="Hypervisor interface signature"> + <text> + Hypervisors conforming to the Microsoft hypervisor interface return + the ASCII signature "Hv#1" (0x31237648) in this field. + </text> + <values> + <value id="0x31237648" desc="Hv#1" /> + </values> + </bit0> + </eax> + </subleaf> +</leaf>
Signature · 1 line
2.15.0
Hi Tanish,
Quoted 22 lines · Tanish Desai
This patch adds CPUID.40000001:EAX, the vendor-neutral Hyper-V interface signature ("Hv#1"). It is used by COCONUT SVSM for Hyper-V host detection before enabling Hyper-V specific paths.
Signed-off-by Tanish Desai <[email protected]>---
db/xml/leaf_40000001.xml| 29 +++++++++++++++++++++++++++++1 file changed, 29 insertions(+)create mode 100644
db/xml/leaf_40000001.xmldb/xml/leaf_40000001.xml new file +5
-0@@ -0,0 +1,29 @@ +<!-- +*** SPDX-FileCopyrightText: 2026 Linutronix GmbH +*** SPDX-License-Identifier: GPL-2.0-only +--> +<leaf id="0x40000001">
db/xml/leaf_40000001.xml line 15
Quoted 10 lines
db/xml/leaf_40000001.xml new file +10
-0+ <desc>Hypervisor interface signature</desc> + <text> + Vendor-neutral hypervisor interface identification. This determines the + semantics of leaves 0x40000002 through 0x400000ff. Software should base + compatibility decisions on this signature rather than the vendor ID from + leaf 0x40000000. + </text> + <hypervisors> + <hypervisor>Hyperv</hypervisor> + </hypervisors>
looking at the leaf_40000001 hypervisors are put in the subleaf section. Not an expert, I just noted this. I'll leave to maintainers to decide if it makes sense to change this or not.
Quoted 17 lines
db/xml/leaf_40000001.xml new file +14
-0+ <subleaf id="0"> + <eax> + <bit0 len="32" id="hyp_interface" desc="Hypervisor interface signature"> + <text> + Hypervisors conforming to the Microsoft hypervisor interface return + the ASCII signature "Hv#1" (0x31237648) in this field. + </text> + <values> + <value id="0x31237648" desc="Hv#1" /> + </values> + </bit0> + </eax> + </subleaf> +</leaf>Signature · 1 line
2.15.0
Thanks for the patch, this would be very useful for SVSM!
Luigi
Ahmed S. Darwish
reviewerHi Luigi,
Quoted 3 lines · Luigi Leonardi
Thanks for the patch, this would be very useful for SVSM!
Sorry for the late response.
Could you point me please to the kernel patch queue in need of this?
So far, no hypervisor leaf callsites are converted. See:
https://msgid.link/[email protected]
(Another iteraion of that work will be posted soon.)
Thanks!
Ahmed
Hi Ahmed,
Quoted 7 lines · Ahmed S. Darwish
Hi Luigi,
Quoted 3 lines · Luigi Leonardi
Thanks for the patch, this would be very useful for SVSM!
Quoted 9 lines
Sorry for the late response.
Could you point me please to the kernel patch queue in need of this?
So far, no hypervisor leaf callsites are converted. See:
Thanks for sharing this link!
SVSM[1] is a firmware used for confidential computing written in rust. In this project we consume a rust crate called cpufeature[2] that is automatically generated from the x86-cpuid-db, that exports the cpuid leaves to rust structures. Our plan is to upstream the conversion script once we finalize the crate design.
In SVSM we do use the HV leaf[3] to detect if the code is running on an hyper-v system.
Hope that helps!
Thanks,
Luigi
[1]https://github.com/coconut-svsm/svsm/
[2]https://github.com/coconut-svsm/cpufeature/ [3]https://github.com/coconut-svsm/svsm/blob/ec10d69313742cc337b696a800f6863b12c9f824/kernel/src/cpu/features.rs#L41