public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Marcin Juszkiewicz" <marcin.juszkiewicz@linaro.org>
To: Xiong Yining <xiongyining1480@phytium.com.cn>, devel@edk2.groups.io
Cc: quic_llindhol@quicinc.com, ardb+tianocore@kernel.org,
	graeme@xora.org.uk, chenbaozi@phytium.com.cn
Subject: Re: [edk2-devel] [PATCH 1/1] SbsaQemu: AcpiDxe: Create SRAT table at runtime
Date: Thu, 15 Feb 2024 15:17:09 +0100	[thread overview]
Message-ID: <408b0a68-216b-4232-ae4f-6db71924c662@linaro.org> (raw)
In-Reply-To: <20240131131554.3003561-2-xiongyining1480@phytium.com.cn>

W dniu 31.01.2024 o 2:15 PM, Xiong Yining pisze:
> Add support to create SRAT(System resource affinity table) for
> sbsa platform at runtime.
> 
> Signed-off-by: Xiong Yining <xiongyining1480@phytium.com.cn>
> Signed-off-by: Chen Baozi <chenbaozi@phytium.com.cn>
> ---
>   .../Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.h | 27 ++++++
>   .../Include/Library/SbsaQemuHardwareInfoLib.h | 11 +++
>   .../Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c | 92 +++++++++++++++++++
>   .../SbsaQemuHardwareInfoLib.c                 | 36 ++++++++
>   4 files changed, 166 insertions(+)
> 
> diff --git a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.h b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.h
> index 7595df4c8a2d..b8c29b803b81 100644
> --- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.h
> +++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.h
> @@ -63,4 +63,31 @@ typedef struct {
>   

> ++#define SBSAQEMU_ACPI_GICC_AFFINITY_STRUCTURE_INIT(                              \
> +          ProximtyDomain, ACPIProcessorUID, Flags, ClockDomain)                   \

s/ProximtyDomain/ProximityDomain/ please

Applied it on top of 20240131120507.2829117-1-xiongyining1480@phytium.com.cn
series ("get rid of DeviceTree from SbsaQemu v5" one).

Code boots but only memory from the first node is listed by both EDK2 and Linux.

QEMU arguments:
-smp 4,sockets=4,maxcpus=4
-m 4G,slots=2,maxmem=5G
-object memory-backend-ram,size=1G,id=m0
-object memory-backend-ram,size=3G,id=m1
-numa node,nodeid=0,cpus=0-1,memdev=m0
-numa node,nodeid=1,cpus=2,memdev=m1
-numa node,nodeid=2,cpus=3

EDK2 memmap:

Type       Start            End              # Pages          Attributes
Available  0000010000000000-000001003841AFFF 000000000003841B 000000000000000E
LoaderCode 000001003841B000-00000100384FFFFF 00000000000000E5 000000000000000E
RT_Code    0000010038500000-000001003857FFFF 0000000000000080 800000000000000E
RT_Data    0000010038580000-000001003861FFFF 00000000000000A0 800000000000000E
RT_Code    0000010038620000-000001003866FFFF 0000000000000050 800000000000000E
ACPI_Recl  0000010038670000-00000100386DFFFF 0000000000000070 000000000000000E
RT_Code    00000100386E0000-000001003872FFFF 0000000000000050 800000000000000E
Available  0000010038730000-000001003A00DFFF 00000000000018DE 000000000000000E
BS_Data    000001003A00E000-000001003A02BFFF 000000000000001E 000000000000000E
Available  000001003A02C000-000001003A039FFF 000000000000000E 000000000000000E
BS_Data    000001003A03A000-000001003A056FFF 000000000000001D 000000000000000E
Available  000001003A057000-000001003A057FFF 0000000000000001 000000000000000E
BS_Data    000001003A058000-000001003B623FFF 00000000000015CC 000000000000000E
Available  000001003B624000-000001003B7D3FFF 00000000000001B0 000000000000000E
BS_Code    000001003B7D4000-000001003BBFFFFF 000000000000042C 000000000000000E
RT_Code    000001003BC00000-000001003BD8FFFF 0000000000000190 800000000000000E
RT_Data    000001003BD90000-000001003BFDFFFF 0000000000000250 800000000000000E
Available  000001003BFE0000-000001003BFFEFFF 000000000000001F 000000000000000E
BS_Data    000001003BFFF000-000001003C01FFFF 0000000000000021 000000000000000E
Available  000001003C020000-000001003F7D4FFF 00000000000037B5 000000000000000E
BS_Data    000001003F7D5000-000001003F7F5FFF 0000000000000021 000000000000000E
BS_Code    000001003F7F6000-000001003F83CFFF 0000000000000047 000000000000000E
BS_Data    000001003F83D000-000001003FFD9FFF 000000000000079D 000000000000000E
BS_Code    000001003FFDA000-000001003FFF7FFF 000000000000001E 000000000000000E
BS_Data    000001003FFF8000-000001003FFFFFFF 0000000000000008 000000000000000E
MMIO       0000000010000000-00000000106BFFFF 00000000000006C0 8000000000000001
MMIO       0000000060010000-0000000060010FFF 0000000000000001 8000000000000001
  
   Reserved  :              0 Pages (0 Bytes)
   LoaderCode:            229 Pages (937,984 Bytes)
   LoaderData:              0 Pages (0 Bytes)
   BS_Code   :          1,169 Pages (4,788,224 Bytes)
   BS_Data   :          7,662 Pages (31,383,552 Bytes)
   RT_Code   :            688 Pages (2,818,048 Bytes)
   RT_Data   :            752 Pages (3,080,192 Bytes)
   ACPI_Recl :            112 Pages (458,752 Bytes)
   ACPI_NVS  :              0 Pages (0 Bytes)
   MMIO      :          1,729 Pages (7,081,984 Bytes)
   MMIO_Port :              0 Pages (0 Bytes)
   PalCode   :              0 Pages (0 Bytes)
   Available :        251,532 Pages (1,030,275,072 Bytes)
   Persistent:              0 Pages (0 Bytes)
               --------------
Total Memory:          1,024 MB (1,073,741,824 Bytes)


SRAT table shows both memory nodes:

  --------------- SRAT Table ---------------

Address  : 0x100386DFD18
Length   : 200
   
00000000 : 53 52 41 54 C8 00 00 00 - 03 48 4C 49 4E 41 52 4F   SRAT.....HLINARO
00000010 : 53 42 53 41 51 45 4D 55 - 10 08 20 20 4C 4E 52 4F   SBSAQEMU..  LNRO
00000020 : 01 00 00 00 01 00 00 00 - 00 00 00 00 00 00 00 00   ................
00000030 : 01 28 01 00 00 00 00 00 - 00 00 00 40 00 01 00 00   .(.........@....
00000040 : 00 00 00 C0 00 00 00 00 - 00 00 00 00 01 00 00 00   ................
00000050 : 00 00 00 00 00 00 00 00 - 01 28 00 00 00 00 00 00   .........(......
00000060 : 00 00 00 00 00 01 00 00 - 00 00 00 40 00 00 00 00   ...........@....
00000070 : 00 00 00 00 01 00 00 00 - 00 00 00 00 00 00 00 00   ................
00000080 : 03 12 00 00 00 00 00 00 - 00 00 01 00 00 00 00 00   ................
00000090 : 00 00 03 12 00 00 00 00 - 01 00 00 00 01 00 00 00   ................
000000A0 : 00 00 00 00 03 12 01 00 - 00 00 02 00 00 00 01 00   ................
000000B0 : 00 00 00 00 00 00 03 12 - 02 00 00 00 03 00 00 00   ................
000000C0 : 01 00 00 00 00 00 00 00                             ........

Table Checksum : OK

SRAT                                 :
   Signature                          : SRAT
   Length                             : 200
   Revision                           : 3
   Checksum                           : 0x48
   Oem ID                             : LINARO
   Oem Table ID                       : SBSAQEMU
   Oem Revision                       : 0x20200810
   Creator ID                         : LNRO
   Creator Revision                   : 0x1
   Reserved                           : 0x1
   Reserved                           : 0x0
   Memory Affinity Structure [0]      :
     Type                             : 0x1
     Length                           : 0x28
     Proximity Domain                 : 0x1
     Reserved                         : 0x0
     Base Address Low                 : 0x40000000
     Base Address High                : 0x100
     Length Low                       : 0xC0000000
     Length High                      : 0x0
     Reserved                         : 0x0
     Flags                            : 0x1
     Reserved                         : 0x0
   Memory Affinity Structure [1]      :
     Type                             : 0x1
     Length                           : 0x28
     Proximity Domain                 : 0x0
     Reserved                         : 0x0
     Base Address Low                 : 0x0
     Base Address High                : 0x100
     Length Low                       : 0x40000000
     Length High                      : 0x0
     Reserved                         : 0x0
     Flags                            : 0x1
     Reserved                         : 0x0
   GICC Affinity Structure [0]        :
     Type                             : 0x3
     Length                           : 0x12
     Proximity Domain                 : 0x0
     ACPI Processor UID               : 0x0
     Flags                            : 0x1
     Clock Domain                     : 0x0
   GICC Affinity Structure [1]        :
     Type                             : 0x3
     Length                           : 0x12
     Proximity Domain                 : 0x0
     ACPI Processor UID               : 0x1
     Flags                            : 0x1
     Clock Domain                     : 0x0
   GICC Affinity Structure [2]        :
     Type                             : 0x3
     Length                           : 0x12
     Proximity Domain                 : 0x1
     ACPI Processor UID               : 0x2
     Flags                            : 0x1
     Clock Domain                     : 0x0
   GICC Affinity Structure [3]        :
     Type                             : 0x3
     Length                           : 0x12
     Proximity Domain                 : 0x2
     ACPI Processor UID               : 0x3
     Flags                            : 0x1
     Clock Domain                     : 0x0


Linux (kernel from Debian or Fedora) boots with memory
from the first node only:

[    0.000000] ACPI: SPCR: console: pl011,mmio32,0x60000000,115200
[    0.000000] ACPI: SRAT: Node 1 PXM 1 [mem 0x10040000000-0x100ffffffff]
[    0.000000] ACPI: SRAT: Node 0 PXM 0 [mem 0x10000000000-0x1003fffffff]
[    0.000000] NUMA: NODE_DATA [mem 0x1003f6fd1c0-0x1003f713fff]
[    0.000000] NUMA: Initmem setup node 1 [<memory-less node>]
[    0.000000] NUMA: NODE_DATA [mem 0x1003f6e6380-0x1003f6fd1bf]
[    0.000000] NUMA: NODE_DATA(1) on node 0
[    0.000000] NUMA: Initmem setup node 2 [<memory-less node>]
[    0.000000] NUMA: NODE_DATA [mem 0x1003f6cf540-0x1003f6e637f]
[    0.000000] NUMA: NODE_DATA(2) on node 0
[    0.000000] Zone ranges:
[    0.000000]   DMA      [mem 0x0000010000000000-0x000001003fffffff]
[    0.000000]   DMA32    empty
[    0.000000]   Normal   empty
[    0.000000]   Device   empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000010000000000-0x00000100384fffff]
[    0.000000]   node   0: [mem 0x0000010038500000-0x000001003866ffff]
[    0.000000]   node   0: [mem 0x0000010038670000-0x00000100386dffff]
[    0.000000]   node   0: [mem 0x00000100386e0000-0x000001003872ffff]
[    0.000000]   node   0: [mem 0x0000010038730000-0x000001003bbfffff]
[    0.000000]   node   0: [mem 0x000001003bc00000-0x000001003bfdffff]
[    0.000000]   node   0: [mem 0x000001003bfe0000-0x000001003fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000010000000000-0x000001003fffffff]
[    0.000000] Initmem setup node 1 as memoryless
[    0.000000] Initmem setup node 2 as memoryless

[    0.000000] ACPI: NUMA: SRAT: PXM 0 -> MPIDR 0x0 -> Node 0
[    0.000000] ACPI: NUMA: SRAT: PXM 0 -> MPIDR 0x1 -> Node 0
[    0.000000] ACPI: NUMA: SRAT: PXM 1 -> MPIDR 0x2 -> Node 1
[    0.000000] ACPI: NUMA: SRAT: PXM 2 -> MPIDR 0x3 -> Node 2
[    0.000000] percpu: Embedded 15 pages/cpu s195368 r8192 d42200 u245760

[    0.000000] Fallback order for Node 0: 0
[    0.000000] Fallback order for Node 1: 1 0
[    0.000000] Fallback order for Node 2: 2 0
[    0.000000] Built 3 zonelists, mobility grouping on.  Total pages: 65280

[    0.000000] Memory: 833824K/1048576K available (18496K kernel code, 4236K rwdata, 16112K rodata, 10560K init, 10585K bss, 149216K reserved, 65536K cma-reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=3



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115524): https://edk2.groups.io/g/devel/message/115524
Mute This Topic: https://groups.io/mt/104074353/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



  reply	other threads:[~2024-02-15 14:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-31 13:15 [edk2-devel] [PATCH 0/1] Add support for generating SRAT tables Xiong Yining
2024-01-31 13:15 ` [edk2-devel] [PATCH 1/1] SbsaQemu: AcpiDxe: Create SRAT table at runtime Xiong Yining
2024-02-15 14:17   ` Marcin Juszkiewicz [this message]
2024-02-20  8:03     ` Xiong Yining
2024-02-21 13:22       ` Marcin Juszkiewicz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=408b0a68-216b-4232-ae4f-6db71924c662@linaro.org \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox