I am trying to figure out how to reinitialize/reset the virtio_rpmsg_bus. I have an application where the m4 is loaded from linux which communicates with rpmsg. The issues I have is the virtqueues hold all of the old messages causing the m4 to read all of the old message erroneously. How can I reset the virtio bus to a fresh state?
已解决! 转到解答。
I was able to get the virtio bus to reset by making it a loadable module. When the module is removed and probed all of the memory gets cleaned up/reallocated. I had to change the Kconfig and Makefile that reside adjacent to virtio_rpmsg_bus to be as follows.
Kconfig:
menu "Rpmsg drivers"
# RPMSG always gets selected by whoever wants it
config RPMSG
tristate
select VIRTIO
select VIRTUALIZATION
config IMX_VIRTIO_RPMSG_BUS
tristate "IMX RPMSG virtio rpmsg bus -- lodable modules only"
default m
depends on RPMSG && m
config IMX_RPMSG_PINGPONG
tristate "IMX RPMSG pingpong driver -- loadable modules only"
default m
depends on RPMSG && m && IMX_VIRTIO_RPMSG_BUS
config IMX_RPMSG_TTY
tristate "IMX RPMSG tty driver -- loadable modules only"
default m
depends on RPMSG && m && IMX_VIRTIO_RPMSG_BUS
endmenu
Makefile:
obj-$(CONFIG_IMX_VIRTIO_RPMSG_BUS) += virtio_rpmsg_bus.o
obj-$(CONFIG_IMX_RPMSG_PINGPONG) += imx_rpmsg_pingpong.o
obj-$(CONFIG_IMX_RPMSG_TTY) += imx_rpmsg_tty.o
I was able to get the virtio bus to reset by making it a loadable module. When the module is removed and probed all of the memory gets cleaned up/reallocated. I had to change the Kconfig and Makefile that reside adjacent to virtio_rpmsg_bus to be as follows.
Kconfig:
menu "Rpmsg drivers"
# RPMSG always gets selected by whoever wants it
config RPMSG
tristate
select VIRTIO
select VIRTUALIZATION
config IMX_VIRTIO_RPMSG_BUS
tristate "IMX RPMSG virtio rpmsg bus -- lodable modules only"
default m
depends on RPMSG && m
config IMX_RPMSG_PINGPONG
tristate "IMX RPMSG pingpong driver -- loadable modules only"
default m
depends on RPMSG && m && IMX_VIRTIO_RPMSG_BUS
config IMX_RPMSG_TTY
tristate "IMX RPMSG tty driver -- loadable modules only"
default m
depends on RPMSG && m && IMX_VIRTIO_RPMSG_BUS
endmenu
Makefile:
obj-$(CONFIG_IMX_VIRTIO_RPMSG_BUS) += virtio_rpmsg_bus.o
obj-$(CONFIG_IMX_RPMSG_PINGPONG) += imx_rpmsg_pingpong.o
obj-$(CONFIG_IMX_RPMSG_TTY) += imx_rpmsg_tty.o
Hi Allen,
virtio_rpmsg_bus is not NXP exclusive. You can look at generic virtio infromation such as this: https://www.kernel.org/doc/Documentation/rpmsg.txt
For running RPmsg demo in NXP i.MX devices you can have a look here: Running RPMsg Demo Applications for Multicore Communication with IMX6SX and IMX7D
Regards,
Carlos
NXP Technical Support
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Carlos,
I am able to run the demo without issue. I also have read the rpmsg documentation provided at kernel.org. There is also the imx_rpmsg.c implementation backing virtio_rpmsg_bus which *is* NXP exclusive. One of the calls exposed in imx_rpmsg.c is imx_rpmsg_reset which is just stubbed out to print "reset !" instead of performing a bus reset. I don't want to seem attacking or mean but neither of your comments seem like they help the community at large as both are easily googleable. The question at hand however could prove useful to others and doesn't have an easily searchable solution.
Thanks,
Allen