From nobody Mon Nov 10 19:32:19 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linux.intel.com ARC-Seal: i=1; a=rsa-sha256; t=1558270747; cv=none; d=zoho.com; s=zohoarc; b=Y0HQvkdh1ceo71r1wXKEdbFJ5dBk+4CvmogbOx6euXPe3VfuqYr5CRlU93BEoI1wO1mo/9Cvcs5OHNq8Yvmv0MOWZ5YAGh2OWrgiIYjMEFm6QEBB3ofJp6fBGHybJIzVZn8EXqe9/YZRl4HLIXtdiQd3VRyO3ArCRAFmfzzBa1I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558270747; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=SQbQuCjlIxAJTmltplWntEz9Ikwt5Tc5A/zyL3fjOVg=; b=EA8gRPMkmNknJhxfaAb04o+kUPbrRzn3oPLkplSdfLhM7OL99HVQfDTwjvIXbWq1jSBwi6xoBgwOo58+PXd/e1TYcJim+QG0u/2Nmq/DpQHkcu6ZDsSPBlH0fIrE02Nzf4X+d63sw/hj9iYEkuyCpe5UGeqfJh6Oc1D+SRYN0Io= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1558270747575286.47202766025464; Sun, 19 May 2019 05:59:07 -0700 (PDT) Received: from localhost ([127.0.0.1]:48413 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSLOb-0000wF-Ge for importer@patchew.org; Sun, 19 May 2019 08:58:33 -0400 Received: from eggs.gnu.org ([209.51.188.92]:44483) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSLMc-0007ql-LM for qemu-devel@nongnu.org; Sun, 19 May 2019 08:56:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hSLMb-0002HF-GX for qemu-devel@nongnu.org; Sun, 19 May 2019 08:56:30 -0400 Received: from mga14.intel.com ([192.55.52.115]:2556) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hSLMY-0002DS-Ak; Sun, 19 May 2019 08:56:26 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 May 2019 05:56:18 -0700 Received: from clx-ap-likexu.sh.intel.com ([10.239.48.98]) by fmsmga001.fm.intel.com with ESMTP; 19 May 2019 05:56:17 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 From: Like Xu To: qemu-trivial@nongnu.org Date: Sun, 19 May 2019 04:54:19 +0800 Message-Id: <20190518205428.90532-2-like.xu@linux.intel.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190518205428.90532-1-like.xu@linux.intel.com> References: <20190518205428.90532-1-like.xu@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 192.55.52.115 Subject: [Qemu-devel] [PATCH v3 01/10] hw/boards: Add struct CpuTopology to MachineState X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Eduardo Habkost , qemu-devel@nongnu.org, "Dr . David Alan Gilbert" , Alistair Francis , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" The cpu topology property CpuTopology is added to the MachineState and its members are initialized with the leagcy global smp variables. From this commit, the code in the system emulation mode is supposed to use cpu topology variables from MachineState instead of the global ones defined in vl.c and there is no semantic change. Suggested-by: Igor Mammedov Suggested-by: Eduardo Habkost Signed-off-by: Like Xu Reviewed-by: Alistair Francis --- include/hw/boards.h | 15 +++++++++++++++ vl.c | 5 +++++ 2 files changed, 20 insertions(+) diff --git a/include/hw/boards.h b/include/hw/boards.h index 6f7916f88f..bc23b5db1d 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -230,6 +230,20 @@ typedef struct DeviceMemoryState { MemoryRegion mr; } DeviceMemoryState; =20 +/** + * CpuTopology: + * @cpus: the number of present logical processors on the machine + * @cores: the number of cores in one package + * @threads: the number of threads in one core + * @max_cpus: the maximum number of logical processors on the machine + */ +typedef struct CpuTopology { + unsigned int cpus; + unsigned int cores; + unsigned int threads; + unsigned int max_cpus; +} CpuTopology; + /** * MachineState: */ @@ -272,6 +286,7 @@ struct MachineState { const char *cpu_type; AccelState *accelerator; CPUArchIdList *possible_cpus; + CpuTopology smp; struct NVDIMMState *nvdimms_state; }; =20 diff --git a/vl.c b/vl.c index c8ca9ff6ff..40b006577b 100644 --- a/vl.c +++ b/vl.c @@ -4133,6 +4133,11 @@ int main(int argc, char **argv, char **envp) =20 smp_parse(qemu_opts_find(qemu_find_opts("smp-opts"), NULL)); =20 + current_machine->smp.cpus =3D smp_cpus; + current_machine->smp.max_cpus =3D max_cpus; + current_machine->smp.cores =3D smp_cores; + current_machine->smp.threads =3D smp_threads; + /* sanity-check smp_cpus and max_cpus against machine_class */ if (smp_cpus < machine_class->min_cpus) { error_report("Invalid SMP CPUs %d. The min CPUs " --=20 2.21.0