From nobody Mon Nov 25 14:32:01 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=flygoat.com ARC-Seal: i=1; a=rsa-sha256; t=1715009607; cv=none; d=zohomail.com; s=zohoarc; b=S2itVpJofROnA9I+RBMfbYT9a9aElFdRzadUNmuPPSJpeC5DnQq5SjPZQHTOBAVLeHcsgb47Sh0GCgLGhWyyd7GyiO12AC59RSSH1xEwj1/EV9YIF4vYKSBZskZNoggem7TA36mkwey+jfRoPPZ6UcmDz2Db8zU5hkyo1v4OneE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715009607; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=XeJ4KkGylBz/yVz6BnceGDPMbIFcGGvB/K45B0IEGpU=; b=eGHMd7zmIWEGmk+L9D4exlcfvWT++5hhE5Sti4tyx9qcI+SjsqOJOIkAhai60Xo7BG0OJhHCh6lULkeBKHtOMRwYcccBoXHdmWsnaGZXWqZ5WVFxNVtkV4WDBiDPDf7zVZxg4gaclKqA9cauhH7kNAz+cHBfJCYyMNw8wbQ/eDk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715009607020789.5693062330218; Mon, 6 May 2024 08:33:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s40Jv-0007kt-Ds; Mon, 06 May 2024 11:32:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s40Js-0007iw-K8 for qemu-devel@nongnu.org; Mon, 06 May 2024 11:32:00 -0400 Received: from wfout7-smtp.messagingengine.com ([64.147.123.150]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s40Jq-0003U6-OH for qemu-devel@nongnu.org; Mon, 06 May 2024 11:32:00 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailfout.west.internal (Postfix) with ESMTP id D55991C000B5; Mon, 6 May 2024 11:31:56 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Mon, 06 May 2024 11:31:57 -0400 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 6 May 2024 11:31:55 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flygoat.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1715009516; x=1715095916; bh=XeJ4KkGylBz/yVz6BnceGDPMbIFcGGvB/K45B0IEGpU=; b= ZCe8ny8SPvGTOR3p1DZIB7NvnA5hBcs2UKhg/wbBPQiNa5xGqBZdHNVLk4vxV2ke vLoYOKTZU9WnjXrRrtYOAPbOrXIe7ASf500QAkoKYYQ7VW9t6e6JE4RnQdrG4PSp routCbp9XdZk2G8CCQOw8VLyHbPawKiNK+vQAnyTur52nkpqMTODwQlLAGhz88yP 3XACa+R4yD+C9cKsiyHaA/1/WoR0DcvbAsIcbeXp5EMU5cz/bSE4eSQu/cj7p4jX IhFDkvqdo07KZr4+Gz+t6flGwGxrfCujdeRhsI+vd1veJVgxRPH1V+ZtIAVnDvxB McdUP6RYd8IH/h9j99alYQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1715009516; x= 1715095916; bh=XeJ4KkGylBz/yVz6BnceGDPMbIFcGGvB/K45B0IEGpU=; b=P 6hk3NXr9gAvabRzdFwwb15PFstbmTS3wwGL3dfOqyRYZLBgWDLet6uCCPyPAmPWa cD5YnlFmUyLYJ6U+HBtoeQeaFOlUsoaPKJIuH3UahVh9f4MKFi2jmt3LDogx051S PuWIr6ZXmj4NiCUUv8wNdWctGvYmmuOGiNUhRR4hHfQ2bmH61gUz+AuVTx0dC0oQ 6yYYsWtLBV/xZFBrZVopRAQKaG2SS3mkiqfiAgsmcZ6scyukVxGSvASkp7hNB7or tSc7Tp4OFPIUBn+7ng/NkOffHXNcyQuwg6RnwJRHonop5mS6KxPC1Hfme0WhvttV 1QOvbtutrGpCJC8kvZ72g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvddviedgledtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephfffufggtgfgkfhfjgfvvefosehtjeertdertdejnecuhfhrohhmpeflihgr gihunhcujggrnhhguceojhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomheqne cuggftrfgrthhtvghrnhepvdekiefhfeevkeeuveetfeelffekgedugefhtdduudeghfeu veegffegudekjeelnecuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrghilh hfrhhomhepjhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail From: Jiaxun Yang Date: Mon, 06 May 2024 16:31:39 +0100 Subject: [PATCH 5/5] hw/mips/boston: Implement multi core support MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240506-mips-smp-v1-5-3cc234786910@flygoat.com> References: <20240506-mips-smp-v1-0-3cc234786910@flygoat.com> In-Reply-To: <20240506-mips-smp-v1-0-3cc234786910@flygoat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Jiaxun Yang X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3546; i=jiaxun.yang@flygoat.com; h=from:subject:message-id; bh=agVUDK5z50Yx3y9FJ7dmchE1btUX/7dn7FnPDCPKZdk=; b=owGbwMvMwCHmXMhTe71c8zDjabUkhjSL74932Ov0zJsbZhlZfK82qc7fOjJkcyPHkS86fcG8u 14uOHuso5SFQYyDQVZMkSVEQKlvQ+PFBdcfZP2BmcPKBDKEgYtTACYSUs7IsM1m1rL8Kdnrwm0j urhjkv2cezff5zFSUyv/NmnF3A3rTjH80zUpFq3wsvK/79e70STjbpiDBkMs/51iEfa8oH3BCq3 8AA== X-Developer-Key: i=jiaxun.yang@flygoat.com; a=openpgp; fpr=980379BEFEBFBF477EA04EF9C111949073FC0F67 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=64.147.123.150; envelope-from=jiaxun.yang@flygoat.com; helo=wfout7-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @flygoat.com) X-ZM-MESSAGEID: 1715009608498100001 Implement multiple physical core support by passing topology to CPS subsystem and generate cpu-map fdt node to decribe new topology. Signed-off-by: Jiaxun Yang --- hw/mips/boston.c | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/hw/mips/boston.c b/hw/mips/boston.c index 1b44fb354c..4ed7d366fe 100644 --- a/hw/mips/boston.c +++ b/hw/mips/boston.c @@ -542,7 +542,10 @@ static const void *create_fdt(BostonState *s, qemu_fdt_setprop_cell(fdt, "/cpus", "#size-cells", 0x0); qemu_fdt_setprop_cell(fdt, "/cpus", "#address-cells", 0x1); =20 + qemu_fdt_add_subnode(fdt, "/cpus/cpu-map"); for (cpu =3D 0; cpu < ms->smp.cpus; cpu++) { + char *map_path; + name =3D g_strdup_printf("/cpus/cpu@%d", cpu); qemu_fdt_add_subnode(fdt, name); qemu_fdt_setprop_string(fdt, name, "compatible", "img,mips"); @@ -550,6 +553,27 @@ static const void *create_fdt(BostonState *s, qemu_fdt_setprop_cell(fdt, name, "reg", cpu); qemu_fdt_setprop_string(fdt, name, "device_type", "cpu"); qemu_fdt_setprop_cells(fdt, name, "clocks", clk_ph, FDT_BOSTON_CLK= _CPU); + qemu_fdt_setprop_cell(fdt, name, "phandle", qemu_fdt_alloc_phandle= (fdt)); + + if (ms->smp.threads > 1) { + map_path =3D g_strdup_printf( + "/cpus/cpu-map/socket%d/cluster%d/core%d/thread%d", + cpu / (ms->smp.clusters * ms->smp.cores * ms->smp.threads), + (cpu / (ms->smp.cores * ms->smp.threads)) % ms->smp.cluste= rs, + (cpu / ms->smp.threads) % ms->smp.cores, + cpu % ms->smp.threads); + } else { + map_path =3D g_strdup_printf( + "/cpus/cpu-map/socket%d/cluster%d/core%d", + cpu / (ms->smp.clusters * ms->smp.cores), + (cpu / ms->smp.cores) % ms->smp.clusters, + cpu % ms->smp.cores); + } + + qemu_fdt_add_path(fdt, map_path); + qemu_fdt_setprop_phandle(fdt, map_path, "cpu", name); + + g_free(map_path); g_free(name); } =20 @@ -591,6 +615,15 @@ static const void *create_fdt(BostonState *s, g_free(name); g_free(gic_name); =20 + /* CM node */ + name =3D g_strdup_printf("/soc/cm@%" HWADDR_PRIx, memmap[BOSTON_CM].ba= se); + qemu_fdt_add_subnode(fdt, name); + qemu_fdt_setprop_string(fdt, name, "compatible", "mti,mips-cm"); + qemu_fdt_setprop_cells(fdt, name, "reg", memmap[BOSTON_CM].base, + memmap[BOSTON_CM].size); + g_free(name); + + /* CDMM node */ name =3D g_strdup_printf("/soc/cdmm@%" HWADDR_PRIx, memmap[BOSTON_CDMM= ].base); qemu_fdt_add_subnode(fdt, name); @@ -703,7 +736,9 @@ static void boston_mach_init(MachineState *machine) object_initialize_child(OBJECT(machine), "cps", &s->cps, TYPE_MIPS_CPS= ); object_property_set_str(OBJECT(&s->cps), "cpu-type", machine->cpu_type, &error_fatal); - object_property_set_uint(OBJECT(&s->cps), "num-vp", machine->smp.cpus, + object_property_set_uint(OBJECT(&s->cps), "num-pcore", machine->smp.co= res, + &error_fatal); + object_property_set_uint(OBJECT(&s->cps), "num-vp", machine->smp.threa= ds, &error_fatal); qdev_connect_clock_in(DEVICE(&s->cps), "clk-in", qdev_get_clock_out(dev, "cpu-refclk")); --=20 2.34.1