Joe Perches
a74ab2ed0d
misc: pvpanic: sysfs_emit uses should have a newline
...
Add newline terminations to the sysfs_emit uses added by -next
commit 8d6da6575f ("misc: pvpanic: introduce events device attribue")
Signed-off-by: Joe Perches <joe@perches.com >
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com >
Link: https://lore.kernel.org/r/13b1c892d52c27d4caeccc89506aadda74f61365.camel@perches.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-02-04 16:56:12 +01:00
zhenwei pi
8d6da6575f
misc: pvpanic: introduce events device attribue
...
Suggested by Paolo & Greg, add 'events' device attribute that can be
used to limit which capabilities the driver uses.
Finally, the pvpanic guest driver works by the limitation of both
device capability and user setting.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com >
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com >
Link: https://lore.kernel.org/r/20210110115358.79100-3-pizhenwei@bytedance.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-01-27 14:28:17 +01:00
zhenwei pi
487709fa1b
misc: pvpanic: introduce device capability
...
According to pvpanic spec:
https://git.qemu.org/?p=qemu.git;a=blob_plain;f=docs/specs/pvpanic.txt
The guest should determine pvpanic capability by RDPT, so initialize
capability during device probing. There is no need to register panic
notifier callback function if no events supported.
Before sending event to host side, check capability firstly.
Suggested by Greg KH, use sysfs to expose capability to user space,
also add new sysfs attribute in document.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com >
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com >
Link: https://lore.kernel.org/r/20210110115358.79100-2-pizhenwei@bytedance.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-01-27 14:28:17 +01:00
Andy Shevchenko
afded6d83a
misc: pvpanic: Check devm_ioport_map() for NULL
...
Inconveniently devm_ioport_map() and devm_ioremap_resource()
return errors differently, i.e. former uses simply NULL pointer,
while the latter an error pointer.
Due to this, we have to check each of them separately.
Fixes: f104060813 ("misc: pvpanic: Combine ACPI and platform drivers")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Link: https://lore.kernel.org/r/20201228184313.57610-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-01-07 20:28:01 +01:00
Andy Shevchenko
2a0387e812
misc: pvpanic: Replace OF headers by mod_devicetable.h
...
There is no use for OF headers in the driver, but mod_devicetable.h
must be included. Update driver accordingly.
Cc: Peng Hao <peng.hao2@zte.com.cn >
Cc: Arnd Bergmann <arnd@arndb.de >
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Link: https://lore.kernel.org/r/20201209203642.27648-5-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-12-10 16:31:46 +01:00
Andy Shevchenko
f104060813
misc: pvpanic: Combine ACPI and platform drivers
...
There is nothing special in the driver that requires to have
a special ACPI driver for it. Combine both into simple
platform driver.
Cc: Peng Hao <peng.hao2@zte.com.cn >
Cc: Arnd Bergmann <arnd@arndb.de >
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Link: https://lore.kernel.org/r/20201209203642.27648-4-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-12-10 16:31:46 +01:00
Wang ShaoBo
a2e7408cf8
misc: pvpanic: Use devm_platform_ioremap_resource()
...
Make use of devm_platform_ioremap_resource() provided by driver
core platform instead of duplicated analogue.
Acked-by: Arnd Bergmann <arn@arndb.de >
Signed-off-by: Wang ShaoBo <bobo.shaobowang@huawei.com >
Link: https://lore.kernel.org/r/20200918083634.33124-1-bobo.shaobowang@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-09-22 18:53:30 +02:00
zhenwei pi
191941692a
misc: pvpanic: add crash loaded event
...
Some users prefer kdump tools to generate guest kernel dumpfile,
at the same time, need a out-of-band kernel panic event.
Currently if booting guest kernel with 'crash_kexec_post_notifiers',
QEMU will receive PVPANIC_PANICKED event and stop VM. If booting
guest kernel without 'crash_kexec_post_notifiers', guest will not
call notifier chain.
Add PVPANIC_CRASH_LOADED bit for pvpanic event, it means that guest
kernel actually hit a kernel panic, but the guest kernel wants to
handle by itself.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com >
Link: https://lore.kernel.org/r/20200102023513.318836-3-pizhenwei@bytedance.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-01-14 15:07:37 +01:00
zhenwei pi
e0b9a42735
misc: pvpanic: move bit definition to uapi header file
...
Some processes outside of the kernel(Ex, QEMU) should know what the
value really is for, so move the bit definition to a uapi file.
Suggested-by: Greg KH <gregkh@linuxfoundation.org >
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com >
Link: https://lore.kernel.org/r/20200102023513.318836-2-pizhenwei@bytedance.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-01-14 15:07:37 +01:00
Anders Roxell
d8e346eb30
misc: pvpanic: fix warning implicit declaration
...
When building and have fragment CONFIG_NO_IOPORT_MAP enabled then the
following warning:
../drivers/misc/pvpanic.c: In function ‘pvpanic_walk_resources’:
../drivers/misc/pvpanic.c:73:10: error: implicit declaration of
function ‘ioport_map’; did you mean ‘ioremap’?
[-Werror=implicit-function-declaration]
base = ioport_map(r.start, resource_size(&r));
^~~~~~~~~~
Since commmit 5d32a66541 ("PCI/ACPI: Allow ACPI to be built without
CONFIG_PCI set"), its now possible to have ACPI enabled without haveing
PCI enabled. However, the pvpanic driver depends on HAS_IOPORT_MAP or
HAVE_IOREMAP_PROT when ACPI is enabled. It was fine until
commit 725eba2928 ("misc/pvpanic: add MMIO support") got added.
Rework so that we do a extra check ifdef CONFIG_HAS_IOPORT_MAP.
Fixes: 5d32a66541 ("PCI/ACPI: Allow ACPI to be built without CONFIG_PCI set")
Suggested-by: Arnd Bergmann <arnd@arndb.de >
Signed-off-by: Anders Roxell <anders.roxell@linaro.org >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-01-18 16:42:05 +01:00
Dan Carpenter
97a64ba77d
misc/pvpanic: fix a NULL vs IS_ERR() check
...
The devm_ioremap_resource() function doesn't return NULL, it returns
error pointers.
Fixes: 46f934c9a1 ("misc/pvpanic: add support to get pvpanic device info FDT")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2018-11-27 08:26:01 +01:00
Peng Hao
78ef4193bb
misc/pvpanic: remove a redundant comma
...
Remove a redundant comma in pvpanic_device_ids.
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Acked-by: Mark Rutland <mark.rutland@arm.com >
Signed-off-by: Peng Hao <peng.hao2@zte.com.cn >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2018-11-07 13:53:04 +01:00
Peng Hao
7247932c7d
misc/pvpanic: convert to SPDX license tags
...
Updates license to use SPDX-License-Identifier instead of
verbose license text.
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Acked-by: Mark Rutland <mark.rutland@arm.com >
Signed-off-by: Peng Hao <peng.hao2@zte.com.cn >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2018-11-07 13:53:04 +01:00
Peng Hao
8eeffed038
misc/pvpanic: change header file sort style
...
Make header files alphabetical order.
Signed-off-by: Peng Hao <peng.hao2@zte.com.cn >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2018-11-07 13:53:04 +01:00
Peng Hao
bfebd5c222
misc/pvpanic: remove unnecessary header file
...
Remove unnecessary header file init.h.
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Acked-by: Mark Rutland <mark.rutland@arm.com >
Signed-off-by: Peng Hao <peng.hao2@zte.com.cn >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2018-11-07 13:53:04 +01:00
Peng Hao
77703e0b03
misc/pvpanic : break dependency on ACPI
...
The pvpanic driver is available for architectures that do not
support ACPI.So break the dependency.
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Signed-off-by: Peng Hao <peng.hao2@zte.com.cn >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2018-11-07 13:53:04 +01:00
Peng Hao
a8b71d2735
misc/pvpanic : grouping ACPI related stuff
...
Grouping ACPI related stuff and make preparation to break
the ACPI dependency w/o any functional change.
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Signed-off-by: Peng Hao <peng.hao2@zte.com.cn >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2018-11-07 13:53:04 +01:00
Peng Hao
46f934c9a1
misc/pvpanic: add support to get pvpanic device info FDT
...
By default, when ACPI tables and FDT coexist for ARM64,
current kernel takes precedence over FDT to get device information.
Virt machine in qemu provides both FDT and ACPI table. Increases the
way to get information through FDT.
Acked-by: Mark Rutland <mark.rutland@arm.com >
Signed-off-by: Peng Hao <peng.hao2@zte.com.cn >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2018-11-07 13:53:04 +01:00
Peng Hao
725eba2928
misc/pvpanic: add MMIO support
...
On some architectures (e.g. arm64), it's preferable to use MMIO, since
this can be used standalone. Add MMIO support to the pvpanic driver.
Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com >
[Use acpi_dev_resource_memory API. - Andy]
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Acked-by: Mark Rutland <mark.rutland@arm.com >
Signed-off-by: Peng Hao <peng.hao2@zte.com.cn >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2018-11-07 13:53:04 +01:00
Peng Hao
d2ae1717f3
misc/pvpanic: simplify the code using acpi_dev_resource_io
...
Use acpi_dev_resource_io API.
Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Acked-by: Mark Rutland <mark.rutland@arm.com >
Signed-off-by: Peng Hao <peng.hao2@zte.com.cn >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2018-11-07 13:53:04 +01:00
Peng Hao
fcb418cd56
pvpanic: move pvpanic to misc as common driver
...
Move pvpanic.c from drivers/platform/x86 to drivers/misc.
Following patches will use pvpanic device in arm64.
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Acked-by: Mark Rutland <mark.rutland@arm.com >
Signed-off-by: Peng Hao <peng.hao2@zte.com.cn >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2018-11-07 13:53:03 +01:00