summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
a70819d)
We will reuse it for affinity adjustments on cell creation.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
/* The GIC interface numbering does not necessarily match the logical map */
static u8 target_cpu_map[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
/* The GIC interface numbering does not necessarily match the logical map */
static u8 target_cpu_map[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
+/* Check that the targeted interface belongs to the cell */
+bool gic_targets_in_cell(struct cell *cell, u8 targets)
+{
+ unsigned int cpu;
+
+ for (cpu = 0; cpu < ARRAY_SIZE(target_cpu_map); cpu++)
+ if (targets & target_cpu_map[cpu] &&
+ per_cpu(cpu)->cell != cell)
+ return false;
+
+ return true;
+}
+
/*
* Most of the GIC distributor writes only reconfigure the IRQs corresponding to
* the bits of the written value, by using separate `set' and `clear' registers.
/*
* Most of the GIC distributor writes only reconfigure the IRQs corresponding to
* the bits of the written value, by using separate `set' and `clear' registers.
* access corresponds to the reg index
*/
struct cell *cell = this_cell();
* access corresponds to the reg index
*/
struct cell *cell = this_cell();
unsigned int offset;
u32 access_mask = 0;
unsigned int offset;
u32 access_mask = 0;
targets = (mmio->value >> (8 * i)) & 0xff;
targets = (mmio->value >> (8 * i)) & 0xff;
- /* Check that the targeted interface belongs to the cell */
- for (cpu = 0; cpu < 8; cpu++) {
- if (!(targets & target_cpu_map[cpu]))
- continue;
-
- if (per_cpu(cpu)->cell == cell)
- continue;
-
+ if (!gic_targets_in_cell(cell, targets)) {
printk("Attempt to route IRQ%d outside of cell\n", irq);
return MMIO_ERROR;
}
printk("Attempt to route IRQ%d outside of cell\n", irq);
return MMIO_ERROR;
}
void gic_handle_sgir_write(struct sgi *sgi, bool virt_input);
void gic_handle_irq(struct per_cpu *cpu_data);
void gic_target_spis(struct cell *config_cell, struct cell *dest_cell);
void gic_handle_sgir_write(struct sgi *sgi, bool virt_input);
void gic_handle_irq(struct per_cpu *cpu_data);
void gic_target_spis(struct cell *config_cell, struct cell *dest_cell);
+bool gic_targets_in_cell(struct cell *cell, u8 targets);
#endif /* !__ASSEMBLY__ */
#endif /* !_JAILHOUSE_ASM_GIC_COMMON_H */
#endif /* !__ASSEMBLY__ */
#endif /* !_JAILHOUSE_ASM_GIC_COMMON_H */