All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pci: treat class 0 devices as endpoints
@ 2018-05-08  9:33 Roger Pau Monne
  2018-05-08 10:08 ` Andrew Cooper
  2018-05-14 12:46 ` Jan Beulich
  0 siblings, 2 replies; 4+ messages in thread
From: Roger Pau Monne @ 2018-05-08  9:33 UTC (permalink / raw)
  To: xen-devel; +Cc: Jan Beulich, 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

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

Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Cc: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/passthrough/pci.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index 1db69d5b99..c4890a4295 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -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;
 }
 
-- 
2.17.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] pci: treat class 0 devices as endpoints
  2018-05-08  9:33 [PATCH] pci: treat class 0 devices as endpoints Roger Pau Monne
@ 2018-05-08 10:08 ` Andrew Cooper
  2018-05-14 12:46 ` Jan Beulich
  1 sibling, 0 replies; 4+ messages in thread
From: Andrew Cooper @ 2018-05-08 10:08 UTC (permalink / raw)
  To: Roger Pau Monne, xen-devel; +Cc: Jan Beulich

On 08/05/18 10:33, Roger Pau Monne 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:
>
> 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.
>
> Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>

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

> ---
> Cc: Jan Beulich <jbeulich@suse.com>
> ---
>  xen/drivers/passthrough/pci.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
> index 1db69d5b99..c4890a4295 100644
> --- a/xen/drivers/passthrough/pci.c
> +++ b/xen/drivers/passthrough/pci.c
> @@ -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;
>  }
>  


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] pci: treat class 0 devices as endpoints
  2018-05-08  9:33 [PATCH] pci: treat class 0 devices as endpoints Roger Pau Monne
  2018-05-08 10:08 ` Andrew Cooper
@ 2018-05-14 12:46 ` Jan Beulich
  2018-05-14 14:01   ` Roger Pau Monné
  1 sibling, 1 reply; 4+ messages in thread
From: Jan Beulich @ 2018-05-14 12:46 UTC (permalink / raw)
  To: Roger Pau Monne; +Cc: xen-devel

>>> On 08.05.18 at 11:33, <roger.pau@citrix.com> 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:
> 
> 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.

> Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>

Acked-by: Jan Beulich <jbeulich@suse.com>

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] pci: treat class 0 devices as endpoints
  2018-05-14 12:46 ` Jan Beulich
@ 2018-05-14 14:01   ` Roger Pau Monné
  0 siblings, 0 replies; 4+ messages in thread
From: Roger Pau Monné @ 2018-05-14 14:01 UTC (permalink / raw)
  To: Jan Beulich; +Cc: xen-devel

On Mon, May 14, 2018 at 06:46:08AM -0600, Jan Beulich wrote:
> >>> On 08.05.18 at 11:33, <roger.pau@citrix.com> 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:
> > 
> > 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.
> 
> > Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
> > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> 
> Acked-by: Jan Beulich <jbeulich@suse.com>

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
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-05-14 14:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-08  9:33 [PATCH] pci: treat class 0 devices as endpoints Roger Pau Monne
2018-05-08 10:08 ` Andrew Cooper
2018-05-14 12:46 ` Jan Beulich
2018-05-14 14:01   ` Roger Pau Monné

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.