From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Linux ACPI <linux-acpi@vger.kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Dan Carpenter <dan.carpenter@oracle.com>,
Steven Noonan <steven@valvesoftware.com>,
Huang Rui <ray.huang@amd.com>
Subject: [PATCH v1 1/2] ACPI: CPPC: Fix up I/O port access in cpc_read()
Date: Wed, 12 Jan 2022 19:26:32 +0100 [thread overview]
Message-ID: <5789025.lOV4Wx5bFT@kreacher> (raw)
In-Reply-To: <11905930.O9o76ZdvQC@kreacher>
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
The code as currently implemented does not work on big endian systems,
so fix it up.
Fixes: a2c8f92bea5f ("ACPI: CPPC: Implement support for SystemIO registers")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/linux-acpi/20220111092928.GA24968@kili/
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/acpi/cppc_acpi.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
Index: linux-pm/drivers/acpi/cppc_acpi.c
===================================================================
--- linux-pm.orig/drivers/acpi/cppc_acpi.c
+++ linux-pm/drivers/acpi/cppc_acpi.c
@@ -929,16 +929,18 @@ static int cpc_read(int cpu, struct cpc_
if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_IO) {
u32 width = 8 << (reg->access_width - 1);
+ u32 val_u32;
acpi_status status;
status = acpi_os_read_port((acpi_io_address)reg->address,
- (u32 *)val, width);
+ &val_u32, width);
if (ACPI_FAILURE(status)) {
pr_debug("Error: Failed to read SystemIO port %llx\n",
reg->address);
return -EFAULT;
}
+ *val = val_u32;
return 0;
} else if (reg->space_id == ACPI_ADR_SPACE_PLATFORM_COMM && pcc_ss_id >= 0)
vaddr = GET_PCC_VADDR(reg->address, pcc_ss_id);
next prev parent reply other threads:[~2022-01-12 18:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-12 18:25 [PATCH v1 0/2] ACPI: CPPC: Fix I/O port reads on big endian and clean up code in cpc_read() Rafael J. Wysocki
2022-01-12 18:26 ` Rafael J. Wysocki [this message]
2022-01-13 3:00 ` [PATCH v1 1/2] ACPI: CPPC: Fix up I/O port access " Huang Rui
2022-01-12 18:27 ` [PATCH v1 2/2] ACPI: CPPC: Drop redundant local variable from cpc_read() Rafael J. Wysocki
2022-01-13 2:39 ` Huang Rui
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=5789025.lOV4Wx5bFT@kreacher \
--to=rjw@rjwysocki.net \
--cc=dan.carpenter@oracle.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ray.huang@amd.com \
--cc=steven@valvesoftware.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