Linux PCI subsystem development
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	linux-pci@vger.kernel.org, "Bjorn Helgaas" <bhelgaas@google.com>,
	"Krzysztof Wilczyński" <kw@linux.com>,
	"Michał Winiarski" <michal.winiarski@intel.com>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	amd-gfx@lists.freedesktop.org, "David Airlie" <airlied@gmail.com>,
	dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	intel-xe@lists.freedesktop.org,
	"Jani Nikula" <jani.nikula@linux.intel.com>,
	"Joonas Lahtinen" <joonas.lahtinen@linux.intel.com>,
	"Lucas De Marchi" <lucas.demarchi@intel.com>,
	"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	"Tvrtko Ursulin" <tursulin@ursulin.net>,
	?UTF-8?q?Thomas=20Hellstr=C3=B6m?=
	<thomas.hellstrom@linux.intel.com>
Cc: linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org
Subject: Re: [PATCH 00/11] PCI: Resizable BAR improvements
Date: Thu, 11 Sep 2025 10:35:18 +0200	[thread overview]
Message-ID: <bfb8fa6f-1217-411f-88c0-24788a0c15c9@amd.com> (raw)
In-Reply-To: <20250911075605.5277-1-ilpo.jarvinen@linux.intel.com>

On 11.09.25 09:55, Ilpo Järvinen wrote:
> pci.c has been used as catch everything that doesn't fits elsewhere
> within PCI core and thus resizable BAR code has been placed there as
> well. Move Resizable BAR related code to a newly introduced rebar.c to
> reduce size of pci.c. After move, there are no pci_rebar_*() calls from
> pci.c indicating this is indeed well-defined subset of PCI core.
> 
> Endpoint drivers perform Resizable BAR related operations which could
> well be performed by PCI core to simplify driver-side code. This
> series adds a few new API functions to that effect and converts the
> drivers to use the new APIs (in separate patches).
> 
> While at it, also convert BAR sizes bitmask to u64 as PCIe spec already
> specifies more sizes than what will fit u32 to make the API typing more
> future-proof. The extra sizes beyond 128TB are not added at this point.
> 
> These are based on pci/main, there are two minor conflicts with the
> work in pci/resource but I'm hesitant to base this on top of it as this
> is otherwise entirely independent. If we end up having to pull the
> bridge window select changes, there should be no reason why this does
> have to become collateral damage (so my suggestion, if this is good to
> go in this cycle, to take this into a separate branch than pci/resource
> and deal with those small conflicts while merging into pci/next).
> 
> I've tested sysfs resize, i915, and xe BAR resizing functionality. In
> the case of xe, I did small hack patch as its resize is anyway broken
> as is because BAR0 pins the bridge window so resizing BAR2 fails. My
> hack caused other problems further down the road (likely because BAR0
> is in use by the driver so releasing it messed assumptions xe driver
> has) but the BAR resize itself was working which was all I was
> interested to know. I'm not planning to pursue fixing the pinning
> problem within xe driver because the core changes to consider maximum
> size of the resizable BARs should take care of the main problem by
> different means.
> 
> Some parts of this are to be used by the resizable BAR changes into the
> resource fitting/assingment logic but these seem to stand on their own
> so sending these out now to reduce the size of the other patch series.

Yeah, sounds like a good idea to me.

Before I answer each mail individually:

Patches #1-#3, #8, #10 and #11 are Reviewed-by: Christian König <christian.koenig@amd.com>.

Patches #6, #7 and #9 are Acked-by: Christian König <christian.koenig@amd.com>.

Nit pick comments on patches #4 and #5, feel free to add my rb to them as well when those are fixed.

Regards,
Christian.

> 
> 
> Ilpo Järvinen (11):
>   PCI: Move Resizable BAR code into rebar.c
>   PCI: Cleanup pci_rebar_bytes_to_size() and move into rebar.c
>   PCI: Move pci_rebar_size_to_bytes() and export it
>   PCI: Improve Resizable BAR functions kernel doc
>   PCI: Add pci_rebar_size_supported() helper
>   drm/i915/gt: Use pci_rebar_size_supported()
>   drm/xe/vram: Use PCI rebar helpers in resize_vram_bar()
>   PCI: Add pci_rebar_get_max_size()
>   drm/xe/vram: Use pci_rebar_get_max_size()
>   drm/amdgpu: Use pci_rebar_get_max_size()
>   PCI: Convert BAR sizes bitmasks to u64
> 
>  Documentation/driver-api/pci/pci.rst        |   3 +
>  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c  |   8 +-
>  drivers/gpu/drm/i915/gt/intel_region_lmem.c |  10 +-
>  drivers/gpu/drm/xe/xe_vram.c                |  32 +-
>  drivers/pci/Makefile                        |   2 +-
>  drivers/pci/iov.c                           |   9 +-
>  drivers/pci/pci-sysfs.c                     |   2 +-
>  drivers/pci/pci.c                           | 145 ---------
>  drivers/pci/pci.h                           |   5 +-
>  drivers/pci/rebar.c                         | 318 ++++++++++++++++++++
>  drivers/pci/setup-res.c                     |  78 -----
>  include/linux/pci.h                         |  15 +-
>  12 files changed, 354 insertions(+), 273 deletions(-)
>  create mode 100644 drivers/pci/rebar.c
> 
> 
> base-commit: 8f5ae30d69d7543eee0d70083daf4de8fe15d585


      parent reply	other threads:[~2025-09-11  8:35 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-11  7:55 [PATCH 00/11] PCI: Resizable BAR improvements Ilpo Järvinen
2025-09-11  7:55 ` [PATCH 01/11] PCI: Move Resizable BAR code into rebar.c Ilpo Järvinen
2025-09-11  7:55 ` [PATCH 02/11] PCI: Cleanup pci_rebar_bytes_to_size() and move " Ilpo Järvinen
2025-09-11 17:25   ` Ruhl, Michael J
2025-09-11  7:55 ` [PATCH 03/11] PCI: Move pci_rebar_size_to_bytes() and export it Ilpo Järvinen
2025-09-11  7:55 ` [PATCH 04/11] PCI: Improve Resizable BAR functions kernel doc Ilpo Järvinen
2025-09-11  8:24   ` Christian König
2025-09-11  8:59     ` Ilpo Järvinen
2025-09-11  9:08       ` Christian König
2025-09-11 20:58   ` Randy Dunlap
2025-09-11  7:55 ` [PATCH 05/11] PCI: Add pci_rebar_size_supported() helper Ilpo Järvinen
2025-09-11  8:27   ` Christian König
2025-09-11  7:56 ` [PATCH 06/11] drm/i915/gt: Use pci_rebar_size_supported() Ilpo Järvinen
2025-09-11  7:56 ` [PATCH 07/11] drm/xe/vram: Use PCI rebar helpers in resize_vram_bar() Ilpo Järvinen
2025-09-11  7:56 ` [PATCH 08/11] PCI: Add pci_rebar_get_max_size() Ilpo Järvinen
2025-09-11  7:56 ` [PATCH 09/11] drm/xe/vram: Use pci_rebar_get_max_size() Ilpo Järvinen
2025-09-11  7:56 ` [PATCH 10/11] drm/amdgpu: " Ilpo Järvinen
2025-09-11  7:56 ` [PATCH 11/11] PCI: Convert BAR sizes bitmasks to u64 Ilpo Järvinen
2025-09-11  8:35 ` Christian König [this message]

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=bfb8fa6f-1217-411f-88c0-24788a0c15c9@amd.com \
    --to=christian.koenig@amd.com \
    --cc=airlied@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=bhelgaas@google.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=kw@linux.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lucas.demarchi@intel.com \
    --cc=michal.winiarski@intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=simona@ffwll.ch \
    --cc=thomas.hellstrom@linux.intel.com \
    --cc=tursulin@ursulin.net \
    /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