From patchwork Fri Sep 6 19:12:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Babu Moger X-Patchwork-Id: 11135867 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 291971398 for ; Fri, 6 Sep 2019 19:19:58 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E465A206BB for ; Fri, 6 Sep 2019 19:19:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=amdcloud.onmicrosoft.com header.i=@amdcloud.onmicrosoft.com header.b="YyIRp3cH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E465A206BB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:59592 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i6Jm0-00023c-Bk for patchwork-qemu-devel@patchwork.kernel.org; Fri, 06 Sep 2019 15:19:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42318) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i6Jei-0002V5-G1 for qemu-devel@nongnu.org; Fri, 06 Sep 2019 15:12:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i6Jeg-0004Bo-Vr for qemu-devel@nongnu.org; Fri, 06 Sep 2019 15:12:24 -0400 Received: from mail-co1nam04on0610.outbound.protection.outlook.com ([2a01:111:f400:fe4d::610]:48565 helo=NAM04-CO1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i6Jeg-0004BG-Ir for qemu-devel@nongnu.org; Fri, 06 Sep 2019 15:12:22 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LNqgs0b/cZ7Oz57hLZbCcrhapQ1ergF7GUZT5ygO9npzGyIjE6YFKz//ZNvRsXz8GD5h8NlI2oPecGj74W28L0yGumR8MLRYhoZn3MNvwVJr2mTEfHJ0LsbCUfFlYPHoP30pgRlRV16lhviKt18BqyvqA/IMFJyRhEhmCr/Nbbqh6WCjNFZ/rfbpHcCBS8jEk5Db2igLVFXGPD3yqDlOxr8C3QQc25HZmGTrlZ88gdXmz+dY6fBd0lGAYCu8lRZnP2SFZHXaHXUtnfnlYD02VLki98XyOZByQ4TPuOdDEw0SzXnqmG4El6DkS8sEeQc6mc2ZoacOt91K1jent/D8Qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aSYSzV68VT/JKcPdzCP+s2mgj9ovKqzmkED9ddim1/8=; b=h02/l075vgmH3uEcl7PNUfoFP6lMH3owwlQIfcQIhadDJ7nYU7NKXO/SpVRUDAhUeKeNUnIfGX7YPxappLQ6Q0EQY7jsyXmJ/EqaxWiaSTX/1lT5OAawtosV5ZyzCWvgO6nvYxVqMdHlxVJTrnIdy6qYY7/Epx3kE6P4q8FFSbwW0BpyLlvOMTaTWvAmgaCYY2OyZH5U6cpC5bFEsFwK8/RQqKa5+Kd++3GLrvaeVmg+l0KXAW83C9WbCFMxb/dgofJKNDgDf/3QF4MOKN+TUxVZmeClpxJN4NIsf/rh5wFR35dvGu18tvrwttdQi/SfB84bpKWfLwm0bMU3UQMnSQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aSYSzV68VT/JKcPdzCP+s2mgj9ovKqzmkED9ddim1/8=; b=YyIRp3cHYvY0r6sruHi5j4fc8CtTCgPyyUdl/uZWqbRupB9s9Ki8vW2qRXT0tY4A9o6Ci/M0SlpEmD2r+UWFvwrqTURKFaYdLtpQpNHUFXuca87Xy990kXXGrqYCDsisuyx4z2qsE2hY4BbS80BwvWgQ49QsMyUmtqZWoQcu/cE= Received: from DM5PR12MB2471.namprd12.prod.outlook.com (52.132.141.138) by DM5PR12MB1145.namprd12.prod.outlook.com (10.168.238.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2241.14; Fri, 6 Sep 2019 19:12:18 +0000 Received: from DM5PR12MB2471.namprd12.prod.outlook.com ([fe80::6c7c:4b6d:f136:1bf8]) by DM5PR12MB2471.namprd12.prod.outlook.com ([fe80::6c7c:4b6d:f136:1bf8%3]) with mapi id 15.20.2220.022; Fri, 6 Sep 2019 19:12:18 +0000 From: "Moger, Babu" To: ssg.sos.staff , "ehabkost@redhat.com" , "marcel.apfelbaum@gmail.com" , "mst@redhat.com" , "pbonzini@redhat.com" , "rth@twiddle.net" , "eblake@redhat.com" , "armbru@redhat.com" , "imammedo@redhat.com" Thread-Topic: [RFC 2 PATCH 06/16] hw/core: Add core complex id in X86CPU topology Thread-Index: AQHVZOcAvXBgYAx8v0mIeU+F8XEfTA== Date: Fri, 6 Sep 2019 19:12:18 +0000 Message-ID: <156779713686.21957.6192568272184346850.stgit@localhost.localdomain> References: <156779689013.21957.1631551572950676212.stgit@localhost.localdomain> In-Reply-To: <156779689013.21957.1631551572950676212.stgit@localhost.localdomain> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: SN6PR06CA0002.namprd06.prod.outlook.com (2603:10b6:805:8e::15) To DM5PR12MB2471.namprd12.prod.outlook.com (2603:10b6:4:b5::10) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Babu.Moger@amd.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [165.204.78.1] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 3b0ad94e-efe7-46c0-b1cc-08d732fe22cb x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600166)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020); SRVR:DM5PR12MB1145; x-ms-traffictypediagnostic: DM5PR12MB1145: x-ld-processed: 3dd8961f-e488-4e60-8e11-a82d994e183d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1360; x-forefront-prvs: 0152EBA40F x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(376002)(396003)(366004)(39860400002)(136003)(346002)(199004)(189003)(2201001)(71190400001)(305945005)(7736002)(9686003)(52116002)(86362001)(71200400001)(6116002)(8936002)(6512007)(3846002)(6436002)(11346002)(103116003)(99286004)(6506007)(6486002)(26005)(4326008)(14454004)(5660300002)(386003)(476003)(102836004)(2906002)(25786009)(76176011)(2501003)(53936002)(8676002)(66446008)(446003)(186003)(66556008)(486006)(66946007)(66476007)(64756008)(110136005)(81166006)(81156014)(478600001)(14444005)(66066001)(256004)(316002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR12MB1145; H:DM5PR12MB2471.namprd12.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: amd.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: m2tiSjboBFbv3l0lFPUCa/vb4cUjZpuoaPFUwMPciTyb79LhXzDrYHfDTLCK/WIyEgyk8r3c78XzNGPr4jvdRy8OKCtKkGExVruvh7M1//4Xzvyj27zbgu+CA+fAhm0YsMVfdzQ/+ZxoEVAFQuJDxZLOPqUsHgD5fsymfJWShiXmMWQ7Uz40xxOQVvTHqw2CL8tN3Gl52DRelDeJ8B8ZPaOxLMzolN+YPrD2zxqWzd3OLRRMkf8fW+UzL6LrDKEWKbDESne7DKb5nQolX/4tzqJGdj5ImMcPGRuh5PQFXeg/zTVhBoPSvHeu7DrECTgGbk0QWiqlv2mbQahO/tTfByuChICN6GBNsptXsrki18Ynn1MGI51ZmG8N+ykTUIPQElrzu3y6xt/w7QpSg2WCOd2nOqGkrzhxcwRW946hDUk= Content-ID: MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3b0ad94e-efe7-46c0-b1cc-08d732fe22cb X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Sep 2019 19:12:18.4350 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: WsiGtlpk94F3QX445J1WKikjCVLFB1FVDZV0fY+0Q0Yi/tHto8cIM0K5kuqrwqwH X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1145 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe4d::610 Subject: [Qemu-devel] [RFC 2 PATCH 06/16] hw/core: Add core complex id in X86CPU topology X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "qemu-devel@nongnu.org" Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Introduce cpu core complex id(ccx_id) in x86CPU topology. Each CCX can have upto 4 cores and share same L3 cache. This information is required to build the topology in new apyc mode. Signed-off-by: Babu Moger --- hw/core/machine-hmp-cmds.c | 3 +++ hw/core/machine.c | 13 +++++++++++++ hw/i386/pc.c | 10 ++++++++++ include/hw/i386/topology.h | 1 + qapi/machine.json | 4 +++- target/i386/cpu.c | 2 ++ target/i386/cpu.h | 1 + 7 files changed, 33 insertions(+), 1 deletion(-) diff --git a/hw/core/machine-hmp-cmds.c b/hw/core/machine-hmp-cmds.c index 1f66bda346..6c534779af 100644 --- a/hw/core/machine-hmp-cmds.c +++ b/hw/core/machine-hmp-cmds.c @@ -89,6 +89,9 @@ void hmp_hotpluggable_cpus(Monitor *mon, const QDict *qdict) if (c->has_die_id) { monitor_printf(mon, " die-id: \"%" PRIu64 "\"\n", c->die_id); } + if (c->has_ccx_id) { + monitor_printf(mon, " ccx-id: \"%" PRIu64 "\"\n", c->ccx_id); + } if (c->has_core_id) { monitor_printf(mon, " core-id: \"%" PRIu64 "\"\n", c->core_id); } diff --git a/hw/core/machine.c b/hw/core/machine.c index 4034b7e903..9a8586cf30 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -694,6 +694,11 @@ void machine_set_cpu_numa_node(MachineState *machine, return; } + if (props->has_ccx_id && !slot->props.has_ccx_id) { + error_setg(errp, "ccx-id is not supported"); + return; + } + /* skip slots with explicit mismatch */ if (props->has_thread_id && props->thread_id != slot->props.thread_id) { continue; @@ -707,6 +712,10 @@ void machine_set_cpu_numa_node(MachineState *machine, continue; } + if (props->has_ccx_id && props->ccx_id != slot->props.ccx_id) { + continue; + } + if (props->has_socket_id && props->socket_id != slot->props.socket_id) { continue; } @@ -1041,6 +1050,10 @@ static char *cpu_slot_to_string(const CPUArchId *cpu) if (cpu->props.has_die_id) { g_string_append_printf(s, "die-id: %"PRId64, cpu->props.die_id); } + + if (cpu->props.has_ccx_id) { + g_string_append_printf(s, "ccx-id: %"PRId64, cpu->props.ccx_id); + } if (cpu->props.has_core_id) { if (s->len) { g_string_append_printf(s, ", "); diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 9e1c3f9f57..f71389ad9f 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -2444,6 +2444,7 @@ static void pc_cpu_pre_plug(HotplugHandler *hotplug_dev, topo_ids.pkg_id = cpu->socket_id; topo_ids.die_id = cpu->die_id; + topo_ids.ccx_id = cpu->ccx_id; topo_ids.core_id = cpu->core_id; topo_ids.smt_id = cpu->thread_id; cpu->apic_id = apicid_from_topo_ids(&topo_info, &topo_ids); @@ -2489,6 +2490,13 @@ static void pc_cpu_pre_plug(HotplugHandler *hotplug_dev, } cpu->die_id = topo_ids.die_id; + if (cpu->ccx_id != -1 && cpu->ccx_id != topo_ids.ccx_id) { + error_setg(errp, "property ccx-id: %u doesn't match set apic-id:" + " 0x%x (ccx-id: %u)", cpu->ccx_id, cpu->apic_id, topo_ids.ccx_id); + return; + } + cpu->ccx_id = topo_ids.ccx_id; + if (cpu->core_id != -1 && cpu->core_id != topo_ids.core_id) { error_setg(errp, "property core-id: %u doesn't match set apic-id:" " 0x%x (core-id: %u)", cpu->core_id, cpu->apic_id, topo_ids.core_id); @@ -2896,6 +2904,8 @@ static const CPUArchIdList *pc_possible_cpu_arch_ids(MachineState *ms) ms->possible_cpus->cpus[i].props.socket_id = topo_ids.pkg_id; ms->possible_cpus->cpus[i].props.has_die_id = true; ms->possible_cpus->cpus[i].props.die_id = topo_ids.die_id; + ms->possible_cpus->cpus[i].props.has_ccx_id = true; + ms->possible_cpus->cpus[i].props.ccx_id = topo_ids.ccx_id; ms->possible_cpus->cpus[i].props.has_core_id = true; ms->possible_cpus->cpus[i].props.core_id = topo_ids.core_id; ms->possible_cpus->cpus[i].props.has_thread_id = true; diff --git a/include/hw/i386/topology.h b/include/hw/i386/topology.h index fb10863a66..5a61d53f05 100644 --- a/include/hw/i386/topology.h +++ b/include/hw/i386/topology.h @@ -170,6 +170,7 @@ static inline void x86_topo_ids_from_apicid(apic_id_t apicid, (apicid >> apicid_die_offset(nr_cores, nr_threads)) & ~(0xFFFFFFFFUL << apicid_die_width(nr_dies)); topo_ids->pkg_id = apicid >> apicid_pkg_offset(nr_dies, nr_cores, nr_threads); + topo_ids->ccx_id = 0; } /* Make APIC ID for the CPU 'cpu_index' diff --git a/qapi/machine.json b/qapi/machine.json index 6db8a7e2ec..bb7627e698 100644 --- a/qapi/machine.json +++ b/qapi/machine.json @@ -597,9 +597,10 @@ # @node-id: NUMA node ID the CPU belongs to # @socket-id: socket number within node/board the CPU belongs to # @die-id: die number within node/board the CPU belongs to (Since 4.1) +# @ccx-id: core complex number within node/board the CPU belongs to (Since 4.1) # @core-id: core number within die the CPU belongs to# @thread-id: thread number within core the CPU belongs to # -# Note: currently there are 5 properties that could be present +# Note: currently there are 6 properties that could be present # but management should be prepared to pass through other # properties with device_add command to allow for future # interface extension. This also requires the filed names to be kept in @@ -611,6 +612,7 @@ 'data': { '*node-id': 'int', '*socket-id': 'int', '*die-id': 'int', + '*ccx-id': 'int', '*core-id': 'int', '*thread-id': 'int' } diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 6d7f9b6b8b..ca02bc21ec 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -5811,12 +5811,14 @@ static Property x86_cpu_properties[] = { DEFINE_PROP_INT32("thread-id", X86CPU, thread_id, 0), DEFINE_PROP_INT32("core-id", X86CPU, core_id, 0), DEFINE_PROP_INT32("die-id", X86CPU, die_id, 0), + DEFINE_PROP_INT32("ccx-id", X86CPU, ccx_id, 0), DEFINE_PROP_INT32("socket-id", X86CPU, socket_id, 0), #else DEFINE_PROP_UINT32("apic-id", X86CPU, apic_id, UNASSIGNED_APIC_ID), DEFINE_PROP_INT32("thread-id", X86CPU, thread_id, -1), DEFINE_PROP_INT32("core-id", X86CPU, core_id, -1), DEFINE_PROP_INT32("die-id", X86CPU, die_id, -1), + DEFINE_PROP_INT32("ccx-id", X86CPU, ccx_id, -1), DEFINE_PROP_INT32("socket-id", X86CPU, socket_id, -1), #endif DEFINE_PROP_INT32("node-id", X86CPU, node_id, CPU_UNSET_NUMA_NODE_ID), diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 8b3dc5533e..db940cdb2a 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -1508,6 +1508,7 @@ struct X86CPU { int32_t node_id; /* NUMA node this CPU belongs to */ int32_t socket_id; int32_t die_id; + int32_t ccx_id; int32_t core_id; int32_t thread_id;