[PATCH 2/2] firmware: arm_scmi: Support 'reg-io-width' property for shared memory
Florian Fainelli
florian.fainelli at broadcom.com
Sun Aug 11 14:03:50 PDT 2024
On 8/11/2024 5:42 AM, Peng Fan wrote:
>> Subject: [PATCH 2/2] firmware: arm_scmi: Support 'reg-io-width'
>> property for shared memory
>>
>> Some shared memory areas might only support a certain access width,
>> (e.g.: 32 bits accesses only). Update the shmem layer to support
>> reading from and writing to such shared memory area using the
>> specified I/O width in the Device Tree. The various transport layers
>> making use of the shmem.c code are updated accordingly to pass the
>> I/O width to the routines that need it.
>>
>> Signed-off-by: Florian Fainelli <florian.fainelli at broadcom.com>
>> ---
>
> [...]
>> }
>>
>> static void smc_mark_txdone(struct scmi_chan_info *cinfo, int ret, diff
>> --git a/drivers/firmware/arm_scmi/shmem.c
>> b/drivers/firmware/arm_scmi/shmem.c
>> index 01d8a9398fe8..192262d63baa 100644
>> --- a/drivers/firmware/arm_scmi/shmem.c
>> +++ b/drivers/firmware/arm_scmi/shmem.c
>> @@ -34,9 +34,20 @@ struct scmi_shared_mem {
>> u8 msg_payload[];
>> };
>>
>> +#define __shmem_copy_toio_tpl(s) \
>> + for (unsigned int i = 0; i < xfer->tx.len; i += shmem_io_width)
>> \
>> + iowrite##s(((u##s *)(xfer->tx.buf))[i / shmem_io_width],
>> \
>> + shmem->msg_payload + i);
>
> there will be a barrier with iowrite, use raw_write##s?
Makes sense, and that matches what memcpy_{from,to}_io() does, too.
>
>> +
>> +#define __shmem_copy_fromio_tpl(s) \
>> + for (unsigned int i = 0; i < xfer->rx.len; i += shmem_io_width)
>> \
>> + ((u##s *)(xfer->rx.buf))[i / shmem_io_width] =
>> \
>> + ioread##s(shmem->msg_payload +
>> shmem_io_width + i);
>
> Use raw_ioread##s?
Agreed.
--
Florian
More information about the linux-arm-kernel
mailing list