linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] add support for pci in the pvpanic driver
@ 2020-10-29 11:43 Mihai Carabas
  2020-10-29 11:43 ` [PATCH 1/4] misc/pvpanic : preparing for pvpanic driver framework Mihai Carabas
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Mihai Carabas @ 2020-10-29 11:43 UTC (permalink / raw)
  To: linux-kernel; +Cc: Mihai Carabas

This patchset adds support for pci in the pvpanic driver. They were assembled
from an old RFC from 2019 [1] which was left unmerged.

In order to test this, you need also to apply the patches I have sent for pci
pvpanic support in qemu [2].

[1] https://lwn.net/ml/linux-kernel/1550575668-6240-1-git-send-email-peng.hao2@zte.com.cn/
[2] https://lists.nongnu.org/archive/html/qemu-devel/2020-10/msg08709.html

Peng Hao (4):
  misc/pvpanic : preparing for pvpanic driver framework
  misc/pvpanic: Add pvpanic driver framework
  misc/pvpanic: Avoid initializing multiple pvpanic devices
  misc/pvpanic: add new pvpanic pci driver

 drivers/misc/Kconfig                |   1 +
 drivers/misc/Makefile               |   2 +-
 drivers/misc/pvpanic.c              | 196 ------------------------------------
 drivers/misc/pvpanic/Kconfig        |  34 +++++++
 drivers/misc/pvpanic/Makefile       |   8 ++
 drivers/misc/pvpanic/pvpanic-acpi.c |  77 ++++++++++++++
 drivers/misc/pvpanic/pvpanic-of.c   |  53 ++++++++++
 drivers/misc/pvpanic/pvpanic-pci.c  |  56 +++++++++++
 drivers/misc/pvpanic/pvpanic.c      | 150 +++++++++++++++++++++++++++
 drivers/misc/pvpanic/pvpanic.h      |  15 +++
 10 files changed, 395 insertions(+), 197 deletions(-)
 delete mode 100644 drivers/misc/pvpanic.c
 create mode 100644 drivers/misc/pvpanic/Kconfig
 create mode 100644 drivers/misc/pvpanic/Makefile
 create mode 100644 drivers/misc/pvpanic/pvpanic-acpi.c
 create mode 100644 drivers/misc/pvpanic/pvpanic-of.c
 create mode 100644 drivers/misc/pvpanic/pvpanic-pci.c
 create mode 100644 drivers/misc/pvpanic/pvpanic.c
 create mode 100644 drivers/misc/pvpanic/pvpanic.h

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/4] misc/pvpanic : preparing for pvpanic driver framework
  2020-10-29 11:43 [PATCH] add support for pci in the pvpanic driver Mihai Carabas
@ 2020-10-29 11:43 ` Mihai Carabas
  2020-10-29 17:02   ` Andy Shevchenko
  2020-10-29 11:43 ` [PATCH 2/4] misc/pvpanic: Add " Mihai Carabas
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: Mihai Carabas @ 2020-10-29 11:43 UTC (permalink / raw)
  To: linux-kernel; +Cc: Peng Hao, Mihai Carabas

From: Peng Hao <peng.hao2@zte.com.cn>

Preparing for pvpanic driver framework. Create a pvpanic driver
directory and move current driver file to new directory.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Peng Hao <peng.hao2@zte.com.cn>
Signed-off-by: Mihai Carabas <mihai.carabas@oracle.com>
---
 drivers/misc/Kconfig           |   1 +
 drivers/misc/Makefile          |   2 +-
 drivers/misc/pvpanic.c         | 196 -----------------------------------------
 drivers/misc/pvpanic/Kconfig   |   7 ++
 drivers/misc/pvpanic/Makefile  |   5 ++
 drivers/misc/pvpanic/pvpanic.c | 196 +++++++++++++++++++++++++++++++++++++++++
 6 files changed, 210 insertions(+), 197 deletions(-)
 delete mode 100644 drivers/misc/pvpanic.c
 create mode 100644 drivers/misc/pvpanic/Kconfig
 create mode 100644 drivers/misc/pvpanic/Makefile
 create mode 100644 drivers/misc/pvpanic/pvpanic.c

diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index d5ce808..6827657 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -466,6 +466,7 @@ config HISI_HIKEY_USB
 	  switching between the dual-role USB-C port and the USB-A host ports
 	  using only one USB controller.
 
+source "drivers/misc/pvpanic/Kconfig"
 source "drivers/misc/c2port/Kconfig"
 source "drivers/misc/eeprom/Kconfig"
 source "drivers/misc/cb710/Kconfig"
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index 2521359..3d6080b 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -53,7 +53,7 @@ obj-$(CONFIG_CXL_BASE)		+= cxl/
 obj-$(CONFIG_PCI_ENDPOINT_TEST)	+= pci_endpoint_test.o
 obj-$(CONFIG_OCXL)		+= ocxl/
 obj-y				+= cardreader/
-obj-$(CONFIG_PVPANIC)   	+= pvpanic.o
+obj-$(CONFIG_PVPANIC)   	+= pvpanic/
 obj-$(CONFIG_HABANA_AI)		+= habanalabs/
 obj-$(CONFIG_UACCE)		+= uacce/
 obj-$(CONFIG_XILINX_SDFEC)	+= xilinx_sdfec.o
diff --git a/drivers/misc/pvpanic.c b/drivers/misc/pvpanic.c
deleted file mode 100644
index e16a5e5..00000000
--- a/drivers/misc/pvpanic.c
+++ /dev/null
@@ -1,196 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- *  Pvpanic Device Support
- *
- *  Copyright (C) 2013 Fujitsu.
- *  Copyright (C) 2018 ZTE.
- */
-
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-#include <linux/acpi.h>
-#include <linux/kernel.h>
-#include <linux/kexec.h>
-#include <linux/module.h>
-#include <linux/of.h>
-#include <linux/of_address.h>
-#include <linux/platform_device.h>
-#include <linux/types.h>
-#include <uapi/misc/pvpanic.h>
-
-static void __iomem *base;
-
-MODULE_AUTHOR("Hu Tao <hutao@cn.fujitsu.com>");
-MODULE_DESCRIPTION("pvpanic device driver");
-MODULE_LICENSE("GPL");
-
-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 */
-};
-
-#ifdef CONFIG_ACPI
-static int pvpanic_add(struct acpi_device *device);
-static int pvpanic_remove(struct acpi_device *device);
-
-static const struct acpi_device_id pvpanic_device_ids[] = {
-	{ "QEMU0001", 0 },
-	{ "", 0 }
-};
-MODULE_DEVICE_TABLE(acpi, pvpanic_device_ids);
-
-static struct acpi_driver pvpanic_driver = {
-	.name =		"pvpanic",
-	.class =	"QEMU",
-	.ids =		pvpanic_device_ids,
-	.ops =		{
-				.add =		pvpanic_add,
-				.remove =	pvpanic_remove,
-			},
-	.owner =	THIS_MODULE,
-};
-
-static acpi_status
-pvpanic_walk_resources(struct acpi_resource *res, void *context)
-{
-	struct resource r;
-
-	if (acpi_dev_resource_io(res, &r)) {
-#ifdef CONFIG_HAS_IOPORT_MAP
-		base = ioport_map(r.start, resource_size(&r));
-		return AE_OK;
-#else
-		return AE_ERROR;
-#endif
-	} else if (acpi_dev_resource_memory(res, &r)) {
-		base = ioremap(r.start, resource_size(&r));
-		return AE_OK;
-	}
-
-	return AE_ERROR;
-}
-
-static int pvpanic_add(struct acpi_device *device)
-{
-	int ret;
-
-	ret = acpi_bus_get_status(device);
-	if (ret < 0)
-		return ret;
-
-	if (!device->status.enabled || !device->status.functional)
-		return -ENODEV;
-
-	acpi_walk_resources(device->handle, METHOD_NAME__CRS,
-			    pvpanic_walk_resources, NULL);
-
-	if (!base)
-		return -ENODEV;
-
-	atomic_notifier_chain_register(&panic_notifier_list,
-				       &pvpanic_panic_nb);
-
-	return 0;
-}
-
-static int pvpanic_remove(struct acpi_device *device)
-{
-
-	atomic_notifier_chain_unregister(&panic_notifier_list,
-					 &pvpanic_panic_nb);
-	iounmap(base);
-
-	return 0;
-}
-
-static int pvpanic_register_acpi_driver(void)
-{
-	return acpi_bus_register_driver(&pvpanic_driver);
-}
-
-static void pvpanic_unregister_acpi_driver(void)
-{
-	acpi_bus_unregister_driver(&pvpanic_driver);
-}
-#else
-static int pvpanic_register_acpi_driver(void)
-{
-	return -ENODEV;
-}
-
-static void pvpanic_unregister_acpi_driver(void) {}
-#endif
-
-static int pvpanic_mmio_probe(struct platform_device *pdev)
-{
-	base = devm_platform_ioremap_resource(pdev, 0);
-	if (IS_ERR(base))
-		return PTR_ERR(base);
-
-	atomic_notifier_chain_register(&panic_notifier_list,
-				       &pvpanic_panic_nb);
-
-	return 0;
-}
-
-static int pvpanic_mmio_remove(struct platform_device *pdev)
-{
-
-	atomic_notifier_chain_unregister(&panic_notifier_list,
-					 &pvpanic_panic_nb);
-
-	return 0;
-}
-
-static const struct of_device_id pvpanic_mmio_match[] = {
-	{ .compatible = "qemu,pvpanic-mmio", },
-	{}
-};
-
-static struct platform_driver pvpanic_mmio_driver = {
-	.driver = {
-		.name = "pvpanic-mmio",
-		.of_match_table = pvpanic_mmio_match,
-	},
-	.probe = pvpanic_mmio_probe,
-	.remove = pvpanic_mmio_remove,
-};
-
-static int __init pvpanic_mmio_init(void)
-{
-	if (acpi_disabled)
-		return platform_driver_register(&pvpanic_mmio_driver);
-	else
-		return pvpanic_register_acpi_driver();
-}
-
-static void __exit pvpanic_mmio_exit(void)
-{
-	if (acpi_disabled)
-		platform_driver_unregister(&pvpanic_mmio_driver);
-	else
-		pvpanic_unregister_acpi_driver();
-}
-
-module_init(pvpanic_mmio_init);
-module_exit(pvpanic_mmio_exit);
diff --git a/drivers/misc/pvpanic/Kconfig b/drivers/misc/pvpanic/Kconfig
new file mode 100644
index 00000000..3e612c6
--- /dev/null
+++ b/drivers/misc/pvpanic/Kconfig
@@ -0,0 +1,7 @@
+config PVPANIC
+	tristate "pvpanic device support"
+	depends on HAS_IOMEM && (ACPI || OF)
+	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.
diff --git a/drivers/misc/pvpanic/Makefile b/drivers/misc/pvpanic/Makefile
new file mode 100644
index 00000000..b8e6dc5
--- /dev/null
+++ b/drivers/misc/pvpanic/Makefile
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Copyright (c) 2018 ZTE Ltd.
+
+obj-$(CONFIG_PVPANIC)            += pvpanic.o
diff --git a/drivers/misc/pvpanic/pvpanic.c b/drivers/misc/pvpanic/pvpanic.c
new file mode 100644
index 00000000..e16a5e5
--- /dev/null
+++ b/drivers/misc/pvpanic/pvpanic.c
@@ -0,0 +1,196 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ *  Pvpanic Device Support
+ *
+ *  Copyright (C) 2013 Fujitsu.
+ *  Copyright (C) 2018 ZTE.
+ */
+
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+#include <linux/acpi.h>
+#include <linux/kernel.h>
+#include <linux/kexec.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/platform_device.h>
+#include <linux/types.h>
+#include <uapi/misc/pvpanic.h>
+
+static void __iomem *base;
+
+MODULE_AUTHOR("Hu Tao <hutao@cn.fujitsu.com>");
+MODULE_DESCRIPTION("pvpanic device driver");
+MODULE_LICENSE("GPL");
+
+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 */
+};
+
+#ifdef CONFIG_ACPI
+static int pvpanic_add(struct acpi_device *device);
+static int pvpanic_remove(struct acpi_device *device);
+
+static const struct acpi_device_id pvpanic_device_ids[] = {
+	{ "QEMU0001", 0 },
+	{ "", 0 }
+};
+MODULE_DEVICE_TABLE(acpi, pvpanic_device_ids);
+
+static struct acpi_driver pvpanic_driver = {
+	.name =		"pvpanic",
+	.class =	"QEMU",
+	.ids =		pvpanic_device_ids,
+	.ops =		{
+				.add =		pvpanic_add,
+				.remove =	pvpanic_remove,
+			},
+	.owner =	THIS_MODULE,
+};
+
+static acpi_status
+pvpanic_walk_resources(struct acpi_resource *res, void *context)
+{
+	struct resource r;
+
+	if (acpi_dev_resource_io(res, &r)) {
+#ifdef CONFIG_HAS_IOPORT_MAP
+		base = ioport_map(r.start, resource_size(&r));
+		return AE_OK;
+#else
+		return AE_ERROR;
+#endif
+	} else if (acpi_dev_resource_memory(res, &r)) {
+		base = ioremap(r.start, resource_size(&r));
+		return AE_OK;
+	}
+
+	return AE_ERROR;
+}
+
+static int pvpanic_add(struct acpi_device *device)
+{
+	int ret;
+
+	ret = acpi_bus_get_status(device);
+	if (ret < 0)
+		return ret;
+
+	if (!device->status.enabled || !device->status.functional)
+		return -ENODEV;
+
+	acpi_walk_resources(device->handle, METHOD_NAME__CRS,
+			    pvpanic_walk_resources, NULL);
+
+	if (!base)
+		return -ENODEV;
+
+	atomic_notifier_chain_register(&panic_notifier_list,
+				       &pvpanic_panic_nb);
+
+	return 0;
+}
+
+static int pvpanic_remove(struct acpi_device *device)
+{
+
+	atomic_notifier_chain_unregister(&panic_notifier_list,
+					 &pvpanic_panic_nb);
+	iounmap(base);
+
+	return 0;
+}
+
+static int pvpanic_register_acpi_driver(void)
+{
+	return acpi_bus_register_driver(&pvpanic_driver);
+}
+
+static void pvpanic_unregister_acpi_driver(void)
+{
+	acpi_bus_unregister_driver(&pvpanic_driver);
+}
+#else
+static int pvpanic_register_acpi_driver(void)
+{
+	return -ENODEV;
+}
+
+static void pvpanic_unregister_acpi_driver(void) {}
+#endif
+
+static int pvpanic_mmio_probe(struct platform_device *pdev)
+{
+	base = devm_platform_ioremap_resource(pdev, 0);
+	if (IS_ERR(base))
+		return PTR_ERR(base);
+
+	atomic_notifier_chain_register(&panic_notifier_list,
+				       &pvpanic_panic_nb);
+
+	return 0;
+}
+
+static int pvpanic_mmio_remove(struct platform_device *pdev)
+{
+
+	atomic_notifier_chain_unregister(&panic_notifier_list,
+					 &pvpanic_panic_nb);
+
+	return 0;
+}
+
+static const struct of_device_id pvpanic_mmio_match[] = {
+	{ .compatible = "qemu,pvpanic-mmio", },
+	{}
+};
+
+static struct platform_driver pvpanic_mmio_driver = {
+	.driver = {
+		.name = "pvpanic-mmio",
+		.of_match_table = pvpanic_mmio_match,
+	},
+	.probe = pvpanic_mmio_probe,
+	.remove = pvpanic_mmio_remove,
+};
+
+static int __init pvpanic_mmio_init(void)
+{
+	if (acpi_disabled)
+		return platform_driver_register(&pvpanic_mmio_driver);
+	else
+		return pvpanic_register_acpi_driver();
+}
+
+static void __exit pvpanic_mmio_exit(void)
+{
+	if (acpi_disabled)
+		platform_driver_unregister(&pvpanic_mmio_driver);
+	else
+		pvpanic_unregister_acpi_driver();
+}
+
+module_init(pvpanic_mmio_init);
+module_exit(pvpanic_mmio_exit);
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/4] misc/pvpanic: Add pvpanic driver framework
  2020-10-29 11:43 [PATCH] add support for pci in the pvpanic driver Mihai Carabas
  2020-10-29 11:43 ` [PATCH 1/4] misc/pvpanic : preparing for pvpanic driver framework Mihai Carabas
@ 2020-10-29 11:43 ` Mihai Carabas
  2020-10-29 13:48   ` kernel test robot
  2020-10-29 14:48   ` kernel test robot
  2020-10-29 11:43 ` [PATCH 3/4] misc/pvpanic: Avoid initializing multiple pvpanic devices Mihai Carabas
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 9+ messages in thread
From: Mihai Carabas @ 2020-10-29 11:43 UTC (permalink / raw)
  To: linux-kernel; +Cc: Peng Hao, Mihai Carabas

From: Peng Hao <peng.hao2@zte.com.cn>

Add pvpanic driver framework and split the original pvpanic acpi/of
driver as the two separate files and modify code to adapt the framework.

Signed-off-by: Peng Hao <peng.hao2@zte.com.cn>
Signed-off-by: Mihai Carabas <mihai.carabas@oracle.com>
---
 drivers/misc/pvpanic/Kconfig        |  19 ++++
 drivers/misc/pvpanic/Makefile       |   2 +
 drivers/misc/pvpanic/pvpanic-acpi.c |  77 ++++++++++++++++
 drivers/misc/pvpanic/pvpanic-of.c   |  53 +++++++++++
 drivers/misc/pvpanic/pvpanic.c      | 177 ++++++++++++------------------------
 drivers/misc/pvpanic/pvpanic.h      |  15 +++
 6 files changed, 224 insertions(+), 119 deletions(-)
 create mode 100644 drivers/misc/pvpanic/pvpanic-acpi.c
 create mode 100644 drivers/misc/pvpanic/pvpanic-of.c
 create mode 100644 drivers/misc/pvpanic/pvpanic.h

diff --git a/drivers/misc/pvpanic/Kconfig b/drivers/misc/pvpanic/Kconfig
index 3e612c6..0c0c0b2 100644
--- a/drivers/misc/pvpanic/Kconfig
+++ b/drivers/misc/pvpanic/Kconfig
@@ -5,3 +5,22 @@ config PVPANIC
 	  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.
+
+if PVPANIC
+
+config PVPANIC_ACPI
+	tristate "pvpanic acpi driver"
+	depends on ACPI
+	default PVPANIC
+	help
+	  This driver is one specific driver for pvpanic driver framework.
+	  It provides an acpi device as pvpanic device.
+
+config PVPANIC_OF
+	tristate "pvpanic mmio driver"
+	depends on OF
+	help
+	  This driver is one specific driver for pvpanic driver framework.
+	  It provides a mmio device as pvpanic device.
+
+endif
diff --git a/drivers/misc/pvpanic/Makefile b/drivers/misc/pvpanic/Makefile
index b8e6dc5..ffd11b1 100644
--- a/drivers/misc/pvpanic/Makefile
+++ b/drivers/misc/pvpanic/Makefile
@@ -3,3 +3,5 @@
 # Copyright (c) 2018 ZTE Ltd.
 
 obj-$(CONFIG_PVPANIC)            += pvpanic.o
+obj-$(CONFIG_PVPANIC_ACPI)       += pvpanic-acpi.o
+obj-$(CONFIG_PVPANIC_OF)         += pvpanic-of.o
diff --git a/drivers/misc/pvpanic/pvpanic-acpi.c b/drivers/misc/pvpanic/pvpanic-acpi.c
new file mode 100644
index 00000000..8d10924
--- /dev/null
+++ b/drivers/misc/pvpanic/pvpanic-acpi.c
@@ -0,0 +1,77 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ *  pvpanic acpi driver.
+ *
+ *  Copyright (C) 2019 ZTE Ltd.
+ *  Author: Peng Hao
+ */
+#include <linux/acpi.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/types.h>
+#include "pvpanic.h"
+
+static int pvpanic_add(struct acpi_device *device);
+static int pvpanic_remove(struct acpi_device *device);
+
+static const struct acpi_device_id pvpanic_device_ids[] = {
+	{ "QEMU0001", 0 },
+	{ "", 0 }
+};
+MODULE_DEVICE_TABLE(acpi, pvpanic_device_ids);
+
+static struct acpi_driver pvpanic_driver = {
+	.name =         "pvpanic",
+	.class =        "QEMU",
+	.ids =          pvpanic_device_ids,
+	.ops =          {
+				.add =          pvpanic_add,
+				.remove =       pvpanic_remove,
+			},
+	.owner =        THIS_MODULE,
+};
+
+static acpi_status
+pvpanic_walk_resources(struct acpi_resource *res, void *context)
+{
+	struct resource r;
+	int ret = 0;
+	struct device *dev = context;
+
+	memset(&r, 0, sizeof(r));
+	if (acpi_dev_resource_io(res, &r) || acpi_dev_resource_memory(res, &r))
+		ret = pvpanic_add_device(dev, &r);
+
+	if (!ret)
+		return AE_OK;
+
+	return AE_ERROR;
+}
+static int pvpanic_add(struct acpi_device *device)
+{
+	int ret;
+	acpi_status status;
+
+	ret = acpi_bus_get_status(device);
+	if (ret < 0)
+		return ret;
+
+	if (!device->status.enabled || !device->status.functional)
+		return -ENODEV;
+
+	status = acpi_walk_resources(device->handle, METHOD_NAME__CRS,
+				     pvpanic_walk_resources, &device->dev);
+
+	if (ACPI_FAILURE(status))
+		return -ENODEV;
+
+	return 0;
+}
+
+static int pvpanic_remove(struct acpi_device *device)
+{
+	pvpanic_remove_device();
+	return 0;
+}
+
+module_acpi_driver(pvpanic_driver);
diff --git a/drivers/misc/pvpanic/pvpanic-of.c b/drivers/misc/pvpanic/pvpanic-of.c
new file mode 100644
index 00000000..73ca5f3
--- /dev/null
+++ b/drivers/misc/pvpanic/pvpanic-of.c
@@ -0,0 +1,53 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ *  pvpanic of driver.
+ *
+ *  Copyright (C) 2019 ZTE Ltd.
+ *  Author: Peng Hao <peng.hao2@zte.com.cn>
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/platform_device.h>
+#include <linux/types.h>
+#include "pvpanic.h"
+
+static int pvpanic_mmio_probe(struct platform_device *pdev)
+{
+	struct resource *res;
+	int ret;
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res)
+		return -EINVAL;
+
+	ret = pvpanic_add_device(&pdev->dev, res);
+	if (ret)
+		return -ENODEV;
+
+	return 0;
+}
+
+static int pvpanic_mmio_remove(struct platform_device *pdev)
+{
+	pvpanic_remove_device();
+	return 0;
+}
+
+static const struct of_device_id pvpanic_mmio_match[] = {
+	{ .compatible = "qemu,pvpanic-mmio", },
+	{}
+};
+
+static struct platform_driver pvpanic_mmio_driver = {
+	.driver = {
+		.name = "pvpanic-mmio",
+		.of_match_table = pvpanic_mmio_match,
+	},
+	.probe = pvpanic_mmio_probe,
+	.remove = pvpanic_mmio_remove,
+};
+
+module_platform_driver(pvpanic_mmio_driver);
diff --git a/drivers/misc/pvpanic/pvpanic.c b/drivers/misc/pvpanic/pvpanic.c
index e16a5e5..4c831f5 100644
--- a/drivers/misc/pvpanic/pvpanic.c
+++ b/drivers/misc/pvpanic/pvpanic.c
@@ -8,17 +8,19 @@
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
-#include <linux/acpi.h>
+#include <linux/io.h>
 #include <linux/kernel.h>
 #include <linux/kexec.h>
 #include <linux/module.h>
-#include <linux/of.h>
-#include <linux/of_address.h>
 #include <linux/platform_device.h>
 #include <linux/types.h>
 #include <uapi/misc/pvpanic.h>
 
-static void __iomem *base;
+static struct {
+	struct platform_device *pdev;
+	void __iomem *base;
+	bool is_ioport;
+} pvpanic_data;
 
 MODULE_AUTHOR("Hu Tao <hutao@cn.fujitsu.com>");
 MODULE_DESCRIPTION("pvpanic device driver");
@@ -27,7 +29,7 @@
 static void
 pvpanic_send_event(unsigned int event)
 {
-	iowrite8(event, base);
+	iowrite8(event, pvpanic_data.base);
 }
 
 static int
@@ -49,148 +51,85 @@
 	.priority = 1, /* let this called before broken drm_fb_helper */
 };
 
-#ifdef CONFIG_ACPI
-static int pvpanic_add(struct acpi_device *device);
-static int pvpanic_remove(struct acpi_device *device);
-
-static const struct acpi_device_id pvpanic_device_ids[] = {
-	{ "QEMU0001", 0 },
-	{ "", 0 }
-};
-MODULE_DEVICE_TABLE(acpi, pvpanic_device_ids);
-
-static struct acpi_driver pvpanic_driver = {
-	.name =		"pvpanic",
-	.class =	"QEMU",
-	.ids =		pvpanic_device_ids,
-	.ops =		{
-				.add =		pvpanic_add,
-				.remove =	pvpanic_remove,
-			},
-	.owner =	THIS_MODULE,
-};
-
-static acpi_status
-pvpanic_walk_resources(struct acpi_resource *res, void *context)
-{
-	struct resource r;
-
-	if (acpi_dev_resource_io(res, &r)) {
-#ifdef CONFIG_HAS_IOPORT_MAP
-		base = ioport_map(r.start, resource_size(&r));
-		return AE_OK;
-#else
-		return AE_ERROR;
-#endif
-	} else if (acpi_dev_resource_memory(res, &r)) {
-		base = ioremap(r.start, resource_size(&r));
-		return AE_OK;
-	}
-
-	return AE_ERROR;
-}
-
-static int pvpanic_add(struct acpi_device *device)
+int pvpanic_add_device(struct device *dev, struct resource *res)
 {
+	struct platform_device *pdev;
 	int ret;
 
-	ret = acpi_bus_get_status(device);
-	if (ret < 0)
-		return ret;
+	pdev = platform_device_alloc("pvpanic", -1);
+	if (!pdev)
+		return -ENOMEM;
 
-	if (!device->status.enabled || !device->status.functional)
-		return -ENODEV;
+	pdev->dev.parent = dev;
 
-	acpi_walk_resources(device->handle, METHOD_NAME__CRS,
-			    pvpanic_walk_resources, NULL);
+	ret = platform_device_add_resources(pdev, res, 1);
+	if (ret)
+		goto err;
 
-	if (!base)
-		return -ENODEV;
-
-	atomic_notifier_chain_register(&panic_notifier_list,
-				       &pvpanic_panic_nb);
+	ret = platform_device_add(pdev);
+	if (ret)
+		goto err;
+	pvpanic_data.pdev = pdev;
 
 	return 0;
+err:
+	platform_device_put(pdev);
+	return ret;
 }
+EXPORT_SYMBOL_GPL(pvpanic_add_device);
 
-static int pvpanic_remove(struct acpi_device *device)
+void pvpanic_remove_device(void)
 {
-
-	atomic_notifier_chain_unregister(&panic_notifier_list,
-					 &pvpanic_panic_nb);
-	iounmap(base);
-
-	return 0;
+	platform_device_unregister(pvpanic_data.pdev);
+	pvpanic_data.pdev = NULL;
 }
+EXPORT_SYMBOL_GPL(pvpanic_remove_device);
 
-static int pvpanic_register_acpi_driver(void)
+static int pvpanic_platform_probe(struct platform_device *pdev)
 {
-	return acpi_bus_register_driver(&pvpanic_driver);
-}
-
-static void pvpanic_unregister_acpi_driver(void)
-{
-	acpi_bus_unregister_driver(&pvpanic_driver);
-}
-#else
-static int pvpanic_register_acpi_driver(void)
-{
-	return -ENODEV;
-}
-
-static void pvpanic_unregister_acpi_driver(void) {}
-#endif
-
-static int pvpanic_mmio_probe(struct platform_device *pdev)
-{
-	base = devm_platform_ioremap_resource(pdev, 0);
-	if (IS_ERR(base))
-		return PTR_ERR(base);
+	struct device *dev = &pdev->dev;
+	struct resource *res;
+	void __iomem *base;
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (res) {
+		base = devm_ioremap_resource(dev, res);
+		if (IS_ERR(base))
+			return -ENODEV;
+	} else {
+		res = platform_get_resource(pdev, IORESOURCE_IO, 0);
+		if (!res)
+			return -ENODEV;
+
+		base = ioport_map(res->start, resource_size(res));
+		if (!base)
+			return -ENODEV;
+		pvpanic_data.is_ioport = true;
+	}
 
+	pvpanic_data.base = base;
 	atomic_notifier_chain_register(&panic_notifier_list,
 				       &pvpanic_panic_nb);
 
 	return 0;
 }
 
-static int pvpanic_mmio_remove(struct platform_device *pdev)
+static int pvpanic_platform_remove(struct platform_device *pdev)
 {
-
 	atomic_notifier_chain_unregister(&panic_notifier_list,
 					 &pvpanic_panic_nb);
+	if (pvpanic_data.is_ioport)
+		iounmap(pvpanic_data.base);
 
 	return 0;
 }
 
-static const struct of_device_id pvpanic_mmio_match[] = {
-	{ .compatible = "qemu,pvpanic-mmio", },
-	{}
-};
-
-static struct platform_driver pvpanic_mmio_driver = {
+static struct platform_driver pvpanic_driver = {
+	.probe = pvpanic_platform_probe,
+	.remove = pvpanic_platform_remove,
 	.driver = {
-		.name = "pvpanic-mmio",
-		.of_match_table = pvpanic_mmio_match,
-	},
-	.probe = pvpanic_mmio_probe,
-	.remove = pvpanic_mmio_remove,
+		.name = "pvpanic",
+	}
 };
 
-static int __init pvpanic_mmio_init(void)
-{
-	if (acpi_disabled)
-		return platform_driver_register(&pvpanic_mmio_driver);
-	else
-		return pvpanic_register_acpi_driver();
-}
-
-static void __exit pvpanic_mmio_exit(void)
-{
-	if (acpi_disabled)
-		platform_driver_unregister(&pvpanic_mmio_driver);
-	else
-		pvpanic_unregister_acpi_driver();
-}
-
-module_init(pvpanic_mmio_init);
-module_exit(pvpanic_mmio_exit);
+module_platform_driver(pvpanic_driver);
diff --git a/drivers/misc/pvpanic/pvpanic.h b/drivers/misc/pvpanic/pvpanic.h
new file mode 100644
index 00000000..5823d72
--- /dev/null
+++ b/drivers/misc/pvpanic/pvpanic.h
@@ -0,0 +1,15 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/* pvpanic driver framework header file
+ *
+ * Copyright (C) 2019 ZTE Ltd.
+ *
+ * Author: Peng Hao <peng.hao2@zte.com.cn>
+ */
+
+#ifndef __DRIVERS_MISC_PVPANIC_H
+#define __DRIVERS_MISC_PVPANIC_H
+
+extern int pvpanic_add_device(struct device *dev, struct resource *res);
+extern void pvpanic_remove_device(void);
+
+#endif
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/4] misc/pvpanic: Avoid initializing multiple pvpanic devices
  2020-10-29 11:43 [PATCH] add support for pci in the pvpanic driver Mihai Carabas
  2020-10-29 11:43 ` [PATCH 1/4] misc/pvpanic : preparing for pvpanic driver framework Mihai Carabas
  2020-10-29 11:43 ` [PATCH 2/4] misc/pvpanic: Add " Mihai Carabas
@ 2020-10-29 11:43 ` Mihai Carabas
  2020-10-29 11:43 ` [PATCH 4/4] misc/pvpanic: add new pvpanic pci driver Mihai Carabas
  2020-11-23 13:18 ` Re [PATCH] add support for pci in the pvpanic driver Mihai Carabas
  4 siblings, 0 replies; 9+ messages in thread
From: Mihai Carabas @ 2020-10-29 11:43 UTC (permalink / raw)
  To: linux-kernel; +Cc: Peng Hao, Mihai Carabas

From: Peng Hao <peng.hao2@zte.com.cn>

Avoid initializing multiple pvpanic devices when configure multiple
pvpanic device driver type. Make sure that only one pvpanic device
is working.

Signed-off-by: Peng Hao <peng.hao2@zte.com.cn>
Signed-off-by: Mihai Carabas <mihai.carabas@oracle.com>
---
 drivers/misc/pvpanic/pvpanic.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/drivers/misc/pvpanic/pvpanic.c b/drivers/misc/pvpanic/pvpanic.c
index 4c831f5..8c7b534 100644
--- a/drivers/misc/pvpanic/pvpanic.c
+++ b/drivers/misc/pvpanic/pvpanic.c
@@ -17,10 +17,13 @@
 #include <uapi/misc/pvpanic.h>
 
 static struct {
+	struct mutex lock;
 	struct platform_device *pdev;
 	void __iomem *base;
 	bool is_ioport;
-} pvpanic_data;
+} pvpanic_data = {
+	.lock = __MUTEX_INITIALIZER(pvpanic_data.lock),
+};
 
 MODULE_AUTHOR("Hu Tao <hutao@cn.fujitsu.com>");
 MODULE_DESCRIPTION("pvpanic device driver");
@@ -56,9 +59,17 @@ int pvpanic_add_device(struct device *dev, struct resource *res)
 	struct platform_device *pdev;
 	int ret;
 
+	mutex_lock(&pvpanic_data.lock);
+	if (pvpanic_data.pdev) {
+		mutex_unlock(&pvpanic_data.lock);
+		return -EEXIST;
+	}
+
 	pdev = platform_device_alloc("pvpanic", -1);
-	if (!pdev)
+	if (!pdev) {
+		mutex_unlock(&pvpanic_data.lock);
 		return -ENOMEM;
+	}
 
 	pdev->dev.parent = dev;
 
@@ -70,9 +81,11 @@ int pvpanic_add_device(struct device *dev, struct resource *res)
 	if (ret)
 		goto err;
 	pvpanic_data.pdev = pdev;
+	mutex_unlock(&pvpanic_data.lock);
 
 	return 0;
 err:
+	mutex_unlock(&pvpanic_data.lock);
 	platform_device_put(pdev);
 	return ret;
 }
@@ -80,8 +93,10 @@ int pvpanic_add_device(struct device *dev, struct resource *res)
 
 void pvpanic_remove_device(void)
 {
+	mutex_lock(&pvpanic_data.lock);
 	platform_device_unregister(pvpanic_data.pdev);
 	pvpanic_data.pdev = NULL;
+	mutex_unlock(&pvpanic_data.lock);
 }
 EXPORT_SYMBOL_GPL(pvpanic_remove_device);
 
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/4] misc/pvpanic: add new pvpanic pci driver
  2020-10-29 11:43 [PATCH] add support for pci in the pvpanic driver Mihai Carabas
                   ` (2 preceding siblings ...)
  2020-10-29 11:43 ` [PATCH 3/4] misc/pvpanic: Avoid initializing multiple pvpanic devices Mihai Carabas
@ 2020-10-29 11:43 ` Mihai Carabas
  2020-11-23 13:18 ` Re [PATCH] add support for pci in the pvpanic driver Mihai Carabas
  4 siblings, 0 replies; 9+ messages in thread
From: Mihai Carabas @ 2020-10-29 11:43 UTC (permalink / raw)
  To: linux-kernel; +Cc: Peng Hao, Mihai Carabas

From: Peng Hao <peng.hao2@zte.com.cn>

Add new pvpanic pci driver to pvpanic driver framework.

Signed-off-by: Peng Hao <peng.hao2@zte.com.cn>
Signed-off-by: Mihai Carabas <mihai.carabas@oracle.com>
---
 drivers/misc/pvpanic/Kconfig       | 10 ++++++-
 drivers/misc/pvpanic/Makefile      |  1 +
 drivers/misc/pvpanic/pvpanic-pci.c | 56 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 66 insertions(+), 1 deletion(-)
 create mode 100644 drivers/misc/pvpanic/pvpanic-pci.c

diff --git a/drivers/misc/pvpanic/Kconfig b/drivers/misc/pvpanic/Kconfig
index 0c0c0b2..866cb37 100644
--- a/drivers/misc/pvpanic/Kconfig
+++ b/drivers/misc/pvpanic/Kconfig
@@ -1,6 +1,6 @@
 config PVPANIC
 	tristate "pvpanic device support"
-	depends on HAS_IOMEM && (ACPI || OF)
+	depends on HAS_IOMEM && (ACPI || OF || PCI)
 	help
 	  This driver provides support for the pvpanic device.  pvpanic is
 	  a paravirtualized device provided by QEMU; it lets a virtual machine
@@ -23,4 +23,12 @@ config PVPANIC_OF
 	  This driver is one specific driver for pvpanic driver framework.
 	  It provides a mmio device as pvpanic device.
 
+config PVPANIC_PCI
+	tristate "pvpanic pci driver"
+	depends on PCI
+	default PVPANIC
+	help
+	  This driver is one specific driver for pvpanic driver framework.
+	  It provides a pci device as pvpanic device.
+
 endif
diff --git a/drivers/misc/pvpanic/Makefile b/drivers/misc/pvpanic/Makefile
index ffd11b1..45d0a60 100644
--- a/drivers/misc/pvpanic/Makefile
+++ b/drivers/misc/pvpanic/Makefile
@@ -5,3 +5,4 @@
 obj-$(CONFIG_PVPANIC)            += pvpanic.o
 obj-$(CONFIG_PVPANIC_ACPI)       += pvpanic-acpi.o
 obj-$(CONFIG_PVPANIC_OF)         += pvpanic-of.o
+obj-$(CONFIG_PVPANIC_PCI)        += pvpanic-pci.o
diff --git a/drivers/misc/pvpanic/pvpanic-pci.c b/drivers/misc/pvpanic/pvpanic-pci.c
new file mode 100644
index 00000000..1261710
--- /dev/null
+++ b/drivers/misc/pvpanic/pvpanic-pci.c
@@ -0,0 +1,56 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ *  pvpanic acpi driver.
+ *
+ *  Copyright (C) 2019 ZTE Ltd.
+ *  Author: Peng Hao <peng.hao2@zte.com.cn>
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/pci.h>
+#include <linux/types.h>
+#include "pvpanic.h"
+
+#define PCI_VENDOR_ID_REDHAT             0x1b36
+#define PCI_DEVICE_ID_REDHAT_PVPANIC     0x0101
+
+static const struct pci_device_id pvpanic_pci_id_tbl[]  = {
+	{ PCI_DEVICE(PCI_VENDOR_ID_REDHAT, PCI_DEVICE_ID_REDHAT_PVPANIC),},
+	{}
+};
+
+static int pvpanic_pci_probe(struct pci_dev *pdev,
+			     const struct pci_device_id *ent)
+{
+	int ret;
+	struct resource res;
+
+	ret = pcim_enable_device(pdev);
+	if (ret < 0)
+		return ret;
+
+	memset(&res, 0, sizeof(res));
+	res.start = pci_resource_start(pdev, 0);
+	res.end = pci_resource_end(pdev, 0);
+	res.flags = IORESOURCE_MEM;
+	ret = pvpanic_add_device(&pdev->dev, &res);
+	if (ret)
+		return ret;
+
+	return 0;
+}
+
+static void pvpanic_pci_remove(struct pci_dev *pdev)
+{
+	pvpanic_remove_device();
+}
+
+static struct pci_driver pvpanic_pci_driver = {
+	.name =         "pvpanic-pci",
+	.id_table =     pvpanic_pci_id_tbl,
+	.probe =        pvpanic_pci_probe,
+	.remove =       pvpanic_pci_remove,
+};
+
+module_pci_driver(pvpanic_pci_driver);
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/4] misc/pvpanic: Add pvpanic driver framework
  2020-10-29 11:43 ` [PATCH 2/4] misc/pvpanic: Add " Mihai Carabas
@ 2020-10-29 13:48   ` kernel test robot
  2020-10-29 14:48   ` kernel test robot
  1 sibling, 0 replies; 9+ messages in thread
From: kernel test robot @ 2020-10-29 13:48 UTC (permalink / raw)
  To: Mihai Carabas, linux-kernel; +Cc: kbuild-all, Peng Hao, Mihai Carabas

[-- Attachment #1: Type: text/plain, Size: 3036 bytes --]

Hi Mihai,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on char-misc/char-misc-testing]
[also build test WARNING on linus/master v5.10-rc1 next-20201028]
[cannot apply to linux/master]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Mihai-Carabas/misc-pvpanic-preparing-for-pvpanic-driver-framework/20201029-204304
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git 3650b228f83adda7e5ee532e2b90429c03f7b9ec
config: xtensa-allyesconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/d8f90ef175d20a5e55607c7dafea596286bb7a64
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Mihai-Carabas/misc-pvpanic-preparing-for-pvpanic-driver-framework/20201029-204304
        git checkout d8f90ef175d20a5e55607c7dafea596286bb7a64
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=xtensa 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/misc/pvpanic/pvpanic.c:54:5: warning: no previous prototype for 'pvpanic_add_device' [-Wmissing-prototypes]
      54 | int pvpanic_add_device(struct device *dev, struct resource *res)
         |     ^~~~~~~~~~~~~~~~~~
>> drivers/misc/pvpanic/pvpanic.c:81:6: warning: no previous prototype for 'pvpanic_remove_device' [-Wmissing-prototypes]
      81 | void pvpanic_remove_device(void)
         |      ^~~~~~~~~~~~~~~~~~~~~

vim +/pvpanic_add_device +54 drivers/misc/pvpanic/pvpanic.c

    53	
  > 54	int pvpanic_add_device(struct device *dev, struct resource *res)
    55	{
    56		struct platform_device *pdev;
    57		int ret;
    58	
    59		pdev = platform_device_alloc("pvpanic", -1);
    60		if (!pdev)
    61			return -ENOMEM;
    62	
    63		pdev->dev.parent = dev;
    64	
    65		ret = platform_device_add_resources(pdev, res, 1);
    66		if (ret)
    67			goto err;
    68	
    69		ret = platform_device_add(pdev);
    70		if (ret)
    71			goto err;
    72		pvpanic_data.pdev = pdev;
    73	
    74		return 0;
    75	err:
    76		platform_device_put(pdev);
    77		return ret;
    78	}
    79	EXPORT_SYMBOL_GPL(pvpanic_add_device);
    80	
  > 81	void pvpanic_remove_device(void)
    82	{
    83		platform_device_unregister(pvpanic_data.pdev);
    84		pvpanic_data.pdev = NULL;
    85	}
    86	EXPORT_SYMBOL_GPL(pvpanic_remove_device);
    87	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 66180 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/4] misc/pvpanic: Add pvpanic driver framework
  2020-10-29 11:43 ` [PATCH 2/4] misc/pvpanic: Add " Mihai Carabas
  2020-10-29 13:48   ` kernel test robot
@ 2020-10-29 14:48   ` kernel test robot
  1 sibling, 0 replies; 9+ messages in thread
From: kernel test robot @ 2020-10-29 14:48 UTC (permalink / raw)
  To: Mihai Carabas, linux-kernel; +Cc: kbuild-all, Peng Hao, Mihai Carabas

[-- Attachment #1: Type: text/plain, Size: 3638 bytes --]

Hi Mihai,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on char-misc/char-misc-testing]
[also build test ERROR on linus/master v5.10-rc1 next-20201029]
[cannot apply to linux/master]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Mihai-Carabas/misc-pvpanic-preparing-for-pvpanic-driver-framework/20201029-204304
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git 3650b228f83adda7e5ee532e2b90429c03f7b9ec
config: openrisc-randconfig-r001-20201029 (attached as .config)
compiler: or1k-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/d8f90ef175d20a5e55607c7dafea596286bb7a64
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Mihai-Carabas/misc-pvpanic-preparing-for-pvpanic-driver-framework/20201029-204304
        git checkout d8f90ef175d20a5e55607c7dafea596286bb7a64
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=openrisc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All error/warnings (new ones prefixed by >>):

   drivers/misc/pvpanic/pvpanic.c:54:5: warning: no previous prototype for 'pvpanic_add_device' [-Wmissing-prototypes]
      54 | int pvpanic_add_device(struct device *dev, struct resource *res)
         |     ^~~~~~~~~~~~~~~~~~
   drivers/misc/pvpanic/pvpanic.c:81:6: warning: no previous prototype for 'pvpanic_remove_device' [-Wmissing-prototypes]
      81 | void pvpanic_remove_device(void)
         |      ^~~~~~~~~~~~~~~~~~~~~
   drivers/misc/pvpanic/pvpanic.c: In function 'pvpanic_platform_probe':
>> drivers/misc/pvpanic/pvpanic.c:104:10: error: implicit declaration of function 'ioport_map'; did you mean 'ioremap'? [-Werror=implicit-function-declaration]
     104 |   base = ioport_map(res->start, resource_size(res));
         |          ^~~~~~~~~~
         |          ioremap
>> drivers/misc/pvpanic/pvpanic.c:104:8: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     104 |   base = ioport_map(res->start, resource_size(res));
         |        ^
   cc1: some warnings being treated as errors

vim +104 drivers/misc/pvpanic/pvpanic.c

    87	
    88	static int pvpanic_platform_probe(struct platform_device *pdev)
    89	{
    90		struct device *dev = &pdev->dev;
    91		struct resource *res;
    92		void __iomem *base;
    93	
    94		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
    95		if (res) {
    96			base = devm_ioremap_resource(dev, res);
    97			if (IS_ERR(base))
    98				return -ENODEV;
    99		} else {
   100			res = platform_get_resource(pdev, IORESOURCE_IO, 0);
   101			if (!res)
   102				return -ENODEV;
   103	
 > 104			base = ioport_map(res->start, resource_size(res));
   105			if (!base)
   106				return -ENODEV;
   107			pvpanic_data.is_ioport = true;
   108		}
   109	
   110		pvpanic_data.base = base;
   111		atomic_notifier_chain_register(&panic_notifier_list,
   112					       &pvpanic_panic_nb);
   113	
   114		return 0;
   115	}
   116	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 28929 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/4] misc/pvpanic : preparing for pvpanic driver framework
  2020-10-29 11:43 ` [PATCH 1/4] misc/pvpanic : preparing for pvpanic driver framework Mihai Carabas
@ 2020-10-29 17:02   ` Andy Shevchenko
  0 siblings, 0 replies; 9+ messages in thread
From: Andy Shevchenko @ 2020-10-29 17:02 UTC (permalink / raw)
  To: Mihai Carabas; +Cc: Linux Kernel Mailing List, Peng Hao

On Thu, Oct 29, 2020 at 2:28 PM Mihai Carabas <mihai.carabas@oracle.com> wrote:
>
> From: Peng Hao <peng.hao2@zte.com.cn>
>
> Preparing for pvpanic driver framework. Create a pvpanic driver
> directory and move current driver file to new directory.

Hmm... It was a bit of a long time...
Have you seen [1]?

[1]: https://lore.kernel.org/lkml/20201027175806.20305-1-andriy.shevchenko@linux.intel.com/

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re [PATCH] add support for pci in the pvpanic driver
  2020-10-29 11:43 [PATCH] add support for pci in the pvpanic driver Mihai Carabas
                   ` (3 preceding siblings ...)
  2020-10-29 11:43 ` [PATCH 4/4] misc/pvpanic: add new pvpanic pci driver Mihai Carabas
@ 2020-11-23 13:18 ` Mihai Carabas
  4 siblings, 0 replies; 9+ messages in thread
From: Mihai Carabas @ 2020-11-23 13:18 UTC (permalink / raw)
  To: mihai.carabas; +Cc: linux-kernel

@Andy:

>Hmm... It was a bit of a long time...
>Have you seen [1]?

>[1]:
>https://lore.kernel.org/lkml/20201027175806.20305-1->andriy.shevche...@linux.intel.com/

I have seen that patchset after I sent mine. Do you want me to rebase and redo
the the pvpanic patchset of adding PCI support on top of yours? Or were you
refering at the fact that I added your Rb? 


Any other feedback on this patchset?

Thank you,
Mihai Carabas

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-11-23 15:09 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-29 11:43 [PATCH] add support for pci in the pvpanic driver Mihai Carabas
2020-10-29 11:43 ` [PATCH 1/4] misc/pvpanic : preparing for pvpanic driver framework Mihai Carabas
2020-10-29 17:02   ` Andy Shevchenko
2020-10-29 11:43 ` [PATCH 2/4] misc/pvpanic: Add " Mihai Carabas
2020-10-29 13:48   ` kernel test robot
2020-10-29 14:48   ` kernel test robot
2020-10-29 11:43 ` [PATCH 3/4] misc/pvpanic: Avoid initializing multiple pvpanic devices Mihai Carabas
2020-10-29 11:43 ` [PATCH 4/4] misc/pvpanic: add new pvpanic pci driver Mihai Carabas
2020-11-23 13:18 ` Re [PATCH] add support for pci in the pvpanic driver Mihai Carabas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).