lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201001132623.172-1-kuldip.dwivedi@puresoftware.com>
Date:   Thu,  1 Oct 2020 18:56:23 +0530
From:   kuldip dwivedi <kuldip.dwivedi@...esoftware.com>
To:     "Rafael J . Wysocki" <rjw@...ysocki.net>,
        Len Brown <lenb@...nel.org>, linux-acpi@...r.kernel.org,
        linux-kernel@...r.kernel.org
Cc:     Ran Wang <ran.wang_1@....com>, Varun Sethi <V.Sethi@....com>,
        Arokia Samy <arokia.samy@....com>,
        Ard Biesheuvel <Ard.Biesheuvel@....com>,
        Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@....com>,
        Paul Yang <Paul.Yang@....com>,
        Gaurav Jain <gaurav.jain@....com>,
        kuldip dwivedi <kuldip.dwivedi@...esoftware.com>,
        Tanveer <tanveer.alam@...esoftware.com>
Subject: [PATCH v1] acpi: processor_throttling: Add supprt for System Memory

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@...esoftware.com>
Signed-off-by: kuldip dwivedi <kuldip.dwivedi@...esoftware.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ