linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: Javier Martinez Canillas <javierm@redhat.com>,
	deller@gmx.de, daniel@ffwll.ch, sam@ravnborg.org,
	maxime@cerno.tech
Cc: linux-fbdev@vger.kernel.org, linux-staging@lists.linux.dev,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 05/11] fbdev: Convert drivers to aperture helpers
Date: Fri, 15 Jul 2022 13:48:34 +0200	[thread overview]
Message-ID: <558097f5-95bc-fa3c-d08e-1ca0a4d6eec2@suse.de> (raw)
In-Reply-To: <8ebc1f33-f654-6b93-8a41-1aa66ab1901c@redhat.com>


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

Hi

Am 11.07.22 um 13:01 schrieb Javier Martinez Canillas:
> On 7/7/22 17:39, Thomas Zimmermann wrote:
>> Convert fbdev drivers from fbdev's remove_conflicting_framebuffers() to
>> the framework-independent aperture_remove_conflicting_devices(). Calling
>> this function will also remove conflicting DRM drivers.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> ---
> 
> [...]
> 
>>   static int lynxfb_kick_out_firmware_fb(struct pci_dev *pdev)
>>   {
>> -	struct apertures_struct *ap;
>> +	resource_size_t base = pci_resource_start(pdev, 0);
>> +	resource_size_t size = pci_resource_len(pdev, 0);
>>   	bool primary = false;
>>   
>> -	ap = alloc_apertures(1);
>> -	if (!ap)
>> -		return -ENOMEM;
>> -
>> -	ap->ranges[0].base = pci_resource_start(pdev, 0);
>> -	ap->ranges[0].size = pci_resource_len(pdev, 0);
>>   #ifdef CONFIG_X86
>>   	primary = pdev->resource[PCI_ROM_RESOURCE].flags &
>>   					IORESOURCE_ROM_SHADOW;
>>   #endif
>> -	remove_conflicting_framebuffers(ap, "sm750_fb1", primary);
>> -	kfree(ap);
>> -	return 0;
>> +
>> +	return aperture_remove_conflicting_devices(base, size, primary, "sm750_fb1");
> 
> Do you know why this can't just use aperture_remove_conflicting_pci_devices() ?

I simply don't want change too much at once, because there was this 
problem with the PCI helper on ast.

At some point we can make a push to really fix this throughout the code 
base. And that would include an update to fb_is_primary_device(), [1] 
which doesn't fill well into the new interfaces.

Best regards
Thomas

[1] 
https://elixir.bootlin.com/linux/latest/source/arch/x86/video/fbdev.c#L14

> 
> It seems that the driver is open coding part of the logic already in that helper.
> For example, figuring out if is a primary by checking the IORESOURCE_ROM_SHADOW
> flag in the PCI_ROM_RESOURCE.
> 
> But also getting the base and size for PCI BAR 0, since the loop in that helper
> would already take care of that (it also starts at BAR 0).
> 
>>   }
>>   
>>   static int lynxfb_pci_probe(struct pci_dev *pdev,
>> diff --git a/drivers/video/fbdev/aty/radeon_base.c b/drivers/video/fbdev/aty/radeon_base.c
>> index b311c07fe66d..e5e362b8c9da 100644
>> --- a/drivers/video/fbdev/aty/radeon_base.c
>> +++ b/drivers/video/fbdev/aty/radeon_base.c
>> @@ -54,6 +54,7 @@
>>   
>>   #include "radeonfb.h"
>>   
>> +#include <linux/aperture.h>
>>   #include <linux/module.h>
>>   #include <linux/moduleparam.h>
>>   #include <linux/kernel.h>
>> @@ -2239,20 +2240,10 @@ static const struct bin_attribute edid2_attr = {
>>   
>>   static int radeon_kick_out_firmware_fb(struct pci_dev *pdev)
>>   {
>> -	struct apertures_struct *ap;
>> +	resource_size_t base = pci_resource_start(pdev, 0);
>> +	resource_size_t size = pci_resource_len(pdev, 0);
>>   
>> -	ap = alloc_apertures(1);
>> -	if (!ap)
>> -		return -ENOMEM;
>> -
>> -	ap->ranges[0].base = pci_resource_start(pdev, 0);
>> -	ap->ranges[0].size = pci_resource_len(pdev, 0);
>> -
>> -	remove_conflicting_framebuffers(ap, KBUILD_MODNAME, false);
>> -
>> -	kfree(ap);
>> -
>> -	return 0;
>> +	return aperture_remove_conflicting_devices(base, size, KBUILD_MODNAME, false);
> 
> Same for this.
> 

-- 
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 --]

  reply	other threads:[~2022-07-15 11:48 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-07 15:39 [PATCH 00/11] fbdev: Maintain device ownership with aperture helpers Thomas Zimmermann
2022-07-07 15:39 ` [PATCH 02/11] fbdev/vga16fb: Create EGA/VGA devices in sysfb code Thomas Zimmermann
2022-07-08 13:09   ` Javier Martinez Canillas
2022-07-11  7:58     ` Thomas Zimmermann
2022-07-11  9:54       ` Javier Martinez Canillas
2022-07-11 10:42         ` Thomas Zimmermann
2022-07-11 10:50           ` Javier Martinez Canillas
2022-07-07 15:39 ` [PATCH 03/11] fbdev/vga16fb: Auto-generate module init/exit code Thomas Zimmermann
2022-07-08 13:16   ` Javier Martinez Canillas
2022-07-11  8:01     ` Thomas Zimmermann
2022-07-11  9:55       ` Javier Martinez Canillas
2022-07-07 15:39 ` [PATCH 04/11] fbdev/core: Remove remove_conflicting_pci_framebuffers() Thomas Zimmermann
2022-07-11 10:51   ` Javier Martinez Canillas
2022-07-07 15:39 ` [PATCH 05/11] fbdev: Convert drivers to aperture helpers Thomas Zimmermann
2022-07-11 11:01   ` Javier Martinez Canillas
2022-07-15 11:48     ` Thomas Zimmermann [this message]
2022-07-15 11:56       ` Javier Martinez Canillas
2022-07-07 15:39 ` [PATCH 06/11] fbdev: Remove conflicting devices on PCI bus Thomas Zimmermann
2022-07-11 11:13   ` Javier Martinez Canillas
2022-07-15 11:52     ` Thomas Zimmermann
2022-07-07 15:39 ` [PATCH 07/11] video/aperture: Disable and unregister sysfb devices via aperture helpers Thomas Zimmermann
2022-07-11 11:16   ` Javier Martinez Canillas
2022-07-07 15:39 ` [PATCH 08/11] video: Provide constants for VGA I/O range Thomas Zimmermann
2022-07-11 11:21   ` Javier Martinez Canillas
2022-07-07 15:39 ` [PATCH 09/11] video/aperture: Remove conflicting VGA devices, if any Thomas Zimmermann
2022-07-11 11:24   ` Javier Martinez Canillas
2022-07-07 15:39 ` [PATCH 10/11] fbdev: Acquire framebuffer apertures for firmware devices Thomas Zimmermann
2022-07-11 11:29   ` Javier Martinez Canillas
2022-07-15 11:58     ` Thomas Zimmermann
2022-07-07 15:39 ` [PATCH 11/11] fbdev: Remove conflict-handling code Thomas Zimmermann
2022-07-11 11:33   ` Javier Martinez Canillas
     [not found] ` <20220707153952.32264-2-tzimmermann@suse.de>
2022-07-08 12:49   ` [PATCH 01/11] fbdev: Remove trailing whitespaces 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=558097f5-95bc-fa3c-d08e-1ca0a4d6eec2@suse.de \
    --to=tzimmermann@suse.de \
    --cc=daniel@ffwll.ch \
    --cc=deller@gmx.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=javierm@redhat.com \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=maxime@cerno.tech \
    --cc=sam@ravnborg.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;
as well as URLs for NNTP newsgroup(s).