Phil-Engljaehringer commented on PR #21114: URL: https://github.com/apache/nuttx/pull/21114#issuecomment-6575214849
Thanks @CV-Bowen, @xiaoxiang781216 and @casaroli for the review. As @casaroli pointed out, imx9_rptun_start() can't be used: rptun_start() calls RPTUN_START() only in the master role, and imx9 runs as the remote. Ringing the doorbell in imx9_rptun_register_callback() would work on master, since rptun_do_start() registers the callback before rptun_start_thread() polls for DRIVER_OK. However, we also need this change in PX4's NuttX fork, which is based on NuttX 12.12, and there the imx9 driver and the rptun start sequence are different. rptun_dev_start() waits for DRIVER_OK inside remoteproc_create_virtio() and only calls RPTUN_REGISTER_CALLBACK() after the host has attached. A doorbell rung in register_callback would only reach the host after it has already attached, so the remote would wait forever. That solution can't be backported to PX4. Without changing the rptun framework, the best place for the doorbell is in imx9_rptun_get_resource(), right after imx9_rsctable_copy(). In both trees this runs on every start, before the remote begins waiting for the host, so the same driver-only change works on master and in PX4. The doorbell would only ring when a fresh table was actually copied, with a UP_DSB() before the MU write so that the table is completely written before the host sees the interrupt. kick_host would be dropped from struct rptun_ops_s, and so would the documentation update for it. The downside is that imx9_rptun_get_resource() then has a side effect you wouldn't expect from its name. I would document that in a comment there. Would you accept this solution? If so, I'll implement and test it and update the PR. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
