lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ba544720-3089-75f0-5e0f-32b231c14f11@suse.de>
Date:   Wed, 19 Feb 2020 09:15:43 +0100
From:   Thomas Zimmermann <tzimmermann@...e.de>
To:     Tian Tao <tiantao6@...ilicon.com>, puck.chen@...ilicon.com,
        airlied@...ux.ie, daniel@...ll.ch, kraxel@...hat.com,
        alexander.deucher@....com, tglx@...utronix.de,
        dri-devel@...ts.freedesktop.org, xinliang.liu@...aro.org,
        linux-kernel@...r.kernel.org
Cc:     linuxarm@...wei.com
Subject: Re: [PATCH] drm/hisilicon: Fixed pcie resource conflict between drm
 and firmware

Hi

Am 19.02.20 um 08:57 schrieb Tian Tao:
> remove the framebuffer initialized by fireware/bootloader,which will use
> hibmc's pcie resource, and may cause conflict.
> 
> Signed-off-by: Tian Tao <tiantao6@...ilicon.com>
> Signed-off-by: Gong junjie <gongjunjie2@...wei.com>
> ---
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> index 5f612f6..7ebe831 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> @@ -47,6 +47,22 @@ static irqreturn_t hibmc_drm_interrupt(int irq, void *arg)
>  	return IRQ_HANDLED;
>  }
>  
> +static void hibmc_remove_framebuffers(struct pci_dev *pdev)
> +{
> +	struct apertures_struct *ap;
> +
> +	ap = alloc_apertures(1);
> +	if (!ap)
> +		return;
> +
> +	ap->ranges[0].base = pci_resource_start(pdev, 0);
> +	ap->ranges[0].size = pci_resource_len(pdev, 0);
> +
> +	drm_fb_helper_remove_conflicting_framebuffers(ap, "hibmcdrmfb", false);
> +
> +	kfree(ap);
> +}
> +
>  static struct drm_driver hibmc_driver = {
>  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>  	.fops			= &hibmc_fops,
> @@ -327,6 +343,8 @@ static int hibmc_pci_probe(struct pci_dev *pdev,
>  	struct drm_device *dev;
>  	int ret;
>  
> +	hibmc_remove_framebuffers(pdev);

Instead of rolling your own, you should try
drm_fb_helper_remove_conflicting_pci_framebuffers(). It releases any I/O
memory resource of the device.

Best regards
Thomas

> +
>  	dev = drm_dev_alloc(&hibmc_driver, &pdev->dev);
>  	if (IS_ERR(dev)) {
>  		DRM_ERROR("failed to allocate drm_device\n");
> 

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



Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ