All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Worsley <amworsley@gmail.com>
To: Thomas Zimmermann <tzimmermann@suse.de>,
	Javier Martinez Canillas <javierm@redhat.com>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
	dri-devel@lists.freedesktop.org (open list:DRM DRIVER FOR
	FIRMWARE FRAMEBUFFERS), linux-kernel@vger.kernel.org (open list)
Cc: Andrew Worsley <amworsley@gmail.com>
Subject: [PATCH] Fix failure of simpledrm probe when trying to grab FB from the EFI-based Framebuffer
Date: Sat, 11 Nov 2023 15:21:22 +1100	[thread overview]
Message-ID: <20231111042926.52990-2-amworsley@gmail.com> (raw)
In-Reply-To: <20231111042926.52990-1-amworsley@gmail.com>

   The simpledrm.c does not call aperture_remove_conflicting_devices() in it's probe
   function as the drivers/video/aperture.c documentation says it should. Consequently
   it's request for the FB memory fails.

...
[    3.085302] simple-framebuffer bd58dc000.framebuffer: [drm] *ERROR* could not acquire memory range [??? 0xffff6e1d8629d580-0x2a5000001a7 flags 0x0]: -16
[    3.086433] simple-framebuffer: probe of bd58dc000.framebuffer failed with error -16
...

   In my case no driver provided /dev/dri/card0 device is available on boot up and X
   fails to start as per this from X start up log.

...
[     5.616] (WW) Falling back to old probe method for modesetting
[     5.616] (EE) open /dev/dri/card0: No such file or directory
...

   Fault confirmed and fixed on Asahi 6.5.0 kernel with both CONFIG_FB_EFI and
   CONFIG_DRM_SIMPLEDRM config options set.

Signed-off-by: Andrew Worsley <amworsley@gmail.com>
---
 drivers/gpu/drm/tiny/simpledrm.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/gpu/drm/tiny/simpledrm.c b/drivers/gpu/drm/tiny/simpledrm.c
index 5fefc895bca2..e55a536b04cf 100644
--- a/drivers/gpu/drm/tiny/simpledrm.c
+++ b/drivers/gpu/drm/tiny/simpledrm.c
@@ -8,6 +8,7 @@
 #include <linux/platform_device.h>
 #include <linux/pm_domain.h>
 #include <linux/regulator/consumer.h>
+#include <linux/aperture.h>
 
 #include <drm/drm_aperture.h>
 #include <drm/drm_atomic.h>
@@ -828,6 +829,13 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv,
 	if (mem) {
 		void *screen_base;
 
+		ret = aperture_remove_conflicting_devices(mem->start, resource_size(mem),
+			DRIVER_NAME);
+		if (ret) {
+			drm_err(dev, "aperture_remove_conflicting_devices: failed:%d\n",
+			    __func__, ret);
+			return ERR_PTR(ret);
+		}
 		ret = devm_aperture_acquire_from_firmware(dev, mem->start, resource_size(mem));
 		if (ret) {
 			drm_err(dev, "could not acquire memory range %pr: %d\n", mem, ret);
@@ -848,6 +856,13 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv,
 		if (!res)
 			return ERR_PTR(-EINVAL);
 
+		ret = aperture_remove_conflicting_devices(res->start, resource_size(res),
+			DRIVER_NAME);
+		if (ret) {
+			drm_err(dev, "aperture_remove_conflicting_devices: failed:%d\n",
+			    __func__, ret);
+			return ERR_PTR(ret);
+		}
 		ret = devm_aperture_acquire_from_firmware(dev, res->start, resource_size(res));
 		if (ret) {
 			drm_err(dev, "could not acquire memory range %pr: %d\n", res, ret);
-- 
2.42.0


  reply	other threads:[~2023-11-11  4:30 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-11  4:21 Andrew Worsley
2023-11-11  4:21 ` Andrew Worsley [this message]
2023-11-11  8:31   ` [PATCH] Fix failure of simpledrm probe when trying to grab FB from the EFI-based Framebuffer Andrew Worsley
2023-11-11  8:46     ` Javier Martinez Canillas
2023-11-11  9:10     ` Javier Martinez Canillas
2023-11-11 10:21       ` Andrew Worsley
2023-11-11 10:21         ` Andrew Worsley
2023-11-12 10:35         ` Javier Martinez Canillas
2023-11-12 10:35           ` Javier Martinez Canillas
2023-11-12 13:27           ` [PATCH] of/platform: Disable sysfb if a simple-framebuffer node is kernel test robot
2023-11-12 13:27             ` kernel test robot
2023-11-12 14:41           ` kernel test robot
2023-11-12 14:41             ` kernel test robot
2023-11-12 15:49           ` [PATCH] Fix failure of simpledrm probe when trying to grab FB from the EFI-based Framebuffer Javier Martinez Canillas
2023-11-12 15:49             ` Javier Martinez Canillas
2023-11-13  8:39           ` Thomas Zimmermann
2023-11-13  8:39             ` Thomas Zimmermann
2023-11-11  8:22 ` Javier Martinez Canillas

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=20231111042926.52990-2-amworsley@gmail.com \
    --to=amworsley@gmail.com \
    --cc=airlied@gmail.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=javierm@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=tzimmermann@suse.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.