On 08/05/2026 12:43, Aswin Murugan wrote:
> Hi Casey,
>
> On 5/5/2026 12:27 AM, Casey Connolly wrote:
>> Port over the smem code to U-Boot and ensure the smem region gets mapped
>> after dcache is enabled.
>>
>> Signed-off-by: Casey Connolly <[email protected]>
>> ---
>> drivers/soc/qcom/smem.c | 399 ++++++++++++
>> +-----------------------------------
>> include/soc/qcom/smem.h | 9 +-
>> 2 files changed, 104 insertions(+), 304 deletions(-)
>>
>> diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c
>> index 7143856e85c3..96288d7bcdef 100644
>> --- a/drivers/soc/qcom/smem.c
>> +++ b/drivers/soc/qcom/smem.c
[...]
>> @@ -1058,153 +962,100 @@ static int qcom_smem_map_toc(struct qcom_smem
>> *smem, struct smem_region *region)
>> {
>> u32 ptable_start;
>> /* map starting 4K for smem header */
>> - region->virt_base = devm_ioremap_wc(smem->dev, region->aux_base,
>> SZ_4K);
>> + region->virt_base = (void *)region->aux_base;
>> ptable_start = region->aux_base + region->size - SZ_4K;
>> /* map last 4k for toc */
>> - smem->ptable = devm_ioremap_wc(smem->dev, ptable_start, SZ_4K);
>> + smem->ptable = (struct smem_ptable *)(u64)ptable_start;
>> if (!region->virt_base || !smem->ptable)
>> return -ENOMEM;
>> + if (dcache_status())
>> + mmu_map_region(region->aux_base, region->size, false);
>> +
> dcache_status() can return true before the MMU and page tables are
> initialized, which makes calling mmu_map_region() unsafe at this point.
> Since the intent here is to check whether MMU operations are safe,
> this should use mmu_status(), which correctly reflects MMU readiness.
ah good point, thanks! I'll fix that in v3.
--
// Casey (she/her)