qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] exec: Kill CPUReadMemoryFunc/CPUWriteMemoryFunc typedefs
@ 2020-06-01 14:15 Philippe Mathieu-Daudé
  2020-06-01 14:15 ` [PATCH v2 1/3] exec/memory: Remove unused MemoryRegionMmio type Philippe Mathieu-Daudé
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-06-01 14:15 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, qemu-trivial, Philippe Mathieu-Daudé,
	Gerd Hoffmann, Paolo Bonzini, Richard Henderson

Followed Peter's suggestions [1]:

 * delete the unused MmeoryRegionMmio
 * move these typedefs into include/hw/usb.h and rename them
   to MUSBReadFunc and MUSBWriteFunc, since that's all they're
   used for now

Since v1 [2], addressed Peter review:
- Renamed include/hw/usb/musb.h -> include/hw/usb/hcd-musb.h
- Added Peter's R-b tags

Series fully reviewed.

[1] https://www.mail-archive.com/qemu-devel@nongnu.org/msg708165.html
[2] https://www.mail-archive.com/qemu-devel@nongnu.org/msg708194.html

Philippe Mathieu-Daudé (3):
  exec/memory: Remove unused MemoryRegionMmio type
  hw/usb: Move device-specific declarations to new 'hcd-musb.h' header
  exec/cpu-common: Move MUSB specific typedefs to 'hw/usb/hcd-musb.h'

 include/exec/cpu-common.h |  3 ---
 include/exec/memory.h     |  6 -----
 include/hw/usb.h          | 30 -------------------------
 include/hw/usb/hcd-musb.h | 47 +++++++++++++++++++++++++++++++++++++++
 hw/usb/hcd-musb.c         |  5 +++--
 hw/usb/tusb6010.c         |  1 +
 6 files changed, 51 insertions(+), 41 deletions(-)
 create mode 100644 include/hw/usb/hcd-musb.h

-- 
2.21.3



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

* [PATCH v2 1/3] exec/memory: Remove unused MemoryRegionMmio type
  2020-06-01 14:15 [PATCH v2 0/3] exec: Kill CPUReadMemoryFunc/CPUWriteMemoryFunc typedefs Philippe Mathieu-Daudé
@ 2020-06-01 14:15 ` Philippe Mathieu-Daudé
  2020-06-02  0:04   ` Richard Henderson
  2020-06-01 14:15 ` [PATCH v2 2/3] hw/usb: Move device-specific declarations to new 'hcd-musb.h' header Philippe Mathieu-Daudé
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-06-01 14:15 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, qemu-trivial, Philippe Mathieu-Daudé,
	Gerd Hoffmann, Paolo Bonzini, Richard Henderson

Since commit 62a0db942dec ('memory: Remove old_mmio accessors')
this structure is unused. Remove it.

Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 include/exec/memory.h | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/include/exec/memory.h b/include/exec/memory.h
index e000bd2f97..3cdc171583 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -50,12 +50,6 @@
 extern bool global_dirty_log;
 
 typedef struct MemoryRegionOps MemoryRegionOps;
-typedef struct MemoryRegionMmio MemoryRegionMmio;
-
-struct MemoryRegionMmio {
-    CPUReadMemoryFunc *read[3];
-    CPUWriteMemoryFunc *write[3];
-};
 
 typedef struct IOMMUTLBEntry IOMMUTLBEntry;
 
-- 
2.21.3



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

* [PATCH v2 2/3] hw/usb: Move device-specific declarations to new 'hcd-musb.h' header
  2020-06-01 14:15 [PATCH v2 0/3] exec: Kill CPUReadMemoryFunc/CPUWriteMemoryFunc typedefs Philippe Mathieu-Daudé
  2020-06-01 14:15 ` [PATCH v2 1/3] exec/memory: Remove unused MemoryRegionMmio type Philippe Mathieu-Daudé
@ 2020-06-01 14:15 ` Philippe Mathieu-Daudé
  2020-06-02  0:05   ` Richard Henderson
  2020-06-01 14:15 ` [PATCH v2 3/3] exec/cpu-common: Move MUSB specific typedefs to 'hw/usb/hcd-musb.h' Philippe Mathieu-Daudé
  2020-06-04 18:57 ` [PATCH v2 0/3] exec: Kill CPUReadMemoryFunc/CPUWriteMemoryFunc typedefs Paolo Bonzini
  3 siblings, 1 reply; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-06-01 14:15 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, qemu-trivial, Philippe Mathieu-Daudé,
	Gerd Hoffmann, Paolo Bonzini, Richard Henderson

Move the declarations for the MUSB-HDRC USB2.0 OTG compliant core
into a separate header.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 include/hw/usb.h          | 30 -------------------------
 include/hw/usb/hcd-musb.h | 46 +++++++++++++++++++++++++++++++++++++++
 hw/usb/hcd-musb.c         |  1 +
 hw/usb/tusb6010.c         |  1 +
 4 files changed, 48 insertions(+), 30 deletions(-)
 create mode 100644 include/hw/usb/hcd-musb.h

diff --git a/include/hw/usb.h b/include/hw/usb.h
index 1cf1cd9584..e2128c7c45 100644
--- a/include/hw/usb.h
+++ b/include/hw/usb.h
@@ -474,36 +474,6 @@ bool usb_host_dev_is_scsi_storage(USBDevice *usbdev);
 
 #define VM_USB_HUB_SIZE 8
 
-/* hw/usb/hdc-musb.c */
-
-enum musb_irq_source_e {
-    musb_irq_suspend = 0,
-    musb_irq_resume,
-    musb_irq_rst_babble,
-    musb_irq_sof,
-    musb_irq_connect,
-    musb_irq_disconnect,
-    musb_irq_vbus_request,
-    musb_irq_vbus_error,
-    musb_irq_rx,
-    musb_irq_tx,
-    musb_set_vbus,
-    musb_set_session,
-    /* Add new interrupts here */
-    musb_irq_max, /* total number of interrupts defined */
-};
-
-typedef struct MUSBState MUSBState;
-
-extern CPUReadMemoryFunc * const musb_read[];
-extern CPUWriteMemoryFunc * const musb_write[];
-
-MUSBState *musb_init(DeviceState *parent_device, int gpio_base);
-void musb_reset(MUSBState *s);
-uint32_t musb_core_intr_get(MUSBState *s);
-void musb_core_intr_clear(MUSBState *s, uint32_t mask);
-void musb_set_size(MUSBState *s, int epnum, int size, int is_tx);
-
 /* usb-bus.c */
 
 #define TYPE_USB_BUS "usb-bus"
diff --git a/include/hw/usb/hcd-musb.h b/include/hw/usb/hcd-musb.h
new file mode 100644
index 0000000000..26b50132ff
--- /dev/null
+++ b/include/hw/usb/hcd-musb.h
@@ -0,0 +1,46 @@
+/*
+ * "Inventra" High-speed Dual-Role Controller (MUSB-HDRC), Mentor Graphics,
+ * USB2.0 OTG compliant core used in various chips.
+ *
+ * Only host-mode and non-DMA accesses are currently supported.
+ *
+ * Copyright (C) 2008 Nokia Corporation
+ * Written by Andrzej Zaborowski <balrog@zabor.org>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef HW_USB_MUSB_H
+#define HW_USB_MUSB_H
+
+#include "exec/cpu-common.h"
+
+enum musb_irq_source_e {
+    musb_irq_suspend = 0,
+    musb_irq_resume,
+    musb_irq_rst_babble,
+    musb_irq_sof,
+    musb_irq_connect,
+    musb_irq_disconnect,
+    musb_irq_vbus_request,
+    musb_irq_vbus_error,
+    musb_irq_rx,
+    musb_irq_tx,
+    musb_set_vbus,
+    musb_set_session,
+    /* Add new interrupts here */
+    musb_irq_max /* total number of interrupts defined */
+};
+
+extern CPUReadMemoryFunc * const musb_read[];
+extern CPUWriteMemoryFunc * const musb_write[];
+
+typedef struct MUSBState MUSBState;
+
+MUSBState *musb_init(DeviceState *parent_device, int gpio_base);
+void musb_reset(MUSBState *s);
+uint32_t musb_core_intr_get(MUSBState *s);
+void musb_core_intr_clear(MUSBState *s, uint32_t mask);
+void musb_set_size(MUSBState *s, int epnum, int size, int is_tx);
+
+#endif
diff --git a/hw/usb/hcd-musb.c b/hw/usb/hcd-musb.c
index c29fbef6fc..5ab13feb3a 100644
--- a/hw/usb/hcd-musb.c
+++ b/hw/usb/hcd-musb.c
@@ -23,6 +23,7 @@
 #include "qemu/osdep.h"
 #include "qemu/timer.h"
 #include "hw/usb.h"
+#include "hw/usb/hcd-musb.h"
 #include "hw/irq.h"
 #include "hw/hw.h"
 
diff --git a/hw/usb/tusb6010.c b/hw/usb/tusb6010.c
index 17580876c6..27eb28d3e4 100644
--- a/hw/usb/tusb6010.c
+++ b/hw/usb/tusb6010.c
@@ -23,6 +23,7 @@
 #include "qemu/module.h"
 #include "qemu/timer.h"
 #include "hw/usb.h"
+#include "hw/usb/hcd-musb.h"
 #include "hw/arm/omap.h"
 #include "hw/hw.h"
 #include "hw/irq.h"
-- 
2.21.3



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

* [PATCH v2 3/3] exec/cpu-common: Move MUSB specific typedefs to 'hw/usb/hcd-musb.h'
  2020-06-01 14:15 [PATCH v2 0/3] exec: Kill CPUReadMemoryFunc/CPUWriteMemoryFunc typedefs Philippe Mathieu-Daudé
  2020-06-01 14:15 ` [PATCH v2 1/3] exec/memory: Remove unused MemoryRegionMmio type Philippe Mathieu-Daudé
  2020-06-01 14:15 ` [PATCH v2 2/3] hw/usb: Move device-specific declarations to new 'hcd-musb.h' header Philippe Mathieu-Daudé
@ 2020-06-01 14:15 ` Philippe Mathieu-Daudé
  2020-06-02  0:10   ` Richard Henderson
  2020-06-04 18:57 ` [PATCH v2 0/3] exec: Kill CPUReadMemoryFunc/CPUWriteMemoryFunc typedefs Paolo Bonzini
  3 siblings, 1 reply; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-06-01 14:15 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, qemu-trivial, Philippe Mathieu-Daudé,
	Gerd Hoffmann, Paolo Bonzini, Richard Henderson

The CPUReadMemoryFunc/CPUWriteMemoryFunc typedefs are legacy
remnant from before the conversion to MemoryRegions.
Since they are now only used in tusb6010.c and hcd-musb.c,
move them to "hw/usb/musb.h" and rename them appropriately.

Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 include/exec/cpu-common.h | 3 ---
 include/hw/usb/hcd-musb.h | 9 +++++----
 hw/usb/hcd-musb.c         | 4 ++--
 3 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h
index b47e5630e7..d5e285d2b5 100644
--- a/include/exec/cpu-common.h
+++ b/include/exec/cpu-common.h
@@ -43,9 +43,6 @@ extern ram_addr_t ram_size;
 
 /* memory API */
 
-typedef void CPUWriteMemoryFunc(void *opaque, hwaddr addr, uint32_t value);
-typedef uint32_t CPUReadMemoryFunc(void *opaque, hwaddr addr);
-
 void qemu_ram_remap(ram_addr_t addr, ram_addr_t length);
 /* This should not be used by devices.  */
 ram_addr_t qemu_ram_addr_from_host(void *ptr);
diff --git a/include/hw/usb/hcd-musb.h b/include/hw/usb/hcd-musb.h
index 26b50132ff..c874b9f292 100644
--- a/include/hw/usb/hcd-musb.h
+++ b/include/hw/usb/hcd-musb.h
@@ -13,8 +13,6 @@
 #ifndef HW_USB_MUSB_H
 #define HW_USB_MUSB_H
 
-#include "exec/cpu-common.h"
-
 enum musb_irq_source_e {
     musb_irq_suspend = 0,
     musb_irq_resume,
@@ -32,8 +30,11 @@ enum musb_irq_source_e {
     musb_irq_max /* total number of interrupts defined */
 };
 
-extern CPUReadMemoryFunc * const musb_read[];
-extern CPUWriteMemoryFunc * const musb_write[];
+/* TODO convert hcd-musb to QOM/qdev and remove MUSBReadFunc/MUSBWriteFunc */
+typedef void MUSBWriteFunc(void *opaque, hwaddr addr, uint32_t value);
+typedef uint32_t MUSBReadFunc(void *opaque, hwaddr addr);
+extern MUSBReadFunc * const musb_read[];
+extern MUSBWriteFunc * const musb_write[];
 
 typedef struct MUSBState MUSBState;
 
diff --git a/hw/usb/hcd-musb.c b/hw/usb/hcd-musb.c
index 5ab13feb3a..85f5ff5bd4 100644
--- a/hw/usb/hcd-musb.c
+++ b/hw/usb/hcd-musb.c
@@ -1540,13 +1540,13 @@ static void musb_writew(void *opaque, hwaddr addr, uint32_t value)
     };
 }
 
-CPUReadMemoryFunc * const musb_read[] = {
+MUSBReadFunc * const musb_read[] = {
     musb_readb,
     musb_readh,
     musb_readw,
 };
 
-CPUWriteMemoryFunc * const musb_write[] = {
+MUSBWriteFunc * const musb_write[] = {
     musb_writeb,
     musb_writeh,
     musb_writew,
-- 
2.21.3



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

* Re: [PATCH v2 1/3] exec/memory: Remove unused MemoryRegionMmio type
  2020-06-01 14:15 ` [PATCH v2 1/3] exec/memory: Remove unused MemoryRegionMmio type Philippe Mathieu-Daudé
@ 2020-06-02  0:04   ` Richard Henderson
  0 siblings, 0 replies; 8+ messages in thread
From: Richard Henderson @ 2020-06-02  0:04 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Peter Maydell, Richard Henderson, Gerd Hoffmann,
	Paolo Bonzini

On 6/1/20 7:15 AM, Philippe Mathieu-Daudé wrote:
> Since commit 62a0db942dec ('memory: Remove old_mmio accessors')
> this structure is unused. Remove it.
> 
> Suggested-by: Peter Maydell <peter.maydell@linaro.org>
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  include/exec/memory.h | 6 ------
>  1 file changed, 6 deletions(-)

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


r~




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

* Re: [PATCH v2 2/3] hw/usb: Move device-specific declarations to new 'hcd-musb.h' header
  2020-06-01 14:15 ` [PATCH v2 2/3] hw/usb: Move device-specific declarations to new 'hcd-musb.h' header Philippe Mathieu-Daudé
@ 2020-06-02  0:05   ` Richard Henderson
  0 siblings, 0 replies; 8+ messages in thread
From: Richard Henderson @ 2020-06-02  0:05 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Peter Maydell, Richard Henderson, Gerd Hoffmann,
	Paolo Bonzini

On 6/1/20 7:15 AM, Philippe Mathieu-Daudé wrote:
> Move the declarations for the MUSB-HDRC USB2.0 OTG compliant core
> into a separate header.
> 
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  include/hw/usb.h          | 30 -------------------------
>  include/hw/usb/hcd-musb.h | 46 +++++++++++++++++++++++++++++++++++++++
>  hw/usb/hcd-musb.c         |  1 +
>  hw/usb/tusb6010.c         |  1 +
>  4 files changed, 48 insertions(+), 30 deletions(-)
>  create mode 100644 include/hw/usb/hcd-musb.h

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


r~




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

* Re: [PATCH v2 3/3] exec/cpu-common: Move MUSB specific typedefs to 'hw/usb/hcd-musb.h'
  2020-06-01 14:15 ` [PATCH v2 3/3] exec/cpu-common: Move MUSB specific typedefs to 'hw/usb/hcd-musb.h' Philippe Mathieu-Daudé
@ 2020-06-02  0:10   ` Richard Henderson
  0 siblings, 0 replies; 8+ messages in thread
From: Richard Henderson @ 2020-06-02  0:10 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Peter Maydell, Richard Henderson, Gerd Hoffmann,
	Paolo Bonzini

On 6/1/20 7:15 AM, Philippe Mathieu-Daudé wrote:
> The CPUReadMemoryFunc/CPUWriteMemoryFunc typedefs are legacy
> remnant from before the conversion to MemoryRegions.
> Since they are now only used in tusb6010.c and hcd-musb.c,
> move them to "hw/usb/musb.h" and rename them appropriately.
> 
> Suggested-by: Peter Maydell <peter.maydell@linaro.org>
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  include/exec/cpu-common.h | 3 ---
>  include/hw/usb/hcd-musb.h | 9 +++++----
>  hw/usb/hcd-musb.c         | 4 ++--
>  3 files changed, 7 insertions(+), 9 deletions(-)

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


r~




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

* Re: [PATCH v2 0/3] exec: Kill CPUReadMemoryFunc/CPUWriteMemoryFunc typedefs
  2020-06-01 14:15 [PATCH v2 0/3] exec: Kill CPUReadMemoryFunc/CPUWriteMemoryFunc typedefs Philippe Mathieu-Daudé
                   ` (2 preceding siblings ...)
  2020-06-01 14:15 ` [PATCH v2 3/3] exec/cpu-common: Move MUSB specific typedefs to 'hw/usb/hcd-musb.h' Philippe Mathieu-Daudé
@ 2020-06-04 18:57 ` Paolo Bonzini
  3 siblings, 0 replies; 8+ messages in thread
From: Paolo Bonzini @ 2020-06-04 18:57 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Peter Maydell, Gerd Hoffmann, Richard Henderson

On 01/06/20 16:15, Philippe Mathieu-Daudé wrote:
> Followed Peter's suggestions [1]:
> 
>  * delete the unused MmeoryRegionMmio
>  * move these typedefs into include/hw/usb.h and rename them
>    to MUSBReadFunc and MUSBWriteFunc, since that's all they're
>    used for now
> 
> Since v1 [2], addressed Peter review:
> - Renamed include/hw/usb/musb.h -> include/hw/usb/hcd-musb.h
> - Added Peter's R-b tags
> 
> Series fully reviewed.
> 
> [1] https://www.mail-archive.com/qemu-devel@nongnu.org/msg708165.html
> [2] https://www.mail-archive.com/qemu-devel@nongnu.org/msg708194.html
> 
> Philippe Mathieu-Daudé (3):
>   exec/memory: Remove unused MemoryRegionMmio type
>   hw/usb: Move device-specific declarations to new 'hcd-musb.h' header
>   exec/cpu-common: Move MUSB specific typedefs to 'hw/usb/hcd-musb.h'
> 
>  include/exec/cpu-common.h |  3 ---
>  include/exec/memory.h     |  6 -----
>  include/hw/usb.h          | 30 -------------------------
>  include/hw/usb/hcd-musb.h | 47 +++++++++++++++++++++++++++++++++++++++
>  hw/usb/hcd-musb.c         |  5 +++--
>  hw/usb/tusb6010.c         |  1 +
>  6 files changed, 51 insertions(+), 41 deletions(-)
>  create mode 100644 include/hw/usb/hcd-musb.h
> 

Queued, thanks.

Paolo



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

end of thread, other threads:[~2020-06-04 18:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-01 14:15 [PATCH v2 0/3] exec: Kill CPUReadMemoryFunc/CPUWriteMemoryFunc typedefs Philippe Mathieu-Daudé
2020-06-01 14:15 ` [PATCH v2 1/3] exec/memory: Remove unused MemoryRegionMmio type Philippe Mathieu-Daudé
2020-06-02  0:04   ` Richard Henderson
2020-06-01 14:15 ` [PATCH v2 2/3] hw/usb: Move device-specific declarations to new 'hcd-musb.h' header Philippe Mathieu-Daudé
2020-06-02  0:05   ` Richard Henderson
2020-06-01 14:15 ` [PATCH v2 3/3] exec/cpu-common: Move MUSB specific typedefs to 'hw/usb/hcd-musb.h' Philippe Mathieu-Daudé
2020-06-02  0:10   ` Richard Henderson
2020-06-04 18:57 ` [PATCH v2 0/3] exec: Kill CPUReadMemoryFunc/CPUWriteMemoryFunc typedefs Paolo Bonzini

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