diff options
author | Ralf Ramsauer | 2018-01-26 03:43:21 -0600 |
---|---|---|
committer | Jan Kiszka | 2018-01-26 11:13:52 -0600 |
commit | e93f5863b6a0122835f2fd76fe47c634fe8bf3c6 (patch) | |
tree | 657a10678dac6c9c227a16af42b7571ad970832a | |
parent | acd8da5bc878edb43038d0d4149c19b589f3d9ac (diff) | |
download | jailhouse-e93f5863b6a0122835f2fd76fe47c634fe8bf3c6.tar.gz jailhouse-e93f5863b6a0122835f2fd76fe47c634fe8bf3c6.tar.xz jailhouse-e93f5863b6a0122835f2fd76fe47c634fe8bf3c6.zip |
inmates: arm: correct decoding of SGIs
If an IRQ is a SGI, bits 10-12 in the IAR of a GICv2 encode the
requesting CPU.
So far, Jailhouse doesn't set those bits (while it should, refer GICv2
spec!) so we didn't get hurt. Nevertheless, this hits us when issuing
SGIs on bare-metal applications without jailhouse. This patch properly
decodes SGI IRQ numbers by applying a mask to read_ack functions.
Signed-off-by: Ralf Ramsauer <ralf.ramsauer@oth-regensburg.de>
[Jan: Removed unrelated hunk from header]
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
-rw-r--r-- | inmates/lib/arm-common/gic-v2.c | 2 | ||||
-rw-r--r-- | inmates/lib/arm-common/gic-v3.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/inmates/lib/arm-common/gic-v2.c b/inmates/lib/arm-common/gic-v2.c index 69ae9e03..e2c271c3 100644 --- a/inmates/lib/arm-common/gic-v2.c +++ b/inmates/lib/arm-common/gic-v2.c | |||
@@ -77,7 +77,7 @@ static void gic_v2_write_eoi(u32 irqn) | |||
77 | 77 | ||
78 | static u32 gic_v2_read_ack(void) | 78 | static u32 gic_v2_read_ack(void) |
79 | { | 79 | { |
80 | return mmio_read32(GICC_V2_BASE + GICC_IAR); | 80 | return mmio_read32(GICC_V2_BASE + GICC_IAR) & 0x3ff; |
81 | } | 81 | } |
82 | 82 | ||
83 | const struct gic gic_v2 = { | 83 | const struct gic gic_v2 = { |
diff --git a/inmates/lib/arm-common/gic-v3.c b/inmates/lib/arm-common/gic-v3.c index 7666b057..f9278f71 100644 --- a/inmates/lib/arm-common/gic-v3.c +++ b/inmates/lib/arm-common/gic-v3.c | |||
@@ -85,7 +85,7 @@ static u32 gic_v3_read_ack(void) | |||
85 | u32 val; | 85 | u32 val; |
86 | 86 | ||
87 | arm_read_sysreg(ICC_IAR1_EL1, val); | 87 | arm_read_sysreg(ICC_IAR1_EL1, val); |
88 | return val; | 88 | return val & 0xffffff; |
89 | } | 89 | } |
90 | 90 | ||
91 | const struct gic gic_v3 = { | 91 | const struct gic gic_v3 = { |