From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: linux-pci@vger.kernel.org, "Bjorn Helgaas" <bhelgaas@google.com>,
"Krzysztof Wilczyński" <kw@linux.com>,
"Christian König" <christian.koenig@amd.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>,
"Simona Vetter" <simona@ffwll.ch>,
"Tvrtko Ursulin" <tursulin@ursulin.net>,
?UTF-8?q?Thomas=20Hellstr=C3=B6m?=
<thomas.hellstrom@linux.intel.com>,
"Michael J . Ruhl" <mjruhl@habana.ai>,
linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org
Subject: Re: [PATCH v2 09/11] drm/xe/vram: Use pci_rebar_get_max_size()
Date: Mon, 15 Sep 2025 16:14:58 -0400 [thread overview]
Message-ID: <aMhzwm_66EOOvtmv@intel.com> (raw)
In-Reply-To: <20250915091358.9203-10-ilpo.jarvinen@linux.intel.com>
On Mon, Sep 15, 2025 at 12:13:56PM +0300, Ilpo Järvinen wrote:
> Use pci_rebar_get_max_size() from PCI core in resize_vram_bar() to
> simplify code.
>
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> Acked-by: Christian König <christian.koenig@amd.com>
> ---
> drivers/gpu/drm/xe/xe_vram.c | 15 +++++++--------
Acked-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
to get this patch merged through any other tree
> 1 file changed, 7 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_vram.c b/drivers/gpu/drm/xe/xe_vram.c
> index d4fbd7f74255..ca02744fb369 100644
> --- a/drivers/gpu/drm/xe/xe_vram.c
> +++ b/drivers/gpu/drm/xe/xe_vram.c
> @@ -54,16 +54,11 @@ static void resize_vram_bar(struct xe_device *xe)
> resource_size_t current_size;
> resource_size_t rebar_size;
> struct resource *root_res;
> - u32 bar_size_mask;
> + int max_size, i;
> u32 pci_cmd;
> - int i;
>
> /* gather some relevant info */
> current_size = pci_resource_len(pdev, LMEM_BAR);
> - bar_size_mask = pci_rebar_get_possible_sizes(pdev, LMEM_BAR);
> -
> - if (!bar_size_mask)
> - return;
>
> if (force_vram_bar_size < 0)
> return;
> @@ -77,7 +72,8 @@ static void resize_vram_bar(struct xe_device *xe)
> drm_info(&xe->drm,
> "Requested size: %lluMiB is not supported by rebar sizes: 0x%x. Leaving default: %lluMiB\n",
> (u64)pci_rebar_size_to_bytes(rebar_size) >> 20,
> - bar_size_mask, (u64)current_size >> 20);
> + pci_rebar_get_possible_sizes(pdev, LMEM_BAR),
> + (u64)current_size >> 20);
> return;
> }
>
> @@ -85,7 +81,10 @@ static void resize_vram_bar(struct xe_device *xe)
> if (rebar_size == current_size)
> return;
> } else {
> - rebar_size = pci_rebar_size_to_bytes(__fls(bar_size_mask));
> + max_size = pci_rebar_get_max_size(pdev, LMEM_BAR);
> + if (max_size < 0)
> + return;
> + rebar_size = pci_rebar_size_to_bytes(max_size);
>
> /* only resize if larger than current */
> if (rebar_size <= current_size)
> --
> 2.39.5
>
next prev parent reply other threads:[~2025-09-15 20:15 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-15 9:13 [PATCH v2 00/11] PCI: Resizable BAR improvements Ilpo Järvinen
2025-09-15 9:13 ` [PATCH v2 01/11] PCI: Move Resizable BAR code into rebar.c Ilpo Järvinen
2025-09-15 9:13 ` [PATCH v2 02/11] PCI: Cleanup pci_rebar_bytes_to_size() and move " Ilpo Järvinen
2025-09-15 9:13 ` [PATCH v2 03/11] PCI: Move pci_rebar_size_to_bytes() and export it Ilpo Järvinen
2025-09-15 9:13 ` [PATCH v2 04/11] PCI: Improve Resizable BAR functions kernel doc Ilpo Järvinen
2025-09-15 9:13 ` [PATCH v2 05/11] PCI: Add pci_rebar_size_supported() helper Ilpo Järvinen
2025-09-15 17:28 ` Andi Shyti
2025-09-16 8:07 ` Jani Nikula
2025-09-15 9:13 ` [PATCH v2 06/11] drm/i915/gt: Use pci_rebar_size_supported() Ilpo Järvinen
2025-09-15 12:42 ` Jani Nikula
2025-09-15 17:24 ` Andi Shyti
2025-09-15 20:14 ` Rodrigo Vivi
2025-09-16 8:12 ` Jani Nikula
2025-09-16 8:57 ` Christian König
2025-09-16 16:05 ` Rodrigo Vivi
2025-09-15 17:22 ` Andi Shyti
2025-09-15 9:13 ` [PATCH v2 07/11] drm/xe/vram: Use PCI rebar helpers in resize_vram_bar() Ilpo Järvinen
2025-09-15 20:15 ` Rodrigo Vivi
2025-09-15 9:13 ` [PATCH v2 08/11] PCI: Add pci_rebar_get_max_size() Ilpo Järvinen
2025-09-15 9:13 ` [PATCH v2 09/11] drm/xe/vram: Use pci_rebar_get_max_size() Ilpo Järvinen
2025-09-15 20:14 ` Rodrigo Vivi [this message]
2025-09-15 9:13 ` [PATCH v2 10/11] drm/amdgpu: " Ilpo Järvinen
2025-09-15 9:13 ` [PATCH v2 11/11] PCI: Convert BAR sizes bitmasks to u64 Ilpo Järvinen
2025-09-15 9:23 ` ✗ CI.checkpatch: warning for PCI: Resizable BAR improvements (rev2) Patchwork
2025-09-15 9:24 ` ✓ CI.KUnit: success " Patchwork
2025-09-15 10:23 ` ✓ Xe.CI.BAT: " Patchwork
2025-09-15 10:55 ` ✓ i915.CI.BAT: " Patchwork
2025-09-15 12:27 ` ✗ Xe.CI.Full: failure " Patchwork
2025-09-15 13:28 ` ✗ i915.CI.Full: " Patchwork
2025-09-15 17:04 ` [PATCH v2 00/11] PCI: Resizable BAR improvements Lucas De Marchi
2025-09-15 17:24 ` Ilpo Järvinen
2025-09-16 18:11 ` Lucas De Marchi
2025-09-17 13:00 ` Ilpo Järvinen
2025-09-17 19:11 ` Lucas De Marchi
2025-09-17 19:40 ` ✗ Fi.CI.BUILD: failure for PCI: Resizable BAR improvements (rev3) Patchwork
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=aMhzwm_66EOOvtmv@intel.com \
--to=rodrigo.vivi@intel.com \
--cc=airlied@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=bhelgaas@google.com \
--cc=christian.koenig@amd.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=mjruhl@habana.ai \
--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 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.