On Tue, 16 Jul 2024 14:13:29 +0300 Mike Rapoport <rppt@xxxxxxxxxx> wrote: > From: "Mike Rapoport (Microsoft)" <rppt@xxxxxxxxxx> > > Hi, > > Following the discussion about handling of CXL fixed memory windows on > arm64 [1] I decided to bite the bullet and move numa_memblks from x86 to > the generic code so they will be available on arm64/riscv and maybe on > loongarch sometime later. > > While it could be possible to use memblock to describe CXL memory windows, > it currently lacks notion of unpopulated memory ranges and numa_memblks > does implement this. > > Another reason to make numa_memblks generic is that both arch_numa (arm64 > and riscv) and loongarch use trimmed copy of x86 code although there is no > fundamental reason why the same code cannot be used on all these platforms. > Having numa_memblks in mm/ will make it's interaction with ACPI and FDT > more consistent and I believe will reduce maintenance burden. > > And with generic numa_memblks it is (almost) straightforward to enable NUMA > emulation on arm64 and riscv. > > The first 5 commits in this series are cleanups that are not strictly > related to numa_memblks. > > Commits 6-11 slightly reorder code in x86 to allow extracting numa_memblks > and NUMA emulation to the generic code. > > Commits 12-14 actually move the code from arch/x86/ to mm/ and commit 15 > does some aftermath cleanups. > > Commit 16 switches arch_numa to numa_memblks. > > Commit 17 enables usage of phys_to_target_node() and > memory_add_physaddr_to_nid() with numa_memblks. Hi Mike, I've lightly tested with emulated CXL + Generic Ports and Generic Initiators as well as more normal cpus and memory via qemu on arm64 and it's looking good.