From patchwork Thu Nov 15 09:41:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Luc Michel X-Patchwork-Id: 10684037 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 40BC7109C for ; Thu, 15 Nov 2018 09:44:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2E6AD286F8 for ; Thu, 15 Nov 2018 09:44:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 228292C098; Thu, 15 Nov 2018 09:44:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EB6C5286F8 for ; Thu, 15 Nov 2018 09:44:24 +0000 (UTC) Received: from localhost ([::1]:37663 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNECF-0000DL-EV for patchwork-qemu-devel@patchwork.kernel.org; Thu, 15 Nov 2018 04:44:23 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40119) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNEAi-0007JB-M2 for qemu-devel@nongnu.org; Thu, 15 Nov 2018 04:42:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gNEAc-0004cm-4x for qemu-devel@nongnu.org; Thu, 15 Nov 2018 04:42:45 -0500 Received: from greensocs.com ([193.104.36.180]:41855) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNEAH-0004Lm-0q; Thu, 15 Nov 2018 04:42:21 -0500 Received: from localhost (localhost [127.0.0.1]) by greensocs.com (Postfix) with ESMTP id 1AB9C6FD8D; Thu, 15 Nov 2018 10:42:14 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1542274934; bh=tkFfkyXsfXUrbWBdmWA6tql8O+uSKaP2Zc61/2iL4AE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=pAbLDraioJ5rhlQy0Mg1c+0or6HMNHHAodhfj8QwsHZp06R/xRk4RqwhACtJXK3pl KfB/CBz1rdakFd3IiMifcz9RODGOqitw1Om0ReexqTP8DAsVhHiKtZ7JNd/MpXncj6 RSMpLfMnCgv9mx92iIbbq/oKwLmCXIuz731yddN4= X-Virus-Scanned: amavisd-new at greensocs.com Authentication-Results: gs-01.greensocs.com (amavisd-new); dkim=pass (1024-bit key) header.d=greensocs.com header.b=mYD9Zjny; dkim=pass (1024-bit key) header.d=greensocs.com header.b=mYD9Zjny Received: from greensocs.com ([127.0.0.1]) by localhost (gs-01.greensocs.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eYhW1oBDq3sg; Thu, 15 Nov 2018 10:42:12 +0100 (CET) Received: by greensocs.com (Postfix, from userid 998) id 933415BD180; Thu, 15 Nov 2018 10:42:12 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1542274932; bh=tkFfkyXsfXUrbWBdmWA6tql8O+uSKaP2Zc61/2iL4AE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=mYD9ZjnysHWZn838BvBDRau6gRSIRsixwl3UaEvgSdZh8jQEuDoTAHfSctjUh2CUp mA57anHUgMTO4pBgyQmTzE6qyFK4oHh/qzwI1AFG8ORAhYEP04YDEodw/KpLgy2kvB BJZQr0xNAGN57XHRTQo+Q4kE3eJteroNptj5Yoww= Received: from michell-laptop.hive.antfield.fr (lfbn-1-8165-82.w90-112.abo.wanadoo.fr [90.112.74.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: luc.michel@greensocs.com) by greensocs.com (Postfix) with ESMTPSA id 32E795BD196; Thu, 15 Nov 2018 10:42:12 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1542274932; bh=tkFfkyXsfXUrbWBdmWA6tql8O+uSKaP2Zc61/2iL4AE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=mYD9ZjnysHWZn838BvBDRau6gRSIRsixwl3UaEvgSdZh8jQEuDoTAHfSctjUh2CUp mA57anHUgMTO4pBgyQmTzE6qyFK4oHh/qzwI1AFG8ORAhYEP04YDEodw/KpLgy2kvB BJZQr0xNAGN57XHRTQo+Q4kE3eJteroNptj5Yoww= From: Luc Michel To: qemu-devel@nongnu.org Date: Thu, 15 Nov 2018 10:41:52 +0100 Message-Id: <20181115094207.22846-2-luc.michel@greensocs.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181115094207.22846-1-luc.michel@greensocs.com> References: <20181115094207.22846-1-luc.michel@greensocs.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 193.104.36.180 Subject: [Qemu-devel] [PATCH v6 01/16] hw/cpu: introduce CPU clusters X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Eduardo Habkost , alistair@alistair23.me, mark.burton@greensocs.com, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , saipava@xilinx.com, edgari@xilinx.com, qemu-arm@nongnu.org, Luc Michel Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This commit adds the cpu-cluster type. It aims at gathering CPUs from the same cluster in a machine. For now it only has a `cluster-id` property. Signed-off-by: Luc Michel Reviewed-by: Alistair Francis Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Reviewed-by: Edgar E. Iglesias --- include/hw/cpu/cluster.h | 38 ++++++++++++++++++++++++++ hw/cpu/cluster.c | 59 ++++++++++++++++++++++++++++++++++++++++ MAINTAINERS | 2 ++ hw/cpu/Makefile.objs | 2 +- 4 files changed, 100 insertions(+), 1 deletion(-) create mode 100644 include/hw/cpu/cluster.h create mode 100644 hw/cpu/cluster.c diff --git a/include/hw/cpu/cluster.h b/include/hw/cpu/cluster.h new file mode 100644 index 0000000000..11f50d5f6b --- /dev/null +++ b/include/hw/cpu/cluster.h @@ -0,0 +1,38 @@ +/* + * QEMU CPU cluster + * + * Copyright (c) 2018 GreenSocs SAS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see + * + */ +#ifndef HW_CPU_CLUSTER_H +#define HW_CPU_CLUSTER_H + +#include "qemu/osdep.h" +#include "hw/qdev.h" + +#define TYPE_CPU_CLUSTER "cpu-cluster" +#define CPU_CLUSTER(obj) \ + OBJECT_CHECK(CPUClusterState, (obj), TYPE_CPU_CLUSTER) + +typedef struct CPUClusterState { + /*< private >*/ + DeviceState parent_obj; + + /*< public >*/ + uint32_t cluster_id; +} CPUClusterState; + +#endif diff --git a/hw/cpu/cluster.c b/hw/cpu/cluster.c new file mode 100644 index 0000000000..e0ffd76152 --- /dev/null +++ b/hw/cpu/cluster.c @@ -0,0 +1,59 @@ +/* + * QEMU CPU cluster + * + * Copyright (c) 2018 GreenSocs SAS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see + * + */ + +#include "qemu/osdep.h" +#include "hw/cpu/cluster.h" +#include "qapi/error.h" +#include "qemu/module.h" + +static void cpu_cluster_init(Object *obj) +{ + static uint32_t cluster_id_auto_increment; + CPUClusterState *cluster = CPU_CLUSTER(obj); + + cluster->cluster_id = cluster_id_auto_increment++; +} + +static Property cpu_cluster_properties[] = { + DEFINE_PROP_UINT32("cluster-id", CPUClusterState, cluster_id, 0), + DEFINE_PROP_END_OF_LIST() +}; + +static void cpu_cluster_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(klass); + + dc->props = cpu_cluster_properties; +} + +static const TypeInfo cpu_cluster_type_info = { + .name = TYPE_CPU_CLUSTER, + .parent = TYPE_DEVICE, + .instance_size = sizeof(CPUClusterState), + .instance_init = cpu_cluster_init, + .class_init = cpu_cluster_class_init, +}; + +static void cpu_cluster_register_types(void) +{ + type_register_static(&cpu_cluster_type_info); +} + +type_init(cpu_cluster_register_types) diff --git a/MAINTAINERS b/MAINTAINERS index 4b8db618f5..3e7a0b09c0 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1029,11 +1029,13 @@ Machine core M: Eduardo Habkost M: Marcel Apfelbaum S: Supported F: hw/core/machine.c F: hw/core/null-machine.c +F: hw/cpu/cluster.c F: include/hw/boards.h +F: include/hw/cpu/cluster.h T: git https://github.com/ehabkost/qemu.git machine-next Xtensa Machines --------------- sim diff --git a/hw/cpu/Makefile.objs b/hw/cpu/Makefile.objs index cd52d20b65..8db9e8a7b3 100644 --- a/hw/cpu/Makefile.objs +++ b/hw/cpu/Makefile.objs @@ -1,5 +1,5 @@ obj-$(CONFIG_ARM11MPCORE) += arm11mpcore.o obj-$(CONFIG_REALVIEW) += realview_mpcore.o obj-$(CONFIG_A9MPCORE) += a9mpcore.o obj-$(CONFIG_A15MPCORE) += a15mpcore.o -common-obj-y += core.o +common-obj-y += core.o cluster.o