Skip to content

Commit 79684f2

Browse files
committed
Merge tag 'ffa-fix-6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/sudeep.holla/linux into arm/fixes
Arm FF-A fix for v6.6 It has been reported that the driver sets the memory region attributes for MEM_LEND operation when the specification clearly states not to. The fix here addresses the issue by ensuring the memory region attributes are cleared for the memory lending operation. * tag 'ffa-fix-6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/sudeep.holla/linux: firmware: arm_ffa: Don't set the memory region attributes for MEM_LEND Link: https://lore.kernel.org/r/20230927121555.158619-1-sudeep.holla@arm.com Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2 parents a16d7a3 + 9dda117 commit 79684f2

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

drivers/firmware/arm_ffa/driver.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,19 @@ static u32 ffa_get_num_pages_sg(struct scatterlist *sg)
397397
return num_pages;
398398
}
399399

400+
static u8 ffa_memory_attributes_get(u32 func_id)
401+
{
402+
/*
403+
* For the memory lend or donate operation, if the receiver is a PE or
404+
* a proxy endpoint, the owner/sender must not specify the attributes
405+
*/
406+
if (func_id == FFA_FN_NATIVE(MEM_LEND) ||
407+
func_id == FFA_MEM_LEND)
408+
return 0;
409+
410+
return FFA_MEM_NORMAL | FFA_MEM_WRITE_BACK | FFA_MEM_INNER_SHAREABLE;
411+
}
412+
400413
static int
401414
ffa_setup_and_transmit(u32 func_id, void *buffer, u32 max_fragsize,
402415
struct ffa_mem_ops_args *args)
@@ -413,8 +426,7 @@ ffa_setup_and_transmit(u32 func_id, void *buffer, u32 max_fragsize,
413426
mem_region->tag = args->tag;
414427
mem_region->flags = args->flags;
415428
mem_region->sender_id = drv_info->vm_id;
416-
mem_region->attributes = FFA_MEM_NORMAL | FFA_MEM_WRITE_BACK |
417-
FFA_MEM_INNER_SHAREABLE;
429+
mem_region->attributes = ffa_memory_attributes_get(func_id);
418430
ep_mem_access = &mem_region->ep_mem_access[0];
419431

420432
for (idx = 0; idx < args->nattrs; idx++, ep_mem_access++) {

0 commit comments

Comments
 (0)