Browse Source

modules: check arch on qom lookup

With target-specific modules we can have multiple modules implementing
the same object.  Therefore we have to check the target arch on lookup
to find the correct module.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jose R. Ziviani <jziviani@suse.de>
Message-Id: <20210624103836.2382472-20-kraxel@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Gerd Hoffmann 4 years ago
parent
commit
ab0cfc3dcb
1 changed files with 6 additions and 0 deletions
  1. 6 0
      util/module.c

+ 6 - 0
util/module.c

@@ -329,6 +329,9 @@ void module_load_qom_one(const char *type)
         if (!modinfo->objs) {
         if (!modinfo->objs) {
             continue;
             continue;
         }
         }
+        if (!module_check_arch(modinfo)) {
+            continue;
+        }
         for (sl = modinfo->objs; *sl != NULL; sl++) {
         for (sl = modinfo->objs; *sl != NULL; sl++) {
             if (strcmp(type, *sl) == 0) {
             if (strcmp(type, *sl) == 0) {
                 module_load_one("", modinfo->name, false);
                 module_load_one("", modinfo->name, false);
@@ -349,6 +352,9 @@ void module_load_qom_all(void)
         if (!modinfo->objs) {
         if (!modinfo->objs) {
             continue;
             continue;
         }
         }
+        if (!module_check_arch(modinfo)) {
+            continue;
+        }
         module_load_one("", modinfo->name, false);
         module_load_one("", modinfo->name, false);
     }
     }
     module_loaded_qom_all = true;
     module_loaded_qom_all = true;