[PATCH] video/aperture: match the pci device when calling sysfb_disable()
Thomas Zimmermann
tzimmermann at suse.de
Mon Aug 19 15:14:31 UTC 2024
Am 19.08.24 um 10:04 schrieb Thomas Zimmermann:
> Hi
>
> Am 16.08.24 um 22:57 schrieb Alex Deucher:
>> On Mon, Aug 12, 2024 at 8:10 AM Thomas Zimmermann
>> <tzimmermann at suse.de> wrote:
>>> Hi
>>>
>>> Am 10.08.24 um 13:44 schrieb kernel test robot:
>>>> Hi Alex,
>>>>
>>>> kernel test robot noticed the following build errors:
>>>>
>>>> [auto build test ERROR on drm-misc/drm-misc-next]
>>>> [also build test ERROR on linus/master v6.11-rc2 next-20240809]
>>>> [If your patch is applied to the wrong git tree, kindly drop us a
>>>> note.
>>>> And when submitting patch, we suggest to use '--base' as documented in
>>>> https://git-scm.com/docs/git-format-patch#_base_tree_information]
>>>>
>>>> url:
>>>> https://github.com/intel-lab-lkp/linux/commits/Alex-Deucher/video-aperture-match-the-pci-device-when-calling-sysfb_disable/20240810-021357
>>>> base: git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
>>>> patch link:
>>>> https://lore.kernel.org/r/20240809150327.2485848-1-alexander.deucher%40amd.com
>>>> patch subject: [PATCH] video/aperture: match the pci device when
>>>> calling sysfb_disable()
>>>> config: csky-randconfig-001-20240810
>>>> (https://download.01.org/0day-ci/archive/20240810/202408101951.tXyqYOzv-lkp@intel.com/config)
>>>> compiler: csky-linux-gcc (GCC) 14.1.0
>>>> reproduce (this is a W=1 build):
>>>> (https://download.01.org/0day-ci/archive/20240810/202408101951.tXyqYOzv-lkp@intel.com/reproduce)
>>>>
>>>> If you fix the issue in a separate patch/commit (i.e. not just a
>>>> new version of
>>>> the same patch/commit), kindly add following tags
>>>> | Reported-by: kernel test robot <lkp at intel.com>
>>>> | Closes:
>>>> https://lore.kernel.org/oe-kbuild-all/202408101951.tXyqYOzv-lkp@intel.com/
>>>>
>>>> All errors (new ones prefixed by >>):
>>>>
>>>> csky-linux-ld: drivers/video/aperture.o: in function
>>>> `aperture_remove_conflicting_pci_devices':
>>>>>> aperture.c:(.text+0x222): undefined reference to
>>>>>> `screen_info_pci_dev'
>>> Strange. There's a already placeholder [1] for architectures without
>>> PCI. Otherwise the source file is listed at [2].
>> So I dug into this, and the problem seems to be that
>> CONFIG_SCREEN_INFO is not defined in that config. I can't figure out
>> how this should work in that case or why this is not a problem in
>> drivers/firmware/sysfb.c.
>>
>> Something like this works:
>> diff --git a/drivers/video/aperture.c b/drivers/video/aperture.c
>> index 56a5a0bc2b1af..50e98210c9fe5 100644
>> --- a/drivers/video/aperture.c
>> +++ b/drivers/video/aperture.c
>> @@ -347,7 +347,9 @@ EXPORT_SYMBOL(__aperture_remove_legacy_vga_devices);
>> */
>> int aperture_remove_conflicting_pci_devices(struct pci_dev *pdev,
>> const char *name)
>> {
>> +#if defined(CONFIG_SCREEN_INFO)
>> struct screen_info *si = &screen_info;
>> +#endif
>> bool primary = false;
>> resource_size_t base, size;
>> int bar, ret = 0;
>> @@ -355,8 +357,10 @@ int
>> aperture_remove_conflicting_pci_devices(struct pci_dev *pdev, const
>> char *na
>> if (pdev == vga_default_device())
>> primary = true;
>>
>> +#if defined(CONFIG_SCREEN_INFO)
>> if (pdev == screen_info_pci_dev(si))
>> sysfb_disable();
>> +#endif
>>
>> for (bar = 0; bar < PCI_STD_NUM_BARS; ++bar) {
>> if (!(pci_resource_flags(pdev, bar) & IORESOURCE_MEM))
>>
>> But that can't be the right fix... Any ideas?
>
> Thanks for investigating. I'd say we should pass the device
> (pdev->dev) to sysfb_disable() and do the test there. In sysfb.c,
> next to sysfb_disable(), you'll find sysfb_parent_dev(), which gives
> the Linux device of the screen_info.
>
> The code then looks something like this:
>
> sysfb_disable(struct device *dev)
> {
> if (dev && dev == sysfb_parent_dev(screen_info))
s/==/!=
> return
>
> /* else do the current code */
> }
>
> there's an invocation of sysfb_disable() in drivers/of/platform.c
> where you can pass NULL.
>
> Best regards
> Thomas
>
>>
>> Alex
>>
>>> [1]
>>> https://elixir.bootlin.com/linux/v6.10/source/include/linux/screen_info.h#L127
>>>
>>> [2]
>>> https://elixir.bootlin.com/linux/v6.10/source/drivers/video/Makefile#L11
>>>
>>>
>>> Best regards
>>> Thomas
>>>
>>>> csky-linux-ld: drivers/video/aperture.o: in function
>>>> `devm_aperture_acquire_release':
>>>>>> aperture.c:(.text+0x2c0): undefined reference to `screen_info'
>>>>>> csky-linux-ld: aperture.c:(.text+0x2c4): undefined reference to
>>>>>> `screen_info_pci_dev'
>>> --
>>> --
>>> Thomas Zimmermann
>>> Graphics Driver Developer
>>> SUSE Software Solutions Germany GmbH
>>> Frankenstrasse 146, 90461 Nuernberg, Germany
>>> GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
>>> HRB 36809 (AG Nuernberg)
>>>
>
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)
More information about the dri-devel
mailing list