Skip to content

Commit 0f2591e

Browse files
sudeep-hollaJassiBrar
authored andcommitted
mailbox: pcc: Add pcc_mbox_chan structure to hold shared memory region info
Currently PCC mailbox controller sets con_priv in each channel to hold the pointer to pcct subspace entry it corresponds to. The mailbox user will then fetch this pointer from the channel descriptor they get when they request for the channel. Using that pointer they then parse the pcct entry again to fetch all the information about shared memory region. In order to remove individual users of PCC mailbox parsing the PCCT subspace entries to fetch same information, let us consolidate the same in pcc mailbox controller by parsing all the shared memory region information into a structure that can also hold the mbox_chan pointer it represent. This can then be used as main PCC mailbox channel pointer that we can return as part of pcc_mbox_request_channel instead of standard mailbox channel pointer. Reviewed-by: Cristian Marussi <[email protected]> Signed-off-by: Sudeep Holla <[email protected]> Signed-off-by: Jassi Brar <[email protected]>
1 parent 4e3c96f commit 0f2591e

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

drivers/mailbox/pcc.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,13 @@ static struct mbox_chan *pcc_mbox_channels;
6767
/**
6868
* struct pcc_chan_info - PCC channel specific information
6969
*
70+
* @chan: PCC channel information with Shared Memory Region info
7071
* @db_vaddr: cached virtual address for doorbell register
7172
* @db_ack_vaddr: cached virtual address for doorbell ack register
7273
* @db_irq: doorbell interrupt
7374
*/
7475
struct pcc_chan_info {
76+
struct pcc_mbox_chan chan;
7577
void __iomem *db_vaddr;
7678
void __iomem *db_ack_vaddr;
7779
int db_irq;
@@ -470,6 +472,27 @@ static void pcc_parse_subspace_db_reg(struct pcc_chan_info *pchan,
470472
db_reg->bit_width / 8);
471473
}
472474

475+
/**
476+
* pcc_parse_subspace_shmem - Parse the PCC Shared Memory Region information
477+
*
478+
* @pchan: Pointer to the PCC channel info structure.
479+
* @pcct_entry: Pointer to the ACPI subtable header.
480+
*
481+
*/
482+
static void pcc_parse_subspace_shmem(struct pcc_chan_info *pchan,
483+
struct acpi_subtable_header *pcct_entry)
484+
{
485+
struct acpi_pcct_subspace *pcct_ss;
486+
487+
pcct_ss = (struct acpi_pcct_subspace *)pcct_entry;
488+
489+
pchan->chan.shmem_base_addr = pcct_ss->base_address;
490+
pchan->chan.shmem_size = pcct_ss->length;
491+
pchan->chan.latency = pcct_ss->latency;
492+
pchan->chan.max_access_rate = pcct_ss->max_access_rate;
493+
pchan->chan.min_turnaround_time = pcct_ss->min_turnaround_time;
494+
}
495+
473496
/**
474497
* acpi_pcc_probe - Parse the ACPI tree for the PCCT.
475498
*
@@ -537,13 +560,17 @@ static int __init acpi_pcc_probe(void)
537560
struct pcc_chan_info *pchan = chan_info + i;
538561
pcc_mbox_channels[i].con_priv = pcct_entry;
539562

563+
pchan->chan.mchan = &pcc_mbox_channels[i];
564+
540565
if (pcc_mbox_ctrl.txdone_irq) {
541566
rc = pcc_parse_subspace_irq(pchan, pcct_entry);
542567
if (rc < 0)
543568
goto err;
544569
}
545570
pcc_parse_subspace_db_reg(pchan, pcct_entry);
546571

572+
pcc_parse_subspace_shmem(pchan, pcct_entry);
573+
547574
pcct_entry = (struct acpi_subtable_header *)
548575
((unsigned long) pcct_entry + pcct_entry->length);
549576
}

include/acpi/pcc.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@
99
#include <linux/mailbox_controller.h>
1010
#include <linux/mailbox_client.h>
1111

12+
struct pcc_mbox_chan {
13+
struct mbox_chan *mchan;
14+
u64 shmem_base_addr;
15+
u64 shmem_size;
16+
u32 latency;
17+
u32 max_access_rate;
18+
u16 min_turnaround_time;
19+
};
20+
1221
#define MAX_PCC_SUBSPACES 256
1322
#ifdef CONFIG_PCC
1423
extern struct mbox_chan *pcc_mbox_request_channel(struct mbox_client *cl,

0 commit comments

Comments
 (0)