forked from torvalds/linux
Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
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 patches. The code from pvpanic.c was split in two new files: - pvpanic.c: generic code that handles pvpanic events - pvpanic-mmio.c: platform/bus dependent code Signed-off-by: Mihai Carabas <mihai.carabas@oracle.com>
- Loading branch information
1 parent
2ab38c1
commit e69d90da4864766e3dc173d0940c05c4ec59278b
Showing
7 changed files
with
115 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,19 @@ | ||
| # SPDX-License-Identifier: GPL-2.0+ | ||
| # | ||
| # Pvpanic Kconfig | ||
| # | ||
| # Copyright (C) 2021 Oracle. | ||
| # | ||
|
|
||
| config PVPANIC | ||
| bool "pvpanic device support" | ||
| help | ||
| This option allows to select a specific pvpanic device driver. | ||
| pvpanic is a paravirtualized device provided by QEMU; it lets | ||
| a virtual machine (guest) communicate panic events to the host. | ||
|
|
||
| config PVPANIC_MMIO | ||
| tristate "pvpanic MMIO device support" | ||
| depends on HAS_IOMEM && (ACPI || OF) && PVPANIC | ||
| help | ||
| This driver provides support for the MMIO pvpanic device. |
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,8 @@ | ||
| # SPDX-License-Identifier: GPL-2.0+ | ||
| # | ||
| # Pvpanic Makefile | ||
| # | ||
| # Copyright (C) 2021 Oracle. | ||
| # | ||
| obj-$(CONFIG_PVPANIC) += pvpanic.o | ||
| obj-$(CONFIG_PVPANIC_MMIO) += pvpanic-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,62 @@ | ||
| // 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); | ||
| } | ||
| EXPORT_SYMBOL_GPL(pvpanic_probe); | ||
|
|
||
| void pvpanic_remove(void) | ||
| { | ||
|
|
||
| atomic_notifier_chain_unregister(&panic_notifier_list, | ||
| &pvpanic_panic_nb); | ||
| base = NULL; | ||
| } | ||
| EXPORT_SYMBOL_GPL(pvpanic_remove); |
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,17 @@ | ||
| // SPDX-License-Identifier: GPL-2.0+ | ||
| /* | ||
| * Pvpanic Device Support | ||
| * | ||
| * Copyright (C) 2021 Oracle. | ||
| */ | ||
|
|
||
| #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_ */ |