Re: [LSF/MM] CXL Boot to Bash - Section 4: Interleave
From: Yuquan Wang
Date: Wed Mar 26 2025 - 05:28:45 EST
On Tue, Mar 11, 2025 at 08:09:02PM -0400, Gregory Price wrote:
> -----------------------
> Combination Interleave.
> -----------------------
> Lets consider now a system where 2 Host Bridges have 2 CXL devices each,
> and we want to interleave the entire set. This requires us to make use
> of both inter and intra host bridge interleave.
>
> First, we can interleave this with the a single CEDT entry, the same as
> the first inter-host-bridge CEDT (now assuming 1GB per device).
>
> ```
> Subtable Type : 01 [CXL Fixed Memory Window Structure]
> Reserved : 00
> Length : 002C
> Reserved : 00000000
> Window base address : 0000000300000000 <- Memory Region
> Window size : 0000000100000000 <- 4GB
> Interleave Members (2^n) : 01 <- 2-way interleave
> Interleave Arithmetic : 00
> Reserved : 0000
> Granularity : 00000000
> Restrictions : 0006 <- Bit(2) - Volatile
> QtgId : 0001
> First Target : 00000007 <- Host Bridge _UID
> Next Target : 00000006 <- Host Bridge _UID
> ```
>
> This gives us a NUMA structure as follows:
> ```
> NUMA Structure:
>
> ---------- -------- | ----------
> | cpu0 |-----| DRAM |----|---| Node 0 |
> ---------- -------- | ----------
> / \ |
> ------- ------- | ----------
> | HB0 |-----| HB1 |-------------|---| Node 1 |
> ------- ------- | ----------
> / \ / \ |
> CXL0 CXL1 CXL2 CXL3 |
> ```
>
> And the respective decoder programming looks as follows
> ```
> Decoders:
> CXL Root
> |
> decoder0.0
> IW:2 IG:256
> [0x300000000, 0x3FFFFFFFF]
> / \
> Host Bridge 7 Host Bridge 6
> / \
> decoder1.0 decoder2.0
> IW:2 IG:512 IW:2 IG:512
> [0x300000000, 0x3FFFFFFFFF] [0x300000000, 0x3FFFFFFFF]
> / \ / \
> endpoint0 endpoint1 endpoint2 endpoint3
> | | | |
> decoder3.0 decoder4.0 decoder5.0 decoder6.0
> IW:4 IG:256 IW:4 IG:256
> [0x300000000, 0x3FFFFFFFF] [0x300000000, 0x3FFFFFFFF]
> ```
>
> Notice at both the root and the host bridge, the Interleave Ways is 2.
> There are two targets at each level. The host bridge has a granularity
> of 512 to capture its parent's ways and granularity (`2*256`).
>
> Each decoder is programmed with the total number of targets (4) and the
> overall granularity (256B).
>
Sorry, I tried to set this topology on Qemu Virt and used:
"cxl create-region -d decoder0.0 -t ram -m mem0,mem1,mem2,mem3"
but it failed with:
"cxl region: validate_ways: Interleave ways 2 is less than number of memdevs specified: 4"
It seems like the CFMWs IW should be 4?
Yuquan