Skip to content

Commit cf878e1

Browse files
jan-kiszkaKAGA-KOKO
authored andcommitted
x86/jailhouse: Wire up IOAPIC for legacy UART ports
The typical I/O interrupts in non-root cells are MSI-based. However, the platform UARTs do not support MSI. In order to run a non-root cell that shall use one of them, the standard IOAPIC must be registered and 1:1 routing for IRQ 3 and 4 set up. If an IOAPIC is not available, the boot loader clears standard_ioapic in the setup data, so registration is skipped. If the guest is not allowed to to use one of those pins, Jailhouse will simply ignore the access. Signed-off-by: Jan Kiszka <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: [email protected] Link: https://lkml.kernel.org/r/90d942dda9d48a8046e00bb3c1bb6757c83227be.1511770314.git.jan.kiszka@siemens.com
1 parent fd49807 commit cf878e1

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

arch/x86/kernel/jailhouse.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <asm/cpu.h>
1616
#include <asm/hypervisor.h>
1717
#include <asm/i8259.h>
18+
#include <asm/irqdomain.h>
1819
#include <asm/reboot.h>
1920
#include <asm/setup.h>
2021

@@ -52,6 +53,15 @@ static unsigned long jailhouse_get_tsc(void)
5253

5354
static void __init jailhouse_get_smp_config(unsigned int early)
5455
{
56+
struct ioapic_domain_cfg ioapic_cfg = {
57+
.type = IOAPIC_DOMAIN_STRICT,
58+
.ops = &mp_ioapic_irqdomain_ops,
59+
};
60+
struct mpc_intsrc mp_irq = {
61+
.type = MP_INTSRC,
62+
.irqtype = mp_INT,
63+
.irqflag = MP_IRQPOL_ACTIVE_HIGH | MP_IRQTRIG_EDGE,
64+
};
5565
unsigned int cpu;
5666

5767
if (x2apic_enabled()) {
@@ -77,6 +87,17 @@ static void __init jailhouse_get_smp_config(unsigned int early)
7787
}
7888

7989
smp_found_config = 1;
90+
91+
if (setup_data.standard_ioapic) {
92+
mp_register_ioapic(0, 0xfec00000, gsi_top, &ioapic_cfg);
93+
94+
/* Register 1:1 mapping for legacy UART IRQs 3 and 4 */
95+
mp_irq.srcbusirq = mp_irq.dstirq = 3;
96+
mp_save_irq(&mp_irq);
97+
98+
mp_irq.srcbusirq = mp_irq.dstirq = 4;
99+
mp_save_irq(&mp_irq);
100+
}
80101
}
81102

82103
static void jailhouse_no_restart(void)

0 commit comments

Comments
 (0)