mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: Saurabh Sengar <ssengar@linux.microsoft.com>,
	ssengar@microsoft.com, drawat.floss@gmail.com, airlied@linux.ie,
	daniel@ffwll.ch, linux-hyperv@vger.kernel.org,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	mikelley@microsoft.com
Subject: Re: [PATCH] drm/hyperv: Don't rely on screen_info.lfb_base for Gen1 VMs
Date: Sat, 10 Sep 2022 20:11:24 +0200	[thread overview]
Message-ID: <14302178-c797-8635-4325-070f78b7f805@suse.de> (raw)
In-Reply-To: <1662734639-27164-1-git-send-email-ssengar@linux.microsoft.com>


[-- Attachment #1.1: Type: text/plain, Size: 2600 bytes --]

Hi

Am 09.09.22 um 16:43 schrieb Saurabh Sengar:
> hyperv_setup_vram tries to remove conflicting framebuffer based on
> 'screen_info'. As observed in past due to some bug or wrong setting
> in grub, the 'screen_info' fields may not be set for Gen1, and in such
> cases drm_aperture_remove_conflicting_framebuffers will not do anything
> useful.
> For Gen1 VMs, it should always be possible to get framebuffer
> conflict removed using PCI device instead.
> 
> Fixes: a0ab5abced55 ("drm/hyperv : Removing the restruction of VRAM allocation with PCI bar size")
> Signed-off-by: Saurabh Sengar <ssengar@linux.microsoft.com>
> ---
>   drivers/gpu/drm/hyperv/hyperv_drm_drv.c | 24 ++++++++++++++++++++----
>   1 file changed, 20 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/hyperv/hyperv_drm_drv.c b/drivers/gpu/drm/hyperv/hyperv_drm_drv.c
> index 6d11e7938c83..b0cc974efa45 100644
> --- a/drivers/gpu/drm/hyperv/hyperv_drm_drv.c
> +++ b/drivers/gpu/drm/hyperv/hyperv_drm_drv.c
> @@ -73,12 +73,28 @@ static int hyperv_setup_vram(struct hyperv_drm_device *hv,
>   			     struct hv_device *hdev)
>   {
>   	struct drm_device *dev = &hv->dev;
> +	struct pci_dev *pdev;
>   	int ret;
>   
> -	drm_aperture_remove_conflicting_framebuffers(screen_info.lfb_base,
> -						     screen_info.lfb_size,
> -						     false,
> -						     &hyperv_driver);
> +	if (efi_enabled(EFI_BOOT)) {
> +		drm_aperture_remove_conflicting_framebuffers(screen_info.lfb_base,
> +							     screen_info.lfb_size,

Using screen_info here seems wrong in any case. You want to remove the 
framebuffer devices that conflict with your driver, which might be 
unrelated to screen_info. AFAICT the correct solution would always 
retrieve the PCI device for removal (i.e., always do the else branch).

Best regard
Thomas

> +							     false,
> +							     &hyperv_driver);
> +	} else {
> +		pdev = pci_get_device(PCI_VENDOR_ID_MICROSOFT, PCI_DEVICE_ID_HYPERV_VIDEO, NULL);
> +		if (!pdev) {
> +			drm_err(dev, "Unable to find PCI Hyper-V video\n");
> +			return -ENODEV;
> +		}
> +
> +		ret = drm_aperture_remove_conflicting_pci_framebuffers(pdev, &hyperv_driver);
> +		pci_dev_put(pdev);
> +		if (ret) {
> +			drm_err(dev, "Not able to remove boot fb\n");
> +			return ret;
> +		}
> +	}
>   
>   	hv->fb_size = (unsigned long)hv->mmio_megabytes * 1024 * 1024;
>   

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

  parent reply	other threads:[~2022-09-10 18:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-09 14:43 Saurabh Sengar
2022-09-10 15:06 ` Michael Kelley (LINUX)
2022-09-10 18:11 ` Thomas Zimmermann [this message]
2022-09-11 16:21   ` Saurabh Singh Sengar
2022-09-12  7:03     ` Thomas Zimmermann
2022-09-13 15:15       ` Saurabh Singh Sengar
2022-09-13 15:25         ` Thomas Zimmermann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=14302178-c797-8635-4325-070f78b7f805@suse.de \
    --to=tzimmermann@suse.de \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=drawat.floss@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikelley@microsoft.com \
    --cc=ssengar@linux.microsoft.com \
    --cc=ssengar@microsoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®