ppc/xive: introduce the XIVE interrupt thread context
commit207d9fe98510eaac575bfde8d1be58137e9a22ff
authorCédric Le Goater <clg@kaod.org>
Sun, 9 Dec 2018 19:45:53 +0000 (9 20:45 +0100)
committerDavid Gibson <david@gibson.dropbear.id.au>
Thu, 20 Dec 2018 22:29:12 +0000 (21 09:29 +1100)
treee30eb6504a5314034c23aeb2c7a35e57c008a5c0
parent002686be42784fdce4c1c8ecd1987ddf740cab77
ppc/xive: introduce the XIVE interrupt thread context

Each POWER9 processor chip has a XIVE presenter that can generate four
different exceptions to its threads:

  - hypervisor exception,
  - O/S exception
  - Event-Based Branch (EBB)
  - msgsnd (doorbell).

Each exception has a state independent from the others called a Thread
Interrupt Management context. This context is a set of registers which
lets the thread handle priority management and interrupt acknowledgment
among other things. The most important ones being :

  - Interrupt Priority Register  (PIPR)
  - Interrupt Pending Buffer     (IPB)
  - Current Processor Priority   (CPPR)
  - Notification Source Register (NSR)

These registers are accessible through a specific MMIO region, called
the Thread Interrupt Management Area (TIMA), four aligned pages, each
exposing a different view of the registers. First page (page address
ending in 0b00) gives access to the entire context and is reserved for
the ring 0 view for the physical thread context. The second (page
address ending in 0b01) is for the hypervisor, ring 1 view. The third
(page address ending in 0b10) is for the operating system, ring 2
view. The fourth (page address ending in 0b11) is for user level, ring
3 view.

The thread interrupt context is modeled with a XiveTCTX object
containing the values of the different exception registers. The TIMA
region is mapped at the same address for each CPU.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
hw/intc/xive.c
include/hw/ppc/xive.h
include/hw/ppc/xive_regs.h