From: Levi Yun <yeoreum.yun@arm.com>
UUID is saved in big endian format.
i.e) For uuid "378daedc-f06b-4446-8314-40ab933c87a3",
It should be saved in memory like:
37 8d ae dc
f0 6b 44 46
83 14 40 ab
93 3c 87 a3
Accoding to FF-A specification[0] 15.4 FFA_MSG_SEND_DRIECT_REQ2,
then UUID is saved in register:
UUID Lo x2 Bytes[0...7] of UUID with byte 0 in the low-order bits.
UUID Hi x3 Bytes[8...15] of UUID with byte 8 in the low-order bits.
That means, we don't need to swap the uuid when it send via direct
message request version 2, just send it as saved in memory.
Remove le64_to_cpu() for uuid in direct message request version 2,
and change uuid_regs' type to __be64 because UUID is saved in network
byte order.
Link: https://developer.arm.com/documentation/den0077/latest [0]
Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
---
drivers/firmware/arm_ffa/driver.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c
index a3a9cdec7389..4a6bc6520d25 100644
--- a/drivers/firmware/arm_ffa/driver.c
+++ b/drivers/firmware/arm_ffa/driver.c
@@ -483,13 +483,13 @@ static int ffa_msg_send_direct_req2(u16 src_id, u16 dst_id, const uuid_t *uuid,
u32 src_dst_ids = PACK_TARGET_INFO(src_id, dst_id);
union {
uuid_t uuid;
- __le64 regs[2];
+ __be64 regs[2];
} uuid_regs = { .uuid = *uuid };
ffa_value_t ret, args = {
.a0 = FFA_MSG_SEND_DIRECT_REQ2,
.a1 = src_dst_ids,
- .a2 = le64_to_cpu(uuid_regs.regs[0]),
- .a3 = le64_to_cpu(uuid_regs.regs[1]),
+ .a2 = uuid_regs.regs[0],
+ .a3 = uuid_regs.regs[1],
};
memcpy((void *)&args + offsetof(ffa_value_t, a4), data, sizeof(*data));
--
LEVI:{C3F47F37-75D8-414A-A8BA-3980EC8A46D7}
On Mon, Nov 25, 2024 at 09:52:51AM +0000, Yeoreum Yun wrote: > From: Levi Yun <yeoreum.yun@arm.com> > > UUID is saved in big endian format. > i.e) For uuid "378daedc-f06b-4446-8314-40ab933c87a3", > > It should be saved in memory like: > 37 8d ae dc > f0 6b 44 46 > 83 14 40 ab > 93 3c 87 a3 > > Accoding to FF-A specification[0] 15.4 FFA_MSG_SEND_DRIECT_REQ2, > then UUID is saved in register: > UUID Lo x2 Bytes[0...7] of UUID with byte 0 in the low-order bits. > UUID Hi x3 Bytes[8...15] of UUID with byte 8 in the low-order bits. > > That means, we don't need to swap the uuid when it send via direct > message request version 2, just send it as saved in memory. > > Remove le64_to_cpu() for uuid in direct message request version 2, > and change uuid_regs' type to __be64 because UUID is saved in network > byte order. > | warning: incorrect type in initializer (different base types) | expected unsigned long a2 | got restricted __be64 | warning: incorrect type in initializer (different base types) | expected unsigned long a3 | got restricted __be64 We will get this warning back with this change, wondering if we can take up BE support separately. -- Regards, Sudeep
Hi, Sudeep. > > | warning: incorrect type in initializer (different base types) > | expected unsigned long a2 > | got restricted __be64 > | warning: incorrect type in initializer (different base types) > | expected unsigned long a3 > | got restricted __be64 > > We will get this warning back with this change, wondering if we can take > up BE support separately. Sorry. I'll change the type :\ Thanks to let me know!
© 2016 - 2026 Red Hat, Inc.