[PATCH v2 1/2] powerpc: add refcount to struct pci_controller

Andrew Donnellan andrew.donnellan at au1.ibm.com
Wed Aug 10 11:45:27 AEST 2016


On 10/08/16 10:44, Mauricio Faria de Oliveira wrote:
> This commit introduces the 'refcount' field in struct pci_controller,
> along with the corresponding functions 'controller_(get|put|free)()'.
>
> The functions 'pcibios_(alloc|free)_controller()' are modified to use
> that in a backwards compatible manner. (i.e., kfree(phb) is performed
> when pcibios_free_controller() is called.)
>
> So, this patch adds the infrastructure with no functional differences
> to current users of pcibios_(alloc|free)_controller().  Notably, only
> the pseries platform calls pcibios_free_controller() for some purpose
> other than to release the pci_controller in case of errors just after
> the call to pcibios_alloc_controller() (i.e., 'goto error' scenarios).

cxl's vPHB API also uses pcibios_free_controller() (which is why we 
export the symbol, as it's called from within the cxl module). When we 
remove/shutdown the underlying cxl device, we remove all the devices 
sitting on the vPHB and then free the vPHB.

I'm currently working on a cxl defect found by an IBM test team where we 
run into this - will review this patch more thoroughly and test it shortly.


Andrew

-- 
Andrew Donnellan              OzLabs, ADL Canberra
andrew.donnellan at au1.ibm.com  IBM Australia Limited



More information about the Linuxppc-dev mailing list