Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

hvc: Convert to using interrupts instead of opal events

Convert the opal hvc driver to use the new irqchip to register for
opal events. As older firmware versions may not have device tree
bindings for the interrupt parent we just use a hardcoded hwirq based
on the event number.

Signed-off-by: Alistair Popple <alistair@popple.id.au>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

authored by

Alistair Popple and committed by
Michael Ellerman
2def86a7 dce143c3

+10 -23
+10 -23
drivers/tty/hvc/hvc_opal.c
··· 29 29 #include <linux/of.h> 30 30 #include <linux/of_platform.h> 31 31 #include <linux/export.h> 32 + #include <linux/interrupt.h> 32 33 33 34 #include <asm/hvconsole.h> 34 35 #include <asm/prom.h> ··· 62 61 /* For early boot console */ 63 62 static struct hvc_opal_priv hvc_opal_boot_priv; 64 63 static u32 hvc_opal_boot_termno; 65 - static bool hvc_opal_event_registered; 66 64 67 65 static const struct hv_ops hvc_opal_raw_ops = { 68 66 .get_chars = opal_get_chars, ··· 162 162 .tiocmset = hvc_opal_hvsi_tiocmset, 163 163 }; 164 164 165 - static int hvc_opal_console_event(struct notifier_block *nb, 166 - unsigned long events, void *change) 167 - { 168 - if (events & OPAL_EVENT_CONSOLE_INPUT) 169 - hvc_kick(); 170 - return 0; 171 - } 172 - 173 - static struct notifier_block hvc_opal_console_nb = { 174 - .notifier_call = hvc_opal_console_event, 175 - }; 176 - 177 165 static int hvc_opal_probe(struct platform_device *dev) 178 166 { 179 167 const struct hv_ops *ops; 180 168 struct hvc_struct *hp; 181 169 struct hvc_opal_priv *pv; 182 170 hv_protocol_t proto; 183 - unsigned int termno, boot = 0; 171 + unsigned int termno, irq, boot = 0; 184 172 const __be32 *reg; 185 - 186 173 187 174 if (of_device_is_compatible(dev->dev.of_node, "ibm,opal-console-raw")) { 188 175 proto = HV_PROTOCOL_RAW; ··· 214 227 dev->dev.of_node->full_name, 215 228 boot ? " (boot console)" : ""); 216 229 217 - /* We don't do IRQ ... */ 218 - hp = hvc_alloc(termno, 0, ops, MAX_VIO_PUT_CHARS); 230 + irq = opal_event_request(ilog2(OPAL_EVENT_CONSOLE_INPUT)); 231 + if (!irq) { 232 + pr_err("hvc_opal: Unable to map interrupt for device %s\n", 233 + dev->dev.of_node->full_name); 234 + return irq; 235 + } 236 + 237 + hp = hvc_alloc(termno, irq, ops, MAX_VIO_PUT_CHARS); 219 238 if (IS_ERR(hp)) 220 239 return PTR_ERR(hp); 221 240 dev_set_drvdata(&dev->dev, hp); 222 - 223 - /* ... but we use OPAL event to kick the console */ 224 - if (!hvc_opal_event_registered) { 225 - opal_notifier_register(&hvc_opal_console_nb); 226 - hvc_opal_event_registered = true; 227 - } 228 241 229 242 return 0; 230 243 }