| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2001 Anton Blanchard <anton@au.ibm.com>, IBM |
|---|
| 3 | | - * |
|---|
| 4 | | - * This program is free software; you can redistribute it and/or |
|---|
| 5 | | - * modify it under the terms of the GNU General Public License |
|---|
| 6 | | - * as published by the Free Software Foundation; either version |
|---|
| 7 | | - * 2 of the License, or (at your option) any later version. |
|---|
| 8 | 4 | * |
|---|
| 9 | 5 | * Communication to userspace based on kernel/printk.c |
|---|
| 10 | 6 | */ |
|---|
| .. | .. |
|---|
| 91 | 87 | return "Dump Notification Event"; |
|---|
| 92 | 88 | case RTAS_TYPE_PRRN: |
|---|
| 93 | 89 | return "Platform Resource Reassignment Event"; |
|---|
| 90 | + case RTAS_TYPE_HOTPLUG: |
|---|
| 91 | + return "Hotplug Event"; |
|---|
| 94 | 92 | } |
|---|
| 95 | 93 | |
|---|
| 96 | 94 | return rtas_type[0]; |
|---|
| .. | .. |
|---|
| 150 | 148 | } else { |
|---|
| 151 | 149 | struct rtas_error_log *errlog = (struct rtas_error_log *)buf; |
|---|
| 152 | 150 | |
|---|
| 153 | | - printk(RTAS_DEBUG "event: %d, Type: %s, Severity: %d\n", |
|---|
| 154 | | - error_log_cnt, rtas_event_type(rtas_error_type(errlog)), |
|---|
| 151 | + printk(RTAS_DEBUG "event: %d, Type: %s (%d), Severity: %d\n", |
|---|
| 152 | + error_log_cnt, |
|---|
| 153 | + rtas_event_type(rtas_error_type(errlog)), |
|---|
| 154 | + rtas_error_type(errlog), |
|---|
| 155 | 155 | rtas_error_severity(errlog)); |
|---|
| 156 | 156 | } |
|---|
| 157 | 157 | } |
|---|
| .. | .. |
|---|
| 273 | 273 | } |
|---|
| 274 | 274 | } |
|---|
| 275 | 275 | |
|---|
| 276 | | -#ifdef CONFIG_PPC_PSERIES |
|---|
| 277 | | -static void handle_prrn_event(s32 scope) |
|---|
| 278 | | -{ |
|---|
| 279 | | - /* |
|---|
| 280 | | - * For PRRN, we must pass the negative of the scope value in |
|---|
| 281 | | - * the RTAS event. |
|---|
| 282 | | - */ |
|---|
| 283 | | - pseries_devicetree_update(-scope); |
|---|
| 284 | | - numa_update_cpu_topology(false); |
|---|
| 285 | | -} |
|---|
| 286 | | - |
|---|
| 287 | 276 | static void handle_rtas_event(const struct rtas_error_log *log) |
|---|
| 288 | 277 | { |
|---|
| 289 | | - if (rtas_error_type(log) != RTAS_TYPE_PRRN || !prrn_is_enabled()) |
|---|
| 278 | + if (!machine_is(pseries)) |
|---|
| 290 | 279 | return; |
|---|
| 291 | 280 | |
|---|
| 292 | | - /* For PRRN Events the extended log length is used to denote |
|---|
| 293 | | - * the scope for calling rtas update-nodes. |
|---|
| 294 | | - */ |
|---|
| 295 | | - handle_prrn_event(rtas_error_extended_log_length(log)); |
|---|
| 281 | + if (rtas_error_type(log) == RTAS_TYPE_PRRN) |
|---|
| 282 | + pr_info_ratelimited("Platform resource reassignment ignored.\n"); |
|---|
| 296 | 283 | } |
|---|
| 297 | | - |
|---|
| 298 | | -#else |
|---|
| 299 | | - |
|---|
| 300 | | -static void handle_rtas_event(const struct rtas_error_log *log) |
|---|
| 301 | | -{ |
|---|
| 302 | | - return; |
|---|
| 303 | | -} |
|---|
| 304 | | - |
|---|
| 305 | | -#endif |
|---|
| 306 | 284 | |
|---|
| 307 | 285 | static int rtas_log_open(struct inode * inode, struct file * file) |
|---|
| 308 | 286 | { |
|---|
| .. | .. |
|---|
| 331 | 309 | |
|---|
| 332 | 310 | count = rtas_error_log_buffer_max; |
|---|
| 333 | 311 | |
|---|
| 334 | | - if (!access_ok(VERIFY_WRITE, buf, count)) |
|---|
| 312 | + if (!access_ok(buf, count)) |
|---|
| 335 | 313 | return -EFAULT; |
|---|
| 336 | 314 | |
|---|
| 337 | 315 | tmp = kmalloc(count, GFP_KERNEL); |
|---|
| .. | .. |
|---|
| 385 | 363 | return 0; |
|---|
| 386 | 364 | } |
|---|
| 387 | 365 | |
|---|
| 388 | | -static const struct file_operations proc_rtas_log_operations = { |
|---|
| 389 | | - .read = rtas_log_read, |
|---|
| 390 | | - .poll = rtas_log_poll, |
|---|
| 391 | | - .open = rtas_log_open, |
|---|
| 392 | | - .release = rtas_log_release, |
|---|
| 393 | | - .llseek = noop_llseek, |
|---|
| 366 | +static const struct proc_ops rtas_log_proc_ops = { |
|---|
| 367 | + .proc_read = rtas_log_read, |
|---|
| 368 | + .proc_poll = rtas_log_poll, |
|---|
| 369 | + .proc_open = rtas_log_open, |
|---|
| 370 | + .proc_release = rtas_log_release, |
|---|
| 371 | + .proc_lseek = noop_llseek, |
|---|
| 394 | 372 | }; |
|---|
| 395 | 373 | |
|---|
| 396 | 374 | static int enable_surveillance(int timeout) |
|---|
| .. | .. |
|---|
| 572 | 550 | return -ENODEV; |
|---|
| 573 | 551 | |
|---|
| 574 | 552 | entry = proc_create("powerpc/rtas/error_log", 0400, NULL, |
|---|
| 575 | | - &proc_rtas_log_operations); |
|---|
| 553 | + &rtas_log_proc_ops); |
|---|
| 576 | 554 | if (!entry) |
|---|
| 577 | 555 | printk(KERN_ERR "Failed to create error_log proc entry\n"); |
|---|
| 578 | 556 | |
|---|