qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] hw/mips/jazz: Fix implicit creation of "-drive if=scsi" devices
@ 2018-03-07  9:24 Thomas Huth
  2018-03-08  8:03 ` Hervé Poussineau
  2018-03-08 18:49 ` Paolo Bonzini
  0 siblings, 2 replies; 3+ messages in thread
From: Thomas Huth @ 2018-03-07  9:24 UTC (permalink / raw)
  To: qemu-devel, Paolo Bonzini, Hervé Poussineau
  Cc: Yongbok Kim, Aurelien Jarno, Fam Zheng

The global hack for creating SCSI devices has recently been removed,
but this apparently broke SCSI devices on some boards that were not
ready for this change yet. For the pica61 machine you now get:

$ mips64-softmmu/qemu-system-mips64 -M pica61 -cdrom x.iso
qemu-system-mips64: -cdrom x.iso: machine type does not support if=scsi,bus=0,unit=2

Fix it by calling scsi_bus_legacy_handle_cmdline() after creating the
corresponding SCSI controller.

Fixes: 1454509726719e0933c800fad00d6999752688ea
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 hw/mips/mips_jazz.c   |  7 ++++---
 hw/scsi/esp.c         | 12 +++++++-----
 include/hw/scsi/esp.h | 10 +++++-----
 3 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c
index b09871a..bde2c9b 100644
--- a/hw/mips/mips_jazz.c
+++ b/hw/mips/mips_jazz.c
@@ -147,6 +147,7 @@ static void mips_jazz_init(MachineState *machine,
     MemoryRegion *ram = g_new(MemoryRegion, 1);
     MemoryRegion *bios = g_new(MemoryRegion, 1);
     MemoryRegion *bios2 = g_new(MemoryRegion, 1);
+    ESPState *esp;
 
     /* init CPUs */
     cpu = MIPS_CPU(cpu_create(machine->cpu_type));
@@ -278,9 +279,9 @@ static void mips_jazz_init(MachineState *machine,
     }
 
     /* SCSI adapter */
-    esp_init(0x80002000, 0,
-             rc4030_dma_read, rc4030_dma_write, dmas[0],
-             qdev_get_gpio_in(rc4030, 5), &esp_reset, &dma_enable);
+    esp = esp_init(0x80002000, 0, rc4030_dma_read, rc4030_dma_write, dmas[0],
+                   qdev_get_gpio_in(rc4030, 5), &esp_reset, &dma_enable);
+    scsi_bus_legacy_handle_cmdline(&esp->bus);
 
     /* Floppy */
     for (n = 0; n < MAX_FD; n++) {
diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c
index 45975c2..64ec285 100644
--- a/hw/scsi/esp.c
+++ b/hw/scsi/esp.c
@@ -618,11 +618,11 @@ static const MemoryRegionOps sysbus_esp_mem_ops = {
     .valid.accepts = esp_mem_accepts,
 };
 
-void esp_init(hwaddr espaddr, int it_shift,
-              ESPDMAMemoryReadWriteFunc dma_memory_read,
-              ESPDMAMemoryReadWriteFunc dma_memory_write,
-              void *dma_opaque, qemu_irq irq, qemu_irq *reset,
-              qemu_irq *dma_enable)
+ESPState *esp_init(hwaddr espaddr, int it_shift,
+                   ESPDMAMemoryReadWriteFunc dma_memory_read,
+                   ESPDMAMemoryReadWriteFunc dma_memory_write,
+                   void *dma_opaque, qemu_irq irq, qemu_irq *reset,
+                   qemu_irq *dma_enable)
 {
     DeviceState *dev;
     SysBusDevice *s;
@@ -644,6 +644,8 @@ void esp_init(hwaddr espaddr, int it_shift,
     sysbus_mmio_map(s, 0, espaddr);
     *reset = qdev_get_gpio_in(dev, 0);
     *dma_enable = qdev_get_gpio_in(dev, 1);
+
+    return esp;
 }
 
 static const struct SCSIBusInfo esp_scsi_info = {
diff --git a/include/hw/scsi/esp.h b/include/hw/scsi/esp.h
index 3b160f8..93fdace 100644
--- a/include/hw/scsi/esp.h
+++ b/include/hw/scsi/esp.h
@@ -7,11 +7,6 @@
 /* esp.c */
 #define ESP_MAX_DEVS 7
 typedef void (*ESPDMAMemoryReadWriteFunc)(void *opaque, uint8_t *buf, int len);
-void esp_init(hwaddr espaddr, int it_shift,
-              ESPDMAMemoryReadWriteFunc dma_memory_read,
-              ESPDMAMemoryReadWriteFunc dma_memory_write,
-              void *dma_opaque, qemu_irq irq, qemu_irq *reset,
-              qemu_irq *dma_enable);
 
 #define ESP_REGS 16
 #define TI_BUFSZ 16
@@ -136,6 +131,11 @@ typedef struct {
 #define TCHI_FAS100A 0x4
 #define TCHI_AM53C974 0x12
 
+ESPState *esp_init(hwaddr espaddr, int it_shift,
+                   ESPDMAMemoryReadWriteFunc dma_memory_read,
+                   ESPDMAMemoryReadWriteFunc dma_memory_write,
+                   void *dma_opaque, qemu_irq irq, qemu_irq *reset,
+                   qemu_irq *dma_enable);
 void esp_dma_enable(ESPState *s, int irq, int level);
 void esp_request_cancelled(SCSIRequest *req);
 void esp_command_complete(SCSIRequest *req, uint32_t status, size_t resid);
-- 
1.8.3.1

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

* Re: [Qemu-devel] [PATCH] hw/mips/jazz: Fix implicit creation of "-drive if=scsi" devices
  2018-03-07  9:24 [Qemu-devel] [PATCH] hw/mips/jazz: Fix implicit creation of "-drive if=scsi" devices Thomas Huth
@ 2018-03-08  8:03 ` Hervé Poussineau
  2018-03-08 18:49 ` Paolo Bonzini
  1 sibling, 0 replies; 3+ messages in thread
From: Hervé Poussineau @ 2018-03-08  8:03 UTC (permalink / raw)
  To: Thomas Huth, qemu-devel, Paolo Bonzini
  Cc: Yongbok Kim, Aurelien Jarno, Fam Zheng

Le 07/03/2018 à 10:24, Thomas Huth a écrit :
> The global hack for creating SCSI devices has recently been removed,
> but this apparently broke SCSI devices on some boards that were not
> ready for this change yet. For the pica61 machine you now get:
> 
> $ mips64-softmmu/qemu-system-mips64 -M pica61 -cdrom x.iso
> qemu-system-mips64: -cdrom x.iso: machine type does not support if=scsi,bus=0,unit=2
> 
> Fix it by calling scsi_bus_legacy_handle_cmdline() after creating the
> corresponding SCSI controller.
> 
> Fixes: 1454509726719e0933c800fad00d6999752688ea
> Signed-off-by: Thomas Huth <thuth@redhat.com>

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

> ---
>   hw/mips/mips_jazz.c   |  7 ++++---
>   hw/scsi/esp.c         | 12 +++++++-----
>   include/hw/scsi/esp.h | 10 +++++-----
>   3 files changed, 16 insertions(+), 13 deletions(-)
> 
> diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c
> index b09871a..bde2c9b 100644
> --- a/hw/mips/mips_jazz.c
> +++ b/hw/mips/mips_jazz.c
> @@ -147,6 +147,7 @@ static void mips_jazz_init(MachineState *machine,
>       MemoryRegion *ram = g_new(MemoryRegion, 1);
>       MemoryRegion *bios = g_new(MemoryRegion, 1);
>       MemoryRegion *bios2 = g_new(MemoryRegion, 1);
> +    ESPState *esp;
>   
>       /* init CPUs */
>       cpu = MIPS_CPU(cpu_create(machine->cpu_type));
> @@ -278,9 +279,9 @@ static void mips_jazz_init(MachineState *machine,
>       }
>   
>       /* SCSI adapter */
> -    esp_init(0x80002000, 0,
> -             rc4030_dma_read, rc4030_dma_write, dmas[0],
> -             qdev_get_gpio_in(rc4030, 5), &esp_reset, &dma_enable);
> +    esp = esp_init(0x80002000, 0, rc4030_dma_read, rc4030_dma_write, dmas[0],
> +                   qdev_get_gpio_in(rc4030, 5), &esp_reset, &dma_enable);
> +    scsi_bus_legacy_handle_cmdline(&esp->bus);
>   
>       /* Floppy */
>       for (n = 0; n < MAX_FD; n++) {
> diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c
> index 45975c2..64ec285 100644
> --- a/hw/scsi/esp.c
> +++ b/hw/scsi/esp.c
> @@ -618,11 +618,11 @@ static const MemoryRegionOps sysbus_esp_mem_ops = {
>       .valid.accepts = esp_mem_accepts,
>   };
>   
> -void esp_init(hwaddr espaddr, int it_shift,
> -              ESPDMAMemoryReadWriteFunc dma_memory_read,
> -              ESPDMAMemoryReadWriteFunc dma_memory_write,
> -              void *dma_opaque, qemu_irq irq, qemu_irq *reset,
> -              qemu_irq *dma_enable)
> +ESPState *esp_init(hwaddr espaddr, int it_shift,
> +                   ESPDMAMemoryReadWriteFunc dma_memory_read,
> +                   ESPDMAMemoryReadWriteFunc dma_memory_write,
> +                   void *dma_opaque, qemu_irq irq, qemu_irq *reset,
> +                   qemu_irq *dma_enable)
>   {
>       DeviceState *dev;
>       SysBusDevice *s;
> @@ -644,6 +644,8 @@ void esp_init(hwaddr espaddr, int it_shift,
>       sysbus_mmio_map(s, 0, espaddr);
>       *reset = qdev_get_gpio_in(dev, 0);
>       *dma_enable = qdev_get_gpio_in(dev, 1);
> +
> +    return esp;
>   }
>   
>   static const struct SCSIBusInfo esp_scsi_info = {
> diff --git a/include/hw/scsi/esp.h b/include/hw/scsi/esp.h
> index 3b160f8..93fdace 100644
> --- a/include/hw/scsi/esp.h
> +++ b/include/hw/scsi/esp.h
> @@ -7,11 +7,6 @@
>   /* esp.c */
>   #define ESP_MAX_DEVS 7
>   typedef void (*ESPDMAMemoryReadWriteFunc)(void *opaque, uint8_t *buf, int len);
> -void esp_init(hwaddr espaddr, int it_shift,
> -              ESPDMAMemoryReadWriteFunc dma_memory_read,
> -              ESPDMAMemoryReadWriteFunc dma_memory_write,
> -              void *dma_opaque, qemu_irq irq, qemu_irq *reset,
> -              qemu_irq *dma_enable);
>   
>   #define ESP_REGS 16
>   #define TI_BUFSZ 16
> @@ -136,6 +131,11 @@ typedef struct {
>   #define TCHI_FAS100A 0x4
>   #define TCHI_AM53C974 0x12
>   
> +ESPState *esp_init(hwaddr espaddr, int it_shift,
> +                   ESPDMAMemoryReadWriteFunc dma_memory_read,
> +                   ESPDMAMemoryReadWriteFunc dma_memory_write,
> +                   void *dma_opaque, qemu_irq irq, qemu_irq *reset,
> +                   qemu_irq *dma_enable);
>   void esp_dma_enable(ESPState *s, int irq, int level);
>   void esp_request_cancelled(SCSIRequest *req);
>   void esp_command_complete(SCSIRequest *req, uint32_t status, size_t resid);
> 

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

* Re: [Qemu-devel] [PATCH] hw/mips/jazz: Fix implicit creation of "-drive if=scsi" devices
  2018-03-07  9:24 [Qemu-devel] [PATCH] hw/mips/jazz: Fix implicit creation of "-drive if=scsi" devices Thomas Huth
  2018-03-08  8:03 ` Hervé Poussineau
@ 2018-03-08 18:49 ` Paolo Bonzini
  1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2018-03-08 18:49 UTC (permalink / raw)
  To: Thomas Huth, qemu-devel, Hervé Poussineau
  Cc: Yongbok Kim, Aurelien Jarno, Fam Zheng

On 07/03/2018 10:24, Thomas Huth wrote:
> The global hack for creating SCSI devices has recently been removed,
> but this apparently broke SCSI devices on some boards that were not
> ready for this change yet. For the pica61 machine you now get:
> 
> $ mips64-softmmu/qemu-system-mips64 -M pica61 -cdrom x.iso
> qemu-system-mips64: -cdrom x.iso: machine type does not support if=scsi,bus=0,unit=2
> 
> Fix it by calling scsi_bus_legacy_handle_cmdline() after creating the
> corresponding SCSI controller.
> 
> Fixes: 1454509726719e0933c800fad00d6999752688ea
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  hw/mips/mips_jazz.c   |  7 ++++---
>  hw/scsi/esp.c         | 12 +++++++-----
>  include/hw/scsi/esp.h | 10 +++++-----
>  3 files changed, 16 insertions(+), 13 deletions(-)
> 
> diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c
> index b09871a..bde2c9b 100644
> --- a/hw/mips/mips_jazz.c
> +++ b/hw/mips/mips_jazz.c
> @@ -147,6 +147,7 @@ static void mips_jazz_init(MachineState *machine,
>      MemoryRegion *ram = g_new(MemoryRegion, 1);
>      MemoryRegion *bios = g_new(MemoryRegion, 1);
>      MemoryRegion *bios2 = g_new(MemoryRegion, 1);
> +    ESPState *esp;
>  
>      /* init CPUs */
>      cpu = MIPS_CPU(cpu_create(machine->cpu_type));
> @@ -278,9 +279,9 @@ static void mips_jazz_init(MachineState *machine,
>      }
>  
>      /* SCSI adapter */
> -    esp_init(0x80002000, 0,
> -             rc4030_dma_read, rc4030_dma_write, dmas[0],
> -             qdev_get_gpio_in(rc4030, 5), &esp_reset, &dma_enable);
> +    esp = esp_init(0x80002000, 0, rc4030_dma_read, rc4030_dma_write, dmas[0],
> +                   qdev_get_gpio_in(rc4030, 5), &esp_reset, &dma_enable);
> +    scsi_bus_legacy_handle_cmdline(&esp->bus);
>  
>      /* Floppy */
>      for (n = 0; n < MAX_FD; n++) {
> diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c
> index 45975c2..64ec285 100644
> --- a/hw/scsi/esp.c
> +++ b/hw/scsi/esp.c
> @@ -618,11 +618,11 @@ static const MemoryRegionOps sysbus_esp_mem_ops = {
>      .valid.accepts = esp_mem_accepts,
>  };
>  
> -void esp_init(hwaddr espaddr, int it_shift,
> -              ESPDMAMemoryReadWriteFunc dma_memory_read,
> -              ESPDMAMemoryReadWriteFunc dma_memory_write,
> -              void *dma_opaque, qemu_irq irq, qemu_irq *reset,
> -              qemu_irq *dma_enable)
> +ESPState *esp_init(hwaddr espaddr, int it_shift,
> +                   ESPDMAMemoryReadWriteFunc dma_memory_read,
> +                   ESPDMAMemoryReadWriteFunc dma_memory_write,
> +                   void *dma_opaque, qemu_irq irq, qemu_irq *reset,
> +                   qemu_irq *dma_enable)
>  {
>      DeviceState *dev;
>      SysBusDevice *s;
> @@ -644,6 +644,8 @@ void esp_init(hwaddr espaddr, int it_shift,
>      sysbus_mmio_map(s, 0, espaddr);
>      *reset = qdev_get_gpio_in(dev, 0);
>      *dma_enable = qdev_get_gpio_in(dev, 1);
> +
> +    return esp;
>  }
>  
>  static const struct SCSIBusInfo esp_scsi_info = {
> diff --git a/include/hw/scsi/esp.h b/include/hw/scsi/esp.h
> index 3b160f8..93fdace 100644
> --- a/include/hw/scsi/esp.h
> +++ b/include/hw/scsi/esp.h
> @@ -7,11 +7,6 @@
>  /* esp.c */
>  #define ESP_MAX_DEVS 7
>  typedef void (*ESPDMAMemoryReadWriteFunc)(void *opaque, uint8_t *buf, int len);
> -void esp_init(hwaddr espaddr, int it_shift,
> -              ESPDMAMemoryReadWriteFunc dma_memory_read,
> -              ESPDMAMemoryReadWriteFunc dma_memory_write,
> -              void *dma_opaque, qemu_irq irq, qemu_irq *reset,
> -              qemu_irq *dma_enable);
>  
>  #define ESP_REGS 16
>  #define TI_BUFSZ 16
> @@ -136,6 +131,11 @@ typedef struct {
>  #define TCHI_FAS100A 0x4
>  #define TCHI_AM53C974 0x12
>  
> +ESPState *esp_init(hwaddr espaddr, int it_shift,
> +                   ESPDMAMemoryReadWriteFunc dma_memory_read,
> +                   ESPDMAMemoryReadWriteFunc dma_memory_write,
> +                   void *dma_opaque, qemu_irq irq, qemu_irq *reset,
> +                   qemu_irq *dma_enable);
>  void esp_dma_enable(ESPState *s, int irq, int level);
>  void esp_request_cancelled(SCSIRequest *req);
>  void esp_command_complete(SCSIRequest *req, uint32_t status, size_t resid);
> 

Queued, thanks.

Paolo

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

end of thread, other threads:[~2018-03-08 18:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-07  9:24 [Qemu-devel] [PATCH] hw/mips/jazz: Fix implicit creation of "-drive if=scsi" devices Thomas Huth
2018-03-08  8:03 ` Hervé Poussineau
2018-03-08 18:49 ` 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).