Skip to content

Commit fa362ff

Browse files
sudeep-hollaJassi Brar
authored andcommitted
mailbox: pcc: Always map the shared memory communication address
Currently the shared memory communication address was mapped by the mailbox client drivers leading to all sorts of inconsistencies. It also has resulted in the inconsistent attributes used while mapping the shared memory regions. In order to remove/eliminate any issues, let us ensures the shared memory address is always mapped and unmapped when the PCC channels are requested and release. We need to map them as the ACPI PCCT associates these shared memory with each channel subspace and may need use the status or the flags in the headers of those shared memory communication address regions to manage the transport/channel. Note, until all the drivers using PCC start using this mapped shmem, there might be double mapping of the shared memory address. This shouldn't have any impact on existing mbox client drivers. Since there are no users of pcc_chan_ioremap() and also it is mapped by default, we can stop exporting it and merge the functionality into pcc_mbox_request_channel(). Acked-by: Huisong Li <lihuisong@huawei.com> Tested-by: Huisong Li <lihuisong@huawei.com> Tested-by: Adam Young <admiyo@os.amperecomputing.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com> Signed-off-by: Jassi Brar <jassisinghbrar@gmail.com>
1 parent 3a675f5 commit fa362ff

File tree

2 files changed

+9
-25
lines changed

2 files changed

+9
-25
lines changed

drivers/mailbox/pcc.c

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,7 @@ static irqreturn_t pcc_mbox_irq(int irq, void *p)
373373
struct pcc_mbox_chan *
374374
pcc_mbox_request_channel(struct mbox_client *cl, int subspace_id)
375375
{
376+
struct pcc_mbox_chan *pcc_mchan;
376377
struct pcc_chan_info *pchan;
377378
struct mbox_chan *chan;
378379
int rc;
@@ -391,7 +392,14 @@ pcc_mbox_request_channel(struct mbox_client *cl, int subspace_id)
391392
if (rc)
392393
return ERR_PTR(rc);
393394

394-
return &pchan->chan;
395+
pcc_mchan = &pchan->chan;
396+
pcc_mchan->shmem = acpi_os_ioremap(pcc_mchan->shmem_base_addr,
397+
pcc_mchan->shmem_size);
398+
if (pcc_mchan->shmem)
399+
return pcc_mchan;
400+
401+
mbox_free_channel(chan);
402+
return ERR_PTR(-ENXIO);
395403
}
396404
EXPORT_SYMBOL_GPL(pcc_mbox_request_channel);
397405

@@ -420,25 +428,6 @@ void pcc_mbox_free_channel(struct pcc_mbox_chan *pchan)
420428
}
421429
EXPORT_SYMBOL_GPL(pcc_mbox_free_channel);
422430

423-
int pcc_mbox_ioremap(struct mbox_chan *chan)
424-
{
425-
struct pcc_chan_info *pchan_info;
426-
struct pcc_mbox_chan *pcc_mbox_chan;
427-
428-
if (!chan || !chan->cl)
429-
return -1;
430-
pchan_info = chan->con_priv;
431-
pcc_mbox_chan = &pchan_info->chan;
432-
433-
pcc_mbox_chan->shmem = acpi_os_ioremap(pcc_mbox_chan->shmem_base_addr,
434-
pcc_mbox_chan->shmem_size);
435-
if (!pcc_mbox_chan->shmem)
436-
return -ENXIO;
437-
438-
return 0;
439-
}
440-
EXPORT_SYMBOL_GPL(pcc_mbox_ioremap);
441-
442431
/**
443432
* pcc_send_data - Called from Mailbox Controller code. Used
444433
* here only to ring the channel doorbell. The PCC client

include/acpi/pcc.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,13 @@ struct pcc_mbox_chan {
3737
extern struct pcc_mbox_chan *
3838
pcc_mbox_request_channel(struct mbox_client *cl, int subspace_id);
3939
extern void pcc_mbox_free_channel(struct pcc_mbox_chan *chan);
40-
extern int pcc_mbox_ioremap(struct mbox_chan *chan);
4140
#else
4241
static inline struct pcc_mbox_chan *
4342
pcc_mbox_request_channel(struct mbox_client *cl, int subspace_id)
4443
{
4544
return ERR_PTR(-ENODEV);
4645
}
4746
static inline void pcc_mbox_free_channel(struct pcc_mbox_chan *chan) { }
48-
static inline int pcc_mbox_ioremap(struct mbox_chan *chan)
49-
{
50-
return 0;
51-
};
5247
#endif
5348

5449
#endif /* _PCC_H */

0 commit comments

Comments
 (0)