All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v6 0/8] PCI/VGA: introduce is_boot_device function callback to vga_client_register
@ 2023-06-12 19:33 ` Sui Jingfeng
  0 siblings, 0 replies; 10+ messages in thread
From: Sui Jingfeng @ 2023-06-12 19:33 UTC (permalink / raw)
  To: Alex Deucher, Christian Konig, Pan Xinhui, David Airlie,
	Daniel Vetter, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
	Tvrtko Ursulin, Ben Skeggs, Karol Herbst, Lyude Paul,
	Bjorn Helgaas, Alex Williamson, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, Hawking Zhang, Mario Limonciello, Lijo Lazar,
	YiPeng Chai, Andrey Grodzovsky, Somalapuram Amaranath,
	Bokun Zhang, Ville Syrjala, Li Yi, Sui Jingfeng, Jason Gunthorpe,
	Kevin Tian, Cornelia Huck, Yishai Hadas, Abhishek Sahu, Yi Liu
  Cc: amd-gfx, dri-devel, linux-kernel, intel-gfx, nouveau, linux-pci,
	kvm, loongson-kernel

The vga_is_firmware_default() function is arch-dependent, it's probably
wrong if we simply remove the arch guard. As the VRAM BAR which contains
firmware framebuffer may move, while the lfb_base and lfb_size members of
the screen_info does not change accordingly. In short, it should take the
re-allocation of the PCI BAR into consideration.

With the observation that device drivers or video aperture helpers may
have better knowledge about which PCI bar contains the firmware fb,
which could avoid the need to iterate all of the PCI BARs. But as a PCI
function at pci/vgaarb.c, vga_is_firmware_default() is not suitable to
make such an optimization since it is loaded too early.

There are PCI display controllers that don't have a dedicated VRAM bar,
this function will lose its effectiveness in such a case. Luckily, the
device driver can provide an accurate workaround.

Therefore, this patch introduces a callback that allows the device driver
to tell the VGAARB if the device is the default boot device. Also honor
the comment: "Clients have two callback mechanisms they can use"

Sui Jingfeng (8):
  PCI/VGA: Use unsigned type for the io_state variable
  PCI/VGA: Deal only with VGA class devices
  PCI/VGA: Tidy up the code and comment format
  PCI/VGA: Replace full MIT license text with SPDX identifier
  video/aperture: Add a helper to detect if an aperture contains
    firmware FB
  PCI/VGA: Introduce is_boot_device function callback to
    vga_client_register
  drm/amdgpu: Implement the is_boot_device callback function
  drm/radeon: Implement the is_boot_device callback function

 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  12 +-
 drivers/gpu/drm/drm_aperture.c             |  16 +++
 drivers/gpu/drm/i915/display/intel_vga.c   |   3 +-
 drivers/gpu/drm/nouveau/nouveau_vga.c      |   2 +-
 drivers/gpu/drm/radeon/radeon_device.c     |  12 +-
 drivers/pci/vgaarb.c                       | 153 +++++++++++++--------
 drivers/vfio/pci/vfio_pci_core.c           |   2 +-
 drivers/video/aperture.c                   |  29 ++++
 include/drm/drm_aperture.h                 |   2 +
 include/linux/aperture.h                   |   7 +
 include/linux/vgaarb.h                     |  35 ++---
 11 files changed, 184 insertions(+), 89 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v6 0/8] PCI/VGA: introduce is_boot_device function callback to vga_client_register
@ 2023-06-12 19:33 ` Sui Jingfeng
  0 siblings, 0 replies; 10+ messages in thread
From: Sui Jingfeng @ 2023-06-12 19:33 UTC (permalink / raw)
  To: Alex Deucher, Christian Konig, Pan Xinhui, David Airlie,
	Daniel Vetter, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
	Tvrtko Ursulin, Ben Skeggs, Karol Herbst, Lyude Paul,
	Bjorn Helgaas, Alex Williamson, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, Hawking Zhang, Mario Limonciello, Lijo Lazar,
	YiPeng Chai, Andrey Grodzovsky, Somalapuram Amaranath,
	Bokun Zhang, Ville Syrjala, Li Yi, Sui Jingfeng, Jason Gunthorpe,
	Kevin Tian, Cornelia Huck, Yishai Hadas, Abhishek Sahu, Yi Liu
  Cc: kvm, nouveau, intel-gfx, linux-kernel, dri-devel,
	loongson-kernel, amd-gfx, linux-pci

The vga_is_firmware_default() function is arch-dependent, it's probably
wrong if we simply remove the arch guard. As the VRAM BAR which contains
firmware framebuffer may move, while the lfb_base and lfb_size members of
the screen_info does not change accordingly. In short, it should take the
re-allocation of the PCI BAR into consideration.

With the observation that device drivers or video aperture helpers may
have better knowledge about which PCI bar contains the firmware fb,
which could avoid the need to iterate all of the PCI BARs. But as a PCI
function at pci/vgaarb.c, vga_is_firmware_default() is not suitable to
make such an optimization since it is loaded too early.

There are PCI display controllers that don't have a dedicated VRAM bar,
this function will lose its effectiveness in such a case. Luckily, the
device driver can provide an accurate workaround.

Therefore, this patch introduces a callback that allows the device driver
to tell the VGAARB if the device is the default boot device. Also honor
the comment: "Clients have two callback mechanisms they can use"

Sui Jingfeng (8):
  PCI/VGA: Use unsigned type for the io_state variable
  PCI/VGA: Deal only with VGA class devices
  PCI/VGA: Tidy up the code and comment format
  PCI/VGA: Replace full MIT license text with SPDX identifier
  video/aperture: Add a helper to detect if an aperture contains
    firmware FB
  PCI/VGA: Introduce is_boot_device function callback to
    vga_client_register
  drm/amdgpu: Implement the is_boot_device callback function
  drm/radeon: Implement the is_boot_device callback function

 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  12 +-
 drivers/gpu/drm/drm_aperture.c             |  16 +++
 drivers/gpu/drm/i915/display/intel_vga.c   |   3 +-
 drivers/gpu/drm/nouveau/nouveau_vga.c      |   2 +-
 drivers/gpu/drm/radeon/radeon_device.c     |  12 +-
 drivers/pci/vgaarb.c                       | 153 +++++++++++++--------
 drivers/vfio/pci/vfio_pci_core.c           |   2 +-
 drivers/video/aperture.c                   |  29 ++++
 include/drm/drm_aperture.h                 |   2 +
 include/linux/aperture.h                   |   7 +
 include/linux/vgaarb.h                     |  35 ++---
 11 files changed, 184 insertions(+), 89 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Intel-gfx] [PATCH v6 0/8] PCI/VGA: introduce is_boot_device function callback to vga_client_register
@ 2023-06-12 19:33 ` Sui Jingfeng
  0 siblings, 0 replies; 10+ messages in thread
From: Sui Jingfeng @ 2023-06-12 19:33 UTC (permalink / raw)
  To: Alex Deucher, Christian Konig, Pan Xinhui, David Airlie,
	Daniel Vetter, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
	Tvrtko Ursulin, Ben Skeggs, Karol Herbst, Lyude Paul,
	Bjorn Helgaas, Alex Williamson, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, Hawking Zhang, Mario Limonciello, Lijo Lazar,
	YiPeng Chai, Andrey Grodzovsky, Somalapuram Amaranath,
	Bokun Zhang, Ville Syrjala, Li Yi, Sui Jingfeng, Jason Gunthorpe,
	Kevin Tian, Cornelia Huck, Yishai Hadas, Abhishek Sahu, Yi Liu
  Cc: kvm, nouveau, intel-gfx, linux-kernel, dri-devel,
	loongson-kernel, amd-gfx, linux-pci

The vga_is_firmware_default() function is arch-dependent, it's probably
wrong if we simply remove the arch guard. As the VRAM BAR which contains
firmware framebuffer may move, while the lfb_base and lfb_size members of
the screen_info does not change accordingly. In short, it should take the
re-allocation of the PCI BAR into consideration.

With the observation that device drivers or video aperture helpers may
have better knowledge about which PCI bar contains the firmware fb,
which could avoid the need to iterate all of the PCI BARs. But as a PCI
function at pci/vgaarb.c, vga_is_firmware_default() is not suitable to
make such an optimization since it is loaded too early.

There are PCI display controllers that don't have a dedicated VRAM bar,
this function will lose its effectiveness in such a case. Luckily, the
device driver can provide an accurate workaround.

Therefore, this patch introduces a callback that allows the device driver
to tell the VGAARB if the device is the default boot device. Also honor
the comment: "Clients have two callback mechanisms they can use"

Sui Jingfeng (8):
  PCI/VGA: Use unsigned type for the io_state variable
  PCI/VGA: Deal only with VGA class devices
  PCI/VGA: Tidy up the code and comment format
  PCI/VGA: Replace full MIT license text with SPDX identifier
  video/aperture: Add a helper to detect if an aperture contains
    firmware FB
  PCI/VGA: Introduce is_boot_device function callback to
    vga_client_register
  drm/amdgpu: Implement the is_boot_device callback function
  drm/radeon: Implement the is_boot_device callback function

 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  12 +-
 drivers/gpu/drm/drm_aperture.c             |  16 +++
 drivers/gpu/drm/i915/display/intel_vga.c   |   3 +-
 drivers/gpu/drm/nouveau/nouveau_vga.c      |   2 +-
 drivers/gpu/drm/radeon/radeon_device.c     |  12 +-
 drivers/pci/vgaarb.c                       | 153 +++++++++++++--------
 drivers/vfio/pci/vfio_pci_core.c           |   2 +-
 drivers/video/aperture.c                   |  29 ++++
 include/drm/drm_aperture.h                 |   2 +
 include/linux/aperture.h                   |   7 +
 include/linux/vgaarb.h                     |  35 ++---
 11 files changed, 184 insertions(+), 89 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Nouveau] [PATCH v6 0/8] PCI/VGA: introduce is_boot_device function callback to vga_client_register
@ 2023-06-12 19:33 ` Sui Jingfeng
  0 siblings, 0 replies; 10+ messages in thread
From: Sui Jingfeng @ 2023-06-12 19:33 UTC (permalink / raw)
  To: Alex Deucher, Christian Konig, Pan Xinhui, David Airlie,
	Daniel Vetter, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
	Tvrtko Ursulin, Ben Skeggs, Karol Herbst, Lyude Paul,
	Bjorn Helgaas, Alex Williamson, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, Hawking Zhang, Mario Limonciello, Lijo Lazar,
	YiPeng Chai, Andrey Grodzovsky, Somalapuram Amaranath,
	Bokun Zhang, Ville Syrjala, Li Yi, Sui Jingfeng, Jason Gunthorpe,
	Kevin Tian, Cornelia Huck, Yishai Hadas, Abhishek Sahu, Yi Liu
  Cc: kvm, nouveau, intel-gfx, linux-kernel, dri-devel,
	loongson-kernel, amd-gfx, linux-pci

The vga_is_firmware_default() function is arch-dependent, it's probably
wrong if we simply remove the arch guard. As the VRAM BAR which contains
firmware framebuffer may move, while the lfb_base and lfb_size members of
the screen_info does not change accordingly. In short, it should take the
re-allocation of the PCI BAR into consideration.

With the observation that device drivers or video aperture helpers may
have better knowledge about which PCI bar contains the firmware fb,
which could avoid the need to iterate all of the PCI BARs. But as a PCI
function at pci/vgaarb.c, vga_is_firmware_default() is not suitable to
make such an optimization since it is loaded too early.

There are PCI display controllers that don't have a dedicated VRAM bar,
this function will lose its effectiveness in such a case. Luckily, the
device driver can provide an accurate workaround.

Therefore, this patch introduces a callback that allows the device driver
to tell the VGAARB if the device is the default boot device. Also honor
the comment: "Clients have two callback mechanisms they can use"

Sui Jingfeng (8):
  PCI/VGA: Use unsigned type for the io_state variable
  PCI/VGA: Deal only with VGA class devices
  PCI/VGA: Tidy up the code and comment format
  PCI/VGA: Replace full MIT license text with SPDX identifier
  video/aperture: Add a helper to detect if an aperture contains
    firmware FB
  PCI/VGA: Introduce is_boot_device function callback to
    vga_client_register
  drm/amdgpu: Implement the is_boot_device callback function
  drm/radeon: Implement the is_boot_device callback function

 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  12 +-
 drivers/gpu/drm/drm_aperture.c             |  16 +++
 drivers/gpu/drm/i915/display/intel_vga.c   |   3 +-
 drivers/gpu/drm/nouveau/nouveau_vga.c      |   2 +-
 drivers/gpu/drm/radeon/radeon_device.c     |  12 +-
 drivers/pci/vgaarb.c                       | 153 +++++++++++++--------
 drivers/vfio/pci/vfio_pci_core.c           |   2 +-
 drivers/video/aperture.c                   |  29 ++++
 include/drm/drm_aperture.h                 |   2 +
 include/linux/aperture.h                   |   7 +
 include/linux/vgaarb.h                     |  35 ++---
 11 files changed, 184 insertions(+), 89 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v6 0/8] PCI/VGA: introduce is_boot_device function callback to vga_client_register
  2023-06-21 22:11   ` Lyude Paul
@ 2023-06-22  4:46     ` Sui Jingfeng
  -1 siblings, 0 replies; 10+ messages in thread
From: Sui Jingfeng @ 2023-06-22  4:46 UTC (permalink / raw)
  To: Lyude Paul, Sui Jingfeng, Alex Deucher, Christian Konig,
	Pan Xinhui, David Airlie, Daniel Vetter, Jani Nikula,
	Joonas Lahtinen, Rodrigo Vivi, Tvrtko Ursulin, Ben Skeggs,
	Karol Herbst, Bjorn Helgaas, Alex Williamson, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Hawking Zhang,
	Mario Limonciello, Lijo Lazar, YiPeng Chai, Andrey Grodzovsky,
	Somalapuram Amaranath, Bokun Zhang, Ville Syrjala, Li Yi,
	Jason Gunthorpe, Kevin Tian, Cornelia Huck, Yishai Hadas,
	Abhishek Sahu, Yi Liu
  Cc: amd-gfx, dri-devel, linux-kernel, intel-gfx, nouveau, linux-pci,
	kvm, loongson-kernel

Hi

On 2023/6/22 06:11, Lyude Paul wrote:
> For the nouveau bits:
>
> Reviewed-by: Lyude Paul <lyude@redhat.com>
Thanks a lot
> On Tue, 2023-06-13 at 03:25 +0800, Sui Jingfeng wrote:
>> From: Sui Jingfeng <suijingfeng@loongson.cn>
>>
>> The vga_is_firmware_default() function is arch-dependent, it's probably
>> wrong if we simply remove the arch guard. As the VRAM BAR which contains
>> firmware framebuffer may move, while the lfb_base and lfb_size members of
>> the screen_info does not change accordingly. In short, it should take the
>> re-allocation of the PCI BAR into consideration.
>>
>> With the observation that device drivers or video aperture helpers may
>> have better knowledge about which PCI bar contains the firmware fb,
>> which could avoid the need to iterate all of the PCI BARs. But as a PCI
>> function at pci/vgaarb.c, vga_is_firmware_default() is not suitable to
>> make such an optimization since it is loaded too early.
>>
>> There are PCI display controllers that don't have a dedicated VRAM bar,
>> this function will lose its effectiveness in such a case. Luckily, the
>> device driver can provide an accurate workaround.
>>
>> Therefore, this patch introduces a callback that allows the device driver
>> to tell the VGAARB if the device is the default boot device. Also honor
>> the comment: "Clients have two callback mechanisms they can use"
>>
>> Sui Jingfeng (8):
>>    PCI/VGA: Use unsigned type for the io_state variable
>>    PCI/VGA: Deal only with VGA class devices
>>    PCI/VGA: Tidy up the code and comment format
>>    PCI/VGA: Replace full MIT license text with SPDX identifier
>>    video/aperture: Add a helper to detect if an aperture contains
>>      firmware FB
>>    PCI/VGA: Introduce is_boot_device function callback to
>>      vga_client_register
>>    drm/amdgpu: Implement the is_boot_device callback function
>>    drm/radeon: Implement the is_boot_device callback function
>>
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  12 +-
>>   drivers/gpu/drm/drm_aperture.c             |  16 +++
>>   drivers/gpu/drm/i915/display/intel_vga.c   |   3 +-
>>   drivers/gpu/drm/nouveau/nouveau_vga.c      |   2 +-
>>   drivers/gpu/drm/radeon/radeon_device.c     |  12 +-
>>   drivers/pci/vgaarb.c                       | 153 +++++++++++++--------
>>   drivers/vfio/pci/vfio_pci_core.c           |   2 +-
>>   drivers/video/aperture.c                   |  29 ++++
>>   include/drm/drm_aperture.h                 |   2 +
>>   include/linux/aperture.h                   |   7 +
>>   include/linux/vgaarb.h                     |  35 ++---
>>   11 files changed, 184 insertions(+), 89 deletions(-)
>>
-- 
Jingfeng


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v6 0/8] PCI/VGA: introduce is_boot_device function callback to vga_client_register
@ 2023-06-22  4:46     ` Sui Jingfeng
  0 siblings, 0 replies; 10+ messages in thread
From: Sui Jingfeng @ 2023-06-22  4:46 UTC (permalink / raw)
  To: Lyude Paul, Sui Jingfeng, Alex Deucher, Christian Konig,
	Pan Xinhui, David Airlie, Daniel Vetter, Jani Nikula,
	Joonas Lahtinen, Rodrigo Vivi, Tvrtko Ursulin, Ben Skeggs,
	Karol Herbst, Bjorn Helgaas, Alex Williamson, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Hawking Zhang,
	Mario Limonciello, Lijo Lazar, YiPeng Chai, Andrey Grodzovsky,
	Somalapuram Amaranath, Bokun Zhang, Ville Syrjala, Li Yi,
	Jason Gunthorpe, Kevin Tian, Cornelia Huck, Yishai Hadas,
	Abhishek Sahu, Yi Liu
  Cc: kvm, nouveau, intel-gfx, linux-kernel, dri-devel,
	loongson-kernel, amd-gfx, linux-pci

Hi

On 2023/6/22 06:11, Lyude Paul wrote:
> For the nouveau bits:
>
> Reviewed-by: Lyude Paul <lyude@redhat.com>
Thanks a lot
> On Tue, 2023-06-13 at 03:25 +0800, Sui Jingfeng wrote:
>> From: Sui Jingfeng <suijingfeng@loongson.cn>
>>
>> The vga_is_firmware_default() function is arch-dependent, it's probably
>> wrong if we simply remove the arch guard. As the VRAM BAR which contains
>> firmware framebuffer may move, while the lfb_base and lfb_size members of
>> the screen_info does not change accordingly. In short, it should take the
>> re-allocation of the PCI BAR into consideration.
>>
>> With the observation that device drivers or video aperture helpers may
>> have better knowledge about which PCI bar contains the firmware fb,
>> which could avoid the need to iterate all of the PCI BARs. But as a PCI
>> function at pci/vgaarb.c, vga_is_firmware_default() is not suitable to
>> make such an optimization since it is loaded too early.
>>
>> There are PCI display controllers that don't have a dedicated VRAM bar,
>> this function will lose its effectiveness in such a case. Luckily, the
>> device driver can provide an accurate workaround.
>>
>> Therefore, this patch introduces a callback that allows the device driver
>> to tell the VGAARB if the device is the default boot device. Also honor
>> the comment: "Clients have two callback mechanisms they can use"
>>
>> Sui Jingfeng (8):
>>    PCI/VGA: Use unsigned type for the io_state variable
>>    PCI/VGA: Deal only with VGA class devices
>>    PCI/VGA: Tidy up the code and comment format
>>    PCI/VGA: Replace full MIT license text with SPDX identifier
>>    video/aperture: Add a helper to detect if an aperture contains
>>      firmware FB
>>    PCI/VGA: Introduce is_boot_device function callback to
>>      vga_client_register
>>    drm/amdgpu: Implement the is_boot_device callback function
>>    drm/radeon: Implement the is_boot_device callback function
>>
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  12 +-
>>   drivers/gpu/drm/drm_aperture.c             |  16 +++
>>   drivers/gpu/drm/i915/display/intel_vga.c   |   3 +-
>>   drivers/gpu/drm/nouveau/nouveau_vga.c      |   2 +-
>>   drivers/gpu/drm/radeon/radeon_device.c     |  12 +-
>>   drivers/pci/vgaarb.c                       | 153 +++++++++++++--------
>>   drivers/vfio/pci/vfio_pci_core.c           |   2 +-
>>   drivers/video/aperture.c                   |  29 ++++
>>   include/drm/drm_aperture.h                 |   2 +
>>   include/linux/aperture.h                   |   7 +
>>   include/linux/vgaarb.h                     |  35 ++---
>>   11 files changed, 184 insertions(+), 89 deletions(-)
>>
-- 
Jingfeng


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v6 0/8] PCI/VGA: introduce is_boot_device function callback to vga_client_register
  2023-06-12 19:25 ` Sui Jingfeng
@ 2023-06-21 22:11   ` Lyude Paul
  -1 siblings, 0 replies; 10+ messages in thread
From: Lyude Paul @ 2023-06-21 22:11 UTC (permalink / raw)
  To: Sui Jingfeng, Alex Deucher, Christian Konig, Pan Xinhui,
	David Airlie, Daniel Vetter, Jani Nikula, Joonas Lahtinen,
	Rodrigo Vivi, Tvrtko Ursulin, Ben Skeggs, Karol Herbst,
	Bjorn Helgaas, Alex Williamson, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, Hawking Zhang, Mario Limonciello, Lijo Lazar,
	YiPeng Chai, Andrey Grodzovsky, Somalapuram Amaranath,
	Bokun Zhang, Ville Syrjala, Li Yi, Sui Jingfeng, Jason Gunthorpe,
	Kevin Tian, Cornelia Huck, Yishai Hadas, Abhishek Sahu, Yi Liu
  Cc: kvm, nouveau, intel-gfx, linux-kernel, dri-devel,
	loongson-kernel, amd-gfx, linux-pci

For the nouveau bits:

Reviewed-by: Lyude Paul <lyude@redhat.com>

On Tue, 2023-06-13 at 03:25 +0800, Sui Jingfeng wrote:
> From: Sui Jingfeng <suijingfeng@loongson.cn>
> 
> The vga_is_firmware_default() function is arch-dependent, it's probably
> wrong if we simply remove the arch guard. As the VRAM BAR which contains
> firmware framebuffer may move, while the lfb_base and lfb_size members of
> the screen_info does not change accordingly. In short, it should take the
> re-allocation of the PCI BAR into consideration.
> 
> With the observation that device drivers or video aperture helpers may
> have better knowledge about which PCI bar contains the firmware fb,
> which could avoid the need to iterate all of the PCI BARs. But as a PCI
> function at pci/vgaarb.c, vga_is_firmware_default() is not suitable to
> make such an optimization since it is loaded too early.
> 
> There are PCI display controllers that don't have a dedicated VRAM bar,
> this function will lose its effectiveness in such a case. Luckily, the
> device driver can provide an accurate workaround.
> 
> Therefore, this patch introduces a callback that allows the device driver
> to tell the VGAARB if the device is the default boot device. Also honor
> the comment: "Clients have two callback mechanisms they can use"
> 
> Sui Jingfeng (8):
>   PCI/VGA: Use unsigned type for the io_state variable
>   PCI/VGA: Deal only with VGA class devices
>   PCI/VGA: Tidy up the code and comment format
>   PCI/VGA: Replace full MIT license text with SPDX identifier
>   video/aperture: Add a helper to detect if an aperture contains
>     firmware FB
>   PCI/VGA: Introduce is_boot_device function callback to
>     vga_client_register
>   drm/amdgpu: Implement the is_boot_device callback function
>   drm/radeon: Implement the is_boot_device callback function
> 
>  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  12 +-
>  drivers/gpu/drm/drm_aperture.c             |  16 +++
>  drivers/gpu/drm/i915/display/intel_vga.c   |   3 +-
>  drivers/gpu/drm/nouveau/nouveau_vga.c      |   2 +-
>  drivers/gpu/drm/radeon/radeon_device.c     |  12 +-
>  drivers/pci/vgaarb.c                       | 153 +++++++++++++--------
>  drivers/vfio/pci/vfio_pci_core.c           |   2 +-
>  drivers/video/aperture.c                   |  29 ++++
>  include/drm/drm_aperture.h                 |   2 +
>  include/linux/aperture.h                   |   7 +
>  include/linux/vgaarb.h                     |  35 ++---
>  11 files changed, 184 insertions(+), 89 deletions(-)
> 

-- 
Cheers,
 Lyude Paul (she/her)
 Software Engineer at Red Hat


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v6 0/8] PCI/VGA: introduce is_boot_device function callback to vga_client_register
@ 2023-06-21 22:11   ` Lyude Paul
  0 siblings, 0 replies; 10+ messages in thread
From: Lyude Paul @ 2023-06-21 22:11 UTC (permalink / raw)
  To: Sui Jingfeng, Alex Deucher, Christian Konig, Pan Xinhui,
	David Airlie, Daniel Vetter, Jani Nikula, Joonas Lahtinen,
	Rodrigo Vivi, Tvrtko Ursulin, Ben Skeggs, Karol Herbst,
	Bjorn Helgaas, Alex Williamson, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, Hawking Zhang, Mario Limonciello, Lijo Lazar,
	YiPeng Chai, Andrey Grodzovsky, Somalapuram Amaranath,
	Bokun Zhang, Ville Syrjala, Li Yi, Sui Jingfeng, Jason Gunthorpe,
	Kevin Tian, Cornelia Huck, Yishai Hadas, Abhishek Sahu, Yi Liu
  Cc: amd-gfx, dri-devel, linux-kernel, intel-gfx, nouveau, linux-pci,
	kvm, loongson-kernel

For the nouveau bits:

Reviewed-by: Lyude Paul <lyude@redhat.com>

On Tue, 2023-06-13 at 03:25 +0800, Sui Jingfeng wrote:
> From: Sui Jingfeng <suijingfeng@loongson.cn>
> 
> The vga_is_firmware_default() function is arch-dependent, it's probably
> wrong if we simply remove the arch guard. As the VRAM BAR which contains
> firmware framebuffer may move, while the lfb_base and lfb_size members of
> the screen_info does not change accordingly. In short, it should take the
> re-allocation of the PCI BAR into consideration.
> 
> With the observation that device drivers or video aperture helpers may
> have better knowledge about which PCI bar contains the firmware fb,
> which could avoid the need to iterate all of the PCI BARs. But as a PCI
> function at pci/vgaarb.c, vga_is_firmware_default() is not suitable to
> make such an optimization since it is loaded too early.
> 
> There are PCI display controllers that don't have a dedicated VRAM bar,
> this function will lose its effectiveness in such a case. Luckily, the
> device driver can provide an accurate workaround.
> 
> Therefore, this patch introduces a callback that allows the device driver
> to tell the VGAARB if the device is the default boot device. Also honor
> the comment: "Clients have two callback mechanisms they can use"
> 
> Sui Jingfeng (8):
>   PCI/VGA: Use unsigned type for the io_state variable
>   PCI/VGA: Deal only with VGA class devices
>   PCI/VGA: Tidy up the code and comment format
>   PCI/VGA: Replace full MIT license text with SPDX identifier
>   video/aperture: Add a helper to detect if an aperture contains
>     firmware FB
>   PCI/VGA: Introduce is_boot_device function callback to
>     vga_client_register
>   drm/amdgpu: Implement the is_boot_device callback function
>   drm/radeon: Implement the is_boot_device callback function
> 
>  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  12 +-
>  drivers/gpu/drm/drm_aperture.c             |  16 +++
>  drivers/gpu/drm/i915/display/intel_vga.c   |   3 +-
>  drivers/gpu/drm/nouveau/nouveau_vga.c      |   2 +-
>  drivers/gpu/drm/radeon/radeon_device.c     |  12 +-
>  drivers/pci/vgaarb.c                       | 153 +++++++++++++--------
>  drivers/vfio/pci/vfio_pci_core.c           |   2 +-
>  drivers/video/aperture.c                   |  29 ++++
>  include/drm/drm_aperture.h                 |   2 +
>  include/linux/aperture.h                   |   7 +
>  include/linux/vgaarb.h                     |  35 ++---
>  11 files changed, 184 insertions(+), 89 deletions(-)
> 

-- 
Cheers,
 Lyude Paul (she/her)
 Software Engineer at Red Hat


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v6 0/8] PCI/VGA: introduce is_boot_device function callback to vga_client_register
@ 2023-06-12 19:25 ` Sui Jingfeng
  0 siblings, 0 replies; 10+ messages in thread
From: Sui Jingfeng @ 2023-06-12 19:25 UTC (permalink / raw)
  To: Alex Deucher, Christian Konig, Pan Xinhui, David Airlie,
	Daniel Vetter, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
	Tvrtko Ursulin, Ben Skeggs, Karol Herbst, Lyude Paul,
	Bjorn Helgaas, Alex Williamson, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, Hawking Zhang, Mario Limonciello, Lijo Lazar,
	YiPeng Chai, Andrey Grodzovsky, Somalapuram Amaranath,
	Bokun Zhang, Ville Syrjala, Li Yi, Sui Jingfeng, Jason Gunthorpe,
	Kevin Tian, Cornelia Huck, Yishai Hadas, Abhishek Sahu, Yi Liu
  Cc: amd-gfx, dri-devel, linux-kernel, intel-gfx, nouveau, linux-pci,
	kvm, loongson-kernel

From: Sui Jingfeng <suijingfeng@loongson.cn>

The vga_is_firmware_default() function is arch-dependent, it's probably
wrong if we simply remove the arch guard. As the VRAM BAR which contains
firmware framebuffer may move, while the lfb_base and lfb_size members of
the screen_info does not change accordingly. In short, it should take the
re-allocation of the PCI BAR into consideration.

With the observation that device drivers or video aperture helpers may
have better knowledge about which PCI bar contains the firmware fb,
which could avoid the need to iterate all of the PCI BARs. But as a PCI
function at pci/vgaarb.c, vga_is_firmware_default() is not suitable to
make such an optimization since it is loaded too early.

There are PCI display controllers that don't have a dedicated VRAM bar,
this function will lose its effectiveness in such a case. Luckily, the
device driver can provide an accurate workaround.

Therefore, this patch introduces a callback that allows the device driver
to tell the VGAARB if the device is the default boot device. Also honor
the comment: "Clients have two callback mechanisms they can use"

Sui Jingfeng (8):
  PCI/VGA: Use unsigned type for the io_state variable
  PCI/VGA: Deal only with VGA class devices
  PCI/VGA: Tidy up the code and comment format
  PCI/VGA: Replace full MIT license text with SPDX identifier
  video/aperture: Add a helper to detect if an aperture contains
    firmware FB
  PCI/VGA: Introduce is_boot_device function callback to
    vga_client_register
  drm/amdgpu: Implement the is_boot_device callback function
  drm/radeon: Implement the is_boot_device callback function

 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  12 +-
 drivers/gpu/drm/drm_aperture.c             |  16 +++
 drivers/gpu/drm/i915/display/intel_vga.c   |   3 +-
 drivers/gpu/drm/nouveau/nouveau_vga.c      |   2 +-
 drivers/gpu/drm/radeon/radeon_device.c     |  12 +-
 drivers/pci/vgaarb.c                       | 153 +++++++++++++--------
 drivers/vfio/pci/vfio_pci_core.c           |   2 +-
 drivers/video/aperture.c                   |  29 ++++
 include/drm/drm_aperture.h                 |   2 +
 include/linux/aperture.h                   |   7 +
 include/linux/vgaarb.h                     |  35 ++---
 11 files changed, 184 insertions(+), 89 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v6 0/8] PCI/VGA: introduce is_boot_device function callback to vga_client_register
@ 2023-06-12 19:25 ` Sui Jingfeng
  0 siblings, 0 replies; 10+ messages in thread
From: Sui Jingfeng @ 2023-06-12 19:25 UTC (permalink / raw)
  To: Alex Deucher, Christian Konig, Pan Xinhui, David Airlie,
	Daniel Vetter, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
	Tvrtko Ursulin, Ben Skeggs, Karol Herbst, Lyude Paul,
	Bjorn Helgaas, Alex Williamson, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, Hawking Zhang, Mario Limonciello, Lijo Lazar,
	YiPeng Chai, Andrey Grodzovsky, Somalapuram Amaranath,
	Bokun Zhang, Ville Syrjala, Li Yi, Sui Jingfeng, Jason Gunthorpe,
	Kevin Tian, Cornelia Huck, Yishai Hadas, Abhishek Sahu, Yi Liu
  Cc: kvm, nouveau, intel-gfx, linux-kernel, dri-devel,
	loongson-kernel, amd-gfx, linux-pci

From: Sui Jingfeng <suijingfeng@loongson.cn>

The vga_is_firmware_default() function is arch-dependent, it's probably
wrong if we simply remove the arch guard. As the VRAM BAR which contains
firmware framebuffer may move, while the lfb_base and lfb_size members of
the screen_info does not change accordingly. In short, it should take the
re-allocation of the PCI BAR into consideration.

With the observation that device drivers or video aperture helpers may
have better knowledge about which PCI bar contains the firmware fb,
which could avoid the need to iterate all of the PCI BARs. But as a PCI
function at pci/vgaarb.c, vga_is_firmware_default() is not suitable to
make such an optimization since it is loaded too early.

There are PCI display controllers that don't have a dedicated VRAM bar,
this function will lose its effectiveness in such a case. Luckily, the
device driver can provide an accurate workaround.

Therefore, this patch introduces a callback that allows the device driver
to tell the VGAARB if the device is the default boot device. Also honor
the comment: "Clients have two callback mechanisms they can use"

Sui Jingfeng (8):
  PCI/VGA: Use unsigned type for the io_state variable
  PCI/VGA: Deal only with VGA class devices
  PCI/VGA: Tidy up the code and comment format
  PCI/VGA: Replace full MIT license text with SPDX identifier
  video/aperture: Add a helper to detect if an aperture contains
    firmware FB
  PCI/VGA: Introduce is_boot_device function callback to
    vga_client_register
  drm/amdgpu: Implement the is_boot_device callback function
  drm/radeon: Implement the is_boot_device callback function

 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  12 +-
 drivers/gpu/drm/drm_aperture.c             |  16 +++
 drivers/gpu/drm/i915/display/intel_vga.c   |   3 +-
 drivers/gpu/drm/nouveau/nouveau_vga.c      |   2 +-
 drivers/gpu/drm/radeon/radeon_device.c     |  12 +-
 drivers/pci/vgaarb.c                       | 153 +++++++++++++--------
 drivers/vfio/pci/vfio_pci_core.c           |   2 +-
 drivers/video/aperture.c                   |  29 ++++
 include/drm/drm_aperture.h                 |   2 +
 include/linux/aperture.h                   |   7 +
 include/linux/vgaarb.h                     |  35 ++---
 11 files changed, 184 insertions(+), 89 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-06-22  4:46 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-12 19:33 [PATCH v6 0/8] PCI/VGA: introduce is_boot_device function callback to vga_client_register Sui Jingfeng
2023-06-12 19:33 ` [Nouveau] " Sui Jingfeng
2023-06-12 19:33 ` [Intel-gfx] " Sui Jingfeng
2023-06-12 19:33 ` Sui Jingfeng
  -- strict thread matches above, loose matches on Subject: below --
2023-06-12 19:25 Sui Jingfeng
2023-06-12 19:25 ` Sui Jingfeng
2023-06-21 22:11 ` Lyude Paul
2023-06-21 22:11   ` Lyude Paul
2023-06-22  4:46   ` Sui Jingfeng
2023-06-22  4:46     ` Sui Jingfeng

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.