|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH 03/10] xen/arm: ffa: fix version negotiation
Hi Bertrand, NIT Typo: s/fix/Fix/ to match the other title On 19/09/2024 14:19, Bertrand Marquis wrote: Fix FFA version negotiation with the firmware to follow the specification guidance more closely. To confirm, below is based on 13.2.1 in DEN0077A, is that correct? If so, can you add a link in the commit message (and maybe code).
Coding style: We are use a single '*' to start comment. + * As of now we only support 1.0 or 1.1. + * For any 1.x >= 1.1 return OK with 1.1 + * For 1.0 return OK with 1.0 + * For anything else return an error. + */
> + if ( (vers >> FFA_VERSION_MAJOR_SHIFT) == FFA_MY_VERSION_MAJOR )
> + {> + if ( vers < FFA_VERSION_1_1 )
+ vers = FFA_VERSION_1_0; + else + vers = FFA_VERSION_1_1; I feel the logic is fragile. The first ``if`` is generic and I think it would be easy to update the major version without updating handle_version(). To some extend, the same problem would happen with the minor version. AFAICT, this is not a new issue, but as you touch the code, we should probably harden it. I could settle with a BUILD_BUG_ON() to catch any change of the minor/major. - ctx->guest_vers = vers;- ffa_set_regs(regs, vers, 0, 0, 0, 0, 0, 0, 0); + ctx->guest_vers = vers; + ffa_set_regs(regs, vers, 0, 0, 0, 0, 0, 0, 0); + } + else + ffa_set_regs_error(regs, FFA_RET_NOT_SUPPORTED); }static void handle_msg_send_direct_req(struct cpu_user_regs *regs, uint32_t fid) Coding style: the second line should be aligned with 'vers' rather than indented.
Coding style: We start comment with /*. + * If the call succeed and the version returned is higher or equal to + * the one Xen requested, the version requested by Xen will be the one + * used. If the version returned is lower but compatible with Xen, Xen + * will use that version instead. + * A version with a different major is rejected before. + */ + if ( vers > FFA_MY_VERSION ) + ffa_fw_version = FFA_MY_VERSION; + else + ffa_fw_version = vers; Looking at the code after your series (didn't check before). We don't seem to use ffa_fw_version for other than checking that FFA was detected. So wouldn't it be better to stop storing the version? Cheers, -- Julien Grall
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |