qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/2] target/mips: jazz: rc4030: Minor cleanups
@ 2019-06-25 14:27 Aleksandar Markovic
  2019-06-25 14:27 ` [Qemu-devel] [PATCH 1/2] dma/rc4030: Fix off-by-one error in specified memory region size Aleksandar Markovic
  2019-06-25 14:27 ` [Qemu-devel] [PATCH 2/2] dma/rc4030: Minor code style cleanup Aleksandar Markovic
  0 siblings, 2 replies; 9+ messages in thread
From: Aleksandar Markovic @ 2019-06-25 14:27 UTC (permalink / raw)
  To: qemu-devel; +Cc: arikalo, hpoussin, f4bug, amarkovic

From: Aleksandar Markovic <amarkovic@wavecomp.com>

This series contains several cleanup items inspired by recent
Philippe's cleanups for Malta devices.

Aleksandar Markovic (2):
  dma/rc4030: Fix off-by-one error in specified memory region size
  dma/rc4030: Minor code style cleanup

 hw/dma/rc4030.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

-- 
2.7.4



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

* [Qemu-devel] [PATCH 1/2] dma/rc4030: Fix off-by-one error in specified memory region size
  2019-06-25 14:27 [Qemu-devel] [PATCH 0/2] target/mips: jazz: rc4030: Minor cleanups Aleksandar Markovic
@ 2019-06-25 14:27 ` Aleksandar Markovic
  2019-06-25 14:34   ` Aleksandar Rikalo
                     ` (2 more replies)
  2019-06-25 14:27 ` [Qemu-devel] [PATCH 2/2] dma/rc4030: Minor code style cleanup Aleksandar Markovic
  1 sibling, 3 replies; 9+ messages in thread
From: Aleksandar Markovic @ 2019-06-25 14:27 UTC (permalink / raw)
  To: qemu-devel; +Cc: arikalo, hpoussin, f4bug, amarkovic

From: Aleksandar Markovic <amarkovic@wavecomp.com>

The size is one byte less than it should be:

address-space: rc4030-dma
  0000000000000000-00000000fffffffe (prio 0, i/o): rc4030.dma

rc4030 is used in MIPS Jazz board context.

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
---
 hw/dma/rc4030.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/dma/rc4030.c b/hw/dma/rc4030.c
index 6ccafec..88ff271 100644
--- a/hw/dma/rc4030.c
+++ b/hw/dma/rc4030.c
@@ -23,6 +23,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu/units.h"
 #include "hw/hw.h"
 #include "hw/mips/mips.h"
 #include "hw/sysbus.h"
@@ -678,7 +679,7 @@ static void rc4030_realize(DeviceState *dev, Error **errp)
 
     memory_region_init_iommu(&s->dma_mr, sizeof(s->dma_mr),
                              TYPE_RC4030_IOMMU_MEMORY_REGION,
-                             o, "rc4030.dma", UINT32_MAX);
+                             o, "rc4030.dma", 4 * GiB);
     address_space_init(&s->dma_as, MEMORY_REGION(&s->dma_mr), "rc4030-dma");
 }
 
-- 
2.7.4



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

* [Qemu-devel] [PATCH 2/2] dma/rc4030: Minor code style cleanup
  2019-06-25 14:27 [Qemu-devel] [PATCH 0/2] target/mips: jazz: rc4030: Minor cleanups Aleksandar Markovic
  2019-06-25 14:27 ` [Qemu-devel] [PATCH 1/2] dma/rc4030: Fix off-by-one error in specified memory region size Aleksandar Markovic
@ 2019-06-25 14:27 ` Aleksandar Markovic
  2019-06-25 14:33   ` Aleksandar Rikalo
                     ` (2 more replies)
  1 sibling, 3 replies; 9+ messages in thread
From: Aleksandar Markovic @ 2019-06-25 14:27 UTC (permalink / raw)
  To: qemu-devel; +Cc: arikalo, hpoussin, f4bug, amarkovic

From: Aleksandar Markovic <amarkovic@wavecomp.com>

Fix some simple checkpatch.pl warnings in rc4030.c.

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
---
 hw/dma/rc4030.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/hw/dma/rc4030.c b/hw/dma/rc4030.c
index 88ff271..155af9b 100644
--- a/hw/dma/rc4030.c
+++ b/hw/dma/rc4030.c
@@ -58,8 +58,8 @@ typedef struct dma_pagetable_entry {
 
 #define TYPE_RC4030_IOMMU_MEMORY_REGION "rc4030-iommu-memory-region"
 
-typedef struct rc4030State
-{
+typedef struct rc4030State {
+
     SysBusDevice parent;
 
     uint32_t config; /* 0x0000: RC4030 config register */
@@ -152,8 +152,9 @@ static uint64_t rc4030_read(void *opaque, hwaddr addr, unsigned int size)
     case 0x0058:
         val = s->cache_bmask;
         /* HACK */
-        if (s->cache_bmask == (uint32_t)-1)
+        if (s->cache_bmask == (uint32_t)-1) {
             s->cache_bmask = 0;
+        }
         break;
     /* Remote Speed Registers */
     case 0x0070:
@@ -538,8 +539,9 @@ static void rc4030_reset(DeviceState *dev)
 
     s->memory_refresh_rate = 0x18186;
     s->nvram_protect = 7;
-    for (i = 0; i < 15; i++)
+    for (i = 0; i < 15; i++) {
         s->rem_speed[i] = 7;
+    }
     s->imr_jazz = 0x10; /* XXX: required by firmware, but why? */
     s->isr_jazz = 0;
 
@@ -551,7 +553,7 @@ static void rc4030_reset(DeviceState *dev)
 
 static int rc4030_post_load(void *opaque, int version_id)
 {
-    rc4030State* s = opaque;
+    rc4030State *s = opaque;
 
     set_next_tick(s);
     update_jazz_irq(s);
@@ -591,7 +593,8 @@ static void rc4030_do_dma(void *opaque, int n, uint8_t *buf, int len, int is_wri
     hwaddr dma_addr;
     int dev_to_mem;
 
-    s->dma_regs[n][DMA_REG_ENABLE] &= ~(DMA_FLAG_TC_INTR | DMA_FLAG_MEM_INTR | DMA_FLAG_ADDR_INTR);
+    s->dma_regs[n][DMA_REG_ENABLE] &=
+           ~(DMA_FLAG_TC_INTR | DMA_FLAG_MEM_INTR | DMA_FLAG_ADDR_INTR);
 
     /* Check DMA channel consistency */
     dev_to_mem = (s->dma_regs[n][DMA_REG_ENABLE] & DMA_FLAG_MEM_TO_DEV) ? 0 : 1;
@@ -603,8 +606,9 @@ static void rc4030_do_dma(void *opaque, int n, uint8_t *buf, int len, int is_wri
     }
 
     /* Get start address and len */
-    if (len > s->dma_regs[n][DMA_REG_COUNT])
+    if (len > s->dma_regs[n][DMA_REG_COUNT]) {
         len = s->dma_regs[n][DMA_REG_COUNT];
+    }
     dma_addr = s->dma_regs[n][DMA_REG_ADDRESS];
 
     /* Read/write data at right place */
-- 
2.7.4



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

* Re: [Qemu-devel] [PATCH 2/2] dma/rc4030: Minor code style cleanup
  2019-06-25 14:27 ` [Qemu-devel] [PATCH 2/2] dma/rc4030: Minor code style cleanup Aleksandar Markovic
@ 2019-06-25 14:33   ` Aleksandar Rikalo
  2019-06-25 14:40   ` Philippe Mathieu-Daudé
  2019-07-02  4:43   ` Hervé Poussineau
  2 siblings, 0 replies; 9+ messages in thread
From: Aleksandar Rikalo @ 2019-06-25 14:33 UTC (permalink / raw)
  To: Aleksandar Markovic, qemu-devel; +Cc: hpoussin, f4bug, Aleksandar Markovic

> From: Aleksandar Markovic <aleksandar.markovic@rt-rk.com>
> Sent: Tuesday, June 25, 2019 4:27 PM
> To: qemu-devel@nongnu.org
> Cc: Aleksandar Markovic; Aleksandar Rikalo; hpoussin@reactos.org; f4bug@amsat.org
> Subject: [PATCH 2/2] dma/rc4030: Minor code style cleanup
>
> From: Aleksandar Markovic <amarkovic@wavecomp.com>
>
> Fix some simple checkpatch.pl warnings in rc4030.c.
>
> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
> ---
>  hw/dma/rc4030.c | 18 +++++++++++-------
>  1 file changed, 11 insertions(+), 7 deletions(-)
>
> diff --git a/hw/dma/rc4030.c b/hw/dma/rc4030.c
> index 88ff271..155af9b 100644
> --- a/hw/dma/rc4030.c
> +++ b/hw/dma/rc4030.c
> @@ -58,8 +58,8 @@ typedef struct dma_pagetable_entry {
>
>  #define TYPE_RC4030_IOMMU_MEMORY_REGION "rc4030-iommu-memory-region"
>
> -typedef struct rc4030State
> -{
> +typedef struct rc4030State {
> +
>      SysBusDevice parent;
>
>      uint32_t config; /* 0x0000: RC4030 config register */
> @@ -152,8 +152,9 @@ static uint64_t rc4030_read(void *opaque, hwaddr addr, unsigned int size)
>      case 0x0058:
>          val = s->cache_bmask;
>          /* HACK */
> -        if (s->cache_bmask == (uint32_t)-1)
> +        if (s->cache_bmask == (uint32_t)-1) {
>              s->cache_bmask = 0;
> +        }
>          break;
>      /* Remote Speed Registers */
>      case 0x0070:
> @@ -538,8 +539,9 @@ static void rc4030_reset(DeviceState *dev)
>
>      s->memory_refresh_rate = 0x18186;
>      s->nvram_protect = 7;
> -    for (i = 0; i < 15; i++)
> +    for (i = 0; i < 15; i++) {
>          s->rem_speed[i] = 7;
> +    }
>      s->imr_jazz = 0x10; /* XXX: required by firmware, but why? */
>      s->isr_jazz = 0;
>
> @@ -551,7 +553,7 @@ static void rc4030_reset(DeviceState *dev)
>
>  static int rc4030_post_load(void *opaque, int version_id)
>  {
> -    rc4030State* s = opaque;
> +    rc4030State *s = opaque;
>
>      set_next_tick(s);
>      update_jazz_irq(s);
> @@ -591,7 +593,8 @@ static void rc4030_do_dma(void *opaque, int n, uint8_t *buf, int len, int is_wri
>      hwaddr dma_addr;
>      int dev_to_mem;
>
> -    s->dma_regs[n][DMA_REG_ENABLE] &= ~(DMA_FLAG_TC_INTR | DMA_FLAG_MEM_INTR | DMA_FLAG_ADDR_INTR);
> +    s->dma_regs[n][DMA_REG_ENABLE] &=
> +           ~(DMA_FLAG_TC_INTR | DMA_FLAG_MEM_INTR | DMA_FLAG_ADDR_INTR);
>
>      /* Check DMA channel consistency */
>      dev_to_mem = (s->dma_regs[n][DMA_REG_ENABLE] & DMA_FLAG_MEM_TO_DEV) ? 0 : 1;
> @@ -603,8 +606,9 @@ static void rc4030_do_dma(void *opaque, int n, uint8_t *buf, int len, int is_wri
>      }
>
>      /* Get start address and len */
> -    if (len > s->dma_regs[n][DMA_REG_COUNT])
> +    if (len > s->dma_regs[n][DMA_REG_COUNT]) {
>          len = s->dma_regs[n][DMA_REG_COUNT];
> +    }
>      dma_addr = s->dma_regs[n][DMA_REG_ADDRESS];
>
>      /* Read/write data at right place */
> --
> 2.7.4

Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>


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

* Re: [Qemu-devel] [PATCH 1/2] dma/rc4030: Fix off-by-one error in specified memory region size
  2019-06-25 14:27 ` [Qemu-devel] [PATCH 1/2] dma/rc4030: Fix off-by-one error in specified memory region size Aleksandar Markovic
@ 2019-06-25 14:34   ` Aleksandar Rikalo
  2019-06-25 14:39   ` Philippe Mathieu-Daudé
  2019-07-02  4:43   ` Hervé Poussineau
  2 siblings, 0 replies; 9+ messages in thread
From: Aleksandar Rikalo @ 2019-06-25 14:34 UTC (permalink / raw)
  To: Aleksandar Markovic, qemu-devel; +Cc: hpoussin, f4bug, Aleksandar Markovic

> From: Aleksandar Markovic <aleksandar.markovic@rt-rk.com>
> Sent: Tuesday, June 25, 2019 4:27 PM
> To: qemu-devel@nongnu.org
> Cc: Aleksandar Markovic; Aleksandar Rikalo; hpoussin@reactos.org; f4bug@amsat.org
> Subject: [PATCH 1/2] dma/rc4030: Fix off-by-one error in specified memory region size
>
> From: Aleksandar Markovic <amarkovic@wavecomp.com>
>
> The size is one byte less than it should be:
>
> address-space: rc4030-dma
>   0000000000000000-00000000fffffffe (prio 0, i/o): rc4030.dma
>
> rc4030 is used in MIPS Jazz board context.
>
> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
> ---
>  hw/dma/rc4030.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/hw/dma/rc4030.c b/hw/dma/rc4030.c
> index 6ccafec..88ff271 100644
> --- a/hw/dma/rc4030.c
> +++ b/hw/dma/rc4030.c
> @@ -23,6 +23,7 @@
>   */
>
>  #include "qemu/osdep.h"
> +#include "qemu/units.h"
>  #include "hw/hw.h"
>  #include "hw/mips/mips.h"
>  #include "hw/sysbus.h"
> @@ -678,7 +679,7 @@ static void rc4030_realize(DeviceState *dev, Error **errp)
>
>      memory_region_init_iommu(&s->dma_mr, sizeof(s->dma_mr),
>                               TYPE_RC4030_IOMMU_MEMORY_REGION,
> -                             o, "rc4030.dma", UINT32_MAX);
> +                             o, "rc4030.dma", 4 * GiB);
>      address_space_init(&s->dma_as, MEMORY_REGION(&s->dma_mr), "rc4030-dma");
>  }
>
> --
> 2.7.4

Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>


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

* Re: [Qemu-devel] [PATCH 1/2] dma/rc4030: Fix off-by-one error in specified memory region size
  2019-06-25 14:27 ` [Qemu-devel] [PATCH 1/2] dma/rc4030: Fix off-by-one error in specified memory region size Aleksandar Markovic
  2019-06-25 14:34   ` Aleksandar Rikalo
@ 2019-06-25 14:39   ` Philippe Mathieu-Daudé
  2019-07-02  4:43   ` Hervé Poussineau
  2 siblings, 0 replies; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-06-25 14:39 UTC (permalink / raw)
  To: Aleksandar Markovic, qemu-devel; +Cc: arikalo, hpoussin, f4bug, amarkovic

On 6/25/19 4:27 PM, Aleksandar Markovic wrote:
> From: Aleksandar Markovic <amarkovic@wavecomp.com>
> 
> The size is one byte less than it should be:
> 
> address-space: rc4030-dma
>   0000000000000000-00000000fffffffe (prio 0, i/o): rc4030.dma
> 
> rc4030 is used in MIPS Jazz board context.

Ah thanks :) I was planing to send this once at home tonight.

> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

  (qemu) info mtree
  ...
  address-space: rc4030-dma
    0000000000000000-00000000ffffffff (prio 0, i/o): rc4030.dma

  address-space: dp8393x
    0000000000000000-00000000ffffffff (prio 0, i/o): rc4030.dma

Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> ---
>  hw/dma/rc4030.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/dma/rc4030.c b/hw/dma/rc4030.c
> index 6ccafec..88ff271 100644
> --- a/hw/dma/rc4030.c
> +++ b/hw/dma/rc4030.c
> @@ -23,6 +23,7 @@
>   */
>  
>  #include "qemu/osdep.h"
> +#include "qemu/units.h"
>  #include "hw/hw.h"
>  #include "hw/mips/mips.h"
>  #include "hw/sysbus.h"
> @@ -678,7 +679,7 @@ static void rc4030_realize(DeviceState *dev, Error **errp)
>  
>      memory_region_init_iommu(&s->dma_mr, sizeof(s->dma_mr),
>                               TYPE_RC4030_IOMMU_MEMORY_REGION,
> -                             o, "rc4030.dma", UINT32_MAX);
> +                             o, "rc4030.dma", 4 * GiB);
>      address_space_init(&s->dma_as, MEMORY_REGION(&s->dma_mr), "rc4030-dma");
>  }
>  
> 


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

* Re: [Qemu-devel] [PATCH 2/2] dma/rc4030: Minor code style cleanup
  2019-06-25 14:27 ` [Qemu-devel] [PATCH 2/2] dma/rc4030: Minor code style cleanup Aleksandar Markovic
  2019-06-25 14:33   ` Aleksandar Rikalo
@ 2019-06-25 14:40   ` Philippe Mathieu-Daudé
  2019-07-02  4:43   ` Hervé Poussineau
  2 siblings, 0 replies; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-06-25 14:40 UTC (permalink / raw)
  To: Aleksandar Markovic, qemu-devel; +Cc: arikalo, hpoussin, f4bug, amarkovic

On 6/25/19 4:27 PM, Aleksandar Markovic wrote:
> From: Aleksandar Markovic <amarkovic@wavecomp.com>
> 
> Fix some simple checkpatch.pl warnings in rc4030.c.
> 
> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> ---
>  hw/dma/rc4030.c | 18 +++++++++++-------
>  1 file changed, 11 insertions(+), 7 deletions(-)
> 
> diff --git a/hw/dma/rc4030.c b/hw/dma/rc4030.c
> index 88ff271..155af9b 100644
> --- a/hw/dma/rc4030.c
> +++ b/hw/dma/rc4030.c
> @@ -58,8 +58,8 @@ typedef struct dma_pagetable_entry {
>  
>  #define TYPE_RC4030_IOMMU_MEMORY_REGION "rc4030-iommu-memory-region"
>  
> -typedef struct rc4030State
> -{
> +typedef struct rc4030State {
> +
>      SysBusDevice parent;
>  
>      uint32_t config; /* 0x0000: RC4030 config register */
> @@ -152,8 +152,9 @@ static uint64_t rc4030_read(void *opaque, hwaddr addr, unsigned int size)
>      case 0x0058:
>          val = s->cache_bmask;
>          /* HACK */
> -        if (s->cache_bmask == (uint32_t)-1)
> +        if (s->cache_bmask == (uint32_t)-1) {
>              s->cache_bmask = 0;
> +        }
>          break;
>      /* Remote Speed Registers */
>      case 0x0070:
> @@ -538,8 +539,9 @@ static void rc4030_reset(DeviceState *dev)
>  
>      s->memory_refresh_rate = 0x18186;
>      s->nvram_protect = 7;
> -    for (i = 0; i < 15; i++)
> +    for (i = 0; i < 15; i++) {
>          s->rem_speed[i] = 7;
> +    }
>      s->imr_jazz = 0x10; /* XXX: required by firmware, but why? */
>      s->isr_jazz = 0;
>  
> @@ -551,7 +553,7 @@ static void rc4030_reset(DeviceState *dev)
>  
>  static int rc4030_post_load(void *opaque, int version_id)
>  {
> -    rc4030State* s = opaque;
> +    rc4030State *s = opaque;
>  
>      set_next_tick(s);
>      update_jazz_irq(s);
> @@ -591,7 +593,8 @@ static void rc4030_do_dma(void *opaque, int n, uint8_t *buf, int len, int is_wri
>      hwaddr dma_addr;
>      int dev_to_mem;
>  
> -    s->dma_regs[n][DMA_REG_ENABLE] &= ~(DMA_FLAG_TC_INTR | DMA_FLAG_MEM_INTR | DMA_FLAG_ADDR_INTR);
> +    s->dma_regs[n][DMA_REG_ENABLE] &=
> +           ~(DMA_FLAG_TC_INTR | DMA_FLAG_MEM_INTR | DMA_FLAG_ADDR_INTR);
>  
>      /* Check DMA channel consistency */
>      dev_to_mem = (s->dma_regs[n][DMA_REG_ENABLE] & DMA_FLAG_MEM_TO_DEV) ? 0 : 1;
> @@ -603,8 +606,9 @@ static void rc4030_do_dma(void *opaque, int n, uint8_t *buf, int len, int is_wri
>      }
>  
>      /* Get start address and len */
> -    if (len > s->dma_regs[n][DMA_REG_COUNT])
> +    if (len > s->dma_regs[n][DMA_REG_COUNT]) {
>          len = s->dma_regs[n][DMA_REG_COUNT];
> +    }
>      dma_addr = s->dma_regs[n][DMA_REG_ADDRESS];
>  
>      /* Read/write data at right place */
> 


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

* Re: [Qemu-devel] [PATCH 2/2] dma/rc4030: Minor code style cleanup
  2019-06-25 14:27 ` [Qemu-devel] [PATCH 2/2] dma/rc4030: Minor code style cleanup Aleksandar Markovic
  2019-06-25 14:33   ` Aleksandar Rikalo
  2019-06-25 14:40   ` Philippe Mathieu-Daudé
@ 2019-07-02  4:43   ` Hervé Poussineau
  2 siblings, 0 replies; 9+ messages in thread
From: Hervé Poussineau @ 2019-07-02  4:43 UTC (permalink / raw)
  To: Aleksandar Markovic, qemu-devel; +Cc: arikalo, f4bug, amarkovic

Le 25/06/2019 à 16:27, Aleksandar Markovic a écrit :
> From: Aleksandar Markovic <amarkovic@wavecomp.com>
> 
> Fix some simple checkpatch.pl warnings in rc4030.c.
> 
> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>

Reviewed-by: Hervé Poussineau <hpoussin@reactos.org>

> ---
>   hw/dma/rc4030.c | 18 +++++++++++-------
>   1 file changed, 11 insertions(+), 7 deletions(-)
> 
> diff --git a/hw/dma/rc4030.c b/hw/dma/rc4030.c
> index 88ff271..155af9b 100644
> --- a/hw/dma/rc4030.c
> +++ b/hw/dma/rc4030.c
> @@ -58,8 +58,8 @@ typedef struct dma_pagetable_entry {
>   
>   #define TYPE_RC4030_IOMMU_MEMORY_REGION "rc4030-iommu-memory-region"
>   
> -typedef struct rc4030State
> -{
> +typedef struct rc4030State {
> +
>       SysBusDevice parent;
>   
>       uint32_t config; /* 0x0000: RC4030 config register */
> @@ -152,8 +152,9 @@ static uint64_t rc4030_read(void *opaque, hwaddr addr, unsigned int size)
>       case 0x0058:
>           val = s->cache_bmask;
>           /* HACK */
> -        if (s->cache_bmask == (uint32_t)-1)
> +        if (s->cache_bmask == (uint32_t)-1) {
>               s->cache_bmask = 0;
> +        }
>           break;
>       /* Remote Speed Registers */
>       case 0x0070:
> @@ -538,8 +539,9 @@ static void rc4030_reset(DeviceState *dev)
>   
>       s->memory_refresh_rate = 0x18186;
>       s->nvram_protect = 7;
> -    for (i = 0; i < 15; i++)
> +    for (i = 0; i < 15; i++) {
>           s->rem_speed[i] = 7;
> +    }
>       s->imr_jazz = 0x10; /* XXX: required by firmware, but why? */
>       s->isr_jazz = 0;
>   
> @@ -551,7 +553,7 @@ static void rc4030_reset(DeviceState *dev)
>   
>   static int rc4030_post_load(void *opaque, int version_id)
>   {
> -    rc4030State* s = opaque;
> +    rc4030State *s = opaque;
>   
>       set_next_tick(s);
>       update_jazz_irq(s);
> @@ -591,7 +593,8 @@ static void rc4030_do_dma(void *opaque, int n, uint8_t *buf, int len, int is_wri
>       hwaddr dma_addr;
>       int dev_to_mem;
>   
> -    s->dma_regs[n][DMA_REG_ENABLE] &= ~(DMA_FLAG_TC_INTR | DMA_FLAG_MEM_INTR | DMA_FLAG_ADDR_INTR);
> +    s->dma_regs[n][DMA_REG_ENABLE] &=
> +           ~(DMA_FLAG_TC_INTR | DMA_FLAG_MEM_INTR | DMA_FLAG_ADDR_INTR);
>   
>       /* Check DMA channel consistency */
>       dev_to_mem = (s->dma_regs[n][DMA_REG_ENABLE] & DMA_FLAG_MEM_TO_DEV) ? 0 : 1;
> @@ -603,8 +606,9 @@ static void rc4030_do_dma(void *opaque, int n, uint8_t *buf, int len, int is_wri
>       }
>   
>       /* Get start address and len */
> -    if (len > s->dma_regs[n][DMA_REG_COUNT])
> +    if (len > s->dma_regs[n][DMA_REG_COUNT]) {
>           len = s->dma_regs[n][DMA_REG_COUNT];
> +    }
>       dma_addr = s->dma_regs[n][DMA_REG_ADDRESS];
>   
>       /* Read/write data at right place */
> 



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

* Re: [Qemu-devel] [PATCH 1/2] dma/rc4030: Fix off-by-one error in specified memory region size
  2019-06-25 14:27 ` [Qemu-devel] [PATCH 1/2] dma/rc4030: Fix off-by-one error in specified memory region size Aleksandar Markovic
  2019-06-25 14:34   ` Aleksandar Rikalo
  2019-06-25 14:39   ` Philippe Mathieu-Daudé
@ 2019-07-02  4:43   ` Hervé Poussineau
  2 siblings, 0 replies; 9+ messages in thread
From: Hervé Poussineau @ 2019-07-02  4:43 UTC (permalink / raw)
  To: Aleksandar Markovic, qemu-devel; +Cc: arikalo, f4bug, amarkovic

Le 25/06/2019 à 16:27, Aleksandar Markovic a écrit :
> From: Aleksandar Markovic <amarkovic@wavecomp.com>
> 
> The size is one byte less than it should be:
> 
> address-space: rc4030-dma
>    0000000000000000-00000000fffffffe (prio 0, i/o): rc4030.dma
> 
> rc4030 is used in MIPS Jazz board context.
> 
> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>

Reviewed-by: Hervé Poussineau <hpoussin@reactos.org>

> ---
>   hw/dma/rc4030.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/dma/rc4030.c b/hw/dma/rc4030.c
> index 6ccafec..88ff271 100644
> --- a/hw/dma/rc4030.c
> +++ b/hw/dma/rc4030.c
> @@ -23,6 +23,7 @@
>    */
>   
>   #include "qemu/osdep.h"
> +#include "qemu/units.h"
>   #include "hw/hw.h"
>   #include "hw/mips/mips.h"
>   #include "hw/sysbus.h"
> @@ -678,7 +679,7 @@ static void rc4030_realize(DeviceState *dev, Error **errp)
>   
>       memory_region_init_iommu(&s->dma_mr, sizeof(s->dma_mr),
>                                TYPE_RC4030_IOMMU_MEMORY_REGION,
> -                             o, "rc4030.dma", UINT32_MAX);
> +                             o, "rc4030.dma", 4 * GiB);
>       address_space_init(&s->dma_as, MEMORY_REGION(&s->dma_mr), "rc4030-dma");
>   }
>   
> 



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

end of thread, other threads:[~2019-07-02  4:45 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-25 14:27 [Qemu-devel] [PATCH 0/2] target/mips: jazz: rc4030: Minor cleanups Aleksandar Markovic
2019-06-25 14:27 ` [Qemu-devel] [PATCH 1/2] dma/rc4030: Fix off-by-one error in specified memory region size Aleksandar Markovic
2019-06-25 14:34   ` Aleksandar Rikalo
2019-06-25 14:39   ` Philippe Mathieu-Daudé
2019-07-02  4:43   ` Hervé Poussineau
2019-06-25 14:27 ` [Qemu-devel] [PATCH 2/2] dma/rc4030: Minor code style cleanup Aleksandar Markovic
2019-06-25 14:33   ` Aleksandar Rikalo
2019-06-25 14:40   ` Philippe Mathieu-Daudé
2019-07-02  4:43   ` Hervé Poussineau

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