qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH-for-5.2 v2 0/4] hw/usb/hcd-xhci: Fix USB_XHCI_NEC device
@ 2020-11-09 13:52 Philippe Mathieu-Daudé
  2020-11-09 13:52 ` [PATCH-for-5.2 v2 1/4] hw/usb/Kconfig: Fix USB_XHCI_NEC (depends on USB_XHCI_PCI) Philippe Mathieu-Daudé
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-11-09 13:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: Philippe Mathieu-Daudé, Gerd Hoffmann

Fix a regression since xhci-sysbus introduction.

Since v1:
- Do not declare TYPE_XHCI abstract

Cleaned a bit code style while here, patches included for 6.0.

Supersedes: <20201107111307.262263-1-philmd@redhat.com>

Philippe Mathieu-Daudé (4):
  hw/usb/Kconfig: Fix USB_XHCI_NEC (depends on USB_XHCI_PCI)
  hw/usb/hcd-xhci: Restrict TYPE_XHCI to hw/usb/
  hw/usb/hcd-xhci-pci: Use OBJECT_DECLARE_SIMPLE_TYPE() macro
  hw/usb/hcd-xhci-pci: Rename "pci-xhci" as TYPE_XHCI_PCI_COMMON

 hw/usb/hcd-xhci-pci.h |  6 ++----
 hw/usb/hcd-xhci.h     |  1 +
 include/hw/usb/xhci.h |  1 -
 hw/usb/hcd-xhci-nec.c |  2 +-
 hw/usb/hcd-xhci-pci.c | 16 ++++++++--------
 hw/usb/Kconfig        |  4 +---
 6 files changed, 13 insertions(+), 17 deletions(-)

-- 
2.26.2




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

* [PATCH-for-5.2 v2 1/4] hw/usb/Kconfig: Fix USB_XHCI_NEC (depends on USB_XHCI_PCI)
  2020-11-09 13:52 [PATCH-for-5.2 v2 0/4] hw/usb/hcd-xhci: Fix USB_XHCI_NEC device Philippe Mathieu-Daudé
@ 2020-11-09 13:52 ` Philippe Mathieu-Daudé
  2020-11-12 21:22   ` Richard Henderson
  2020-11-09 13:52 ` [PATCH-for-6.0 v2 2/4] hw/usb/hcd-xhci: Restrict TYPE_XHCI to hw/usb/ Philippe Mathieu-Daudé
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-11-09 13:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: Sai Pavan Boddu, Philippe Mathieu-Daudé, Gerd Hoffmann

Since commit 755fba11fbc and 8ddab8dd3d8 we can not build
USB_XHCI_NEC without USB_XHCI_PCI. Correct the Kconfig
dependency.

Fixes: 755fba11fbc ("usb/hcd-xhci: Move qemu-xhci device to hcd-xhci-pci.c")
Reviewed-by: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/usb/Kconfig | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/hw/usb/Kconfig b/hw/usb/Kconfig
index a674ce4c542..6a213b04758 100644
--- a/hw/usb/Kconfig
+++ b/hw/usb/Kconfig
@@ -42,9 +42,7 @@ config USB_XHCI_PCI
 
 config USB_XHCI_NEC
     bool
-    default y if PCI_DEVICES
-    depends on PCI
-    select USB_XHCI
+    select USB_XHCI_PCI
 
 config USB_XHCI_SYSBUS
     bool
-- 
2.26.2



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

* [PATCH-for-6.0 v2 2/4] hw/usb/hcd-xhci: Restrict TYPE_XHCI to hw/usb/
  2020-11-09 13:52 [PATCH-for-5.2 v2 0/4] hw/usb/hcd-xhci: Fix USB_XHCI_NEC device Philippe Mathieu-Daudé
  2020-11-09 13:52 ` [PATCH-for-5.2 v2 1/4] hw/usb/Kconfig: Fix USB_XHCI_NEC (depends on USB_XHCI_PCI) Philippe Mathieu-Daudé
@ 2020-11-09 13:52 ` Philippe Mathieu-Daudé
  2020-11-12 21:23   ` Richard Henderson
  2020-11-09 13:52 ` [PATCH-for-6.0 v2 3/4] hw/usb/hcd-xhci-pci: Use OBJECT_DECLARE_SIMPLE_TYPE() macro Philippe Mathieu-Daudé
  2020-11-09 13:53 ` [PATCH-for-6.0 v2 4/4] hw/usb/hcd-xhci-pci: Rename "pci-xhci" as TYPE_XHCI_PCI_COMMON Philippe Mathieu-Daudé
  3 siblings, 1 reply; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-11-09 13:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: Philippe Mathieu-Daudé, Gerd Hoffmann

TYPE_XHCI is not a generic device meant to be instantiated by
QOM objects outside of hw/usb/. Do not expose the type in public
namespace (via include/).

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/usb/hcd-xhci.h     | 1 +
 include/hw/usb/xhci.h | 1 -
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/usb/hcd-xhci.h b/hw/usb/hcd-xhci.h
index ccf50ae28be..f7150a7e12b 100644
--- a/hw/usb/hcd-xhci.h
+++ b/hw/usb/hcd-xhci.h
@@ -27,6 +27,7 @@
 #include "hw/usb/xhci.h"
 #include "sysemu/dma.h"
 
+#define TYPE_XHCI "base-xhci"
 OBJECT_DECLARE_SIMPLE_TYPE(XHCIState, XHCI)
 
 /* Very pessimistic, let's hope it's enough for all cases */
diff --git a/include/hw/usb/xhci.h b/include/hw/usb/xhci.h
index 5c90e1373e5..90b56429199 100644
--- a/include/hw/usb/xhci.h
+++ b/include/hw/usb/xhci.h
@@ -1,7 +1,6 @@
 #ifndef HW_USB_XHCI_H
 #define HW_USB_XHCI_H
 
-#define TYPE_XHCI "base-xhci"
 #define TYPE_NEC_XHCI "nec-usb-xhci"
 #define TYPE_QEMU_XHCI "qemu-xhci"
 #define TYPE_XHCI_SYSBUS "sysbus-xhci"
-- 
2.26.2



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

* [PATCH-for-6.0 v2 3/4] hw/usb/hcd-xhci-pci: Use OBJECT_DECLARE_SIMPLE_TYPE() macro
  2020-11-09 13:52 [PATCH-for-5.2 v2 0/4] hw/usb/hcd-xhci: Fix USB_XHCI_NEC device Philippe Mathieu-Daudé
  2020-11-09 13:52 ` [PATCH-for-5.2 v2 1/4] hw/usb/Kconfig: Fix USB_XHCI_NEC (depends on USB_XHCI_PCI) Philippe Mathieu-Daudé
  2020-11-09 13:52 ` [PATCH-for-6.0 v2 2/4] hw/usb/hcd-xhci: Restrict TYPE_XHCI to hw/usb/ Philippe Mathieu-Daudé
@ 2020-11-09 13:52 ` Philippe Mathieu-Daudé
  2020-11-12 21:24   ` Richard Henderson
  2020-11-09 13:53 ` [PATCH-for-6.0 v2 4/4] hw/usb/hcd-xhci-pci: Rename "pci-xhci" as TYPE_XHCI_PCI_COMMON Philippe Mathieu-Daudé
  3 siblings, 1 reply; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-11-09 13:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: Philippe Mathieu-Daudé, Gerd Hoffmann

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/usb/hcd-xhci-pci.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/hw/usb/hcd-xhci-pci.h b/hw/usb/hcd-xhci-pci.h
index aa2e890627c..cf9a180caa4 100644
--- a/hw/usb/hcd-xhci-pci.h
+++ b/hw/usb/hcd-xhci-pci.h
@@ -28,9 +28,7 @@
 #include "hcd-xhci.h"
 
 #define TYPE_XHCI_PCI "pci-xhci"
-#define XHCI_PCI(obj) \
-    OBJECT_CHECK(XHCIPciState, (obj), TYPE_XHCI_PCI)
-
+OBJECT_DECLARE_SIMPLE_TYPE(XHCIPciState, XHCI_PCI)
 
 typedef struct XHCIPciState {
     /*< private >*/
-- 
2.26.2



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

* [PATCH-for-6.0 v2 4/4] hw/usb/hcd-xhci-pci: Rename "pci-xhci" as TYPE_XHCI_PCI_COMMON
  2020-11-09 13:52 [PATCH-for-5.2 v2 0/4] hw/usb/hcd-xhci: Fix USB_XHCI_NEC device Philippe Mathieu-Daudé
                   ` (2 preceding siblings ...)
  2020-11-09 13:52 ` [PATCH-for-6.0 v2 3/4] hw/usb/hcd-xhci-pci: Use OBJECT_DECLARE_SIMPLE_TYPE() macro Philippe Mathieu-Daudé
@ 2020-11-09 13:53 ` Philippe Mathieu-Daudé
  2020-11-12 21:24   ` Richard Henderson
  3 siblings, 1 reply; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-11-09 13:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: Philippe Mathieu-Daudé, Gerd Hoffmann

Follow the code base style by using the _COMMON suffix to
abstract QOM types.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/usb/hcd-xhci-pci.h |  4 ++--
 hw/usb/hcd-xhci-nec.c |  2 +-
 hw/usb/hcd-xhci-pci.c | 16 ++++++++--------
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/hw/usb/hcd-xhci-pci.h b/hw/usb/hcd-xhci-pci.h
index cf9a180caa4..c862e82d964 100644
--- a/hw/usb/hcd-xhci-pci.h
+++ b/hw/usb/hcd-xhci-pci.h
@@ -27,8 +27,8 @@
 #include "hw/usb.h"
 #include "hcd-xhci.h"
 
-#define TYPE_XHCI_PCI "pci-xhci"
-OBJECT_DECLARE_SIMPLE_TYPE(XHCIPciState, XHCI_PCI)
+#define TYPE_XHCI_PCI_COMMON "pci-xhci"
+OBJECT_DECLARE_SIMPLE_TYPE(XHCIPciState, XHCI_PCI_COMMON)
 
 typedef struct XHCIPciState {
     /*< private >*/
diff --git a/hw/usb/hcd-xhci-nec.c b/hw/usb/hcd-xhci-nec.c
index 5707b2cabd1..16b3b46fd59 100644
--- a/hw/usb/hcd-xhci-nec.c
+++ b/hw/usb/hcd-xhci-nec.c
@@ -52,7 +52,7 @@ static void nec_xhci_class_init(ObjectClass *klass, void *data)
 
 static const TypeInfo nec_xhci_info = {
     .name          = TYPE_NEC_XHCI,
-    .parent        = TYPE_XHCI_PCI,
+    .parent        = TYPE_XHCI_PCI_COMMON,
     .class_init    = nec_xhci_class_init,
 };
 
diff --git a/hw/usb/hcd-xhci-pci.c b/hw/usb/hcd-xhci-pci.c
index b78fcd2bb2d..b4487cce4ba 100644
--- a/hw/usb/hcd-xhci-pci.c
+++ b/hw/usb/hcd-xhci-pci.c
@@ -80,14 +80,14 @@ static void xhci_pci_intr_raise(XHCIState *xhci, int n, bool level)
 
 static void xhci_pci_reset(DeviceState *dev)
 {
-    XHCIPciState *s = XHCI_PCI(dev);
+    XHCIPciState *s = XHCI_PCI_COMMON(dev);
 
     device_legacy_reset(DEVICE(&s->xhci));
 }
 
 static int xhci_pci_vmstate_post_load(void *opaque, int version_id)
 {
-    XHCIPciState *s = XHCI_PCI(opaque);
+    XHCIPciState *s = XHCI_PCI_COMMON(opaque);
     PCIDevice *pci_dev = PCI_DEVICE(s);
     int intr;
 
@@ -105,7 +105,7 @@ static void usb_xhci_pci_realize(struct PCIDevice *dev, Error **errp)
 {
     int ret;
     Error *err = NULL;
-    XHCIPciState *s = XHCI_PCI(dev);
+    XHCIPciState *s = XHCI_PCI_COMMON(dev);
 
     dev->config[PCI_CLASS_PROG] = 0x30;    /* xHCI */
     dev->config[PCI_INTERRUPT_PIN] = 0x01; /* interrupt pin 1 */
@@ -165,7 +165,7 @@ static void usb_xhci_pci_realize(struct PCIDevice *dev, Error **errp)
 
 static void usb_xhci_pci_exit(PCIDevice *dev)
 {
-    XHCIPciState *s = XHCI_PCI(dev);
+    XHCIPciState *s = XHCI_PCI_COMMON(dev);
     /* destroy msix memory region */
     if (dev->msix_table && dev->msix_pba
         && dev->msix_entry_used) {
@@ -187,7 +187,7 @@ static const VMStateDescription vmstate_xhci_pci = {
 
 static void xhci_instance_init(Object *obj)
 {
-    XHCIPciState *s = XHCI_PCI(obj);
+    XHCIPciState *s = XHCI_PCI_COMMON(obj);
     /*
      * QEMU_PCI_CAP_EXPRESS initialization does not depend on QEMU command
      * line, therefore, no need to wait to realize like other devices
@@ -211,7 +211,7 @@ static void xhci_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo xhci_pci_info = {
-    .name          = TYPE_XHCI_PCI,
+    .name          = TYPE_XHCI_PCI_COMMON,
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(XHCIPciState),
     .class_init    = xhci_class_init,
@@ -235,7 +235,7 @@ static void qemu_xhci_class_init(ObjectClass *klass, void *data)
 
 static void qemu_xhci_instance_init(Object *obj)
 {
-    XHCIPciState *s = XHCI_PCI(obj);
+    XHCIPciState *s = XHCI_PCI_COMMON(obj);
     XHCIState *xhci = &s->xhci;
 
     s->msi      = ON_OFF_AUTO_OFF;
@@ -247,7 +247,7 @@ static void qemu_xhci_instance_init(Object *obj)
 
 static const TypeInfo qemu_xhci_info = {
     .name          = TYPE_QEMU_XHCI,
-    .parent        = TYPE_XHCI_PCI,
+    .parent        = TYPE_XHCI_PCI_COMMON,
     .class_init    = qemu_xhci_class_init,
     .instance_init = qemu_xhci_instance_init,
 };
-- 
2.26.2



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

* Re: [PATCH-for-5.2 v2 1/4] hw/usb/Kconfig: Fix USB_XHCI_NEC (depends on USB_XHCI_PCI)
  2020-11-09 13:52 ` [PATCH-for-5.2 v2 1/4] hw/usb/Kconfig: Fix USB_XHCI_NEC (depends on USB_XHCI_PCI) Philippe Mathieu-Daudé
@ 2020-11-12 21:22   ` Richard Henderson
  0 siblings, 0 replies; 9+ messages in thread
From: Richard Henderson @ 2020-11-12 21:22 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel; +Cc: Sai Pavan Boddu, Gerd Hoffmann

On 11/9/20 5:52 AM, Philippe Mathieu-Daudé wrote:
> Since commit 755fba11fbc and 8ddab8dd3d8 we can not build
> USB_XHCI_NEC without USB_XHCI_PCI. Correct the Kconfig
> dependency.
> 
> Fixes: 755fba11fbc ("usb/hcd-xhci: Move qemu-xhci device to hcd-xhci-pci.c")
> Reviewed-by: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  hw/usb/Kconfig | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


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

* Re: [PATCH-for-6.0 v2 2/4] hw/usb/hcd-xhci: Restrict TYPE_XHCI to hw/usb/
  2020-11-09 13:52 ` [PATCH-for-6.0 v2 2/4] hw/usb/hcd-xhci: Restrict TYPE_XHCI to hw/usb/ Philippe Mathieu-Daudé
@ 2020-11-12 21:23   ` Richard Henderson
  0 siblings, 0 replies; 9+ messages in thread
From: Richard Henderson @ 2020-11-12 21:23 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel; +Cc: Gerd Hoffmann

On 11/9/20 5:52 AM, Philippe Mathieu-Daudé wrote:
> TYPE_XHCI is not a generic device meant to be instantiated by
> QOM objects outside of hw/usb/. Do not expose the type in public
> namespace (via include/).
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  hw/usb/hcd-xhci.h     | 1 +
>  include/hw/usb/xhci.h | 1 -
>  2 files changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


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

* Re: [PATCH-for-6.0 v2 3/4] hw/usb/hcd-xhci-pci: Use OBJECT_DECLARE_SIMPLE_TYPE() macro
  2020-11-09 13:52 ` [PATCH-for-6.0 v2 3/4] hw/usb/hcd-xhci-pci: Use OBJECT_DECLARE_SIMPLE_TYPE() macro Philippe Mathieu-Daudé
@ 2020-11-12 21:24   ` Richard Henderson
  0 siblings, 0 replies; 9+ messages in thread
From: Richard Henderson @ 2020-11-12 21:24 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel; +Cc: Gerd Hoffmann

On 11/9/20 5:52 AM, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  hw/usb/hcd-xhci-pci.h | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


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

* Re: [PATCH-for-6.0 v2 4/4] hw/usb/hcd-xhci-pci: Rename "pci-xhci" as TYPE_XHCI_PCI_COMMON
  2020-11-09 13:53 ` [PATCH-for-6.0 v2 4/4] hw/usb/hcd-xhci-pci: Rename "pci-xhci" as TYPE_XHCI_PCI_COMMON Philippe Mathieu-Daudé
@ 2020-11-12 21:24   ` Richard Henderson
  0 siblings, 0 replies; 9+ messages in thread
From: Richard Henderson @ 2020-11-12 21:24 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel; +Cc: Gerd Hoffmann

On 11/9/20 5:53 AM, Philippe Mathieu-Daudé wrote:
> Follow the code base style by using the _COMMON suffix to
> abstract QOM types.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  hw/usb/hcd-xhci-pci.h |  4 ++--
>  hw/usb/hcd-xhci-nec.c |  2 +-
>  hw/usb/hcd-xhci-pci.c | 16 ++++++++--------
>  3 files changed, 11 insertions(+), 11 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


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

end of thread, other threads:[~2020-11-12 21:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-09 13:52 [PATCH-for-5.2 v2 0/4] hw/usb/hcd-xhci: Fix USB_XHCI_NEC device Philippe Mathieu-Daudé
2020-11-09 13:52 ` [PATCH-for-5.2 v2 1/4] hw/usb/Kconfig: Fix USB_XHCI_NEC (depends on USB_XHCI_PCI) Philippe Mathieu-Daudé
2020-11-12 21:22   ` Richard Henderson
2020-11-09 13:52 ` [PATCH-for-6.0 v2 2/4] hw/usb/hcd-xhci: Restrict TYPE_XHCI to hw/usb/ Philippe Mathieu-Daudé
2020-11-12 21:23   ` Richard Henderson
2020-11-09 13:52 ` [PATCH-for-6.0 v2 3/4] hw/usb/hcd-xhci-pci: Use OBJECT_DECLARE_SIMPLE_TYPE() macro Philippe Mathieu-Daudé
2020-11-12 21:24   ` Richard Henderson
2020-11-09 13:53 ` [PATCH-for-6.0 v2 4/4] hw/usb/hcd-xhci-pci: Rename "pci-xhci" as TYPE_XHCI_PCI_COMMON Philippe Mathieu-Daudé
2020-11-12 21:24   ` Richard Henderson

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