Re: [PATCH] PCI: dwc: pci-dra7xx: Fix MSI IRQ handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 24/03/20 8:35 pm, Lorenzo Pieralisi wrote:
[...]
>> -static irqreturn_t dra7xx_pcie_msi_irq_handler(int irq, void *arg)
>> +static void dra7xx_pcie_msi_irq_handler(struct irq_desc *desc)
>>  {
>> -	struct dra7xx_pcie *dra7xx = arg;
>> -	struct dw_pcie *pci = dra7xx->pci;
>> -	struct pcie_port *pp = &pci->pp;
>> +	struct irq_chip *chip = irq_desc_get_chip(desc);
>> +	struct dra7xx_pcie *dra7xx;
>> +	struct dw_pcie *pci;
>> +	struct pcie_port *pp;
>>  	unsigned long reg;
>>  	u32 virq, bit;
>> +	int count = 0;
>> +
>> +	chained_irq_enter(chip, desc);
>> +
>> +	pp = irq_desc_get_handler_data(desc);
>> +	pci = to_dw_pcie_from_pp(pp);
>> +	dra7xx = to_dra7xx_pcie(pci);
>>  
>>  	reg = dra7xx_pcie_readl(dra7xx, PCIECTRL_DRA7XX_CONF_IRQSTATUS_MSI);
>> +	dra7xx_pcie_writel(dra7xx, PCIECTRL_DRA7XX_CONF_IRQSTATUS_MSI, reg);
>>  
>>  	switch (reg) {
>>  	case MSI:
>> -		dw_handle_msi_irq(pp);
>> +		/**
>> +		 * Need to make sure all MSI status bits read 0 before
>> +		 * exiting. Else, new MSI IRQs are not registered by the
>> +		 * wrapper. Have an upperbound for the loop and exit the
>> +		 * IRQ in case of IRQ flood to avoid locking up system
>> +		 * in interrupt context.
>> +		 */
>> +		while (dra7xx_pcie_handle_msi_irq(pp) && count < 1000)
>> +			count++;
> 
> Apologies for the delay in replying.
> 
> Do you really need to call the function in a loop ? Can't the loop
> be written inside the function ? It is not going to be any nicer
> but I think it would make code easier to follow. Also, don't know
> if you want to print a warning to signal a count overrun.
> 
> I don't like this code at all but at least it is self-contained
> so we may get it in this cycle.
> 

I have posted v3 with loop moved inside dra7xx_pcie_handle_msi_irq() and
also added dev_warn on overrun. Thanks!

Regard
Vignesh

[...]




[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux