xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* Re: [Xen-devel] [PATCH v2] xen-pciback: fix INTERRUPT_TYPE_* defines
  2020-03-20  3:09 [Xen-devel] [PATCH v2] xen-pciback: fix INTERRUPT_TYPE_* defines Marek Marczykowski-Górecki
@ 2020-03-20  1:21 ` Boris Ostrovsky
  2020-03-23 14:55 ` Roger Pau Monné
  1 sibling, 0 replies; 3+ messages in thread
From: Boris Ostrovsky @ 2020-03-20  1:21 UTC (permalink / raw)
  To: Marek Marczykowski-Górecki, xen-devel
  Cc: Juergen Gross, Simon Gaiser, Stefano Stabellini, open list,
	Roger Pau Monné


On 3/19/20 11:09 PM, Marek Marczykowski-Górecki wrote:
> xen_pcibk_get_interrupt_type() assumes INTERRUPT_TYPE_NONE being 0
> (initialize ret to 0 and return as INTERRUPT_TYPE_NONE).
> Fix the definition to make INTERRUPT_TYPE_NONE really 0, and also shift
> other values to not leave holes.
> But also, do not assume INTERRUPT_TYPE_NONE being 0 anymore to avoid
> similar confusions in the future.
>
> Fixes: 476878e4b2be ("xen-pciback: optionally allow interrupt enable flag writes")
> Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>


Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* [Xen-devel] [PATCH v2] xen-pciback: fix INTERRUPT_TYPE_* defines
@ 2020-03-20  3:09 Marek Marczykowski-Górecki
  2020-03-20  1:21 ` Boris Ostrovsky
  2020-03-23 14:55 ` Roger Pau Monné
  0 siblings, 2 replies; 3+ messages in thread
From: Marek Marczykowski-Górecki @ 2020-03-20  3:09 UTC (permalink / raw)
  To: xen-devel
  Cc: Juergen Gross, Stefano Stabellini,
	Marek Marczykowski-Górecki, open list, Simon Gaiser,
	Boris Ostrovsky, Roger Pau Monné

xen_pcibk_get_interrupt_type() assumes INTERRUPT_TYPE_NONE being 0
(initialize ret to 0 and return as INTERRUPT_TYPE_NONE).
Fix the definition to make INTERRUPT_TYPE_NONE really 0, and also shift
other values to not leave holes.
But also, do not assume INTERRUPT_TYPE_NONE being 0 anymore to avoid
similar confusions in the future.

Fixes: 476878e4b2be ("xen-pciback: optionally allow interrupt enable flag writes")
Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
Changes in v2:
 - don't depend on INTERRUPT_TYPE_NONE being 0
---
 drivers/xen/xen-pciback/conf_space.c | 2 +-
 drivers/xen/xen-pciback/conf_space.h | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/xen/xen-pciback/conf_space.c b/drivers/xen/xen-pciback/conf_space.c
index b20e43e148ce..da51a5d34e6e 100644
--- a/drivers/xen/xen-pciback/conf_space.c
+++ b/drivers/xen/xen-pciback/conf_space.c
@@ -320,7 +320,7 @@ int xen_pcibk_get_interrupt_type(struct pci_dev *dev)
 		if (val & PCI_MSIX_FLAGS_ENABLE)
 			ret |= INTERRUPT_TYPE_MSIX;
 	}
-	return ret;
+	return ret ?: INTERRUPT_TYPE_NONE;
 }
 
 void xen_pcibk_config_free_dyn_fields(struct pci_dev *dev)
diff --git a/drivers/xen/xen-pciback/conf_space.h b/drivers/xen/xen-pciback/conf_space.h
index 28c45180a12e..5fe431c79f25 100644
--- a/drivers/xen/xen-pciback/conf_space.h
+++ b/drivers/xen/xen-pciback/conf_space.h
@@ -65,10 +65,10 @@ struct config_field_entry {
 	void *data;
 };
 
-#define INTERRUPT_TYPE_NONE (1<<0)
-#define INTERRUPT_TYPE_INTX (1<<1)
-#define INTERRUPT_TYPE_MSI  (1<<2)
-#define INTERRUPT_TYPE_MSIX (1<<3)
+#define INTERRUPT_TYPE_NONE (0)
+#define INTERRUPT_TYPE_INTX (1<<0)
+#define INTERRUPT_TYPE_MSI  (1<<1)
+#define INTERRUPT_TYPE_MSIX (1<<2)
 
 extern bool xen_pcibk_permissive;
 
-- 
2.21.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [Xen-devel] [PATCH v2] xen-pciback: fix INTERRUPT_TYPE_* defines
  2020-03-20  3:09 [Xen-devel] [PATCH v2] xen-pciback: fix INTERRUPT_TYPE_* defines Marek Marczykowski-Górecki
  2020-03-20  1:21 ` Boris Ostrovsky
@ 2020-03-23 14:55 ` Roger Pau Monné
  1 sibling, 0 replies; 3+ messages in thread
From: Roger Pau Monné @ 2020-03-23 14:55 UTC (permalink / raw)
  To: Marek Marczykowski-Górecki
  Cc: Juergen Gross, Stefano Stabellini, open list, Simon Gaiser,
	xen-devel, Boris Ostrovsky

On Fri, Mar 20, 2020 at 04:09:18AM +0100, Marek Marczykowski-Górecki wrote:
> xen_pcibk_get_interrupt_type() assumes INTERRUPT_TYPE_NONE being 0
> (initialize ret to 0 and return as INTERRUPT_TYPE_NONE).
> Fix the definition to make INTERRUPT_TYPE_NONE really 0, and also shift
> other values to not leave holes.
> But also, do not assume INTERRUPT_TYPE_NONE being 0 anymore to avoid
> similar confusions in the future.
> 
> Fixes: 476878e4b2be ("xen-pciback: optionally allow interrupt enable flag writes")
> Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>

Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

end of thread, other threads:[~2020-03-23 14:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-20  3:09 [Xen-devel] [PATCH v2] xen-pciback: fix INTERRUPT_TYPE_* defines Marek Marczykowski-Górecki
2020-03-20  1:21 ` Boris Ostrovsky
2020-03-23 14:55 ` Roger Pau Monné

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