* [Qemu-devel] [PATCH] Add tab-completion for device_add.
@ 2012-01-08 15:14 Andrzej Zaborowski
2012-01-09 2:19 ` andrzej zaborowski
0 siblings, 1 reply; 6+ messages in thread
From: Andrzej Zaborowski @ 2012-01-08 15:14 UTC (permalink / raw)
To: qemu-devel
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
---
There are other ways to do this, but adding an API for querying
available qdev drivers was the one that made most sense to me.
---
hw/qdev.c | 38 ++++++++++++++++++++++++++++++++++++++
hw/qdev.h | 7 +++++++
monitor.c | 41 +++++++++++++++++++++++++++++++++++++++++
3 files changed, 86 insertions(+), 0 deletions(-)
diff --git a/hw/qdev.c b/hw/qdev.c
index d0cf66d..ba97312 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -1535,3 +1535,41 @@ void qdev_machine_init(void)
qdev_get_peripheral_anon();
qdev_get_peripheral();
}
+
+int qdev_driver_foreach(qdev_driver_foreach_func func, void *opaque)
+{
+ DeviceInfo *info;
+ int ret = 0;
+
+ for (info = device_info_list; info != NULL; info = info->next) {
+ ret |= (*func)(info, opaque);
+ }
+
+ return ret;
+}
+
+int qdev_driver_prop_foreach(qdev_driver_prop_foreach_func func,
+ const char *driver, void *opaque)
+{
+ DeviceInfo *info;
+ Property *prop;
+ int ret = 0;
+
+ info = qdev_find_info(NULL, driver);
+ if (!info) {
+ return -1;
+ }
+
+ for (prop = info->props; prop && prop->name; prop++) {
+ /*
+ * TODO Properties without a parser are just for dirty hacks.
+ * See comment in qdev_device_help.
+ */
+ if (!prop->info->parse) {
+ continue; /* no way to set it, don't show */
+ }
+ ret |= (*func)(prop, opaque);
+ }
+
+ return ret;
+}
diff --git a/hw/qdev.h b/hw/qdev.h
index 2abb767..b72a31a 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -624,4 +624,11 @@ char *qdev_get_type(DeviceState *dev, Error **errp);
*/
void qdev_machine_init(void);
+/* Driver querying */
+typedef int (*qdev_driver_foreach_func)(DeviceInfo *info, void *opaque);
+int qdev_driver_foreach(qdev_driver_foreach_func func, void *opaque);
+typedef int (*qdev_driver_prop_foreach_func)(Property *info, void *opaque);
+int qdev_driver_prop_foreach(qdev_driver_prop_foreach_func func,
+ const char *driver, void *opaque);
+
#endif
diff --git a/monitor.c b/monitor.c
index 7334401..3eab307 100644
--- a/monitor.c
+++ b/monitor.c
@@ -4069,6 +4069,28 @@ static void block_completion_it(void *opaque, BlockDriverState *bs)
}
}
+static int driver_completion_it(DeviceInfo *info, void *opaque)
+{
+ const char *input = opaque;
+
+ if (input[0] == '\0' || !strncmp(info->name, input, strlen(input))) {
+ readline_add_completion(cur_mon->rs, info->name);
+ }
+
+ return 0;
+}
+
+static int driver_prop_completion_it(Property *prop, void *opaque)
+{
+ const char *input = opaque;
+
+ if (input[0] == '\0' || !strncmp(prop->name, input, strlen(input))) {
+ readline_add_completion(cur_mon->rs, prop->name);
+ }
+
+ return 0;
+}
+
/* NOTE: this parser is an approximate form of the real command parser */
static void parse_cmdline(const char *cmdline,
int *pnb_args, char **args)
@@ -4109,6 +4131,7 @@ static void monitor_find_completion(const char *cmdline)
const char *ptype, *str;
const mon_cmd_t *cmd;
const KeyDef *key;
+ char *pkey;
parse_cmdline(cmdline, &nb_args, args);
#ifdef DEBUG_COMPLETION
@@ -4147,6 +4170,7 @@ static void monitor_find_completion(const char *cmdline)
goto cleanup;
}
+ key_get_info(cmd->args_type, &pkey);
ptype = next_arg_type(cmd->args_type);
for(i = 0; i < nb_args - 2; i++) {
if (*ptype != '\0') {
@@ -4192,9 +4216,26 @@ static void monitor_find_completion(const char *cmdline)
}
}
break;
+ case 'O':
+ if (!strcmp(pkey, "device")) {
+ char *sep = strrchr(str, ',');
+
+ readline_set_completion_index(cur_mon->rs,
+ strlen(sep ? sep + 1 : str));
+ if (sep) {
+ char *driver = qemu_strndup(str, strchr(str, ',') - str);
+ qdev_driver_prop_foreach(driver_prop_completion_it,
+ driver, (void *) (sep + 1));
+ qemu_free(driver);
+ } else {
+ qdev_driver_foreach(driver_completion_it, (void *) str);
+ }
+ }
+ break;
default:
break;
}
+ qemu_free(pkey);
}
cleanup:
--
1.7.4.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH] Add tab-completion for device_add.
[not found] <yes>
@ 2012-01-08 15:28 ` Andrzej Zaborowski
2012-01-12 17:01 ` Anthony Liguori
2019-12-04 9:36 ` [PATCH] i386: pass CLZERO to guests with EPYC CPU model on AMD ZEN platform Ani Sinha
1 sibling, 1 reply; 6+ messages in thread
From: Andrzej Zaborowski @ 2012-01-08 15:28 UTC (permalink / raw)
To: qemu-devel
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
---
There are other ways to do this, but adding an API for querying
available qdev drivers was the one that made most sense to me.
---
hw/qdev.c | 38 ++++++++++++++++++++++++++++++++++++++
hw/qdev.h | 7 +++++++
monitor.c | 41 +++++++++++++++++++++++++++++++++++++++++
3 files changed, 86 insertions(+), 0 deletions(-)
diff --git a/hw/qdev.c b/hw/qdev.c
index d0cf66d..ba97312 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -1535,3 +1535,41 @@ void qdev_machine_init(void)
qdev_get_peripheral_anon();
qdev_get_peripheral();
}
+
+int qdev_driver_foreach(qdev_driver_foreach_func func, void *opaque)
+{
+ DeviceInfo *info;
+ int ret = 0;
+
+ for (info = device_info_list; info != NULL; info = info->next) {
+ ret |= (*func)(info, opaque);
+ }
+
+ return ret;
+}
+
+int qdev_driver_prop_foreach(qdev_driver_prop_foreach_func func,
+ const char *driver, void *opaque)
+{
+ DeviceInfo *info;
+ Property *prop;
+ int ret = 0;
+
+ info = qdev_find_info(NULL, driver);
+ if (!info) {
+ return -1;
+ }
+
+ for (prop = info->props; prop && prop->name; prop++) {
+ /*
+ * TODO Properties without a parser are just for dirty hacks.
+ * See comment in qdev_device_help.
+ */
+ if (!prop->info->parse) {
+ continue; /* no way to set it, don't show */
+ }
+ ret |= (*func)(prop, opaque);
+ }
+
+ return ret;
+}
diff --git a/hw/qdev.h b/hw/qdev.h
index 2abb767..b72a31a 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -624,4 +624,11 @@ char *qdev_get_type(DeviceState *dev, Error **errp);
*/
void qdev_machine_init(void);
+/* Driver querying */
+typedef int (*qdev_driver_foreach_func)(DeviceInfo *info, void *opaque);
+int qdev_driver_foreach(qdev_driver_foreach_func func, void *opaque);
+typedef int (*qdev_driver_prop_foreach_func)(Property *info, void *opaque);
+int qdev_driver_prop_foreach(qdev_driver_prop_foreach_func func,
+ const char *driver, void *opaque);
+
#endif
diff --git a/monitor.c b/monitor.c
index 7334401..3eab307 100644
--- a/monitor.c
+++ b/monitor.c
@@ -4069,6 +4069,28 @@ static void block_completion_it(void *opaque, BlockDriverState *bs)
}
}
+static int driver_completion_it(DeviceInfo *info, void *opaque)
+{
+ const char *input = opaque;
+
+ if (input[0] == '\0' || !strncmp(info->name, input, strlen(input))) {
+ readline_add_completion(cur_mon->rs, info->name);
+ }
+
+ return 0;
+}
+
+static int driver_prop_completion_it(Property *prop, void *opaque)
+{
+ const char *input = opaque;
+
+ if (input[0] == '\0' || !strncmp(prop->name, input, strlen(input))) {
+ readline_add_completion(cur_mon->rs, prop->name);
+ }
+
+ return 0;
+}
+
/* NOTE: this parser is an approximate form of the real command parser */
static void parse_cmdline(const char *cmdline,
int *pnb_args, char **args)
@@ -4109,6 +4131,7 @@ static void monitor_find_completion(const char *cmdline)
const char *ptype, *str;
const mon_cmd_t *cmd;
const KeyDef *key;
+ char *pkey;
parse_cmdline(cmdline, &nb_args, args);
#ifdef DEBUG_COMPLETION
@@ -4147,6 +4170,7 @@ static void monitor_find_completion(const char *cmdline)
goto cleanup;
}
+ key_get_info(cmd->args_type, &pkey);
ptype = next_arg_type(cmd->args_type);
for(i = 0; i < nb_args - 2; i++) {
if (*ptype != '\0') {
@@ -4192,9 +4216,26 @@ static void monitor_find_completion(const char *cmdline)
}
}
break;
+ case 'O':
+ if (!strcmp(pkey, "device")) {
+ char *sep = strrchr(str, ',');
+
+ readline_set_completion_index(cur_mon->rs,
+ strlen(sep ? sep + 1 : str));
+ if (sep) {
+ char *driver = g_strndup(str, strchr(str, ',') - str);
+ qdev_driver_prop_foreach(driver_prop_completion_it,
+ driver, (void *) (sep + 1));
+ g_free(driver);
+ } else {
+ qdev_driver_foreach(driver_completion_it, (void *) str);
+ }
+ }
+ break;
default:
break;
}
+ g_free(pkey);
}
cleanup:
--
1.7.4.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] Add tab-completion for device_add.
2012-01-08 15:14 [Qemu-devel] [PATCH] Add tab-completion for device_add Andrzej Zaborowski
@ 2012-01-09 2:19 ` andrzej zaborowski
0 siblings, 0 replies; 6+ messages in thread
From: andrzej zaborowski @ 2012-01-09 2:19 UTC (permalink / raw)
To: qemu-devel
On 8 January 2012 16:14, Andrzej Zaborowski <balrogg@gmail.com> wrote:
> Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
> ---
> There are other ways to do this, but adding an API for querying
> available qdev drivers was the one that made most sense to me.
> ---
> hw/qdev.c | 38 ++++++++++++++++++++++++++++++++++++++
> hw/qdev.h | 7 +++++++
> monitor.c | 41 +++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 86 insertions(+), 0 deletions(-)
Sorry, sent the old version of the patch, please look at the one I'll
send in a minute instead.
Cheers
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] Add tab-completion for device_add.
2012-01-08 15:28 ` [Qemu-devel] [PATCH] Add tab-completion for device_add Andrzej Zaborowski
@ 2012-01-12 17:01 ` Anthony Liguori
0 siblings, 0 replies; 6+ messages in thread
From: Anthony Liguori @ 2012-01-12 17:01 UTC (permalink / raw)
To: Andrzej Zaborowski; +Cc: qemu-devel
On 01/08/2012 09:28 AM, Andrzej Zaborowski wrote:
> Signed-off-by: Andrzej Zaborowski<andrew.zaborowski@intel.com>
> ---
> There are other ways to do this, but adding an API for querying
> available qdev drivers was the one that made most sense to me.
> ---
> hw/qdev.c | 38 ++++++++++++++++++++++++++++++++++++++
> hw/qdev.h | 7 +++++++
> monitor.c | 41 +++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 86 insertions(+), 0 deletions(-)
>
> diff --git a/hw/qdev.c b/hw/qdev.c
> index d0cf66d..ba97312 100644
> --- a/hw/qdev.c
> +++ b/hw/qdev.c
> @@ -1535,3 +1535,41 @@ void qdev_machine_init(void)
> qdev_get_peripheral_anon();
> qdev_get_peripheral();
> }
> +
> +int qdev_driver_foreach(qdev_driver_foreach_func func, void *opaque)
> +{
> + DeviceInfo *info;
> + int ret = 0;
> +
> + for (info = device_info_list; info != NULL; info = info->next) {
> + ret |= (*func)(info, opaque);
> + }
> +
> + return ret;
> +}
> +
> +int qdev_driver_prop_foreach(qdev_driver_prop_foreach_func func,
> + const char *driver, void *opaque)
> +{
> + DeviceInfo *info;
> + Property *prop;
> + int ret = 0;
> +
> + info = qdev_find_info(NULL, driver);
> + if (!info) {
> + return -1;
> + }
> +
> + for (prop = info->props; prop&& prop->name; prop++) {
> + /*
> + * TODO Properties without a parser are just for dirty hacks.
> + * See comment in qdev_device_help.
> + */
> + if (!prop->info->parse) {
> + continue; /* no way to set it, don't show */
> + }
> + ret |= (*func)(prop, opaque);
Would be better to pass prop->name here as Property is going to go away soon.
Regards,
Anthony Liguori
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] i386: pass CLZERO to guests with EPYC CPU model on AMD ZEN platform
[not found] <yes>
2012-01-08 15:28 ` [Qemu-devel] [PATCH] Add tab-completion for device_add Andrzej Zaborowski
@ 2019-12-04 9:36 ` Ani Sinha
2019-12-16 9:31 ` Ani Sinha
1 sibling, 1 reply; 6+ messages in thread
From: Ani Sinha @ 2019-12-04 9:36 UTC (permalink / raw)
To: qemu-devel; +Cc: Ani Sinha
CLZERO CPUID should be passed on to the guests that use EPYC or EPYC-IBPB CPU
model when the AMD ZEN based host supports it. This change makes it recognize
this CPUID for guests which use EPYC or EPYC-IBPB CPU model.
Signed-off-by: Ani Sinha <ani.sinha@nutanix.com>
---
target/i386/cpu.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 69f518a..55f0691 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -3813,6 +3813,8 @@ static X86CPUDefinition builtin_x86_defs[] = {
CPUID_EXT3_MISALIGNSSE | CPUID_EXT3_SSE4A | CPUID_EXT3_ABM |
CPUID_EXT3_CR8LEG | CPUID_EXT3_SVM | CPUID_EXT3_LAHF_LM |
CPUID_EXT3_TOPOEXT,
+ .features[FEAT_8000_0008_EBX] =
+ CPUID_8000_0008_EBX_CLZERO,
.features[FEAT_7_0_EBX] =
CPUID_7_0_EBX_FSGSBASE | CPUID_7_0_EBX_BMI1 | CPUID_7_0_EBX_AVX2 |
CPUID_7_0_EBX_SMEP | CPUID_7_0_EBX_BMI2 | CPUID_7_0_EBX_RDSEED |
--
1.9.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] i386: pass CLZERO to guests with EPYC CPU model on AMD ZEN platform
2019-12-04 9:36 ` [PATCH] i386: pass CLZERO to guests with EPYC CPU model on AMD ZEN platform Ani Sinha
@ 2019-12-16 9:31 ` Ani Sinha
0 siblings, 0 replies; 6+ messages in thread
From: Ani Sinha @ 2019-12-16 9:31 UTC (permalink / raw)
To: qemu-devel@nongnu.org
[-- Attachment #1: Type: text/plain, Size: 1059 bytes --]
Hi :
Can I get some love for this patch?
thanks
ani
On Dec 4, 2019, 3:06 PM +0530, Ani Sinha <ani.sinha@nutanix.com>, wrote:
CLZERO CPUID should be passed on to the guests that use EPYC or EPYC-IBPB CPU
model when the AMD ZEN based host supports it. This change makes it recognize
this CPUID for guests which use EPYC or EPYC-IBPB CPU model.
Signed-off-by: Ani Sinha <ani.sinha@nutanix.com>
---
target/i386/cpu.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 69f518a..55f0691 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -3813,6 +3813,8 @@ static X86CPUDefinition builtin_x86_defs[] = {
CPUID_EXT3_MISALIGNSSE | CPUID_EXT3_SSE4A | CPUID_EXT3_ABM |
CPUID_EXT3_CR8LEG | CPUID_EXT3_SVM | CPUID_EXT3_LAHF_LM |
CPUID_EXT3_TOPOEXT,
+ .features[FEAT_8000_0008_EBX] =
+ CPUID_8000_0008_EBX_CLZERO,
.features[FEAT_7_0_EBX] =
CPUID_7_0_EBX_FSGSBASE | CPUID_7_0_EBX_BMI1 | CPUID_7_0_EBX_AVX2 |
CPUID_7_0_EBX_SMEP | CPUID_7_0_EBX_BMI2 | CPUID_7_0_EBX_RDSEED |
--
1.9.4
[-- Attachment #2: Type: text/html, Size: 1858 bytes --]
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-12-16 9:32 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <yes>
2012-01-08 15:28 ` [Qemu-devel] [PATCH] Add tab-completion for device_add Andrzej Zaborowski
2012-01-12 17:01 ` Anthony Liguori
2019-12-04 9:36 ` [PATCH] i386: pass CLZERO to guests with EPYC CPU model on AMD ZEN platform Ani Sinha
2019-12-16 9:31 ` Ani Sinha
2012-01-08 15:14 [Qemu-devel] [PATCH] Add tab-completion for device_add Andrzej Zaborowski
2012-01-09 2:19 ` andrzej zaborowski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).