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>
This commit is contained in:
Marc Zyngier 2016-12-19 19:18:13 +00:00
parent 70cc81edc0
commit adcdb94e31
1 changed files with 11 additions and 10 deletions

View File

@ -684,17 +684,18 @@ static inline u32 its_get_event_id(struct irq_data *d)
return d->hwirq - its_dev->event_map.lpi_base; return d->hwirq - its_dev->event_map.lpi_base;
} }
static void lpi_set_config(struct irq_data *d, bool enable) static void lpi_update_config(struct irq_data *d, u8 clr, u8 set)
{ {
struct its_device *its_dev = irq_data_get_irq_chip_data(d); struct its_device *its_dev = irq_data_get_irq_chip_data(d);
irq_hw_number_t hwirq = d->hwirq; irq_hw_number_t hwirq = d->hwirq;
u32 id = its_get_event_id(d); struct page *prop_page;
u8 *cfg = page_address(gic_rdists->prop_page) + hwirq - 8192; u8 *cfg;
if (enable) prop_page = gic_rdists->prop_page;
*cfg |= LPI_PROP_ENABLED;
else cfg = page_address(prop_page) + hwirq - 8192;
*cfg &= ~LPI_PROP_ENABLED; *cfg &= ~clr;
*cfg |= set;
/* /*
* Make the above write visible to the redistributors. * Make the above write visible to the redistributors.
@ -705,17 +706,17 @@ static void lpi_set_config(struct irq_data *d, bool enable)
gic_flush_dcache_to_poc(cfg, sizeof(*cfg)); gic_flush_dcache_to_poc(cfg, sizeof(*cfg));
else else
dsb(ishst); dsb(ishst);
its_send_inv(its_dev, id); its_send_inv(its_dev, its_get_event_id(d));
} }
static void its_mask_irq(struct irq_data *d) static void its_mask_irq(struct irq_data *d)
{ {
lpi_set_config(d, false); lpi_update_config(d, LPI_PROP_ENABLED, 0);
} }
static void its_unmask_irq(struct irq_data *d) static void its_unmask_irq(struct irq_data *d)
{ {
lpi_set_config(d, true); lpi_update_config(d, 0, LPI_PROP_ENABLED);
} }
static int its_set_affinity(struct irq_data *d, const struct cpumask *mask_val, static int its_set_affinity(struct irq_data *d, const struct cpumask *mask_val,