From 89d2468d964e635eb80d4d00c29074a28d0e6d19 Mon Sep 17 00:00:00 2001 From: Cédric Le Goater Date: Wed, 1 Sep 2021 11:41:51 +0200 Subject: ppc/xive: Export priority_to_ipb() helper Signed-off-by: Cédric Le Goater Message-Id: <20210901094153.227671-7-clg@kaod.org> Signed-off-by: David Gibson --- include/hw/ppc/xive.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'include') diff --git a/include/hw/ppc/xive.h b/include/hw/ppc/xive.h index db76411654..29b130eaea 100644 --- a/include/hw/ppc/xive.h +++ b/include/hw/ppc/xive.h @@ -458,6 +458,17 @@ struct XiveENDSource { */ #define XIVE_PRIORITY_MAX 7 +/* + * Convert a priority number to an Interrupt Pending Buffer (IPB) + * register, which indicates a pending interrupt at the priority + * corresponding to the bit number + */ +static inline uint8_t xive_priority_to_ipb(uint8_t priority) +{ + return priority > XIVE_PRIORITY_MAX ? + 0 : 1 << (XIVE_PRIORITY_MAX - priority); +} + /* * XIVE Thread Interrupt Management Aera (TIMA) * -- cgit v1.2.3-55-g7522