Hi all,
Today's linux-next merge of the pci tree got a conflict in:
drivers/gpu/drm/xe/xe_vram.c
between commit:
d30203739be7 ("drm/xe: Move rebar to be done earlier")
from Linus' tree and commits:
73cd7ee85e78 ("PCI: Fix restoring BARs on BAR resize rollback path")
348df5b30822 ("drm/xe: Remove driver side BAR release before resize")
af63e94f01d7 ("drm/xe/vram: Use PCI rebar helpers in resize_vram_bar()")
from the pci tree.
I fixed it up (but I am not happy with the result - see below) and can
carry the fix as necessary. This is now fixed as far as linux-next is
concerned, but any non trivial conflicts should be mentioned to your
upstream maintainer when your tree is submitted for merging. You may
also want to consider cooperating with the maintainer of the conflicting
tree to minimise any particularly complex conflicts.
--
Cheers,
Stephen Rothwell
diff --cc drivers/gpu/drm/xe/xe_vram.c
index 652df7a5f4f6,10f8a73e190b..000000000000
--- a/drivers/gpu/drm/xe/xe_vram.c
+++ b/drivers/gpu/drm/xe/xe_vram.c
@@@ -24,39 -24,14 +24,37 @@@
#include "xe_vram.h"
#include "xe_vram_types.h"
- #define BAR_SIZE_SHIFT 20
-
-static void
-_resize_bar(struct xe_device *xe, int resno, resource_size_t size)
+/*
+ * Release all the BARs that could influence/block LMEMBAR resizing, i.e.
+ * assigned IORESOURCE_MEM_64 BARs
+ */
+static void release_bars(struct pci_dev *pdev)
+{
+ struct resource *res;
+ int i;
+
+ pci_dev_for_each_resource(pdev, res, i) {
+ /* Resource already un-assigned, do not reset it */
+ if (!res->parent)
+ continue;
+
+ /* No need to release unrelated BARs */
+ if (!(res->flags & IORESOURCE_MEM_64))
+ continue;
+
+ pci_release_resource(pdev, i);
+ }
+}
+
+static void resize_bar(struct xe_device *xe, int resno, resource_size_t size)
{
struct pci_dev *pdev = to_pci_dev(xe->drm.dev);
int bar_size = pci_rebar_bytes_to_size(size);
int ret;
+ release_bars(pdev);
+
- ret = pci_resize_resource(pdev, resno, bar_size);
+ ret = pci_resize_resource(pdev, resno, bar_size, 0);
if (ret) {
drm_info(&xe->drm, "Failed to resize BAR%d to %dM (%pe). Consider enabling 'Resizable BAR' support in your BIOS\n",
resno, 1 << bar_size, ERR_PTR(ret));
On Fri, Nov 14, 2025 at 01:13:00PM +1100, Stephen Rothwell wrote:
>Hi all,
>
>Today's linux-next merge of the pci tree got a conflict in:
>
> drivers/gpu/drm/xe/xe_vram.c
>
>between commit:
>
> d30203739be7 ("drm/xe: Move rebar to be done earlier")
>
>from Linus' tree and commits:
>
> 73cd7ee85e78 ("PCI: Fix restoring BARs on BAR resize rollback path")
> 348df5b30822 ("drm/xe: Remove driver side BAR release before resize")
> af63e94f01d7 ("drm/xe/vram: Use PCI rebar helpers in resize_vram_bar()")
>
>from the pci tree.
>
>I fixed it up (but I am not happy with the result - see below) and can
>carry the fix as necessary. This is now fixed as far as linux-next is
>concerned, but any non trivial conflicts should be mentioned to your
>upstream maintainer when your tree is submitted for merging. You may
>also want to consider cooperating with the maintainer of the conflicting
>tree to minimise any particularly complex conflicts.
>
>--
>Cheers,
>Stephen Rothwell
>
>diff --cc drivers/gpu/drm/xe/xe_vram.c
>index 652df7a5f4f6,10f8a73e190b..000000000000
>--- a/drivers/gpu/drm/xe/xe_vram.c
>+++ b/drivers/gpu/drm/xe/xe_vram.c
>@@@ -24,39 -24,14 +24,37 @@@
> #include "xe_vram.h"
> #include "xe_vram_types.h"
>
>- #define BAR_SIZE_SHIFT 20
>-
> -static void
> -_resize_bar(struct xe_device *xe, int resno, resource_size_t size)
> +/*
> + * Release all the BARs that could influence/block LMEMBAR resizing, i.e.
> + * assigned IORESOURCE_MEM_64 BARs
> + */
> +static void release_bars(struct pci_dev *pdev)
> +{
> + struct resource *res;
> + int i;
> +
> + pci_dev_for_each_resource(pdev, res, i) {
> + /* Resource already un-assigned, do not reset it */
> + if (!res->parent)
> + continue;
> +
> + /* No need to release unrelated BARs */
> + if (!(res->flags & IORESOURCE_MEM_64))
> + continue;
> +
> + pci_release_resource(pdev, i);
> + }
> +}
> +
> +static void resize_bar(struct xe_device *xe, int resno, resource_size_t size)
> {
> struct pci_dev *pdev = to_pci_dev(xe->drm.dev);
> int bar_size = pci_rebar_bytes_to_size(size);
> int ret;
>
> + release_bars(pdev);
> +
https://lore.kernel.org/all/3ts3e2fwom7inbu2kzrvljo5mm7wz5ruaf6daib6cf5tk3v4al@njzufk22tcsy
the more correct fix here would be to drop the call and the entire
function since the functionality inside pci made this redundant.
thanks
Lucas De Marchi
>- ret = pci_resize_resource(pdev, resno, bar_size);
>+ ret = pci_resize_resource(pdev, resno, bar_size, 0);
> if (ret) {
> drm_info(&xe->drm, "Failed to resize BAR%d to %dM (%pe). Consider enabling 'Resizable BAR' support in your BIOS\n",
> resno, 1 << bar_size, ERR_PTR(ret));
Hi Lucas, On Fri, 14 Nov 2025 08:24:07 -0600 Lucas De Marchi <lucas.demarchi@intel.com> wrote: > > > https://lore.kernel.org/all/3ts3e2fwom7inbu2kzrvljo5mm7wz5ruaf6daib6cf5tk3v4al@njzufk22tcsy > > the more correct fix here would be to drop the call and the entire > function since the functionality inside pci made this redundant. I have done that from today. -- Cheers, Stephen Rothwell
© 2016 - 2026 Red Hat, Inc.