[ipxe-devel] [RFC PATCH 4/8] hyperv: recognize OVMF's guest OS id

Roman Kagan rkagan at virtuozzo.com
Mon Jun 11 17:28:19 UTC 2018


OVMF with Hyper-V support sets its own guest OS id.

Recognize it and refuse to bind the vmbus driver in this case.

Signed-off-by: Roman Kagan <rkagan at virtuozzo.com>
---
 src/include/ipxe/hyperv.h            | 4 ++++
 src/arch/x86/drivers/hyperv/hyperv.c | 3 ++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/include/ipxe/hyperv.h b/src/include/ipxe/hyperv.h
index 9b7e54a5..807dca27 100644
--- a/src/include/ipxe/hyperv.h
+++ b/src/include/ipxe/hyperv.h
@@ -44,6 +44,10 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
  */
 #define HV_GUEST_OS_ID_UEFI ( 1ULL << 40 )
 
+/** Guest OS identity for OVMF with Hyper-V/VMBus support
+ */
+#define HV_GUEST_OS_ID_OVMF ( 0x8e00ULL << 48 )
+
 /** Enable hypercall page */
 #define HV_HYPERCALL_ENABLE 0x00000001UL
 
diff --git a/src/arch/x86/drivers/hyperv/hyperv.c b/src/arch/x86/drivers/hyperv/hyperv.c
index 4359362f..0056f5b1 100644
--- a/src/arch/x86/drivers/hyperv/hyperv.c
+++ b/src/arch/x86/drivers/hyperv/hyperv.c
@@ -237,7 +237,8 @@ static int hv_check_uefi ( struct hv_hypervisor *hv ) {
 
 	/* Check for UEFI firmware's guest OS identity */
 	guest_os_id = rdmsr ( HV_X64_MSR_GUEST_OS_ID );
-	if ( guest_os_id == HV_GUEST_OS_ID_UEFI ) {
+	if ( guest_os_id == HV_GUEST_OS_ID_UEFI ||
+	     guest_os_id == HV_GUEST_OS_ID_OVMF ) {
 		DBGC ( hv, "HV %p is owned by UEFI firmware\n", hv );
 		return -ENOTSUP;
 	}
-- 
2.17.1




More information about the ipxe-devel mailing list