AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: daniel@ffwll.ch, airlied@gmail.com, deller@gmx.de, javierm@redhat.com
Cc: linux-fbdev@vger.kernel.org, intel-gfx@lists.freedesktop.org,
	linux-hyperv@vger.kernel.org, amd-gfx@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org,
	Thomas Zimmermann <tzimmermann@suse.de>,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH 11/18] fbdev/efifb: Do not use struct fb_info.apertures
Date: Mon, 19 Dec 2022 17:05:09 +0100	[thread overview]
Message-ID: <20221219160516.23436-12-tzimmermann@suse.de> (raw)
In-Reply-To: <20221219160516.23436-1-tzimmermann@suse.de>

Acquire ownership of the firmware scanout buffer by calling Linux'
aperture helpers. Remove the use of struct fb_info.apertures and do
not set FBINFO_MISC_FIRMWARE; both of which previously configured
buffer ownership.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/video/fbdev/efifb.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/drivers/video/fbdev/efifb.c b/drivers/video/fbdev/efifb.c
index 694013f62781..a5779fb453a2 100644
--- a/drivers/video/fbdev/efifb.c
+++ b/drivers/video/fbdev/efifb.c
@@ -7,6 +7,7 @@
  *
  */
 
+#include <linux/aperture.h>
 #include <linux/kernel.h>
 #include <linux/efi.h>
 #include <linux/efi-bgrt.h>
@@ -51,6 +52,8 @@ static struct pci_dev *efifb_pci_dev;	/* dev with BAR covering the efifb */
 
 struct efifb_par {
 	u32 pseudo_palette[16];
+	resource_size_t base;
+	resource_size_t size;
 };
 
 static struct fb_var_screeninfo efifb_defined = {
@@ -253,6 +256,8 @@ static inline void efifb_show_boot_graphics(struct fb_info *info) {}
  */
 static void efifb_destroy(struct fb_info *info)
 {
+	struct efifb_par *par = info->par;
+
 	if (efifb_pci_dev)
 		pm_runtime_put(&efifb_pci_dev->dev);
 
@@ -264,8 +269,7 @@ static void efifb_destroy(struct fb_info *info)
 	}
 
 	if (request_mem_succeeded)
-		release_mem_region(info->apertures->ranges[0].base,
-				   info->apertures->ranges[0].size);
+		release_mem_region(par->base, par->size);
 	fb_dealloc_cmap(&info->cmap);
 
 	framebuffer_release(info);
@@ -461,13 +465,8 @@ static int efifb_probe(struct platform_device *dev)
 	par = info->par;
 	info->pseudo_palette = par->pseudo_palette;
 
-	info->apertures = alloc_apertures(1);
-	if (!info->apertures) {
-		err = -ENOMEM;
-		goto err_release_fb;
-	}
-	info->apertures->ranges[0].base = efifb_fix.smem_start;
-	info->apertures->ranges[0].size = size_remap;
+	par->base = efifb_fix.smem_start;
+	par->size = size_remap;
 
 	if (efi_enabled(EFI_MEMMAP) &&
 	    !efi_mem_desc_lookup(efifb_fix.smem_start, &md)) {
@@ -556,7 +555,7 @@ static int efifb_probe(struct platform_device *dev)
 	info->fbops = &efifb_ops;
 	info->var = efifb_defined;
 	info->fix = efifb_fix;
-	info->flags = FBINFO_FLAG_DEFAULT | FBINFO_MISC_FIRMWARE;
+	info->flags = FBINFO_FLAG_DEFAULT;
 
 	orientation = drm_get_panel_orientation_quirk(efifb_defined.xres,
 						      efifb_defined.yres);
@@ -589,6 +588,11 @@ static int efifb_probe(struct platform_device *dev)
 	if (efifb_pci_dev)
 		WARN_ON(pm_runtime_get_sync(&efifb_pci_dev->dev) < 0);
 
+	err = devm_aperture_acquire_for_platform_device(dev, par->base, par->size);
+	if (err) {
+		pr_err("efifb: cannot acquire aperture\n");
+		goto err_put_rpm_ref;
+	}
 	err = register_framebuffer(info);
 	if (err < 0) {
 		pr_err("efifb: cannot register framebuffer\n");
-- 
2.39.0


  parent reply	other threads:[~2022-12-19 16:06 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-19 16:04 [PATCH 00/18] drm, fbdev: Remove apertures structure and FBINFO_MISC_FIRMWARE Thomas Zimmermann
2022-12-19 16:04 ` [PATCH 01/18] fbcon: Remove trailing whitespaces Thomas Zimmermann
2022-12-20  9:10   ` Javier Martinez Canillas
2022-12-19 16:05 ` [PATCH 02/18] Revert "fbcon: don't lose the console font across generic->chip driver switch" Thomas Zimmermann
2022-12-20  9:17   ` Javier Martinez Canillas
2022-12-19 16:05 ` [PATCH 03/18] drm/gma500: Do not set struct fb_info.apertures Thomas Zimmermann
2022-12-20  9:18   ` Javier Martinez Canillas
2022-12-19 16:05 ` [PATCH 04/18] drm/i915: " Thomas Zimmermann
2022-12-20  9:19   ` Javier Martinez Canillas
2022-12-19 16:05 ` [PATCH 05/18] drm/radeon: " Thomas Zimmermann
2022-12-20  9:19   ` Javier Martinez Canillas
2022-12-19 16:05 ` [PATCH 06/18] drm/fb-helper: Do not allocate unused apertures structure Thomas Zimmermann
2022-12-20  9:22   ` Javier Martinez Canillas
2022-12-19 16:05 ` [PATCH 07/18] fbdev/clps711x-fb: Do not set struct fb_info.apertures Thomas Zimmermann
2022-12-20  9:24   ` Javier Martinez Canillas
2022-12-19 16:05 ` [PATCH 08/18] fbdev/hyperv-fb: " Thomas Zimmermann
2022-12-20  9:24   ` Javier Martinez Canillas
2022-12-29 15:57   ` Michael Kelley (LINUX)
2022-12-19 16:05 ` [PATCH 09/18] vfio-mdev/mdpy-fb: " Thomas Zimmermann
2022-12-20  9:32   ` Javier Martinez Canillas
2023-01-03 13:54     ` Thomas Zimmermann
2022-12-19 16:05 ` [PATCH 10/18] fbdev/efifb: Add struct efifb_par for driver data Thomas Zimmermann
2022-12-20  9:33   ` Javier Martinez Canillas
2022-12-19 16:05 ` Thomas Zimmermann [this message]
2022-12-20  9:35   ` [PATCH 11/18] fbdev/efifb: Do not use struct fb_info.apertures Javier Martinez Canillas
2022-12-19 16:05 ` [PATCH 12/18] fbdev/offb: Allocate struct offb_par with framebuffer_alloc() Thomas Zimmermann
2022-12-20  9:37   ` Javier Martinez Canillas
2022-12-19 16:05 ` [PATCH 13/18] fbdev/offb: Do not use struct fb_info.apertures Thomas Zimmermann
2022-12-20  9:38   ` Javier Martinez Canillas
2022-12-19 16:05 ` [PATCH 14/18] fbdev/simplefb: " Thomas Zimmermann
2022-12-20  9:40   ` Javier Martinez Canillas
2022-12-19 16:05 ` [PATCH 15/18] fbdev/vesafb: Remove trailing whitespaces Thomas Zimmermann
2022-12-20  9:40   ` Javier Martinez Canillas
2022-12-19 16:05 ` [PATCH 16/18] fbdev/vesafb: Do not use struct fb_info.apertures Thomas Zimmermann
2022-12-20  9:43   ` Javier Martinez Canillas
2022-12-19 16:05 ` [PATCH 17/18] fbdev/vga16fb: " Thomas Zimmermann
2022-12-20  9:44   ` Javier Martinez Canillas
2022-12-19 16:05 ` [PATCH 18/18] drm/fbdev: Remove aperture handling and FBINFO_MISC_FIRMWARE Thomas Zimmermann
2022-12-20  9:46   ` 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=20221219160516.23436-12-tzimmermann@suse.de \
    --to=tzimmermann@suse.de \
    --cc=airlied@gmail.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=daniel@ffwll.ch \
    --cc=deller@gmx.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=javierm@redhat.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-hyperv@vger.kernel.org \
    /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