Skip to contentSkip to conversation

pci: treat class 0 devices as endpoints

PATCH In review Roger Pau Monne 3 participants 4 messages May 8, 2018 – May 14, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pci: treat class 0 devices as endpoints

Class 0 devices are legacy pre PCI 2.0 devices that didn't have a class code. Treat them as endpoints, so that they can be handled by the IOMMU and properly passed-through to the hardware domain.

Such device has been seen on a Super Micro server, lspci -vv reports:

00:13.0 Non-VGA unclassified device: Intel Corporation Device a135 (rev 31)
Subsystem: Super Micro Computer Inc Device 0931
Flags: bus master, fast devsel, latency 0, IRQ 11 Memory at df222000 (64-bit, non-prefetchable) [size=4K]
Capabilities: [80] Power Management version 3

Arguably this is not a legacy device (since this is a new server), but in any case Xen needs to deal with it.

---
Cc: Jan Beulich <[email protected]>

---
 xen/drivers/passthrough/pci.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
xen/drivers/passthrough/pci.c +2 -1
index 1db69d5b99..c4890a4295 100644
@@ -927,10 +927,11 @@ enum pdev_type pdev_type(u16 seg, u8 bus, u8 devfn)
     case PCI_CLASS_BRIDGE_HOST:
         return DEV_TYPE_PCI_HOST_BRIDGE;
 
-    case 0x0000: case 0xffff:
+    case 0xffff:
         return DEV_TYPE_PCI_UNKNOWN;
     }
 
+    /* NB: treat legacy pre PCI 2.0 devices (class_device == 0) as endpoints. */
     return pos ? DEV_TYPE_PCIe_ENDPOINT : DEV_TYPE_PCI;
 }
 
Signature · 7 lines
2.17.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw
Quoted 12 lines · Roger Pau Monne

Class 0 devices are legacy pre PCI 2.0 devices that didn't have a class code. Treat them as endpoints, so that they can be handled by the IOMMU and properly passed-through to the hardware domain.

Such device has been seen on a Super Micro server, lspci -vv reports:

00:13.0 Non-VGA unclassified device: Intel Corporation Device a135 (rev 31)
Subsystem: Super Micro Computer Inc Device 0931
Flags: bus master, fast devsel, latency 0, IRQ 11 Memory at df222000 (64-bit, non-prefetchable) [size=4K]
Capabilities: [80] Power Management version 3

Quoted 5 lines

Arguably this is not a legacy device (since this is a new server), but in any case Xen needs to deal with it.

FWIW, An updated lspci reports:

00:13.0 Non-VGA unclassified device: Intel Corporation Sunrise Point-H Integrated Sensor Hub (rev 31)
Subsystem: Super Micro Computer Inc Device 0931

~Andrew

Quoted 13 lines

---
Cc: Jan Beulich <[email protected]>

---
 xen/drivers/passthrough/pci.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
xen/drivers/passthrough/pci.c +0 -0
index 1db69d5b99..c4890a4295 100644
@@ -927,10 +927,11 @@ enum pdev_type pdev_type(u16 seg, u8 bus, u8 devfn)
     case PCI_CLASS_BRIDGE_HOST:
         return DEV_TYPE_PCI_HOST_BRIDGE;

xen/drivers/passthrough/pci.c enum pdev_type pdev_type(u16 seg, u8 bus, u8 devfn) · line 937

Quoted 10 lines
xen/drivers/passthrough/pci.c +2 -1
 
-    case 0x0000: case 0xffff:
+    case 0xffff:
         return DEV_TYPE_PCI_UNKNOWN;
     }
 
+    /* NB: treat legacy pre PCI 2.0 devices (class_device == 0) as endpoints. */
     return pos ? DEV_TYPE_PCIe_ENDPOINT : DEV_TYPE_PCI;
 }
 

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Acked-by on v1 1/1
#2 lore raw
In reply to Roger Pau Monne
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 08.05.18 at 11:33, <[email protected]> wrote:

Class 0 devices are legacy pre PCI 2.0 devices that didn't have a class code. Treat them as endpoints, so that they can be handled by the IOMMU and properly passed-through to the hardware domain.

Such device has been seen on a Super Micro server, lspci -vv reports:

Quoted 8 lines

00:13.0 Non-VGA unclassified device: Intel Corporation Device a135 (rev 31)
Subsystem: Super Micro Computer Inc Device 0931
Flags: bus master, fast devsel, latency 0, IRQ 11 Memory at df222000 (64-bit, non-prefetchable) [size=4K]
Capabilities: [80] Power Management version 3

Arguably this is not a legacy device (since this is a new server), but in any case Xen needs to deal with it.

Well, it's a two fold argument: On one hand I agree we ought to be dealing with class 0. Otoh this particular device is an example to the contrary - we should try to avoid passing through broken devices: If their designers don't even get the class code right, what other flaws do we have to expect? Anyway, this is no objection to the actual code change, I'm merely unconvinced that the argumentation is plausible.

Quoted 2 lines

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#3 lore raw
Quoted 23 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 08.05.18 at 11:33, <[email protected]> wrote:

Class 0 devices are legacy pre PCI 2.0 devices that didn't have a class code. Treat them as endpoints, so that they can be handled by the IOMMU and properly passed-through to the hardware domain.

Such device has been seen on a Super Micro server, lspci -vv reports:

Quoted 8 lines

00:13.0 Non-VGA unclassified device: Intel Corporation Device a135 (rev 31)
Subsystem: Super Micro Computer Inc Device 0931
Flags: bus master, fast devsel, latency 0, IRQ 11 Memory at df222000 (64-bit, non-prefetchable) [size=4K]
Capabilities: [80] Power Management version 3

Arguably this is not a legacy device (since this is a new server), but in any case Xen needs to deal with it.

Well, it's a two fold argument: On one hand I agree we ought to be dealing with class 0. Otoh this particular device is an example to the contrary - we should try to avoid passing through broken devices: If their designers don't even get the class code right, what other flaws do we have to expect? Anyway, this is no objection to the actual code change, I'm merely unconvinced that the argumentation is plausible.

Quoted 4 lines
Quoted 2 lines

Thanks.

Since I also have another patch already Acked, I guess I will maintain my for-4.12 branch until the tree opens again.

Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel