Skip to content

Commit 3a3ce10

Browse files
sudeep-hollarafaeljw
authored andcommitted
ACPI: CPPC: Simplify PCC shared memory region handling
The PCC driver now handles mapping and unmapping of shared memory areas as part of pcc_mbox_{request,free}_channel(). Without these before, this ACPI CPPC driver did handling of those mappings like several other PCC mailbox client drivers. There were redundant operations, leading to unnecessary code. Maintaining the consistency across these driver was harder due to scattered handling of shmem. Just use the mapped shmem and remove all redundant operations from this driver. Signed-off-by: Sudeep Holla <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 8960c45 commit 3a3ce10

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

drivers/acpi/cppc_acpi.c

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747

4848
struct cppc_pcc_data {
4949
struct pcc_mbox_chan *pcc_channel;
50-
void __iomem *pcc_comm_addr;
5150
bool pcc_channel_acquired;
5251
unsigned int deadline_us;
5352
unsigned int pcc_mpar, pcc_mrtt, pcc_nominal;
@@ -95,7 +94,7 @@ static DEFINE_PER_CPU(int, cpu_pcc_subspace_idx);
9594
static DEFINE_PER_CPU(struct cpc_desc *, cpc_desc_ptr);
9695

9796
/* pcc mapped address + header size + offset within PCC subspace */
98-
#define GET_PCC_VADDR(offs, pcc_ss_id) (pcc_data[pcc_ss_id]->pcc_comm_addr + \
97+
#define GET_PCC_VADDR(offs, pcc_ss_id) (pcc_data[pcc_ss_id]->pcc_channel->shmem + \
9998
0x8 + (offs))
10099

101100
/* Check if a CPC register is in PCC */
@@ -223,7 +222,7 @@ static int check_pcc_chan(int pcc_ss_id, bool chk_err_bit)
223222
int ret, status;
224223
struct cppc_pcc_data *pcc_ss_data = pcc_data[pcc_ss_id];
225224
struct acpi_pcct_shared_memory __iomem *generic_comm_base =
226-
pcc_ss_data->pcc_comm_addr;
225+
pcc_ss_data->pcc_channel->shmem;
227226

228227
if (!pcc_ss_data->platform_owns_pcc)
229228
return 0;
@@ -258,7 +257,7 @@ static int send_pcc_cmd(int pcc_ss_id, u16 cmd)
258257
int ret = -EIO, i;
259258
struct cppc_pcc_data *pcc_ss_data = pcc_data[pcc_ss_id];
260259
struct acpi_pcct_shared_memory __iomem *generic_comm_base =
261-
pcc_ss_data->pcc_comm_addr;
260+
pcc_ss_data->pcc_channel->shmem;
262261
unsigned int time_delta;
263262

264263
/*
@@ -571,15 +570,6 @@ static int register_pcc_channel(int pcc_ss_idx)
571570
pcc_data[pcc_ss_idx]->pcc_mpar = pcc_chan->max_access_rate;
572571
pcc_data[pcc_ss_idx]->pcc_nominal = pcc_chan->latency;
573572

574-
pcc_data[pcc_ss_idx]->pcc_comm_addr =
575-
acpi_os_ioremap(pcc_chan->shmem_base_addr,
576-
pcc_chan->shmem_size);
577-
if (!pcc_data[pcc_ss_idx]->pcc_comm_addr) {
578-
pr_err("Failed to ioremap PCC comm region mem for %d\n",
579-
pcc_ss_idx);
580-
return -ENOMEM;
581-
}
582-
583573
/* Set flag so that we don't come here for each CPU. */
584574
pcc_data[pcc_ss_idx]->pcc_channel_acquired = true;
585575
}

0 commit comments

Comments
 (0)