[PATCH v4 08/11] PCI: microchip: Move IRQ init functions to pcie-plda-host.c

Minda Chen minda.chen at starfivetech.com
Thu Aug 31 20:57:44 PDT 2023



On 2023/8/25 20:09, Conor Dooley wrote:
> Daire, can you look at this one too please?
> 
> On Fri, Aug 25, 2023 at 05:01:26PM +0800, Minda Chen wrote:
>> Move IRQ init functions to pcie-plda-host.c.
>> mc_handle_event() is merged to plda_handle_event().
>> Set most of the IRQ functions to static in pcie-plda-host.c
>> 
>> Signed-off-by: Minda Chen <minda.chen at starfivetech.com>
> 
>> -void plda_handle_event(struct irq_desc *desc)
>> +static void plda_handle_event(struct irq_desc *desc)
>>  {
>>  	struct plda_pcie_rp *port = irq_desc_get_handler_data(desc);
>>  	struct irq_chip *chip = irq_desc_get_chip(desc);
>> @@ -264,14 +268,18 @@ void plda_handle_event(struct irq_desc *desc)
>>  
>>  	chained_irq_enter(chip, desc);
>>  
>> -	val = readl_relaxed(port->bridge_addr + ISTATUS_LOCAL);
>> -	origin = val;
>> -	val = val >> A_ATR_EVT_POST_ERR_SHIFT;
>> -	events |= val & 0xff;
>> -	if (origin & PM_MSI_INT_INTX_MASK)
>> -		events |= BIT(EVENT_PM_MSI_INT_INTX);
>> -	val = (origin >> PM_MSI_INT_MSI_SHIFT) & 0xf;
>> -	events |= val << EVENT_PM_MSI_INT_MSI;
>> +	if (port->ops && port->ops->get_events) {
> 
> I still don't love the dancing here. Can you just always register a
> callback?
> 
> Thanks,
> Conor.
> 
OK, Thanks.
>> +		events = port->ops->get_events(port);
>> +	} else {
>> +		val = readl_relaxed(port->bridge_addr + ISTATUS_LOCAL);
>> +		origin = val;
>> +		val = val >> A_ATR_EVT_POST_ERR_SHIFT;
>> +		events |= val & 0xff;
>> +		if (origin & PM_MSI_INT_INTX_MASK)
>> +			events |= BIT(EVENT_PM_MSI_INT_INTX);
>> +		val = (origin >> PM_MSI_INT_MSI_SHIFT) & 0xf;
>> +		events |= val << EVENT_PM_MSI_INT_MSI;
>> +	}
>>  
>>  	for_each_set_bit(bit, &events, port->num_events)
>>  		generic_handle_domain_irq(port->event_domain, bit);



More information about the linux-riscv mailing list