Re: [Qemu-devel] [PATCH v6 08/11] mptsas: change msi property type

2016-06-01 Thread Markus Armbruster
Cao jin  writes:

>>From uint32 to enum OnOffAuto, and give it a shorter name.
>
> cc: Paolo Bonzini 
> cc: Michael S. Tsirkin 
> cc: Markus Armbruster 
> cc: Marcel Apfelbaum 
>
> Signed-off-by: Cao jin 
> ---
>  hw/scsi/mptsas.c | 4 ++--
>  hw/scsi/mptsas.h | 3 ++-
>  2 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/hw/scsi/mptsas.c b/hw/scsi/mptsas.c
> index 1c18c84..afee576 100644
> --- a/hw/scsi/mptsas.c
> +++ b/hw/scsi/mptsas.c
> @@ -1285,7 +1285,7 @@ static void mptsas_scsi_realize(PCIDevice *dev, Error 
> **errp)
>  memory_region_init_io(>diag_io, OBJECT(s), _diag_ops, s,
>"mptsas-diag", 0x1);
>  
> -if (s->msi_available &&
> +if ((s->msi == ON_OFF_AUTO_AUTO || s->msi == ON_OFF_AUTO_ON) &&
>  msi_init(dev, 0, 1, true, false) >= 0) {
>  s->msi_in_use = true;
>  }

Same suggestions as for PATCH 06:

* Use the s->msi != ON_OFF_AUTO_OFF
* Add /* TODO check for errors */ now, drop it when you add the check in
  PATCH 11.

> @@ -1404,7 +1404,7 @@ static const VMStateDescription vmstate_mptsas = {
>  static Property mptsas_properties[] = {
>  DEFINE_PROP_UINT64("sas_address", MPTSASState, sas_addr, 0),
>  /* TODO: test MSI support under Windows */
> -DEFINE_PROP_BIT("msi", MPTSASState, msi_available, 0, true),
> +DEFINE_PROP_ON_OFF_AUTO("msi", MPTSASState, msi, ON_OFF_AUTO_AUTO),
>  DEFINE_PROP_END_OF_LIST(),
>  };
>  
> diff --git a/hw/scsi/mptsas.h b/hw/scsi/mptsas.h
> index 595f81f..0436a33 100644
> --- a/hw/scsi/mptsas.h
> +++ b/hw/scsi/mptsas.h
> @@ -27,7 +27,8 @@ struct MPTSASState {
>  MemoryRegion diag_io;
>  QEMUBH *request_bh;
>  
> -uint32_t msi_available;
> +/* properties */
> +OnOffAuto msi;
>  uint64_t sas_addr;
>  
>  bool msi_in_use;



[Qemu-devel] [PATCH v6 08/11] mptsas: change msi property type

2016-05-23 Thread Cao jin
>From uint32 to enum OnOffAuto, and give it a shorter name.

cc: Paolo Bonzini 
cc: Michael S. Tsirkin 
cc: Markus Armbruster 
cc: Marcel Apfelbaum 

Signed-off-by: Cao jin 
---
 hw/scsi/mptsas.c | 4 ++--
 hw/scsi/mptsas.h | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/hw/scsi/mptsas.c b/hw/scsi/mptsas.c
index 1c18c84..afee576 100644
--- a/hw/scsi/mptsas.c
+++ b/hw/scsi/mptsas.c
@@ -1285,7 +1285,7 @@ static void mptsas_scsi_realize(PCIDevice *dev, Error 
**errp)
 memory_region_init_io(>diag_io, OBJECT(s), _diag_ops, s,
   "mptsas-diag", 0x1);
 
-if (s->msi_available &&
+if ((s->msi == ON_OFF_AUTO_AUTO || s->msi == ON_OFF_AUTO_ON) &&
 msi_init(dev, 0, 1, true, false) >= 0) {
 s->msi_in_use = true;
 }
@@ -1404,7 +1404,7 @@ static const VMStateDescription vmstate_mptsas = {
 static Property mptsas_properties[] = {
 DEFINE_PROP_UINT64("sas_address", MPTSASState, sas_addr, 0),
 /* TODO: test MSI support under Windows */
-DEFINE_PROP_BIT("msi", MPTSASState, msi_available, 0, true),
+DEFINE_PROP_ON_OFF_AUTO("msi", MPTSASState, msi, ON_OFF_AUTO_AUTO),
 DEFINE_PROP_END_OF_LIST(),
 };
 
diff --git a/hw/scsi/mptsas.h b/hw/scsi/mptsas.h
index 595f81f..0436a33 100644
--- a/hw/scsi/mptsas.h
+++ b/hw/scsi/mptsas.h
@@ -27,7 +27,8 @@ struct MPTSASState {
 MemoryRegion diag_io;
 QEMUBH *request_bh;
 
-uint32_t msi_available;
+/* properties */
+OnOffAuto msi;
 uint64_t sas_addr;
 
 bool msi_in_use;
-- 
2.1.0