search for: virtio_pci_cap

Displaying 20 results from an estimated 99 matches for "virtio_pci_cap".

2020 Aug 19
0
[PATCH v3 04/18] virtio: Implement get_shm_region for PCI transport
..., u64 *offset, u64 *len) +{ + int pos; + + for (pos = pci_find_capability(dev, PCI_CAP_ID_VNDR); pos > 0; + pos = pci_find_next_capability(dev, pos, PCI_CAP_ID_VNDR)) { + u8 type, cap_len, id; + u32 tmp32; + u64 res_offset, res_length; + + pci_read_config_byte(dev, pos + offsetof(struct virtio_pci_cap, + cfg_type), &type); + if (type != VIRTIO_PCI_CAP_SHARED_MEMORY_CFG) + continue; + + pci_read_config_byte(dev, pos + offsetof(struct virtio_pci_cap, + cap_len), &cap_len); + if (cap_len != sizeof(struct virtio_pci_cap64)) { + dev_err(&dev->dev, "%s: shm cap...
2015 Jan 20
0
[PATCH 03/05] fixup! virtio_pci: macros for PCI layout offsets
...io/virtio_pci_modern.c | 6 ++++-- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/include/uapi/linux/virtio_pci.h b/include/uapi/linux/virtio_pci.h index 0911c62..3b7e4d2 100644 --- a/include/uapi/linux/virtio_pci.h +++ b/include/uapi/linux/virtio_pci.h @@ -124,11 +124,6 @@ struct virtio_pci_cap { __le32 length; /* Length of the structure, in bytes. */ }; -#define VIRTIO_PCI_CAP_BAR_SHIFT 5 -#define VIRTIO_PCI_CAP_BAR_MASK 0x7 -#define VIRTIO_PCI_CAP_TYPE_SHIFT 0 -#define VIRTIO_PCI_CAP_TYPE_MASK 0x7 - struct virtio_pci_notify_cap { struct virtio_pci_cap cap; __le32 notify_off_...
2015 Jan 20
0
[PATCH 03/05] fixup! virtio_pci: macros for PCI layout offsets
...io/virtio_pci_modern.c | 6 ++++-- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/include/uapi/linux/virtio_pci.h b/include/uapi/linux/virtio_pci.h index 0911c62..3b7e4d2 100644 --- a/include/uapi/linux/virtio_pci.h +++ b/include/uapi/linux/virtio_pci.h @@ -124,11 +124,6 @@ struct virtio_pci_cap { __le32 length; /* Length of the structure, in bytes. */ }; -#define VIRTIO_PCI_CAP_BAR_SHIFT 5 -#define VIRTIO_PCI_CAP_BAR_MASK 0x7 -#define VIRTIO_PCI_CAP_TYPE_SHIFT 0 -#define VIRTIO_PCI_CAP_TYPE_MASK 0x7 - struct virtio_pci_notify_cap { struct virtio_pci_cap cap; __le32 notify_off_...
2015 Jun 18
1
[PATCH] virtio-pci: alloc only resources actually used.
Hi, > > +static struct resource *request_capability(struct pci_dev *dev, int off, > > + const char *name) > > +{ > > + u8 bar; > > + u32 offset, length; > > + > > + pci_read_config_byte(dev, off + offsetof(struct virtio_pci_cap, > > + bar), > > + &bar); > > + pci_read_config_dword(dev, off + offsetof(struct virtio_pci_cap, offset), > > + &offset); > > + pci_read_config_dword(dev, off + offsetof(struct virtio_pci_cap, length), > > + &length); >...
2015 Jun 18
1
[PATCH] virtio-pci: alloc only resources actually used.
Hi, > > +static struct resource *request_capability(struct pci_dev *dev, int off, > > + const char *name) > > +{ > > + u8 bar; > > + u32 offset, length; > > + > > + pci_read_config_byte(dev, off + offsetof(struct virtio_pci_cap, > > + bar), > > + &bar); > > + pci_read_config_dword(dev, off + offsetof(struct virtio_pci_cap, offset), > > + &offset); > > + pci_read_config_dword(dev, off + offsetof(struct virtio_pci_cap, length), > > + &length); >...
2015 Jan 20
0
[PATCH 01/05] fixup! virtio_pci: modern driver
...n.c | 23 +++++++++-------------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/include/uapi/linux/virtio_pci.h b/include/uapi/linux/virtio_pci.h index 4e05423..a2b2e13 100644 --- a/include/uapi/linux/virtio_pci.h +++ b/include/uapi/linux/virtio_pci.h @@ -117,10 +117,11 @@ struct virtio_pci_cap { __u8 cap_vndr; /* Generic PCI field: PCI_CAP_ID_VNDR */ __u8 cap_next; /* Generic PCI field: next ptr. */ __u8 cap_len; /* Generic PCI field: capability length */ - __u8 type_and_bar; /* Upper 3 bits: bar. - * Lower 3 is VIRTIO_PCI_CAP_*_CFG. */ + __u8 cfg_type; /* Identifies the st...
2015 Jan 20
0
[PATCH 01/05] fixup! virtio_pci: modern driver
...n.c | 23 +++++++++-------------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/include/uapi/linux/virtio_pci.h b/include/uapi/linux/virtio_pci.h index 4e05423..a2b2e13 100644 --- a/include/uapi/linux/virtio_pci.h +++ b/include/uapi/linux/virtio_pci.h @@ -117,10 +117,11 @@ struct virtio_pci_cap { __u8 cap_vndr; /* Generic PCI field: PCI_CAP_ID_VNDR */ __u8 cap_next; /* Generic PCI field: next ptr. */ __u8 cap_len; /* Generic PCI field: capability length */ - __u8 type_and_bar; /* Upper 3 bits: bar. - * Lower 3 is VIRTIO_PCI_CAP_*_CFG. */ + __u8 cfg_type; /* Identifies the st...
2014 Dec 30
0
[PATCH RFC v2 6/7] virtio_pci: macros for PCI layout offsets.
...include/uapi/linux/virtio_pci.h index 28c2ce0..5d546c6 100644 --- a/include/uapi/linux/virtio_pci.h +++ b/include/uapi/linux/virtio_pci.h @@ -159,6 +159,36 @@ struct virtio_pci_common_cfg { __le32 queue_used_hi; /* read-write */ }; +/* Macro versions of offsets for the Old Timers! */ +#define VIRTIO_PCI_CAP_VNDR 0 +#define VIRTIO_PCI_CAP_NEXT 1 +#define VIRTIO_PCI_CAP_LEN 2 +#define VIRTIO_PCI_CAP_TYPE_AND_BAR 3 +#define VIRTIO_PCI_CAP_OFFSET 4 +#define VIRTIO_PCI_CAP_LENGTH 8 + +#define VIRTIO_PCI_NOTIFY_CAP_MULT 12 + +#define VIRTIO_PCI_COMMON_DFSELECT 0 +#define VIRTIO_PCI_COMMON_DF 4 +#defin...
2014 Dec 30
0
[PATCH RFC v2 6/7] virtio_pci: macros for PCI layout offsets.
...include/uapi/linux/virtio_pci.h index 28c2ce0..5d546c6 100644 --- a/include/uapi/linux/virtio_pci.h +++ b/include/uapi/linux/virtio_pci.h @@ -159,6 +159,36 @@ struct virtio_pci_common_cfg { __le32 queue_used_hi; /* read-write */ }; +/* Macro versions of offsets for the Old Timers! */ +#define VIRTIO_PCI_CAP_VNDR 0 +#define VIRTIO_PCI_CAP_NEXT 1 +#define VIRTIO_PCI_CAP_LEN 2 +#define VIRTIO_PCI_CAP_TYPE_AND_BAR 3 +#define VIRTIO_PCI_CAP_OFFSET 4 +#define VIRTIO_PCI_CAP_LENGTH 8 + +#define VIRTIO_PCI_NOTIFY_CAP_MULT 12 + +#define VIRTIO_PCI_COMMON_DFSELECT 0 +#define VIRTIO_PCI_COMMON_DF 4 +#defin...
2015 Jun 16
2
[PATCH] virtio-pci: alloc only resources actually used.
...modern.c @@ -64,6 +64,24 @@ static void vp_iowrite64_twopart(u64 val, vp_iowrite32(val >> 32, hi); } +static struct resource *request_capability(struct pci_dev *dev, int off, + const char *name) +{ + u8 bar; + u32 offset, length; + + pci_read_config_byte(dev, off + offsetof(struct virtio_pci_cap, + bar), + &bar); + pci_read_config_dword(dev, off + offsetof(struct virtio_pci_cap, offset), + &offset); + pci_read_config_dword(dev, off + offsetof(struct virtio_pci_cap, length), + &length); + + return request_mem_region(pci_resource_start(dev, bar) + offs...
2015 Jun 16
2
[PATCH] virtio-pci: alloc only resources actually used.
...modern.c @@ -64,6 +64,24 @@ static void vp_iowrite64_twopart(u64 val, vp_iowrite32(val >> 32, hi); } +static struct resource *request_capability(struct pci_dev *dev, int off, + const char *name) +{ + u8 bar; + u32 offset, length; + + pci_read_config_byte(dev, off + offsetof(struct virtio_pci_cap, + bar), + &bar); + pci_read_config_dword(dev, off + offsetof(struct virtio_pci_cap, offset), + &offset); + pci_read_config_dword(dev, off + offsetof(struct virtio_pci_cap, length), + &length); + + return request_mem_region(pci_resource_start(dev, bar) + offs...
2015 Jan 21
14
[PATCH pre-squash 00/14] virtio 1.0: virtio-pci fixup
This is just the full patchset reposted with fixups in correct order, before squashing them. I also tweaked commit log for patch "virtio_pci: modern driver" I also included Gerd's tag: Tested-by: Gerd Hoffmann <kraxel at redhat.com> You can find it all before the rebase -i --autosquash in my tree: git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git virtio-next
2015 Jan 21
14
[PATCH pre-squash 00/14] virtio 1.0: virtio-pci fixup
This is just the full patchset reposted with fixups in correct order, before squashing them. I also tweaked commit log for patch "virtio_pci: modern driver" I also included Gerd's tag: Tested-by: Gerd Hoffmann <kraxel at redhat.com> You can find it all before the rebase -i --autosquash in my tree: git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git virtio-next
2016 Aug 30
4
[PATCH v2 2/2] vfio: add virtio pci quirk
.../vfio.h> > +#include <linux/virtio_pci.h> > +#include <linux/virtio_config.h> > + > +#include "vfio_pci_private.h" > + > +/** > + * virtio_pci_find_capability - walk capabilities to find device info. > + * @dev: the pci device > + * @cfg_type: the VIRTIO_PCI_CAP_* value we seek > + * > + * Returns offset of the capability, or 0. > + */ > +static inline int virtio_pci_find_capability(struct pci_dev *dev, u8 cfg_type) Does inlining this really make sense? > +{ > + int pos; > + > + for (pos = pci_find_capability(dev, PCI_CAP_ID_VNDR)...
2016 Aug 30
4
[PATCH v2 2/2] vfio: add virtio pci quirk
.../vfio.h> > +#include <linux/virtio_pci.h> > +#include <linux/virtio_config.h> > + > +#include "vfio_pci_private.h" > + > +/** > + * virtio_pci_find_capability - walk capabilities to find device info. > + * @dev: the pci device > + * @cfg_type: the VIRTIO_PCI_CAP_* value we seek > + * > + * Returns offset of the capability, or 0. > + */ > +static inline int virtio_pci_find_capability(struct pci_dev *dev, u8 cfg_type) Does inlining this really make sense? > +{ > + int pos; > + > + for (pos = pci_find_capability(dev, PCI_CAP_ID_VNDR)...
2019 Jul 25
5
[PATCH 0/4] virtio: Add definitions for shared memory regions
From: "Dr. David Alan Gilbert" <dgilbert at redhat.com> Add the virtio shared memory region definitions that have just got merged into the spec. Dr. David Alan Gilbert (4): virtio_pci: Define id field virtio_pci: Define virtio_pci_cap64 virtio_pci: Defined shared memory capability virito_mmio: Define shared memory region registers include/uapi/linux/virtio_mmio.h | 11 +++++++++++ include/uapi/linux/virtio_pci.h | 11 ++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) -- 2.21.0
2016 Apr 18
1
[PATCH RFC 3/3] vfio: add virtio pci quirk
...gt; +#include <linux/virtio_config.h> I don't see where io or uaccess are needed here. > + > +#include "vfio_pci_private.h" > + > +/** > + * virtio_pci_find_capability - walk capabilities to find device info. > + * @dev: the pci device > + * @cfg_type: the VIRTIO_PCI_CAP_* value we seek > + * > + * Returns offset of the capability, or 0. > + */ > +static inline int virtio_pci_find_capability(struct pci_dev *dev, u8 cfg_type) This is called from probe code, why inline? There's already a function with this exact same name in virtio code, can we come...
2016 Apr 18
1
[PATCH RFC 3/3] vfio: add virtio pci quirk
...gt; +#include <linux/virtio_config.h> I don't see where io or uaccess are needed here. > + > +#include "vfio_pci_private.h" > + > +/** > + * virtio_pci_find_capability - walk capabilities to find device info. > + * @dev: the pci device > + * @cfg_type: the VIRTIO_PCI_CAP_* value we seek > + * > + * Returns offset of the capability, or 0. > + */ > +static inline int virtio_pci_find_capability(struct pci_dev *dev, u8 cfg_type) This is called from probe code, why inline? There's already a function with this exact same name in virtio code, can we come...
2016 Aug 30
2
[PATCH v2 2/2] vfio: add virtio pci quirk
...lt;linux/virtio_config.h> > > > + > > > +#include "vfio_pci_private.h" > > > + > > > +/** > > > + * virtio_pci_find_capability - walk capabilities to find device info. > > > + * @dev: the pci device > > > + * @cfg_type: the VIRTIO_PCI_CAP_* value we seek > > > + * > > > + * Returns offset of the capability, or 0. > > > + */ > > > +static inline int virtio_pci_find_capability(struct pci_dev *dev, u8 cfg_type) > > > > Does inlining this really make sense? > > > > >...
2016 Aug 30
2
[PATCH v2 2/2] vfio: add virtio pci quirk
...lt;linux/virtio_config.h> > > > + > > > +#include "vfio_pci_private.h" > > > + > > > +/** > > > + * virtio_pci_find_capability - walk capabilities to find device info. > > > + * @dev: the pci device > > > + * @cfg_type: the VIRTIO_PCI_CAP_* value we seek > > > + * > > > + * Returns offset of the capability, or 0. > > > + */ > > > +static inline int virtio_pci_find_capability(struct pci_dev *dev, u8 cfg_type) > > > > Does inlining this really make sense? > > > > >...