> diff --git a/hw/core/smp-cache.c b/hw/core/smp-cache.c > new file mode 100644 > index 000000000000..c0157ce51c8f > --- /dev/null > +++ b/hw/core/smp-cache.c > @@ -0,0 +1,103 @@ > +/* > + * Cache Object for SMP machine > + * > + * Copyright (C) 2024 Intel Corporation. > + * > + * Author: Zhao Liu <zhao1.liu@xxxxxxxxx> > + * > + * This work is licensed under the terms of the GNU GPL, version 2 or > + * later. See the COPYING file in the top-level directory. > + */ > + > +#include "qemu/osdep.h" > + > +#include "hw/core/smp-cache.h" > +#include "qapi/error.h" > +#include "qapi/qapi-visit-machine-common.h" > +#include "qom/object_interfaces.h" > + > +static void > +smp_cache_get_cache_prop(Object *obj, Visitor *v, const char *name, > + void *opaque, Error **errp) > +{ > + SMPCache *cache = SMP_CACHE(obj); > + SMPCachePropertyList *head = NULL; > + SMPCachePropertyList **tail = &head; > + > + for (int i = 0; i < SMP_CACHE__MAX; i++) { > + SMPCacheProperty *node = g_new(SMPCacheProperty, 1); > + > + node->name = cache->props[i].name; > + node->topo = cache->props[i].topo; > + QAPI_LIST_APPEND(tail, node); > + } > + > + if (!visit_type_SMPCachePropertyList(v, name, &head, errp)) { > + return; Oops, here I shouldn't return. Whether it succeeds or not, I should continue with the following free(). > + } > + qapi_free_SMPCachePropertyList(head); > +}