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.10027.1679306174307531600 for ; Mon, 20 Mar 2023 02:56:14 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XCPd0ACz; 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=1679306173; 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=DSlX92y/L32IqKLkbKfrS3qK26QAcbRsW+E6z1AnnDM=; b=XCPd0ACzyk1cfoC60dZJAjmBAx4TrgijLIvEbLdzQ+Uo6S/VoZlrjBGBoHw2W0K4TyWVWr Nt9IkI1c2CAPZsKTO0Qql53J+EHTGjeEnt5o7WPLPbd7drDXB4y+bpxe3CEzUmbZBto1nv YNeR6V6QVtFe3+z8TID1/j0yoDAfj/Y= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-608-Ngmmz3zNOiuM3apFjRccNg-1; Mon, 20 Mar 2023 05:56:11 -0400 X-MC-Unique: Ngmmz3zNOiuM3apFjRccNg-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7429E88B7A7; Mon, 20 Mar 2023 09:56:11 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.144]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 47CD8492C13; Mon, 20 Mar 2023 09:56:11 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 205D71800081; Mon, 20 Mar 2023 10:56:10 +0100 (CET) Date: Mon, 20 Mar 2023 10:56:10 +0100 From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Ray Ni , Pawel Polawski , Rahul Kumar , Oliver Steffen , Eric Dong Subject: Re: [PATCH 1/1] UefiCpuPkg/MpInitLib: fix apic mode for cpu hotplug Message-ID: <20230320095610.icocnngadqjjyr27@sirius.home.kraxel.org> References: <20230307122037.3100651-1-kraxel@redhat.com> MIME-Version: 1.0 In-Reply-To: <20230307122037.3100651-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Mar 07, 2023 at 01:20:37PM +0100, Gerd Hoffmann wrote: > In case the number of CPUs can in increase beyond 255 > due to CPU hotplug choose x2apic mode. > > Signed-off-by: Gerd Hoffmann Ping. Any comments on this patch? thanks, Gerd > --- > UefiCpuPkg/Library/MpInitLib/MpLib.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c > index e5dc852ed95f..d73b95001263 100644 > --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c > +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c > @@ -526,7 +526,9 @@ CollectProcessorCount ( > // > // Enable x2APIC mode if > // 1. Number of CPU is greater than 255; or > - // 2. There are any logical processors reporting an Initial APIC ID of 255 or greater. > + // 2. The platform exposed the exact *boot* CPU count to us in advance, and > + // more than 255 logical processors are possible later, with hotplug; or > + // 3. There are any logical processors reporting an Initial APIC ID of 255 or greater. > // > X2Apic = FALSE; > if (CpuMpData->CpuCount > 255) { > @@ -534,6 +536,10 @@ CollectProcessorCount ( > // If there are more than 255 processor found, force to enable X2APIC > // > X2Apic = TRUE; > + } else if ((PcdGet32 (PcdCpuBootLogicalProcessorNumber) > 0) && > + (PcdGet32 (PcdCpuMaxLogicalProcessorNumber) > 255)) > + { > + X2Apic = TRUE; > } else { > CpuInfoInHob = (CPU_INFO_IN_HOB *)(UINTN)CpuMpData->CpuInfoInHob; > for (Index = 0; Index < CpuMpData->CpuCount; Index++) { > -- > 2.39.2 > --