[08/11] fbdev/hyperv: use pci aperture helpers

Message ID 20230111154112.90575-8-daniel.vetter@ffwll.ch
State New
Headers
Series [01/11] drm/ast: Use drm_aperture_remove_conflicting_pci_framebuffers |

Commit Message

Daniel Vetter Jan. 11, 2023, 3:41 p.m. UTC
  Again this just gets setting the primary parameter right, which might
help in some case (but then I guess the hyperv display isn't vga
compatible, I have no idea). It's more consistent for sure.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Wei Liu <wei.liu@kernel.org>
Cc: Dexuan Cui <decui@microsoft.com>
Cc: linux-hyperv@vger.kernel.org
---
 drivers/video/fbdev/hyperv_fb.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
  

Comments

Dexuan Cui Jan. 17, 2023, 6:42 p.m. UTC | #1
> From: Daniel Vetter <daniel.vetter@ffwll.ch>
> Sent: Wednesday, January 11, 2023 7:41 AM
> [...]
> diff --git a/drivers/video/fbdev/hyperv_fb.c
> b/drivers/video/fbdev/hyperv_fb.c
> @@ -1076,9 +1076,7 @@ static int hvfb_getmem(struct hv_device *hdev,
> struct fb_info *info)
>         info->screen_size = dio_fb_size;
> 
>  getmem_done:
> -
> aperture_remove_conflicting_devices(info->apertures->ranges[0].base,
> -
> info->apertures->ranges[0].size,
> -                                           false,
> KBUILD_MODNAME);
> +       aperture_remove_conflicting_pci_devices(pdev,
> KBUILD_MODNAME);

NACK. I think the patch breaks Gen-2 VMs, because 'pdev' is NULL in a
Gen-2 VM.

A VM running on Hyper-V can be Gen-1 or Gen-2: see
https://learn.microsoft.com/en-us/windows-server/virtualization/hyper-v/plan/should-i-create-a-generation-1-or-2-virtual-machine-in-hyper-v

A Gen-2 VM doesn't have the legacy PCI Bus, and doesn't have a legacy
PCI VGA adapter device, so the 'pdev' is NULL here.

> 
>         if (gen2vm) {
>                 /* framebuffer is reallocated, clear screen_info to avoid
> misuse from kexec */
  

Patch

diff --git a/drivers/video/fbdev/hyperv_fb.c b/drivers/video/fbdev/hyperv_fb.c
index fdbf02b42723..1067a64bbdf3 100644
--- a/drivers/video/fbdev/hyperv_fb.c
+++ b/drivers/video/fbdev/hyperv_fb.c
@@ -1076,9 +1076,7 @@  static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info)
 	info->screen_size = dio_fb_size;
 
 getmem_done:
-	aperture_remove_conflicting_devices(info->apertures->ranges[0].base,
-					    info->apertures->ranges[0].size,
-					    false, KBUILD_MODNAME);
+	aperture_remove_conflicting_pci_devices(pdev, KBUILD_MODNAME);
 
 	if (gen2vm) {
 		/* framebuffer is reallocated, clear screen_info to avoid misuse from kexec */