From patchwork Wed Jan 31 10:13:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Liu X-Patchwork-Id: 13539031 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C6C4169946 for ; Wed, 31 Jan 2024 10:00:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706695249; cv=none; b=Js1drHi9o0WokL7qN3aWZNFbM5rdBsYDCfViwvlJupTHIJ/lLPFPQ+wxUkXLnLRCxAPn+s9x+uBrHTwvtxIGluAo2jWWi9LgRVTtHBeD6BDerIAkvM4qmOSOLpSdU2yeuWE5xXyEy9/qjigORYZEag5vCvHKxee/lH5FBVxCrjg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706695249; c=relaxed/simple; bh=g7kZcy8qMzcnRiMnRXVem45+V8mcU65tYpnu/7h40Zc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=JMUvAto6nogq7YYYcO7+pvtwIQgJFyz9/EfwvjN8cjM0ZjWdhKLmlGA/hL/lzGr0o6vxSaVlGehnBXy0HZyNQvmw5D20bZHUUYyPfniJ98jr/3VG8CLFUCwG8nAtekkpOPsXggGD8AC92ozllngwj7Er/SYbZGrHJTXeN9huy18= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=ZydtO2cf; arc=none smtp.client-ip=192.198.163.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ZydtO2cf" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706695247; x=1738231247; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=g7kZcy8qMzcnRiMnRXVem45+V8mcU65tYpnu/7h40Zc=; b=ZydtO2cfx969QPQOa2llHZy7kNltKhC+3eFBzSzmGx68cToEkjw3THbv ntAXPjeApxXGZ0FKhpVEpnwH7in6fzwYH0uZMgHXZBHjmXofxSbJptvXW XfA2cjgzbMhlZWOJaDAxixKnFU82QMD2Ey5Afv9TLutJ/NCJLiI6tqwAX rZKnP/oO2986DMHQggGTwlTWUWkUxZYDTit1e+iCHsRvTbntvqlCMuO6m nsPmosBnaK+tOoacEEJgjbocWSBBK++T9xftnkQkijhgsXaZMq/hXDwPE FRPE51CNmDZhSSgOEPz+H3PIX0r8WEfuUr7WuXEtSBbsa3Oo5jx4Bm7ru w==; X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="25032492" X-IronPort-AV: E=Sophos;i="6.05,231,1701158400"; d="scan'208";a="25032492" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2024 02:00:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,231,1701158400"; d="scan'208";a="4035929" Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by fmviesa003.fm.intel.com with ESMTP; 31 Jan 2024 02:00:42 -0800 From: Zhao Liu To: Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?q?aud=C3=A9?= , Yanan Wang , "Michael S . Tsirkin" , Paolo Bonzini , Richard Henderson , Eric Blake , Markus Armbruster , Marcelo Tosatti Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, Babu Moger , Xiaoyao Li , Zhenyu Wang , Zhuocheng Ding , Yongwei Ma , Zhao Liu Subject: [PATCH v8 01/21] hw/core/machine: Introduce the module as a CPU topology level Date: Wed, 31 Jan 2024 18:13:30 +0800 Message-Id: <20240131101350.109512-2-zhao1.liu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240131101350.109512-1-zhao1.liu@linux.intel.com> References: <20240131101350.109512-1-zhao1.liu@linux.intel.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Zhao Liu In x86, module is the topology level above core, which contains a set of cores that share certain resources (in current products, the resource usually includes L2 cache, as well as module scoped features and MSRs). To build the module level topology for x86 CPUs, introduce module level support in MachineState and MachineClass. Suggested-by: Xiaoyao Li Tested-by: Yongwei Ma Signed-off-by: Zhao Liu --- Changes since v7: * New commit to introduce module level in -smp. --- hw/core/machine-smp.c | 2 +- hw/core/machine.c | 1 + include/hw/boards.h | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/hw/core/machine-smp.c b/hw/core/machine-smp.c index 25019c91ee36..a0a30da59aa4 100644 --- a/hw/core/machine-smp.c +++ b/hw/core/machine-smp.c @@ -234,7 +234,7 @@ void machine_parse_smp_config(MachineState *ms, unsigned int machine_topo_get_cores_per_socket(const MachineState *ms) { - return ms->smp.cores * ms->smp.clusters * ms->smp.dies; + return ms->smp.cores * ms->smp.modules * ms->smp.clusters * ms->smp.dies; } unsigned int machine_topo_get_threads_per_socket(const MachineState *ms) diff --git a/hw/core/machine.c b/hw/core/machine.c index fb5afdcae4cc..36fe3a4806f2 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -1148,6 +1148,7 @@ static void machine_initfn(Object *obj) ms->smp.sockets = 1; ms->smp.dies = 1; ms->smp.clusters = 1; + ms->smp.modules = 1; ms->smp.cores = 1; ms->smp.threads = 1; diff --git a/include/hw/boards.h b/include/hw/boards.h index bcfde8a84d10..78dea50054a1 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -143,6 +143,7 @@ typedef struct { * provided SMP configuration * @books_supported - whether books are supported by the machine * @drawers_supported - whether drawers are supported by the machine + * @modules_supported - whether modules are supported by the machine */ typedef struct { bool prefer_sockets; @@ -151,6 +152,7 @@ typedef struct { bool has_clusters; bool books_supported; bool drawers_supported; + bool modules_supported; } SMPCompatProps; /** @@ -338,6 +340,7 @@ typedef struct DeviceMemoryState { * @sockets: the number of sockets in one book * @dies: the number of dies in one socket * @clusters: the number of clusters in one die + * @modules: the number of modules in one cluster * @cores: the number of cores in one cluster * @threads: the number of threads in one core * @max_cpus: the maximum number of logical processors on the machine @@ -349,6 +352,7 @@ typedef struct CpuTopology { unsigned int sockets; unsigned int dies; unsigned int clusters; + unsigned int modules; unsigned int cores; unsigned int threads; unsigned int max_cpus;