Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mailbox: pcc: Initialize SHMEM before binding the channel with the client

The PCC channel's shared memory region must be set up before the
mailbox controller binds the channel with the client, as the binding
process may trigger client operations like startup() that may rely on
SHMEM being initialized.

Reorder the setup sequence to ensure the shared memory is ready before
binding. Initialize and map the PCC shared memory (SHMEM) prior to
calling mbox_bind_client() so that clients never observe an uninitialized
or NULL SHMEM during bind-time callbacks or early use in startup().

This makes the PCC mailbox channel bring-up order consistent and
eliminates a race between SHMEM setup and client binding.

This will be needed in channel startup to clear/acknowledge any pending
interrupts before enabling them.

Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Acked-by: lihuisong@huawei.com
Tested-by: Adam Young <admiyo@os.amperecomputing.com>
Signed-off-by: Jassi Brar <jassisinghbrar@gmail.com>

authored by

Sudeep Holla and committed by
Jassi Brar
9f3bbbb7 9c753f7c

+10 -8
+10 -8
drivers/mailbox/pcc.c
··· 377 377 return ERR_PTR(-EBUSY); 378 378 } 379 379 380 - rc = mbox_bind_client(chan, cl); 381 - if (rc) 382 - return ERR_PTR(rc); 383 - 384 380 pcc_mchan = &pchan->chan; 385 381 pcc_mchan->shmem = acpi_os_ioremap(pcc_mchan->shmem_base_addr, 386 382 pcc_mchan->shmem_size); 387 - if (pcc_mchan->shmem) 388 - return pcc_mchan; 383 + if (!pcc_mchan->shmem) 384 + return ERR_PTR(-ENXIO); 389 385 390 - mbox_free_channel(chan); 391 - return ERR_PTR(-ENXIO); 386 + rc = mbox_bind_client(chan, cl); 387 + if (rc) { 388 + iounmap(pcc_mchan->shmem); 389 + pcc_mchan->shmem = NULL; 390 + return ERR_PTR(rc); 391 + } 392 + 393 + return pcc_mchan; 392 394 } 393 395 EXPORT_SYMBOL_GPL(pcc_mbox_request_channel); 394 396