qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] megasas: Fix compilation for 32 bit hosts
@ 2012-07-10  5:41 Stefan Weil
  2012-07-10  6:00 ` Hannes Reinecke
  2012-07-10 13:39 ` Anthony Liguori
  0 siblings, 2 replies; 5+ messages in thread
From: Stefan Weil @ 2012-07-10  5:41 UTC (permalink / raw)
  To: Anthony Liguori
  Cc: Hannes Reinecke, Paolo Bonzini, Stefan Weil, qemu-devel,
	Alexander Graf

Cc: Hannes Reinecke <hare@suse.de>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
 default-configs/pci.mak |    4 ++++
 hw/megasas.c            |   13 +++++++------
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/default-configs/pci.mak b/default-configs/pci.mak
index 9d3e1db..120b69d 100644
--- a/default-configs/pci.mak
+++ b/default-configs/pci.mak
@@ -5,6 +5,10 @@ CONFIG_USB_UHCI=y
 CONFIG_USB_OHCI=y
 CONFIG_USB_EHCI=y
 CONFIG_USB_XHCI=y
+
+# RAID adapter
+CONFIG_MEGASAS_SCSI_PCI=y
+
 CONFIG_NE2000_PCI=y
 CONFIG_EEPRO100_PCI=y
 CONFIG_PCNET_PCI=y
diff --git a/hw/megasas.c b/hw/megasas.c
index b48836f..26cf118 100644
--- a/hw/megasas.c
+++ b/hw/megasas.c
@@ -372,12 +372,13 @@ static uint64_t megasas_fw_time(void)
     return bcd_time;
 }
 
-static uint64_t megasas_gen_sas_addr(uint64_t id)
+static uint64_t megasas_gen_sas_addr(void *p)
 {
+    uint64_t id = (uintptr_t)p;
     uint64_t addr;
 
     addr = 0x5001a4aULL << 36;
-    addr |= id & 0xfffffffff;
+    addr |= id & 0xfffffffffULL;
 
     return addr;
 }
@@ -672,7 +673,7 @@ static int megasas_ctrl_get_info(MegasasState *s, MegasasCmd *cmd)
     info.host.type = MFI_INFO_HOST_PCIX;
     info.device.type = MFI_INFO_DEV_SAS3G;
     info.device.port_count = 2;
-    info.device.port_addr[0] = cpu_to_le64(megasas_gen_sas_addr((uint64_t)s));
+    info.device.port_addr[0] = cpu_to_le64(megasas_gen_sas_addr(s));
 
     memcpy(info.product_name, "MegaRAID SAS 8708EM2", 20);
     snprintf(info.serial_number, 32, "QEMU%08lx",
@@ -761,7 +762,7 @@ static int megasas_mfc_get_defaults(MegasasState *s, MegasasCmd *cmd)
         return MFI_STAT_INVALID_PARAMETER;
     }
 
-    info.sas_addr = cpu_to_le64(megasas_gen_sas_addr((uint64_t)s));
+    info.sas_addr = cpu_to_le64(megasas_gen_sas_addr(s));
     info.stripe_size = 3;
     info.flush_time = 4;
     info.background_rate = 30;
@@ -891,7 +892,7 @@ static int megasas_dcmd_pd_get_list(MegasasState *s, MegasasCmd *cmd)
         info.addr[num_pd_disks].scsi_dev_type = sdev->type;
         info.addr[num_pd_disks].connect_port_bitmap = 0x1;
         info.addr[num_pd_disks].sas_addr[0] =
-            cpu_to_le64(megasas_gen_sas_addr((uint64_t)sdev));
+            cpu_to_le64(megasas_gen_sas_addr(sdev));
         num_pd_disks++;
         offset += sizeof(struct mfi_pd_address);
     }
@@ -994,7 +995,7 @@ static int megasas_pd_get_info_submit(SCSIDevice *sdev, int lun,
     info->slot_number = (sdev->id & 0xFF);
     info->path_info.count = 1;
     info->path_info.sas_addr[0] =
-        cpu_to_le64(megasas_gen_sas_addr((uint64_t)sdev));
+        cpu_to_le64(megasas_gen_sas_addr(sdev));
     info->connected_port_bitmap = 0x1;
     info->device_speed = 1;
     info->link_speed = 1;
-- 
1.7.0.4

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

* Re: [Qemu-devel] [PATCH] megasas: Fix compilation for 32 bit hosts
  2012-07-10  5:41 [Qemu-devel] [PATCH] megasas: Fix compilation for 32 bit hosts Stefan Weil
@ 2012-07-10  6:00 ` Hannes Reinecke
  2012-07-10  6:03   ` Stefan Weil
  2012-07-10 13:39 ` Anthony Liguori
  1 sibling, 1 reply; 5+ messages in thread
From: Hannes Reinecke @ 2012-07-10  6:00 UTC (permalink / raw)
  To: Stefan Weil; +Cc: Paolo Bonzini, Anthony Liguori, qemu-devel, Alexander Graf

Hi Stefan,

you might've seen that Anthony objected to this in general.
Apparently I'm not allowed to use the instance address to seed the
SAS address.

So yes, your fix is valid, but might be pointless as I might have to
re-do this section anyway.
But wait and see what Anthony has to say here.

Cheers,

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

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

* Re: [Qemu-devel] [PATCH] megasas: Fix compilation for 32 bit hosts
  2012-07-10  6:00 ` Hannes Reinecke
@ 2012-07-10  6:03   ` Stefan Weil
  2012-07-10  8:39     ` Hannes Reinecke
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Weil @ 2012-07-10  6:03 UTC (permalink / raw)
  To: Hannes Reinecke
  Cc: Stefan Weil, Anthony Liguori, qemu-devel, Alexander Graf,
	Paolo Bonzini

Am 10.07.2012 08:00, schrieb Hannes Reinecke:
> Hi Stefan,
>
> you might've seen that Anthony objected to this in general.
> Apparently I'm not allowed to use the instance address to seed the
> SAS address.
>
> So yes, your fix is valid, but might be pointless as I might have to
> re-do this section anyway.
> But wait and see what Anthony has to say here.
>
> Cheers,
>
> Hannes

There remains an additional problem with megasas_dcmd_dump_frame
because it takes too many arguments.

Builds with the simple trace backend fail.

Cheers,

Stefan

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

* Re: [Qemu-devel] [PATCH] megasas: Fix compilation for 32 bit hosts
  2012-07-10  6:03   ` Stefan Weil
@ 2012-07-10  8:39     ` Hannes Reinecke
  0 siblings, 0 replies; 5+ messages in thread
From: Hannes Reinecke @ 2012-07-10  8:39 UTC (permalink / raw)
  To: Stefan Weil; +Cc: Paolo Bonzini, Anthony Liguori, qemu-devel, Alexander Graf

On 07/10/2012 08:03 AM, Stefan Weil wrote:
> Am 10.07.2012 08:00, schrieb Hannes Reinecke:
>> Hi Stefan,
>>
>> you might've seen that Anthony objected to this in general.
>> Apparently I'm not allowed to use the instance address to seed the
>> SAS address.
>>
>> So yes, your fix is valid, but might be pointless as I might have to
>> re-do this section anyway.
>> But wait and see what Anthony has to say here.
>>
>> Cheers,
>>
>> Hannes
> 
> There remains an additional problem with megasas_dcmd_dump_frame
> because it takes too many arguments.
> 
> Builds with the simple trace backend fail.
> 
Yeah. Apparently the trace infrastructure can't handle 9 arguments.

I'll be sending a patch.

Cheers,

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

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

* Re: [Qemu-devel] [PATCH] megasas: Fix compilation for 32 bit hosts
  2012-07-10  5:41 [Qemu-devel] [PATCH] megasas: Fix compilation for 32 bit hosts Stefan Weil
  2012-07-10  6:00 ` Hannes Reinecke
@ 2012-07-10 13:39 ` Anthony Liguori
  1 sibling, 0 replies; 5+ messages in thread
From: Anthony Liguori @ 2012-07-10 13:39 UTC (permalink / raw)
  To: Stefan Weil; +Cc: Paolo Bonzini, Alexander Graf, Hannes Reinecke, qemu-devel

On 07/10/2012 12:41 AM, Stefan Weil wrote:
> Cc: Hannes Reinecke<hare@suse.de>
> Signed-off-by: Stefan Weil<sw@weilnetz.de>
> ---
>   default-configs/pci.mak |    4 ++++
>   hw/megasas.c            |   13 +++++++------
>   2 files changed, 11 insertions(+), 6 deletions(-)
>
> diff --git a/default-configs/pci.mak b/default-configs/pci.mak
> index 9d3e1db..120b69d 100644
> --- a/default-configs/pci.mak
> +++ b/default-configs/pci.mak
> @@ -5,6 +5,10 @@ CONFIG_USB_UHCI=y
>   CONFIG_USB_OHCI=y
>   CONFIG_USB_EHCI=y
>   CONFIG_USB_XHCI=y
> +
> +# RAID adapter
> +CONFIG_MEGASAS_SCSI_PCI=y
> +
>   CONFIG_NE2000_PCI=y
>   CONFIG_EEPRO100_PCI=y
>   CONFIG_PCNET_PCI=y
> diff --git a/hw/megasas.c b/hw/megasas.c
> index b48836f..26cf118 100644
> --- a/hw/megasas.c
> +++ b/hw/megasas.c
> @@ -372,12 +372,13 @@ static uint64_t megasas_fw_time(void)
>       return bcd_time;
>   }
>
> -static uint64_t megasas_gen_sas_addr(uint64_t id)
> +static uint64_t megasas_gen_sas_addr(void *p)
>   {
> +    uint64_t id = (uintptr_t)p;


I said in another note that this isn't acceptable.  This sort of thing is an ABI 
issue so it needs to be fixed properly.

Regards,

Anthony Liguori

>       uint64_t addr;
>
>       addr = 0x5001a4aULL<<  36;
> -    addr |= id&  0xfffffffff;
> +    addr |= id&  0xfffffffffULL;
>
>       return addr;
>   }
> @@ -672,7 +673,7 @@ static int megasas_ctrl_get_info(MegasasState *s, MegasasCmd *cmd)
>       info.host.type = MFI_INFO_HOST_PCIX;
>       info.device.type = MFI_INFO_DEV_SAS3G;
>       info.device.port_count = 2;
> -    info.device.port_addr[0] = cpu_to_le64(megasas_gen_sas_addr((uint64_t)s));
> +    info.device.port_addr[0] = cpu_to_le64(megasas_gen_sas_addr(s));
>
>       memcpy(info.product_name, "MegaRAID SAS 8708EM2", 20);
>       snprintf(info.serial_number, 32, "QEMU%08lx",
> @@ -761,7 +762,7 @@ static int megasas_mfc_get_defaults(MegasasState *s, MegasasCmd *cmd)
>           return MFI_STAT_INVALID_PARAMETER;
>       }
>
> -    info.sas_addr = cpu_to_le64(megasas_gen_sas_addr((uint64_t)s));
> +    info.sas_addr = cpu_to_le64(megasas_gen_sas_addr(s));
>       info.stripe_size = 3;
>       info.flush_time = 4;
>       info.background_rate = 30;
> @@ -891,7 +892,7 @@ static int megasas_dcmd_pd_get_list(MegasasState *s, MegasasCmd *cmd)
>           info.addr[num_pd_disks].scsi_dev_type = sdev->type;
>           info.addr[num_pd_disks].connect_port_bitmap = 0x1;
>           info.addr[num_pd_disks].sas_addr[0] =
> -            cpu_to_le64(megasas_gen_sas_addr((uint64_t)sdev));
> +            cpu_to_le64(megasas_gen_sas_addr(sdev));
>           num_pd_disks++;
>           offset += sizeof(struct mfi_pd_address);
>       }
> @@ -994,7 +995,7 @@ static int megasas_pd_get_info_submit(SCSIDevice *sdev, int lun,
>       info->slot_number = (sdev->id&  0xFF);
>       info->path_info.count = 1;
>       info->path_info.sas_addr[0] =
> -        cpu_to_le64(megasas_gen_sas_addr((uint64_t)sdev));
> +        cpu_to_le64(megasas_gen_sas_addr(sdev));
>       info->connected_port_bitmap = 0x1;
>       info->device_speed = 1;
>       info->link_speed = 1;

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

end of thread, other threads:[~2012-07-10 13:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-10  5:41 [Qemu-devel] [PATCH] megasas: Fix compilation for 32 bit hosts Stefan Weil
2012-07-10  6:00 ` Hannes Reinecke
2012-07-10  6:03   ` Stefan Weil
2012-07-10  8:39     ` Hannes Reinecke
2012-07-10 13:39 ` Anthony Liguori

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