-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ipm driver for AMD-Xilinx platforms. #61008
Conversation
openamp shared memory regions can be anywhere in DDR memory withing 2G range. Current SRAM_PRIV region is 64M which prevents access of shared memory (vrings) by RPU (cortex-r5) if it is out of 64M range. This patch allows vrings to be in DDR within 2G address space. Developed-by: Dan Millea Commited by: Tanmay Shah Signed-off-by: Dan Milea <dan.milea@windriver.com> Signed-off-by: Tanmay Shah <tanmay.shah@amd.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @TanmayShah-xilinx, and thank you very much for your first pull request to the Zephyr project!
A project maintainer just triggered our CI pipeline to run it against your PR and ensure it's compliant and doesn't cause any issues. You might want to take this opportunity to review the project's Contributor Expectations and make any updates to your pull request if necessary. 😊
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have some question and initial minor nitpicks here.
@carlocaione @uLipe requesting reviews. |
@uLipe I agree to all the comments, but I will wait for more comments before addressing them. Please let me know explicitly once you are done reviewing this patch set, so I can start working on all the comments at the same time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not using the MBOX API instead that is supporting multiple channels out-of-the-box instead of having to tweak the IPM API?
drivers/ipm/ipm_xlnx_ipi.c
Outdated
#define READ8_REG(reg, offset) sys_read8((reg) + (offset)) | ||
#define WRITE8_REG(reg, offset, val) sys_write8(val, (reg) + (offset)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useless macros, remove those.
drivers/ipm/ipm_xlnx_ipi.c
Outdated
uint32_t remote_ipi_ch_bit; | ||
}; | ||
|
||
static ALWAYS_INLINE void set_bit(const uint32_t addr, uint32_t offset, uint8_t bit) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, use sys_set_bit
& co. Same for clear
and test
.
@carlocaione , I talked to @tnmysh , and the reason of providing the IPM first is to avoid breaking changes on the zephyr system reference applications from openAMP, the samples consumes the IPM driver in the same way the current openamp in-tree samples does ( excluding the new static vrings based, that already use mbox). Can we move forward with this last one driver? And put the mbox driver on the backlog as we did for the IVSHMEM IPM? Thanks :) |
Alright, but something still needs to be addressed in this driver (see my comments). |
Got it, thank you! |
Thanks @carlocaione and @uLipe for reviews. If you are done reviewing this patchset, I will address all the comments. If you need more time for reviews please let me know. |
@tnmysh I'm done with my review for now :) |
yup, waiting for the new revision. |
Changes in v2:
|
Add ipm driver to use Inter Processor Interrupts on Xilinx ZynqMP platform. This patch also adds sample application that shows use of xlnx ipm driver. This driver uses default arm gic interrupt controller and works only for lockstep mode of cortex-r5f cluster for now. In split mode the cortex-r5 cluster will have two r5f cores and they are expected to work in AMP mode. If both r5f cores run simultaneouly, only one of the core is able to receive IPI interrupts at this time and it will be the one that started later. In future this limitation shall be removed. Signed-off-by: Tanmay Shah <tanmay.shah@amd.com>
Added header xlnx_ipi_ipm.h file in latest push. |
#include <zephyr/logging/log.h> | ||
|
||
#include "ipm_xlnx_ipi.h" | ||
LOG_MODULE_REGISTER(ipm_xlnx_ipi, CONFIG_IPM_LOG_LEVEL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: please group the log include files with LOG_MODULE_REGISTER macro.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just left a minor comment, overall LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM just a couple of comments
const struct xlnx_ipi_child_config *cdev_conf; | ||
|
||
cdev_conf = dev->config; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useless?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to remove this. Since, this PR is merged, I will create separate change Thanks.
return -EMSGSIZE; | ||
} | ||
|
||
key = irq_lock(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason to use irq_lock
over something SMP safe like using a spinlock?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Carlo, Thanks for reviews.
Actually this driver can be used in SMP mode or AMP mode.
For AMP mode, we may not need spinlocks. For SMP mode we will need spinlocks. I will add that support in separate patch.
Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried added spinlocks, but didn't work as expected. ipi_send can be called from interrupt context. Instead I will have to add workqueue support for each child's callback that are currently being called from ISR. This will be taken care later when SMP use cases are enabled. For now would like to go ahead with simple irq_lock();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @tnmysh!
Congratulations on getting your very first Zephyr pull request merged 🎉🥳. This is a fantastic achievement, and we're thrilled to have you as part of our community!
To celebrate this milestone and showcase your contribution, we'd love to award you the Zephyr Technical Contributor badge. If you're interested, please claim your badge by filling out this form: Claim Your Zephyr Badge.
Thank you for your valuable input, and we look forward to seeing more of your contributions in the future! 🪁
This PR introduces new IPM driver for AMD-Xilinx platforms.
The sample demo is available in openamp-system-reference repository here that is using this driver to communicate with host processor: https://github.com/OpenAMP/openamp-system-reference/tree/main/examples/zephyr/rpmsg_multi_services
This PR also extends MPU SRAM_PRIV region from 64M to 2G for this demo to work.