lib: sbi: Rename map_range/unmap_range functions

*_map_range and *_unmap_range functions are required
in M-Mode to get the temporary access to S-Mode and U-Mode
regions. Thse functions only operate using the TYPE_MEMORY
memory protection mechanisms. Rename them to reflect the
actual usage of these functions and let generic map/unmap_range
names to implement generic functions

Signed-off-by: Rahul Pathak <rahul.pathak@oss.qualcomm.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Reviewed-by: Pawandeep Oza <pawandeep.oza@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20260820121309.2551296-2-rahul.pathak@oss.qualcomm.com
Signed-off-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
Rahul Pathak
2026-09-05 12:52:39 +05:30
committed by Anup Patel
parent 7774b82e4a
commit 35af7c8c7e
8 changed files with 72 additions and 67 deletions
+12 -12
View File
@@ -401,10 +401,10 @@ int sbi_mpxy_set_shmem(unsigned long shmem_phys_lo,
if (flags == SBI_EXT_MPXY_SHMEM_FLAG_OVERWRITE_RETURN) {
ret_buf = (unsigned long *)(ulong)SHMEM_PHYS_ADDR(shmem_phys_hi,
shmem_phys_lo);
sbi_hart_protection_map_range((unsigned long)ret_buf, mpxy_shmem_size);
sbi_hart_protection_temp_map_range((unsigned long)ret_buf, mpxy_shmem_size);
ret_buf[0] = cpu_to_lle(ms->shmem.shmem_addr_lo);
ret_buf[1] = cpu_to_lle(ms->shmem.shmem_addr_hi);
sbi_hart_protection_unmap_range((unsigned long)ret_buf, mpxy_shmem_size);
sbi_hart_protection_temp_unmap_range((unsigned long)ret_buf, mpxy_shmem_size);
}
/** Setup the new shared memory */
@@ -436,7 +436,7 @@ int sbi_mpxy_get_channel_ids(u32 start_index)
return SBI_ERR_INVALID_PARAM;
shmem_base = hart_shmem_base(ms);
sbi_hart_protection_map_range((unsigned long)hart_shmem_base(ms), mpxy_shmem_size);
sbi_hart_protection_temp_map_range((unsigned long)hart_shmem_base(ms), mpxy_shmem_size);
/** number of channel ids which can be stored in shmem adjusting
* for remaining and returned fields */
@@ -466,7 +466,7 @@ int sbi_mpxy_get_channel_ids(u32 start_index)
shmem_base[0] = cpu_to_le32(remaining);
shmem_base[1] = cpu_to_le32(returned);
sbi_hart_protection_unmap_range((unsigned long)hart_shmem_base(ms), mpxy_shmem_size);
sbi_hart_protection_temp_unmap_range((unsigned long)hart_shmem_base(ms), mpxy_shmem_size);
return SBI_SUCCESS;
}
@@ -498,7 +498,7 @@ int sbi_mpxy_read_attrs(u32 channel_id, u32 base_attr_id, u32 attr_count)
shmem_base = hart_shmem_base(ms);
end_id = base_attr_id + attr_count - 1;
sbi_hart_protection_map_range((unsigned long)hart_shmem_base(ms), mpxy_shmem_size);
sbi_hart_protection_temp_map_range((unsigned long)hart_shmem_base(ms), mpxy_shmem_size);
/* Standard attributes range check */
if (mpxy_is_std_attr(base_attr_id)) {
@@ -537,7 +537,7 @@ int sbi_mpxy_read_attrs(u32 channel_id, u32 base_attr_id, u32 attr_count)
base_attr_id, attr_count);
}
out:
sbi_hart_protection_unmap_range((unsigned long)hart_shmem_base(ms), mpxy_shmem_size);
sbi_hart_protection_temp_unmap_range((unsigned long)hart_shmem_base(ms), mpxy_shmem_size);
return ret;
}
@@ -650,7 +650,7 @@ int sbi_mpxy_write_attrs(u32 channel_id, u32 base_attr_id, u32 attr_count)
shmem_base = hart_shmem_base(ms);
end_id = base_attr_id + attr_count - 1;
sbi_hart_protection_map_range((unsigned long)shmem_base, mpxy_shmem_size);
sbi_hart_protection_temp_map_range((unsigned long)shmem_base, mpxy_shmem_size);
mem_ptr = (u32 *)shmem_base;
@@ -707,7 +707,7 @@ int sbi_mpxy_write_attrs(u32 channel_id, u32 base_attr_id, u32 attr_count)
base_attr_id, attr_count);
}
out:
sbi_hart_protection_unmap_range((unsigned long)shmem_base, mpxy_shmem_size);
sbi_hart_protection_temp_unmap_range((unsigned long)shmem_base, mpxy_shmem_size);
return ret;
}
@@ -740,7 +740,7 @@ int sbi_mpxy_send_message(u32 channel_id, u8 msg_id,
return SBI_ERR_INVALID_PARAM;
shmem_base = hart_shmem_base(ms);
sbi_hart_protection_map_range((unsigned long)shmem_base, mpxy_shmem_size);
sbi_hart_protection_temp_map_range((unsigned long)shmem_base, mpxy_shmem_size);
if (resp_data_len) {
resp_buf = shmem_base;
@@ -757,7 +757,7 @@ int sbi_mpxy_send_message(u32 channel_id, u8 msg_id,
msg_data_len);
}
sbi_hart_protection_unmap_range((unsigned long)shmem_base, mpxy_shmem_size);
sbi_hart_protection_temp_unmap_range((unsigned long)shmem_base, mpxy_shmem_size);
if (ret == SBI_ERR_TIMEOUT || ret == SBI_ERR_IO)
return ret;
@@ -788,12 +788,12 @@ int sbi_mpxy_get_notification_events(u32 channel_id, unsigned long *events_len)
return SBI_ERR_NOT_SUPPORTED;
shmem_base = hart_shmem_base(ms);
sbi_hart_protection_map_range((unsigned long)shmem_base, mpxy_shmem_size);
sbi_hart_protection_temp_map_range((unsigned long)shmem_base, mpxy_shmem_size);
eventsbuf = shmem_base;
ret = channel->get_notification_events(channel, eventsbuf,
mpxy_shmem_size,
events_len);
sbi_hart_protection_unmap_range((unsigned long)shmem_base, mpxy_shmem_size);
sbi_hart_protection_temp_unmap_range((unsigned long)shmem_base, mpxy_shmem_size);
if (ret)
return ret;