[PATCH V2 06/10] i3c: mipi-i3c-hci-pci: Enable MSI support

Adrian Hunter adrian.hunter at intel.com
Mon Dec 15 09:26:55 PST 2025


On 12/12/2025 19:38, Frank Li wrote:
> On Thu, Dec 11, 2025 at 06:19:56PM +0200, Adrian Hunter wrote:
>> On 11/12/2025 17:40, Frank Li wrote:
>>> On Thu, Dec 11, 2025 at 03:48:05PM +0200, Adrian Hunter wrote:
>>>> Use pci_alloc_irq_vectors() to support all IRQ types.  Do not call
>>>> pci_free_irq_vectors() because it is unnecessary when the device is
>>>> managed due to the use of pcim_enable_device().
>>>
>>> pcim_enable_device() add action pcim_disable_device(), I have not see
>>> pci_free_irq_vectors() in pcim_disable_device().
>>>
>>> Can you tell me where call pci_free_irq_vectors?
>>
>> pci_alloc_irq_vectors()
>> 	pci_alloc_irq_vectors_affinity()
>> 		__pci_enable_msix_range()
>> 			pci_setup_msi_context()
>> 				pcim_setup_msi_release()
>> 					devm_add_action(pcim_msi_release)
>> 							:
>> 							pci_free_irq_vectors()
>> 		__pci_enable_msi_range()
>> 			pci_setup_msi_context()
> 
> Okay, it should be that pci_alloc_irq_vectors() provide auto free. not
> because pcim_enable_device()?

No, it is conditional on pci_is_managed(dev) which is true if
pcim_enable_device() has been used.

> 
> The below statement should be wrong.
> 
> "Do not call pci_free_irq_vectors() because it is unnecessary when the device is
> managed due to the use of pcim_enable_device()."
> 
> Frank
>>
>>>
>>> And move these small patch ahead in serise.
>>>
>>> Frank
>>>>
>>>> Signed-off-by: Adrian Hunter <adrian.hunter at intel.com>
>>>> ---
>>>>
>>>>
>>>> Changes in V2:
>>>> 	New patch split from "i3c: mipi-i3c-hci-pci: Add support for
>>>> 	Multi-Bus Instances"
>>>>
>>>>
>>>>  drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c | 8 ++++++--
>>>>  1 file changed, 6 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c b/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
>>>> index 8ade911e3835..0fd3587671e1 100644
>>>> --- a/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
>>>> +++ b/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
>>>> @@ -203,6 +203,10 @@ static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
>>>>
>>>>  	pci_set_master(pci);
>>>>
>>>> +	ret = pci_alloc_irq_vectors(pci, 1, 1, PCI_IRQ_ALL_TYPES);
>>>> +	if (ret < 0)
>>>> +		return ret;
>>>> +
>>>>  	memset(&res, 0, sizeof(res));
>>>>
>>>>  	res[0].flags = IORESOURCE_MEM;
>>>> @@ -210,8 +214,8 @@ static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
>>>>  	res[0].end = pci_resource_end(pci, 0);
>>>>
>>>>  	res[1].flags = IORESOURCE_IRQ;
>>>> -	res[1].start = pci->irq;
>>>> -	res[1].end = pci->irq;
>>>> +	res[1].start = pci_irq_vector(hci->pci, 0);
>>>> +	res[1].end = res[1].start;
>>>>
>>>>  	dev_id = ida_alloc(&mipi_i3c_hci_pci_ida, GFP_KERNEL);
>>>>  	if (dev_id < 0)
>>>> --
>>>> 2.51.0
>>>>
>>>>
>>>> --
>>>> linux-i3c mailing list
>>>> linux-i3c at lists.infradead.org
>>>> http://lists.infradead.org/mailman/listinfo/linux-i3c
>>
>>
>> --
>> linux-i3c mailing list
>> linux-i3c at lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-i3c




More information about the linux-i3c mailing list