linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V4 1/3]  misc/pvpanic: return 0 for empty body register function
@ 2018-12-18  9:46 Peng Hao
  2018-12-18  9:46 ` [PATCH V4 2/3] misc/pvpanic : add pci interface for pvpanic Peng Hao
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Peng Hao @ 2018-12-18  9:46 UTC (permalink / raw)
  To: gregkh, arnd, andy.shevchenko; +Cc: linux-kernel, Peng Hao

Return 0 for empty body register function normally.

Signed-off-by: Peng Hao <peng.hao2@zte.com.cn>
---
QEMU community requires additional PCI devices to simulate PVPANIC devices
so that some architectures can not occupy precious less than 4G of memory 
space.

 drivers/misc/pvpanic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/pvpanic.c b/drivers/misc/pvpanic.c
index 3150dc2..f84ed30 100644
--- a/drivers/misc/pvpanic.c
+++ b/drivers/misc/pvpanic.c
@@ -125,7 +125,7 @@ static void pvpanic_unregister_acpi_driver(void)
 #else
 static int pvpanic_register_acpi_driver(void)
 {
-	return -ENODEV;
+	return 0;
 }
 
 static void pvpanic_unregister_acpi_driver(void) {}
-- 
1.8.3.1


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

* [PATCH V4 2/3]  misc/pvpanic : add pci interface for pvpanic
  2018-12-18  9:46 [PATCH V4 1/3] misc/pvpanic: return 0 for empty body register function Peng Hao
@ 2018-12-18  9:46 ` Peng Hao
  2018-12-18 13:31   ` kbuild test robot
  2018-12-18 13:38   ` kbuild test robot
  2018-12-18  9:46 ` [PATCH V4 3/3] misc/pvpanic : add pci dependency in Kconfig Peng Hao
  2018-12-18 10:28 ` [PATCH V4 1/3] misc/pvpanic: return 0 for empty body register function Greg KH
  2 siblings, 2 replies; 7+ messages in thread
From: Peng Hao @ 2018-12-18  9:46 UTC (permalink / raw)
  To: gregkh, arnd, andy.shevchenko; +Cc: linux-kernel, Peng Hao

Support pvpanic as a pci device in guest kernel.

Signed-off-by: Peng Hao <peng.hao2@zte.com.cn>
---
 drivers/misc/pvpanic.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 70 insertions(+), 2 deletions(-)

diff --git a/drivers/misc/pvpanic.c b/drivers/misc/pvpanic.c
index f84ed30..c30bf62 100644
--- a/drivers/misc/pvpanic.c
+++ b/drivers/misc/pvpanic.c
@@ -13,9 +13,12 @@
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
+#include <linux/pci.h>
 #include <linux/platform_device.h>
 #include <linux/types.h>
 
+#define PCI_VENDOR_ID_REDHAT             0x1b36
+#define PCI_DEVICE_ID_REDHAT_PVPANIC     0x0101
 static void __iomem *base;
 
 #define PVPANIC_PANICKED        (1 << 0)
@@ -172,12 +175,76 @@ static int pvpanic_mmio_remove(struct platform_device *pdev)
 	.remove = pvpanic_mmio_remove,
 };
 
+#ifdef CONFIG_PCI
+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;
+
+	ret = pcim_enable_device(pdev);
+	if (ret < 0)
+		return ret;
+
+	ret = pcim_iomap_regions(pdev, 1 << 0, pci_name(pdev));
+	if (ret)
+		return ret;
+
+	base = pcim_iomap_table(pdev)[0];
+
+	atomic_notifier_chain_register(&panic_notifier_list,
+				       &pvpanic_panic_nb);
+	return 0;
+}
+
+static void pvpanic_pci_remove(struct pci_dev *pdev)
+{
+	atomic_notifier_chain_unregister(&panic_notifier_list,
+					 &pvpanic_panic_nb);
+}
+
+static struct pci_driver pvpanic_pci_driver = {
+	.name =         "pvpanic-pci",
+	.id_table =     pvpanic_pci_id_tbl,
+	.probe =        pvpanic_pci_probe,
+	.remove =       pvpanic_pci_remove,
+};
+
+static int pvpanic_register_pci_driver(void)
+{
+	return pci_register_driver(&pvpanic_pci_driver);
+}
+
+static void pvpanic_unregister_pci_driver(void)
+{
+	pci_unregister_driver(&pvpanic_pci_driver);
+}
+#else
+static int pvpanic_register_pci_driver(void)
+{
+	return 0;
+}
+
+static void pvpanic_unregister_pci_drvier(void) {}
+#endif
+
 static int __init pvpanic_mmio_init(void)
 {
+	int r1, r2;
+
 	if (acpi_disabled)
-		return platform_driver_register(&pvpanic_mmio_driver);
+		r1 = platform_driver_register(&pvpanic_mmio_driver);
+	else
+		r1 = pvpanic_register_acpi_driver();
+	r2 = pvpanic_register_pci_driver();
+	if (r1 && r2) /* all drivers register failed */
+		return 1;
 	else
-		return pvpanic_register_acpi_driver();
+		return 0;
 }
 
 static void __exit pvpanic_mmio_exit(void)
@@ -186,6 +253,7 @@ static void __exit pvpanic_mmio_exit(void)
 		platform_driver_unregister(&pvpanic_mmio_driver);
 	else
 		pvpanic_unregister_acpi_driver();
+	pvpanic_unregister_pci_driver();
 }
 
 module_init(pvpanic_mmio_init);
-- 
1.8.3.1


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

* [PATCH V4 3/3]  misc/pvpanic : add pci dependency in Kconfig
  2018-12-18  9:46 [PATCH V4 1/3] misc/pvpanic: return 0 for empty body register function Peng Hao
  2018-12-18  9:46 ` [PATCH V4 2/3] misc/pvpanic : add pci interface for pvpanic Peng Hao
@ 2018-12-18  9:46 ` Peng Hao
  2018-12-18 10:28 ` [PATCH V4 1/3] misc/pvpanic: return 0 for empty body register function Greg KH
  2 siblings, 0 replies; 7+ messages in thread
From: Peng Hao @ 2018-12-18  9:46 UTC (permalink / raw)
  To: gregkh, arnd, andy.shevchenko; +Cc: linux-kernel, Peng Hao

Add PCI dependency for pvpanic in Kconfig.

Signed-off-by: Peng Hao <peng.hao2@zte.com.cn>
---
 drivers/misc/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index f417b06..5ff8ca4 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -515,7 +515,7 @@ config MISC_RTSX
 
 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
-- 
1.8.3.1


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

* Re: [PATCH V4 1/3]  misc/pvpanic: return 0 for empty body register function
  2018-12-18  9:46 [PATCH V4 1/3] misc/pvpanic: return 0 for empty body register function Peng Hao
  2018-12-18  9:46 ` [PATCH V4 2/3] misc/pvpanic : add pci interface for pvpanic Peng Hao
  2018-12-18  9:46 ` [PATCH V4 3/3] misc/pvpanic : add pci dependency in Kconfig Peng Hao
@ 2018-12-18 10:28 ` Greg KH
       [not found]   ` <201812190811376451432@zte.com.cn>
  2 siblings, 1 reply; 7+ messages in thread
From: Greg KH @ 2018-12-18 10:28 UTC (permalink / raw)
  To: Peng Hao; +Cc: arnd, andy.shevchenko, linux-kernel

On Tue, Dec 18, 2018 at 05:46:41PM +0800, Peng Hao wrote:
> Return 0 for empty body register function normally.
> 
> Signed-off-by: Peng Hao <peng.hao2@zte.com.cn>
> ---
> QEMU community requires additional PCI devices to simulate PVPANIC devices
> so that some architectures can not occupy precious less than 4G of memory 
> space.

What is this for below the --- line?

And again, you did not specify what changed from the previous versions.
I can not take these unless you provide it.

thanks,

greg k-h

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

* Re: [PATCH V4 2/3]  misc/pvpanic : add pci interface for pvpanic
  2018-12-18  9:46 ` [PATCH V4 2/3] misc/pvpanic : add pci interface for pvpanic Peng Hao
@ 2018-12-18 13:31   ` kbuild test robot
  2018-12-18 13:38   ` kbuild test robot
  1 sibling, 0 replies; 7+ messages in thread
From: kbuild test robot @ 2018-12-18 13:31 UTC (permalink / raw)
  To: Peng Hao
  Cc: kbuild-all, gregkh, arnd, andy.shevchenko, linux-kernel, Peng Hao

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

Hi Peng,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on char-misc/char-misc-testing]
[also build test ERROR on next-20181218]
[cannot apply to v4.20-rc7]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Peng-Hao/misc-pvpanic-return-0-for-empty-body-register-function/20181218-184724
config: nds32-allyesconfig (attached as .config)
compiler: nds32le-linux-gcc (GCC) 6.4.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=6.4.0 make.cross ARCH=nds32 

All errors (new ones prefixed by >>):

   drivers/misc/pvpanic.c: In function 'pvpanic_mmio_exit':
>> drivers/misc/pvpanic.c:256:2: error: implicit declaration of function 'pvpanic_unregister_pci_driver' [-Werror=implicit-function-declaration]
     pvpanic_unregister_pci_driver();
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   At top level:
   drivers/misc/pvpanic.c:232:13: warning: 'pvpanic_unregister_pci_drvier' defined but not used [-Wunused-function]
    static void pvpanic_unregister_pci_drvier(void) {}
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +/pvpanic_unregister_pci_driver +256 drivers/misc/pvpanic.c

   249	
   250	static void __exit pvpanic_mmio_exit(void)
   251	{
   252		if (acpi_disabled)
   253			platform_driver_unregister(&pvpanic_mmio_driver);
   254		else
   255			pvpanic_unregister_acpi_driver();
 > 256		pvpanic_unregister_pci_driver();
   257	}
   258	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

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

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

* Re: [PATCH V4 2/3]  misc/pvpanic : add pci interface for pvpanic
  2018-12-18  9:46 ` [PATCH V4 2/3] misc/pvpanic : add pci interface for pvpanic Peng Hao
  2018-12-18 13:31   ` kbuild test robot
@ 2018-12-18 13:38   ` kbuild test robot
  1 sibling, 0 replies; 7+ messages in thread
From: kbuild test robot @ 2018-12-18 13:38 UTC (permalink / raw)
  To: Peng Hao
  Cc: kbuild-all, gregkh, arnd, andy.shevchenko, linux-kernel, Peng Hao

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

Hi Peng,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on char-misc/char-misc-testing]
[also build test ERROR on next-20181218]
[cannot apply to v4.20-rc7]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Peng-Hao/misc-pvpanic-return-0-for-empty-body-register-function/20181218-184724
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.2.0 make.cross ARCH=sh 

All errors (new ones prefixed by >>):

   drivers/misc/pvpanic.c: In function 'pvpanic_mmio_exit':
>> drivers/misc/pvpanic.c:256:2: error: implicit declaration of function 'pvpanic_unregister_pci_driver'; did you mean 'pvpanic_unregister_pci_drvier'? [-Werror=implicit-function-declaration]
     pvpanic_unregister_pci_driver();
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     pvpanic_unregister_pci_drvier
   At top level:
   drivers/misc/pvpanic.c:232:13: warning: 'pvpanic_unregister_pci_drvier' defined but not used [-Wunused-function]
    static void pvpanic_unregister_pci_drvier(void) {}
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +256 drivers/misc/pvpanic.c

   249	
   250	static void __exit pvpanic_mmio_exit(void)
   251	{
   252		if (acpi_disabled)
   253			platform_driver_unregister(&pvpanic_mmio_driver);
   254		else
   255			pvpanic_unregister_acpi_driver();
 > 256		pvpanic_unregister_pci_driver();
   257	}
   258	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

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

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

* Re: [PATCH V4 1/3]  misc/pvpanic: return 0 for empty body registerfunction
       [not found]   ` <201812190811376451432@zte.com.cn>
@ 2018-12-19  6:56     ` Greg KH
  0 siblings, 0 replies; 7+ messages in thread
From: Greg KH @ 2018-12-19  6:56 UTC (permalink / raw)
  To: peng.hao2; +Cc: arnd, andy.shevchenko, linux-kernel

On Wed, Dec 19, 2018 at 08:11:37AM +0800, peng.hao2@zte.com.cn wrote:
> >On Tue, Dec 18, 2018 at 05:46:41PM +0800, Peng Hao wrote:
> >> Return 0 for empty body register function normally.
> >>
> >> Signed-off-by: Peng Hao <peng.hao2@zte.com.cn>
> >> ---
> >> QEMU community requires additional PCI devices to simulate PVPANIC devices
> >> so that some architectures can not occupy precious less than 4G of memory
> >> space.
> >
> >What is this for below the --- line?
> >
> >And again, you did not specify what changed from the previous versions.
> >I can not take these unless you provide it.
> 
> The previous version of the code is basically unchanged, and the new patches just 
> adds a PCI interface. Previous versions only support ACPI and FDT interfaces.
> The QEMU community requires a PCI interface so that some architectures do not occupy
>  precious low 4G memory address.

No, you are changing things between each version, hopefully based on the
review comments.  And the testing that is being provided for you showing
you where your code breaks the build.

That goes in the "what changed" lines, as is documented in the kernel
documentation.  Please follow that when resubmitting if you wish for
your changes to be able to be accepted.

thanks,

greg k-h

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

end of thread, other threads:[~2018-12-19  6:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-18  9:46 [PATCH V4 1/3] misc/pvpanic: return 0 for empty body register function Peng Hao
2018-12-18  9:46 ` [PATCH V4 2/3] misc/pvpanic : add pci interface for pvpanic Peng Hao
2018-12-18 13:31   ` kbuild test robot
2018-12-18 13:38   ` kbuild test robot
2018-12-18  9:46 ` [PATCH V4 3/3] misc/pvpanic : add pci dependency in Kconfig Peng Hao
2018-12-18 10:28 ` [PATCH V4 1/3] misc/pvpanic: return 0 for empty body register function Greg KH
     [not found]   ` <201812190811376451432@zte.com.cn>
2018-12-19  6:56     ` [PATCH V4 1/3] misc/pvpanic: return 0 for empty body registerfunction Greg KH

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).