Displaying 20 results from an estimated 54 matches for "map_capability".
Did you mean:
imap_capability
2015 Jun 18
1
[PATCH] virtio-pci: alloc only resources actually used.
...oo much. The spec says:
> The drivers SHOULD only map part of configuration structure large enough
> for device operation.
We don't map it here though. We just reserve what belongs to virtio
according to the capabilities.
> I think you should limit this to PAGE_SIZE like we do for map_capability.
notify is much larger than PAGE_SIZE.
> > err = -EINVAL;
> > vp_dev->common = map_capability(pci_dev, common,
> > sizeof(struct virtio_pci_common_cfg), 4,
>
> map_capability has a bunch of checks in place to validate the capability
> structure. With reque...
2015 Jun 18
1
[PATCH] virtio-pci: alloc only resources actually used.
...oo much. The spec says:
> The drivers SHOULD only map part of configuration structure large enough
> for device operation.
We don't map it here though. We just reserve what belongs to virtio
according to the capabilities.
> I think you should limit this to PAGE_SIZE like we do for map_capability.
notify is much larger than PAGE_SIZE.
> > err = -EINVAL;
> > vp_dev->common = map_capability(pci_dev, common,
> > sizeof(struct virtio_pci_common_cfg), 4,
>
> map_capability has a bunch of checks in place to validate the capability
> structure. With reque...
2015 Jun 16
2
[PATCH] virtio-pci: alloc only resources actually used.
..._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) + offset,
+ length, name);
+}
+
static void __iomem *map_capability(struct pci_dev *dev, int off,
size_t minlen,
u32 align,
@@ -131,10 +149,12 @@ static void __iomem *map_capability(struct pci_dev *dev, int off,
}
p = pci_iomap_range(dev, bar, offset, length);
- if (!p)
+ if (!p) {
dev_err(&dev->dev,
"virtio_pci: unable to...
2015 Jun 16
2
[PATCH] virtio-pci: alloc only resources actually used.
..._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) + offset,
+ length, name);
+}
+
static void __iomem *map_capability(struct pci_dev *dev, int off,
size_t minlen,
u32 align,
@@ -131,10 +149,12 @@ static void __iomem *map_capability(struct pci_dev *dev, int off,
}
p = pci_iomap_range(dev, bar, offset, length);
- if (!p)
+ if (!p) {
dev_err(&dev->dev,
"virtio_pci: unable to...
2015 Jun 18
1
[PATCH v2] virtio-pci: alloc only resources actually used.
...ci_resource_len(dev, bar));
> > + return NULL;
> > + }
> > +
> > + if (limit && length > limit)
> > + length = limit;
> > +
>
> I'll have to review the above carefully. Hopefully next week.
> Any reason you didn't just move code out map_capability to a helper,
> without changes? Would have made review easier.
Doesn't work that easily as there are different things to check.
request_capability verifies the capability itself only, map_capability
has a bunch of additional range checks because it supports partial maps.
> I don't...
2015 Jun 18
1
[PATCH v2] virtio-pci: alloc only resources actually used.
...ci_resource_len(dev, bar));
> > + return NULL;
> > + }
> > +
> > + if (limit && length > limit)
> > + length = limit;
> > +
>
> I'll have to review the above carefully. Hopefully next week.
> Any reason you didn't just move code out map_capability to a helper,
> without changes? Would have made review easier.
Doesn't work that easily as there are different things to check.
request_capability verifies the capability itself only, map_capability
has a bunch of additional range checks because it supports partial maps.
> I don't...
2015 Jun 18
2
[PATCH v2] virtio-pci: alloc only resources actually used.
...ar %i length %lu\n",
+ length, offset, bar,
+ (unsigned long)pci_resource_len(dev, bar));
+ return NULL;
+ }
+
+ if (limit && length > limit)
+ length = limit;
+
+ return request_mem_region(pci_resource_start(dev, bar) + offset,
+ length, name);
+}
+
static void __iomem *map_capability(struct pci_dev *dev, int off,
size_t minlen,
u32 align,
@@ -131,10 +162,12 @@ static void __iomem *map_capability(struct pci_dev *dev, int off,
}
p = pci_iomap_range(dev, bar, offset, length);
- if (!p)
+ if (!p) {
dev_err(&dev->dev,
"virtio_pci: unable to...
2015 Jun 18
2
[PATCH v2] virtio-pci: alloc only resources actually used.
...ar %i length %lu\n",
+ length, offset, bar,
+ (unsigned long)pci_resource_len(dev, bar));
+ return NULL;
+ }
+
+ if (limit && length > limit)
+ length = limit;
+
+ return request_mem_region(pci_resource_start(dev, bar) + offset,
+ length, name);
+}
+
static void __iomem *map_capability(struct pci_dev *dev, int off,
size_t minlen,
u32 align,
@@ -131,10 +162,12 @@ static void __iomem *map_capability(struct pci_dev *dev, int off,
}
p = pci_iomap_range(dev, bar, offset, length);
- if (!p)
+ if (!p) {
dev_err(&dev->dev,
"virtio_pci: unable to...
2015 Jun 16
0
[PATCH] virtio-pci: alloc only resources actually used.
...pci_resource_start(dev, bar) + offset,
> + length, name);
> +}
> +
For device config, this might request too much. The spec says:
The drivers SHOULD only map part of configuration structure large enough
for device operation.
I think you should limit this to PAGE_SIZE like we do for map_capability.
> static void __iomem *map_capability(struct pci_dev *dev, int off,
> size_t minlen,
> u32 align,
> @@ -131,10 +149,12 @@ static void __iomem *map_capability(struct pci_dev *dev, int off,
> }
>
> p = pci_iomap_range(dev, bar, offset, length);
> - i...
2015 Jun 18
0
[PATCH v2] virtio-pci: alloc only resources actually used.
...ength, offset, bar,
> + (unsigned long)pci_resource_len(dev, bar));
> + return NULL;
> + }
> +
> + if (limit && length > limit)
> + length = limit;
> +
I'll have to review the above carefully. Hopefully next week.
Any reason you didn't just move code out map_capability to a helper,
without changes? Would have made review easier.
I don't see reasons to request regions that we aren't going to
claim ...
> + return request_mem_region(pci_resource_start(dev, bar) + offset,
> + length, name);
Hmm this seems wrong, resource can be IO, not just me...
2020 May 29
12
[PATCH 0/6] vDPA: doorbell mapping
Hi all:
This series introduce basic functionality of doorbell mapping support
for vhost-vDPA. Userspace program may use mmap() to map a the doorbell
of a specific virtqueue into its address space. This is help to reudce
the syscall or vmexit overhead.
A new vdpa_config_ops was introduced to report the location of the
doorbell, vhost_vdpa may then choose to map the doorbell when:
- The doorbell
2020 May 29
12
[PATCH 0/6] vDPA: doorbell mapping
Hi all:
This series introduce basic functionality of doorbell mapping support
for vhost-vDPA. Userspace program may use mmap() to map a the doorbell
of a specific virtqueue into its address space. This is help to reudce
the syscall or vmexit overhead.
A new vdpa_config_ops was introduced to report the location of the
doorbell, vhost_vdpa may then choose to map the doorbell when:
- The doorbell
2014 Dec 30
0
[PATCH RFC v2 5/7] virtio_pci: modern driver
....au>
+ * Michael S. Tsirkin <mst at redhat.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ *
+ */
+
+#define VIRTIO_PCI_NO_LEGACY
+#include "virtio_pci_common.h"
+
+static void __iomem *map_capability(struct pci_dev *dev, int off,
+ size_t minlen,
+ u32 align,
+ u32 start, u32 size,
+ size_t *len)
+{
+ u8 type_and_bar, bar;
+ u32 offset, length;
+ void __iomem *p;
+
+ pci_read_config_byte(dev, off + offsetof(struct virtio_pci_cap,
+ type_and_bar),
+ &...
2014 Dec 30
0
[PATCH RFC v2 5/7] virtio_pci: modern driver
....au>
+ * Michael S. Tsirkin <mst at redhat.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ *
+ */
+
+#define VIRTIO_PCI_NO_LEGACY
+#include "virtio_pci_common.h"
+
+static void __iomem *map_capability(struct pci_dev *dev, int off,
+ size_t minlen,
+ u32 align,
+ u32 start, u32 size,
+ size_t *len)
+{
+ u8 type_and_bar, bar;
+ u32 offset, length;
+ void __iomem *p;
+
+ pci_read_config_byte(dev, off + offsetof(struct virtio_pci_cap,
+ type_and_bar),
+ &...
2020 Jun 10
2
[PATCH V3] vdpa: introduce virtio pci driver
...if (pci_resource_len(dev, bar) &&
>> + pci_resource_flags(dev, bar) & ioresource_types) {
>> + *bars |= (1 << bar);
>> + return pos;
>> + }
>> + }
>> + }
>> + return 0;
>> +}
>> +
>> +static void __iomem *map_capability(struct vp_vdpa *vp_vdpa, int off,
>> + resource_size_t *pa)
>> +{
>> + struct pci_dev *pdev = vp_vdpa->pdev;
>> + u32 offset;
>> + u8 bar;
>> +
>> + pci_read_config_byte(pdev,
>> + off + offsetof(struct virtio_pci_cap, bar),
>>...
2020 Jun 10
2
[PATCH V3] vdpa: introduce virtio pci driver
...if (pci_resource_len(dev, bar) &&
>> + pci_resource_flags(dev, bar) & ioresource_types) {
>> + *bars |= (1 << bar);
>> + return pos;
>> + }
>> + }
>> + }
>> + return 0;
>> +}
>> +
>> +static void __iomem *map_capability(struct vp_vdpa *vp_vdpa, int off,
>> + resource_size_t *pa)
>> +{
>> + struct pci_dev *pdev = vp_vdpa->pdev;
>> + u32 offset;
>> + u8 bar;
>> +
>> + pci_read_config_byte(pdev,
>> + off + offsetof(struct virtio_pci_cap, bar),
>>...
2015 Feb 15
3
[PATCH 1/2] virtio_pci_modern: type-safe io accessors
...nline void vp_iowrite8(u8 value, u8 __iomem *addr)
+{
+ iowrite8(value, addr);
+}
+
+static inline void vp_iowrite16(u16 value, u16 __iomem *addr)
+{
+ iowrite16(value, addr);
+}
+
+static inline void vp_iowrite32(u32 value, u32 __iomem *addr)
+{
+ iowrite16(value, addr);
+}
+
static void __iomem *map_capability(struct pci_dev *dev, int off,
size_t minlen,
u32 align,
--
MST
2015 Feb 15
3
[PATCH 1/2] virtio_pci_modern: type-safe io accessors
...nline void vp_iowrite8(u8 value, u8 __iomem *addr)
+{
+ iowrite8(value, addr);
+}
+
+static inline void vp_iowrite16(u16 value, u16 __iomem *addr)
+{
+ iowrite16(value, addr);
+}
+
+static inline void vp_iowrite32(u32 value, u32 __iomem *addr)
+{
+ iowrite16(value, addr);
+}
+
static void __iomem *map_capability(struct pci_dev *dev, int off,
size_t minlen,
u32 align,
--
MST
2015 Jan 20
0
[PATCH 01/05] fixup! virtio_pci: modern driver
...cture, in bytes. */
};
#define VIRTIO_PCI_CAP_BAR_SHIFT 5
diff --git a/drivers/virtio/virtio_pci_modern.c b/drivers/virtio/virtio_pci_modern.c
index e2f41c9..a3d8101 100644
--- a/drivers/virtio/virtio_pci_modern.c
+++ b/drivers/virtio/virtio_pci_modern.c
@@ -26,13 +26,13 @@ static void __iomem *map_capability(struct pci_dev *dev, int off,
u32 start, u32 size,
size_t *len)
{
- u8 type_and_bar, bar;
+ u8 bar;
u32 offset, length;
void __iomem *p;
pci_read_config_byte(dev, off + offsetof(struct virtio_pci_cap,
- type_and_bar),
- &type_and_bar);
+ bar),
+...
2015 Jan 20
0
[PATCH 01/05] fixup! virtio_pci: modern driver
...cture, in bytes. */
};
#define VIRTIO_PCI_CAP_BAR_SHIFT 5
diff --git a/drivers/virtio/virtio_pci_modern.c b/drivers/virtio/virtio_pci_modern.c
index e2f41c9..a3d8101 100644
--- a/drivers/virtio/virtio_pci_modern.c
+++ b/drivers/virtio/virtio_pci_modern.c
@@ -26,13 +26,13 @@ static void __iomem *map_capability(struct pci_dev *dev, int off,
u32 start, u32 size,
size_t *len)
{
- u8 type_and_bar, bar;
+ u8 bar;
u32 offset, length;
void __iomem *p;
pci_read_config_byte(dev, off + offsetof(struct virtio_pci_cap,
- type_and_bar),
- &type_and_bar);
+ bar),
+...