linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jocelyn Falempe <jfalempe@redhat.com>
To: Thomas Zimmermann <tzimmermann@suse.de>,
	zackr@vmware.com, javierm@redhat.com,
	maarten.lankhorst@linux.intel.com, mripard@kernel.org,
	airlied@linux.ie, daniel@ffwll.ch, deller@gmx.de,
	hdegoede@redhat.com
Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 3/5] drm/simpledrm: Request memory region in driver
Date: Mon, 24 Jan 2022 15:23:01 +0100	[thread overview]
Message-ID: <bede759f-23c2-a87e-abde-108196e36fde@redhat.com> (raw)
In-Reply-To: <20220124123659.4692-4-tzimmermann@suse.de>

On 24/01/2022 13:36, Thomas Zimmermann wrote:
> Requesting the framebuffer memory in simpledrm marks the memory
> range as busy. This used to be done by the firmware sysfb code,
> but the driver is the correct place.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>   drivers/gpu/drm/tiny/simpledrm.c | 20 +++++++++++++++-----
>   1 file changed, 15 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/tiny/simpledrm.c b/drivers/gpu/drm/tiny/simpledrm.c
> index 04146da2d1d8..f72b71511a65 100644
> --- a/drivers/gpu/drm/tiny/simpledrm.c
> +++ b/drivers/gpu/drm/tiny/simpledrm.c
> @@ -526,21 +526,31 @@ static int simpledrm_device_init_mm(struct simpledrm_device *sdev)
>   {
>   	struct drm_device *dev = &sdev->dev;
>   	struct platform_device *pdev = sdev->pdev;
> -	struct resource *mem;
> +	struct resource *res, *mem;
>   	void __iomem *screen_base;
>   	int ret;
>   
> -	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	if (!mem)
> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +	if (!res)
>   		return -EINVAL;
>   
> -	ret = devm_aperture_acquire_from_firmware(dev, mem->start, resource_size(mem));
> +	ret = devm_aperture_acquire_from_firmware(dev, res->start, resource_size(res));
>   	if (ret) {
>   		drm_err(dev, "could not acquire memory range %pr: error %d\n",
> -			mem, ret);
> +			res, ret);
>   		return ret;
>   	}
>   
> +	mem = devm_request_mem_region(&pdev->dev, res->start, resource_size(res),
> +				      sdev->dev.driver->name);
> +	if (!mem) {
> +		/*
> +		 * We cannot make this fatal. Sometimes this comes from magic
> +		 * spaces our resource handlers simply don't know about
> +		 */
> +		drm_warn(dev, "could not acquire memory region %pr\n", res);
> +	}
> +
>   	screen_base = devm_ioremap_wc(&pdev->dev, mem->start,
>   				      resource_size(mem));

if mem is NULL, accessing mem->start will segfault after the warning.
I think you renamed "mem" to "res" so probably it should be renamed here 
too ?

>   	if (!screen_base)


  parent reply	other threads:[~2022-01-24 14:23 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-24 12:36 [PATCH 0/5] sysfb: Fix memory-region management Thomas Zimmermann
2022-01-24 12:36 ` [PATCH 1/5] fbdev: Hot-unplug firmware fb devices on forced removal Thomas Zimmermann
2022-01-24 13:52   ` Javier Martinez Canillas
2022-01-24 13:56     ` Javier Martinez Canillas
2022-01-24 14:19     ` Thomas Zimmermann
2022-01-24 14:31       ` Javier Martinez Canillas
2022-01-24 15:59   ` Zack Rusin
2022-01-24 12:36 ` [PATCH 2/5] drivers/firmware: Don't mark as busy the simple-framebuffer IO resource Thomas Zimmermann
2022-01-24 15:59   ` Zack Rusin
2022-01-24 12:36 ` [PATCH 3/5] drm/simpledrm: Request memory region in driver Thomas Zimmermann
2022-01-24 14:00   ` Javier Martinez Canillas
2022-01-24 14:23   ` Jocelyn Falempe [this message]
2022-01-25  8:31     ` Thomas Zimmermann
2022-01-24 12:36 ` [PATCH 4/5] fbdev/simplefb: " Thomas Zimmermann
2022-01-24 14:24   ` Javier Martinez Canillas
2022-01-24 12:36 ` [PATCH 5/5] drm: Add TODO item for requesting memory regions Thomas Zimmermann
2022-01-24 14:25   ` Javier Martinez Canillas
  -- strict thread matches above, loose matches on Subject: below --
2022-01-25  9:12 [PATCH 0/5] sysfb: Fix memory-region management Thomas Zimmermann
2022-01-25  9:12 ` [PATCH 3/5] drm/simpledrm: Request memory region in driver Thomas Zimmermann
2022-01-25 13:41   ` Jocelyn Falempe

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=bede759f-23c2-a87e-abde-108196e36fde@redhat.com \
    --to=jfalempe@redhat.com \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=deller@gmx.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hdegoede@redhat.com \
    --cc=javierm@redhat.com \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=tzimmermann@suse.de \
    --cc=zackr@vmware.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;
as well as URLs for NNTP newsgroup(s).