diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -256,7 +256,8 @@ * Good {morning,afternoon,evening,night}. */ startrtclock(); - printcpuinfo(); + if (!(efi_boot && vm_guest == VM_GUEST_HV)) + printcpuinfo(); /* * Display physical memory if SMBIOS reports reasonable amount. @@ -269,7 +270,8 @@ } if (memsize < ptoa((uintmax_t)vm_free_count())) memsize = ptoa((uintmax_t)Maxmem); - printf("real memory = %ju (%ju MB)\n", memsize, memsize >> 20); + if (!(efi_boot && vm_guest == VM_GUEST_HV)) + printf("real memory = %ju (%ju MB)\n", memsize, memsize >> 20); realmem = atop(memsize); /* @@ -293,9 +295,10 @@ vm_ksubmap_init(&kmi); - printf("avail memory = %ju (%ju MB)\n", - ptoa((uintmax_t)vm_free_count()), - ptoa((uintmax_t)vm_free_count()) / 1048576); + if (!(efi_boot && vm_guest == VM_GUEST_HV)) + printf("avail memory = %ju (%ju MB)\n", + ptoa((uintmax_t)vm_free_count()), + ptoa((uintmax_t)vm_free_count()) / 1048576); #ifdef DEV_PCI if (bootverbose && intel_graphics_stolen_base != 0) printf("intel stolen mem: base %#jx size %ju MB\n", diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -53,6 +53,7 @@ #include #include #include +#include #if defined(__i386__) || defined(__amd64__) #include @@ -1402,6 +1403,15 @@ if (rle->type == SYS_RES_IRQ) continue; + /* + * Don't reserve SYS_RES_MEMORY. Hyper-V ACPI firmware might try to + * allocate a massive range blocking other devices from being able + * to allocate memory later down the road. + */ + if (vm_guest == VM_GUEST_HV && rle->type == SYS_RES_MEMORY) + continue; + + /* * Don't reserve the resource if it is already allocated. * The acpi_ec(4) driver can allocate its resources early diff --git a/sys/dev/acpica/acpi_pxm.c b/sys/dev/acpica/acpi_pxm.c --- a/sys/dev/acpica/acpi_pxm.c +++ b/sys/dev/acpica/acpi_pxm.c @@ -284,15 +284,18 @@ break; cpup = cpu_find(cpu->ApicId); if (cpup != NULL) { - printf("SRAT: Duplicate local APIC ID %u\n", - cpu->ApicId); + if (!(efi_boot && vm_guest == VM_GUEST_HV)) + printf("SRAT: Duplicate local APIC ID %u\n", + cpu->ApicId); *(int *)arg = ENXIO; break; } cpup = cpu_add(cpu->ApicId, domain); - if (cpup == NULL) - printf("SRAT: Ignoring local APIC ID %u (too high)\n", - cpu->ApicId); + if (cpup == NULL) { + if (!(efi_boot && vm_guest == VM_GUEST_HV)) + printf("SRAT: Ignoring local APIC ID %u (too high)\n", + cpu->ApicId); + } break; case ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY: x2apic = (ACPI_SRAT_X2APIC_CPU_AFFINITY *)entry; @@ -306,9 +309,11 @@ KASSERT(cpu_find(x2apic->ApicId) == NULL, ("Duplicate local APIC ID %u", x2apic->ApicId)); cpup = cpu_add(x2apic->ApicId, x2apic->ProximityDomain); - if (cpup == NULL) - printf("SRAT: Ignoring local APIC ID %u (too high)\n", - x2apic->ApicId); + if (cpup == NULL) { + if (!(efi_boot && vm_guest == VM_GUEST_HV)) + printf("SRAT: Ignoring local APIC ID %u (too high)\n", + x2apic->ApicId); + } break; case ACPI_SRAT_TYPE_GICC_AFFINITY: gicc = (ACPI_SRAT_GICC_AFFINITY *)entry; @@ -322,9 +327,11 @@ KASSERT(cpu_find(gicc->AcpiProcessorUid) == NULL, ("Duplicate CPU UID %u", gicc->AcpiProcessorUid)); cpup = cpu_add(gicc->AcpiProcessorUid, gicc->ProximityDomain); - if (cpup == NULL) - printf("SRAT: Ignoring CPU UID %u (too high)\n", - gicc->AcpiProcessorUid); + if (cpup == NULL) { + if (!(efi_boot && vm_guest == VM_GUEST_HV)) + printf("SRAT: Ignoring CPU UID %u (too high)\n", + gicc->AcpiProcessorUid); + } break; case ACPI_SRAT_TYPE_MEMORY_AFFINITY: mem = (ACPI_SRAT_MEM_AFFINITY *)entry; @@ -342,12 +349,14 @@ break; if (base >= maxphyaddr || !overlaps_phys_avail(base, base + length)) { - printf("SRAT: Ignoring memory at addr 0x%jx\n", - (uintmax_t)base); + if (!(efi_boot && vm_guest == VM_GUEST_HV)) + printf("SRAT: Ignoring memory at addr 0x%jx\n", + (uintmax_t)base); break; } if (num_mem == VM_PHYSSEG_MAX) { - printf("SRAT: Too many memory regions\n"); + if (!(efi_boot && vm_guest == VM_GUEST_HV)) + printf("SRAT: Too many memory regions\n"); *(int *)arg = ENXIO; break; } @@ -367,7 +376,8 @@ if (mem_info[i].end <= base) continue; if (mem_info[i].start < base + length) { - printf("SRAT: Overlapping memory entries\n"); + if (!(efi_boot && vm_guest == VM_GUEST_HV)) + printf("SRAT: Overlapping memory entries\n"); *(int *)arg = ENXIO; return; } diff --git a/sys/dev/hyperv/vmbus/hyperv.c b/sys/dev/hyperv/vmbus/hyperv.c --- a/sys/dev/hyperv/vmbus/hyperv.c +++ b/sys/dev/hyperv/vmbus/hyperv.c @@ -38,6 +38,8 @@ #include #include +#include + #include #include #include @@ -166,6 +168,10 @@ */ return (false); } + + if (efi_boot) + return (true); + hyperv_features = regs[0]; hyperv_pm_features = regs[2]; hyperv_features3 = regs[3]; diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c --- a/sys/dev/vt/vt_core.c +++ b/sys/dev/vt/vt_core.c @@ -283,12 +283,14 @@ if (!vty_enabled(VTY_VT)) return; - if (main_vd->vd_driver != NULL) - printf("VT(%s): %s %ux%u\n", main_vd->vd_driver->vd_name, - (main_vd->vd_flags & VDF_TEXTMODE) ? "text" : "resolution", - main_vd->vd_width, main_vd->vd_height); - else - printf("VT: init without driver.\n"); + if (vm_guest != VM_GUEST_HV) { + if (main_vd->vd_driver != NULL) + printf("VT(%s): %s %ux%u\n", main_vd->vd_driver->vd_name, + (main_vd->vd_flags & VDF_TEXTMODE) ? "text" : "resolution", + main_vd->vd_width, main_vd->vd_height); + else + printf("VT: init without driver.\n"); + } mtx_init(&main_vd->vd_lock, "vtdev", NULL, MTX_DEF); cv_init(&main_vd->vd_winswitch, "vtwswt"); @@ -3143,20 +3145,23 @@ if (main_vd->vd_driver == NULL) { main_vd->vd_driver = drv; - printf("VT: initialize with new VT driver \"%s\".\n", - drv->vd_name); + if (vm_guest != VM_GUEST_HV) + printf("VT: initialize with new VT driver \"%s\".\n", + drv->vd_name); } else { /* * Check if have rights to replace current driver. For example: * it is bad idea to replace KMS driver with generic VGA one. */ if (drv->vd_priority <= main_vd->vd_driver->vd_priority) { - printf("VT: Driver priority %d too low. Current %d\n ", - drv->vd_priority, main_vd->vd_driver->vd_priority); + if (vm_guest != VM_GUEST_HV) + printf("VT: Driver priority %d too low. Current %d\n ", + drv->vd_priority, main_vd->vd_driver->vd_priority); return; } - printf("VT: Replacing driver \"%s\" with new \"%s\".\n", - main_vd->vd_driver->vd_name, drv->vd_name); + if (vm_guest != VM_GUEST_HV) + printf("VT: Replacing driver \"%s\" with new \"%s\".\n", + main_vd->vd_driver->vd_name, drv->vd_name); } vt_replace_backend(drv, softc); diff --git a/sys/gdb/gdb_main.c b/sys/gdb/gdb_main.c --- a/sys/gdb/gdb_main.c +++ b/sys/gdb/gdb_main.c @@ -83,19 +83,22 @@ gdb_cur = dp; } } - if (gdb_cur != NULL) { - printf("GDB: debug ports:"); - SET_FOREACH(iter, gdb_dbgport_set) { - dp = *iter; - if (dp->gdb_active == 0) - printf(" %s", dp->gdb_name); - } - printf("\n"); - } else - printf("GDB: no debug ports present\n"); + if (vm_guest != VM_GUEST_HV) { + if (gdb_cur != NULL) { + printf("GDB: debug ports:"); + SET_FOREACH(iter, gdb_dbgport_set) { + dp = *iter; + if (dp->gdb_active == 0) + printf(" %s", dp->gdb_name); + } + printf("\n"); + } else + printf("GDB: no debug ports present\n"); + } if (gdb_cur != NULL) { gdb_cur->gdb_init(); - printf("GDB: current port: %s\n", gdb_cur->gdb_name); + if (vm_guest != VM_GUEST_HV) + printf("GDB: current port: %s\n", gdb_cur->gdb_name); } if (gdb_cur != NULL) { cur_pri = (boothowto & RB_GDB) ? 2 : 0; diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -353,20 +353,23 @@ static void print_caddr_t(void *data) { - printf("%s", (char *)data); + if (vm_guest != VM_GUEST_HV) + printf("%s", (char *)data); } static void print_version(void *data __unused) { - int len; - - /* Strip a trailing newline from version. */ - len = strlen(version); - while (len > 0 && version[len - 1] == '\n') - len--; - printf("%.*s %s\n", len, version, machine); - printf("%s\n", compiler_version); + if (vm_guest != VM_GUEST_HV) { + int len; + + /* Strip a trailing newline from version. */ + len = strlen(version); + while (len > 0 && version[len - 1] == '\n') + len--; + printf("%.*s %s\n", len, version, machine); + printf("%s\n", compiler_version); + } } SYSINIT(announce, SI_SUB_COPYRIGHT, SI_ORDER_FIRST, print_caddr_t, diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c --- a/sys/kern/kern_tc.c +++ b/sys/kern/kern_tc.c @@ -1195,9 +1195,10 @@ printf(" -- Insufficient hz, needs at least %u\n", u); } } else if (tc->tc_quality >= 0 || bootverbose) { - printf("Timecounter \"%s\" frequency %ju Hz quality %d\n", - tc->tc_name, (uintmax_t)tc->tc_frequency, - tc->tc_quality); + if (vm_guest != VM_GUEST_HV) + printf("Timecounter \"%s\" frequency %ju Hz quality %d\n", + tc->tc_name, (uintmax_t)tc->tc_frequency, + tc->tc_quality); } /* diff --git a/sys/kern/subr_kdb.c b/sys/kern/subr_kdb.c --- a/sys/kern/subr_kdb.c +++ b/sys/kern/subr_kdb.c @@ -532,15 +532,17 @@ } } if (kdb_dbbe != NULL) { - printf("KDB: debugger backends:"); - SET_FOREACH(iter, kdb_dbbe_set) { - be = *iter; - if (be->dbbe_active == 0) - printf(" %s", be->dbbe_name); + if (vm_guest != VM_GUEST_HV) { + printf("KDB: debugger backends:"); + SET_FOREACH(iter, kdb_dbbe_set) { + be = *iter; + if (be->dbbe_active == 0) + printf(" %s", be->dbbe_name); + } + printf("\n"); + printf("KDB: current backend: %s\n", + kdb_dbbe->dbbe_name); } - printf("\n"); - printf("KDB: current backend: %s\n", - kdb_dbbe->dbbe_name); } } diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c --- a/sys/kern/subr_prf.c +++ b/sys/kern/subr_prf.c @@ -1049,8 +1049,10 @@ if (msgbufmapped && oldp != msgbufp) msgbuf_copy(oldp, msgbufp); msgbufmapped = true; - if (print_boot_tag && *current_boot_tag != '\0') - printf("%s\n", current_boot_tag); + if (print_boot_tag && *current_boot_tag != '\0') { + if (vm_guest != VM_GUEST_HV) + printf("%s\n", current_boot_tag); + } oldp = msgbufp; } diff --git a/sys/modules/hyperv/Makefile b/sys/modules/hyperv/Makefile --- a/sys/modules/hyperv/Makefile +++ b/sys/modules/hyperv/Makefile @@ -1,5 +1,5 @@ # $FreeBSD$ -SUBDIR = vmbus netvsc storvsc utilities hvsock +SUBDIR = vmbus netvsc storvsc utilities hvsock pcib .include diff --git a/sys/modules/hyperv/pcib/Makefile b/sys/modules/hyperv/pcib/Makefile --- a/sys/modules/hyperv/pcib/Makefile +++ b/sys/modules/hyperv/pcib/Makefile @@ -3,7 +3,7 @@ .PATH: ${SRCTOP}/sys/dev/hyperv/pcib \ ${SRCTOP}/sys/dev/hyperv/vmbus -KMOD= vmbus_pcib +KMOD= hv_vmbus_pcib SRCS= vmbus_pcib.c SRCS+= bus_if.h device_if.h pci_if.h pcib_if.h vmbus_if.h diff --git a/sys/vm/memguard.c b/sys/vm/memguard.c --- a/sys/vm/memguard.c +++ b/sys/vm/memguard.c @@ -215,10 +215,12 @@ PAGE_SIZE, 0, M_WAITOK); memguard_base = base; - printf("MEMGUARD DEBUGGING ALLOCATOR INITIALIZED:\n"); - printf("\tMEMGUARD map base: 0x%lx\n", (u_long)base); - printf("\tMEMGUARD map size: %jd KBytes\n", - (uintmax_t)memguard_mapsize >> 10); + if (vm_guest != VM_GUEST_HV) { + printf("MEMGUARD DEBUGGING ALLOCATOR INITIALIZED:\n"); + printf("\tMEMGUARD map base: 0x%lx\n", (u_long)base); + printf("\tMEMGUARD map size: %jd KBytes\n", + (uintmax_t)memguard_mapsize >> 10); + } } /*