static void parse_numa_node(NumaNodeOptions *node, QemuOpts *opts, Error **errp)

{

    uint16_t nodenr;

    uint16List *cpus = NULL;



    if (node->has_nodeid) {

        nodenr = node->nodeid;

    } else {

        nodenr = nb_numa_nodes;

    }



    if (nodenr >= MAX_NODES) {

        error_setg(errp, "Max number of NUMA nodes reached: %"

                   PRIu16 "", nodenr);

        return;

    }



    if (numa_info[nodenr].present) {

        error_setg(errp, "Duplicate NUMA nodeid: %" PRIu16, nodenr);

        return;

    }



    for (cpus = node->cpus; cpus; cpus = cpus->next) {

        if (cpus->value >= max_cpus) {

            error_setg(errp,

                       "CPU index (%" PRIu16 ")"

                       " should be smaller than maxcpus (%d)",

                       cpus->value, max_cpus);

            return;

        }

        bitmap_set(numa_info[nodenr].node_cpu, cpus->value, 1);

    }



    if (node->has_mem && node->has_memdev) {

        error_setg(errp, "qemu: cannot specify both mem= and memdev=");

        return;

    }



    if (have_memdevs == -1) {

        have_memdevs = node->has_memdev;

    }

    if (node->has_memdev != have_memdevs) {

        error_setg(errp, "qemu: memdev option must be specified for either "

                   "all or no nodes");

        return;

    }



    if (node->has_mem) {

        uint64_t mem_size = node->mem;

        const char *mem_str = qemu_opt_get(opts, "mem");

        /* Fix up legacy suffix-less format */

        if (g_ascii_isdigit(mem_str[strlen(mem_str) - 1])) {

            mem_size <<= 20;

        }

        numa_info[nodenr].node_mem = mem_size;

    }

    if (node->has_memdev) {

        Object *o;

        o = object_resolve_path_type(node->memdev, TYPE_MEMORY_BACKEND, NULL);

        if (!o) {

            error_setg(errp, "memdev=%s is ambiguous", node->memdev);

            return;

        }



        object_ref(o);

        numa_info[nodenr].node_mem = object_property_get_int(o, "size", NULL);

        numa_info[nodenr].node_memdev = MEMORY_BACKEND(o);

    }

    numa_info[nodenr].present = true;

    max_numa_nodeid = MAX(max_numa_nodeid, nodenr + 1);

}

static void parse_numa_node(NumaNodeOptions *node, QemuOpts *opts, Error **errp)

{

    uint16_t nodenr;

    uint16List *cpus = NULL;



    if (node->has_nodeid) {

        nodenr = node->nodeid;

    } else {

        nodenr = nb_numa_nodes;

    }



    if (nodenr >= MAX_NODES) {

        error_setg(errp, "Max number of NUMA nodes reached: %"

                   PRIu16 "", nodenr);

        return;

    }



    if (numa_info[nodenr].present) {

        error_setg(errp, "Duplicate NUMA nodeid: %" PRIu16, nodenr);

        return;

    }



    for (cpus = node->cpus; cpus; cpus = cpus->next) {

        if (cpus->value >= max_cpus) {

            error_setg(errp,

                       "CPU index (%" PRIu16 ")"

                       " should be smaller than maxcpus (%d)",

                       cpus->value, max_cpus);

            return;

        }

        bitmap_set(numa_info[nodenr].node_cpu, cpus->value, 1);

    }



    if (node->has_mem && node->has_memdev) {

        error_setg(errp, "qemu: cannot specify both mem= and memdev=");

        return;

    }



    if (have_memdevs == -1) {

        have_memdevs = node->has_memdev;

    }

    if (node->has_memdev != have_memdevs) {

        error_setg(errp, "qemu: memdev option must be specified for either "

                   "all or no nodes");

        return;

    }



    if (node->has_mem) {

        uint64_t mem_size = node->mem;

        const char *mem_str = qemu_opt_get(opts, "mem");

        

        if (g_ascii_isdigit(mem_str[strlen(mem_str) - 1])) {

            mem_size <<= 20;

        }

        numa_info[nodenr].node_mem = mem_size;

    }

    if (node->has_memdev) {

        Object *o;

        o = object_resolve_path_type(node->memdev, TYPE_MEMORY_BACKEND, NULL);

        if (!o) {

            error_setg(errp, "memdev=%s is ambiguous", node->memdev);

            return;

        }



        object_ref(o);

        numa_info[nodenr].node_mem = object_property_get_int(o, "size", NULL);

        numa_info[nodenr].node_memdev = MEMORY_BACKEND(o);

    }

    numa_info[nodenr].present = true;

    max_numa_nodeid = MAX(max_numa_nodeid, nodenr + 1);

}

static void FUNC_0(NumaNodeOptions *VAR_0, QemuOpts *VAR_1, Error **VAR_2)

{

    uint16_t nodenr;

    uint16List *cpus = NULL;



    if (VAR_0->has_nodeid) {

        nodenr = VAR_0->nodeid;

    } else {

        nodenr = nb_numa_nodes;

    }



    if (nodenr >= MAX_NODES) {

        error_setg(VAR_2, "Max number of NUMA nodes reached: %"

                   PRIu16 "", nodenr);

        return;

    }



    if (numa_info[nodenr].present) {

        error_setg(VAR_2, "Duplicate NUMA nodeid: %" PRIu16, nodenr);

        return;

    }



    for (cpus = VAR_0->cpus; cpus; cpus = cpus->next) {

        if (cpus->value >= max_cpus) {

            error_setg(VAR_2,

                       "CPU index (%" PRIu16 ")"

                       " should be smaller than maxcpus (%d)",

                       cpus->value, max_cpus);

            return;

        }

        bitmap_set(numa_info[nodenr].node_cpu, cpus->value, 1);

    }



    if (VAR_0->has_mem && VAR_0->has_memdev) {

        error_setg(VAR_2, "qemu: cannot specify both mem= and memdev=");

        return;

    }



    if (have_memdevs == -1) {

        have_memdevs = VAR_0->has_memdev;

    }

    if (VAR_0->has_memdev != have_memdevs) {

        error_setg(VAR_2, "qemu: memdev option must be specified for either "

                   "all or no nodes");

        return;

    }



    if (VAR_0->has_mem) {

        uint64_t mem_size = VAR_0->mem;

        const char *VAR_3 = qemu_opt_get(VAR_1, "mem");

        

        if (g_ascii_isdigit(VAR_3[strlen(VAR_3) - 1])) {

            mem_size <<= 20;

        }

        numa_info[nodenr].node_mem = mem_size;

    }

    if (VAR_0->has_memdev) {

        Object *o;

        o = object_resolve_path_type(VAR_0->memdev, TYPE_MEMORY_BACKEND, NULL);

        if (!o) {

            error_setg(VAR_2, "memdev=%s is ambiguous", VAR_0->memdev);

            return;

        }



        object_ref(o);

        numa_info[nodenr].node_mem = object_property_get_int(o, "size", NULL);

        numa_info[nodenr].node_memdev = MEMORY_BACKEND(o);

    }

    numa_info[nodenr].present = true;

    max_numa_nodeid = MAX(max_numa_nodeid, nodenr + 1);

}

static void FUNC_0(NumaNodeOptions *VAR_0, QemuOpts *VAR_1, Error **VAR_2)
{ uint16_t nodenr; uint16List *cpus = NULL; if (VAR_0->has_nodeid) { nodenr = VAR_0->nodeid; } else { nodenr = nb_numa_nodes; } if (nodenr >= MAX_NODES) { error_setg(VAR_2, "Max number of NUMA nodes reached: %"
PRIu16 "", nodenr); return; } if (numa_info[nodenr].present) { error_setg(VAR_2, "Duplicate NUMA nodeid: %" PRIu16, nodenr); return; } for (cpus = VAR_0->cpus; cpus; cpus = cpus->next) { if (cpus->value >= max_cpus) { error_setg(VAR_2,
"CPU index (%" PRIu16 ")"
" should be smaller than maxcpus (%d)",
cpus->value, max_cpus); return; } bitmap_set(numa_info[nodenr].node_cpu, cpus->value, 1); } if (VAR_0->has_mem && VAR_0->has_memdev) { error_setg(VAR_2, "qemu: cannot specify both mem= and memdev="); return; } if (have_memdevs == -1) { have_memdevs = VAR_0->has_memdev; } if (VAR_0->has_memdev != have_memdevs) { error_setg(VAR_2, "qemu: memdev option must be specified for either "
"all or no nodes"); return; } if (VAR_0->has_mem) { uint64_t mem_size = VAR_0->mem; const char *VAR_3 = qemu_opt_get(VAR_1, "mem"); if (g_ascii_isdigit(VAR_3[strlen(VAR_3) - 1])) { mem_size <<= 20; } numa_info[nodenr].node_mem = mem_size; } if (VAR_0->has_memdev) { Object *o; o = object_resolve_path_type(VAR_0->memdev, TYPE_MEMORY_BACKEND, NULL); if (!o) { error_setg(VAR_2, "memdev=%s is ambiguous", VAR_0->memdev); return; } object_ref(o); numa_info[nodenr].node_mem = object_property_get_int(o, "size", NULL); numa_info[nodenr].node_memdev = MEMORY_BACKEND(o); } numa_info[nodenr].present = true; max_numa_nodeid = MAX(max_numa_nodeid, nodenr + 1); }