Skip to contentSkip to conversation

exec: Kill CPUReadMemoryFunc/CPUWriteMemoryFunc typedefs

PATCH Applied Philippe Mathieu-Daudé 3 participants 8 messages Jun 1, 2020 – Jun 4, 2020

lore
Share & tools
lore
#0 lore raw

v2 cover exec: Kill CPUReadMemoryFunc/CPUWriteMemoryFunc typedefs

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/[email protected]/msg708165.html
[2] https://www.mail-archive.com/[email protected]/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
Signature · 1 line
2.21.3
#1 lore raw

PATCH v2 1/3 exec/memory: Remove unused MemoryRegionMmio type

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

---
 include/exec/memory.h | 6 ------
 1 file changed, 6 deletions(-)
include/exec/memory.h +0 -6
index e000bd2f97..3cdc171583 100644
@@ -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;
 
Signature · 1 line
2.21.3
Reviewed-by on v2 1/3
#2 lore raw

Re: [PATCH v2 1/3] exec/memory: Remove unused MemoryRegionMmio type

Quoted 9 lines · Philippe Mathieu-Daudé

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

---
 include/exec/memory.h | 6 ------
 1 file changed, 6 deletions(-)

r~

#3 lore raw

PATCH v2 2/3 hw/usb: Move device-specific declarations to new 'hcd-musb.h' header

In reply to Philippe Mathieu-Daudé

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

---
 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
include/hw/usb.h +0 -30
index 1cf1cd9584..e2128c7c45 100644
@@ -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"
include/hw/usb/hcd-musb.h new file +46 -0

46 lines not on this page · raw message

hw/usb/hcd-musb.c +1 -0
index c29fbef6fc..5ab13feb3a 100644
@@ -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"
 
hw/usb/tusb6010.c +1 -0
index 17580876c6..27eb28d3e4 100644
@@ -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"
Signature · 1 line
2.21.3
Reviewed-by on v2 2/3
#4 lore raw

Re: [PATCH v2 2/3] hw/usb: Move device-specific declarations to new 'hcd-musb.h' header

Quoted 5 lines · Philippe Mathieu-Daudé

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

Quoted 7 lines
---
 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

r~

#5 lore raw

PATCH v2 3/3 exec/cpu-common: Move MUSB specific typedefs to 'hw/usb/hcd-musb.h'

In reply to Philippe Mathieu-Daudé

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.

---
 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(-)
include/exec/cpu-common.h +0 -3
index b47e5630e7..d5e285d2b5 100644
@@ -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);
include/hw/usb/hcd-musb.h +5 -4
index 26b50132ff..c874b9f292 100644
@@ -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;
 
hw/usb/hcd-musb.c +2 -2
index 5ab13feb3a..85f5ff5bd4 100644
@@ -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,
Signature · 1 line
2.21.3
Reviewed-by on v2 3/3
#6 lore raw

Re: [PATCH v2 3/3] exec/cpu-common: Move MUSB specific typedefs to 'hw/usb/hcd-musb.h'

Quoted 5 lines · Philippe Mathieu-Daudé

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.

Quoted 8 lines
---
 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(-)

r~

#7 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 21 lines · Philippe Mathieu-Daudé

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/[email protected]/msg708165.html
[2] https://www.mail-archive.com/[email protected]/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'

Quoted 9 lines
 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