diff mbox

[1/7] megasas: Enable MSI-X support

Message ID 1397632623-26353-2-git-send-email-hare@suse.de
State New
Headers show

Commit Message

Hannes Reinecke April 16, 2014, 7:16 a.m. UTC
MSI-X support has been fixed in qemu, so we can enable it again.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 hw/scsi/megasas.c | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

Comments

Alexander Graf April 16, 2014, 11:43 a.m. UTC | #1
On 16.04.14 09:16, Hannes Reinecke wrote:
> MSI-X support has been fixed in qemu, so we can enable it again.
>
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
>   hw/scsi/megasas.c | 20 ++++++--------------
>   1 file changed, 6 insertions(+), 14 deletions(-)
>
> diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
> index e6e1ffd..496bab8 100644
> --- a/hw/scsi/megasas.c
> +++ b/hw/scsi/megasas.c
> @@ -29,7 +29,7 @@
>   
>   #include "mfi.h"
>   
> -#define MEGASAS_VERSION "1.70"
> +#define MEGASAS_VERSION "1.71"

What happens when I create a VM on 2.0 and then run it with 2.1? Will 
the VM see a difference?


Alex
Hannes Reinecke April 16, 2014, 11:49 a.m. UTC | #2
On 04/16/2014 01:43 PM, Alexander Graf wrote:
> 
> On 16.04.14 09:16, Hannes Reinecke wrote:
>> MSI-X support has been fixed in qemu, so we can enable it again.
>>
>> Signed-off-by: Hannes Reinecke <hare@suse.de>
>> ---
>>   hw/scsi/megasas.c | 20 ++++++--------------
>>   1 file changed, 6 insertions(+), 14 deletions(-)
>>
>> diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
>> index e6e1ffd..496bab8 100644
>> --- a/hw/scsi/megasas.c
>> +++ b/hw/scsi/megasas.c
>> @@ -29,7 +29,7 @@
>>     #include "mfi.h"
>>   -#define MEGASAS_VERSION "1.70"
>> +#define MEGASAS_VERSION "1.71"
> 
> What happens when I create a VM on 2.0 and then run it with 2.1?
> Will the VM see a difference?
> 
The only difference you'll see is a different PCI configuration.
Other than that the behaviour will be identical.

For compatible behaviour you'd need to set 'use_msix=false' in the
megasas configuration.

If this really is an issue I can re-sent the patch with defaulting
back to 'false'.

Cheers,

Hannes
Alexander Graf April 16, 2014, 11:53 a.m. UTC | #3
On 16.04.14 13:49, Hannes Reinecke wrote:
> On 04/16/2014 01:43 PM, Alexander Graf wrote:
>> On 16.04.14 09:16, Hannes Reinecke wrote:
>>> MSI-X support has been fixed in qemu, so we can enable it again.
>>>
>>> Signed-off-by: Hannes Reinecke <hare@suse.de>
>>> ---
>>>    hw/scsi/megasas.c | 20 ++++++--------------
>>>    1 file changed, 6 insertions(+), 14 deletions(-)
>>>
>>> diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
>>> index e6e1ffd..496bab8 100644
>>> --- a/hw/scsi/megasas.c
>>> +++ b/hw/scsi/megasas.c
>>> @@ -29,7 +29,7 @@
>>>      #include "mfi.h"
>>>    -#define MEGASAS_VERSION "1.70"
>>> +#define MEGASAS_VERSION "1.71"
>> What happens when I create a VM on 2.0 and then run it with 2.1?
>> Will the VM see a difference?
>>
> The only difference you'll see is a different PCI configuration.
> Other than that the behaviour will be identical.

Hrm. Can we keep this at 1.70 for the old PCI model and bump to 1.80 for 
the new one?

>
> For compatible behaviour you'd need to set 'use_msix=false' in the
> megasas configuration.
>
> If this really is an issue I can re-sent the patch with defaulting
> back to 'false'.

I think it makes sense to default to "false" for the old device type only.


Alex
Andreas Färber April 16, 2014, 2:04 p.m. UTC | #4
Am 16.04.2014 09:16, schrieb Hannes Reinecke:
> MSI-X support has been fixed in qemu, so we can enable it again.

"QEMU" fwiw

> 
> Signed-off-by: Hannes Reinecke <hare@suse.de>

We had discussed enabling MSI-X before, and what I am missing here is a
change to the VMStateDescription. As long as no patches moving that
responsibility to PCIDevice / PCIEDevice are applied [1], it is your
responsibility to add appropriate VMSTATE_MSIX() macro for your device.

Regards,
Andreas

[1] http://lists.nongnu.org/archive/html/qemu-devel/2013-09/msg00219.html
Michael S. Tsirkin April 16, 2014, 3:10 p.m. UTC | #5
On Wed, Apr 16, 2014 at 04:04:43PM +0200, Andreas Färber wrote:
> Am 16.04.2014 09:16, schrieb Hannes Reinecke:
> > MSI-X support has been fixed in qemu, so we can enable it again.
> 
> "QEMU" fwiw
> 
> > 
> > Signed-off-by: Hannes Reinecke <hare@suse.de>
> 
> We had discussed enabling MSI-X before, and what I am missing here is a
> change to the VMStateDescription. As long as no patches moving that
> responsibility to PCIDevice / PCIEDevice are applied [1], it is your
> responsibility to add appropriate VMSTATE_MSIX() macro for your device.
> 
> Regards,
> Andreas
> 
> [1] http://lists.nongnu.org/archive/html/qemu-devel/2013-09/msg00219.html


And disable the property for old pc machine types.

> -- 
> SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
> GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
diff mbox

Patch

diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
index e6e1ffd..496bab8 100644
--- a/hw/scsi/megasas.c
+++ b/hw/scsi/megasas.c
@@ -29,7 +29,7 @@ 
 
 #include "mfi.h"
 
-#define MEGASAS_VERSION "1.70"
+#define MEGASAS_VERSION "1.71"
 #define MEGASAS_MAX_FRAMES 2048         /* Firmware limit at 65535 */
 #define MEGASAS_DEFAULT_FRAMES 1000     /* Windows requires this */
 #define MEGASAS_MAX_SGE 128             /* Firmware limit */
@@ -2083,9 +2083,7 @@  static void megasas_scsi_uninit(PCIDevice *d)
 {
     MegasasState *s = MEGASAS(d);
 
-#ifdef USE_MSIX
-    msix_uninit(d, &s->mmio_io);
-#endif
+    msix_uninit(d, &s->mmio_io, &s->mmio_io);
     memory_region_destroy(&s->mmio_io);
     memory_region_destroy(&s->port_io);
     memory_region_destroy(&s->queue_io);
@@ -2124,15 +2122,11 @@  static int megasas_scsi_init(PCIDevice *dev)
     memory_region_init_io(&s->queue_io, OBJECT(s), &megasas_queue_ops, s,
                           "megasas-queue", 0x40000);
 
-#ifdef USE_MSIX
-    /* MSI-X support is currently broken */
     if (megasas_use_msix(s) &&
-        msix_init(dev, 15, &s->mmio_io, 0, 0x2000)) {
+        msix_init(dev, 15, &s->mmio_io, 0, 0x2000,
+                  &s->mmio_io, 0, 0x3800, 0x68)) {
         s->flags &= ~MEGASAS_MASK_USE_MSIX;
     }
-#else
-    s->flags &= ~MEGASAS_MASK_USE_MSIX;
-#endif
 
     bar_type = PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_TYPE_64;
     pci_register_bar(dev, 0, bar_type, &s->mmio_io);
@@ -2151,7 +2145,7 @@  static int megasas_scsi_init(PCIDevice *dev)
         s->sas_addr |= PCI_FUNC(dev->devfn);
     }
     if (!s->hba_serial) {
-	s->hba_serial = g_strdup(MEGASAS_HBA_SERIAL);
+        s->hba_serial = g_strdup(MEGASAS_HBA_SERIAL);
     }
     if (s->fw_sge >= MEGASAS_MAX_SGE - MFI_PASS_FRAME_SIZE) {
         s->fw_sge = MEGASAS_MAX_SGE - MFI_PASS_FRAME_SIZE;
@@ -2196,10 +2190,8 @@  static Property megasas_properties[] = {
                        MEGASAS_DEFAULT_FRAMES),
     DEFINE_PROP_STRING("hba_serial", MegasasState, hba_serial),
     DEFINE_PROP_UINT64("sas_address", MegasasState, sas_addr, 0),
-#ifdef USE_MSIX
     DEFINE_PROP_BIT("use_msix", MegasasState, flags,
-                    MEGASAS_FLAG_USE_MSIX, false),
-#endif
+                    MEGASAS_FLAG_USE_MSIX, true),
     DEFINE_PROP_BIT("use_jbod", MegasasState, flags,
                     MEGASAS_FLAG_USE_JBOD, false),
     DEFINE_PROP_END_OF_LIST(),