From nobody Mon Nov 25 12:50:05 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=1715009558; cv=none; d=zohomail.com; s=zohoarc; b=THTQJcrGcQpU25Zw0Ako1UCxrfp/WaoPzqterTN1m+UpLiQKExlNMx4ZAB6AlvZswypCTMphb4CqSdHbV4GGv/nkLttVAXKvHzZaGeWlPcTvfVABlOx7lwxwoqYYOd9DYgi5qonWPi+ZPtW/bo6QJcsfnwBP+AX2J21Ct8KGSKo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715009558; 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=2kuNcBBCNIBTaFBvxiXhPQn5uSFy+yrNa24i85xHEC8=; b=G1embyAff72sK8eejfrW+N2vk8yCYEDoZjk/EhdMn8CDctxQHyNvojYPPVVbiUGG8I5Ncg3gJ/RCRrWSWHpQH9ufIs+4f563W3luv0rdMymVpOUDuvVd0qbVB/CIis8c09yG1iUjKQzMiOKaNgy7WpTp2HQp+MvS/ERhxeXCX2c= 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 1715009557899311.24771802385237; Mon, 6 May 2024 08:32:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s40Js-0007j6-UT; Mon, 06 May 2024 11:32:00 -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 1s40Jp-0007hF-1x for qemu-devel@nongnu.org; Mon, 06 May 2024 11:31:59 -0400 Received: from wfhigh1-smtp.messagingengine.com ([64.147.123.152]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s40Jk-0003Jj-W0 for qemu-devel@nongnu.org; Mon, 06 May 2024 11:31:55 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailfhigh.west.internal (Postfix) with ESMTP id 0E4F21800143; Mon, 6 May 2024 11:31:49 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Mon, 06 May 2024 11:31:50 -0400 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 6 May 2024 11:31:48 -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=1715009509; x=1715095909; bh=2kuNcBBCNIBTaFBvxiXhPQn5uSFy+yrNa24i85xHEC8=; b= hFMJsVrDm6ThZcwKdF0fGyzgnmkpZSjN4PwsK1xfn14m6Zt9GPpvXs8+hoDiZTSz 3EnLLd3GO6Cl27NbjS7y17wx0IMlu5p1HN6CaZzFSZWBw4aMuiJOLjhOKViNFSRO t4hH3y179ge74aLTQKevsbwBJ/uv/REcoZ596E9de30v2mHsM41MOvbZK8tx0CXA NSSVSs5QEhy/sCXsCbJYExCF4LTjsADAGk4OGLAlbf8Hf4WVmTCZ1xkOEPz4pdQn LYYnaf3WGB+sIcosJiUx4SUR8ZOEeGWZ1z0JILi2G6Td2lpIXhxf7k4l8Nl7hCi4 938DptHH8FiK2C7fhk7x+Q== 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=1715009509; x= 1715095909; bh=2kuNcBBCNIBTaFBvxiXhPQn5uSFy+yrNa24i85xHEC8=; b=K VWua7GEZG3f0rCctUinQBOhsg2mhh3bhN1av5uh/Y9zCjFTxMztsnc17iwRyAzWD 0uzJs4S+49UiAUP3FS+jci7GCa8gdAZ4J2qq8B1ZBojE3JGiyw4ay43yz/U7gLIH mL1xcdbKj89UKa9AuU6XscWDfr2NLYAVXfuQROVuhU5hj7zFRrx6rF5vT0SvtRHb 7n8HunH1DwUxhdnRZodlnIUqReASU4yGOUYcHAdwRLb7+AuGEo7cCDlUwBepxNRU egIleIZD1kdDNyCGix5M3Px3JxfnMS4K3u4m/CdG5pcY3CoSTqq23nHCtgEMl6Ug GZFNzU+DFT/RjYoU0svNA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvddviedgledtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephfffufggtgfgkfhfjgfvvefosehtjeertdertdejnecuhfhrohhmpeflihgr gihunhcujggrnhhguceojhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomheqne cuggftrfgrthhtvghrnhepvdekiefhfeevkeeuveetfeelffekgedugefhtdduudeghfeu veegffegudekjeelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepjhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail From: Jiaxun Yang Date: Mon, 06 May 2024 16:31:35 +0100 Subject: [PATCH 1/5] target/mips: Make globalnumber a CPU property MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240506-mips-smp-v1-1-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=3976; i=jiaxun.yang@flygoat.com; h=from:subject:message-id; bh=CJg+yb6JSEoXL9V2aoefjDejZ9YFbsgnL4KcYazjW70=; b=owGbwMvMwCHmXMhTe71c8zDjabUkhjSL74+bF+kt7ckz/LWGMWIl23a5xZLH/mrsP1Evvt1p1 evutwpLOkpZGMQ4GGTFFFlCBJT6NjReXHD9QdYfmDmsTCBDGLg4BWAiyT2MDIfU1DY9vsxQo712 rd+ZU7ndDiynp1uW3UoVl9F/4DzHQJGRYclvFsvlkxpmuN1rmJvknPZvusrq1O9etr+WR2atObs jiAsA 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.152; envelope-from=jiaxun.yang@flygoat.com; helo=wfhigh1-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: 1715009558240100001 GlobalNumber marks topology information of a CPU instance. Make it a CPU property to allow CPS to override topology information. Signed-off-by: Jiaxun Yang --- target/mips/cpu.c | 16 +++++++++++++++- target/mips/cpu.h | 10 +++++++++- target/mips/sysemu/machine.c | 5 ++--- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/target/mips/cpu.c b/target/mips/cpu.c index bbe01d07dd..762000d09b 100644 --- a/target/mips/cpu.c +++ b/target/mips/cpu.c @@ -296,7 +296,6 @@ static void mips_cpu_reset_hold(Object *obj, ResetType = type) env->CP0_Random =3D env->tlb->nb_tlb - 1; env->tlb->tlb_in_use =3D env->tlb->nb_tlb; env->CP0_Wired =3D 0; - env->CP0_GlobalNumber =3D (cs->cpu_index & 0xFF) << CP0GN_VPId; env->CP0_EBase =3D KSEG0_BASE | (cs->cpu_index & 0x3FF); if (env->CP0_Config3 & (1 << CP0C3_CMGCR)) { env->CP0_CMGCRBase =3D 0x1fbf8000 >> 4; @@ -484,6 +483,12 @@ static void mips_cpu_realizefn(DeviceState *dev, Error= **errp) =20 env->exception_base =3D (int32_t)0xBFC00000; =20 +#if !defined(CONFIG_USER_ONLY) + if (env->CP0_GlobalNumber =3D=3D -1) { + env->CP0_GlobalNumber =3D (cs->cpu_index & 0xFF) << CP0GN_VPId; + } +#endif + #if defined(CONFIG_TCG) && !defined(CONFIG_USER_ONLY) mmu_init(env, env->cpu_model); #endif @@ -563,6 +568,13 @@ static const TCGCPUOps mips_tcg_ops =3D { }; #endif /* CONFIG_TCG */ =20 +static Property mips_cpu_properties[] =3D { +#if !defined(CONFIG_USER_ONLY) + DEFINE_PROP_INT32("globalnumber", MIPSCPU, env.CP0_GlobalNumber, -1), +#endif + DEFINE_PROP_END_OF_LIST(), +}; + static void mips_cpu_class_init(ObjectClass *c, void *data) { MIPSCPUClass *mcc =3D MIPS_CPU_CLASS(c); @@ -592,6 +604,8 @@ static void mips_cpu_class_init(ObjectClass *c, void *d= ata) #ifdef CONFIG_TCG cc->tcg_ops =3D &mips_tcg_ops; #endif /* CONFIG_TCG */ + + device_class_set_props(dc, mips_cpu_properties); } =20 static const TypeInfo mips_cpu_type_info =3D { diff --git a/target/mips/cpu.h b/target/mips/cpu.h index 3e906a175a..7499608678 100644 --- a/target/mips/cpu.h +++ b/target/mips/cpu.h @@ -612,8 +612,13 @@ typedef struct CPUArchState { # define CP0EnLo_RI 31 # define CP0EnLo_XI 30 #endif - int32_t CP0_GlobalNumber; + /* CP0_GlobalNumber is preserved across CPU reset. */ #define CP0GN_VPId 0 +#define CP0GN_VPId_MASK (0xFFUL << CP0GN_VPId) +#define CP0GN_CoreNum 8 +#define CP0GN_CoreNum_MASK (0xFUL << CP0GN_CoreNum) +#define CP0GN_ClusterNum 16 +#define CP0GN_ClusterNum_MASK (0xFUL << CP0GN_ClusterNum) /* * CP0 Register 4 */ @@ -1175,6 +1180,9 @@ typedef struct CPUArchState { struct {} end_reset_fields; =20 /* Fields from here on are preserved across CPU reset. */ +#if !defined(CONFIG_USER_ONLY) + int32_t CP0_GlobalNumber; +#endif CPUMIPSMVPContext *mvp; #if !defined(CONFIG_USER_ONLY) CPUMIPSTLBContext *tlb; diff --git a/target/mips/sysemu/machine.c b/target/mips/sysemu/machine.c index 213fd637fc..235d640862 100644 --- a/target/mips/sysemu/machine.c +++ b/target/mips/sysemu/machine.c @@ -218,8 +218,8 @@ static const VMStateDescription vmstate_tlb =3D { =20 const VMStateDescription vmstate_mips_cpu =3D { .name =3D "cpu", - .version_id =3D 21, - .minimum_version_id =3D 21, + .version_id =3D 22, + .minimum_version_id =3D 22, .post_load =3D cpu_post_load, .fields =3D (const VMStateField[]) { /* Active TC */ @@ -257,7 +257,6 @@ const VMStateDescription vmstate_mips_cpu =3D { VMSTATE_INT32(env.CP0_VPEOpt, MIPSCPU), VMSTATE_UINT64(env.CP0_EntryLo0, MIPSCPU), VMSTATE_UINT64(env.CP0_EntryLo1, MIPSCPU), - VMSTATE_INT32(env.CP0_GlobalNumber, MIPSCPU), VMSTATE_UINTTL(env.CP0_Context, MIPSCPU), VMSTATE_INT32(env.CP0_MemoryMapID, MIPSCPU), VMSTATE_INT32(env.CP0_PageMask, MIPSCPU), --=20 2.34.1 From nobody Mon Nov 25 12:50:05 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=1715009582; cv=none; d=zohomail.com; s=zohoarc; b=GUhJ4D54QwwY3LaJA0Q8hK5HBZwYEcHYRenLucHqoD9q0mSiUkL1yNxvQus5m6r58aUu5zOR1ted+N+d6uoI70eWARQAHLq1b+7+jquMHJbbvH+V9AC6wVNepAxAHJnSzgLsfVXoyDVh8iT83m+1bvcmJ1U0BdmrsizRHHYmbY8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715009582; 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=gqjjzC39vWS61HBS72F1U4lFSfSfPey3jLgyUvvD31A=; b=Ib+nhr6fZs9DUgjlSKiLpdPEpJtPpBbyeqsKj9NQ2Cw25UuERTpKNoecmFy9wwFCJtKA03SsxB9nJFwE8ntDYM8QDHxtzt3XBhu2jFX5l3Y+VBrvwX0mfksTe0Tol/zEeluGuJ0WDgSH6L2Qbto/HUXSXuLI/RAAshg4kg9XVB4= 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 1715009582602294.9346346126724; Mon, 6 May 2024 08:33:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s40Ju-0007k7-IE; Mon, 06 May 2024 11:32:02 -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 1s40Jq-0007hN-Vr for qemu-devel@nongnu.org; Mon, 06 May 2024 11:31:59 -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 1s40Jl-0003K2-Uv for qemu-devel@nongnu.org; Mon, 06 May 2024 11:31:57 -0400 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfout.west.internal (Postfix) with ESMTP id CE5621C00168; Mon, 6 May 2024 11:31:51 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Mon, 06 May 2024 11:31:52 -0400 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 6 May 2024 11:31:50 -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=1715009511; x=1715095911; bh=gqjjzC39vWS61HBS72F1U4lFSfSfPey3jLgyUvvD31A=; b= hcm5A6yHERFG/K2S6uxuyj6iBe67ISJ/9SDpzrnyok59ByqUrCZCp15KGE6Ce+qv 4HxbrifmpBSYcXNJ+RKkzmq7T3SG8VOM1cQUUzhQETGVNSAZWm04xDJ2hMkzMpyP 4a92sCDU+wMFs8byYaLvwsDc0nxLqOdgD6KBAr7jlzA/efHv/rGqRHgTNCpV0b3o PbOznPZDURc3S4ifCW89yVhtcCPJUhfSksuqRY901NSOd7nWyYa/2PFZ5EHChbvt iPYmwsrJr3984xfIjg94gqBQXBzn3sXdYXjtjEllUO2AxPKWs/d2hXOLVZ10HC5U j6tvfHOaE3rcxiPXBJZGVA== 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=1715009511; x= 1715095911; bh=gqjjzC39vWS61HBS72F1U4lFSfSfPey3jLgyUvvD31A=; b=L 0J/L9UE7qP4MD3dHynj72DBshVf3i0G3fbyIKEU/hPFZsUm73QDxaTVej2Xfk5tn aKWFXUTB0T3V7GhF0M2QgHhG5TP22Mp6HDbcdb0lqPMmCmONkvKZb/eyBJ5Nf4u6 /oUIzbaQW0hrYd6Ap9BBTcNPRRFGH0Ez0CFLR8vEcXaq6iu8hAd3DNW/QdUDHgvM vtj5XxpTV2iDeoPn7YpnbxDaCeuWfIjGGc90/1lgzrBBiNH0DSSjB7dGsCHuUdGC vwAAVS/Ml7aO7PgdKa2vvc5D/DjIiFRdXryZ4E20i14XwCfwcpb13FgBEuhY+Gfb ht3znmxRxz0Eey7VICPXA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvddviedgledtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephfffufggtgfgkfhfjgfvvefosehtjeertdertdejnecuhfhrohhmpeflihgr gihunhcujggrnhhguceojhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomheqne cuggftrfgrthhtvghrnhepvdekiefhfeevkeeuveetfeelffekgedugefhtdduudeghfeu veegffegudekjeelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepjhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail From: Jiaxun Yang Date: Mon, 06 May 2024 16:31:36 +0100 Subject: [PATCH 2/5] hw/msic/mips_cmgcr: Implement multicore functions MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240506-mips-smp-v1-2-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=15709; i=jiaxun.yang@flygoat.com; h=from:subject:message-id; bh=YC6TrlfnKQ28wZCq8QngZ3hZOxnX06cw7yNgHujMLfM=; b=owGbwMvMwCHmXMhTe71c8zDjabUkhjSL74+1Lob+3OG5Q6rW3+psgH2AzZ+HvK8DN81xDHw58 0+Kt8TbjlIWBjEOBlkxRZYQAaW+DY0XF1x/kPUHZg4rE8gQBi5OAZjIy7UMf2XWyn87tiNyYkPD 2dzqCTpLGSfX8T2JkGGrXeHVyH+Vs4OR4ZjPDbv/Al0JUfv1TV/EW/toamzY3XSu7u71herKrqd leAE= 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: 1715009584610100001 We implemented following functions to allow software to probe and control VPs on secondary core - Reading out pcore count and coherence state - Two scratch GCRs for firmware - Semaphore GCR for register locking - Redirect block to other cores Signed-off-by: Jiaxun Yang --- hw/misc/mips_cmgcr.c | 168 +++++++++++++++++++++++++++++++++++----= ---- include/hw/misc/mips_cmgcr.h | 87 +++++++++++++++++++--- 2 files changed, 215 insertions(+), 40 deletions(-) diff --git a/hw/misc/mips_cmgcr.c b/hw/misc/mips_cmgcr.c index 2703040f45..8c2d184f2c 100644 --- a/hw/misc/mips_cmgcr.c +++ b/hw/misc/mips_cmgcr.c @@ -73,14 +73,19 @@ static inline void update_gic_base(MIPSGCRState *gcr, u= int64_t val) static uint64_t gcr_read(void *opaque, hwaddr addr, unsigned size) { MIPSGCRState *gcr =3D (MIPSGCRState *) opaque; - MIPSGCRVPState *current_vps =3D &gcr->vps[current_cpu->cpu_index]; - MIPSGCRVPState *other_vps =3D &gcr->vps[current_vps->other]; + int redirect_corenum =3D mips_gcr_get_redirect_corenum(gcr); + int redirect_vpid =3D mips_gcr_get_redirect_vpid(gcr); + int current_corenum =3D mips_gcr_get_current_corenum(gcr); + int current_vpid =3D mips_gcr_get_current_vpid(gcr); + MIPSGCRPCoreState *current_pcore =3D &gcr->pcs[current_corenum]; + MIPSGCRVPState *current_vps =3D ¤t_pcore->vps[current_vpid]; + MIPSGCRPCoreState *other_pcore =3D &gcr->pcs[redirect_corenum]; + MIPSGCRVPState *other_vps =3D &other_pcore->vps[redirect_vpid]; =20 switch (addr) { /* Global Control Block Register */ case GCR_CONFIG_OFS: - /* Set PCORES to 0 */ - return 0; + return gcr->num_pcores - 1; case GCR_BASE_OFS: return gcr->gcr_base; case GCR_REV_OFS: @@ -96,7 +101,19 @@ static uint64_t gcr_read(void *opaque, hwaddr addr, uns= igned size) case GCR_L2_CONFIG_OFS: /* L2 BYPASS */ return GCR_L2_CONFIG_BYPASS_MSK; + case GCR_SYS_CONFIG2_OFS: + return gcr->num_vps << GCR_SYS_CONFIG2_MAXVP_SHF; + case GCR_SCRATCH0_OFS: + return gcr->scratch[0]; + case GCR_SCRATCH1_OFS: + return gcr->scratch[1]; + case GCR_SEM_OFS: + return gcr->sem; /* Core-Local and Core-Other Control Blocks */ + case MIPS_CLCB_OFS + GCR_CL_COH_EN_OFS: + return current_pcore->coh_en; + case MIPS_COCB_OFS + GCR_CL_COH_EN_OFS: + return other_pcore->coh_en; case MIPS_CLCB_OFS + GCR_CL_CONFIG_OFS: case MIPS_COCB_OFS + GCR_CL_CONFIG_OFS: /* Set PVP to # of VPs - 1 */ @@ -105,10 +122,18 @@ static uint64_t gcr_read(void *opaque, hwaddr addr, u= nsigned size) return current_vps->reset_base; case MIPS_COCB_OFS + GCR_CL_RESETBASE_OFS: return other_vps->reset_base; - case MIPS_CLCB_OFS + GCR_CL_OTHER_OFS: - return current_vps->other; - case MIPS_COCB_OFS + GCR_CL_OTHER_OFS: - return other_vps->other; + case MIPS_CLCB_OFS + GCR_CL_REDIRECT_OFS: + return current_vps->redirect; + case MIPS_COCB_OFS + GCR_CL_REDIRECT_OFS: + return other_vps->redirect; + case MIPS_CLCB_OFS + GCR_CL_ID_OFS: + return current_corenum; + case MIPS_COCB_OFS + GCR_CL_ID_OFS: + return redirect_corenum; + case MIPS_CLCB_OFS + GCR_CL_SCRATCH_OFS: + return current_vps->scratch; + case MIPS_COCB_OFS + GCR_CL_SCRATCH_OFS: + return other_vps->scratch; default: qemu_log_mask(LOG_UNIMP, "Read %d bytes at GCR offset 0x%" HWADDR_= PRIx "\n", size, addr); @@ -123,12 +148,36 @@ static inline target_ulong get_exception_base(MIPSGCR= VPState *vps) return (int32_t)(vps->reset_base & GCR_CL_RESET_BASE_RESETBASE_MSK); } =20 +static inline void set_redirect(MIPSGCRState *gcr, + MIPSGCRVPState *vps, target_ulong data) +{ + int new_vpid =3D data & GCR_CL_REDIRECT_VP_MSK; + int new_coreid =3D (data & GCR_CL_REDIRECT_CORE_MSK) >> GCR_CL_REDIREC= T_CORE_SHF; + + if (new_vpid >=3D gcr->num_vps) { + return; + } + + if (new_coreid >=3D gcr->num_pcores) { + return; + } + + vps->redirect =3D data & (GCR_CL_REDIRECT_VP_MSK | GCR_CL_REDIRECT_COR= E_MSK); +} + /* Write GCR registers */ static void gcr_write(void *opaque, hwaddr addr, uint64_t data, unsigned s= ize) { - MIPSGCRState *gcr =3D (MIPSGCRState *)opaque; - MIPSGCRVPState *current_vps =3D &gcr->vps[current_cpu->cpu_index]; - MIPSGCRVPState *other_vps =3D &gcr->vps[current_vps->other]; + MIPSGCRState *gcr =3D (MIPSGCRState *) opaque; + int redirect_corenum =3D mips_gcr_get_redirect_corenum(gcr); + int redirect_vpid =3D mips_gcr_get_redirect_vpid(gcr); + int redirect_vpnum =3D mips_gcr_get_redirect_vpnum(gcr); + int current_corenum =3D mips_gcr_get_current_corenum(gcr); + int current_vpid =3D mips_gcr_get_current_vpid(gcr); + MIPSGCRPCoreState *current_pcore =3D &gcr->pcs[current_corenum]; + MIPSGCRVPState *current_vps =3D ¤t_pcore->vps[current_vpid]; + MIPSGCRPCoreState *other_pcore =3D &gcr->pcs[redirect_corenum]; + MIPSGCRVPState *other_vps =3D &other_pcore->vps[redirect_vpid]; =20 switch (addr) { case GCR_BASE_OFS: @@ -140,6 +189,25 @@ static void gcr_write(void *opaque, hwaddr addr, uint6= 4_t data, unsigned size) case GCR_CPC_BASE_OFS: update_cpc_base(gcr, data); break; + case GCR_SCRATCH0_OFS: + gcr->scratch[0] =3D data; + break; + case GCR_SCRATCH1_OFS: + gcr->scratch[1] =3D data; + break; + case GCR_SEM_OFS: + /* Write is inhibited if the SEM_LOCK bit is already 1 */ + if ((data & GCR_SEM_LOCK_MASK) && (gcr->sem & GCR_SEM_LOCK_MASK)) { + break; + } + gcr->sem =3D data; + break; + case MIPS_CLCB_OFS + GCR_CL_COH_EN_OFS: + current_pcore->coh_en =3D data & 1; + break; + case MIPS_COCB_OFS + GCR_CL_COH_EN_OFS: + other_pcore->coh_en =3D data & 1; + break; case MIPS_CLCB_OFS + GCR_CL_RESETBASE_OFS: current_vps->reset_base =3D data & GCR_CL_RESET_BASE_MSK; cpu_set_exception_base(current_cpu->cpu_index, @@ -147,18 +215,17 @@ static void gcr_write(void *opaque, hwaddr addr, uint= 64_t data, unsigned size) break; case MIPS_COCB_OFS + GCR_CL_RESETBASE_OFS: other_vps->reset_base =3D data & GCR_CL_RESET_BASE_MSK; - cpu_set_exception_base(current_vps->other, + cpu_set_exception_base(redirect_vpnum, get_exception_base(other_vps)); break; - case MIPS_CLCB_OFS + GCR_CL_OTHER_OFS: - if ((data & GCR_CL_OTHER_MSK) < gcr->num_vps) { - current_vps->other =3D data & GCR_CL_OTHER_MSK; - } + case MIPS_CLCB_OFS + GCR_CL_REDIRECT_OFS: + set_redirect(gcr, current_vps, data); break; - case MIPS_COCB_OFS + GCR_CL_OTHER_OFS: - if ((data & GCR_CL_OTHER_MSK) < gcr->num_vps) { - other_vps->other =3D data & GCR_CL_OTHER_MSK; - } + case MIPS_COCB_OFS + GCR_CL_SCRATCH_OFS: + other_vps->scratch =3D data; + break; + case MIPS_COCB_OFS + GCR_CL_REDIRECT_OFS: + set_redirect(gcr, other_vps, data); break; default: qemu_log_mask(LOG_UNIMP, "Write %d bytes at GCR offset 0x%" HWADDR= _PRIx @@ -189,30 +256,67 @@ static void mips_gcr_init(Object *obj) static void mips_gcr_reset(DeviceState *dev) { MIPSGCRState *s =3D MIPS_GCR(dev); - int i; + int pc, vp; =20 + update_gcr_base(s, s->gcr_base); update_gic_base(s, 0); update_cpc_base(s, 0); =20 - for (i =3D 0; i < s->num_vps; i++) { - s->vps[i].other =3D 0; - s->vps[i].reset_base =3D 0xBFC00000 & GCR_CL_RESET_BASE_MSK; - cpu_set_exception_base(i, get_exception_base(&s->vps[i])); + for (pc =3D 0; pc < s->num_pcores; pc++) { + s->pcs[pc].coh_en =3D 1; + for (vp =3D 0; vp < s->num_vps; vp++) { + int vpnum =3D pc * s->num_vps + vp; + + s->pcs[pc].vps[vp].redirect =3D 0; + s->pcs[pc].vps[vp].reset_base =3D 0xBFC00000 & GCR_CL_RESET_BA= SE_MSK; + cpu_set_exception_base(vpnum, get_exception_base(&s->pcs[pc].v= ps[vp])); + } } } =20 -static const VMStateDescription vmstate_mips_gcr =3D { - .name =3D "mips-gcr", +static const VMStateDescription vmstate_mips_gcr_vps =3D { + .name =3D "mips-gcr/vps", .version_id =3D 0, .minimum_version_id =3D 0, .fields =3D (const VMStateField[]) { + VMSTATE_UINT32(redirect, MIPSGCRVPState), + VMSTATE_UINT64(reset_base, MIPSGCRVPState), + VMSTATE_UINT64(scratch, MIPSGCRVPState), + VMSTATE_END_OF_LIST() + }, +}; + +static const VMStateDescription vmstate_mips_gcr_pcs =3D { + .name =3D "mips-gcr/pcs", + .version_id =3D 0, + .minimum_version_id =3D 0, + .fields =3D (const VMStateField[]) { + VMSTATE_INT32(num_vps, MIPSGCRPCoreState), + VMSTATE_UINT32(coh_en, MIPSGCRPCoreState), + VMSTATE_STRUCT_VARRAY_ALLOC(vps, MIPSGCRPCoreState, num_vps, 0, + vmstate_mips_gcr_vps, MIPSGCRVPState), + VMSTATE_END_OF_LIST() + }, +}; + +static const VMStateDescription vmstate_mips_gcr =3D { + .name =3D "mips-gcr", + .version_id =3D 1, + .minimum_version_id =3D 1, + .fields =3D (const VMStateField[]) { + VMSTATE_UINT64_ARRAY(scratch, MIPSGCRState, 2), + VMSTATE_UINT32(sem, MIPSGCRState), VMSTATE_UINT64(cpc_base, MIPSGCRState), + VMSTATE_UINT64(gic_base, MIPSGCRState), + VMSTATE_STRUCT_VARRAY_ALLOC(pcs, MIPSGCRState, num_pcores, 0, + vmstate_mips_gcr_pcs, MIPSGCRPCoreState), VMSTATE_END_OF_LIST() }, }; =20 static Property mips_gcr_properties[] =3D { - DEFINE_PROP_UINT32("num-vp", MIPSGCRState, num_vps, 1), + DEFINE_PROP_INT32("num-pcores", MIPSGCRState, num_pcores, 1), + DEFINE_PROP_INT32("num-vp", MIPSGCRState, num_vps, 1), DEFINE_PROP_INT32("gcr-rev", MIPSGCRState, gcr_rev, 0x800), DEFINE_PROP_UINT64("gcr-base", MIPSGCRState, gcr_base, GCR_BASE_ADDR), DEFINE_PROP_LINK("gic", MIPSGCRState, gic_mr, TYPE_MEMORY_REGION, @@ -226,8 +330,12 @@ static void mips_gcr_realize(DeviceState *dev, Error *= *errp) { MIPSGCRState *s =3D MIPS_GCR(dev); =20 - /* Create local set of registers for each VP */ - s->vps =3D g_new(MIPSGCRVPState, s->num_vps); + /* Create local set of registers for each VP and each pcore */ + s->pcs =3D g_new(MIPSGCRPCoreState, s->num_pcores); + for (int i =3D 0; i < s->num_pcores; i++) { + s->pcs[i].num_vps =3D s->num_vps; + s->pcs[i].vps =3D g_new(MIPSGCRVPState, s->num_vps); + } } =20 static void mips_gcr_class_init(ObjectClass *klass, void *data) diff --git a/include/hw/misc/mips_cmgcr.h b/include/hw/misc/mips_cmgcr.h index db4bf5f449..f75ff660c2 100644 --- a/include/hw/misc/mips_cmgcr.h +++ b/include/hw/misc/mips_cmgcr.h @@ -34,16 +34,27 @@ OBJECT_DECLARE_SIMPLE_TYPE(MIPSGCRState, MIPS_GCR) #define GCR_GIC_STATUS_OFS 0x00D0 #define GCR_CPC_STATUS_OFS 0x00F0 #define GCR_L2_CONFIG_OFS 0x0130 +#define GCR_SYS_CONFIG2_OFS 0x0150 +#define GCR_SCRATCH0_OFS 0x0280 +#define GCR_SCRATCH1_OFS 0x0288 +#define GCR_SEM_OFS 0x0640 =20 /* Core Local and Core Other Block Register Map */ -#define GCR_CL_CONFIG_OFS 0x0010 -#define GCR_CL_OTHER_OFS 0x0018 -#define GCR_CL_RESETBASE_OFS 0x0020 +#define GCR_CL_COH_EN_OFS 0x0008 /* Core-Local */ +#define GCR_CL_CONFIG_OFS 0x0010 /* Core-Local */ +#define GCR_CL_REDIRECT_OFS 0x0018 /* VP-Local */ +#define GCR_CL_RESETBASE_OFS 0x0020 /* VP-Local */ +#define GCR_CL_ID_OFS 0x0028 /* Core-Local */ +#define GCR_CL_SCRATCH_OFS 0x0060 /* VP-Local */ =20 /* GCR_L2_CONFIG register fields */ #define GCR_L2_CONFIG_BYPASS_SHF 20 #define GCR_L2_CONFIG_BYPASS_MSK ((0x1ULL) << GCR_L2_CONFIG_BYPASS_SHF) =20 +/* GCR_SYS_CONFIG2 register fields */ +#define GCR_SYS_CONFIG2_MAXVP_SHF 0 +#define GCR_SYS_CONFIG2_MAXVP_MSK ((0xFULL) << GCR_SYS_CONFIG2_MAXVP_SH= F) + /* GCR_BASE register fields */ #define GCR_BASE_GCRBASE_MSK 0xffffffff8000ULL =20 @@ -52,14 +63,20 @@ OBJECT_DECLARE_SIMPLE_TYPE(MIPSGCRState, MIPS_GCR) #define GCR_GIC_BASE_GICBASE_MSK 0xFFFFFFFE0000ULL #define GCR_GIC_BASE_MSK (GCR_GIC_BASE_GICEN_MSK | GCR_GIC_BASE_GICBASE_MS= K) =20 +/* GCR_SEM register fields */ +#define GCR_SEM_DATA_MSK 0x00000000EFFFFFFFULL +#define GCR_SEM_LOCK_MASK 0x0000000080000000ULL + /* GCR_CPC_BASE register fields */ #define GCR_CPC_BASE_CPCEN_MSK 1 #define GCR_CPC_BASE_CPCBASE_MSK 0xFFFFFFFF8000ULL #define GCR_CPC_BASE_MSK (GCR_CPC_BASE_CPCEN_MSK | GCR_CPC_BASE_CPCBASE_MS= K) =20 -/* GCR_CL_OTHER_OFS register fields */ -#define GCR_CL_OTHER_VPOTHER_MSK 0x7 -#define GCR_CL_OTHER_MSK GCR_CL_OTHER_VPOTHER_MSK +/* GCR_CL_REDIRECT_OFS register fields */ +#define GCR_CL_REDIRECT_VP_MSK 0x7U +#define GCR_CL_REDIRECT_VP_SHF 0 +#define GCR_CL_REDIRECT_CORE_MSK 0xF00U +#define GCR_CL_REDIRECT_CORE_SHF 8 =20 /* GCR_CL_RESETBASE_OFS register fields */ #define GCR_CL_RESET_BASE_RESETBASE_MSK 0xFFFFF000U @@ -67,15 +84,28 @@ OBJECT_DECLARE_SIMPLE_TYPE(MIPSGCRState, MIPS_GCR) =20 typedef struct MIPSGCRVPState MIPSGCRVPState; struct MIPSGCRVPState { - uint32_t other; + uint32_t redirect; uint64_t reset_base; + uint64_t scratch; +}; + +typedef struct MIPSGCRPCoreState MIPSGCRPCoreState; +struct MIPSGCRPCoreState { + int32_t num_vps; /* Number of VPs in that core */ + uint32_t coh_en; + /* VP Local/Other Registers */ + MIPSGCRVPState *vps; }; =20 struct MIPSGCRState { SysBusDevice parent_obj; =20 int32_t gcr_rev; - uint32_t num_vps; + int32_t num_pcores; /* Number of physical cores */ + int32_t num_vps; /* Number of VPs per physical core */ + + uint64_t scratch[2]; /* GCR Scratch */ + uint32_t sem; /* GCR Semaphore */ hwaddr gcr_base; MemoryRegion iomem; MemoryRegion *cpc_mr; @@ -84,8 +114,45 @@ struct MIPSGCRState { uint64_t cpc_base; uint64_t gic_base; =20 - /* VP Local/Other Registers */ - MIPSGCRVPState *vps; + /* Core Local/Other Registers */ + MIPSGCRPCoreState *pcs; }; =20 +static inline int mips_gcr_get_current_corenum(MIPSGCRState *s) +{ + return current_cpu->cpu_index / s->num_vps; +} + +static inline int mips_gcr_get_current_vpid(MIPSGCRState *s) +{ + return current_cpu->cpu_index % s->num_vps; +} + +static inline int mips_gcr_get_redirect_corenum(MIPSGCRState *s) +{ + int current_corenum =3D mips_gcr_get_current_corenum(s); + int current_vpid =3D mips_gcr_get_current_vpid(s); + MIPSGCRVPState *current_vps =3D &s->pcs[current_corenum].vps[current_v= pid]; + + return (current_vps->redirect & GCR_CL_REDIRECT_CORE_MSK) >> + GCR_CL_REDIRECT_CORE_SHF; +} + +static inline int mips_gcr_get_redirect_vpid(MIPSGCRState *s) +{ + int current_corenum =3D mips_gcr_get_current_corenum(s); + int current_vpid =3D mips_gcr_get_current_vpid(s); + MIPSGCRVPState *current_vps =3D &s->pcs[current_corenum].vps[current_v= pid]; + + return (current_vps->redirect & GCR_CL_REDIRECT_VP_MSK) >> + GCR_CL_REDIRECT_VP_SHF; +} + +static inline int mips_gcr_get_redirect_vpnum(MIPSGCRState *s) +{ + int core =3D mips_gcr_get_redirect_corenum(s); + int vpid =3D mips_gcr_get_redirect_vpid(s); + return core * s->num_vps + vpid; +} + #endif /* MIPS_CMGCR_H */ --=20 2.34.1 From nobody Mon Nov 25 12:50:05 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=1715009599; cv=none; d=zohomail.com; s=zohoarc; b=NW4q7iHiFA/NRhwVrvzFWW4rOu/wPKTutydd9/n0NdR2XxpG3qH7z6tCPd3fXDcUprXpcVQOobKnRIlQBvCbxXYrCDK2g/+3RmHJpH2ojAE59hh/XLGJdOK2F5ss7p69pfk0VCJf+xO5QZ4kqWKohHeS8LwmTDioZlOfwOpmNq4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715009599; 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=zSuWjtonhAvpP4vNszbrhHmYCXZDb4UBfgKX0cnoSL0=; b=eYSPAzny2a7uKUYo5mcslWYeDbjzhT98BxyZyPzqkzoqkeAL4937r/pjLjr5+dJgx2iU1Bn1yFVgN0WhxhcZWVYGcLTW8/8gZWakmCzrT0aD6BcBuiLGTPUvqevALgp5hnLWH0u/tU6MTpi8L/tRzxkDXu0Tb8Rthy64L+lWLbE= 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 1715009599344227.06762738462896; Mon, 6 May 2024 08:33:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s40Jt-0007jx-LZ; Mon, 06 May 2024 11:32:01 -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 1s40Jp-0007hH-Rn for qemu-devel@nongnu.org; Mon, 06 May 2024 11:31:59 -0400 Received: from wfhigh1-smtp.messagingengine.com ([64.147.123.152]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s40Jm-0003Oy-Rs for qemu-devel@nongnu.org; Mon, 06 May 2024 11:31:57 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailfhigh.west.internal (Postfix) with ESMTP id 80DE218000D3; Mon, 6 May 2024 11:31:53 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Mon, 06 May 2024 11:31:53 -0400 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 6 May 2024 11:31:52 -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=1715009513; x=1715095913; bh=zSuWjtonhAvpP4vNszbrhHmYCXZDb4UBfgKX0cnoSL0=; b= rbaLDADTSjnTGw0axYkJbC7X/MZhZfIKK6klrN6qvoNSahUg4DdVooXLQL2Xa7nl R9qntdRhKSoyJWup5zXHVNqeZB/afdRhBJnsWfrKocs8bNzU2bqSN9rVp3gMt+lA NY+LW+/ltQONAM06IWcDvdAi6v+bbVTmz5D7FFg5qC/dB2x0dR67CCfpUtJm95Ov ExXJTwRvjMjFyVasijTOL7F3yMaB6SxlaSGgxjcl48wq30spjdl8MYq3MhlJlAQJ 1Nsd5+//tIxzH+XePb6UujgKRHhPkaDlft07VynnIuVAF2lje+x0BsQqj5Pqku0t GBf5gHI9JtV92aRLZ5Av4g== 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=1715009513; x= 1715095913; bh=zSuWjtonhAvpP4vNszbrhHmYCXZDb4UBfgKX0cnoSL0=; b=R kFXBLFY+HAwKlQp996KoSZ5rJ8F4jUqzVOZCnJbLhGN9AI0zxEJ0nGnpi/6u0zOV wdA1K8WgtxRk2NkmfIS4sPUsJKGMgaL2Un7W5NbPsgBBgdIrgQ7glwxTDOt2jaJL Pn1chn2iwMQRFpO+1uzE2QcvbPvPQzSCXSZkGUciO2ZHlZxpIcEPFdHOoW+SUNtq q4KFEbaDK7taH41gZFb2HZVsBvLaL8AYiqeBVbImiLBiTARlxRWk8+5nLbb8jEAT 3ahDgX04vOAQYh/oY2zkDyO9ooACaJNBzx0g0MuHvtyjU2wGyWOVM7TiryTtLPAm HxZMLwPGilTMdrtwup/5Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvddviedgledtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephfffufggtgfgkfhfjgfvvefosehtjeertdertdejnecuhfhrohhmpeflihgr gihunhcujggrnhhguceojhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomheqne cuggftrfgrthhtvghrnhepvdekiefhfeevkeeuveetfeelffekgedugefhtdduudeghfeu veegffegudekjeelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepjhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail From: Jiaxun Yang Date: Mon, 06 May 2024 16:31:37 +0100 Subject: [PATCH 3/5] hw/msic/mips_cpc: 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-3-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=8389; i=jiaxun.yang@flygoat.com; h=from:subject:message-id; bh=KYFqNiS8gSxVVeBLA/WE1udVx7/n3BTMqPVVrQQtEP4=; b=owGbwMvMwCHmXMhTe71c8zDjabUkhjSL749/XeFWqRQ43Hu9k8uEmW1FQ6B1zxyZjUovir6KC tY9KXHrKGVhEONgkBVTZAkRUOrb0HhxwfUHWX9g5rAygQxh4OIUgInYZTEyrNy64ePDhut7m3mO lbxYyfuF3ZtnT2XKHk9by+r6LW0zVBl+s+wz9fVbYfY34poe4wyZR7cZ1/a5x7YfLUzldjt21ec oMwA= 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.152; envelope-from=jiaxun.yang@flygoat.com; helo=wfhigh1-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: 1715009604527100001 Implement multiple physical core support for MIPS CPC controller. Including some R/O configuration registers and VP bring up support on multiple cores. Signed-off-by: Jiaxun Yang --- hw/misc/mips_cpc.c | 97 ++++++++++++++++++++++++++++++++++--------= ---- include/hw/misc/mips_cpc.h | 15 ++++++- 2 files changed, 85 insertions(+), 27 deletions(-) diff --git a/hw/misc/mips_cpc.c b/hw/misc/mips_cpc.c index 1e8fd2e699..f6a2f29088 100644 --- a/hw/misc/mips_cpc.c +++ b/hw/misc/mips_cpc.c @@ -25,9 +25,25 @@ #include "hw/sysbus.h" #include "migration/vmstate.h" =20 +#include "hw/misc/mips_cmgcr.h" #include "hw/misc/mips_cpc.h" #include "hw/qdev-properties.h" =20 +static inline int cpc_vpnum_to_corenum(MIPSCPCState *cpc, int vpnum) +{ + return vpnum / cpc->num_vp; +} + +static inline int cpc_vpnum_to_vpid(MIPSCPCState *cpc, int vpnum) +{ + return vpnum % cpc->num_vp; +} + +static inline MIPSCPCPCoreState *cpc_vpnum_to_pcs(MIPSCPCState *cpc, int v= pnum) +{ + return &cpc->pcs[cpc_vpnum_to_corenum(cpc, vpnum)]; +} + static inline uint64_t cpc_vp_run_mask(MIPSCPCState *cpc) { return (1ULL << cpc->num_vp) - 1; @@ -39,36 +55,41 @@ static void mips_cpu_reset_async_work(CPUState *cs, run= _on_cpu_data data) =20 cpu_reset(cs); cs->halted =3D 0; - cpc->vp_running |=3D 1ULL << cs->cpu_index; + cpc_vpnum_to_pcs(cpc, cs->cpu_index)->vp_running |=3D + 1 << cpc_vpnum_to_vpid(cpc, cs->cpu_index); } =20 -static void cpc_run_vp(MIPSCPCState *cpc, uint64_t vp_run) +static void cpc_run_vp(MIPSCPCState *cpc, int pcore, uint64_t vp_run) { - CPUState *cs =3D first_cpu; + MIPSCPCPCoreState *pcs =3D &cpc->pcs[pcore]; =20 - CPU_FOREACH(cs) { - uint64_t i =3D 1ULL << cs->cpu_index; - if (i & vp_run & ~cpc->vp_running) { + for (int vpid =3D 0; vpid < cpc->num_vp; vpid++) { + if ((1 << vpid) & vp_run & ~pcs->vp_running) { + int vpnum =3D pcore * cpc->num_vp + vpid; /* * To avoid racing with a CPU we are just kicking off. * We do the final bit of preparation for the work in * the target CPUs context. */ - async_safe_run_on_cpu(cs, mips_cpu_reset_async_work, - RUN_ON_CPU_HOST_PTR(cpc)); + async_safe_run_on_cpu(qemu_get_cpu(vpnum), + mips_cpu_reset_async_work, + RUN_ON_CPU_HOST_PTR(cpc)); + pcs->vp_running |=3D 1 << vpid; } } } =20 -static void cpc_stop_vp(MIPSCPCState *cpc, uint64_t vp_stop) +static void cpc_stop_vp(MIPSCPCState *cpc, int pcore, uint64_t vp_stop) { - CPUState *cs =3D first_cpu; + MIPSCPCPCoreState *pcs =3D &cpc->pcs[pcore]; + + for (int vpid =3D 0; vpid < cpc->num_vp; vpid++) { + if ((1 << vpid) & vp_stop & pcs->vp_running) { + int vpnum =3D pcore * cpc->num_vp + vpid; + CPUState *cs =3D qemu_get_cpu(vpnum); =20 - CPU_FOREACH(cs) { - uint64_t i =3D 1ULL << cs->cpu_index; - if (i & vp_stop & cpc->vp_running) { cpu_interrupt(cs, CPU_INTERRUPT_HALT); - cpc->vp_running &=3D ~i; + pcs->vp_running &=3D ~(1 << vpid); } } } @@ -77,15 +98,20 @@ static void cpc_write(void *opaque, hwaddr offset, uint= 64_t data, unsigned size) { MIPSCPCState *s =3D opaque; + int current_corenum =3D cpc_vpnum_to_corenum(s, current_cpu->cpu_index= ); =20 switch (offset) { case CPC_CL_BASE_OFS + CPC_VP_RUN_OFS: + cpc_run_vp(s, current_corenum, data); + break; case CPC_CO_BASE_OFS + CPC_VP_RUN_OFS: - cpc_run_vp(s, data & cpc_vp_run_mask(s)); + cpc_run_vp(s, mips_gcr_get_redirect_corenum(s->gcr), data); break; case CPC_CL_BASE_OFS + CPC_VP_STOP_OFS: + cpc_stop_vp(s, current_corenum, data); + break; case CPC_CO_BASE_OFS + CPC_VP_STOP_OFS: - cpc_stop_vp(s, data & cpc_vp_run_mask(s)); + cpc_stop_vp(s, mips_gcr_get_redirect_corenum(s->gcr), data); break; default: qemu_log_mask(LOG_UNIMP, @@ -101,9 +127,13 @@ static uint64_t cpc_read(void *opaque, hwaddr offset, = unsigned size) MIPSCPCState *s =3D opaque; =20 switch (offset) { + case CPC_CL_BASE_OFS + CPC_CL_STAT_CONF_OFS: + case CPC_CO_BASE_OFS + CPC_CL_STAT_CONF_OFS: + return CPC_CL_STAT_CONF_SEQ_STATE_U6 << CPC_CL_STAT_CONF_SEQ_STATE= _SHF; case CPC_CL_BASE_OFS + CPC_VP_RUNNING_OFS: + return cpc_vpnum_to_pcs(s, current_cpu->cpu_index)->vp_running; case CPC_CO_BASE_OFS + CPC_VP_RUNNING_OFS: - return s->vp_running; + return s->pcs[mips_gcr_get_redirect_corenum(s->gcr)].vp_running; default: qemu_log_mask(LOG_UNIMP, "%s: Bad offset 0x%x\n", __func__, (int)offset); @@ -137,9 +167,11 @@ static void mips_cpc_realize(DeviceState *dev, Error *= *errp) if (s->vp_start_running > cpc_vp_run_mask(s)) { error_setg(errp, "incorrect vp_start_running 0x%" PRIx64 " for num_vp = =3D %d", - s->vp_running, s->num_vp); + s->vp_start_running, s->num_vp); return; } + + s->pcs =3D g_new(MIPSCPCPCoreState, s->num_pcores); } =20 static void mips_cpc_reset(DeviceState *dev) @@ -147,25 +179,40 @@ static void mips_cpc_reset(DeviceState *dev) MIPSCPCState *s =3D MIPS_CPC(dev); =20 /* Reflect the fact that all VPs are halted on reset */ - s->vp_running =3D 0; + for (int i =3D 0; i < s->num_pcores; i++) { + s->pcs[i].vp_running =3D 0; + } =20 - /* Put selected VPs into run state */ - cpc_run_vp(s, s->vp_start_running); + /* Put selected VPs on core 0 into run state */ + cpc_run_vp(s, 0, s->vp_start_running); } =20 -static const VMStateDescription vmstate_mips_cpc =3D { - .name =3D "mips-cpc", +static const VMStateDescription vmstate_mips_cpc_pcs =3D { + .name =3D "mips-cpc/pcs", .version_id =3D 0, .minimum_version_id =3D 0, .fields =3D (const VMStateField[]) { - VMSTATE_UINT64(vp_running, MIPSCPCState), + VMSTATE_UINT64(vp_running, MIPSCPCPCoreState), + VMSTATE_END_OF_LIST() + }, +}; + +static const VMStateDescription vmstate_mips_cpc =3D { + .name =3D "mips-cpc", + .version_id =3D 1, + .minimum_version_id =3D 1, + .fields =3D (const VMStateField[]) { + VMSTATE_STRUCT_VARRAY_ALLOC(pcs, MIPSCPCState, num_pcores, 0, + vmstate_mips_cpc_pcs, MIPSCPCPCoreStat= e), VMSTATE_END_OF_LIST() }, }; =20 static Property mips_cpc_properties[] =3D { - DEFINE_PROP_UINT32("num-vp", MIPSCPCState, num_vp, 0x1), + DEFINE_PROP_INT32("num-vp", MIPSCPCState, num_vp, 0x1), + DEFINE_PROP_INT32("num-pcore", MIPSCPCState, num_pcores, 0x1), DEFINE_PROP_UINT64("vp-start-running", MIPSCPCState, vp_start_running,= 0x1), + DEFINE_PROP_LINK("gcr", MIPSCPCState, gcr, TYPE_MIPS_GCR, MIPSGCRState= *), DEFINE_PROP_END_OF_LIST(), }; =20 diff --git a/include/hw/misc/mips_cpc.h b/include/hw/misc/mips_cpc.h index fcafbd5e00..e88acf4681 100644 --- a/include/hw/misc/mips_cpc.h +++ b/include/hw/misc/mips_cpc.h @@ -30,6 +30,10 @@ #define CPC_CO_BASE_OFS 0x4000 =20 /* CPC register offsets relative to block offsets */ +#define CPC_CL_CMD_OFS 0x00 +#define CPC_CL_STAT_CONF_OFS 0x08 +#define CPC_CL_STAT_CONF_SEQ_STATE_SHF 19 +#define CPC_CL_STAT_CONF_SEQ_STATE_U6 7 #define CPC_VP_STOP_OFS 0x20 #define CPC_VP_RUN_OFS 0x28 #define CPC_VP_RUNNING_OFS 0x30 @@ -37,14 +41,21 @@ #define TYPE_MIPS_CPC "mips-cpc" OBJECT_DECLARE_SIMPLE_TYPE(MIPSCPCState, MIPS_CPC) =20 +typedef struct MIPSCPCPCoreState MIPSCPCPCoreState; +struct MIPSCPCPCoreState { + uint64_t vp_running; +}; + struct MIPSCPCState { SysBusDevice parent_obj; =20 - uint32_t num_vp; + int32_t num_pcores; + int32_t num_vp; uint64_t vp_start_running; /* VPs running from restart */ + MIPSGCRState *gcr; =20 MemoryRegion mr; - uint64_t vp_running; /* Indicates which VPs are in the run state */ + MIPSCPCPCoreState *pcs; }; =20 #endif /* MIPS_CPC_H */ --=20 2.34.1 From nobody Mon Nov 25 12:50:05 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=1715009611; cv=none; d=zohomail.com; s=zohoarc; b=j3RwQRRmM8TwBpvu6IglHSufZu5GgG8N6PrVyLS17zS92ICWk36xkpgPZ7T6ExF3GbV1Trg/5IawB3pRFiixYkNMHxET6dKk3yyfWROLhYvsY3a424wjO3U+nBXO8fXRodC7xs4G639ui+szjevN6TgPd30MDKr6TIW3W819FAY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715009611; 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=nPIbGPamlN+9KKqIN+ZYNQjFTgy446GDwC+t8kWt5Mo=; b=LNI0s+PmYXxcdaLukPqlBXd9y4N1uItvjxk1hEZuqxYAXzPIafwv5dG4M2xbDQYfZJcCpRmqy03TzmDJvAvo/lUoP8qsFumZbS0qXNVp6FtzHC1kTW1dYZ3wF83jiXyIqbO23w3B3PHafLjFlHd1TQ6LEXx+fbsIh1URBP1/W1E= 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 1715009611042275.465105210816; Mon, 6 May 2024 08:33:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s40Ju-0007kD-O3; Mon, 06 May 2024 11:32:02 -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 1s40Jr-0007hw-DE for qemu-devel@nongnu.org; Mon, 06 May 2024 11:31:59 -0400 Received: from wfhigh1-smtp.messagingengine.com ([64.147.123.152]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s40Jo-0003RL-OQ for qemu-devel@nongnu.org; Mon, 06 May 2024 11:31:59 -0400 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailfhigh.west.internal (Postfix) with ESMTP id 30A421800153; Mon, 6 May 2024 11:31:55 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 06 May 2024 11:31:55 -0400 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 6 May 2024 11:31:53 -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=1715009514; x=1715095914; bh=nPIbGPamlN+9KKqIN+ZYNQjFTgy446GDwC+t8kWt5Mo=; b= SU1pVRz5c/o04E/X/JByliBslJhzlKM+tTD3yrwnGCp49ncYw7tfR1Q0peVVBHkI y9YuEHh3L2jES6Wd+qxLoDOa0g5xQcChKlVCWzCS9qYQ7is3V74qWY8QCaATTYot XXLEyKqcqcFpfO2dKCy4RWNMRdxVLORqgKDX5K1v5y1ElMOGFZD14bDcOhrAcUt6 i4Hos4ZyUGJPvzWc4Gz6S+DDzUZefxQQg1V+s7PJSQIBOw83X3tPGnbYeE/zG/B4 /FwiivgakzSCQVdF3KHb3+gH8vPqEkTxiGxNgRcoSoHCA8HUl/qlgJ6vLGn5IgwC RtRsjrrEObihHdStNWwn2A== 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=1715009514; x= 1715095914; bh=nPIbGPamlN+9KKqIN+ZYNQjFTgy446GDwC+t8kWt5Mo=; b=N AKwTAZEBRSGe6n4t7CHZvE0q+VnsqImdiVgdUGw8VFhuuE0ARt3QAJb7Taq5Kppv mjGmpRvGHh2/oLjJr/M12X4MrLOpqc5qyJtYV4Ko88R8Vq1Swji7GLW/yk8ayBxl yjcKo0llzQRaCSfK7yacUHY6lK7+IKDfFnX84lA7envgGIs7ryczTCBdf2+Aeyro 0ggHfWq7gg6ZJ7jXJn6vOteku55ImzWXNBkIjZ0Nt0jjn8bOSANQjZ0a7yeN74zL In5B6zo2QRB+EwNVV6XbWg8xvWwRcDO3QfgdBGCmGg90NOQaUkswTFITMv0iRSSy 0qgRgy8vsLbMFOWHK0RcQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvddviedgledtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephfffufggtgfgkfhfjgfvvefosehtjeertdertdejnecuhfhrohhmpeflihgr gihunhcujggrnhhguceojhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomheqne cuggftrfgrthhtvghrnhepvdekiefhfeevkeeuveetfeelffekgedugefhtdduudeghfeu veegffegudekjeelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepjhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail From: Jiaxun Yang Date: Mon, 06 May 2024 16:31:38 +0100 Subject: [PATCH 4/5] hw/mips/cps: 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-4-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=6178; i=jiaxun.yang@flygoat.com; h=from:subject:message-id; bh=/FjpNTd8i6ZiVBgPVy4jFS2xatx8RS7XQ1Hw3unLW38=; b=owGbwMvMwCHmXMhTe71c8zDjabUkhjSL748PM0v6eK1lFHq3YKrZUlXOrc9mlD511q9NrOae6 nL7cjJTRykLgxgHg6yYIkuIgFLfhsaLC64/yPoDM4eVCWQIAxenAExkFR/DHx7LnpULs/+HzLp2 /tflc1Y3ziSfdd9qGBgpE2SlzZa8tpGR4RbfoktF179eVZmbNEt6UoTIywOfVpaWemaefLxLwqn flRkA 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.152; envelope-from=jiaxun.yang@flygoat.com; helo=wfhigh1-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: 1715009612490100001 Implement multiple physical core support by creating CPU devices accorading to the new topology and passing pcore/vp information to CPC and CMGCR sub-devices. Signed-off-by: Jiaxun Yang --- hw/mips/cps.c | 66 +++++++++++++++++++++++++++++++----------------= ---- include/hw/mips/cps.h | 1 + 2 files changed, 41 insertions(+), 26 deletions(-) diff --git a/hw/mips/cps.c b/hw/mips/cps.c index 07b73b0a1f..6cf02379a9 100644 --- a/hw/mips/cps.c +++ b/hw/mips/cps.c @@ -73,31 +73,43 @@ static void mips_cps_realize(DeviceState *dev, Error **= errp) return; } =20 - for (int i =3D 0; i < s->num_vp; i++) { - MIPSCPU *cpu =3D MIPS_CPU(object_new(s->cpu_type)); - CPUMIPSState *env =3D &cpu->env; + object_initialize_child(OBJECT(dev), "gcr", &s->gcr, TYPE_MIPS_GCR); =20 - /* All VPs are halted on reset. Leave powering up to CPC. */ - object_property_set_bool(OBJECT(cpu), "start-powered-off", true, - &error_abort); + for (int corenum =3D 0; corenum < s->num_pcore; corenum++) { + for (int vpid =3D 0; vpid < s->num_vp; vpid++) { + int vpnum =3D corenum * s->num_vp + vpid; + int32_t globalnumber =3D (corenum << CP0GN_CoreNum) | vpid; =20 - /* All cores use the same clock tree */ - qdev_connect_clock_in(DEVICE(cpu), "clk-in", s->clock); + MIPSCPU *cpu =3D MIPS_CPU(object_new(s->cpu_type)); + CPUMIPSState *env =3D &cpu->env; =20 - if (!qdev_realize_and_unref(DEVICE(cpu), NULL, errp)) { - return; - } + /* All VPs are halted on reset. Leave powering up to CPC. */ + object_property_set_bool(OBJECT(cpu), "start-powered-off", tru= e, + &error_abort); + + object_property_set_int(OBJECT(cpu), "globalnumber", globalnum= ber, + &error_abort); + + /* All cores use the same clock tree */ + qdev_connect_clock_in(DEVICE(cpu), "clk-in", s->clock); + + if (!qdev_realize_and_unref(DEVICE(cpu), NULL, errp)) { + return; + } + + g_assert(vpnum =3D=3D CPU(cpu)->cpu_index); =20 - /* Init internal devices */ - cpu_mips_irq_init_cpu(cpu); - cpu_mips_clock_init(cpu); + /* Init internal devices */ + cpu_mips_irq_init_cpu(cpu); + cpu_mips_clock_init(cpu); =20 - if (cpu_mips_itu_supported(env)) { - itu_present =3D true; - /* Attach ITC Tag to the VP */ - env->itc_tag =3D mips_itu_get_tag_region(&s->itu); + if (cpu_mips_itu_supported(env)) { + itu_present =3D true; + /* Attach ITC Tag to the VP */ + env->itc_tag =3D mips_itu_get_tag_region(&s->itu); + } + qemu_register_reset(main_cpu_reset, cpu); } - qemu_register_reset(main_cpu_reset, cpu); } =20 /* Inter-Thread Communication Unit */ @@ -119,8 +131,12 @@ static void mips_cps_realize(DeviceState *dev, Error *= *errp) object_initialize_child(OBJECT(dev), "cpc", &s->cpc, TYPE_MIPS_CPC); object_property_set_uint(OBJECT(&s->cpc), "num-vp", s->num_vp, &error_abort); + object_property_set_uint(OBJECT(&s->cpc), "num-pcore", s->num_pcore, + &error_abort); object_property_set_int(OBJECT(&s->cpc), "vp-start-running", 1, &error_abort); + object_property_set_link(OBJECT(&s->cpc), "gcr", OBJECT(&s->gcr), + &error_abort); if (!sysbus_realize(SYS_BUS_DEVICE(&s->cpc), errp)) { return; } @@ -130,7 +146,7 @@ static void mips_cps_realize(DeviceState *dev, Error **= errp) =20 /* Global Interrupt Controller */ object_initialize_child(OBJECT(dev), "gic", &s->gic, TYPE_MIPS_GIC); - object_property_set_uint(OBJECT(&s->gic), "num-vp", s->num_vp, + object_property_set_uint(OBJECT(&s->gic), "num-vp", s->num_vp * s->num= _pcore, &error_abort); object_property_set_uint(OBJECT(&s->gic), "num-irq", 128, &error_abort); @@ -141,16 +157,13 @@ static void mips_cps_realize(DeviceState *dev, Error = **errp) memory_region_add_subregion(&s->container, 0, sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->gic)= , 0)); =20 - /* Global Configuration Registers */ - gcr_base =3D MIPS_CPU(first_cpu)->env.CP0_CMGCRBase << 4; - - object_initialize_child(OBJECT(dev), "gcr", &s->gcr, TYPE_MIPS_GCR); + gcr_base =3D GCR_BASE_ADDR; + object_property_set_uint(OBJECT(&s->gcr), "num-pcores", s->num_pcore, + &error_abort); object_property_set_uint(OBJECT(&s->gcr), "num-vp", s->num_vp, &error_abort); object_property_set_int(OBJECT(&s->gcr), "gcr-rev", 0x800, &error_abort); - object_property_set_int(OBJECT(&s->gcr), "gcr-base", gcr_base, - &error_abort); object_property_set_link(OBJECT(&s->gcr), "gic", OBJECT(&s->gic.mr), &error_abort); object_property_set_link(OBJECT(&s->gcr), "cpc", OBJECT(&s->cpc.mr), @@ -164,6 +177,7 @@ static void mips_cps_realize(DeviceState *dev, Error **= errp) } =20 static Property mips_cps_properties[] =3D { + DEFINE_PROP_UINT32("num-pcore", MIPSCPSState, num_pcore, 1), DEFINE_PROP_UINT32("num-vp", MIPSCPSState, num_vp, 1), DEFINE_PROP_UINT32("num-irq", MIPSCPSState, num_irq, 256), DEFINE_PROP_STRING("cpu-type", MIPSCPSState, cpu_type), diff --git a/include/hw/mips/cps.h b/include/hw/mips/cps.h index 04d636246a..ea184b46a9 100644 --- a/include/hw/mips/cps.h +++ b/include/hw/mips/cps.h @@ -35,6 +35,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(MIPSCPSState, MIPS_CPS) struct MIPSCPSState { SysBusDevice parent_obj; =20 + uint32_t num_pcore; uint32_t num_vp; uint32_t num_irq; char *cpu_type; --=20 2.34.1 From nobody Mon Nov 25 12:50:05 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