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

tty/hvc_opal: Kick the HVC thread on OPAL console events

The firmware can notify us when new input data is available, so
let's make sure we wakeup the HVC thread in that case.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

+21 -1
+21 -1
drivers/tty/hvc/hvc_opal.c
··· 61 61 /* For early boot console */ 62 62 static struct hvc_opal_priv hvc_opal_boot_priv; 63 63 static u32 hvc_opal_boot_termno; 64 + static bool hvc_opal_event_registered; 64 65 65 66 static const struct hv_ops hvc_opal_raw_ops = { 66 67 .get_chars = opal_get_chars, ··· 162 161 .tiocmset = hvc_opal_hvsi_tiocmset, 163 162 }; 164 163 164 + static int hvc_opal_console_event(struct notifier_block *nb, 165 + unsigned long events, void *change) 166 + { 167 + if (events & OPAL_EVENT_CONSOLE_INPUT) 168 + hvc_kick(); 169 + return 0; 170 + } 171 + 172 + static struct notifier_block hvc_opal_console_nb = { 173 + .notifier_call = hvc_opal_console_event, 174 + }; 175 + 165 176 static int hvc_opal_probe(struct platform_device *dev) 166 177 { 167 178 const struct hv_ops *ops; ··· 182 169 hv_protocol_t proto; 183 170 unsigned int termno, boot = 0; 184 171 const __be32 *reg; 172 + 185 173 186 174 if (of_device_is_compatible(dev->dev.of_node, "ibm,opal-console-raw")) { 187 175 proto = HV_PROTOCOL_RAW; ··· 227 213 dev->dev.of_node->full_name, 228 214 boot ? " (boot console)" : ""); 229 215 230 - /* We don't do IRQ yet */ 216 + /* We don't do IRQ ... */ 231 217 hp = hvc_alloc(termno, 0, ops, MAX_VIO_PUT_CHARS); 232 218 if (IS_ERR(hp)) 233 219 return PTR_ERR(hp); 234 220 dev_set_drvdata(&dev->dev, hp); 221 + 222 + /* ... but we use OPAL event to kick the console */ 223 + if (!hvc_opal_event_registered) { 224 + opal_notifier_register(&hvc_opal_console_nb); 225 + hvc_opal_event_registered = true; 226 + } 235 227 236 228 return 0; 237 229 }