x86: Factor out interrupt_entry macro

Move the interrupt entry code into an assembly macro so that it can be
reused for other interrupts than the NMI.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
x86: Introduce enable_irq and disable_irq inline helpers

To be used soon for APIC interrupt draining.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
x86: Factor out set_idt_int_gate

Encapsulate common code to set an interrupt gate in the IDT. Use a
symbolic constant to represent its flags.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
x86: Clear APIC on INIT emulation and shutdown

Make sure no problematic part of the previous APIC state leaks across
an INIT signal or the shutdown of non-Linux cells. We mask all LVTs,
then ack any interrupts that are marked in the APIC's ISR and finally
drain all interrupts that may be still held in IRR. This is done by
clearing TPR first, thus releasing interrupts that may have been blocked
by a raised task priority. We then briefly enable local interrupts so
that the dummy handler installed for vectors 32-255 can accept and ack
them.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Document VT-d disabling in Linux kernel

We do not support emulating VT-d to the Linux kernel, so we have to
demand disabling it when Jailhouse is used.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>