Commit 81f2f7ce authored by Alistair Popple's avatar Alistair Popple Committed by Michael Ellerman

opal: Remove events notifier

All users of the old opal events notifier have been converted over to
the irq domain so remove the event notifier functions.
Signed-off-by: default avatarAlistair Popple <alistair@popple.id.au>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 8034f715
...@@ -100,7 +100,6 @@ void opal_handle_events(uint64_t events) ...@@ -100,7 +100,6 @@ void opal_handle_events(uint64_t events)
{ {
int virq, hwirq = 0; int virq, hwirq = 0;
u64 mask = opal_event_irqchip.mask; u64 mask = opal_event_irqchip.mask;
u64 notifier_mask = 0;
if (!in_irq() && (events & mask)) { if (!in_irq() && (events & mask)) {
last_outstanding_events = events; last_outstanding_events = events;
...@@ -108,19 +107,16 @@ void opal_handle_events(uint64_t events) ...@@ -108,19 +107,16 @@ void opal_handle_events(uint64_t events)
return; return;
} }
while (events) { while (events & mask) {
hwirq = fls64(events) - 1; hwirq = fls64(events) - 1;
if (BIT_ULL(hwirq) & mask) {
virq = irq_find_mapping(opal_event_irqchip.domain, virq = irq_find_mapping(opal_event_irqchip.domain,
hwirq); hwirq);
if (virq) { if (virq)
if (BIT_ULL(hwirq) & mask)
generic_handle_irq(virq); generic_handle_irq(virq);
} else }
notifier_mask |= BIT_ULL(hwirq);
events &= ~BIT_ULL(hwirq); events &= ~BIT_ULL(hwirq);
} }
opal_do_notifier(notifier_mask);
} }
static irqreturn_t opal_interrupt(int irq, void *data) static irqreturn_t opal_interrupt(int irq, void *data)
......
...@@ -53,11 +53,7 @@ static int mc_recoverable_range_len; ...@@ -53,11 +53,7 @@ static int mc_recoverable_range_len;
struct device_node *opal_node; struct device_node *opal_node;
static DEFINE_SPINLOCK(opal_write_lock); static DEFINE_SPINLOCK(opal_write_lock);
static ATOMIC_NOTIFIER_HEAD(opal_notifier_head);
static struct atomic_notifier_head opal_msg_notifier_head[OPAL_MSG_TYPE_MAX]; static struct atomic_notifier_head opal_msg_notifier_head[OPAL_MSG_TYPE_MAX];
static DEFINE_SPINLOCK(opal_notifier_lock);
static uint64_t last_notified_mask = 0x0ul;
static atomic_t opal_notifier_hold = ATOMIC_INIT(0);
static uint32_t opal_heartbeat; static uint32_t opal_heartbeat;
static void opal_reinit_cores(void) static void opal_reinit_cores(void)
...@@ -223,82 +219,6 @@ static int __init opal_register_exception_handlers(void) ...@@ -223,82 +219,6 @@ static int __init opal_register_exception_handlers(void)
} }
machine_early_initcall(powernv, opal_register_exception_handlers); machine_early_initcall(powernv, opal_register_exception_handlers);
int opal_notifier_register(struct notifier_block *nb)
{
if (!nb) {
pr_warning("%s: Invalid argument (%p)\n",
__func__, nb);
return -EINVAL;
}
atomic_notifier_chain_register(&opal_notifier_head, nb);
return 0;
}
EXPORT_SYMBOL_GPL(opal_notifier_register);
int opal_notifier_unregister(struct notifier_block *nb)
{
if (!nb) {
pr_warning("%s: Invalid argument (%p)\n",
__func__, nb);
return -EINVAL;
}
atomic_notifier_chain_unregister(&opal_notifier_head, nb);
return 0;
}
EXPORT_SYMBOL_GPL(opal_notifier_unregister);
void opal_do_notifier(uint64_t events)
{
unsigned long flags;
uint64_t changed_mask;
if (atomic_read(&opal_notifier_hold))
return;
spin_lock_irqsave(&opal_notifier_lock, flags);
changed_mask = last_notified_mask ^ events;
last_notified_mask = events;
spin_unlock_irqrestore(&opal_notifier_lock, flags);
/*
* We feed with the event bits and changed bits for
* enough information to the callback.
*/
atomic_notifier_call_chain(&opal_notifier_head,
events, (void *)changed_mask);
}
void opal_notifier_update_evt(uint64_t evt_mask,
uint64_t evt_val)
{
unsigned long flags;
spin_lock_irqsave(&opal_notifier_lock, flags);
last_notified_mask &= ~evt_mask;
last_notified_mask |= evt_val;
spin_unlock_irqrestore(&opal_notifier_lock, flags);
}
void opal_notifier_enable(void)
{
int64_t rc;
__be64 evt = 0;
atomic_set(&opal_notifier_hold, 0);
/* Process pending events */
rc = opal_poll_events(&evt);
if (rc == OPAL_SUCCESS && evt)
opal_do_notifier(be64_to_cpu(evt));
}
void opal_notifier_disable(void)
{
atomic_set(&opal_notifier_hold, 1);
}
/* /*
* Opal message notifier based on message type. Allow subscribers to get * Opal message notifier based on message type. Allow subscribers to get
* notified for specific messgae type. * notified for specific messgae type.
...@@ -570,10 +490,8 @@ int opal_handle_hmi_exception(struct pt_regs *regs) ...@@ -570,10 +490,8 @@ int opal_handle_hmi_exception(struct pt_regs *regs)
local_paca->hmi_event_available = 0; local_paca->hmi_event_available = 0;
rc = opal_poll_events(&evt); rc = opal_poll_events(&evt);
if (rc == OPAL_SUCCESS && evt) { if (rc == OPAL_SUCCESS && evt)
opal_do_notifier(be64_to_cpu(evt));
opal_handle_events(be64_to_cpu(evt)); opal_handle_events(be64_to_cpu(evt));
}
return 1; return 1;
} }
......
...@@ -35,7 +35,6 @@ extern u32 pnv_get_supported_cpuidle_states(void); ...@@ -35,7 +35,6 @@ extern u32 pnv_get_supported_cpuidle_states(void);
extern void pnv_lpc_init(void); extern void pnv_lpc_init(void);
extern void opal_do_notifier(uint64_t events);
extern void opal_handle_events(uint64_t events); extern void opal_handle_events(uint64_t events);
extern void opal_event_shutdown(void); extern void opal_event_shutdown(void);
......
...@@ -107,7 +107,7 @@ static void pnv_prepare_going_down(void) ...@@ -107,7 +107,7 @@ static void pnv_prepare_going_down(void)
* Disable all notifiers from OPAL, we can't * Disable all notifiers from OPAL, we can't
* service interrupts anymore anyway * service interrupts anymore anyway
*/ */
opal_notifier_disable(); opal_event_shutdown();
/* Soft disable interrupts */ /* Soft disable interrupts */
local_irq_disable(); local_irq_disable();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment