• Daniel Axtens's avatar
    cxl: Refactor adaptor init/teardown · c044c415
    Daniel Axtens authored
    Some aspects of initialisation are done only once in the lifetime of
    an adapter: for example, allocating memory for the adapter,
    allocating the adapter number, or setting up sysfs/debugfs files.
    
    However, we may want to be able to do some parts of the
    initialisation multiple times: for example, in error recovery we
    want to be able to tear down and then re-map IO memory and IRQs.
    
    Therefore, refactor CXL init/teardown as follows.
    
     - Keep the overarching functions 'cxl_init_adapter' and its pair,
       'cxl_remove_adapter'.
    
     - Move all 'once only' allocation/freeing steps to the existing
       'cxl_alloc_adapter' function, and its pair 'cxl_release_adapter'
       (This involves moving allocation of the adapter number out of
       cxl_init_adapter.)
    
     - Create two new functions: 'cxl_configure_adapter', and its pair
       'cxl_deconfigure_adapter'. These two functions 'wire up' the
       hardware --- they (de)configure resources that do not need to
       last the entire lifetime of the adapter
    Signed-off-by: default avatarDaniel Axtens <dja@axtens.net>
    Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
    c044c415
pci.c 33.3 KB