All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/radeon: avoid bogus "vram limit (0) must be a power of 2" warning
@ 2022-07-06 20:01 ` Mateusz Jończyk
  0 siblings, 0 replies; 6+ messages in thread
From: Mateusz Jończyk @ 2022-07-06 20:01 UTC (permalink / raw)
  To: amd-gfx, dri-devel, linux-kernel
  Cc: Mateusz Jończyk, Alex Deucher, Christian König, Pan,
	Xinhui, David Airlie, Daniel Vetter, Jonathan Gray

I was getting the following message on boot on Linux 5.19-rc5:
        radeon 0000:01:05.0: vram limit (0) must be a power of 2
(I didn't use any radeon.vramlimit commandline parameter).

This is caused by
commit 8c2d34eb53b9 ("drm/radeon: use kernel is_power_of_2 rather than local version")
which removed radeon_check_pot_argument() and converted its users to
is_power_of_2(). The two functions differ in its handling of 0, which is
the default value of radeon_vram_limit: radeon_check_pot_argument()
"incorrectly" considered it a power of 2, while is_power_of_2() does not.

An appropriate conditional silences the warning message.

It is not necessary to add a similar test to other callers of
is_power_of_2() in radeon_device.c. The matching commit in amdgpu:
commit 761175078466 ("drm/amdgpu: use kernel is_power_of_2 rather than local version")
is unaffected by this bug.

Tested on Radeon HD 3200.

Not ccing stable, this is not serious enough.

Fixes: 8c2d34eb53b9 ("drm/radeon: use kernel is_power_of_2 rather than local version")
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Jonathan Gray <jsg@jsg.id.au>
Signed-off-by: Mateusz Jończyk <mat.jonczyk@o2.pl>
---
 drivers/gpu/drm/radeon/radeon_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index 15692cb241fc..429644d5ddc6 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -1113,7 +1113,7 @@ static int radeon_gart_size_auto(enum radeon_family family)
 static void radeon_check_arguments(struct radeon_device *rdev)
 {
 	/* vramlimit must be a power of two */
-	if (!is_power_of_2(radeon_vram_limit)) {
+	if (radeon_vram_limit != 0 && !is_power_of_2(radeon_vram_limit)) {
 		dev_warn(rdev->dev, "vram limit (%d) must be a power of 2\n",
 				radeon_vram_limit);
 		radeon_vram_limit = 0;

base-commit: 88084a3df1672e131ddc1b4e39eeacfd39864acf
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] drm/radeon: avoid bogus "vram limit (0) must be a power of 2" warning
@ 2022-07-06 20:01 ` Mateusz Jończyk
  0 siblings, 0 replies; 6+ messages in thread
From: Mateusz Jończyk @ 2022-07-06 20:01 UTC (permalink / raw)
  To: amd-gfx, dri-devel, linux-kernel
  Cc: Jonathan Gray, Mateusz Jończyk, Pan, Xinhui, David Airlie,
	Daniel Vetter, Alex Deucher, Christian König

I was getting the following message on boot on Linux 5.19-rc5:
        radeon 0000:01:05.0: vram limit (0) must be a power of 2
(I didn't use any radeon.vramlimit commandline parameter).

This is caused by
commit 8c2d34eb53b9 ("drm/radeon: use kernel is_power_of_2 rather than local version")
which removed radeon_check_pot_argument() and converted its users to
is_power_of_2(). The two functions differ in its handling of 0, which is
the default value of radeon_vram_limit: radeon_check_pot_argument()
"incorrectly" considered it a power of 2, while is_power_of_2() does not.

An appropriate conditional silences the warning message.

It is not necessary to add a similar test to other callers of
is_power_of_2() in radeon_device.c. The matching commit in amdgpu:
commit 761175078466 ("drm/amdgpu: use kernel is_power_of_2 rather than local version")
is unaffected by this bug.

Tested on Radeon HD 3200.

Not ccing stable, this is not serious enough.

Fixes: 8c2d34eb53b9 ("drm/radeon: use kernel is_power_of_2 rather than local version")
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Jonathan Gray <jsg@jsg.id.au>
Signed-off-by: Mateusz Jończyk <mat.jonczyk@o2.pl>
---
 drivers/gpu/drm/radeon/radeon_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index 15692cb241fc..429644d5ddc6 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -1113,7 +1113,7 @@ static int radeon_gart_size_auto(enum radeon_family family)
 static void radeon_check_arguments(struct radeon_device *rdev)
 {
 	/* vramlimit must be a power of two */
-	if (!is_power_of_2(radeon_vram_limit)) {
+	if (radeon_vram_limit != 0 && !is_power_of_2(radeon_vram_limit)) {
 		dev_warn(rdev->dev, "vram limit (%d) must be a power of 2\n",
 				radeon_vram_limit);
 		radeon_vram_limit = 0;

base-commit: 88084a3df1672e131ddc1b4e39eeacfd39864acf
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] drm/radeon: avoid bogus "vram limit (0) must be a power of 2" warning
@ 2022-07-06 20:01 ` Mateusz Jończyk
  0 siblings, 0 replies; 6+ messages in thread
From: Mateusz Jończyk @ 2022-07-06 20:01 UTC (permalink / raw)
  To: amd-gfx, dri-devel, linux-kernel
  Cc: Mateusz Jończyk, Pan, Xinhui, David Airlie, Alex Deucher,
	Christian König

I was getting the following message on boot on Linux 5.19-rc5:
        radeon 0000:01:05.0: vram limit (0) must be a power of 2
(I didn't use any radeon.vramlimit commandline parameter).

This is caused by
commit 8c2d34eb53b9 ("drm/radeon: use kernel is_power_of_2 rather than local version")
which removed radeon_check_pot_argument() and converted its users to
is_power_of_2(). The two functions differ in its handling of 0, which is
the default value of radeon_vram_limit: radeon_check_pot_argument()
"incorrectly" considered it a power of 2, while is_power_of_2() does not.

An appropriate conditional silences the warning message.

It is not necessary to add a similar test to other callers of
is_power_of_2() in radeon_device.c. The matching commit in amdgpu:
commit 761175078466 ("drm/amdgpu: use kernel is_power_of_2 rather than local version")
is unaffected by this bug.

Tested on Radeon HD 3200.

Not ccing stable, this is not serious enough.

Fixes: 8c2d34eb53b9 ("drm/radeon: use kernel is_power_of_2 rather than local version")
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Jonathan Gray <jsg@jsg.id.au>
Signed-off-by: Mateusz Jończyk <mat.jonczyk@o2.pl>
---
 drivers/gpu/drm/radeon/radeon_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index 15692cb241fc..429644d5ddc6 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -1113,7 +1113,7 @@ static int radeon_gart_size_auto(enum radeon_family family)
 static void radeon_check_arguments(struct radeon_device *rdev)
 {
 	/* vramlimit must be a power of two */
-	if (!is_power_of_2(radeon_vram_limit)) {
+	if (radeon_vram_limit != 0 && !is_power_of_2(radeon_vram_limit)) {
 		dev_warn(rdev->dev, "vram limit (%d) must be a power of 2\n",
 				radeon_vram_limit);
 		radeon_vram_limit = 0;

base-commit: 88084a3df1672e131ddc1b4e39eeacfd39864acf
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm/radeon: avoid bogus "vram limit (0) must be a power of 2" warning
  2022-07-06 20:01 ` Mateusz Jończyk
  (?)
@ 2022-07-06 21:52   ` Alex Deucher
  -1 siblings, 0 replies; 6+ messages in thread
From: Alex Deucher @ 2022-07-06 21:52 UTC (permalink / raw)
  To: Mateusz Jończyk
  Cc: amd-gfx list, Maling list - DRI developers, LKML, Jonathan Gray,
	Pan, Xinhui, David Airlie, Daniel Vetter, Alex Deucher,
	Christian König

Applied.  Thanks!

Alex

On Wed, Jul 6, 2022 at 5:40 PM Mateusz Jończyk <mat.jonczyk@o2.pl> wrote:
>
> I was getting the following message on boot on Linux 5.19-rc5:
>         radeon 0000:01:05.0: vram limit (0) must be a power of 2
> (I didn't use any radeon.vramlimit commandline parameter).
>
> This is caused by
> commit 8c2d34eb53b9 ("drm/radeon: use kernel is_power_of_2 rather than local version")
> which removed radeon_check_pot_argument() and converted its users to
> is_power_of_2(). The two functions differ in its handling of 0, which is
> the default value of radeon_vram_limit: radeon_check_pot_argument()
> "incorrectly" considered it a power of 2, while is_power_of_2() does not.
>
> An appropriate conditional silences the warning message.
>
> It is not necessary to add a similar test to other callers of
> is_power_of_2() in radeon_device.c. The matching commit in amdgpu:
> commit 761175078466 ("drm/amdgpu: use kernel is_power_of_2 rather than local version")
> is unaffected by this bug.
>
> Tested on Radeon HD 3200.
>
> Not ccing stable, this is not serious enough.
>
> Fixes: 8c2d34eb53b9 ("drm/radeon: use kernel is_power_of_2 rather than local version")
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: Christian König <christian.koenig@amd.com>
> Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Jonathan Gray <jsg@jsg.id.au>
> Signed-off-by: Mateusz Jończyk <mat.jonczyk@o2.pl>
> ---
>  drivers/gpu/drm/radeon/radeon_device.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
> index 15692cb241fc..429644d5ddc6 100644
> --- a/drivers/gpu/drm/radeon/radeon_device.c
> +++ b/drivers/gpu/drm/radeon/radeon_device.c
> @@ -1113,7 +1113,7 @@ static int radeon_gart_size_auto(enum radeon_family family)
>  static void radeon_check_arguments(struct radeon_device *rdev)
>  {
>         /* vramlimit must be a power of two */
> -       if (!is_power_of_2(radeon_vram_limit)) {
> +       if (radeon_vram_limit != 0 && !is_power_of_2(radeon_vram_limit)) {
>                 dev_warn(rdev->dev, "vram limit (%d) must be a power of 2\n",
>                                 radeon_vram_limit);
>                 radeon_vram_limit = 0;
>
> base-commit: 88084a3df1672e131ddc1b4e39eeacfd39864acf
> --
> 2.25.1
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm/radeon: avoid bogus "vram limit (0) must be a power of 2" warning
@ 2022-07-06 21:52   ` Alex Deucher
  0 siblings, 0 replies; 6+ messages in thread
From: Alex Deucher @ 2022-07-06 21:52 UTC (permalink / raw)
  To: Mateusz Jończyk
  Cc: David Airlie, Pan, Xinhui, LKML, Maling list - DRI developers,
	amd-gfx list, Alex Deucher, Christian König

Applied.  Thanks!

Alex

On Wed, Jul 6, 2022 at 5:40 PM Mateusz Jończyk <mat.jonczyk@o2.pl> wrote:
>
> I was getting the following message on boot on Linux 5.19-rc5:
>         radeon 0000:01:05.0: vram limit (0) must be a power of 2
> (I didn't use any radeon.vramlimit commandline parameter).
>
> This is caused by
> commit 8c2d34eb53b9 ("drm/radeon: use kernel is_power_of_2 rather than local version")
> which removed radeon_check_pot_argument() and converted its users to
> is_power_of_2(). The two functions differ in its handling of 0, which is
> the default value of radeon_vram_limit: radeon_check_pot_argument()
> "incorrectly" considered it a power of 2, while is_power_of_2() does not.
>
> An appropriate conditional silences the warning message.
>
> It is not necessary to add a similar test to other callers of
> is_power_of_2() in radeon_device.c. The matching commit in amdgpu:
> commit 761175078466 ("drm/amdgpu: use kernel is_power_of_2 rather than local version")
> is unaffected by this bug.
>
> Tested on Radeon HD 3200.
>
> Not ccing stable, this is not serious enough.
>
> Fixes: 8c2d34eb53b9 ("drm/radeon: use kernel is_power_of_2 rather than local version")
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: Christian König <christian.koenig@amd.com>
> Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Jonathan Gray <jsg@jsg.id.au>
> Signed-off-by: Mateusz Jończyk <mat.jonczyk@o2.pl>
> ---
>  drivers/gpu/drm/radeon/radeon_device.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
> index 15692cb241fc..429644d5ddc6 100644
> --- a/drivers/gpu/drm/radeon/radeon_device.c
> +++ b/drivers/gpu/drm/radeon/radeon_device.c
> @@ -1113,7 +1113,7 @@ static int radeon_gart_size_auto(enum radeon_family family)
>  static void radeon_check_arguments(struct radeon_device *rdev)
>  {
>         /* vramlimit must be a power of two */
> -       if (!is_power_of_2(radeon_vram_limit)) {
> +       if (radeon_vram_limit != 0 && !is_power_of_2(radeon_vram_limit)) {
>                 dev_warn(rdev->dev, "vram limit (%d) must be a power of 2\n",
>                                 radeon_vram_limit);
>                 radeon_vram_limit = 0;
>
> base-commit: 88084a3df1672e131ddc1b4e39eeacfd39864acf
> --
> 2.25.1
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm/radeon: avoid bogus "vram limit (0) must be a power of 2" warning
@ 2022-07-06 21:52   ` Alex Deucher
  0 siblings, 0 replies; 6+ messages in thread
From: Alex Deucher @ 2022-07-06 21:52 UTC (permalink / raw)
  To: Mateusz Jończyk
  Cc: Daniel Vetter, David Airlie, Pan, Xinhui, LKML,
	Maling list - DRI developers, amd-gfx list, Jonathan Gray,
	Alex Deucher, Christian König

Applied.  Thanks!

Alex

On Wed, Jul 6, 2022 at 5:40 PM Mateusz Jończyk <mat.jonczyk@o2.pl> wrote:
>
> I was getting the following message on boot on Linux 5.19-rc5:
>         radeon 0000:01:05.0: vram limit (0) must be a power of 2
> (I didn't use any radeon.vramlimit commandline parameter).
>
> This is caused by
> commit 8c2d34eb53b9 ("drm/radeon: use kernel is_power_of_2 rather than local version")
> which removed radeon_check_pot_argument() and converted its users to
> is_power_of_2(). The two functions differ in its handling of 0, which is
> the default value of radeon_vram_limit: radeon_check_pot_argument()
> "incorrectly" considered it a power of 2, while is_power_of_2() does not.
>
> An appropriate conditional silences the warning message.
>
> It is not necessary to add a similar test to other callers of
> is_power_of_2() in radeon_device.c. The matching commit in amdgpu:
> commit 761175078466 ("drm/amdgpu: use kernel is_power_of_2 rather than local version")
> is unaffected by this bug.
>
> Tested on Radeon HD 3200.
>
> Not ccing stable, this is not serious enough.
>
> Fixes: 8c2d34eb53b9 ("drm/radeon: use kernel is_power_of_2 rather than local version")
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: Christian König <christian.koenig@amd.com>
> Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Jonathan Gray <jsg@jsg.id.au>
> Signed-off-by: Mateusz Jończyk <mat.jonczyk@o2.pl>
> ---
>  drivers/gpu/drm/radeon/radeon_device.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
> index 15692cb241fc..429644d5ddc6 100644
> --- a/drivers/gpu/drm/radeon/radeon_device.c
> +++ b/drivers/gpu/drm/radeon/radeon_device.c
> @@ -1113,7 +1113,7 @@ static int radeon_gart_size_auto(enum radeon_family family)
>  static void radeon_check_arguments(struct radeon_device *rdev)
>  {
>         /* vramlimit must be a power of two */
> -       if (!is_power_of_2(radeon_vram_limit)) {
> +       if (radeon_vram_limit != 0 && !is_power_of_2(radeon_vram_limit)) {
>                 dev_warn(rdev->dev, "vram limit (%d) must be a power of 2\n",
>                                 radeon_vram_limit);
>                 radeon_vram_limit = 0;
>
> base-commit: 88084a3df1672e131ddc1b4e39eeacfd39864acf
> --
> 2.25.1
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-07-07  7:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-06 20:01 [PATCH] drm/radeon: avoid bogus "vram limit (0) must be a power of 2" warning Mateusz Jończyk
2022-07-06 20:01 ` Mateusz Jończyk
2022-07-06 20:01 ` Mateusz Jończyk
2022-07-06 21:52 ` Alex Deucher
2022-07-06 21:52   ` Alex Deucher
2022-07-06 21:52   ` Alex Deucher

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.