Re: [PATCH V2] drm/amdgpu/display: Enable DC_FP for LoongArch
On 2023/5/5 19:32, Huacai Chen wrote: Now LoongArch provides kernel_fpu_begin() and kernel_fpu_end() in commit 2b3bd32ea3a22ea2d ("LoongArch: Provide kernel fpu functions"), so we can enable DC_FP for DCN devices. Some grammatical fixes and paraphrasing: "LoongArch now provides kernel_fpu_{begin,end} that are used like the x86 counterparts in commit 2b3bd32ea3a22ea2d ("LoongArch: Provide kernel fpu functions"), so we can now implement DRM_AMD_DC_FP on LoongArch for supporting more DCN devices." Signed-off-by: WANG Xuerui Signed-off-by: Huacai Chen I just finished my tests according to the link above and all seems fine. * Board: A2101 (Loongson 3A5000 with LS7A1000 bridge) - with the firmware provided at [1] * GPU: RX 6400 (PowerColor ITX RX6400 4GB GDDR6) * Display: Dell P2317H (connected via DisplayPort) * Kernel: next-20230505 with this patch (with the conflict resolved) * Sysroot: up-to-date Gentoo/LoongArch I've tested: * Desktop sessions: Xfce4, Plasma Wayland * Hot-plugging - at tty, at sddm, inside Plasma Wayland session, multiple times each * Changing resolutions * kms_flip tests: every non-skipped case passed (I can't test dual-monitor right now) [1]: https://github.com/loongson/Firmware/tree/main/5000Series/PC/A2101 Hence it's: Tested-by: WANG Xuerui --- V2: Update commit message to add the commit which provides kernel fpu functions. drivers/gpu/drm/amd/display/Kconfig| 2 +- drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c | 6 -- drivers/gpu/drm/amd/display/dc/dml/Makefile| 5 + 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/display/Kconfig b/drivers/gpu/drm/amd/display/Kconfig index 2d8e55e29637..49df073962d5 100644 --- a/drivers/gpu/drm/amd/display/Kconfig +++ b/drivers/gpu/drm/amd/display/Kconfig @@ -8,7 +8,7 @@ config DRM_AMD_DC depends on BROKEN || !CC_IS_CLANG || X86_64 || SPARC64 || ARM64 select SND_HDA_COMPONENT if SND_HDA_CORE # !CC_IS_CLANG: https://github.com/ClangBuiltLinux/linux/issues/1752 - select DRM_AMD_DC_FP if (X86 || (PPC64 && ALTIVEC) || (ARM64 && KERNEL_MODE_NEON && !CC_IS_CLANG)) + select DRM_AMD_DC_FP if (X86 || LOONGARCH || (PPC64 && ALTIVEC) || (ARM64 && KERNEL_MODE_NEON && !CC_IS_CLANG)) help Choose this option if you want to use the new display engine support for AMDGPU. This adds required support for Vega and diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c b/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c index 1743ca0a3641..86f4c0e04654 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c @@ -33,6 +33,8 @@ #include #elif defined(CONFIG_ARM64) #include +#elif defined(CONFIG_LOONGARCH) +#include #endif /** @@ -88,7 +90,7 @@ void dc_fpu_begin(const char *function_name, const int line) *pcpu += 1; if (*pcpu == 1) { -#if defined(CONFIG_X86) +#if defined(CONFIG_X86) || defined(CONFIG_LOONGARCH) kernel_fpu_begin(); And with the conflict here with linux-next resolved then we may be good to go. #elif defined(CONFIG_PPC64) if (cpu_has_feature(CPU_FTR_VSX_COMP)) { @@ -127,7 +129,7 @@ void dc_fpu_end(const char *function_name, const int line) pcpu = get_cpu_ptr(&fpu_recursion_depth); *pcpu -= 1; if (*pcpu <= 0) { -#if defined(CONFIG_X86) +#if defined(CONFIG_X86) || defined(CONFIG_LOONGARCH) kernel_fpu_end(); #elif defined(CONFIG_PPC64) if (cpu_has_feature(CPU_FTR_VSX_COMP)) { diff --git a/drivers/gpu/drm/amd/display/dc/dml/Makefile b/drivers/gpu/drm/amd/display/dc/dml/Makefile index 01db035589c5..542962a93e8f 100644 --- a/drivers/gpu/drm/amd/display/dc/dml/Makefile +++ b/drivers/gpu/drm/amd/display/dc/dml/Makefile @@ -38,6 +38,11 @@ ifdef CONFIG_ARM64 dml_rcflags := -mgeneral-regs-only endif +ifdef CONFIG_LOONGARCH +dml_ccflags := -mfpu=64 +dml_rcflags := -msoft-float +endif + ifdef CONFIG_CC_IS_GCC ifneq ($(call gcc-min-version, 70100),y) IS_OLD_GCC = 1 -- WANG "xen0n" Xuerui Linux/LoongArch mailing list: https://lore.kernel.org/loongarch/
Re: [PATCH V2] drm/amdgpu/display: Enable DC_FP for LoongArch
Hi, On 5/5/23 21:39, Hamza Mahfooz wrote: Hey Huacai, On 5/5/23 07:32, Huacai Chen wrote: Now LoongArch provides kernel_fpu_begin() and kernel_fpu_end() in commit 2b3bd32ea3a22ea2d ("LoongArch: Provide kernel fpu functions"), so we can enable DC_FP for DCN devices. Have you had the chance to test how well this is working on actual hardware, or was it only compile tested? If it was only compile tested, it would be great if you could run some tests. Please see the following for more details: https://lore.kernel.org/amd-gfx/8eb69dfb-ae35-dbf2-3f82-e8cc00e53...@amd.com/ Thanks for the helpful link! I did test an earlier version of this patch along with the arch/loongarch kernel FPU bits before that patch got upstreamed, with a RX 6400 (BEIGE_GOBY) on a Loongson 3A5000 + LS7A1000 system (by far the most popular combination for LoongArch desktops). Things like Plasma Wayland session or glmark2 work just fine, although I didn't go for the more complete testing as detailed in the mail you linked to. I'll try going through that procedure in the next 1~2 days when I have time & get physical access to that box. On a side note, I had to modprobe amdgpu with runpm=0, otherwise my dmesg gets flooded with PSP getting resumed every 8~10 seconds or so. I currently have none of the connectors plugged in. I didn't notice any similar reports on the Internet so I don't know if it's due to platform quirks or not. Signed-off-by: WANG Xuerui Signed-off-by: Huacai Chen --- V2: Update commit message to add the commit which provides kernel fpu functions. drivers/gpu/drm/amd/display/Kconfig | 2 +- drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c | 6 -- drivers/gpu/drm/amd/display/dc/dml/Makefile | 5 + 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/display/Kconfig b/drivers/gpu/drm/amd/display/Kconfig index 2d8e55e29637..49df073962d5 100644 --- a/drivers/gpu/drm/amd/display/Kconfig +++ b/drivers/gpu/drm/amd/display/Kconfig @@ -8,7 +8,7 @@ config DRM_AMD_DC depends on BROKEN || !CC_IS_CLANG || X86_64 || SPARC64 || ARM64 select SND_HDA_COMPONENT if SND_HDA_CORE # !CC_IS_CLANG: https://github.com/ClangBuiltLinux/linux/issues/1752 - select DRM_AMD_DC_FP if (X86 || (PPC64 && ALTIVEC) || (ARM64 && KERNEL_MODE_NEON && !CC_IS_CLANG)) + select DRM_AMD_DC_FP if (X86 || LOONGARCH || (PPC64 && ALTIVEC) || (ARM64 && KERNEL_MODE_NEON && !CC_IS_CLANG)) help Choose this option if you want to use the new display engine support for AMDGPU. This adds required support for Vega and diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c b/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c index 1743ca0a3641..86f4c0e04654 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c @@ -33,6 +33,8 @@ #include #elif defined(CONFIG_ARM64) #include +#elif defined(CONFIG_LOONGARCH) +#include #endif /** @@ -88,7 +90,7 @@ void dc_fpu_begin(const char *function_name, const int line) *pcpu += 1; if (*pcpu == 1) { -#if defined(CONFIG_X86) +#if defined(CONFIG_X86) || defined(CONFIG_LOONGARCH) kernel_fpu_begin(); This is going to conflict with commit b1bcdd409d2d ("drm/amd/display: Disable migration to ensure consistency of per-CPU variable"), which is present in next-20230505. Resolution is trivial though. #elif defined(CONFIG_PPC64) if (cpu_has_feature(CPU_FTR_VSX_COMP)) { @@ -127,7 +129,7 @@ void dc_fpu_end(const char *function_name, const int line) pcpu = get_cpu_ptr(&fpu_recursion_depth); *pcpu -= 1; if (*pcpu <= 0) { -#if defined(CONFIG_X86) +#if defined(CONFIG_X86) || defined(CONFIG_LOONGARCH) kernel_fpu_end(); #elif defined(CONFIG_PPC64) if (cpu_has_feature(CPU_FTR_VSX_COMP)) { diff --git a/drivers/gpu/drm/amd/display/dc/dml/Makefile b/drivers/gpu/drm/amd/display/dc/dml/Makefile index 01db035589c5..542962a93e8f 100644 --- a/drivers/gpu/drm/amd/display/dc/dml/Makefile +++ b/drivers/gpu/drm/amd/display/dc/dml/Makefile @@ -38,6 +38,11 @@ ifdef CONFIG_ARM64 dml_rcflags := -mgeneral-regs-only endif +ifdef CONFIG_LOONGARCH +dml_ccflags := -mfpu=64 +dml_rcflags := -msoft-float +endif + ifdef CONFIG_CC_IS_GCC ifneq ($(call gcc-min-version, 70100),y) IS_OLD_GCC = 1 -- WANG "xen0n" Xuerui Linux/LoongArch mailing list: https://lore.kernel.org/loongarch/
Re: [PATCH V2] drm/amdgpu/display: Enable DC_FP for LoongArch
On 5/6/23 02:00, Alex Deucher wrote: On Fri, May 5, 2023 at 1:57 PM WANG Xuerui wrote: On a side note, I had to modprobe amdgpu with runpm=0, otherwise my dmesg gets flooded with PSP getting resumed every 8~10 seconds or so. I currently have none of the connectors plugged in. I didn't notice any similar reports on the Internet so I don't know if it's due to platform quirks or not. That might just be part of the normal suspend/resume process. If it happens at regular intervals, it sounds like something is waking the GPU at a regular interval. We should probably remove that message to avoid it being too chatty, but you may want to check what is waking it so much as doing so sort of negates the value of runtime power management. Ah. This is extremely helpful as I'm immediately able to confirm it's node_exporter trying to access the hwmon readings (I have a monitoring infra for all my devboxes). Every sufficiently spaced read from say temp1_input wakes up the GPU. Not many people have their boxes working like this I guess... but at least we could probably reduce the log spam a bit if it's not feasible to get GPU metrics while avoiding to resume it? (Currently it's 25 lines per resume, mostly SMU resume logs and ring info.) And of course this is not a big deal, I can always work around it locally. Thanks for the hint again. -- WANG "xen0n" Xuerui Linux/LoongArch mailing list: https://lore.kernel.org/loongarch/
Re: [PATCH V2] drm/amdgpu/display: Enable DC_FP for LoongArch
Hi, Hamza, On Fri, May 5, 2023 at 9:37 PM Hamza Mahfooz wrote: > > > Hey Huacai, > > On 5/5/23 07:32, Huacai Chen wrote: > > Now LoongArch provides kernel_fpu_begin() and kernel_fpu_end() in commit > > 2b3bd32ea3a22ea2d ("LoongArch: Provide kernel fpu functions"), so we can > > enable DC_FP for DCN devices. > > Have you had the chance to test how well this is working on actual > hardware, or was it only compile tested? If it was only compile tested, > it would be great if you could run some tests. Please see the following > for more details: > https://lore.kernel.org/amd-gfx/8eb69dfb-ae35-dbf2-3f82-e8cc00e53...@amd.com/ I have tested hotplug, resolution changing and kms_flip in IGT, all of them works fine. Huacai > > > > > Signed-off-by: WANG Xuerui > > Signed-off-by: Huacai Chen > > --- > > V2: Update commit message to add the commit which provides kernel fpu > > functions. > > > > drivers/gpu/drm/amd/display/Kconfig| 2 +- > > drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c | 6 -- > > drivers/gpu/drm/amd/display/dc/dml/Makefile| 5 + > > 3 files changed, 10 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/gpu/drm/amd/display/Kconfig > > b/drivers/gpu/drm/amd/display/Kconfig > > index 2d8e55e29637..49df073962d5 100644 > > --- a/drivers/gpu/drm/amd/display/Kconfig > > +++ b/drivers/gpu/drm/amd/display/Kconfig > > @@ -8,7 +8,7 @@ config DRM_AMD_DC > > depends on BROKEN || !CC_IS_CLANG || X86_64 || SPARC64 || ARM64 > > select SND_HDA_COMPONENT if SND_HDA_CORE > > # !CC_IS_CLANG: https://github.com/ClangBuiltLinux/linux/issues/1752 > > - select DRM_AMD_DC_FP if (X86 || (PPC64 && ALTIVEC) || (ARM64 && > > KERNEL_MODE_NEON && !CC_IS_CLANG)) > > + select DRM_AMD_DC_FP if (X86 || LOONGARCH || (PPC64 && ALTIVEC) || > > (ARM64 && KERNEL_MODE_NEON && !CC_IS_CLANG)) > > help > > Choose this option if you want to use the new display engine > > support for AMDGPU. This adds required support for Vega and > > diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c > > b/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c > > index 1743ca0a3641..86f4c0e04654 100644 > > --- a/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c > > +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c > > @@ -33,6 +33,8 @@ > > #include > > #elif defined(CONFIG_ARM64) > > #include > > +#elif defined(CONFIG_LOONGARCH) > > +#include > > #endif > > > > /** > > @@ -88,7 +90,7 @@ void dc_fpu_begin(const char *function_name, const int > > line) > > *pcpu += 1; > > > > if (*pcpu == 1) { > > -#if defined(CONFIG_X86) > > +#if defined(CONFIG_X86) || defined(CONFIG_LOONGARCH) > > kernel_fpu_begin(); > > #elif defined(CONFIG_PPC64) > > if (cpu_has_feature(CPU_FTR_VSX_COMP)) { > > @@ -127,7 +129,7 @@ void dc_fpu_end(const char *function_name, const int > > line) > > pcpu = get_cpu_ptr(&fpu_recursion_depth); > > *pcpu -= 1; > > if (*pcpu <= 0) { > > -#if defined(CONFIG_X86) > > +#if defined(CONFIG_X86) || defined(CONFIG_LOONGARCH) > > kernel_fpu_end(); > > #elif defined(CONFIG_PPC64) > > if (cpu_has_feature(CPU_FTR_VSX_COMP)) { > > diff --git a/drivers/gpu/drm/amd/display/dc/dml/Makefile > > b/drivers/gpu/drm/amd/display/dc/dml/Makefile > > index 01db035589c5..542962a93e8f 100644 > > --- a/drivers/gpu/drm/amd/display/dc/dml/Makefile > > +++ b/drivers/gpu/drm/amd/display/dc/dml/Makefile > > @@ -38,6 +38,11 @@ ifdef CONFIG_ARM64 > > dml_rcflags := -mgeneral-regs-only > > endif > > > > +ifdef CONFIG_LOONGARCH > > +dml_ccflags := -mfpu=64 > > +dml_rcflags := -msoft-float > > +endif > > + > > ifdef CONFIG_CC_IS_GCC > > ifneq ($(call gcc-min-version, 70100),y) > > IS_OLD_GCC = 1 > -- > Hamza >
Re: [PATCH V2] drm/amdgpu/display: Enable DC_FP for LoongArch
On Fri, May 5, 2023 at 2:39 PM WANG Xuerui wrote: > > On 5/6/23 02:00, Alex Deucher wrote: > > On Fri, May 5, 2023 at 1:57 PM WANG Xuerui wrote: > >> > >> On a side note, I had to modprobe amdgpu with runpm=0, otherwise my > >> dmesg gets flooded with PSP getting resumed every 8~10 seconds or so. I > >> currently have none of the connectors plugged in. I didn't notice any > >> similar reports on the Internet so I don't know if it's due to platform > >> quirks or not. > > That might just be part of the normal suspend/resume process. If it > > happens at regular intervals, it sounds like something is waking the > > GPU at a regular interval. We should probably remove that message to > > avoid it being too chatty, but you may want to check what is waking it > > so much as doing so sort of negates the value of runtime power > > management. > > Ah. This is extremely helpful as I'm immediately able to confirm it's > node_exporter trying to access the hwmon readings (I have a monitoring > infra for all my devboxes). Every sufficiently spaced read from say > temp1_input wakes up the GPU. Not many people have their boxes working > like this I guess... but at least we could probably reduce the log spam > a bit if it's not feasible to get GPU metrics while avoiding to resume > it? (Currently it's 25 lines per resume, mostly SMU resume logs and ring Well, there are no metrics to pull because the GPU is powered down when in runtime suspend. Alex > info.) > > And of course this is not a big deal, I can always work around it > locally. Thanks for the hint again. > > -- > WANG "xen0n" Xuerui > > Linux/LoongArch mailing list: https://lore.kernel.org/loongarch/ >
Re: [PATCH V2] drm/amdgpu/display: Enable DC_FP for LoongArch
On Fri, May 5, 2023 at 1:57 PM WANG Xuerui wrote: > > Hi, > > On 5/5/23 21:39, Hamza Mahfooz wrote: > > > > Hey Huacai, > > > > On 5/5/23 07:32, Huacai Chen wrote: > >> Now LoongArch provides kernel_fpu_begin() and kernel_fpu_end() in commit > >> 2b3bd32ea3a22ea2d ("LoongArch: Provide kernel fpu functions"), so we can > >> enable DC_FP for DCN devices. > > > > Have you had the chance to test how well this is working on actual > > hardware, or was it only compile tested? If it was only compile tested, > > it would be great if you could run some tests. Please see the following > > for more details: > > https://lore.kernel.org/amd-gfx/8eb69dfb-ae35-dbf2-3f82-e8cc00e53...@amd.com/ > > > > > Thanks for the helpful link! > > I did test an earlier version of this patch along with the > arch/loongarch kernel FPU bits before that patch got upstreamed, with a > RX 6400 (BEIGE_GOBY) on a Loongson 3A5000 + LS7A1000 system (by far the > most popular combination for LoongArch desktops). Things like Plasma > Wayland session or glmark2 work just fine, although I didn't go for the > more complete testing as detailed in the mail you linked to. I'll try > going through that procedure in the next 1~2 days when I have time & get > physical access to that box. > > On a side note, I had to modprobe amdgpu with runpm=0, otherwise my > dmesg gets flooded with PSP getting resumed every 8~10 seconds or so. I > currently have none of the connectors plugged in. I didn't notice any > similar reports on the Internet so I don't know if it's due to platform > quirks or not. That might just be part of the normal suspend/resume process. If it happens at regular intervals, it sounds like something is waking the GPU at a regular interval. We should probably remove that message to avoid it being too chatty, but you may want to check what is waking it so much as doing so sort of negates the value of runtime power management. Alex > > >> > >> Signed-off-by: WANG Xuerui > >> Signed-off-by: Huacai Chen > >> --- > >> V2: Update commit message to add the commit which provides kernel fpu > >> functions. > >> > >> drivers/gpu/drm/amd/display/Kconfig| 2 +- > >> drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c | 6 -- > >> drivers/gpu/drm/amd/display/dc/dml/Makefile| 5 + > >> 3 files changed, 10 insertions(+), 3 deletions(-) > >> > >> diff --git a/drivers/gpu/drm/amd/display/Kconfig > >> b/drivers/gpu/drm/amd/display/Kconfig > >> index 2d8e55e29637..49df073962d5 100644 > >> --- a/drivers/gpu/drm/amd/display/Kconfig > >> +++ b/drivers/gpu/drm/amd/display/Kconfig > >> @@ -8,7 +8,7 @@ config DRM_AMD_DC > >> depends on BROKEN || !CC_IS_CLANG || X86_64 || SPARC64 || ARM64 > >> select SND_HDA_COMPONENT if SND_HDA_CORE > >> # !CC_IS_CLANG: > >> https://github.com/ClangBuiltLinux/linux/issues/1752 > >> -select DRM_AMD_DC_FP if (X86 || (PPC64 && ALTIVEC) || (ARM64 && > >> KERNEL_MODE_NEON && !CC_IS_CLANG)) > >> +select DRM_AMD_DC_FP if (X86 || LOONGARCH || (PPC64 && ALTIVEC) > >> || (ARM64 && KERNEL_MODE_NEON && !CC_IS_CLANG)) > >> help > >> Choose this option if you want to use the new display engine > >> support for AMDGPU. This adds required support for Vega and > >> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c > >> b/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c > >> index 1743ca0a3641..86f4c0e04654 100644 > >> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c > >> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c > >> @@ -33,6 +33,8 @@ > >> #include > >> #elif defined(CONFIG_ARM64) > >> #include > >> +#elif defined(CONFIG_LOONGARCH) > >> +#include > >> #endif > >> /** > >> @@ -88,7 +90,7 @@ void dc_fpu_begin(const char *function_name, const > >> int line) > >> *pcpu += 1; > >> if (*pcpu == 1) { > >> -#if defined(CONFIG_X86) > >> +#if defined(CONFIG_X86) || defined(CONFIG_LOONGARCH) > >> kernel_fpu_begin(); > This is going to conflict with commit b1bcdd409d2d ("drm/amd/display: > Disable migration to ensure consistency of per-CPU variable"), which is > present in next-20230505. Resolution is trivial though. > >> #elif defined(CONFIG_PPC64) > >> if (cpu_has_feature(CPU_FTR_VSX_COMP)) { > >> @@ -127,7 +129,7 @@ void dc_fpu_end(const char *function_name, const > >> int line) > >> pcpu = get_cpu_ptr(&fpu_recursion_depth); > >> *pcpu -= 1; > >> if (*pcpu <= 0) { > >> -#if defined(CONFIG_X86) > >> +#if defined(CONFIG_X86) || defined(CONFIG_LOONGARCH) > >> kernel_fpu_end(); > >> #elif defined(CONFIG_PPC64) > >> if (cpu_has_feature(CPU_FTR_VSX_COMP)) { > >> diff --git a/drivers/gpu/drm/amd/display/dc/dml/Makefile > >> b/drivers/gpu/drm/amd/display/dc/dml/Makefile > >> index 01db035589c5..542962a93e8f 100644 > >> --- a/drivers/gpu/drm/amd/display/dc/dml/Makefile > >> +++ b/drivers/gpu/drm/amd/display/dc/dml/Makefile > >> @@ -38,6 +38,11 @@ ifdef CONFIG_ARM64 > >> dm
Re: [PATCH V2] drm/amdgpu/display: Enable DC_FP for LoongArch
Hey Huacai, On 5/5/23 07:32, Huacai Chen wrote: Now LoongArch provides kernel_fpu_begin() and kernel_fpu_end() in commit 2b3bd32ea3a22ea2d ("LoongArch: Provide kernel fpu functions"), so we can enable DC_FP for DCN devices. Have you had the chance to test how well this is working on actual hardware, or was it only compile tested? If it was only compile tested, it would be great if you could run some tests. Please see the following for more details: https://lore.kernel.org/amd-gfx/8eb69dfb-ae35-dbf2-3f82-e8cc00e53...@amd.com/ Signed-off-by: WANG Xuerui Signed-off-by: Huacai Chen --- V2: Update commit message to add the commit which provides kernel fpu functions. drivers/gpu/drm/amd/display/Kconfig| 2 +- drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c | 6 -- drivers/gpu/drm/amd/display/dc/dml/Makefile| 5 + 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/display/Kconfig b/drivers/gpu/drm/amd/display/Kconfig index 2d8e55e29637..49df073962d5 100644 --- a/drivers/gpu/drm/amd/display/Kconfig +++ b/drivers/gpu/drm/amd/display/Kconfig @@ -8,7 +8,7 @@ config DRM_AMD_DC depends on BROKEN || !CC_IS_CLANG || X86_64 || SPARC64 || ARM64 select SND_HDA_COMPONENT if SND_HDA_CORE # !CC_IS_CLANG: https://github.com/ClangBuiltLinux/linux/issues/1752 - select DRM_AMD_DC_FP if (X86 || (PPC64 && ALTIVEC) || (ARM64 && KERNEL_MODE_NEON && !CC_IS_CLANG)) + select DRM_AMD_DC_FP if (X86 || LOONGARCH || (PPC64 && ALTIVEC) || (ARM64 && KERNEL_MODE_NEON && !CC_IS_CLANG)) help Choose this option if you want to use the new display engine support for AMDGPU. This adds required support for Vega and diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c b/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c index 1743ca0a3641..86f4c0e04654 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c @@ -33,6 +33,8 @@ #include #elif defined(CONFIG_ARM64) #include +#elif defined(CONFIG_LOONGARCH) +#include #endif /** @@ -88,7 +90,7 @@ void dc_fpu_begin(const char *function_name, const int line) *pcpu += 1; if (*pcpu == 1) { -#if defined(CONFIG_X86) +#if defined(CONFIG_X86) || defined(CONFIG_LOONGARCH) kernel_fpu_begin(); #elif defined(CONFIG_PPC64) if (cpu_has_feature(CPU_FTR_VSX_COMP)) { @@ -127,7 +129,7 @@ void dc_fpu_end(const char *function_name, const int line) pcpu = get_cpu_ptr(&fpu_recursion_depth); *pcpu -= 1; if (*pcpu <= 0) { -#if defined(CONFIG_X86) +#if defined(CONFIG_X86) || defined(CONFIG_LOONGARCH) kernel_fpu_end(); #elif defined(CONFIG_PPC64) if (cpu_has_feature(CPU_FTR_VSX_COMP)) { diff --git a/drivers/gpu/drm/amd/display/dc/dml/Makefile b/drivers/gpu/drm/amd/display/dc/dml/Makefile index 01db035589c5..542962a93e8f 100644 --- a/drivers/gpu/drm/amd/display/dc/dml/Makefile +++ b/drivers/gpu/drm/amd/display/dc/dml/Makefile @@ -38,6 +38,11 @@ ifdef CONFIG_ARM64 dml_rcflags := -mgeneral-regs-only endif +ifdef CONFIG_LOONGARCH +dml_ccflags := -mfpu=64 +dml_rcflags := -msoft-float +endif + ifdef CONFIG_CC_IS_GCC ifneq ($(call gcc-min-version, 70100),y) IS_OLD_GCC = 1 -- Hamza
[PATCH V2] drm/amdgpu/display: Enable DC_FP for LoongArch
Now LoongArch provides kernel_fpu_begin() and kernel_fpu_end() in commit 2b3bd32ea3a22ea2d ("LoongArch: Provide kernel fpu functions"), so we can enable DC_FP for DCN devices. Signed-off-by: WANG Xuerui Signed-off-by: Huacai Chen --- V2: Update commit message to add the commit which provides kernel fpu functions. drivers/gpu/drm/amd/display/Kconfig| 2 +- drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c | 6 -- drivers/gpu/drm/amd/display/dc/dml/Makefile| 5 + 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/display/Kconfig b/drivers/gpu/drm/amd/display/Kconfig index 2d8e55e29637..49df073962d5 100644 --- a/drivers/gpu/drm/amd/display/Kconfig +++ b/drivers/gpu/drm/amd/display/Kconfig @@ -8,7 +8,7 @@ config DRM_AMD_DC depends on BROKEN || !CC_IS_CLANG || X86_64 || SPARC64 || ARM64 select SND_HDA_COMPONENT if SND_HDA_CORE # !CC_IS_CLANG: https://github.com/ClangBuiltLinux/linux/issues/1752 - select DRM_AMD_DC_FP if (X86 || (PPC64 && ALTIVEC) || (ARM64 && KERNEL_MODE_NEON && !CC_IS_CLANG)) + select DRM_AMD_DC_FP if (X86 || LOONGARCH || (PPC64 && ALTIVEC) || (ARM64 && KERNEL_MODE_NEON && !CC_IS_CLANG)) help Choose this option if you want to use the new display engine support for AMDGPU. This adds required support for Vega and diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c b/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c index 1743ca0a3641..86f4c0e04654 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c @@ -33,6 +33,8 @@ #include #elif defined(CONFIG_ARM64) #include +#elif defined(CONFIG_LOONGARCH) +#include #endif /** @@ -88,7 +90,7 @@ void dc_fpu_begin(const char *function_name, const int line) *pcpu += 1; if (*pcpu == 1) { -#if defined(CONFIG_X86) +#if defined(CONFIG_X86) || defined(CONFIG_LOONGARCH) kernel_fpu_begin(); #elif defined(CONFIG_PPC64) if (cpu_has_feature(CPU_FTR_VSX_COMP)) { @@ -127,7 +129,7 @@ void dc_fpu_end(const char *function_name, const int line) pcpu = get_cpu_ptr(&fpu_recursion_depth); *pcpu -= 1; if (*pcpu <= 0) { -#if defined(CONFIG_X86) +#if defined(CONFIG_X86) || defined(CONFIG_LOONGARCH) kernel_fpu_end(); #elif defined(CONFIG_PPC64) if (cpu_has_feature(CPU_FTR_VSX_COMP)) { diff --git a/drivers/gpu/drm/amd/display/dc/dml/Makefile b/drivers/gpu/drm/amd/display/dc/dml/Makefile index 01db035589c5..542962a93e8f 100644 --- a/drivers/gpu/drm/amd/display/dc/dml/Makefile +++ b/drivers/gpu/drm/amd/display/dc/dml/Makefile @@ -38,6 +38,11 @@ ifdef CONFIG_ARM64 dml_rcflags := -mgeneral-regs-only endif +ifdef CONFIG_LOONGARCH +dml_ccflags := -mfpu=64 +dml_rcflags := -msoft-float +endif + ifdef CONFIG_CC_IS_GCC ifneq ($(call gcc-min-version, 70100),y) IS_OLD_GCC = 1 -- 2.39.1