From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by mx.groups.io with SMTP id smtpd.web11.201664.1673973639167905943 for ; Tue, 17 Jan 2023 08:40:39 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rR49UoKR; spf=pass (domain: kernel.org, ip: 145.40.68.75, mailfrom: ardb@kernel.org) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B0821B81909 for ; Tue, 17 Jan 2023 16:40:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F6A7C43398 for ; Tue, 17 Jan 2023 16:40:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673973636; bh=upDfZfPKDUsdRcyNtsyRmMVCzHjdDnrNYbaWWz8m9Yc=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=rR49UoKRrbrpiClDgeVAQGIDFKAcn80R4X3tiV4FAcpD4HM4iUpw7GhUHkMSSvGJj +ZbR25dfw2cB3hSGHmMac/sgVO7W6se3i8x6QJjMxO4ZcGCSlxE1qt5rJ0F8OwIQcK HukNAgxQtGKmG+SsqkfgOjF2GTijtTa1Lja6NwFj/na7LTDoq9iazs+Y5pgLvG+QOh aXJysV17P/Lu08+CLSMCD6lGtUcyYtsfW9oHl1iZ6o0yXPQHWYpj2ViGT8q64KRnpE tuaK81TAUPVotd/wDpDyrAZmsxzG1Tv1OsRkXYXLT3BgCUjqHm8ZKZdsbpYHLb1WFA 3AczMT8rRwH2A== Received: by mail-lj1-f173.google.com with SMTP id bn6so33716558ljb.13 for ; Tue, 17 Jan 2023 08:40:36 -0800 (PST) X-Gm-Message-State: AFqh2kp5oem6RU7jEq/aIKhvaCzxJ0ejCWqAqYgx6LHsd/JkyP+ZNQZy UyPm4FHpG734varC5HS6luo98IelvkMs9rSKiDM= X-Google-Smtp-Source: AMrXdXs7t9UmkMsyEW5kxaq1RAsAbL+bsyMAcCKvNIE3x/GIEVy6OFJM3GrzFgHU12xG1r3bygx/XLJetvxeB71PESA= X-Received: by 2002:a05:651c:b1f:b0:28b:814d:7087 with SMTP id b31-20020a05651c0b1f00b0028b814d7087mr349129ljr.516.1673973634419; Tue, 17 Jan 2023 08:40:34 -0800 (PST) MIME-Version: 1.0 References: <20230113042126.3107135-1-nhi@os.amperecomputing.com> <7d401f29-56d9-d754-88a6-684ce329a727@quicinc.com> <25ee195f-85ee-d783-7e5c-f0da8b9972b4@quicinc.com> In-Reply-To: <25ee195f-85ee-d783-7e5c-f0da8b9972b4@quicinc.com> From: "Ard Biesheuvel" Date: Tue, 17 Jan 2023 17:40:23 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [edk2-devel] [edk2-platforms][PATCH 1/1] AmpereAltraPkg: Update ArmPlatformLib to work with changed ARM_CORE_INFO To: Rebecca Cran Cc: Nhi Pham , devel@edk2.groups.io, nhi@os.amperecomputing.com, patches@amperecomputing.com, quic_llindhol@quicinc.com, ardb+tianocore@kernel.org, Tinh Nguyen Content-Type: text/plain; charset="UTF-8" On Tue, 17 Jan 2023 at 13:55, Rebecca Cran wrote: > > I was under the impression that this is becoming a more standard format? > If this is not defined in an ARM spec somewhere, we shouldn't add it to ArmPkg at this point. > For example, the Neoverse N2 has AFF0 always 0 (it's not hyperthreaded), > it puts the core ID in AFF1, the cluster ID in AFF2, but since it only > has a single socket AFF3 is always 0. This differs from older cores > where the core ID was in AFF0 and the cluster ID in AFF1. > > https://developer.arm.com/documentation/102099/0000/AArch64-registers/AArch64-identification-registers/MPIDR-EL1--Multiprocessor-Affinity-Register > > Am I mistaken? > > -- > Rebecca Cran > > On 1/17/23 02:53, Nhi Pham wrote: > > Hi Rebecca, > > > > That's Ampere Altra Family specific MPIDR encoding. So, we could not > > leverage the definitions in the ArmPkg/Include/Library/ArmLib.h. > > > > -Nhi > > > > On 1/13/2023 9:40 PM, Rebecca Cran wrote: > >> On 1/12/23 21:21, Nhi Pham via groups.io wrote: > >> > >>> +// > >>> +// MPIDR manipulation > >>> +// > >>> +#define AC01_GET_MPIDR(SocketId, ClusterId, CoreId) \ > >>> + (((SocketId) << 32) | ((ClusterId) << 16) | ((CoreId) << 8)) > >>> +#define AC01_GET_SOCKET_ID(Mpidr) (((Mpidr) & ARM_CORE_AFF3) >> 32) > >>> +#define AC01_GET_CLUSTER_ID(Mpidr) (((Mpidr) & ARM_CORE_AFF2) >> 16) > >>> +#define AC01_GET_CORE_ID(Mpidr) (((Mpidr) & ARM_CORE_AFF1) >> 8) > >>> + > >> > >> Ideally, this should go in ArmPkg/Include/Library/ArmLib.h, but I'm > >> not sure how we should handle the older format where the the core was > >> in the first 8 bits. > >>