• Dan Williams's avatar
    cxl/port: Fix @host confusion in cxl_dport_setup_regs() · 33d9c987
    Dan Williams authored
    commit 5d2ffbe4 ("cxl/port: Store the downstream port's Component Register mappings in struct cxl_dport")
    
    ...moved the dport component registers from a raw component_reg_phys
    passed in at dport instantiation time to a 'struct cxl_register_map'
    populated with both the component register data *and* the "host" device
    for mapping operations.
    
    While typical CXL switch dports are mapped by their associated 'struct
    cxl_port', an RCH host bridge dport registered by cxl_acpi needs to wait
    until the cxl_mem driver makes the attachment to map the registers. This
    is because there are no intervening 'struct cxl_port' instances between
    the root cxl_port and the endpoint port in an RCH topology.
    
    For now just mark the host as NULL in the RCH dport case until code that
    needs to map the dport registers arrives.
    
    This patch is not flagged for -stable since nothing in the current
    driver uses the dport->comp_map.
    
    Now, I am slightly uneasy that cxl_setup_comp_regs() sets map->host to a
    wrong value and then cxl_dport_setup_regs() fixes it up, but the
    alternatives I came up with are more messy. For example, adding an
    @logdev to 'struct cxl_register_map' that the dev_printk()s can fall
    back to when @host is NULL. I settled on "post-fixup+comment" since it
    is only RCH dports that have this special case where register probing is
    split between a host-bridge RCRB lookup and when cxl_mem_probe() does
    the association of the cxl_memdev and endpoint port.
    
    [moved rename of @comp_map to @reg_map into next patch]
    
    Fixes: 5d2ffbe4 ("cxl/port: Store the downstream port's Component Register mappings in struct cxl_dport")
    Signed-off-by: default avatarRobert Richter <rrichter@amd.com>
    Reviewed-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
    Link: https://lore.kernel.org/r/20231018171713.1883517-4-rrichter@amd.comSigned-off-by: default avatarDan Williams <dan.j.williams@intel.com>
    33d9c987
port.c 51.4 KB