* [PATCH] drm/loongson: Error out if no VRAM detected
@ 2024-01-19 10:40 Huacai Chen
2024-01-19 16:18 ` Sui JIngfeng
` (2 more replies)
0 siblings, 3 replies; 14+ messages in thread
From: Huacai Chen @ 2024-01-19 10:40 UTC (permalink / raw)
To: David Airlie, Daniel Vetter, Huacai Chen, Jingfeng Sui
Cc: dri-devel, Huacai Chen
If there is no VRAM (it is true if there is a discreted card), we get
such an error and Xorg fails to start:
[ 136.401131] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
[ 137.444342] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
[ 138.871166] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
[ 140.444078] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
[ 142.403993] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
[ 143.970625] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
[ 145.862013] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
So in lsdc_get_dedicated_vram() we error out if no VRAM (or VRAM is less
than 1MB which is also an unusable case) detected.
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
---
drivers/gpu/drm/loongson/lsdc_drv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/loongson/lsdc_drv.c b/drivers/gpu/drm/loongson/lsdc_drv.c
index 89ccc0c43169..d8ff60b46abe 100644
--- a/drivers/gpu/drm/loongson/lsdc_drv.c
+++ b/drivers/gpu/drm/loongson/lsdc_drv.c
@@ -184,7 +184,7 @@ static int lsdc_get_dedicated_vram(struct lsdc_device *ldev,
drm_info(ddev, "Dedicated vram start: 0x%llx, size: %uMiB\n",
(u64)base, (u32)(size >> 20));
- return 0;
+ return (size > SZ_1M) ? 0 : -ENODEV;
}
static struct lsdc_device *
--
2.39.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: drm/loongson: Error out if no VRAM detected
2024-01-19 10:40 [PATCH] drm/loongson: Error out if no VRAM detected Huacai Chen
@ 2024-01-19 16:18 ` Sui JIngfeng
2024-01-20 10:15 ` Katyusha
` (3 more replies)
2024-01-23 1:21 ` [PATCH] " Shi Pujin
2024-02-02 17:24 ` Sui Jingfeng
2 siblings, 4 replies; 14+ messages in thread
From: Sui JIngfeng @ 2024-01-19 16:18 UTC (permalink / raw)
To: Huacai Chen, David Airlie, Daniel Vetter, Huacai Chen
Cc: loongson-kernel@lists.loongnix.cn, dri-devel
Hi,
Thanks a lot for contribution.
On 2024/1/19 18:40, Huacai Chen wrote:
> If there is no VRAM (it is true if there is a discreted card),
Why the dedicated VRAM is gone whenthere is a discrete card?
As far as I know, this is only possible on Loongson 3C5000 + aspeed BMC
server hardware platform where the dedicated VRAM chip of Loongson
Graphics is NOT soldered on the motherboard. Probably for cost reason,
but then, the platform BIOS(either UEFI or PMON) should turn off the
Loongson integrated graphics.
Because without dedicated VRAM, this driver can not work correctly. Or carve out
part of system RAM as VRAM, and write the base address and size to the BAR 2 of
the GPU PCI device.
This is NOT true for Loongson 3A5000/3A6000 desktop hardware, because I have do
a lot test on various platform[1] before this driver was merged. It never happens
on a sane hardware configuration. Please update the commit message and limit the
scope.
[1] https://github.com/loongson-gfx/loongson_boards
> we get
> such an error and Xorg fails to start:
Yeah, If there is no dedicated VRAM, the driver can't allocate memory for framebuffer.
But this is probably more about the hardware configuration issue, not a driver issue.
> [ 136.401131] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
> [ 137.444342] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
> [ 138.871166] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
> [ 140.444078] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
> [ 142.403993] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
> [ 143.970625] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
> [ 145.862013] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
>
> So in lsdc_get_dedicated_vram() we error out if no VRAM (or VRAM is less
> than 1MB which is also an unusable case) detected.
This is not expected, if you want this driver be there and run normally.
You should guarantee that there have at least 64MiB dedicated VRAM.
I'm OK if this patch is strongly requested, but this is a kind of error handling.
Please give more details about the hardware in using and explain why there is no
dedicated VRAM available for your hardware.
> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
> ---
> drivers/gpu/drm/loongson/lsdc_drv.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/loongson/lsdc_drv.c b/drivers/gpu/drm/loongson/lsdc_drv.c
> index 89ccc0c43169..d8ff60b46abe 100644
> --- a/drivers/gpu/drm/loongson/lsdc_drv.c
> +++ b/drivers/gpu/drm/loongson/lsdc_drv.c
> @@ -184,7 +184,7 @@ static int lsdc_get_dedicated_vram(struct lsdc_device *ldev,
> drm_info(ddev, "Dedicated vram start: 0x%llx, size: %uMiB\n",
> (u64)base, (u32)(size >> 20));
>
> - return 0;
> + return (size > SZ_1M) ? 0 : -ENODEV;
> }
>
> static struct lsdc_device *
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: drm/loongson: Error out if no VRAM detected
2024-01-19 16:18 ` Sui JIngfeng
@ 2024-01-20 10:15 ` Katyusha
2024-01-20 12:01 ` Katyusha
` (2 subsequent siblings)
3 siblings, 0 replies; 14+ messages in thread
From: Katyusha @ 2024-01-20 10:15 UTC (permalink / raw)
To: sui.jingfeng
Cc: daniel.vetter, chenhuacai, dri-devel, loongson-kernel, airlied,
chenhuacai
[-- Attachment #1: Type: text/plain, Size: 108 bytes --]
Hi,
This patch works fine with my Loongson 3A5000M laptop (L71), which has a
7A1000 chipset without VRAM.
[-- Attachment #2: Type: text/html, Size: 1296 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: drm/loongson: Error out if no VRAM detected
2024-01-19 16:18 ` Sui JIngfeng
2024-01-20 10:15 ` Katyusha
@ 2024-01-20 12:01 ` Katyusha
2024-01-20 21:28 ` Sui JIngfeng
2024-01-20 16:07 ` yetist
2024-01-24 10:06 ` Huacai Chen
3 siblings, 1 reply; 14+ messages in thread
From: Katyusha @ 2024-01-20 12:01 UTC (permalink / raw)
To: Sui JIngfeng, Huacai Chen, David Airlie, Daniel Vetter,
Huacai Chen
Cc: loongson-kernel@lists.loongnix.cn, dri-devel
[-- Attachment #1: Type: text/plain, Size: 3282 bytes --]
Hi,
This patch works fine with my Loongson 3A5000M laptop (L71), which has a
7A1000 chipset without VRAM.
On 2024/1/20 0:18, Sui JIngfeng wrote:
> Hi,
>
> Thanks a lot for contribution.
>
> On 2024/1/19 18:40, Huacai Chen wrote:
>> If there is no VRAM (it is true if there is a discreted card),
>
>
> Why the dedicated VRAM is gone whenthere is a discrete card?
>
> As far as I know, this is only possible on Loongson 3C5000 + aspeed
> BMC server hardware platform where the dedicated VRAM chip of Loongson
> Graphics is NOT soldered on the motherboard. Probably for cost reason,
> but then, the platform BIOS(either UEFI or PMON) should turn off the
> Loongson integrated graphics.
>
> Because without dedicated VRAM, this driver can not work correctly. Or
> carve out
> part of system RAM as VRAM, and write the base address and size to the
> BAR 2 of
> the GPU PCI device.
> This is NOT true for Loongson 3A5000/3A6000 desktop hardware,
> because I have do
> a lot test on various platform[1] before this driver was merged. It
> never happens
> on a sane hardware configuration. Please update the commit message and
> limit the
> scope.
>
> [1] https://github.com/loongson-gfx/loongson_boards
>
>> we get
>> such an error and Xorg fails to start:
>
>
> Yeah, If there is no dedicated VRAM, the driver can't allocate memory
> for framebuffer.
> But this is probably more about the hardware configuration issue, not
> a driver issue.
>
>
>> [ 136.401131] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB)
>> failed
>> [ 137.444342] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB)
>> failed
>> [ 138.871166] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB)
>> failed
>> [ 140.444078] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB)
>> failed
>> [ 142.403993] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB)
>> failed
>> [ 143.970625] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB)
>> failed
>> [ 145.862013] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB)
>> failed
>>
>> So in lsdc_get_dedicated_vram() we error out if no VRAM (or VRAM is less
>> than 1MB which is also an unusable case) detected.
>
>
> This is not expected, if you want this driver be there and run normally.
> You should guarantee that there have at least 64MiB dedicated VRAM.
>
> I'm OK if this patch is strongly requested, but this is a kind of
> error handling.
> Please give more details about the hardware in using and explain why
> there is no
> dedicated VRAM available for your hardware.
>
>
>> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
>> ---
>> drivers/gpu/drm/loongson/lsdc_drv.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/loongson/lsdc_drv.c
>> b/drivers/gpu/drm/loongson/lsdc_drv.c
>> index 89ccc0c43169..d8ff60b46abe 100644
>> --- a/drivers/gpu/drm/loongson/lsdc_drv.c
>> +++ b/drivers/gpu/drm/loongson/lsdc_drv.c
>> @@ -184,7 +184,7 @@ static int lsdc_get_dedicated_vram(struct
>> lsdc_device *ldev,
>> drm_info(ddev, "Dedicated vram start: 0x%llx, size: %uMiB\n",
>> (u64)base, (u32)(size >> 20));
>> - return 0;
>> + return (size > SZ_1M) ? 0 : -ENODEV;
>> }
>> static struct lsdc_device *
>
[-- Attachment #2: Type: text/html, Size: 6260 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: drm/loongson: Error out if no VRAM detected
2024-01-19 16:18 ` Sui JIngfeng
2024-01-20 10:15 ` Katyusha
2024-01-20 12:01 ` Katyusha
@ 2024-01-20 16:07 ` yetist
2024-01-20 21:09 ` Sui JIngfeng
2024-01-24 10:06 ` Huacai Chen
3 siblings, 1 reply; 14+ messages in thread
From: yetist @ 2024-01-20 16:07 UTC (permalink / raw)
To: Sui JIngfeng, Huacai Chen, David Airlie, Daniel Vetter,
Huacai Chen
Cc: loongson-kernel@lists.loongnix.cn, dri-devel
Without this patch, my server cannot start the DM. It is a Loongson
3C5000L server, with both a Loongson display controller and an ASPEED
graphics card.
$ lspci |grep VGA
0000:00:06.1 VGA Compatible Controller: Loongson Technology LLC DC
(Display Controller) (rev 01)
0000:03:00.0 VGA-compatible controller: ASPEED Technology, Inc.
ASPEED Graphics Family (revision 41)
When not working, there is the following information in dmesg:
loongson 0000:00:06.1: [drm] Private vram start: 0xe00472a6000, size:
0MiB
Loongson 0000:00:06.1: [drm] *Error* Request (0MiB) failed
Anyway, this patch works fine with my server now, thank you.
Tested-by: Xiaotian Wu <wuxiaotian@loongson.cn>
在 2024/1/20 00:18, Sui JIngfeng 写道:
> Hi,
>
> Thanks a lot for contribution.
>
> On 2024/1/19 18:40, Huacai Chen wrote:
>> If there is no VRAM (it is true if there is a discreted card),
>
>
> Why the dedicated VRAM is gone whenthere is a discrete card?
>
> As far as I know, this is only possible on Loongson 3C5000 + aspeed
> BMC server hardware platform where the dedicated VRAM chip of Loongson
> Graphics is NOT soldered on the motherboard. Probably for cost reason,
> but then, the platform BIOS(either UEFI or PMON) should turn off the
> Loongson integrated graphics.
>
> Because without dedicated VRAM, this driver can not work correctly. Or
> carve out
> part of system RAM as VRAM, and write the base address and size to the
> BAR 2 of
> the GPU PCI device.
> This is NOT true for Loongson 3A5000/3A6000 desktop hardware,
> because I have do
> a lot test on various platform[1] before this driver was merged. It
> never happens
> on a sane hardware configuration. Please update the commit message and
> limit the
> scope.
>
> [1] https://github.com/loongson-gfx/loongson_boards
>
>> we get
>> such an error and Xorg fails to start:
>
>
> Yeah, If there is no dedicated VRAM, the driver can't allocate memory
> for framebuffer.
> But this is probably more about the hardware configuration issue, not
> a driver issue.
>
>
>> [ 136.401131] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB)
>> failed
>> [ 137.444342] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB)
>> failed
>> [ 138.871166] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB)
>> failed
>> [ 140.444078] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB)
>> failed
>> [ 142.403993] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB)
>> failed
>> [ 143.970625] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB)
>> failed
>> [ 145.862013] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB)
>> failed
>>
>> So in lsdc_get_dedicated_vram() we error out if no VRAM (or VRAM is less
>> than 1MB which is also an unusable case) detected.
>
>
> This is not expected, if you want this driver be there and run normally.
> You should guarantee that there have at least 64MiB dedicated VRAM.
>
> I'm OK if this patch is strongly requested, but this is a kind of
> error handling.
> Please give more details about the hardware in using and explain why
> there is no
> dedicated VRAM available for your hardware.
>
>
>> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
>> ---
>> drivers/gpu/drm/loongson/lsdc_drv.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/loongson/lsdc_drv.c
>> b/drivers/gpu/drm/loongson/lsdc_drv.c
>> index 89ccc0c43169..d8ff60b46abe 100644
>> --- a/drivers/gpu/drm/loongson/lsdc_drv.c
>> +++ b/drivers/gpu/drm/loongson/lsdc_drv.c
>> @@ -184,7 +184,7 @@ static int lsdc_get_dedicated_vram(struct
>> lsdc_device *ldev,
>> drm_info(ddev, "Dedicated vram start: 0x%llx, size: %uMiB\n",
>> (u64)base, (u32)(size >> 20));
>> - return 0;
>> + return (size > SZ_1M) ? 0 : -ENODEV;
>> }
>> static struct lsdc_device *
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: drm/loongson: Error out if no VRAM detected
2024-01-20 16:07 ` yetist
@ 2024-01-20 21:09 ` Sui JIngfeng
2024-01-21 8:45 ` yetist
0 siblings, 1 reply; 14+ messages in thread
From: Sui JIngfeng @ 2024-01-20 21:09 UTC (permalink / raw)
To: yetist, Huacai Chen, David Airlie, Daniel Vetter, Huacai Chen
Cc: loongson-kernel@lists.loongnix.cn, dri-devel
Hi,
On 2024/1/21 00:07, yetist wrote:
> Without this patch, my server cannot start the DM. It is a Loongson
> 3C5000L server, with both a Loongson display controller and an ASPEED
> graphics card.
>
> $ lspci |grep VGA
> 0000:00:06.1 VGA Compatible Controller: Loongson Technology LLC DC
> (Display Controller) (rev 01)
> 0000:03:00.0 VGA-compatible controller: ASPEED Technology, Inc.
> ASPEED Graphics Family (revision 41)
>
> When not working, there is the following information in dmesg:
>
> loongson 0000:00:06.1: [drm] Private vram start: 0xe00472a6000,
> size: 0MiB
> Loongson 0000:00:06.1: [drm] *Error* Request (0MiB) failed
>
>
> Anyway, this patch works fine with my server now, thank you.
>
Does the sever you are using has a dedicated VRAM for the 0000:00:06.1?
If not, the driver shouldn't be probed. This also means that the 0000:00:06.1
(Display Controller) shouldn't be detected by Linux kernel, because there is
no way for this driver can works correctly on such a case.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: drm/loongson: Error out if no VRAM detected
2024-01-20 12:01 ` Katyusha
@ 2024-01-20 21:28 ` Sui JIngfeng
2024-01-21 7:07 ` Katyusha
0 siblings, 1 reply; 14+ messages in thread
From: Sui JIngfeng @ 2024-01-20 21:28 UTC (permalink / raw)
To: Katyusha, Huacai Chen, David Airlie, Daniel Vetter, Huacai Chen
Cc: loongson-kernel@lists.loongnix.cn, dri-devel
Hi,
On 2024/1/20 20:01, Katyusha wrote:
>
> Hi,
>
> This patch works fine with my Loongson 3A5000M laptop (L71), which has
> a 7A1000 chipset without VRAM.
>
>
Can you give more details about the hardware configuration about this laptop?
For example, by using 'lspci | grep VGA' command. I want to make sure if the
integrated display controller are there.
Normally, the integrated graphics should not be used if there is no dedicated
VRAM equipped. And the platform BIOS should disable it.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: drm/loongson: Error out if no VRAM detected
2024-01-20 21:28 ` Sui JIngfeng
@ 2024-01-21 7:07 ` Katyusha
2024-01-23 13:10 ` Sui Jingfeng
0 siblings, 1 reply; 14+ messages in thread
From: Katyusha @ 2024-01-21 7:07 UTC (permalink / raw)
To: Sui JIngfeng, Huacai Chen, David Airlie, Daniel Vetter,
Huacai Chen
Cc: loongson-kernel@lists.loongnix.cn, dri-devel
Hi,
On 2024/1/21 5:28, Sui JIngfeng wrote:
> Hi,
>
>
> On 2024/1/20 20:01, Katyusha wrote:
>>
>> Hi,
>>
>> This patch works fine with my Loongson 3A5000M laptop (L71), which
>> has a 7A1000 chipset without VRAM.
>>
>>
>
> Can you give more details about the hardware configuration about this
> laptop?
> For example, by using 'lspci | grep VGA' command. I want to make sure
> if the
> integrated display controller are there.
>
>
> Normally, the integrated graphics should not be used if there is no
> dedicated
> VRAM equipped. And the platform BIOS should disable it.
>
Here's my result of lspci:
$ sudo lspci -k | grep VGA
00:06.1 VGA compatible controller: Loongson Technology LLC DC (Display
Controller) (rev 01)
07:00.0 VGA compatible controller: Advanced Micro Devices, Inc.
[AMD/ATI] Oland [Radeon HD 8570 / R5 430 OEM / R7 240/340 / Radeon 520
OEM] (rev 87)
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: drm/loongson: Error out if no VRAM detected
2024-01-20 21:09 ` Sui JIngfeng
@ 2024-01-21 8:45 ` yetist
0 siblings, 0 replies; 14+ messages in thread
From: yetist @ 2024-01-21 8:45 UTC (permalink / raw)
To: Sui JIngfeng, Huacai Chen, David Airlie, Daniel Vetter,
Huacai Chen
Cc: loongson-kernel@lists.loongnix.cn, dri-devel
在 2024/1/21 05:09, Sui JIngfeng 写道:
> Hi,
>
>
> On 2024/1/21 00:07, yetist wrote:
>> Without this patch, my server cannot start the DM. It is a Loongson
>> 3C5000L server, with both a Loongson display controller and an ASPEED
>> graphics card.
>>
>> $ lspci |grep VGA
>> 0000:00:06.1 VGA Compatible Controller: Loongson Technology LLC DC
>> (Display Controller) (rev 01)
>> 0000:03:00.0 VGA-compatible controller: ASPEED Technology, Inc.
>> ASPEED Graphics Family (revision 41)
>>
>> When not working, there is the following information in dmesg:
>>
>> loongson 0000:00:06.1: [drm] Private vram start: 0xe00472a6000,
>> size: 0MiB
>> Loongson 0000:00:06.1: [drm] *Error* Request (0MiB) failed
>>
>>
>> Anyway, this patch works fine with my server now, thank you.
>>
>
> Does the sever you are using has a dedicated VRAM for the 0000:00:06.1?
>
This hardware has no VRAM.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] drm/loongson: Error out if no VRAM detected
2024-01-19 10:40 [PATCH] drm/loongson: Error out if no VRAM detected Huacai Chen
2024-01-19 16:18 ` Sui JIngfeng
@ 2024-01-23 1:21 ` Shi Pujin
2024-02-02 17:24 ` Sui Jingfeng
2 siblings, 0 replies; 14+ messages in thread
From: Shi Pujin @ 2024-01-23 1:21 UTC (permalink / raw)
To: Huacai Chen, David Airlie, Daniel Vetter, Huacai Chen,
Jingfeng Sui
Cc: dri-devel
[-- Attachment #1: Type: text/plain, Size: 1875 bytes --]
Hi,
This patch works fine with my Loongson 3A5000 laptop (GDC-1401), which
has a
7A1000 chipset without VRAM.
lspci |grep VGA
00:06.1 VGA compatible controller: Loongson Technology LLC DC (Display
Controller) (rev 01)
07:00.0 VGA compatible controller: Advanced Micro Devices, Inc.
[AMD/ATI] Oland [Radeon HD 8570 / R5 430 OEM / R7 240/340 / Radeon 520
OEM] (rev 87)
在 2024/1/19 18:40, Huacai Chen 写道:
> If there is no VRAM (it is true if there is a discreted card), we get
> such an error and Xorg fails to start:
>
> [ 136.401131] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
> [ 137.444342] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
> [ 138.871166] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
> [ 140.444078] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
> [ 142.403993] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
> [ 143.970625] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
> [ 145.862013] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
>
> So in lsdc_get_dedicated_vram() we error out if no VRAM (or VRAM is less
> than 1MB which is also an unusable case) detected.
>
> Signed-off-by: Huacai Chen<chenhuacai@loongson.cn>
> ---
> drivers/gpu/drm/loongson/lsdc_drv.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/loongson/lsdc_drv.c b/drivers/gpu/drm/loongson/lsdc_drv.c
> index 89ccc0c43169..d8ff60b46abe 100644
> --- a/drivers/gpu/drm/loongson/lsdc_drv.c
> +++ b/drivers/gpu/drm/loongson/lsdc_drv.c
> @@ -184,7 +184,7 @@ static int lsdc_get_dedicated_vram(struct lsdc_device *ldev,
> drm_info(ddev, "Dedicated vram start: 0x%llx, size: %uMiB\n",
> (u64)base, (u32)(size >> 20));
>
> - return 0;
> + return (size > SZ_1M) ? 0 : -ENODEV;
> }
>
> static struct lsdc_device *
[-- Attachment #2: Type: text/html, Size: 2468 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: drm/loongson: Error out if no VRAM detected
2024-01-21 7:07 ` Katyusha
@ 2024-01-23 13:10 ` Sui Jingfeng
0 siblings, 0 replies; 14+ messages in thread
From: Sui Jingfeng @ 2024-01-23 13:10 UTC (permalink / raw)
To: Katyusha, Huacai Chen, David Airlie, Daniel Vetter, Huacai Chen
Cc: loongson-kernel@lists.loongnix.cn, Li Chao, dri-devel
Hi,
CCing Li Chao <lichao@loongson.cn>
On 2024/1/21 15:07, Katyusha wrote:
> Hi,
>
> On 2024/1/21 5:28, Sui JIngfeng wrote:
>> Hi,
>>
>>
>> On 2024/1/20 20:01, Katyusha wrote:
>>>
>>> Hi,
>>>
>>> This patch works fine with my Loongson 3A5000M laptop (L71), which
>>> has a 7A1000 chipset without VRAM.
>>>
>>>
>>
>> Can you give more details about the hardware configuration about this
>> laptop?
>> For example, by using 'lspci | grep VGA' command. I want to make sure
>> if the
>> integrated display controller are there.
>>
>>
>> Normally, the integrated graphics should not be used if there is no
>> dedicated
>> VRAM equipped. And the platform BIOS should disable it.
>>
> Here's my result of lspci:
>
> $ sudo lspci -k | grep VGA
> 00:06.1 VGA compatible controller: Loongson Technology LLC DC (Display
> Controller) (rev 01)
> 07:00.0 VGA compatible controller: Advanced Micro Devices, Inc.
> [AMD/ATI] Oland [Radeon HD 8570 / R5 430 OEM / R7 240/340 / Radeon 520
> OEM] (rev 87)
>
Thanks a lot for feedback, please feed this back to Loongson UEFI firmware team.
Update the firmware, as this is not the right way to fix a bug.
When Loongson laptop or notebook is equipped with a Radeon GPU,
the integrated graphics will not be used. Besides don't has a
dedicated VRAM, it also don't has a external video transmitters.
Therefore, the integrate graphics are completely not usable.
Please disable it on such cases.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: drm/loongson: Error out if no VRAM detected
2024-01-19 16:18 ` Sui JIngfeng
` (2 preceding siblings ...)
2024-01-20 16:07 ` yetist
@ 2024-01-24 10:06 ` Huacai Chen
3 siblings, 0 replies; 14+ messages in thread
From: Huacai Chen @ 2024-01-24 10:06 UTC (permalink / raw)
To: Sui JIngfeng
Cc: loongson-kernel@lists.loongnix.cn, Daniel Vetter, David Airlie,
dri-devel, Huacai Chen
Hi, Jingfeng,
On Sat, Jan 20, 2024 at 12:19 AM Sui JIngfeng <sui.jingfeng@linux.dev> wrote:
>
> Hi,
>
> Thanks a lot for contribution.
>
> On 2024/1/19 18:40, Huacai Chen wrote:
> > If there is no VRAM (it is true if there is a discreted card),
>
>
> Why the dedicated VRAM is gone whenthere is a discrete card?
>
> As far as I know, this is only possible on Loongson 3C5000 + aspeed BMC
> server hardware platform where the dedicated VRAM chip of Loongson
> Graphics is NOT soldered on the motherboard. Probably for cost reason,
> but then, the platform BIOS(either UEFI or PMON) should turn off the
> Loongson integrated graphics.
>
> Because without dedicated VRAM, this driver can not work correctly. Or carve out
> part of system RAM as VRAM, and write the base address and size to the BAR 2 of
> the GPU PCI device.
> This is NOT true for Loongson 3A5000/3A6000 desktop hardware, because I have do
> a lot test on various platform[1] before this driver was merged. It never happens
> on a sane hardware configuration. Please update the commit message and limit the
> scope.
I will update in V2.
>
> [1] https://github.com/loongson-gfx/loongson_boards
>
> > we get
> > such an error and Xorg fails to start:
>
>
> Yeah, If there is no dedicated VRAM, the driver can't allocate memory for framebuffer.
> But this is probably more about the hardware configuration issue, not a driver issue.
I agree, but it seems we need a workaround in the driver because there
are already many machines with ill firmware.
>
>
> > [ 136.401131] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
> > [ 137.444342] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
> > [ 138.871166] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
> > [ 140.444078] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
> > [ 142.403993] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
> > [ 143.970625] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
> > [ 145.862013] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
> >
> > So in lsdc_get_dedicated_vram() we error out if no VRAM (or VRAM is less
> > than 1MB which is also an unusable case) detected.
>
>
> This is not expected, if you want this driver be there and run normally.
> You should guarantee that there have at least 64MiB dedicated VRAM.
I think this depends on the resolution, I choose 1MB here only because
the driver's debug info prints 0MB if VRAM is less than 1MB.
Huacai
>
> I'm OK if this patch is strongly requested, but this is a kind of error handling.
> Please give more details about the hardware in using and explain why there is no
> dedicated VRAM available for your hardware.
>
>
> > Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
> > ---
> > drivers/gpu/drm/loongson/lsdc_drv.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/loongson/lsdc_drv.c b/drivers/gpu/drm/loongson/lsdc_drv.c
> > index 89ccc0c43169..d8ff60b46abe 100644
> > --- a/drivers/gpu/drm/loongson/lsdc_drv.c
> > +++ b/drivers/gpu/drm/loongson/lsdc_drv.c
> > @@ -184,7 +184,7 @@ static int lsdc_get_dedicated_vram(struct lsdc_device *ldev,
> > drm_info(ddev, "Dedicated vram start: 0x%llx, size: %uMiB\n",
> > (u64)base, (u32)(size >> 20));
> >
> > - return 0;
> > + return (size > SZ_1M) ? 0 : -ENODEV;
> > }
> >
> > static struct lsdc_device *
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: drm/loongson: Error out if no VRAM detected
2024-01-19 10:40 [PATCH] drm/loongson: Error out if no VRAM detected Huacai Chen
2024-01-19 16:18 ` Sui JIngfeng
2024-01-23 1:21 ` [PATCH] " Shi Pujin
@ 2024-02-02 17:24 ` Sui Jingfeng
2024-02-06 4:05 ` Huacai Chen
2 siblings, 1 reply; 14+ messages in thread
From: Sui Jingfeng @ 2024-02-02 17:24 UTC (permalink / raw)
To: Huacai Chen, David Airlie, Daniel Vetter, Huacai Chen; +Cc: dri-devel
On 2024/1/19 18:40, Huacai Chen wrote:
> If there is no VRAM (it is true if there is a discreted card), we get
> such an error and Xorg fails to start:
>
> [ 136.401131] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
> [ 137.444342] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
> [ 138.871166] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
> [ 140.444078] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
> [ 142.403993] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
> [ 143.970625] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
> [ 145.862013] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
>
> So in lsdc_get_dedicated_vram() we error out if no VRAM (or VRAM is less
> than 1MB which is also an unusable case) detected.
>
> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
> ---
> drivers/gpu/drm/loongson/lsdc_drv.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/loongson/lsdc_drv.c b/drivers/gpu/drm/loongson/lsdc_drv.c
> index 89ccc0c43169..d8ff60b46abe 100644
> --- a/drivers/gpu/drm/loongson/lsdc_drv.c
> +++ b/drivers/gpu/drm/loongson/lsdc_drv.c
> @@ -184,7 +184,7 @@ static int lsdc_get_dedicated_vram(struct lsdc_device *ldev,
> drm_info(ddev, "Dedicated vram start: 0x%llx, size: %uMiB\n",
> (u64)base, (u32)(size >> 20));
>
> - return 0;
> + return (size > SZ_1M) ? 0 : -ENODEV;
I forget to tell you that you probably should return ENOSPC at here,
which stand for no space left on device, not the ENODEV.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: drm/loongson: Error out if no VRAM detected
2024-02-02 17:24 ` Sui Jingfeng
@ 2024-02-06 4:05 ` Huacai Chen
0 siblings, 0 replies; 14+ messages in thread
From: Huacai Chen @ 2024-02-06 4:05 UTC (permalink / raw)
To: Sui Jingfeng; +Cc: Huacai Chen, David Airlie, Daniel Vetter, dri-devel
On Sat, Feb 3, 2024 at 1:24 AM Sui Jingfeng <sui.jingfeng@linux.dev> wrote:
>
>
> On 2024/1/19 18:40, Huacai Chen wrote:
> > If there is no VRAM (it is true if there is a discreted card), we get
> > such an error and Xorg fails to start:
> >
> > [ 136.401131] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
> > [ 137.444342] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
> > [ 138.871166] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
> > [ 140.444078] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
> > [ 142.403993] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
> > [ 143.970625] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
> > [ 145.862013] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
> >
> > So in lsdc_get_dedicated_vram() we error out if no VRAM (or VRAM is less
> > than 1MB which is also an unusable case) detected.
> >
> > Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
> > ---
> > drivers/gpu/drm/loongson/lsdc_drv.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/loongson/lsdc_drv.c b/drivers/gpu/drm/loongson/lsdc_drv.c
> > index 89ccc0c43169..d8ff60b46abe 100644
> > --- a/drivers/gpu/drm/loongson/lsdc_drv.c
> > +++ b/drivers/gpu/drm/loongson/lsdc_drv.c
> > @@ -184,7 +184,7 @@ static int lsdc_get_dedicated_vram(struct lsdc_device *ldev,
> > drm_info(ddev, "Dedicated vram start: 0x%llx, size: %uMiB\n",
> > (u64)base, (u32)(size >> 20));
> >
> > - return 0;
> > + return (size > SZ_1M) ? 0 : -ENODEV;
>
>
> I forget to tell you that you probably should return ENOSPC at here,
> which stand for no space left on device, not the ENODEV.
Make sense, will do.
Huacai
>
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2024-02-06 4:05 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-19 10:40 [PATCH] drm/loongson: Error out if no VRAM detected Huacai Chen
2024-01-19 16:18 ` Sui JIngfeng
2024-01-20 10:15 ` Katyusha
2024-01-20 12:01 ` Katyusha
2024-01-20 21:28 ` Sui JIngfeng
2024-01-21 7:07 ` Katyusha
2024-01-23 13:10 ` Sui Jingfeng
2024-01-20 16:07 ` yetist
2024-01-20 21:09 ` Sui JIngfeng
2024-01-21 8:45 ` yetist
2024-01-24 10:06 ` Huacai Chen
2024-01-23 1:21 ` [PATCH] " Shi Pujin
2024-02-02 17:24 ` Sui Jingfeng
2024-02-06 4:05 ` Huacai Chen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).