Skip to contentSkip to conversation

RISC-V: ACPI: Enable CPPC based cpufreq support

PATCH Applied Sunil V L 7 participants 16 messages Feb 8, 2024 – Mar 21, 2024

Subsystems (4)
lore
Share & tools
lore

Sunil V L

author maintainer
#0 lore raw

cover RISC-V: ACPI: Enable CPPC based cpufreq support

This series enables the support for "Collaborative Processor Performance Control (CPPC) on ACPI based RISC-V platforms. It depends on the encoding of CPPC registers as defined in RISC-V FFH spec [2].

CPPC is described in the ACPI spec [1]. RISC-V FFH spec required to enable this, is available at [2].

[1] - https://uefi.org/specs/ACPI/6.5/08_Processor_Configuration_and_Control.html#collaborative-processor-performance-control
[2] - https://github.com/riscv-non-isa/riscv-acpi-ffh/releases/download/v1.0.0/riscv-ffh.pdf

The series is based on the LPI support series.
Based-on: [email protected]
(https://lore.kernel.org/lkml/[email protected]/)

Sunil V L (3):
ACPI: RISC-V: Add CPPC driver
cpufreq: Move CPPC configs to common Kconfig and add RISC-V
RISC-V: defconfig: Enable CONFIG_ACPI_CPPC_CPUFREQ

 arch/riscv/configs/defconfig |   1 +
 drivers/acpi/riscv/Makefile  |   1 +
 drivers/acpi/riscv/cppc.c    | 157 +++++++++++++++++++++++++++++++++++
 drivers/cpufreq/Kconfig      |  29 +++++++
 drivers/cpufreq/Kconfig.arm  |  26 ------
 5 files changed, 188 insertions(+), 26 deletions(-)
 create mode 100644 drivers/acpi/riscv/cppc.c
Signature · 1 line
2.34.1
author maintainer
#1 lore raw

PATCH 1/3 ACPI: RISC-V: Add CPPC driver

Add cpufreq driver based on ACPI CPPC for RISC-V. The driver uses either SBI CPPC interfaces or the CSRs to access the CPPC registers as defined by the RISC-V FFH spec.

---
 drivers/acpi/riscv/Makefile |   1 +
 drivers/acpi/riscv/cppc.c   | 157 ++++++++++++++++++++++++++++++++++++
 2 files changed, 158 insertions(+)
 create mode 100644 drivers/acpi/riscv/cppc.c
drivers/acpi/riscv/Makefile +1 -0
index 7309d92dd477..86b0925f612d 100644
@@ -1,3 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0-only
 obj-y					+= rhct.o
 obj-$(CONFIG_ACPI_PROCESSOR_IDLE)	+= cpuidle.o
+obj-$(CONFIG_ACPI_CPPC_LIB)		+= cppc.o
drivers/acpi/riscv/cppc.c new file +157 -0

157 lines not on this page · raw message

Signature · 1 line
2.34.1
author maintainer
#2 lore raw

PATCH 2/3 cpufreq: Move CPPC configs to common Kconfig and add RISC-V

In reply to Sunil V L

CPPC related config options are currently defined only in ARM specific file. However, they are required for RISC-V as well. Instead of creating a new Kconfig.riscv file and duplicating them, move them to the common Kconfig file and enable RISC-V too.

---
 drivers/cpufreq/Kconfig     | 29 +++++++++++++++++++++++++++++
 drivers/cpufreq/Kconfig.arm | 26 --------------------------
 2 files changed, 29 insertions(+), 26 deletions(-)
drivers/cpufreq/Kconfig +29 -0
index 35efb53d5492..94e55c40970a 100644
@@ -302,4 +302,33 @@ config QORIQ_CPUFREQ
 	  which are capable of changing the CPU's frequency dynamically.
 
 endif
+
+config ACPI_CPPC_CPUFREQ
+	tristate "CPUFreq driver based on the ACPI CPPC spec"
+	depends on ACPI_PROCESSOR
+	depends on ARM || ARM64 || RISCV
+	select ACPI_CPPC_LIB
+	help
+	  This adds a CPUFreq driver which uses CPPC methods
+	  as described in the ACPIv5.1 spec. CPPC stands for
+	  Collaborative Processor Performance Controls. It
+	  is based on an abstract continuous scale of CPU
+	  performance values which allows the remote power
+	  processor to flexibly optimize for power and
+	  performance. CPPC relies on power management firmware
+	  support for its operation.
+
+	  If in doubt, say N.
+
+config ACPI_CPPC_CPUFREQ_FIE
+	bool "Frequency Invariance support for CPPC cpufreq driver"
+	depends on ACPI_CPPC_CPUFREQ && GENERIC_ARCH_TOPOLOGY
+	depends on ARM || ARM64 || RISCV
+	default y
+	help
+	  This extends frequency invariance support in the CPPC cpufreq driver,
+	  by using CPPC delivered and reference performance counters.
+
+	  If in doubt, say N.
+
 endmenu
drivers/cpufreq/Kconfig.arm +0 -26
index f911606897b8..987b3d900a89 100644
@@ -3,32 +3,6 @@
 # ARM CPU Frequency scaling drivers
 #
 
-config ACPI_CPPC_CPUFREQ
-	tristate "CPUFreq driver based on the ACPI CPPC spec"
-	depends on ACPI_PROCESSOR
-	select ACPI_CPPC_LIB
-	help
-	  This adds a CPUFreq driver which uses CPPC methods
-	  as described in the ACPIv5.1 spec. CPPC stands for
-	  Collaborative Processor Performance Controls. It
-	  is based on an abstract continuous scale of CPU
-	  performance values which allows the remote power
-	  processor to flexibly optimize for power and
-	  performance. CPPC relies on power management firmware
-	  support for its operation.
-
-	  If in doubt, say N.
-
-config ACPI_CPPC_CPUFREQ_FIE
-	bool "Frequency Invariance support for CPPC cpufreq driver"
-	depends on ACPI_CPPC_CPUFREQ && GENERIC_ARCH_TOPOLOGY
-	default y
-	help
-	  This extends frequency invariance support in the CPPC cpufreq driver,
-	  by using CPPC delivered and reference performance counters.
-
-	  If in doubt, say N.
-
 config ARM_ALLWINNER_SUN50I_CPUFREQ_NVMEM
 	tristate "Allwinner nvmem based SUN50I CPUFreq driver"
 	depends on ARCH_SUNXI
Signature · 1 line
2.34.1
author maintainer
#4 lore raw

PATCH 3/3 RISC-V: defconfig: Enable CONFIG_ACPI_CPPC_CPUFREQ

In reply to Sunil V L

CONFIG_ACPI_CPPC_CPUFREQ is required to enable CPPC for RISC-V.

---
 arch/riscv/configs/defconfig | 1 +
 1 file changed, 1 insertion(+)
arch/riscv/configs/defconfig +1 -0
index eaf34e871e30..2988ecd3eb4d 100644
@@ -44,6 +44,7 @@ CONFIG_CPU_FREQ_GOV_USERSPACE=y
 CONFIG_CPU_FREQ_GOV_ONDEMAND=y
 CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m
 CONFIG_CPUFREQ_DT=y
+CONFIG_ACPI_CPPC_CPUFREQ=m
 CONFIG_VIRTUALIZATION=y
 CONFIG_KVM=m
 CONFIG_ACPI=y
Signature · 1 line
2.34.1
Reviewed-by on the v1 series
#5 lore raw
In reply to Sunil V L

The code looks good to me, so FWIW:

+Sudeep as this touches cppc/arm in case he didn't see the patches

Quoted 27 lines · Sunil V L

This series enables the support for "Collaborative Processor Performance Control (CPPC) on ACPI based RISC-V platforms. It depends on the encoding of CPPC registers as defined in RISC-V FFH spec [2].

CPPC is described in the ACPI spec [1]. RISC-V FFH spec required to enable this, is available at [2].

[1] - https://uefi.org/specs/ACPI/6.5/08_Processor_Configuration_and_Control.html#collaborative-processor-performance-control
[2] - https://github.com/riscv-non-isa/riscv-acpi-ffh/releases/download/v1.0.0/riscv-ffh.pdf

The series is based on the LPI support series.
Based-on: [email protected]
(https://lore.kernel.org/lkml/[email protected]/)

Sunil V L (3):
ACPI: RISC-V: Add CPPC driver
cpufreq: Move CPPC configs to common Kconfig and add RISC-V
RISC-V: defconfig: Enable CONFIG_ACPI_CPPC_CPUFREQ

  arch/riscv/configs/defconfig |   1 +
  drivers/acpi/riscv/Makefile  |   1 +
  drivers/acpi/riscv/cppc.c    | 157 +++++++++++++++++++++++++++++++++++
  drivers/cpufreq/Kconfig      |  29 +++++++
  drivers/cpufreq/Kconfig.arm  |  26 ------
  5 files changed, 188 insertions(+), 26 deletions(-)

create mode 100644 drivers/acpi/riscv/cppc.c

maintainer Acked-by on the v1 series
#7 lore raw
In reply to Sunil V L
Quoted 28 lines · Sunil V L

This series enables the support for "Collaborative Processor Performance Control (CPPC) on ACPI based RISC-V platforms. It depends on the encoding of CPPC registers as defined in RISC-V FFH spec [2].

CPPC is described in the ACPI spec [1]. RISC-V FFH spec required to enable this, is available at [2].

[1] - https://uefi.org/specs/ACPI/6.5/08_Processor_Configuration_and_Control.html#collaborative-processor-performance-control
[2] - https://github.com/riscv-non-isa/riscv-acpi-ffh/releases/download/v1.0.0/riscv-ffh.pdf

The series is based on the LPI support series.
Based-on: [email protected]
(https://lore.kernel.org/lkml/[email protected]/)

Sunil V L (3):
ACPI: RISC-V: Add CPPC driver
cpufreq: Move CPPC configs to common Kconfig and add RISC-V
RISC-V: defconfig: Enable CONFIG_ACPI_CPPC_CPUFREQ

 arch/riscv/configs/defconfig |   1 +
 drivers/acpi/riscv/Makefile  |   1 +
 drivers/acpi/riscv/cppc.c    | 157 +++++++++++++++++++++++++++++++++++
 drivers/cpufreq/Kconfig      |  29 +++++++
 drivers/cpufreq/Kconfig.arm  |  26 ------
 5 files changed, 188 insertions(+), 26 deletions(-)
 create mode 100644 drivers/acpi/riscv/cppc.c
Quoted 1 line

--

This is fine with me, so

and it would be good to ask Viresh (who maintains the CPPC cpufreq driver) for an ACK.

Thanks!

maintainer Acked-by on v1 2/3
#3 lore raw

Re: [PATCH v1 -next 2/3] cpufreq: Move CPPC configs to common Kconfig and add RISC-V

In reply to Sunil V L
Quoted 10 lines · Sunil V L

CPPC related config options are currently defined only in ARM specific file. However, they are required for RISC-V as well. Instead of creating a new Kconfig.riscv file and duplicating them, move them to the common Kconfig file and enable RISC-V too.

---
 drivers/cpufreq/Kconfig     | 29 +++++++++++++++++++++++++++++
 drivers/cpufreq/Kconfig.arm | 26 --------------------------
 2 files changed, 29 insertions(+), 26 deletions(-)
Signature · 1 line
viresh
maintainer
#8 lore raw
In reply to Rafael J. Wysocki
Quoted 29 lines · Rafael J. Wysocki
Quoted 28 lines · Sunil V L

This series enables the support for "Collaborative Processor Performance Control (CPPC) on ACPI based RISC-V platforms. It depends on the encoding of CPPC registers as defined in RISC-V FFH spec [2].

CPPC is described in the ACPI spec [1]. RISC-V FFH spec required to enable this, is available at [2].

[1] - https://uefi.org/specs/ACPI/6.5/08_Processor_Configuration_and_Control.html#collaborative-processor-performance-control
[2] - https://github.com/riscv-non-isa/riscv-acpi-ffh/releases/download/v1.0.0/riscv-ffh.pdf

The series is based on the LPI support series.
Based-on: [email protected]
(https://lore.kernel.org/lkml/[email protected]/)

Sunil V L (3):
ACPI: RISC-V: Add CPPC driver
cpufreq: Move CPPC configs to common Kconfig and add RISC-V
RISC-V: defconfig: Enable CONFIG_ACPI_CPPC_CPUFREQ

 arch/riscv/configs/defconfig |   1 +
 drivers/acpi/riscv/Makefile  |   1 +
 drivers/acpi/riscv/cppc.c    | 157 +++++++++++++++++++++++++++++++++++
 drivers/cpufreq/Kconfig      |  29 +++++++
 drivers/cpufreq/Kconfig.arm  |  26 ------
 5 files changed, 188 insertions(+), 26 deletions(-)
 create mode 100644 drivers/acpi/riscv/cppc.c
Quoted 8 lines
Quoted 1 line

--

This is fine with me, so

and it would be good to ask Viresh (who maintains the CPPC cpufreq driver) for an ACK.

I have provided my Ack over the cpufreq patch. Thanks.

Signature · 1 line
viresh
Acked-by
#6 lore raw
In reply to Pierre Gondois
Quoted 5 lines · Pierre Gondois

The code looks good to me, so FWIW:

+Sudeep as this touches cppc/arm in case he didn't see the patches

Thanks!

Quoted 15 lines · Sunil V L
Quoted 14 lines

This series enables the support for "Collaborative Processor Performance Control (CPPC) on ACPI based RISC-V platforms. It depends on the encoding of CPPC registers as defined in RISC-V FFH spec [2].

CPPC is described in the ACPI spec [1]. RISC-V FFH spec required to enable this, is available at [2].

[1] - https://uefi.org/specs/ACPI/6.5/08_Processor_Configuration_and_Control.html#collaborative-processor-performance-control
[2] - https://github.com/riscv-non-isa/riscv-acpi-ffh/releases/download/v1.0.0/riscv-ffh.pdf

The series is based on the LPI support series.
Based-on: [email protected]
(https://lore.kernel.org/lkml/[email protected]/)

Quoted 5 lines
Quoted 5 lines

Sunil V L (3):
ACPI: RISC-V: Add CPPC driver
cpufreq: Move CPPC configs to common Kconfig and add RISC-V
RISC-V: defconfig: Enable CONFIG_ACPI_CPPC_CPUFREQ

Looks good to me.

--
Regards,
Sudeep

#9 lore raw
In reply to Sunil V L
Quoted 7 lines · Sunil V L

This series enables the support for "Collaborative Processor Performance Control (CPPC) on ACPI based RISC-V platforms. It depends on the encoding of CPPC registers as defined in RISC-V FFH spec [2].

CPPC is described in the ACPI spec [1]. RISC-V FFH spec required to enable this, is available at [2].

Quoted 6 lines

[1] - https://uefi.org/specs/ACPI/6.5/08_Processor_Configuration_and_Control.html#collaborative-processor-performance-control
[2] - https://github.com/riscv-non-isa/riscv-acpi-ffh/releases/download/v1.0.0/riscv-ffh.pdf

The series is based on the LPI support series.
Based-on: [email protected]
(https://lore.kernel.org/lkml/[email protected]/)

Should the https://github.com/vlsunil/qemu/tree/lpi_exp branch also be used for this CPPC series too?

Thanks,
Drew

#10 lore raw
Quoted 11 lines · Drew Fustini
Quoted 10 lines · Sunil V L

This series enables the support for "Collaborative Processor Performance Control (CPPC) on ACPI based RISC-V platforms. It depends on the encoding of CPPC registers as defined in RISC-V FFH spec [2].

CPPC is described in the ACPI spec [1]. RISC-V FFH spec required to enable this, is available at [2].

[1] - https://uefi.org/specs/ACPI/6.5/08_Processor_Configuration_and_Control.html#collaborative-processor-performance-control
[2] - https://github.com/riscv-non-isa/riscv-acpi-ffh/releases/download/v1.0.0/riscv-ffh.pdf

Quoted 6 lines
Quoted 3 lines

The series is based on the LPI support series.
Based-on: [email protected]
(https://lore.kernel.org/lkml/[email protected]/)

Should the https://github.com/vlsunil/qemu/tree/lpi_exp branch also be used for this CPPC series too?

I noticed the ventanamicro qemu repo has a dev-upstream branch [1] which contains 4bb6ba4d0fb9 ("riscv/virt: acpi: Enable CPPC - _CPC and _PSD"). I've built that but I still see 'SBI CPPC extension NOT detected!!' in the Linux boot log.

I'm using upstream opensbi. It seems that sbi_cppc_probe() fails because cppc_dev is not set. Nothing in the upstream opensbi repo seems to call sbi_cppc_set_device(), so I am uncertain how it is possible for it to work. Is there an opensbi branch I should be using?

Thanks,
Drew

[1] https://github.com/ventanamicro/qemu/tree/dev-upstream

author maintainer
#11 lore raw
Quoted 29 lines · Drew Fustini
Quoted 11 lines · Drew Fustini
Quoted 10 lines · Sunil V L

This series enables the support for "Collaborative Processor Performance Control (CPPC) on ACPI based RISC-V platforms. It depends on the encoding of CPPC registers as defined in RISC-V FFH spec [2].

CPPC is described in the ACPI spec [1]. RISC-V FFH spec required to enable this, is available at [2].

[1] - https://uefi.org/specs/ACPI/6.5/08_Processor_Configuration_and_Control.html#collaborative-processor-performance-control
[2] - https://github.com/riscv-non-isa/riscv-acpi-ffh/releases/download/v1.0.0/riscv-ffh.pdf

Quoted 6 lines
Quoted 3 lines

The series is based on the LPI support series.
Based-on: [email protected]
(https://lore.kernel.org/lkml/[email protected]/)

Should the https://github.com/vlsunil/qemu/tree/lpi_exp branch also be used for this CPPC series too?

I noticed the ventanamicro qemu repo has a dev-upstream branch [1] which contains 4bb6ba4d0fb9 ("riscv/virt: acpi: Enable CPPC - _CPC and _PSD"). I've built that but I still see 'SBI CPPC extension NOT detected!!' in the Linux boot log.

I'm using upstream opensbi. It seems that sbi_cppc_probe() fails because cppc_dev is not set. Nothing in the upstream opensbi repo seems to call sbi_cppc_set_device(), so I am uncertain how it is possible for it to work. Is there an opensbi branch I should be using?

Quoted 4 lines

Thanks,
Drew

[1] https://github.com/ventanamicro/qemu/tree/dev-upstream

Please use below branches for qemu and opensbi. These are just dummy objects/interfaces added to test the kernel change which are otherwise platform specific features.

https://github.com/vlsunil/qemu/tree/lpi_cppc_exp
https://github.com/vlsunil/opensbi/tree/cppc_exp

Regards
Sunil

#12 lore raw
Quoted 33 lines · Sunil V L
Quoted 32 lines · Drew Fustini
Quoted 11 lines · Drew Fustini
Quoted 10 lines · Sunil V L

This series enables the support for "Collaborative Processor Performance Control (CPPC) on ACPI based RISC-V platforms. It depends on the encoding of CPPC registers as defined in RISC-V FFH spec [2].

CPPC is described in the ACPI spec [1]. RISC-V FFH spec required to enable this, is available at [2].

[1] - https://uefi.org/specs/ACPI/6.5/08_Processor_Configuration_and_Control.html#collaborative-processor-performance-control
[2] - https://github.com/riscv-non-isa/riscv-acpi-ffh/releases/download/v1.0.0/riscv-ffh.pdf

Quoted 6 lines
Quoted 3 lines

The series is based on the LPI support series.
Based-on: [email protected]
(https://lore.kernel.org/lkml/[email protected]/)

Should the https://github.com/vlsunil/qemu/tree/lpi_exp branch also be used for this CPPC series too?

I noticed the ventanamicro qemu repo has a dev-upstream branch [1] which contains 4bb6ba4d0fb9 ("riscv/virt: acpi: Enable CPPC - _CPC and _PSD"). I've built that but I still see 'SBI CPPC extension NOT detected!!' in the Linux boot log.

I'm using upstream opensbi. It seems that sbi_cppc_probe() fails because cppc_dev is not set. Nothing in the upstream opensbi repo seems to call sbi_cppc_set_device(), so I am uncertain how it is possible for it to work. Is there an opensbi branch I should be using?

Thanks,
Drew

Quoted 8 lines
Quoted 1 line

[1] https://github.com/ventanamicro/qemu/tree/dev-upstream

Please use below branches for qemu and opensbi. These are just dummy objects/interfaces added to test the kernel change which are otherwise platform specific features.

https://github.com/vlsunil/qemu/tree/lpi_cppc_exp
https://github.com/vlsunil/opensbi/tree/cppc_exp

Thank you for providing those branches.

The CPPC extension is now detected okay during boot but I see the following in the boot log [1]:

[    1.094707] cpufreq: cpufreq_online: ->get() failed

Have you seen that too?

This appears to be from the following in drivers/cpufreq/cpufreq.c

1500 if (cpufreq_driver->get && has_target()) {
1501 policy->cur = cpufreq_driver->get(policy->cpu);
1502 if (!policy->cur) {

1503                         ret = -EIO;
1504                         pr_err("%s: ->get() failed\n", __func__);
1505                         goto out_destroy_policy;

1506 }
1507 }

I'm not very familiar with the cpufreq code yet. My first thought is that maybe the get() function pointer isn't set correctly?

thanks,
drew

[1] https://gist.github.com/pdp7/00ab047509d25871f87b3dc1b2445eaa

#15 lore raw
In reply to Sunil V L
This series was applied to riscv/linux.git (for-next) by Palmer Dabbelt <[email protected]>:

Hello:

This series was applied to riscv/linux.git (for-next) by Palmer Dabbelt <[email protected]>:

Quoted 8 lines · On Thu, 8 Feb 2024 09:14:11 +0530 you wrote:

This series enables the support for "Collaborative Processor Performance Control (CPPC) on ACPI based RISC-V platforms. It depends on the encoding of CPPC registers as defined in RISC-V FFH spec [2].

CPPC is described in the ACPI spec [1]. RISC-V FFH spec required to enable this, is available at [2].

[...]

Here is the summary with links:
- [v1,-next,1/3] ACPI: RISC-V: Add CPPC driver

    https://git.kernel.org/riscv/c/30f3ffbee86b
  - [v1,-next,2/3] cpufreq: Move CPPC configs to common Kconfig and add RISC-V
    https://git.kernel.org/riscv/c/7ee1378736f0
  - [v1,-next,3/3] RISC-V: defconfig: Enable CONFIG_ACPI_CPPC_CPUFREQ
    https://git.kernel.org/riscv/c/282b9df4e960

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
#13 lore raw
In reply to Sunil V L
Quoted 33 lines · Sunil V L
Quoted 32 lines · Drew Fustini
Quoted 11 lines · Drew Fustini
Quoted 10 lines · Sunil V L

This series enables the support for "Collaborative Processor Performance Control (CPPC) on ACPI based RISC-V platforms. It depends on the encoding of CPPC registers as defined in RISC-V FFH spec [2].

CPPC is described in the ACPI spec [1]. RISC-V FFH spec required to enable this, is available at [2].

[1] - https://uefi.org/specs/ACPI/6.5/08_Processor_Configuration_and_Control.html#collaborative-processor-performance-control
[2] - https://github.com/riscv-non-isa/riscv-acpi-ffh/releases/download/v1.0.0/riscv-ffh.pdf

Quoted 6 lines
Quoted 3 lines

The series is based on the LPI support series.
Based-on: [email protected]
(https://lore.kernel.org/lkml/[email protected]/)

Should the https://github.com/vlsunil/qemu/tree/lpi_exp branch also be used for this CPPC series too?

I noticed the ventanamicro qemu repo has a dev-upstream branch [1] which contains 4bb6ba4d0fb9 ("riscv/virt: acpi: Enable CPPC - _CPC and _PSD"). I've built that but I still see 'SBI CPPC extension NOT detected!!' in the Linux boot log.

I'm using upstream opensbi. It seems that sbi_cppc_probe() fails because cppc_dev is not set. Nothing in the upstream opensbi repo seems to call sbi_cppc_set_device(), so I am uncertain how it is possible for it to work. Is there an opensbi branch I should be using?

Thanks,
Drew

Quoted 8 lines
Quoted 1 line

[1] https://github.com/ventanamicro/qemu/tree/dev-upstream

Please use below branches for qemu and opensbi. These are just dummy objects/interfaces added to test the kernel change which are otherwise platform specific features.

https://github.com/vlsunil/qemu/tree/lpi_cppc_exp
https://github.com/vlsunil/opensbi/tree/cppc_exp

I know the opensbi branch is just for the purpose of testing the kernel driver. However, I am new to ACPI and I am trying to understand how a real system might work.

The _CPC register address encoding in the RISC-V FFH spec enables the SBI CPPC register ID to be specified. But how would SBI firmware know what physical address corresponds to the CPPC register?

If sbi_cppc_test_write() [1] was implemented for a real system, then how would it know what physical address to write to for a CPPC register like SBI_CPPC_DESIRED_PERF?

Thanks,
Drew

[1] https://github.com/vlsunil/opensbi/commit/e23cda47158626f96e5992db00efaaac5dab31b0

author maintainer
#14 lore raw
Quoted 47 lines · Drew Fustini
Quoted 33 lines · Sunil V L
Quoted 32 lines · Drew Fustini
Quoted 11 lines · Drew Fustini
Quoted 10 lines · Sunil V L

This series enables the support for "Collaborative Processor Performance Control (CPPC) on ACPI based RISC-V platforms. It depends on the encoding of CPPC registers as defined in RISC-V FFH spec [2].

CPPC is described in the ACPI spec [1]. RISC-V FFH spec required to enable this, is available at [2].

[1] - https://uefi.org/specs/ACPI/6.5/08_Processor_Configuration_and_Control.html#collaborative-processor-performance-control
[2] - https://github.com/riscv-non-isa/riscv-acpi-ffh/releases/download/v1.0.0/riscv-ffh.pdf

Quoted 6 lines
Quoted 3 lines

The series is based on the LPI support series.
Based-on: [email protected]
(https://lore.kernel.org/lkml/[email protected]/)

Should the https://github.com/vlsunil/qemu/tree/lpi_exp branch also be used for this CPPC series too?

I noticed the ventanamicro qemu repo has a dev-upstream branch [1] which contains 4bb6ba4d0fb9 ("riscv/virt: acpi: Enable CPPC - _CPC and _PSD"). I've built that but I still see 'SBI CPPC extension NOT detected!!' in the Linux boot log.

I'm using upstream opensbi. It seems that sbi_cppc_probe() fails because cppc_dev is not set. Nothing in the upstream opensbi repo seems to call sbi_cppc_set_device(), so I am uncertain how it is possible for it to work. Is there an opensbi branch I should be using?

Thanks,
Drew

Quoted 8 lines
Quoted 1 line

[1] https://github.com/ventanamicro/qemu/tree/dev-upstream

Please use below branches for qemu and opensbi. These are just dummy objects/interfaces added to test the kernel change which are otherwise platform specific features.

https://github.com/vlsunil/qemu/tree/lpi_cppc_exp
https://github.com/vlsunil/opensbi/tree/cppc_exp

I know the opensbi branch is just for the purpose of testing the kernel driver. However, I am new to ACPI and I am trying to understand how a real system might work.

Quoted 8 lines

The _CPC register address encoding in the RISC-V FFH spec enables the SBI CPPC register ID to be specified. But how would SBI firmware know what physical address corresponds to the CPPC register?

If sbi_cppc_test_write() [1] was implemented for a real system, then how would it know what physical address to write to for a CPPC register like SBI_CPPC_DESIRED_PERF?

The SBI extension provides an abstraction to access the CPPC registers. SBI implementation for the platform should be aware of how to access a particular register in the back end when it supports the extension.

Regards,
Sunil