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

Followed Peter's suggestions:

 * 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

https://www.mail-archive.com/qemu-devel@nongnu.org/msg708165.html

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

 include/exec/cpu-common.h |  3 ---
 include/exec/memory.h     |  6 -----
 include/hw/usb.h          | 30 -------------------------
 include/hw/usb/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/musb.h

-- 
2.21.3



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

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

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

Suggested-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] 6+ messages in thread

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

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

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 include/hw/usb.h      | 30 ----------------------------
 include/hw/usb/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/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/musb.h b/include/hw/usb/musb.h
new file mode 100644
index 0000000000..26b50132ff
--- /dev/null
+++ b/include/hw/usb/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..ea7a89fd0c 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/musb.h"
 #include "hw/irq.h"
 #include "hw/hw.h"
 
diff --git a/hw/usb/tusb6010.c b/hw/usb/tusb6010.c
index 17580876c6..52cf6ec9b8 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/musb.h"
 #include "hw/arm/omap.h"
 #include "hw/hw.h"
 #include "hw/irq.h"
-- 
2.21.3



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

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

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>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 include/exec/cpu-common.h | 3 ---
 include/hw/usb/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/musb.h b/include/hw/usb/musb.h
index 26b50132ff..c874b9f292 100644
--- a/include/hw/usb/musb.h
+++ b/include/hw/usb/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 ea7a89fd0c..82865abe65 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] 6+ messages in thread

* Re: [PATCH 0/3] exec: Kill CPUReadMemoryFunc/CPUWriteMemoryFunc typedefs
  2020-06-01  7:53 [PATCH 0/3] exec: Kill CPUReadMemoryFunc/CPUWriteMemoryFunc typedefs Philippe Mathieu-Daudé
                   ` (2 preceding siblings ...)
  2020-06-01  7:54 ` [PATCH 3/3] exec/cpu-common: Move MUSB specific typedefs to 'hw/usb/musb.h' Philippe Mathieu-Daudé
@ 2020-06-01 10:35 ` Peter Maydell
  2020-06-01 11:21   ` Philippe Mathieu-Daudé
  3 siblings, 1 reply; 6+ messages in thread
From: Peter Maydell @ 2020-06-01 10:35 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Paolo Bonzini, Richard Henderson, QEMU Developers, Gerd Hoffmann

On Mon, 1 Jun 2020 at 08:54, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> Followed Peter's suggestions:
>
>  * 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

>  include/exec/cpu-common.h |  3 ---
>  include/exec/memory.h     |  6 -----
>  include/hw/usb.h          | 30 -------------------------
>  include/hw/usb/musb.h     | 47 +++++++++++++++++++++++++++++++++++++++
>  hw/usb/hcd-musb.c         |  5 +++--
>  hw/usb/tusb6010.c         |  1 +

I think we usually would give the .h file a name matching the .c file,
so include/hw/usb/hcd-musb.h ?

Either way, whole series:
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM


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

* Re: [PATCH 0/3] exec: Kill CPUReadMemoryFunc/CPUWriteMemoryFunc typedefs
  2020-06-01 10:35 ` [PATCH 0/3] exec: Kill CPUReadMemoryFunc/CPUWriteMemoryFunc typedefs Peter Maydell
@ 2020-06-01 11:21   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-06-01 11:21 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Paolo Bonzini, Gerd Hoffmann, QEMU Developers, Richard Henderson

On 6/1/20 12:35 PM, Peter Maydell wrote:
> On Mon, 1 Jun 2020 at 08:54, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>>
>> Followed Peter's suggestions:
>>
>>  * 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
> 
>>  include/exec/cpu-common.h |  3 ---
>>  include/exec/memory.h     |  6 -----
>>  include/hw/usb.h          | 30 -------------------------
>>  include/hw/usb/musb.h     | 47 +++++++++++++++++++++++++++++++++++++++
>>  hw/usb/hcd-musb.c         |  5 +++--
>>  hw/usb/tusb6010.c         |  1 +
> 
> I think we usually would give the .h file a name matching the .c file,
> so include/hw/usb/hcd-musb.h ?

Indeed, I'll update.

> 
> Either way, whole series:
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

Thanks!

> 
> thanks
> -- PMM
> 


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

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

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-01  7:53 [PATCH 0/3] exec: Kill CPUReadMemoryFunc/CPUWriteMemoryFunc typedefs Philippe Mathieu-Daudé
2020-06-01  7:53 ` [PATCH 1/3] exec/memory: Remove unused MemoryRegionMmio type Philippe Mathieu-Daudé
2020-06-01  7:53 ` [PATCH 2/3] hw/usb: Move device-specific declarations to new 'musb.h' header Philippe Mathieu-Daudé
2020-06-01  7:54 ` [PATCH 3/3] exec/cpu-common: Move MUSB specific typedefs to 'hw/usb/musb.h' Philippe Mathieu-Daudé
2020-06-01 10:35 ` [PATCH 0/3] exec: Kill CPUReadMemoryFunc/CPUWriteMemoryFunc typedefs Peter Maydell
2020-06-01 11:21   ` Philippe Mathieu-Daudé

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.