lib: sbi_mpxy: Fix shared memory size rounding

The sbi_mpxy_register_channel() currently performs ceiling division by
PAGE_SIZE but stores the resulting page count in mpxy_shmem_size. All
consumers interpret mpxy_shmem_size as a byte count, so channels requiring
more than one page get an undersized shared memory value.

Address the above issue by using ROUNDUP() to keep the rounded value in
bytes.

Fixes: ec09918426 ("lib: sbi: Update MPXY framework and SBI extension as per latest spec")
Signed-off-by: Shibo Zhu <3499129952@qq.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Link: https://lore.kernel.org/r/tencent_14AA3BA0083001905C262A5CD64E442FC205@qq.com
Signed-off-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
Shibo Zhu
2026-09-28 17:42:15 +05:30
committed by Anup Patel
parent 0ffaa1bc65
commit 2de7dfb681
+2 -2
View File
@@ -257,8 +257,8 @@ int sbi_mpxy_register_channel(struct sbi_mpxy_channel *channel)
/* Update shared memory size if required */
if (mpxy_shmem_size < channel->attrs.msg_data_maxlen) {
mpxy_shmem_size = channel->attrs.msg_data_maxlen;
mpxy_shmem_size = (mpxy_shmem_size + (PAGE_SIZE - 1)) / PAGE_SIZE;
mpxy_shmem_size = ROUNDUP(channel->attrs.msg_data_maxlen,
PAGE_SIZE);
}
sbi_list_add_tail(&channel->head, &mpxy_channel_list);