From nobody Mon Feb 9 04:14:50 2026 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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1667220781; cv=none; d=zohomail.com; s=zohoarc; b=By+s2v6zaEbOg/Ak3WzRdLCZumS/ueXzKPiay5hBXXndcxVO2H1syrd5Ux1Yezs7DiQoOt6IReAadPKdoLI4RvntWki/LTYdHbGkdVnBpxY254aaHeGF3tXXUWPu9JS4ZXbJWyzf8RGagmiTkWFsm560XOSXVOQmrFXSz0qgu90= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1667220781; h=Content-Type: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; bh=LO/qtuNrZ89fDPCMFSkl2M7QRcm1BKFrenr7dPdjQIM=; b=ioMng6APRhwYsuPvms8XjsLnsz5gBgaW3UtRzTmobMcrl10JmP5h9hYONew+HdlJAF3+FdJzGBvNxNZDyg3zZ1xYUv51X5t9P4n90aOcyFhRv5/PP09DR3i4pejSLqBXdYfBwsPJvvvGdhtg22rq38wZYKJNTTKcdXv3kCcT+vg= 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+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 166722078181780.26967553761438; Mon, 31 Oct 2022 05:53:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1opUHS-0004Vo-8U; Mon, 31 Oct 2022 08:52:42 -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 1opUGu-0002XO-NX for qemu-devel@nongnu.org; Mon, 31 Oct 2022 08:52:12 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1opUGf-0002V2-Ug for qemu-devel@nongnu.org; Mon, 31 Oct 2022 08:52:08 -0400 Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-76-ajyr5rTaODOR8EFW52IOOw-1; Mon, 31 Oct 2022 08:51:40 -0400 Received: by mail-wm1-f70.google.com with SMTP id d13-20020a05600c34cd00b003ce1f62ac5aso8307809wmq.4 for ; Mon, 31 Oct 2022 05:51:40 -0700 (PDT) Received: from redhat.com ([2.52.15.189]) by smtp.gmail.com with ESMTPSA id l13-20020a05600c2ccd00b003a2f2bb72d5sm8137327wmc.45.2022.10.31.05.51.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Oct 2022 05:51:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1667220709; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=LO/qtuNrZ89fDPCMFSkl2M7QRcm1BKFrenr7dPdjQIM=; b=RDVaa9hAX75sAxS2pusda8vdIy1RQma7PscVtxvisoJP6pj60kVTw1jGQj4TMX538XcSh7 dK4jQ/zIMaqwVp/8Omhq0z+uP8Jg24cYozDeeAY54cKU3OVn1o1lXRR/EiuXe13aZ411/G wqwqjHyVUQayXxL0vJkEiR06CDz27Bs= X-MC-Unique: ajyr5rTaODOR8EFW52IOOw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=LO/qtuNrZ89fDPCMFSkl2M7QRcm1BKFrenr7dPdjQIM=; b=3LasC47/V2+a+mWuPa2f0C7pEmOnQYm4nuqSYcupt9P1e900lGfuNeZapuEXhzwv2I TY0rmLn/EnITI/WlagPEboFpa2LgbyjYTHhJ/UMQ8UGU8XlwsOqLqCiipaFLshR7tPY4 5JtPHD+BSLEDRBTVGmrnkAUvqh9bU0jB1XZIv1+skGro0aK461ZTKlRCfj0fyg8SHGqp eSuwKx7nEE0Modv/qK9n1fWIO6fnPOhf5N34jc5ax15VWh1pyFQTzAKlXY/71zjpCdpP vV7LPW16DvsKWNrOjY476wxOeHEwD3MgBv9Uz0op8D8vdND5xIfBvNyZJXhI//XZuEOC 3xZg== X-Gm-Message-State: ACrzQf3zaRBS99BBmb3+kOzzSa2Z1//SlUqLKRG1uYu9bNzl2LWtIa3Z cPUjtbA3qsHI1CQb06M77w//PKoHkZuPvMnP+7QtE8RmeJhLWh/KJt7YNtEv0roBunbtlRtmDfc IduRBvgfhpqS7WZhxrRehc1QKh8NgBviW7RiVZqAJHT/O1VMN+vGEA7juVicO X-Received: by 2002:a05:600c:4f10:b0:3c6:dcc6:51d7 with SMTP id l16-20020a05600c4f1000b003c6dcc651d7mr7964050wmq.91.1667220699063; Mon, 31 Oct 2022 05:51:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5DmVXKiYbpvBP5dNZIRNZT7dTN+iB6PC3vli4+JiafoZz0F/2TBWaSORdodtlHSmqZrSpGOg== X-Received: by 2002:a05:600c:4f10:b0:3c6:dcc6:51d7 with SMTP id l16-20020a05600c4f1000b003c6dcc651d7mr7964032wmq.91.1667220698784; Mon, 31 Oct 2022 05:51:38 -0700 (PDT) Date: Mon, 31 Oct 2022 08:51:36 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Julia Suvorova , Igor Mammedov , Ani Sinha Subject: [PULL 18/86] hw/smbios: add core_count2 to smbios table type 4 Message-ID: <20221031124928.128475-19-mst@redhat.com> References: <20221031124928.128475-1-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20221031124928.128475-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent 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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.048, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=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: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1667220782539100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Julia Suvorova In order to use the increased number of cpus, we need to bring smbios tables in line with the SMBIOS 3.0 specification. This allows us to introduce core_count2 which acts as a duplicate of core_count if we have fewer cores than 256, and contains the actual core number per socket if we have more. core_enabled2 and thread_count2 fields work the same way. Signed-off-by: Julia Suvorova Reviewed-by: Igor Mammedov Message-Id: <20220731162141.178443-2-jusual@redhat.com> Message-Id: <20221011111731.101412-2-jusual@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/smbios/smbios_build.h | 9 +++++++-- include/hw/firmware/smbios.h | 12 ++++++++++++ hw/smbios/smbios.c | 19 ++++++++++++++++--- 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/hw/smbios/smbios_build.h b/hw/smbios/smbios_build.h index 56b5a1e3f3..351660024e 100644 --- a/hw/smbios/smbios_build.h +++ b/hw/smbios/smbios_build.h @@ -27,6 +27,11 @@ extern unsigned smbios_table_max; extern unsigned smbios_table_cnt; =20 #define SMBIOS_BUILD_TABLE_PRE(tbl_type, tbl_handle, tbl_required) \ + SMBIOS_BUILD_TABLE_PRE_SIZE(tbl_type, tbl_handle, tbl_required, \ + sizeof(struct smbios_type_##tbl_type))\ + +#define SMBIOS_BUILD_TABLE_PRE_SIZE(tbl_type, tbl_handle, \ + tbl_required, tbl_len) \ struct smbios_type_##tbl_type *t; \ size_t t_off; /* table offset into smbios_tables */ \ int str_index =3D 0; = \ @@ -39,12 +44,12 @@ extern unsigned smbios_table_cnt; /* use offset of table t within smbios_tables */ \ /* (pointer must be updated after each realloc) */ \ t_off =3D smbios_tables_len; = \ - smbios_tables_len +=3D sizeof(*t); = \ + smbios_tables_len +=3D tbl_len; = \ smbios_tables =3D g_realloc(smbios_tables, smbios_tables_len); = \ t =3D (struct smbios_type_##tbl_type *)(smbios_tables + t_off); = \ \ t->header.type =3D tbl_type; = \ - t->header.length =3D sizeof(*t); = \ + t->header.length =3D tbl_len; = \ t->header.handle =3D cpu_to_le16(tbl_handle); = \ } while (0) =20 diff --git a/include/hw/firmware/smbios.h b/include/hw/firmware/smbios.h index e7d386f7c8..7f3259a630 100644 --- a/include/hw/firmware/smbios.h +++ b/include/hw/firmware/smbios.h @@ -18,6 +18,8 @@ =20 =20 #define SMBIOS_MAX_TYPE 127 +#define offsetofend(TYPE, MEMBER) \ + (offsetof(TYPE, MEMBER) + sizeof_field(TYPE, MEMBER)) =20 /* memory area description, used by type 19 table */ struct smbios_phys_mem_area { @@ -187,8 +189,18 @@ struct smbios_type_4 { uint8_t thread_count; uint16_t processor_characteristics; uint16_t processor_family2; + /* SMBIOS spec 3.0.0, Table 21 */ + uint16_t core_count2; + uint16_t core_enabled2; + uint16_t thread_count2; } QEMU_PACKED; =20 +typedef enum smbios_type_4_len_ver { + SMBIOS_TYPE_4_LEN_V28 =3D offsetofend(struct smbios_type_4, + processor_family2), + SMBIOS_TYPE_4_LEN_V30 =3D offsetofend(struct smbios_type_4, thread_cou= nt2), +} smbios_type_4_len_ver; + /* SMBIOS type 8 - Port Connector Information */ struct smbios_type_8 { struct smbios_structure_header header; diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c index 51437ca09f..b4243de735 100644 --- a/hw/smbios/smbios.c +++ b/hw/smbios/smbios.c @@ -711,8 +711,14 @@ static void smbios_build_type_3_table(void) static void smbios_build_type_4_table(MachineState *ms, unsigned instance) { char sock_str[128]; + size_t tbl_len =3D SMBIOS_TYPE_4_LEN_V28; =20 - SMBIOS_BUILD_TABLE_PRE(4, T4_BASE + instance, true); /* required */ + if (smbios_ep_type =3D=3D SMBIOS_ENTRY_POINT_TYPE_64) { + tbl_len =3D SMBIOS_TYPE_4_LEN_V30; + } + + SMBIOS_BUILD_TABLE_PRE_SIZE(4, T4_BASE + instance, + true, tbl_len); /* required */ =20 snprintf(sock_str, sizeof(sock_str), "%s%2x", type4.sock_pfx, instance= ); SMBIOS_TABLE_SET_STR(4, socket_designation_str, sock_str); @@ -739,8 +745,15 @@ static void smbios_build_type_4_table(MachineState *ms= , unsigned instance) SMBIOS_TABLE_SET_STR(4, serial_number_str, type4.serial); SMBIOS_TABLE_SET_STR(4, asset_tag_number_str, type4.asset); SMBIOS_TABLE_SET_STR(4, part_number_str, type4.part); - t->core_count =3D t->core_enabled =3D ms->smp.cores; - t->thread_count =3D ms->smp.threads; + + t->core_count =3D (ms->smp.cores > 255) ? 0xFF : ms->smp.cores; + t->core_enabled =3D t->core_count; + + t->core_count2 =3D t->core_enabled2 =3D cpu_to_le16(ms->smp.cores); + + t->thread_count =3D (ms->smp.threads > 255) ? 0xFF : ms->smp.threads; + t->thread_count2 =3D cpu_to_le16(ms->smp.threads); + t->processor_characteristics =3D cpu_to_le16(0x02); /* Unknown */ t->processor_family2 =3D cpu_to_le16(0x01); /* Other */ =20 --=20 MST