Skip to contentSkip to conversation

qemu-system-arm dies on introspection of ast2700-a1 and ast2700-a2

DISCUSSION Markus Armbruster 3 participants 3 messages Oct 21

lore
Share & tools
lore
#0 lore raw

Watch this:

    $ qemu-system-arm -S -nodefaults -display none -M none -qmp stdio
    {"QMP": {"version": {"qemu": {"micro": 50, "minor": 1, "major": 11}, "package": "v11.1.0-2545-g2d150b99ce"}, "capabilities": ["oob"]}}
    {"execute": "qmp_capabilities", "arguments": {"enable": ["oob"]}}
    {"return": {}}
    {"execute": "qom-list-properties", "arguments": {"typename": "ast2700-a1"}}
    qemu-system-arm: unknown type 'cortex-a35-arm-cpu'
    [Exit 1 ]

Same for ast2700-a2.

I found the folllowing in their .instance_init() method aspeed_soc_ast2700_init():

    for (i = 0; i < sc->num_cpus; i++) {
        if (qtest_enabled() && !target_aarch64()) {
            /*
             * Introspection qtest just want to create this object
             * without realizing it. ARM_CPU_TYPE_NAME("cortex-a35")
             * is not available on 32-bit binary: skip it since we
             * won't even realize it.
             */
            continue;
        }
        object_initialize_child(obj, "cpu[*]", &a->cpu[i],
                                aspeed_soc_cpu_type(sc->valid_cpu_types));
    }

This seems to paper over the bug so make the tests pass. That's wrong.

.instance_init() must not fail and must not exit(), regardless of context.

object_initialize_child() exit()s when the type doesn't exist, because &error_fatal gets passed to in type_get_or_load_by_name() in object_initialize_child().

The narrow fix is to make type "cortex-a35-arm-cpu" exist, or to make the two bad types "ast2700-a1" and "ast2700-a2" not exist.

#1 lore raw
Quoted 34 lines · Markus Armbruster

Watch this:

     $ qemu-system-arm -S -nodefaults -display none -M none -qmp stdio
     {"QMP": {"version": {"qemu": {"micro": 50, "minor": 1, "major": 11}, "package": "v11.1.0-2545-g2d150b99ce"}, "capabilities": ["oob"]}}
     {"execute": "qmp_capabilities", "arguments": {"enable": ["oob"]}}
     {"return": {}}
     {"execute": "qom-list-properties", "arguments": {"typename": "ast2700-a1"}}
     qemu-system-arm: unknown type 'cortex-a35-arm-cpu'
     [Exit 1 ]

Same for ast2700-a2.

I found the folllowing in their .instance_init() method aspeed_soc_ast2700_init():

     for (i = 0; i < sc->num_cpus; i++) {
         if (qtest_enabled() && !target_aarch64()) {
             /*
              * Introspection qtest just want to create this object
              * without realizing it. ARM_CPU_TYPE_NAME("cortex-a35")
              * is not available on 32-bit binary: skip it since we
              * won't even realize it.
              */
             continue;
         }
         object_initialize_child(obj, "cpu[*]", &a->cpu[i],
                                 aspeed_soc_cpu_type(sc->valid_cpu_types));
     }

This seems to paper over the bug so make the tests pass. That's wrong.

.instance_init() must not fail and must not exit(), regardless of context.

Quoted 6 lines

object_initialize_child() exit()s when the type doesn't exist, because &error_fatal gets passed to in type_get_or_load_by_name() in object_initialize_child().

The narrow fix is to make type "cortex-a35-arm-cpu" exist, or to make the two bad types "ast2700-a1" and "ast2700-a2" not exist.

The ast2700 machines are hidden on 32-bit builds with

.is_available = target_aarch64,

but the SoC types they use are not (see commit 89b5f1ed43f "hw/arm: filter minimal set of machines" following earlier attempt a2239a87339 "hw/arm/aspeed: Do not realize 64-bit CPU types under QTest").

Pierrick, I thought this pattern was solved, can you have a look please?

Thanks,

Phil.

#2 lore raw
In reply to Markus Armbruster
Quoted 34 lines · Markus Armbruster

Watch this:

    $ qemu-system-arm -S -nodefaults -display none -M none -qmp stdio
    {"QMP": {"version": {"qemu": {"micro": 50, "minor": 1, "major": 11}, "package": "v11.1.0-2545-g2d150b99ce"}, "capabilities": ["oob"]}}
    {"execute": "qmp_capabilities", "arguments": {"enable": ["oob"]}}
    {"return": {}}
    {"execute": "qom-list-properties", "arguments": {"typename": "ast2700-a1"}}
    qemu-system-arm: unknown type 'cortex-a35-arm-cpu'
    [Exit 1 ]

Same for ast2700-a2.

I found the folllowing in their .instance_init() method aspeed_soc_ast2700_init():

    for (i = 0; i < sc->num_cpus; i++) {
        if (qtest_enabled() && !target_aarch64()) {
            /*
             * Introspection qtest just want to create this object
             * without realizing it. ARM_CPU_TYPE_NAME("cortex-a35")
             * is not available on 32-bit binary: skip it since we
             * won't even realize it.
             */
            continue;
        }
        object_initialize_child(obj, "cpu[*]", &a->cpu[i],
                                aspeed_soc_cpu_type(sc->valid_cpu_types));
    }

This seems to paper over the bug so make the tests pass. That's wrong.

.instance_init() must not fail and must not exit(), regardless of context.

Quoted 6 lines

object_initialize_child() exit()s when the type doesn't exist, because &error_fatal gets passed to in type_get_or_load_by_name() in object_initialize_child().

The narrow fix is to make type "cortex-a35-arm-cpu" exist, or to make the two bad types "ast2700-a1" and "ast2700-a2" not exist.

Is the problem here that DEFINE_TYPES(aspeed_soc_ast27x0_types) doesn't allow for conditional realisation of the SoCs? Oh but it does:

.is_available = target_aarch64,

Signature · 2 lines
Alex Bennée
Virtualisation Tech Lead @ Linaro