qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] megasas: Add write function to handle write access to PCI BAR 3
@ 2015-07-27  8:51 Salva Peiró
  2015-07-27  8:57 ` Hannes Reinecke
  0 siblings, 1 reply; 3+ messages in thread
From: Salva Peiró @ 2015-07-27  8:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Hannes Reinecke, qemu-block, Salva Peiró

This patch fixes a QEMU SEGFAULT when a write operation is performed on
the memory region of the PCI BAR 3 (base address space).
When a writeb(0xe0000000) is performed the .write function is invoked to
handle the write access, however, since the .write is not initialised,
the call to 0, causes QEMU to SEGFAULT.

Signed-off-by: Salva Peiró <speirofr@gmail.com>
---
 hw/scsi/megasas.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
index 51ba9e0..a04369c 100644
--- a/hw/scsi/megasas.c
+++ b/hw/scsi/megasas.c
@@ -2202,8 +2202,15 @@ static uint64_t megasas_queue_read(void *opaque, hwaddr addr,
     return 0;
 }
 
+static void megasas_queue_write(void *opaque, hwaddr addr,
+                               uint64_t val, unsigned size)
+{
+    return;
+}
+
 static const MemoryRegionOps megasas_queue_ops = {
     .read = megasas_queue_read,
+    .write = megasas_queue_write,
     .endianness = DEVICE_LITTLE_ENDIAN,
     .impl = {
         .min_access_size = 8,
-- 
2.1.4

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

* Re: [Qemu-devel] [PATCH] megasas: Add write function to handle write access to PCI BAR 3
  2015-07-27  8:51 [Qemu-devel] [PATCH] megasas: Add write function to handle write access to PCI BAR 3 Salva Peiró
@ 2015-07-27  8:57 ` Hannes Reinecke
  2015-07-27 10:21   ` Paolo Bonzini
  0 siblings, 1 reply; 3+ messages in thread
From: Hannes Reinecke @ 2015-07-27  8:57 UTC (permalink / raw)
  To: Salva Peiró, qemu-devel; +Cc: Paolo Bonzini, qemu-block

On 07/27/2015 10:51 AM, Salva Peiró wrote:
> This patch fixes a QEMU SEGFAULT when a write operation is performed on
> the memory region of the PCI BAR 3 (base address space).
> When a writeb(0xe0000000) is performed the .write function is invoked to
> handle the write access, however, since the .write is not initialised,
> the call to 0, causes QEMU to SEGFAULT.
> 
> Signed-off-by: Salva Peiró <speirofr@gmail.com>
> ---
>  hw/scsi/megasas.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
> index 51ba9e0..a04369c 100644
> --- a/hw/scsi/megasas.c
> +++ b/hw/scsi/megasas.c
> @@ -2202,8 +2202,15 @@ static uint64_t megasas_queue_read(void *opaque, hwaddr addr,
>      return 0;
>  }
>  
> +static void megasas_queue_write(void *opaque, hwaddr addr,
> +                               uint64_t val, unsigned size)
> +{
> +    return;
> +}
> +
>  static const MemoryRegionOps megasas_queue_ops = {
>      .read = megasas_queue_read,
> +    .write = megasas_queue_write,
>      .endianness = DEVICE_LITTLE_ENDIAN,
>      .impl = {
>          .min_access_size = 8,
> 
Yep, that's the correct fix.

Acked-by: Hannes Reinecke <hare@suse.com>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		               zSeries & Storage
hare@suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)

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

* Re: [Qemu-devel] [PATCH] megasas: Add write function to handle write access to PCI BAR 3
  2015-07-27  8:57 ` Hannes Reinecke
@ 2015-07-27 10:21   ` Paolo Bonzini
  0 siblings, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2015-07-27 10:21 UTC (permalink / raw)
  To: Hannes Reinecke, Salva Peiró, qemu-devel; +Cc: qemu-block



On 27/07/2015 10:57, Hannes Reinecke wrote:
> Acked-by: Hannes Reinecke <hare@suse.com>

Thanks, applied for 2.4.

Paolo

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

end of thread, other threads:[~2015-07-27 10:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-27  8:51 [Qemu-devel] [PATCH] megasas: Add write function to handle write access to PCI BAR 3 Salva Peiró
2015-07-27  8:57 ` Hannes Reinecke
2015-07-27 10:21   ` 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).