• Dan Williams's avatar
    cxl/port: Add RCD endpoint port enumeration · 0a19bfc8
    Dan Williams authored
    Unlike a CXL memory expander in a VH topology that has at least one
    intervening 'struct cxl_port' instance between itself and the CXL root
    device, an RCD attaches one-level higher. For example:
    
                   VH
              ┌──────────┐
              │ ACPI0017 │
              │  root0   │
              └─────┬────┘
                    │
              ┌─────┴────┐
              │  dport0  │
        ┌─────┤ ACPI0016 ├─────┐
        │     │  port1   │     │
        │     └────┬─────┘     │
        │          │           │
     ┌──┴───┐   ┌──┴───┐   ┌───┴──┐
     │dport0│   │dport1│   │dport2│
     │ RP0  │   │ RP1  │   │ RP2  │
     └──────┘   └──┬───┘   └──────┘
                   │
               ┌───┴─────┐
               │endpoint0│
               │  port2  │
               └─────────┘
    
    ...vs:
    
                  RCH
              ┌──────────┐
              │ ACPI0017 │
              │  root0   │
              └────┬─────┘
                   │
               ┌───┴────┐
               │ dport0 │
               │ACPI0016│
               └───┬────┘
                   │
              ┌────┴─────┐
              │endpoint0 │
              │  port1   │
              └──────────┘
    
    So arrange for endpoint port in the RCH/RCD case to appear directly
    connected to the host-bridge in its singular role as a dport. Compare
    that to the VH case where the host-bridge serves a dual role as a
    'cxl_dport' for the CXL root device *and* a 'cxl_port' upstream port for
    the Root Ports in the Root Complex that are modeled as 'cxl_dport'
    instances in the CXL topology.
    
    Another deviation from the VH case is that RCDs may need to look up
    their component registers from the Root Complex Register Block (RCRB).
    That platform firmware specified RCRB area is cached by the cxl_acpi
    driver and conveyed via the host-bridge dport to the cxl_mem driver to
    perform the cxl_rcrb_to_component() lookup for the endpoint port
    (See 9.11.8 CXL Devices Attached to an RCH for the lookup of the
    upstream port component registers).
    Tested-by: default avatarRobert Richter <rrichter@amd.com>
    Link: https://lore.kernel.org/r/166993045621.1882361.1730100141527044744.stgit@dwillia2-xfh.jf.intel.comReviewed-by: default avatarRobert Richter <rrichter@amd.com>
    Reviewed-by: default avatarJonathan Camerom <Jonathan.Cameron@huawei.com>
    Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
    0a19bfc8
mem.c 5.44 KB