arch/armv7[a|r]: Implement up_affinity_irq

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2022-09-18 18:49:12 +08:00 committed by Masayuki Ishikawa
parent 17ac85eb0a
commit 079a6fa6cc
3 changed files with 66 additions and 0 deletions

View File

@ -504,6 +504,33 @@ int up_prioritize_irq(int irq, int priority)
return -EINVAL;
}
/****************************************************************************
* Name: up_affinity_irq
*
* Description:
* Set an IRQ affinity by software.
*
****************************************************************************/
void up_affinity_irq(int irq, cpu_set_t cpuset)
{
if (irq >= GIC_IRQ_SPI && irq < NR_IRQS)
{
uintptr_t regaddr;
uint32_t regval;
/* Write the new cpuset to the corresponding field in the in the
* distributor Interrupt Processor Target Register (GIC_ICDIPTR).
*/
regaddr = GIC_ICDIPTR(irq);
regval = getreg32(regaddr);
regval &= ~GIC_ICDIPTR_ID_MASK(irq);
regval |= GIC_ICDIPTR_ID(irq, cpuset);
putreg32(regval, regaddr);
}
}
/****************************************************************************
* Name: up_trigger_irq
*

View File

@ -503,6 +503,33 @@ int up_prioritize_irq(int irq, int priority)
return -EINVAL;
}
/****************************************************************************
* Name: up_affinity_irq
*
* Description:
* Set an IRQ affinity by software.
*
****************************************************************************/
void up_affinity_irq(int irq, cpu_set_t cpuset)
{
if (irq >= GIC_IRQ_SPI && irq < NR_IRQS)
{
uintptr_t regaddr;
uint32_t regval;
/* Write the new cpuset to the corresponding field in the in the
* distributor Interrupt Processor Target Register (GIC_ICDIPTR).
*/
regaddr = GIC_ICDIPTR(irq);
regval = getreg32(regaddr);
regval &= ~GIC_ICDIPTR_ID_MASK(irq);
regval |= GIC_ICDIPTR_ID(irq, cpuset);
putreg32(regval, regaddr);
}
}
/****************************************************************************
* Name: up_trigger_irq
*

View File

@ -1489,6 +1489,18 @@ void up_enable_irq(int irq);
void up_disable_irq(int irq);
#endif
/****************************************************************************
* Name: up_affinity_irq
*
* Description:
* Set an IRQ affinity by software.
*
****************************************************************************/
#ifdef CONFIG_SMP
void up_affinity_irq(int irq, cpu_set_t cpuset);
#endif
/****************************************************************************
* Name: up_trigger_irq
*