virt/qemu/debian/patches/0003-STX-qemu-dpdk-changes-for-openvswitch-dpdk.patch
dliu5 f08c85737a Upgrade qemu to 7.2.0.
As we add kata container support for StarlingX
with the latest kata containers stable version 3.1.3.

We need to upgrade qemu to 7.2.0 version to make them
compatible.

Test plan:
PASS - Build qemu package.
PASS - Build /install image on AIO-SX.
PASS - Verify the package is installed in the system.
PASS - Verify the qemu-utils correctly installed by
       running qemi-image -V
PASS - Verify the qemu x86_64 correctly installed by
       running qemu-system-x86_64 --version
PASS - Verify stx-openstack works correctly with sanity
       and regression tests.
PASS - Verify that the kata-runtime check command print
       system is capable of running kata containers.
PASS - Verify that kubectl could create pod with kata
       containers runtime, and pod start successfully.

Story: 2010781
Task: 48183

Change-Id: Ie9fba13999023e3dce37c620864710707bc679ed
Signed-off-by: David Liu <david.liu@windriver.com>
2023-12-22 07:05:27 -05:00

205 lines
5.9 KiB
Diff

From 31ae2e35caa16dcf4cc1fa2ff5e3c1aa825b5352 Mon Sep 17 00:00:00 2001
From: Jim Somerville <Jim.Somerville@windriver.com>
Date: Fri, 26 Apr 2019 17:41:04 -0300
Subject: [PATCH] STX: qemu dpdk changes for openvswitch dpdk
Signed-off-by: Jim Somerville <Jim.Somerville@windriver.com>
Signed-off-by: Rafael Falcao <Rafael.VieiraFalcao@windriver.com>
[Rebased original changes to the qemu 7.2 version]
Signed-off-by: david.liu <david.liu@windriver.com>
---
configure | 27 +++++++++++++++++
hw/net/virtio-net.c | 5 ++++
softmmu/vl.c | 70 ++++++++++++++++++++++++++++++++++++++++++++-
3 files changed, 101 insertions(+), 1 deletion(-)
diff --git a/configure b/configure
index 5f1828f1..6b92b5cb 100755
--- a/configure
+++ b/configure
@@ -853,6 +853,11 @@ for opt do
;;
--with-coroutine=*) coroutine="$optarg"
;;
+ --disable-dpdk) dpdk="no"
+ ;;
+ --dpdkdir=*) rte_sdk="$optarg"
+ dpdk="yes"
+ ;;
--disable-zlib-test)
;;
--disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane)
@@ -2401,6 +2406,28 @@ if test -n "$gdb_bin"; then
fi
fi
+if test "$dpdk" = "yes"; then
+ if test "${rte_sdk+set}" != set; then
+ echo "No dpdkdir given"
+ exit 1
+ fi
+ echo "dpdk_dir=`eval echo $rte_sdk`" >> $config_host_mak
+ echo "dpdk_lib_dir=\$(dpdk_dir)/x86_64-default-linuxapp-gcc/lib" >> $config_host_mak_
+ echo "dpdk_inc_dir=\$(dpdk_dir)/x86_64-default-linuxapp-gcc/include" >> $config_host_mak
+ echo "" >> $config_host_mak
+ echo "dpdk_libs=\$(dpdk_lib_dir)/librte_eal.a \\" >> $config_host_mak
+ echo " \$(dpdk_lib_dir)/libethdev.a \\" >> $config_host_mak
+ echo " \$(dpdk_lib_dir)/librte_cmdline.a \\" >> $config_host_mak
+ echo " \$(dpdk_lib_dir)/librte_hash.a \\" >> $config_host_mak
+ echo " \$(dpdk_lib_dir)/librte_lpm.a \\" >> $config_host_mak
+ echo " \$(dpdk_lib_dir)/librte_mbuf.a \\" >> $config_host_mak
+ echo " \$(dpdk_lib_dir)/librte_mempool.a \\" >> $config_host_mak
+ echo " \$(dpdk_lib_dir)/librte_ring.a \\" >> $config_host_mak
+ echo " \$(dpdk_lib_dir)/librte_malloc.a" >> $config_host_mak
+ LIBS="\$(dpdk_libs) $LIBS"
+ QEMU_INCLUDES="-I\$(dpdk_inc_dir) $QEMU_INCLUDES"
+fi
+
if test "$container" != no; then
echo "ENGINE=$container" >> $config_host_mak
fi
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index aba12759..01ca6015 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -2,6 +2,7 @@
* Virtio Network Device
*
* Copyright IBM, Corp. 2007
+ * Copyright 2012-2013 Intel Corporation All Rights Reserved.
*
* Authors:
* Anthony Liguori <aliguori@us.ibm.com>
@@ -1671,6 +1672,7 @@ static void receive_header(VirtIONet *n, const struct iovec *iov, int iov_cnt,
}
}
+#if 0
static int receive_filter(VirtIONet *n, const uint8_t *buf, int size)
{
static const uint8_t bcast[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
@@ -1721,6 +1723,7 @@ static int receive_filter(VirtIONet *n, const uint8_t *buf, int size)
return 0;
}
+#endif
static uint8_t virtio_net_get_hash_type(bool isip4,
bool isip6,
@@ -1852,8 +1855,10 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,
return 0;
}
+ #if 0
if (!receive_filter(n, buf, size))
return size;
+ #endif
offset = i = 0;
diff --git a/softmmu/vl.c b/softmmu/vl.c
index a1720fe4..6c68f123 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -1583,6 +1583,35 @@ static const QEMUOption *lookup_opt(int argc, char **argv,
return popt;
}
+#ifdef CONFIG_ENABLE_DPDK
+static const QEMUOption *quick_scan_opt(int argc, char **argv, int *poptind)
+{
+ const QEMUOption *popt;
+ int optind = *poptind;
+ char *r = argv[optind];
+
+ loc_set_cmdline(argv, optind, 1);
+ optind++;
+ /* Treat --foo the same as -foo. */
+ if (r[1] == '-')
+ r++;
+ popt = qemu_options;
+ for(;;) {
+ /* need to ignore non qemu args, e.g. dpdk args */
+ if (!popt->name) {
+ *poptind = optind;
+ return NULL;
+ }
+ if (!strcmp(popt->name, r + 1))
+ break;
+ popt++;
+ }
+
+ *poptind = optind;
+ return popt;
+}
+#endif
+
static MachineClass *select_machine(QDict *qdict, Error **errp)
{
const char *optarg = qdict_get_try_str(qdict, "type");
@@ -2644,6 +2673,11 @@ void qemu_init(int argc, char **argv)
MachineClass *machine_class;
bool userconfig = true;
FILE *vmstate_dump_file = NULL;
+
+#ifdef CONFIG_ENABLE_DPDK
+ bool use_dpdk = false;
+ int retval;
+#endif
qemu_add_opts(&qemu_drive_opts);
qemu_add_drive_opts(&qemu_legacy_drive_opts);
@@ -2680,7 +2714,38 @@ void qemu_init(int argc, char **argv)
error_init(argv[0]);
qemu_init_exec_dir(argv[0]);
-
+
+#ifdef CONFIG_ENABLE_DPDK
+ /* need to check for -enable-dpdk before calling rte_eal_init. If
+ * it is not found, don't call rte_eal_init */
+ optind = 1;
+ while (optind < argc) {
+ if (argv[optind][0] != '-') {
+ /* disk image */
+ optind++;
+ continue;
+ } else {
+ const QEMUOption *popt;
+ popt = quick_scan_opt(argc, argv, &optind);
+ if (popt) {
+ switch (popt->index) {
+ case QEMU_OPTION_enable_dpdk:
+ use_dpdk = true;
+ break;
+ }
+ }
+ }
+ }
+
+ if (use_dpdk) {
+ if ((retval = rte_eal_init(argc, argv)) < 0)
+ return -1;
+
+ argc -= retval;
+ argv += retval;
+ }
+#endif
+
qemu_init_arch_modules();
qemu_init_subsystems();
@@ -3532,6 +3597,9 @@ void qemu_init(int argc, char **argv)
cpu_timers_init();
user_register_global_props();
+
+ extern int rte_eal_init(int argc, char **argv);
+
replay_configure(icount_opts);
configure_rtc(qemu_find_opts_singleton("rtc"));
--
2.30.2