Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+14 -2
+14 -2
drivers/firmware/arm_ffa/driver.c
··· 397 397 return num_pages; 398 398 } 399 399 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 + 400 413 static int 401 414 ffa_setup_and_transmit(u32 func_id, void *buffer, u32 max_fragsize, 402 415 struct ffa_mem_ops_args *args) ··· 426 413 mem_region->tag = args->tag; 427 414 mem_region->flags = args->flags; 428 415 mem_region->sender_id = drv_info->vm_id; 429 - mem_region->attributes = FFA_MEM_NORMAL | FFA_MEM_WRITE_BACK | 430 - FFA_MEM_INNER_SHAREABLE; 416 + mem_region->attributes = ffa_memory_attributes_get(func_id); 431 417 ep_mem_access = &mem_region->ep_mem_access[0]; 432 418 433 419 for (idx = 0; idx < args->nattrs; idx++, ep_mem_access++) {