FreeBSD Bugzilla – Attachment 216621 Details for
Bug 222996
FreeBSD 11.1-12 on Hyper-V with PCI Express Pass Through
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch to reservice mmio space for frame buffer on Gen2 Hyper-V
fb_reserve_072120.patch (text/plain), 2.65 KB, created by
Wei Hu
on 2020-07-21 07:22:28 UTC
(
hide
)
Description:
Patch to reservice mmio space for frame buffer on Gen2 Hyper-V
Filename:
MIME Type:
Creator:
Wei Hu
Created:
2020-07-21 07:22:28 UTC
Size:
2.65 KB
patch
obsolete
>Index: dev/hyperv/vmbus/vmbus.c >=================================================================== >diff --git a/head/sys/dev/hyperv/vmbus/vmbus.c b/head/sys/dev/hyperv/vmbus/vmbus.c >--- a/head/sys/dev/hyperv/vmbus/vmbus.c (revision 361362) >+++ b/head/sys/dev/hyperv/vmbus/vmbus.c (working copy) >@@ -35,6 +35,7 @@ > #include <sys/param.h> > #include <sys/bus.h> > #include <sys/kernel.h> >+#include <sys/linker.h> > #include <sys/lock.h> > #include <sys/malloc.h> > #include <sys/module.h> >@@ -46,6 +47,7 @@ > > #include <machine/bus.h> > #include <machine/intr_machdep.h> >+#include <machine/metadata.h> > #include <machine/md_var.h> > #include <machine/resource.h> > #include <x86/include/apicvar.h> >@@ -1332,12 +1334,66 @@ > vmbus_get_mmio_res_pass(dev, parse_32); > } > >+/* >+ * On Gen2 VMs, Hyper-V provides mmio space for framebuffer. >+ * This mmio address range is not useable for other PCI devices. >+ * Currently only efifb driver is using this range without reserving >+ * it from system. >+ * Therefore, vmbus driver reserves it before any other PCI devices >+ * drivers start to request mmio addresses. >+ */ >+static struct resource *hv_fb_res; >+ > static void >+vmbus_fb_mmio_res(device_t dev) >+{ >+ struct efi_fb *efifb; >+ caddr_t kmdp; >+ >+ struct vmbus_softc *sc = device_get_softc(dev); >+ int rid = 0; >+ >+ kmdp = preload_search_by_type("elf kernel"); >+ if (kmdp == NULL) >+ kmdp = preload_search_by_type("elf64 kernel"); >+ efifb = (struct efi_fb *)preload_search_info(kmdp, >+ MODINFO_METADATA | MODINFOMD_EFI_FB); >+ if (efifb == NULL) { >+ if (bootverbose) >+ device_printf(dev, >+ "fb has no preloaded kernel efi information\n"); >+ /* We are on Gen1 VM, just return. */ >+ return; >+ } else { >+ if (bootverbose) >+ device_printf(dev, >+ "efifb: fb_addr: %#jx, size: %#jx, " >+ "actual size needed: 0x%x\n", >+ efifb->fb_addr, efifb->fb_size, >+ (int) efifb->fb_height * efifb->fb_width); >+ } >+ >+ hv_fb_res = pcib_host_res_alloc(&sc->vmbus_mmio_res, dev, >+ SYS_RES_MEMORY, &rid, >+ efifb->fb_addr, efifb->fb_addr + efifb->fb_size, efifb->fb_size, >+ RF_ACTIVE | rman_make_alignment_flags(PAGE_SIZE)); >+ >+ if (hv_fb_res && bootverbose) >+ device_printf(dev, >+ "successfully reserved memory for framebuffer " >+ "starting at %#jx, size %#jx\n", >+ efifb->fb_addr, efifb->fb_size); >+} >+ >+static void > vmbus_free_mmio_res(device_t dev) > { > struct vmbus_softc *sc = device_get_softc(dev); > > pcib_host_res_free(dev, &sc->vmbus_mmio_res); >+ >+ if (hv_fb_res) >+ hv_fb_res = NULL; > } > #endif /* NEW_PCIB */ > >@@ -1387,6 +1443,7 @@ > > #ifdef NEW_PCIB > vmbus_get_mmio_res(sc->vmbus_dev); >+ vmbus_fb_mmio_res(sc->vmbus_dev); > #endif > > sc->vmbus_flags |= VMBUS_FLAG_ATTACHED;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 222996
:
187158
|
194707
|
216006
|
216007
|
216468
| 216621 |
223208
|
223209
|
223210
|
223211
|
223225
|
223226
|
223227