lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aMhzwm_66EOOvtmv@intel.com>
Date: Mon, 15 Sep 2025 16:14:58 -0400
From: Rodrigo Vivi <rodrigo.vivi@...el.com>
To: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
CC: <linux-pci@...r.kernel.org>, Bjorn Helgaas <bhelgaas@...gle.com>,
	Krzysztof Wilczyński <kw@...ux.com>, Christian
 König <christian.koenig@....com>, "Michał
 Winiarski" <michal.winiarski@...el.com>, Alex Deucher
	<alexander.deucher@....com>, <amd-gfx@...ts.freedesktop.org>, David Airlie
	<airlied@...il.com>, <dri-devel@...ts.freedesktop.org>,
	<intel-gfx@...ts.freedesktop.org>, <intel-xe@...ts.freedesktop.org>, "Jani
 Nikula" <jani.nikula@...ux.intel.com>, Joonas Lahtinen
	<joonas.lahtinen@...ux.intel.com>, Lucas De Marchi
	<lucas.demarchi@...el.com>, Simona Vetter <simona@...ll.ch>, Tvrtko Ursulin
	<tursulin@...ulin.net>, ?UTF-8?q?Thomas=20Hellstr=C3=B6m?=
	<thomas.hellstrom@...ux.intel.com>, "Michael J . Ruhl" <mjruhl@...ana.ai>,
	<linux-kernel@...r.kernel.org>, <linux-doc@...r.kernel.org>
Subject: Re: [PATCH v2 09/11] drm/xe/vram: Use pci_rebar_get_max_size()

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@...ux.intel.com>
> Acked-by: Christian König <christian.koenig@....com>
> ---
>  drivers/gpu/drm/xe/xe_vram.c | 15 +++++++--------


Acked-by: Rodrigo Vivi <rodrigo.vivi@...el.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
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ