From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web10.39921.1674112412840516981 for ; Wed, 18 Jan 2023 23:13:33 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Dbm48jhV; spf=pass (domain: redhat.com, ip: 170.10.133.124, mailfrom: kraxel@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674112411; 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=gYhXVZCw99I9kn7wQN94WihAm++6a4cu96zJj9wjg+c=; b=Dbm48jhV9UyPwDfiUtgNuNlFQ5xkLM8INkZhrWOxkNk9po1XynNx7tnMvFbUkpRZV4cZP9 aI+qRhwlVbDZIqgmRcmqAF2pXCApQZoTtXEKCuJ0ZVtpGaWCI3fCDMBa99H4gsmRjDjRVy LKc9WCzdNtIitt26V65hIgeN3o/zkbA= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-446-br_JojmCO8Ocq9CpO8K1bg-1; Thu, 19 Jan 2023 02:13:26 -0500 X-MC-Unique: br_JojmCO8Ocq9CpO8K1bg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E1E5F29AA2EC; Thu, 19 Jan 2023 07:13:25 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.186]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AEB221121315; Thu, 19 Jan 2023 07:13:25 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 51817180093C; Thu, 19 Jan 2023 08:13:24 +0100 (CET) Date: Thu, 19 Jan 2023 08:13:24 +0100 From: "Gerd Hoffmann" To: "Ni, Ray" Cc: "Wu, Jiaxin" , "devel@edk2.groups.io" , "Dong, Eric" , "Zeng, Star" , Laszlo Ersek , "Kumar, Rahul R" , "Kinney, Michael D" , "Zimmer, Vincent" Subject: Re: [PATCH v3 1/5] UefiCpuPkg/SmmBaseHob.h: Add SMM Base HOB Data Message-ID: <20230119071324.4xvry2vvvfdr5m5y@sirius.home.kraxel.org> References: <20230118095620.9860-1-jiaxin.wu@intel.com> <20230118095620.9860-2-jiaxin.wu@intel.com> <20230118111913.xgjlxdhngzwhvf76@sirius.home.kraxel.org> MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Jan 18, 2023 at 03:06:11PM +0000, Ni, Ray wrote: > Gerd, > In another mail with title "MdePkg: Remove Itanium leftover data structure", > we are discussing the HOB EFI_SEC_PLATFORM_INFORMATION_RECORD2 that helps > share the BIST information with CpuDxe driver. > That HOB is of format: ( ) +. > Very similar to the format of SMM_BASE_HOB_DATA: + Same problem indeed. > So, if we use a pattern here to remove the 8K CPU limitation, the same pattern will > be used by EFI_SEC_PLATFORM_INFORMATION_RECORD2 as well. > > How about a new format as below? + Mike and Vincent for comments since the same > pattern may be used for EFI_SEC_PLATFORM_INFORMATION_RECORD3. > > #pragma pack(1) > typedef struct { > UINT32 CpuIndex; > UINT32 NumberOfCpus; // align to EFI_SEC_PLATFORM_INFORMATION_RECORD2.NumberOfCpus > UINT64 SmBase[]; > } SMM_BASE_HOB_DATA; > #pragma pack() > > For system with less than 8K CPUs, one HOB is produced. CpuIndex is set to 0 indicating > the HOB describes the CPU from 0 to NumberOfCpus-1. > > The HOB list may contains multiple such HOB instances each describing the information for > CPU from CpuIndex to CpuIndex + NumberOfCpus - 1. > The instance order in the HOB list is random so consumer cannot assume the CpuIndex > of first instance is 0. The idea looks good to me. For the smbase case it might also be possible to store the base address and the per-cpu entry size, then use smbase = base + size * cpuindex to calculate the per-cpu base address. Puts some restrictions on the memory allocation (must be one big block), not sure this is possible, that part of the code is not (yet?) posted for review. take care, Gerd