Skip to contentSkip to conversation

hw/core/generic-loader: Set a category for the generic-loader device

PATCH In review Thomas Huth 4 participants 6 messages Oct 5, 2018 – Oct 8, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/core/generic-loader: Set a category for the generic-loader device

Each device that is instantiatable by the users should be marked with a category. Since the generic-loader does not fit anywhere else, put it into the MISC category.

---
 hw/core/generic-loader.c | 1 +
 1 file changed, 1 insertion(+)
hw/core/generic-loader.c +1 -0
index fde32cb..be29ae1 100644
@@ -204,6 +204,7 @@ static void generic_loader_class_init(ObjectClass *klass, void *data)
     dc->unrealize = generic_loader_unrealize;
     dc->props = generic_loader_props;
     dc->desc = "Generic Loader";
+    set_bit(DEVICE_CATEGORY_MISC, dc->categories);
 }
 
 static TypeInfo generic_loader_info = {
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 14 lines · On Fri, 5 Oct 2018 11:42:26 +0200 Thomas Huth <[email protected]> wrote:

Each device that is instantiatable by the users should be marked with a category. Since the generic-loader does not fit anywhere else, put it into the MISC category.

---
 hw/core/generic-loader.c | 1 +
 1 file changed, 1 insertion(+)
hw/core/generic-loader.c +0 -0
index fde32cb..be29ae1 100644

hw/core/generic-loader.c static void generic_loader_class_init(ObjectClass *klass, void *data) · line 210

Quoted 7 lines
hw/core/generic-loader.c +1 -0
@@ -204,6 +204,7 @@ static void generic_loader_class_init(ObjectClass *klass, void *data)
     dc->unrealize = generic_loader_unrealize;
     dc->props = generic_loader_props;
     dc->desc = "Generic Loader";
+    set_bit(DEVICE_CATEGORY_MISC, dc->categories);
 }
 
 static TypeInfo generic_loader_info = {
Reviewed-by on v1 1/1
#2 lore raw
In reply to Thomas Huth
Quoted 6 lines · Thomas Huth

Each device that is instantiatable by the users should be marked with a category. Since the generic-loader does not fit anywhere else, put it into the MISC category.

Alistair

Quoted 20 lines
---
 hw/core/generic-loader.c | 1 +
 1 file changed, 1 insertion(+)
hw/core/generic-loader.c +1 -1
index fde32cb..be29ae1 100644
@@ -204,6 +204,7 @@ static void generic_loader_class_init(ObjectClass *klass, void *data)
     dc->unrealize = generic_loader_unrealize;
     dc->props = generic_loader_props;
     dc->desc = "Generic Loader";
+    set_bit(DEVICE_CATEGORY_MISC, dc->categories);
 }
 
 static TypeInfo generic_loader_info = {
--

1.8.3.1

#3 lore raw
In reply to Thomas Huth
Quoted 2 lines · Thomas Huth

Each device that is instantiatable by the users should be marked with a category.

Presumably we could assert() this somewhere (at which point we'd find that we have dozens of devices that fail to set a category bit, I imagine) ?

thanks
-- PMM

#4 lore raw
Quoted 7 lines · Peter Maydell
Quoted 2 lines · Thomas Huth

Each device that is instantiatable by the users should be marked with a category.

Presumably we could assert() this somewhere (at which point we'd find that we have dozens of devices that fail to set a category bit, I imagine) ?

You bet ... alone in qemu-system-aarch64, "-device help" shows more than 120 devices without a category...

So if we'd want to enforce this, there is a lot of clean-up work needed first. Once we're in a good shape, I think a "make check" test would be the right thing to enforce that future devices are always provided with a category.

Thomas

#5 lore raw
Quoted 9 lines · Thomas Huth
Quoted 7 lines · Peter Maydell
Quoted 2 lines · Thomas Huth

Each device that is instantiatable by the users should be marked with a category.

Presumably we could assert() this somewhere (at which point we'd find that we have dozens of devices that fail to set a category bit, I imagine) ?

Quoted 7 lines

You bet ... alone in qemu-system-aarch64, "-device help" shows more than 120 devices without a category...

So if we'd want to enforce this, there is a lot of clean-up work needed first. Once we're in a good shape, I think a "make check" test would be the right thing to enforce that future devices are always provided with a category.

Asserting in something like the device base class realize seems to me like a good approach -- that way it gets automatically covered by the existing test that tries to create every user creatable device (we do have one of those, right?), and developers of new devices will spot their error immediately even if they don't happen to run 'make check'.

thanks
-- PMM