From: kuldip dwivedi <kuldip.dwivedi@puresoftware.com>
To: "Rafael J . Wysocki" <rjw@rjwysocki.net>,
Len Brown <lenb@kernel.org>,
linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Ran Wang <ran.wang_1@nxp.com>, Varun Sethi <V.Sethi@nxp.com>,
Arokia Samy <arokia.samy@nxp.com>,
Ard Biesheuvel <Ard.Biesheuvel@arm.com>,
Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>,
Paul Yang <Paul.Yang@arm.com>, Gaurav Jain <gaurav.jain@nxp.com>,
kuldip dwivedi <kuldip.dwivedi@puresoftware.com>,
Tanveer <tanveer.alam@puresoftware.com>
Subject: [PATCH v1] acpi: processor_throttling: Add supprt for System Memory
Date: Thu, 1 Oct 2020 18:56:23 +0530 [thread overview]
Message-ID: <20201001132623.172-1-kuldip.dwivedi@puresoftware.com> (raw)
The existing driver does not support System Memory so
adding support of system meory so that this can be used
on platforms which has ACPI_ADR_SPACE_SYSTEM_MEMORY type
system registers.
Function that creates sysfs entries in processor_driver in Linux,
is enabled to be compiled for arm64 platform
Signed-off-by: Tanveer <tanveer.alam@puresoftware.com>
Signed-off-by: kuldip dwivedi <kuldip.dwivedi@puresoftware.com>
---
Notes:
1. Added package in CPU.asl in edk2-platform to support
_PCT: Performance Control and provide cluster status/control
register like below..
Name(_PTC, Package () {
ResourceTemplate() {Register(SystemMemory, 32, 0, CPU_CLK_CSSR_REG,
CPU_DWORD_ACCESS)},
ResourceTemplate() {Register(SystemMemory, 32, 0, CPU_CLK_CSSR_REG,
CPU_DWORD_ACCESS)}
})
for reference please see line:100 to line:105
https://source.codeaurora.org/external/qoriq/qoriq-components/edk2-platforms/tree/Platform/NXP/LS1046aRdbPkg/AcpiTables/Dsdt/CPU.asl?h=LX2160_UEFI_ACPI_EAR3
2. This feature is tested on LS1046A platform
drivers/acpi/Kconfig | 2 +-
drivers/acpi/processor_throttling.c | 24 ++++++++++++++++++++++++
2 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 7540a5179a47..78b3e45f05e0 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -274,7 +274,7 @@ config ACPI_PROCESSOR
tristate "Processor"
depends on X86 || IA64 || ARM64
select ACPI_PROCESSOR_IDLE
- select ACPI_CPU_FREQ_PSS if X86 || IA64
+ select ACPI_CPU_FREQ_PSS if X86 || IA64 || ARM64
default y
help
This driver adds support for the ACPI Processor package. It is required
diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c
index a0bd56ece3ff..8ace1fb76712 100644
--- a/drivers/acpi/processor_throttling.c
+++ b/drivers/acpi/processor_throttling.c
@@ -767,6 +767,7 @@ static int acpi_read_throttling_status(struct acpi_processor *pr,
{
u32 bit_width, bit_offset;
u32 ptc_value;
+ u64 ptc_value_64;
u64 ptc_mask;
struct acpi_processor_throttling *throttling;
int ret = -1;
@@ -784,6 +785,17 @@ static int acpi_read_throttling_status(struct acpi_processor *pr,
*value = (u64) ((ptc_value >> bit_offset) & ptc_mask);
ret = 0;
break;
+ case ACPI_ADR_SPACE_SYSTEM_MEMORY:
+ bit_width = throttling->status_register.bit_width;
+ bit_offset = throttling->status_register.bit_offset;
+
+ acpi_os_read_memory((acpi_physical_address)
+ throttling->status_register.address,
+ &ptc_value_64, (u32) (bit_width + bit_offset));
+ ptc_mask = (1UL << bit_width) - 1;
+ *value = (u64) ((ptc_value_64 >> bit_offset) & ptc_mask);
+ ret = 0;
+ break;
case ACPI_ADR_SPACE_FIXED_HARDWARE:
ret = acpi_throttling_rdmsr(value);
break;
@@ -817,6 +829,18 @@ static int acpi_write_throttling_state(struct acpi_processor *pr,
(u32) (bit_width + bit_offset));
ret = 0;
break;
+ case ACPI_ADR_SPACE_SYSTEM_MEMORY:
+ bit_width = throttling->control_register.bit_width;
+ bit_offset = throttling->control_register.bit_offset;
+ ptc_mask = (1UL << bit_width) - 1;
+ ptc_value = value & ptc_mask;
+
+ acpi_os_write_memory((acpi_physical_address)
+ throttling->control_register.address,
+ (u64) (ptc_value << bit_offset),
+ (u32) (bit_width + bit_offset));
+ ret = 0;
+ break;
case ACPI_ADR_SPACE_FIXED_HARDWARE:
ret = acpi_throttling_wrmsr(value);
break;
--
2.17.1
next reply other threads:[~2020-10-01 13:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-01 13:26 kuldip dwivedi [this message]
2020-10-02 13:00 ` [PATCH v1] acpi: processor_throttling: Add supprt for System Memory kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201001132623.172-1-kuldip.dwivedi@puresoftware.com \
--to=kuldip.dwivedi@puresoftware.com \
--cc=Ard.Biesheuvel@arm.com \
--cc=Paul.Yang@arm.com \
--cc=Samer.El-Haj-Mahmoud@arm.com \
--cc=V.Sethi@nxp.com \
--cc=arokia.samy@nxp.com \
--cc=gaurav.jain@nxp.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ran.wang_1@nxp.com \
--cc=rjw@rjwysocki.net \
--cc=tanveer.alam@puresoftware.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).