|
Pablo Greco |
e6a3ae |
From 28a766b8099f5e745dbfc18834277039643214a3 Mon Sep 17 00:00:00 2001
|
|
Pablo Greco |
e6a3ae |
From: Laszlo Ersek <lersek@redhat.com>
|
|
Pablo Greco |
e6a3ae |
Date: Thu, 12 Sep 2019 13:04:58 +0100
|
|
Pablo Greco |
e6a3ae |
Subject: [PATCH 01/22] accel: use g_strsplit for parsing accelerator names
|
|
Pablo Greco |
e6a3ae |
MIME-Version: 1.0
|
|
Pablo Greco |
e6a3ae |
Content-Type: text/plain; charset=UTF-8
|
|
Pablo Greco |
e6a3ae |
Content-Transfer-Encoding: 8bit
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
RH-Author: Laszlo Ersek <lersek@redhat.com>
|
|
Pablo Greco |
e6a3ae |
Message-id: <20190912130503.14094-2-lersek@redhat.com>
|
|
Pablo Greco |
e6a3ae |
Patchwork-id: 90437
|
|
Pablo Greco |
e6a3ae |
O-Subject: [RHEL-8.2.0 qemu-kvm PATCH 1/6] accel: use g_strsplit for parsing accelerator names
|
|
Pablo Greco |
e6a3ae |
Bugzilla: 1749022
|
|
Pablo Greco |
e6a3ae |
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
|
Pablo Greco |
e6a3ae |
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
|
Pablo Greco |
e6a3ae |
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
From: Daniel P. Berrangé <berrange@redhat.com>
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
Instead of re-using the get_opt_name() method from QemuOpts to split a
|
|
Pablo Greco |
e6a3ae |
string on ':', just use g_strsplit().
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
RHEL8 notes:
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
- Fix up upstream's obviously garbled UTF8 sequences in Dan's name (Author
|
|
Pablo Greco |
e6a3ae |
meta-datum, Signed-off-by tags).
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
- Harmless context difference due to downstream-only commit 8b53513834e6
|
|
Pablo Greco |
e6a3ae |
("Use kvm by default", 2018-04-24).
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
|
Pablo Greco |
e6a3ae |
Message-Id: <20180416111743.8473-2-berrange@redhat.com>
|
|
Pablo Greco |
e6a3ae |
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Pablo Greco |
e6a3ae |
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
|
Pablo Greco |
e6a3ae |
(cherry picked from commit 20efc49ed625585809401d8293ad9267927a6a4a)
|
|
Pablo Greco |
e6a3ae |
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
|
|
Pablo Greco |
e6a3ae |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
Pablo Greco |
e6a3ae |
---
|
|
Pablo Greco |
e6a3ae |
accel/accel.c | 16 +++++++---------
|
|
Pablo Greco |
e6a3ae |
include/qemu/option.h | 1 -
|
|
Pablo Greco |
e6a3ae |
util/qemu-option.c | 3 ++-
|
|
Pablo Greco |
e6a3ae |
3 files changed, 9 insertions(+), 11 deletions(-)
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
diff --git a/accel/accel.c b/accel/accel.c
|
|
Pablo Greco |
e6a3ae |
index 5f3d73f..57390e5 100644
|
|
Pablo Greco |
e6a3ae |
--- a/accel/accel.c
|
|
Pablo Greco |
e6a3ae |
+++ b/accel/accel.c
|
|
Pablo Greco |
e6a3ae |
@@ -70,8 +70,8 @@ static int accel_init_machine(AccelClass *acc, MachineState *ms)
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
void configure_accelerator(MachineState *ms)
|
|
Pablo Greco |
e6a3ae |
{
|
|
Pablo Greco |
e6a3ae |
- const char *accel, *p;
|
|
Pablo Greco |
e6a3ae |
- char buf[10];
|
|
Pablo Greco |
e6a3ae |
+ const char *accel;
|
|
Pablo Greco |
e6a3ae |
+ char **accel_list, **tmp;
|
|
Pablo Greco |
e6a3ae |
int ret;
|
|
Pablo Greco |
e6a3ae |
bool accel_initialised = false;
|
|
Pablo Greco |
e6a3ae |
bool init_failed = false;
|
|
Pablo Greco |
e6a3ae |
@@ -83,13 +83,10 @@ void configure_accelerator(MachineState *ms)
|
|
Pablo Greco |
e6a3ae |
accel = "kvm:tcg";
|
|
Pablo Greco |
e6a3ae |
}
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
- p = accel;
|
|
Pablo Greco |
e6a3ae |
- while (!accel_initialised && *p != '\0') {
|
|
Pablo Greco |
e6a3ae |
- if (*p == ':') {
|
|
Pablo Greco |
e6a3ae |
- p++;
|
|
Pablo Greco |
e6a3ae |
- }
|
|
Pablo Greco |
e6a3ae |
- p = get_opt_name(buf, sizeof(buf), p, ':');
|
|
Pablo Greco |
e6a3ae |
- acc = accel_find(buf);
|
|
Pablo Greco |
e6a3ae |
+ accel_list = g_strsplit(accel, ":", 0);
|
|
Pablo Greco |
e6a3ae |
+
|
|
Pablo Greco |
e6a3ae |
+ for (tmp = accel_list; !accel_initialised && tmp && *tmp; tmp++) {
|
|
Pablo Greco |
e6a3ae |
+ acc = accel_find(*tmp);
|
|
Pablo Greco |
e6a3ae |
if (!acc) {
|
|
Pablo Greco |
e6a3ae |
continue;
|
|
Pablo Greco |
e6a3ae |
}
|
|
Pablo Greco |
e6a3ae |
@@ -107,6 +104,7 @@ void configure_accelerator(MachineState *ms)
|
|
Pablo Greco |
e6a3ae |
accel_initialised = true;
|
|
Pablo Greco |
e6a3ae |
}
|
|
Pablo Greco |
e6a3ae |
}
|
|
Pablo Greco |
e6a3ae |
+ g_strfreev(accel_list);
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
if (!accel_initialised) {
|
|
Pablo Greco |
e6a3ae |
if (!init_failed) {
|
|
Pablo Greco |
e6a3ae |
diff --git a/include/qemu/option.h b/include/qemu/option.h
|
|
Pablo Greco |
e6a3ae |
index 306fdb5..1cfe5cb 100644
|
|
Pablo Greco |
e6a3ae |
--- a/include/qemu/option.h
|
|
Pablo Greco |
e6a3ae |
+++ b/include/qemu/option.h
|
|
Pablo Greco |
e6a3ae |
@@ -28,7 +28,6 @@
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
#include "qemu/queue.h"
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
-const char *get_opt_name(char *buf, int buf_size, const char *p, char delim);
|
|
Pablo Greco |
e6a3ae |
const char *get_opt_value(char *buf, int buf_size, const char *p);
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
void parse_option_size(const char *name, const char *value,
|
|
Pablo Greco |
e6a3ae |
diff --git a/util/qemu-option.c b/util/qemu-option.c
|
|
Pablo Greco |
e6a3ae |
index 95e6cf4..a8db173 100644
|
|
Pablo Greco |
e6a3ae |
--- a/util/qemu-option.c
|
|
Pablo Greco |
e6a3ae |
+++ b/util/qemu-option.c
|
|
Pablo Greco |
e6a3ae |
@@ -49,7 +49,8 @@
|
|
Pablo Greco |
e6a3ae |
* The return value is the position of the delimiter/zero byte after the option
|
|
Pablo Greco |
e6a3ae |
* name in p.
|
|
Pablo Greco |
e6a3ae |
*/
|
|
Pablo Greco |
e6a3ae |
-const char *get_opt_name(char *buf, int buf_size, const char *p, char delim)
|
|
Pablo Greco |
e6a3ae |
+static const char *get_opt_name(char *buf, int buf_size, const char *p,
|
|
Pablo Greco |
e6a3ae |
+ char delim)
|
|
Pablo Greco |
e6a3ae |
{
|
|
Pablo Greco |
e6a3ae |
char *q;
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
--
|
|
Pablo Greco |
e6a3ae |
1.8.3.1
|
|
Pablo Greco |
e6a3ae |
|