Skip to contentSkip to conversation

vfio: Extended capability fixes

PATCH Applied Alex Williamson 3 participants 4 messages Nov 2, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vfio: Extended capability fixes

- Virtual channel position gets truncated as a u8
- Print the ecap that's unknown, not the last cap we saw
- Print actual config offset, which provides enough info to make some sense of the error.

---

 drivers/vfio/vfio_pci_config.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/vfio/vfio_pci_config.c +4 -4
index 8af995d..8304316 100644
@@ -410,7 +410,7 @@ static int vfio_msi_cap_len(struct vfio_dev *vdev, u8 pos)
  * Determine extended capability length for VC (2 & 9) and
  * MFVC capabilities
  */
-static int vfio_vc_cap_len(struct vfio_dev *vdev, u8 pos)
+static int vfio_vc_cap_len(struct vfio_dev *vdev, u16 pos)
 {
 	struct pci_dev *pdev = vdev->pdev;
 	u32 dw;
@@ -580,7 +580,7 @@ int vfio_build_config_map(struct vfio_dev *vdev)
 				printk(KERN_WARNING
 					"%s: pci config conflict at %x, "
 					"caps %x %x\n",
-					__func__, i, map[pos+i], cap);
+					__func__, pos+i, map[pos+i], cap);
 			map[pos+i] = cap;
 		}
 		ret = pci_read_config_byte(pdev, pos + PCI_CAP_LIST_NEXT, &pos);
@@ -683,7 +683,7 @@ int vfio_build_config_map(struct vfio_dev *vdev)
 		if (len == 0 || len == 0xFF) {
 			printk(KERN_WARNING
 				"%s: unknown length for pci ext cap %x\n",
-				__func__, cap);
+				__func__, ecap);
 			len = PCI_CAP_SIZEOF;
 		}
 		for (i = 0; i < len; i++) {
@@ -691,7 +691,7 @@ int vfio_build_config_map(struct vfio_dev *vdev)
 				printk(KERN_WARNING
 					"%s: pci config conflict at %x, "
 					"caps %x %x\n",
-					__func__, i, map[epos+i], ecap);
+					__func__, epos+i, map[epos+i], ecap);
 			map[epos+i] = ecap;
 		}
 
#1 lore raw
Quoted 43 lines · Alex Williamson

- Virtual channel position gets truncated as a u8
- Print the ecap that's unknown, not the last cap we saw
- Print actual config offset, which provides enough info to make some sense of the error.

---

 drivers/vfio/vfio_pci_config.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/vfio/vfio_pci_config.c +3 -3
index 8af995d..8304316 100644
@@ -410,7 +410,7 @@ static int vfio_msi_cap_len(struct vfio_dev *vdev, u8 pos)
  * Determine extended capability length for VC (2 & 9) and
  * MFVC capabilities
  */
-static int vfio_vc_cap_len(struct vfio_dev *vdev, u8 pos)
+static int vfio_vc_cap_len(struct vfio_dev *vdev, u16 pos)
 {
 	struct pci_dev *pdev = vdev->pdev;
 	u32 dw;
@@ -580,7 +580,7 @@ int vfio_build_config_map(struct vfio_dev *vdev)
 				printk(KERN_WARNING
 					"%s: pci config conflict at %x, "
 					"caps %x %x\n",
-					__func__, i, map[pos+i], cap);
+					__func__, pos+i, map[pos+i], cap);
 			map[pos+i] = cap;
 		}
 		ret = pci_read_config_byte(pdev, pos + PCI_CAP_LIST_NEXT, &pos);
@@ -683,7 +683,7 @@ int vfio_build_config_map(struct vfio_dev *vdev)
 		if (len == 0 || len == 0xFF) {
 			printk(KERN_WARNING
 				"%s: unknown length for pci ext cap %x\n",
-				__func__, cap);
+				__func__, ecap);
 			len = PCI_CAP_SIZEOF;
 		}
 		for (i = 0; i < len; i++) {

drivers/vfio/vfio_pci_config.c int vfio_build_config_map(struct vfio_dev *vdev) · line 695

Quoted 6 lines
drivers/vfio/vfio_pci_config.c +1 -1
@@ -691,7 +691,7 @@ int vfio_build_config_map(struct vfio_dev *vdev)
 				printk(KERN_WARNING
 					"%s: pci config conflict at %x, "
 					"caps %x %x\n",
-					__func__, i, map[epos+i], ecap);
+					__func__, epos+i, map[epos+i], ecap);
 			map[epos+i] = ecap;

Not related to this patch, but I am surprised checkpatch does not complain about lack of spaces around + here and elsewhere. Or does it?

Quoted 8 lines
drivers/vfio/vfio_pci_config.c +0 -1
 		}
 
 
--

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#2 lore raw
Quoted 71 lines · Michael S. Tsirkin
Quoted 70 lines · Alex Williamson

- Virtual channel position gets truncated as a u8

- Print the ecap that's unknown, not the last cap we saw
- Print actual config offset, which provides enough info to make

some sense of the error.

---

 drivers/vfio/vfio_pci_config.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
(quoted diff) +0 -0

b/drivers/vfio/vfio_pci_config.c index 8af995d..8304316 100644

drivers/vfio/vfio_pci_config.c +1 -1
@@ -410,7 +410,7 @@ static int vfio_msi_cap_len(struct vfio_dev *vdev, u8
 pos)
 
  * Determine extended capability length for VC (2 & 9) and
  * MFVC capabilities
  */
 
-static int vfio_vc_cap_len(struct vfio_dev *vdev, u8 pos)
+static int vfio_vc_cap_len(struct vfio_dev *vdev, u16 pos)

{

drivers/vfio/vfio_pci_config.c +1 -1
 	struct pci_dev *pdev = vdev->pdev;
 	u32 dw;
@@ -580,7 +580,7 @@ int vfio_build_config_map(struct vfio_dev *vdev)
 
 				printk(KERN_WARNING
 
 					"%s: pci config conflict at %x, "
 					"caps %x %x\n",
 
-					__func__, i, map[pos+i], cap);
+					__func__, pos+i, map[pos+i], cap);
drivers/vfio/vfio_pci_config.c +1 -1
 			map[pos+i] = cap;
 
 		}
 		ret = pci_read_config_byte(pdev, pos + PCI_CAP_LIST_NEXT, &pos);
@@ -683,7 +683,7 @@ int vfio_build_config_map(struct vfio_dev *vdev)
 
 		if (len == 0 || len == 0xFF) {
 
 			printk(KERN_WARNING
 
 				"%s: unknown length for pci ext cap %x\n",
 
-				__func__, cap);
+				__func__, ecap);
 
 			len = PCI_CAP_SIZEOF;
 
 		}
 		for (i = 0; i < len; i++) {
@@ -691,7 +691,7 @@ int vfio_build_config_map(struct vfio_dev *vdev)
 
 				printk(KERN_WARNING
 
 					"%s: pci config conflict at %x, "
 					"caps %x %x\n",
 
Quoted 8 lines
Quoted 4 lines
drivers/vfio/vfio_pci_config.c +1 -1
-					__func__, i, map[epos+i], ecap);
+					__func__, epos+i, map[epos+i], ecap);

map[epos+i] = ecap;

Not related to this patch, but I am surprised checkpatch does not complain about lack of spaces around + here and elsewhere. Or does it?

It did not complain.

Quoted 8 lines
Quoted 8 lines

}

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Applied
#3 lore raw
In reply to Alex Williamson

Applied. Thanks!

Quoted 50 lines · Alex Williamson

- Virtual channel position gets truncated as a u8
- Print the ecap that's unknown, not the last cap we saw
- Print actual config offset, which provides enough info to make some sense of the error.

---

 drivers/vfio/vfio_pci_config.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
(quoted diff) +0 -0

b/drivers/vfio/vfio_pci_config.c index 8af995d..8304316 100644

drivers/vfio/vfio_pci_config.c +0 -0
@@ -410,7 +410,7 @@ static int vfio_msi_cap_len(struct vfio_dev *vdev, u8

pos) * Determine extended capability length for VC (2 & 9) and
* MFVC capabilities
*/

drivers/vfio/vfio_pci_config.c +4 -4
-static int vfio_vc_cap_len(struct vfio_dev *vdev, u8 pos)
+static int vfio_vc_cap_len(struct vfio_dev *vdev, u16 pos)
 {
 	struct pci_dev *pdev = vdev->pdev;
 	u32 dw;
@@ -580,7 +580,7 @@ int vfio_build_config_map(struct vfio_dev *vdev)
 				printk(KERN_WARNING
 					"%s: pci config conflict at %x, "
 					"caps %x %x\n",
-					__func__, i, map[pos+i], cap);
+					__func__, pos+i, map[pos+i], cap);
 			map[pos+i] = cap;
 		}
 		ret = pci_read_config_byte(pdev, pos + PCI_CAP_LIST_NEXT, &pos);
@@ -683,7 +683,7 @@ int vfio_build_config_map(struct vfio_dev *vdev)
 		if (len == 0 || len == 0xFF) {
 			printk(KERN_WARNING
 				"%s: unknown length for pci ext cap %x\n",
-				__func__, cap);
+				__func__, ecap);
 			len = PCI_CAP_SIZEOF;
 		}
 		for (i = 0; i < len; i++) {
@@ -691,7 +691,7 @@ int vfio_build_config_map(struct vfio_dev *vdev)
 				printk(KERN_WARNING
 					"%s: pci config conflict at %x, "
 					"caps %x %x\n",
-					__func__, i, map[epos+i], ecap);
+					__func__, epos+i, map[epos+i], ecap);
 			map[epos+i] = ecap;
 		}