public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCHv2] virtio_pci: better macro exported in uapi
@ 2013-05-19 13:22 Michael S. Tsirkin
  2013-05-20  1:30 ` Rusty Russell
  0 siblings, 1 reply; 2+ messages in thread
From: Michael S. Tsirkin @ 2013-05-19 13:22 UTC (permalink / raw)
  To: kvm
  Cc: Rusty Russell, Paul E. McKenney, David Howells, Thomas Gleixner,
	Michael Kerrisk, virtualization, linux-kernel

Macro VIRTIO_PCI_CONFIG assumes that userspace actually has a structure
with a field named msix_enabled.  Add VIRTIO_PCI_CONFIG_OFF that gets
the msix_enabled by value instead, to make it useful for userspace.  We
still keep VIRTIO_PCI_CONFIG around for now, in case some userspace uses
it.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---

Changes from v1:
- rename macro to VIRTIO_PCI_CONFIG_OFF so preprocessor
  can be used to check for its presence, as suggested
  by Rusty
- keep old macro around as suggested by David Howells

 include/uapi/linux/virtio_pci.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/virtio_pci.h b/include/uapi/linux/virtio_pci.h
index ea66f3f..e5ec1ca 100644
--- a/include/uapi/linux/virtio_pci.h
+++ b/include/uapi/linux/virtio_pci.h
@@ -80,7 +80,9 @@
 
 /* The remaining space is defined by each driver as the per-driver
  * configuration space */
-#define VIRTIO_PCI_CONFIG(dev)		((dev)->msix_enabled ? 24 : 20)
+#define VIRTIO_PCI_CONFIG_OFF(msix_enabled)	((msix_enabled) ? 24 : 20)
+/* Deprecated: please use VIRTIO_PCI_CONFIG_OFF instead */
+#define VIRTIO_PCI_CONFIG(dev)	VIRTIO_PCI_CONFIG_OFF((dev)->msix_enabled)
 
 /* Virtio ABI version, this must match exactly */
 #define VIRTIO_PCI_ABI_VERSION		0
-- 
MST

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

* Re: [PATCHv2] virtio_pci: better macro exported in uapi
  2013-05-19 13:22 [PATCHv2] virtio_pci: better macro exported in uapi Michael S. Tsirkin
@ 2013-05-20  1:30 ` Rusty Russell
  0 siblings, 0 replies; 2+ messages in thread
From: Rusty Russell @ 2013-05-20  1:30 UTC (permalink / raw)
  To: Michael S. Tsirkin, kvm
  Cc: Paul E. McKenney, David Howells, Thomas Gleixner, Michael Kerrisk,
	virtualization, linux-kernel

"Michael S. Tsirkin" <mst@redhat.com> writes:

> Macro VIRTIO_PCI_CONFIG assumes that userspace actually has a structure
> with a field named msix_enabled.  Add VIRTIO_PCI_CONFIG_OFF that gets
> the msix_enabled by value instead, to make it useful for userspace.  We
> still keep VIRTIO_PCI_CONFIG around for now, in case some userspace uses
> it.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

Applied.

Thanks,
Rusty.

> ---
>
> Changes from v1:
> - rename macro to VIRTIO_PCI_CONFIG_OFF so preprocessor
>   can be used to check for its presence, as suggested
>   by Rusty
> - keep old macro around as suggested by David Howells
>
>  include/uapi/linux/virtio_pci.h | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/include/uapi/linux/virtio_pci.h b/include/uapi/linux/virtio_pci.h
> index ea66f3f..e5ec1ca 100644
> --- a/include/uapi/linux/virtio_pci.h
> +++ b/include/uapi/linux/virtio_pci.h
> @@ -80,7 +80,9 @@
>  
>  /* The remaining space is defined by each driver as the per-driver
>   * configuration space */
> -#define VIRTIO_PCI_CONFIG(dev)		((dev)->msix_enabled ? 24 : 20)
> +#define VIRTIO_PCI_CONFIG_OFF(msix_enabled)	((msix_enabled) ? 24 : 20)
> +/* Deprecated: please use VIRTIO_PCI_CONFIG_OFF instead */
> +#define VIRTIO_PCI_CONFIG(dev)	VIRTIO_PCI_CONFIG_OFF((dev)->msix_enabled)
>  
>  /* Virtio ABI version, this must match exactly */
>  #define VIRTIO_PCI_ABI_VERSION		0
> -- 
> MST

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

end of thread, other threads:[~2013-05-20  2:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-19 13:22 [PATCHv2] virtio_pci: better macro exported in uapi Michael S. Tsirkin
2013-05-20  1:30 ` Rusty Russell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox