From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 43038D801B3 for ; Thu, 22 Feb 2024 00:44:54 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=Ex4OOrkLdDILW5+Bc8HzNlWZeGK2xc/yOxD5JLqROMM=; c=relaxed/simple; d=groups.io; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1708562693; v=1; b=omF+dmzihVoCJ8bIYLs965pSrVequF0TZVTSnIoaq6j65FkHQB70Qt8nxpGsKC4CD1vaIzyF BLNsrOliKny1pGscJpfinitya/Qd6eD+bSfSOFgIe8H3e2j5mZe6rH/1L0NdlYSsfx78YkM/Rqa oARJ13dL3bPMuvlQFDUqh+P0= X-Received: by 127.0.0.2 with SMTP id VUzeYY7687511xtJg9b7s8RC; Wed, 21 Feb 2024 16:44:53 -0800 X-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.2657.1708562692259097161 for ; Wed, 21 Feb 2024 16:44:52 -0800 X-Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-222-UkpZiMbAMkSD37tY21ghpQ-1; Wed, 21 Feb 2024 19:44:49 -0500 X-MC-Unique: UkpZiMbAMkSD37tY21ghpQ-1 X-Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B75353869157; Thu, 22 Feb 2024 00:44:48 +0000 (UTC) X-Received: from [10.39.192.46] (unknown [10.39.192.46]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 200F4492BE7; Thu, 22 Feb 2024 00:44:46 +0000 (UTC) Message-ID: <3e3c9c39-76c1-4a80-4cfa-830b52ecd831@redhat.com> Date: Thu, 22 Feb 2024 01:44:45 +0100 MIME-Version: 1.0 Subject: Re: [edk2-devel] [PATCH v2 3/5] UefiCpuPkg/MpInitLib: Add support for multiple HOBs to SwitchApContext() To: devel@edk2.groups.io, kraxel@redhat.com Cc: Oliver Steffen , Rahul Kumar , Ray Ni References: <20240220174939.1288689-1-kraxel@redhat.com> <20240220174939.1288689-4-kraxel@redhat.com> From: "Laszlo Ersek" In-Reply-To: <20240220174939.1288689-4-kraxel@redhat.com> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,lersek@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: QWQBBhKLTGe0E6t2sy6kGXRrx7686176AA= Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=omF+dmzi; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=redhat.com (policy=none) On 2/20/24 18:49, Gerd Hoffmann wrote: > Rename the MpHandOff parameter to FirstMpHandOff. Add loops so the > function inspects all HOBs present in the system. >=20 > Signed-off-by: Gerd Hoffmann > --- > UefiCpuPkg/Library/MpInitLib/MpLib.h | 2 +- > UefiCpuPkg/Library/MpInitLib/MpLib.c | 35 ++++++++++++++++++---------- > 2 files changed, 24 insertions(+), 13 deletions(-) >=20 > diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h b/UefiCpuPkg/Library/Mp= InitLib/MpLib.h > index bc2a0232291d..b5214b904b41 100644 > --- a/UefiCpuPkg/Library/MpInitLib/MpLib.h > +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h > @@ -482,7 +482,7 @@ GetWakeupBuffer ( > **/ > VOID > SwitchApContext ( > - IN MP_HAND_OFF *MpHandOff > + IN CONST MP_HAND_OFF *FirstMpHandOff > ); > =20 > /** > diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/Mp= InitLib/MpLib.c > index 8f198ff6d817..c13de34e5769 100644 > --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c > +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c > @@ -1938,31 +1938,42 @@ GetBspNumber ( > This procedure allows the AP to switch to another section of > memory and continue its loop there. > =20 > - @param[in] MpHandOff Pointer to MP hand-off data structure. > + @param[in] FirstMpHandOff Pointer to first MP hand-off HOB. comment should say sth like "Pointer to first MP hand-off HOB body". Reviewed-by: Laszlo Ersek > **/ > VOID > SwitchApContext ( > - IN MP_HAND_OFF *MpHandOff > + IN CONST MP_HAND_OFF *FirstMpHandOff > ) > { > - UINTN Index; > - UINT32 BspNumber; > + UINTN Index; > + UINT32 BspNumber; > + CONST MP_HAND_OFF *MpHandOff; > =20 > - BspNumber =3D GetBspNumber (MpHandOff); > + BspNumber =3D GetBspNumber (FirstMpHandOff); > =20 > - for (Index =3D 0; Index < MpHandOff->CpuCount; Index++) { > - if (Index !=3D BspNumber) { > - *(UINTN *)(UINTN)MpHandOff->Info[Index].StartupProcedureAddress = =3D (UINTN)SwitchContextPerAp; > - *(UINT32 *)(UINTN)MpHandOff->Info[Index].StartupSignalAddress = =3D MpHandOff->StartupSignalValue; > + for (MpHandOff =3D FirstMpHandOff; > + MpHandOff !=3D NULL; > + MpHandOff =3D GetNextMpHandOffHob (MpHandOff)) > + { > + for (Index =3D 0; Index < MpHandOff->CpuCount; Index++) { > + if (MpHandOff->ProcessorIndex + Index !=3D BspNumber) { > + *(UINTN *)(UINTN)MpHandOff->Info[Index].StartupProcedureAddress = =3D (UINTN)SwitchContextPerAp; > + *(UINT32 *)(UINTN)MpHandOff->Info[Index].StartupSignalAddress = =3D MpHandOff->StartupSignalValue; > + } > } > } > =20 > // > // Wait all APs waken up if this is not the 1st broadcast of SIPI > // > - for (Index =3D 0; Index < MpHandOff->CpuCount; Index++) { > - if (Index !=3D BspNumber) { > - WaitApWakeup ((UINT32 *)(UINTN)(MpHandOff->Info[Index].StartupSign= alAddress)); > + for (MpHandOff =3D FirstMpHandOff; > + MpHandOff !=3D NULL; > + MpHandOff =3D GetNextMpHandOffHob (MpHandOff)) > + { > + for (Index =3D 0; Index < MpHandOff->CpuCount; Index++) { > + if (MpHandOff->ProcessorIndex + Index !=3D BspNumber) { > + WaitApWakeup ((UINT32 *)(UINTN)(MpHandOff->Info[Index].StartupSi= gnalAddress)); > + } > } > } > } -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#115764): https://edk2.groups.io/g/devel/message/115764 Mute This Topic: https://groups.io/mt/104472306/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-