* [Qemu-devel] [PATCH] Introduce DEVICE_CATEGORY_CPU for CPU devices
@ 2017-01-20 12:18 Thomas Huth
2017-01-20 12:26 ` Paolo Bonzini
2017-01-20 12:31 ` Peter Maydell
0 siblings, 2 replies; 4+ messages in thread
From: Thomas Huth @ 2017-01-20 12:18 UTC (permalink / raw)
To: qemu-devel, Eduardo Habkost, Paolo Bonzini
Cc: qemu-ppc, Richard Henderson, David Gibson, Bharata B Rao
Now that the hot-pluggable CPUs show up in the help text of
"-device ?", we should group them into an appropriate category.
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
hw/ppc/pnv_core.c | 1 +
hw/ppc/spapr_cpu_core.c | 1 +
include/hw/qdev-core.h | 1 +
qdev-monitor.c | 1 +
target/i386/cpu.c | 2 ++
5 files changed, 6 insertions(+)
diff --git a/hw/ppc/pnv_core.c b/hw/ppc/pnv_core.c
index d79d530..a9c981e 100644
--- a/hw/ppc/pnv_core.c
+++ b/hw/ppc/pnv_core.c
@@ -190,6 +190,7 @@ static void pnv_core_class_init(ObjectClass *oc, void *data)
DeviceClass *dc = DEVICE_CLASS(oc);
PnvCoreClass *pcc = PNV_CORE_CLASS(oc);
+ set_bit(DEVICE_CATEGORY_CPU, dc->categories);
dc->realize = pnv_core_realize;
dc->props = pnv_core_properties;
pcc->cpu_oc = cpu_class_by_name(TYPE_POWERPC_CPU, data);
diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
index c18632b..dd0028e 100644
--- a/hw/ppc/spapr_cpu_core.c
+++ b/hw/ppc/spapr_cpu_core.c
@@ -365,6 +365,7 @@ void spapr_cpu_core_class_init(ObjectClass *oc, void *data)
DeviceClass *dc = DEVICE_CLASS(oc);
sPAPRCPUCoreClass *scc = SPAPR_CPU_CORE_CLASS(oc);
+ set_bit(DEVICE_CATEGORY_CPU, dc->categories);
dc->realize = spapr_cpu_core_realize;
scc->cpu_class = cpu_class_by_name(TYPE_POWERPC_CPU, data);
g_assert(scc->cpu_class);
diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index 2c97347..b44b476 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -26,6 +26,7 @@ typedef enum DeviceCategory {
DEVICE_CATEGORY_DISPLAY,
DEVICE_CATEGORY_SOUND,
DEVICE_CATEGORY_MISC,
+ DEVICE_CATEGORY_CPU,
DEVICE_CATEGORY_MAX
} DeviceCategory;
diff --git a/qdev-monitor.c b/qdev-monitor.c
index c73410c..5f2fcdf 100644
--- a/qdev-monitor.c
+++ b/qdev-monitor.c
@@ -136,6 +136,7 @@ static void qdev_print_devinfos(bool show_no_user)
[DEVICE_CATEGORY_DISPLAY] = "Display",
[DEVICE_CATEGORY_SOUND] = "Sound",
[DEVICE_CATEGORY_MISC] = "Misc",
+ [DEVICE_CATEGORY_CPU] = "CPU",
[DEVICE_CATEGORY_MAX] = "Uncategorized",
};
GSList *list, *elt;
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index aba11ae..7b8ca5f 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -2381,8 +2381,10 @@ static void x86_cpu_cpudef_class_init(ObjectClass *oc, void *data)
{
X86CPUDefinition *cpudef = data;
X86CPUClass *xcc = X86_CPU_CLASS(oc);
+ DeviceClass *dc = DEVICE_CLASS(oc);
xcc->cpu_def = cpudef;
+ set_bit(DEVICE_CATEGORY_CPU, dc->categories);
}
static void x86_register_cpudef_type(X86CPUDefinition *def)
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] Introduce DEVICE_CATEGORY_CPU for CPU devices
2017-01-20 12:18 [Qemu-devel] [PATCH] Introduce DEVICE_CATEGORY_CPU for CPU devices Thomas Huth
@ 2017-01-20 12:26 ` Paolo Bonzini
2017-01-20 12:31 ` Peter Maydell
1 sibling, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2017-01-20 12:26 UTC (permalink / raw)
To: Thomas Huth, qemu-devel, Eduardo Habkost
Cc: qemu-ppc, Richard Henderson, David Gibson, Bharata B Rao
On 20/01/2017 13:18, Thomas Huth wrote:
> Now that the hot-pluggable CPUs show up in the help text of
> "-device ?", we should group them into an appropriate category.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> hw/ppc/pnv_core.c | 1 +
> hw/ppc/spapr_cpu_core.c | 1 +
> include/hw/qdev-core.h | 1 +
> qdev-monitor.c | 1 +
> target/i386/cpu.c | 2 ++
> 5 files changed, 6 insertions(+)
>
> diff --git a/hw/ppc/pnv_core.c b/hw/ppc/pnv_core.c
> index d79d530..a9c981e 100644
> --- a/hw/ppc/pnv_core.c
> +++ b/hw/ppc/pnv_core.c
> @@ -190,6 +190,7 @@ static void pnv_core_class_init(ObjectClass *oc, void *data)
> DeviceClass *dc = DEVICE_CLASS(oc);
> PnvCoreClass *pcc = PNV_CORE_CLASS(oc);
>
> + set_bit(DEVICE_CATEGORY_CPU, dc->categories);
> dc->realize = pnv_core_realize;
> dc->props = pnv_core_properties;
> pcc->cpu_oc = cpu_class_by_name(TYPE_POWERPC_CPU, data);
> diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
> index c18632b..dd0028e 100644
> --- a/hw/ppc/spapr_cpu_core.c
> +++ b/hw/ppc/spapr_cpu_core.c
> @@ -365,6 +365,7 @@ void spapr_cpu_core_class_init(ObjectClass *oc, void *data)
> DeviceClass *dc = DEVICE_CLASS(oc);
> sPAPRCPUCoreClass *scc = SPAPR_CPU_CORE_CLASS(oc);
>
> + set_bit(DEVICE_CATEGORY_CPU, dc->categories);
> dc->realize = spapr_cpu_core_realize;
> scc->cpu_class = cpu_class_by_name(TYPE_POWERPC_CPU, data);
> g_assert(scc->cpu_class);
> diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
> index 2c97347..b44b476 100644
> --- a/include/hw/qdev-core.h
> +++ b/include/hw/qdev-core.h
> @@ -26,6 +26,7 @@ typedef enum DeviceCategory {
> DEVICE_CATEGORY_DISPLAY,
> DEVICE_CATEGORY_SOUND,
> DEVICE_CATEGORY_MISC,
> + DEVICE_CATEGORY_CPU,
> DEVICE_CATEGORY_MAX
> } DeviceCategory;
>
> diff --git a/qdev-monitor.c b/qdev-monitor.c
> index c73410c..5f2fcdf 100644
> --- a/qdev-monitor.c
> +++ b/qdev-monitor.c
> @@ -136,6 +136,7 @@ static void qdev_print_devinfos(bool show_no_user)
> [DEVICE_CATEGORY_DISPLAY] = "Display",
> [DEVICE_CATEGORY_SOUND] = "Sound",
> [DEVICE_CATEGORY_MISC] = "Misc",
> + [DEVICE_CATEGORY_CPU] = "CPU",
> [DEVICE_CATEGORY_MAX] = "Uncategorized",
> };
> GSList *list, *elt;
> diff --git a/target/i386/cpu.c b/target/i386/cpu.c
> index aba11ae..7b8ca5f 100644
> --- a/target/i386/cpu.c
> +++ b/target/i386/cpu.c
> @@ -2381,8 +2381,10 @@ static void x86_cpu_cpudef_class_init(ObjectClass *oc, void *data)
> {
> X86CPUDefinition *cpudef = data;
> X86CPUClass *xcc = X86_CPU_CLASS(oc);
> + DeviceClass *dc = DEVICE_CLASS(oc);
>
> xcc->cpu_def = cpudef;
> + set_bit(DEVICE_CATEGORY_CPU, dc->categories);
> }
>
> static void x86_register_cpudef_type(X86CPUDefinition *def)
>
Queued, thanks.
Paolo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] Introduce DEVICE_CATEGORY_CPU for CPU devices
2017-01-20 12:18 [Qemu-devel] [PATCH] Introduce DEVICE_CATEGORY_CPU for CPU devices Thomas Huth
2017-01-20 12:26 ` Paolo Bonzini
@ 2017-01-20 12:31 ` Peter Maydell
2017-01-20 12:55 ` Thomas Huth
1 sibling, 1 reply; 4+ messages in thread
From: Peter Maydell @ 2017-01-20 12:31 UTC (permalink / raw)
To: Thomas Huth
Cc: QEMU Developers, Eduardo Habkost, Paolo Bonzini, David Gibson,
qemu-ppc@nongnu.org, Bharata B Rao, Richard Henderson
On 20 January 2017 at 12:18, Thomas Huth <thuth@redhat.com> wrote:
> Now that the hot-pluggable CPUs show up in the help text of
> "-device ?", we should group them into an appropriate category.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> hw/ppc/pnv_core.c | 1 +
> hw/ppc/spapr_cpu_core.c | 1 +
> include/hw/qdev-core.h | 1 +
> qdev-monitor.c | 1 +
> target/i386/cpu.c | 2 ++
> 5 files changed, 6 insertions(+)
Can we just set the category bit in the class init functions
for the TYPE_CPU and TYPE_CPU_CORE superclasses, rather
than having to do it in a subclass for each architecture
(and thus potentially forgetting to do it for other archs) ?
thanks
-- PMM
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] Introduce DEVICE_CATEGORY_CPU for CPU devices
2017-01-20 12:31 ` Peter Maydell
@ 2017-01-20 12:55 ` Thomas Huth
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Huth @ 2017-01-20 12:55 UTC (permalink / raw)
To: Peter Maydell
Cc: QEMU Developers, Eduardo Habkost, Paolo Bonzini, David Gibson,
qemu-ppc@nongnu.org, Bharata B Rao, Richard Henderson
On 20.01.2017 13:31, Peter Maydell wrote:
> On 20 January 2017 at 12:18, Thomas Huth <thuth@redhat.com> wrote:
>> Now that the hot-pluggable CPUs show up in the help text of
>> "-device ?", we should group them into an appropriate category.
>>
>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>> ---
>> hw/ppc/pnv_core.c | 1 +
>> hw/ppc/spapr_cpu_core.c | 1 +
>> include/hw/qdev-core.h | 1 +
>> qdev-monitor.c | 1 +
>> target/i386/cpu.c | 2 ++
>> 5 files changed, 6 insertions(+)
>
> Can we just set the category bit in the class init functions
> for the TYPE_CPU and TYPE_CPU_CORE superclasses, rather
> than having to do it in a subclass for each architecture
> (and thus potentially forgetting to do it for other archs) ?
Good idea, that seems to work, too. I'll send a v2 ...
Thomas
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-01-20 12:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-20 12:18 [Qemu-devel] [PATCH] Introduce DEVICE_CATEGORY_CPU for CPU devices Thomas Huth
2017-01-20 12:26 ` Paolo Bonzini
2017-01-20 12:31 ` Peter Maydell
2017-01-20 12:55 ` Thomas Huth
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).