forked from torvalds/linux
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
misc/pvpanic: split-up generic and platform dependent code
Split-up generic and platform dependent code in order to be able to re-use generic event handling code in pvpanic PCI device driver in the next patch. The code from pvpanic.c was split in two new files: - pvpanic-common.c: generic code that handles pvpanic events - mmio.c: platform/bus dependent code Signed-off-by: Mihai Carabas <mihai.carabas@oracle.com>
- Loading branch information
1 parent
2ab38c1
commit 17d14b4
Showing
7 changed files
with
93 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
config PVPANIC | ||
bool "pvpanic device support" | ||
help | ||
This option enables pvpanic device driver. | ||
|
||
config PVPANIC_MMIO | ||
tristate "pvpanic MMIO device support" | ||
depends on HAS_IOMEM && (ACPI || OF) && PVPANIC | ||
help | ||
This driver provides support for the pvpanic device. pvpanic is | ||
a paravirtualized device provided by QEMU; it lets a virtual machine | ||
(guest) communicate panic events to the host. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
obj-$(CONFIG_PVPANIC_MMIO) += pvpanic-mmio.o | ||
pvpanic-mmio-objs := pvpanic-common.o mmio.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// SPDX-License-Identifier: GPL-2.0+ | ||
/* | ||
* Pvpanic Device Support | ||
* | ||
* Copyright (C) 2013 Fujitsu. | ||
* Copyright (C) 2018 ZTE. | ||
* Copyright (C) 2021 Oracle. | ||
*/ | ||
|
||
#include <linux/io.h> | ||
#include <linux/kernel.h> | ||
#include <linux/kexec.h> | ||
#include <linux/mod_devicetable.h> | ||
#include <linux/module.h> | ||
#include <linux/platform_device.h> | ||
#include <linux/types.h> | ||
|
||
#include <uapi/misc/pvpanic.h> | ||
|
||
static void __iomem *base; | ||
|
||
static void | ||
pvpanic_send_event(unsigned int event) | ||
{ | ||
iowrite8(event, base); | ||
} | ||
|
||
static int | ||
pvpanic_panic_notify(struct notifier_block *nb, unsigned long code, | ||
void *unused) | ||
{ | ||
unsigned int event = PVPANIC_PANICKED; | ||
|
||
if (kexec_crash_loaded()) | ||
event = PVPANIC_CRASH_LOADED; | ||
|
||
pvpanic_send_event(event); | ||
|
||
return NOTIFY_DONE; | ||
} | ||
|
||
static struct notifier_block pvpanic_panic_nb = { | ||
.notifier_call = pvpanic_panic_notify, | ||
.priority = 1, /* let this called before broken drm_fb_helper */ | ||
}; | ||
|
||
void pvpanic_probe(void __iomem *pbase) | ||
{ | ||
base = pbase; | ||
atomic_notifier_chain_register(&panic_notifier_list, | ||
&pvpanic_panic_nb); | ||
} | ||
|
||
void pvpanic_remove(void) | ||
{ | ||
|
||
atomic_notifier_chain_unregister(&panic_notifier_list, | ||
&pvpanic_panic_nb); | ||
base = NULL; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#ifndef PVPANIC_H_ | ||
#define PVPANIC_H_ | ||
|
||
|
||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
|
||
void pvpanic_probe(void __iomem *base); | ||
void pvpanic_remove(void); | ||
|
||
#endif /* PVPANIC_H_ */ |