BACKPORT: firmware: qcom_scm: Use fixed width src vm bitmap
The maximum VMID for assign_mem is 63. Use a u64 to represent this bitmap instead of architecture-dependent "unsigned int" which varies in size on 32-bit and 64-bit platforms. Acked-by: Kalle Valo <kvalo@kernel.org> (ath10k) Tested-by: Gokul krishna Krishnakumar <quic_gokukris@quicinc.com> Signed-off-by: Elliot Berman <quic_eberman@quicinc.com> Reviewed-by: Bjorn Andersson <andersson@kernel.org> Signed-off-by: Bjorn Andersson <andersson@kernel.org> Link: https://lore.kernel.org/r/20230213181832.3489174-1-quic_eberman@quicinc.com Bug: 279506910 (cherry picked from commit 968a26a07f75377afbd4f7bb18ef587a1443c244) Change-Id: Ie7125d1299e4edda47f3e6e9031dc515cfdd8f0f [eberman: Drop modifications to drivers/remoteproc/qcom_q6v5_pas.c which don't exist in 14-6.1] Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
This commit is contained in:
parent
b0426ab62e
commit
15a4929f8e
6 changed files with 16 additions and 14 deletions
|
|
@ -898,7 +898,7 @@ static int __qcom_scm_assign_mem(struct device *dev, phys_addr_t mem_region,
|
|||
* Return negative errno on failure or 0 on success with @srcvm updated.
|
||||
*/
|
||||
int qcom_scm_assign_mem(phys_addr_t mem_addr, size_t mem_sz,
|
||||
unsigned int *srcvm,
|
||||
u64 *srcvm,
|
||||
const struct qcom_scm_vmperm *newvm,
|
||||
unsigned int dest_cnt)
|
||||
{
|
||||
|
|
@ -915,9 +915,9 @@ int qcom_scm_assign_mem(phys_addr_t mem_addr, size_t mem_sz,
|
|||
__le32 *src;
|
||||
void *ptr;
|
||||
int ret, i, b;
|
||||
unsigned long srcvm_bits = *srcvm;
|
||||
u64 srcvm_bits = *srcvm;
|
||||
|
||||
src_sz = hweight_long(srcvm_bits) * sizeof(*src);
|
||||
src_sz = hweight64(srcvm_bits) * sizeof(*src);
|
||||
mem_to_map_sz = sizeof(*mem_to_map);
|
||||
dest_sz = dest_cnt * sizeof(*destvm);
|
||||
ptr_sz = ALIGN(src_sz, SZ_64) + ALIGN(mem_to_map_sz, SZ_64) +
|
||||
|
|
@ -930,8 +930,10 @@ int qcom_scm_assign_mem(phys_addr_t mem_addr, size_t mem_sz,
|
|||
/* Fill source vmid detail */
|
||||
src = ptr;
|
||||
i = 0;
|
||||
for_each_set_bit(b, &srcvm_bits, BITS_PER_LONG)
|
||||
src[i++] = cpu_to_le32(b);
|
||||
for (b = 0; b < BITS_PER_TYPE(u64); b++) {
|
||||
if (srcvm_bits & BIT(b))
|
||||
src[i++] = cpu_to_le32(b);
|
||||
}
|
||||
|
||||
/* Fill details of mem buff to map */
|
||||
mem_to_map = ptr + ALIGN(src_sz, SZ_64);
|
||||
|
|
|
|||
|
|
@ -247,7 +247,7 @@ struct fastrpc_channel_ctx {
|
|||
int domain_id;
|
||||
int sesscount;
|
||||
int vmcount;
|
||||
u32 perms;
|
||||
u64 perms;
|
||||
struct qcom_scm_vmperm vmperms[FASTRPC_MAX_VMIDS];
|
||||
struct rpmsg_device *rpdev;
|
||||
struct fastrpc_session_ctx session[FASTRPC_MAX_SESSIONS];
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ static int ath10k_qmi_map_msa_permission(struct ath10k_qmi *qmi,
|
|||
{
|
||||
struct qcom_scm_vmperm dst_perms[3];
|
||||
struct ath10k *ar = qmi->ar;
|
||||
unsigned int src_perms;
|
||||
u64 src_perms;
|
||||
u32 perm_count;
|
||||
int ret;
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ static int ath10k_qmi_unmap_msa_permission(struct ath10k_qmi *qmi,
|
|||
{
|
||||
struct qcom_scm_vmperm dst_perms;
|
||||
struct ath10k *ar = qmi->ar;
|
||||
unsigned int src_perms;
|
||||
u64 src_perms;
|
||||
int ret;
|
||||
|
||||
src_perms = BIT(QCOM_SCM_VMID_MSS_MSA) | BIT(QCOM_SCM_VMID_WLAN);
|
||||
|
|
|
|||
|
|
@ -230,8 +230,8 @@ struct q6v5 {
|
|||
bool has_qaccept_regs;
|
||||
bool has_ext_cntl_regs;
|
||||
bool has_vq6;
|
||||
int mpss_perm;
|
||||
int mba_perm;
|
||||
u64 mpss_perm;
|
||||
u64 mba_perm;
|
||||
const char *hexagon_mdt_image;
|
||||
int version;
|
||||
};
|
||||
|
|
@ -407,7 +407,7 @@ static void q6v5_pds_disable(struct q6v5 *qproc, struct device **pds,
|
|||
}
|
||||
}
|
||||
|
||||
static int q6v5_xfer_mem_ownership(struct q6v5 *qproc, int *current_perm,
|
||||
static int q6v5_xfer_mem_ownership(struct q6v5 *qproc, u64 *current_perm,
|
||||
bool local, bool remote, phys_addr_t addr,
|
||||
size_t size)
|
||||
{
|
||||
|
|
@ -939,7 +939,7 @@ static int q6v5_mpss_init_image(struct q6v5 *qproc, const struct firmware *fw,
|
|||
unsigned long dma_attrs = DMA_ATTR_FORCE_CONTIGUOUS;
|
||||
dma_addr_t phys;
|
||||
void *metadata;
|
||||
int mdata_perm;
|
||||
u64 mdata_perm;
|
||||
int xferop_ret;
|
||||
size_t size;
|
||||
void *ptr;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ struct qcom_rmtfs_mem {
|
|||
|
||||
unsigned int client_id;
|
||||
|
||||
unsigned int perms;
|
||||
u64 perms;
|
||||
};
|
||||
|
||||
static ssize_t qcom_rmtfs_mem_show(struct device *dev,
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ extern int qcom_scm_mem_protect_video_var(u32 cp_start, u32 cp_size,
|
|||
u32 cp_nonpixel_start,
|
||||
u32 cp_nonpixel_size);
|
||||
extern int qcom_scm_assign_mem(phys_addr_t mem_addr, size_t mem_sz,
|
||||
unsigned int *src,
|
||||
u64 *src,
|
||||
const struct qcom_scm_vmperm *newvm,
|
||||
unsigned int dest_cnt);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue