• Dan Williams's avatar
    cxl/core/port: Add switch port enumeration · 2703c16c
    Dan Williams authored
    So far the platorm level CXL resources have been enumerated by the
    cxl_acpi driver, and cxl_pci has gathered all the pre-requisite
    information it needs to fire up a cxl_mem driver. However, the first
    thing the cxl_mem driver will be tasked to do is validate that all the
    PCIe Switches in its ancestry also have CXL capabilities and an CXL.mem
    link established.
    
    Provide a common mechanism for a CXL.mem endpoint driver to enumerate
    all the ancestor CXL ports in the topology and validate CXL.mem
    connectivity.
    
    Multiple endpoints may end up racing to establish a shared port in the
    topology. This race is resolved via taking the device-lock on a parent
    CXL Port before establishing a new child. The winner of the race
    establishes the port, the loser simply registers its interest in the
    port via 'struct cxl_ep' place-holder reference.
    
    At endpoint teardown the same parent port lock is taken as 'struct
    cxl_ep' references are deleted. Last endpoint to drop its reference
    unregisters the port.
    Reviewed-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
    Link: https://lore.kernel.org/r/164398731146.902644.1029761300481366248.stgit@dwillia2-desk3.amr.corp.intel.comSigned-off-by: default avatarDan Williams <dan.j.williams@intel.com>
    2703c16c
cxl.h 15 KB