Skip to content

Commit adcdb94

Browse files
author
Marc Zyngier
committed
irqchip/gic-v3-its: Generalize LPI configuration
We're are going to need to change a bit more than just the enable bit in the LPI property table in the future. So let's change the LPI configuration funtion to take a set of bits to be cleared, and a set of bits to be set. This way, we'll be able to use it when a guest updates an LPI property (priority, for example). Reviewed-by: Eric Auger <eric.auger@redhat.com> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
1 parent 70cc81e commit adcdb94

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

drivers/irqchip/irq-gic-v3-its.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -684,17 +684,18 @@ static inline u32 its_get_event_id(struct irq_data *d)
684684
return d->hwirq - its_dev->event_map.lpi_base;
685685
}
686686

687-
static void lpi_set_config(struct irq_data *d, bool enable)
687+
static void lpi_update_config(struct irq_data *d, u8 clr, u8 set)
688688
{
689689
struct its_device *its_dev = irq_data_get_irq_chip_data(d);
690690
irq_hw_number_t hwirq = d->hwirq;
691-
u32 id = its_get_event_id(d);
692-
u8 *cfg = page_address(gic_rdists->prop_page) + hwirq - 8192;
691+
struct page *prop_page;
692+
u8 *cfg;
693693

694-
if (enable)
695-
*cfg |= LPI_PROP_ENABLED;
696-
else
697-
*cfg &= ~LPI_PROP_ENABLED;
694+
prop_page = gic_rdists->prop_page;
695+
696+
cfg = page_address(prop_page) + hwirq - 8192;
697+
*cfg &= ~clr;
698+
*cfg |= set;
698699

699700
/*
700701
* Make the above write visible to the redistributors.
@@ -705,17 +706,17 @@ static void lpi_set_config(struct irq_data *d, bool enable)
705706
gic_flush_dcache_to_poc(cfg, sizeof(*cfg));
706707
else
707708
dsb(ishst);
708-
its_send_inv(its_dev, id);
709+
its_send_inv(its_dev, its_get_event_id(d));
709710
}
710711

711712
static void its_mask_irq(struct irq_data *d)
712713
{
713-
lpi_set_config(d, false);
714+
lpi_update_config(d, LPI_PROP_ENABLED, 0);
714715
}
715716

716717
static void its_unmask_irq(struct irq_data *d)
717718
{
718-
lpi_set_config(d, true);
719+
lpi_update_config(d, 0, LPI_PROP_ENABLED);
719720
}
720721

721722
static int its_set_affinity(struct irq_data *d, const struct cpumask *mask_val,

0 commit comments

Comments
 (0)