Displaying 20 results from an estimated 117 matches for "pci_read_config_byte".
2020 Aug 19
0
[PATCH v3 04/18] virtio: Implement get_shm_region for PCI transport
...ct pci_dev *dev, u8 required_id,
+ u8 *bar, 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)) {
+ d...
2016 Aug 30
4
[PATCH v2 2/2] vfio: add virtio pci quirk
..._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);
> + pos > 0;
> + pos = pci_find_next_capability(dev, pos, PCI_CAP_ID_VNDR)) {
> + u8 type;
> + pci_read_config_byte(dev, pos + offsetof(struct virtio_pci_cap,
> + cfg_type),
> + &type);
> +
> + if (type != cfg_type)
> + continue;
> +
> + /* Ignore structures with reserved BAR values */
> + if (type != VIRTIO_PCI_CAP_PCI_CFG) {
> + u8 bar;
> +
> + pci_r...
2016 Aug 30
4
[PATCH v2 2/2] vfio: add virtio pci quirk
..._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);
> + pos > 0;
> + pos = pci_find_next_capability(dev, pos, PCI_CAP_ID_VNDR)) {
> + u8 type;
> + pci_read_config_byte(dev, pos + offsetof(struct virtio_pci_cap,
> + cfg_type),
> + &type);
> +
> + if (type != cfg_type)
> + continue;
> +
> + /* Ignore structures with reserved BAR values */
> + if (type != VIRTIO_PCI_CAP_PCI_CFG) {
> + u8 bar;
> +
> + pci_r...
2015 Jan 20
0
[PATCH 01/05] fixup! virtio_pci: modern driver
...- 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),
+ &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, leng...
2015 Jan 20
0
[PATCH 01/05] fixup! virtio_pci: modern driver
...- 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),
+ &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, leng...
2016 Apr 18
1
[PATCH RFC 3/3] vfio: add virtio pci quirk
...t same name in virtio code, can we come up with something
unique to avoid confusion?
> +{
> + 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;
> + pci_read_config_byte(dev, pos + offsetof(struct virtio_pci_cap,
> + cfg_type),
> + &type);
> +
> + if (type != cfg_type)
> + continue;
> +
> + /* Ignore structures with reserved BAR values */
> + if (type != VIRTIO_PCI_CAP_PCI_CFG) {
> + u8 bar;
> +
> + pci_r...
2016 Apr 18
1
[PATCH RFC 3/3] vfio: add virtio pci quirk
...t same name in virtio code, can we come up with something
unique to avoid confusion?
> +{
> + 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;
> + pci_read_config_byte(dev, pos + offsetof(struct virtio_pci_cap,
> + cfg_type),
> + &type);
> +
> + if (type != cfg_type)
> + continue;
> +
> + /* Ignore structures with reserved BAR values */
> + if (type != VIRTIO_PCI_CAP_PCI_CFG) {
> + u8 bar;
> +
> + pci_r...
2016 Aug 30
2
[PATCH v2 2/2] vfio: add virtio pci quirk
...t;
> > > +{
> > > + 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;
> > > + pci_read_config_byte(dev, pos + offsetof(struct virtio_pci_cap,
> > > + cfg_type),
> > > + &type);
> > > +
> > > + if (type != cfg_type)
> > > + continue;
> > > +
> > > + /* Ignore structures with reserved BAR values */
> > >...
2016 Aug 30
2
[PATCH v2 2/2] vfio: add virtio pci quirk
...t;
> > > +{
> > > + 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;
> > > + pci_read_config_byte(dev, pos + offsetof(struct virtio_pci_cap,
> > > + cfg_type),
> > > + &type);
> > > +
> > > + if (type != cfg_type)
> > > + continue;
> > > +
> > > + /* Ignore structures with reserved BAR values */
> > >...
2016 Apr 18
0
[PATCH RFC 3/3] vfio: add virtio pci quirk
...Returns offset of the capability, or 0.
+ */
+static inline int virtio_pci_find_capability(struct pci_dev *dev, u8 cfg_type)
+{
+ 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;
+ pci_read_config_byte(dev, pos + offsetof(struct virtio_pci_cap,
+ cfg_type),
+ &type);
+
+ if (type != cfg_type)
+ continue;
+
+ /* Ignore structures with reserved BAR values */
+ if (type != VIRTIO_PCI_CAP_PCI_CFG) {
+ u8 bar;
+
+ pci_read_config_byte(dev, pos +
+ offsetof(struct v...
2016 Aug 30
0
[PATCH v2 2/2] vfio: add virtio pci quirk
...Returns offset of the capability, or 0.
+ */
+static inline int virtio_pci_find_capability(struct pci_dev *dev, u8 cfg_type)
+{
+ 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;
+ pci_read_config_byte(dev, pos + offsetof(struct virtio_pci_cap,
+ cfg_type),
+ &type);
+
+ if (type != cfg_type)
+ continue;
+
+ /* Ignore structures with reserved BAR values */
+ if (type != VIRTIO_PCI_CAP_PCI_CFG) {
+ u8 bar;
+
+ pci_read_config_byte(dev, pos +
+ offsetof(struct v...
2016 Aug 30
6
[PATCH v2 0/2] vfio: blacklist legacy virtio devices
Legacy virtio devices always bypassed an IOMMU, so using them with vfio was
never safe. This adds a quirk detecting these and disabling VFIO unless the
noiommu mode is used. At the moment, this only applies to virtio-pci devices.
The patch might make sense on stable as well.
Michael S. Tsirkin (2):
vfio: report group noiommu status
vfio: add virtio pci quirk
2016 Aug 30
6
[PATCH v2 0/2] vfio: blacklist legacy virtio devices
Legacy virtio devices always bypassed an IOMMU, so using them with vfio was
never safe. This adds a quirk detecting these and disabling VFIO unless the
noiommu mode is used. At the moment, this only applies to virtio-pci devices.
The patch might make sense on stable as well.
Michael S. Tsirkin (2):
vfio: report group noiommu status
vfio: add virtio pci quirk
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...
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...
2016 Aug 30
0
[PATCH v2 2/2] vfio: add virtio pci quirk
...; Does inlining this really make sense?
>
> > +{
> > + 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;
> > + pci_read_config_byte(dev, pos + offsetof(struct virtio_pci_cap,
> > + cfg_type),
> > + &type);
> > +
> > + if (type != cfg_type)
> > + continue;
> > +
> > + /* Ignore structures with reserved BAR values */
> > + if (type != VIRTIO_PCI_CAP_PCI_CFG)...
2016 Apr 18
5
[PATCH RFC 0/3] virtio-pci: iommu support
This is an attempt to allow enabling IOMMU for DMA.
Design:
- new feature bit IOMMU_PLATFORM which means
host won't bypass IOMMU
- virtio core uses DMA API if it sees IOMMU_PLATFORM
- add quirk for vfio to disable device unless IOMMU_PLATFORM is set
or the no-iommu mode is enabled
- while I'm not sure how it will be used, it seems like a good idea to
also have
2016 Apr 18
5
[PATCH RFC 0/3] virtio-pci: iommu support
This is an attempt to allow enabling IOMMU for DMA.
Design:
- new feature bit IOMMU_PLATFORM which means
host won't bypass IOMMU
- virtio core uses DMA API if it sees IOMMU_PLATFORM
- add quirk for vfio to disable device unless IOMMU_PLATFORM is set
or the no-iommu mode is enabled
- while I'm not sure how it will be used, it seems like a good idea to
also have
2016 Aug 30
0
[PATCH v2 2/2] vfio: add virtio pci quirk
...gt; > + 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;
> > > > + pci_read_config_byte(dev, pos + offsetof(struct virtio_pci_cap,
> > > > + cfg_type),
> > > > + &type);
> > > > +
> > > > + if (type != cfg_type)
> > > > + continue;
> > > > +
> > > > + /* Ignore structures with re...
2020 Jun 10
2
[PATCH V3] vdpa: introduce virtio pci driver
...u32 ioresource_types, int *bars)
>> +{
>> + 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, bar;
>> +
>> + pci_read_config_byte(dev, pos + offsetof(struct virtio_pci_cap,
>> + cfg_type),
>> + &type);
>> + pci_read_config_byte(dev, pos + offsetof(struct virtio_pci_cap,
>> + bar),
>> + &bar);
>> +
>> + /* Ignore structures with reserved BAR valu...