[PATCH 6/9] drm/xe: Remove driver side BAR release before resize

Ilpo Järvinen posted 9 patches 3 months, 1 week ago
[PATCH 6/9] drm/xe: Remove driver side BAR release before resize
Posted by Ilpo Järvinen 3 months, 1 week ago
PCI core handles releasing device's resources and their rollback in
case of failure of a BAR resizing operation. Releasing resource prior
to calling pci_resize_resource() prevents PCI core from restoring the
BARs as they were.

Remove driver-side release of BARs from the xe driver.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
---
 drivers/gpu/drm/xe/xe_vram.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_vram.c b/drivers/gpu/drm/xe/xe_vram.c
index b44ebf50fedb..929412f0d131 100644
--- a/drivers/gpu/drm/xe/xe_vram.c
+++ b/drivers/gpu/drm/xe/xe_vram.c
@@ -33,9 +33,6 @@ _resize_bar(struct xe_device *xe, int resno, resource_size_t size)
 	int bar_size = pci_rebar_bytes_to_size(size);
 	int ret;
 
-	if (pci_resource_len(pdev, resno))
-		pci_release_resource(pdev, resno);
-
 	ret = pci_resize_resource(pdev, resno, bar_size);
 	if (ret) {
 		drm_info(&xe->drm, "Failed to resize BAR%d to %dM (%pe). Consider enabling 'Resizable BAR' support in your BIOS\n",
-- 
2.39.5

Re: [PATCH 6/9] drm/xe: Remove driver side BAR release before resize
Posted by Lucas De Marchi 3 months, 1 week ago
On Tue, Oct 28, 2025 at 07:35:48PM +0200, Ilpo Järvinen wrote:
>PCI core handles releasing device's resources and their rollback in
>case of failure of a BAR resizing operation. Releasing resource prior
>to calling pci_resize_resource() prevents PCI core from restoring the
>BARs as they were.
>
>Remove driver-side release of BARs from the xe driver.
>
>Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
>Cc: Lucas De Marchi <lucas.demarchi@intel.com>
>---
> drivers/gpu/drm/xe/xe_vram.c | 3 ---
> 1 file changed, 3 deletions(-)
>
>diff --git a/drivers/gpu/drm/xe/xe_vram.c b/drivers/gpu/drm/xe/xe_vram.c
>index b44ebf50fedb..929412f0d131 100644
>--- a/drivers/gpu/drm/xe/xe_vram.c
>+++ b/drivers/gpu/drm/xe/xe_vram.c
>@@ -33,9 +33,6 @@ _resize_bar(struct xe_device *xe, int resno, resource_size_t size)
> 	int bar_size = pci_rebar_bytes_to_size(size);
> 	int ret;
>
>-	if (pci_resource_len(pdev, resno))
>-		pci_release_resource(pdev, resno);
>-

conflict with drm-xe-next:

++<<<<<<< ours
  +      release_bars(pdev);
  +
++=======
++>>>>>>> theirs

if we don't need to release the BARs anymore to call
pci_resize_resource(), then the resolution is simply to drop the
function release_bars() function.

I'm sending that to our CI for coverage:
https://lore.kernel.org/intel-xe/20251028211613.3228940-2-lucas.demarchi@intel.com/T/#u

thanks
Lucas De Marchi

> 	ret = pci_resize_resource(pdev, resno, bar_size);
> 	if (ret) {
> 		drm_info(&xe->drm, "Failed to resize BAR%d to %dM (%pe). Consider enabling 'Resizable BAR' support in your BIOS\n",
>-- 
>2.39.5
>
Re: [PATCH 6/9] drm/xe: Remove driver side BAR release before resize
Posted by Lucas De Marchi 3 months, 1 week ago
On Tue, Oct 28, 2025 at 04:24:04PM -0500, Lucas De Marchi wrote:
>On Tue, Oct 28, 2025 at 07:35:48PM +0200, Ilpo Järvinen wrote:
>>PCI core handles releasing device's resources and their rollback in
>>case of failure of a BAR resizing operation. Releasing resource prior
>>to calling pci_resize_resource() prevents PCI core from restoring the
>>BARs as they were.
>>
>>Remove driver-side release of BARs from the xe driver.
>>
>>Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
>>Cc: Lucas De Marchi <lucas.demarchi@intel.com>
>>---
>>drivers/gpu/drm/xe/xe_vram.c | 3 ---
>>1 file changed, 3 deletions(-)
>>
>>diff --git a/drivers/gpu/drm/xe/xe_vram.c b/drivers/gpu/drm/xe/xe_vram.c
>>index b44ebf50fedb..929412f0d131 100644
>>--- a/drivers/gpu/drm/xe/xe_vram.c
>>+++ b/drivers/gpu/drm/xe/xe_vram.c
>>@@ -33,9 +33,6 @@ _resize_bar(struct xe_device *xe, int resno, resource_size_t size)
>>	int bar_size = pci_rebar_bytes_to_size(size);
>>	int ret;
>>
>>-	if (pci_resource_len(pdev, resno))
>>-		pci_release_resource(pdev, resno);
>>-
>
>conflict with drm-xe-next:
>
>++<<<<<<< ours
> +      release_bars(pdev);
> +
>++=======
>++>>>>>>> theirs
>
>if we don't need to release the BARs anymore to call
>pci_resize_resource(), then the resolution is simply to drop the
>function release_bars() function.
>
>I'm sending that to our CI for coverage:
>https://lore.kernel.org/intel-xe/20251028211613.3228940-2-lucas.demarchi@intel.com/T/#u

CI came back clean. Looks good from xe side:

Acked-by: Lucas De Marchi <lucas.demarchi@intel.com>

thanks
Lucas De Marchi

>
>thanks
>Lucas De Marchi
>
>>	ret = pci_resize_resource(pdev, resno, bar_size);
>>	if (ret) {
>>		drm_info(&xe->drm, "Failed to resize BAR%d to %dM (%pe). Consider enabling 'Resizable BAR' support in your BIOS\n",
>>-- 
>>2.39.5
>>