linux-dey:RT: fix virtio_trans build on Cortex-A9 and enable mailbox support

This patch fixes build failures of the virtio_trans driver (Cortex-A9, 32-bit ARM)
when building a PREEMPT_RT-enabled kernel. The errors were caused by
unresolved 64-bit division symbols (__aeabi_uldivmod / __aeabi_ldivmod)
generated when the driver was compiled as a module.

Changes included:

* virtio_trans.c:
  - Replace 64-bit modulus operations (`idx % vt->{tx,rx}_vring_size`) with
    kernel-safe 64-bit division macros using `div_u64_rem()`.
    This prevents implicit calls to non-exported ARM EABI helpers that are not
    available to kernel modules on 32-bit ARM.

* fragment-nxp-rt.config:
  - Enable the mailbox framework (`CONFIG_MAILBOX=y`) required by virtio
    mailbox-based transports.
  - Build the virtio transport driver into the kernel (`CONFIG_VIRTIO_TRANS=y`)
    instead of as a module, ensuring proper symbol resolution
    during link time. Without this a license error is shown when building
    the kernel in yocto.

https://onedigi.atlassian.net/browse/DEL-9783

Signed-off-by: Francisco Gil <francisco.gilmartinez@digi.com>
This commit is contained in:
Francisco Gil 2025-10-10 13:41:54 +02:00
parent 985e973d6e
commit b3a84b1d4e
2 changed files with 13 additions and 5 deletions

View File

@ -43642,6 +43642,7 @@ index 000000000000..13c003e2ba45
+#include <linux/pagemap.h>
+#include <linux/init.h>
+#include <linux/list.h>
+#include <linux/math64.h>
+#include <linux/poll.h>
+#include <linux/sched.h>
+#include <linux/slab.h>
@ -43815,8 +43816,11 @@ index 000000000000..13c003e2ba45
+ }
+
+ spin_lock(&vt->txvq_lock);
+ virttrans_queue_txbuf(vt, &vt->tx_sgl[idx % vt->tx_vring_size],
+ buf, vt->pkt_size);
+ u64 tmp_idx = idx;
+ u32 tmp_rem;
+ div_u64_rem(tmp_idx, vt->tx_vring_size, &tmp_rem);
+ virttrans_queue_txbuf(vt, &vt->tx_sgl[tmp_rem],
+ buf, vt->pkt_size);
+ idx++;
+ spin_unlock(&vt->txvq_lock);
+
@ -43952,8 +43956,11 @@ index 000000000000..13c003e2ba45
+ }
+
+ spin_lock(&vt->rxvq_lock);
+ virttrans_queue_rxbuf(vt, &vt->rx_sgl[idx % vt->rx_vring_size],
+ buf, vt->pkt_size);
+ u64 tmp_idx = idx;
+ u32 tmp_rem;
+ div_u64_rem(tmp_idx, vt->rx_vring_size, &tmp_rem);
+ virttrans_queue_rxbuf(vt, &vt->rx_sgl[tmp_rem],
+ buf, vt->pkt_size);
+ idx++;
+ spin_unlock(&vt->rxvq_lock);
+

View File

@ -12,6 +12,7 @@ CONFIG_NET_EMATCH_STACK=32
CONFIG_NET_EMATCH_U32=y
CONFIG_NET_EMATCH_META=y
CONFIG_NET_PKTGEN=y
CONFIG_MAILBOX=y
CONFIG_VIRTIO_NET=m
CONFIG_NET_DSA_NETC=m
CONFIG_NET_DSA_NETC_PTP=y
@ -21,7 +22,7 @@ CONFIG_EXPERT=y
CONFIG_PREEMPT_RT=y
CONFIG_RPMSG_TTY=m
CONFIG_GENERIC_SOFTWARE_MAILBOX=y
CONFIG_VIRTIO_TRANS=m
CONFIG_VIRTIO_TRANS=y
CONFIG_ACPI_CONTAINER=y
CONFIG_THERMAL=y
CONFIG_CLK_QORIQ=y