Skip to contentSkip to conversation

drm/i915: Detect virtual south bridge

PATCH Applied [email protected] 4 participants 8 messages Aug 28, 2015 – Sep 28, 2015

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

PATCH 1/1 drm/i915: Detect virtual south bridge

From: Robert Beckett <[email protected]>

Virtualized systems often use a virtual P2X4 south bridge. Detect this in intel_detect_pch and make a best guess as to which PCH we should be using.

This was seen on vmware esxi hypervisor. When passing the graphics device through to a guest, it can not pass through the PCH. Instead it simulates a P2X4 southbridge.

---
 drivers/gpu/drm/i915/i915_drv.c |   30 ++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/i915_drv.h |    1 +
 2 files changed, 31 insertions(+)
drivers/gpu/drm/i915/i915_drv.c +30 -0
index ce3bd0c..8e158b3 100644
@@ -443,6 +443,34 @@ static const struct pci_device_id pciidlist[] = {		/* aka */
 
 MODULE_DEVICE_TABLE(pci, pciidlist);
 
+static enum intel_pch intel_virt_detect_pch(struct drm_device *dev)
+{
+	enum intel_pch ret = PCH_NOP;
+
+	/*
+	 * In a virtualized passthrough environment we can be in a
+	 * setup where the ISA bridge is not able to be passed through.
+	 * In this case, a south bridge can be emulated and we have to
+	 * make an educated guess as to which PCH is really there.
+	 */
+
+	if (IS_GEN5(dev)) {
+		ret = PCH_IBX;
+		DRM_DEBUG_KMS("Assuming Ibex Peak PCH\n");
+	} else if (IS_GEN6(dev) || IS_IVYBRIDGE(dev)) {
+		ret = PCH_CPT;
+		DRM_DEBUG_KMS("Assuming CouarPoint PCH\n");
+	} else if (IS_HASWELL(dev) || IS_BROADWELL(dev)) {
+		ret = PCH_LPT;
+		DRM_DEBUG_KMS("Assuming LynxPoint PCH\n");
+	} else if (IS_SKYLAKE(dev)) {
+		ret = PCH_SPT;
+		DRM_DEBUG_KMS("Assuming SunrisePoint PCH\n");
+	}
+
+	return ret;
+}
+
 void intel_detect_pch(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
@@ -503,6 +531,8 @@ void intel_detect_pch(struct drm_device *dev)
 				dev_priv->pch_type = PCH_SPT;
 				DRM_DEBUG_KMS("Found SunrisePoint LP PCH\n");
 				WARN_ON(!IS_SKYLAKE(dev));
+			} else if (id == INTEL_PCH_P2X_DEVICE_ID_TYPE) {
+				dev_priv->pch_type = intel_virt_detect_pch(dev);
 			} else
 				continue;
 
drivers/gpu/drm/i915/i915_drv.h +1 -0
index 8c93845..6eb0230 100644
@@ -2584,6 +2584,7 @@ struct drm_i915_cmd_table {
 #define INTEL_PCH_LPT_LP_DEVICE_ID_TYPE		0x9c00
 #define INTEL_PCH_SPT_DEVICE_ID_TYPE		0xA100
 #define INTEL_PCH_SPT_LP_DEVICE_ID_TYPE		0x9D00
+#define INTEL_PCH_P2X_DEVICE_ID_TYPE		0x7100
 
 #define INTEL_PCH_TYPE(dev) (__I915__(dev)->pch_type)
 #define HAS_PCH_SPT(dev) (INTEL_PCH_TYPE(dev) == PCH_SPT)
Signature · 6 lines
1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 11 lines · On Fri, Aug 28, 2015 at 01:10:22PM +0100, [email protected] wrote:

From: Robert Beckett <[email protected]>

Virtualized systems often use a virtual P2X4 south bridge. Detect this in intel_detect_pch and make a best guess as to which PCH we should be using.

This was seen on vmware esxi hypervisor. When passing the graphics device through to a guest, it can not pass through the PCH. Instead it simulates a P2X4 southbridge.

What changed here compared to your earlier submission a day before? -Daniel

Quoted 72 lines
---
 drivers/gpu/drm/i915/i915_drv.c |   30 ++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/i915_drv.h |    1 +
 2 files changed, 31 insertions(+)
drivers/gpu/drm/i915/i915_drv.c +30 -0
index ce3bd0c..8e158b3 100644
@@ -443,6 +443,34 @@ static const struct pci_device_id pciidlist[] = {		/* aka */
 
 MODULE_DEVICE_TABLE(pci, pciidlist);
 
+static enum intel_pch intel_virt_detect_pch(struct drm_device *dev)
+{
+	enum intel_pch ret = PCH_NOP;
+
+	/*
+	 * In a virtualized passthrough environment we can be in a
+	 * setup where the ISA bridge is not able to be passed through.
+	 * In this case, a south bridge can be emulated and we have to
+	 * make an educated guess as to which PCH is really there.
+	 */
+
+	if (IS_GEN5(dev)) {
+		ret = PCH_IBX;
+		DRM_DEBUG_KMS("Assuming Ibex Peak PCH\n");
+	} else if (IS_GEN6(dev) || IS_IVYBRIDGE(dev)) {
+		ret = PCH_CPT;
+		DRM_DEBUG_KMS("Assuming CouarPoint PCH\n");
+	} else if (IS_HASWELL(dev) || IS_BROADWELL(dev)) {
+		ret = PCH_LPT;
+		DRM_DEBUG_KMS("Assuming LynxPoint PCH\n");
+	} else if (IS_SKYLAKE(dev)) {
+		ret = PCH_SPT;
+		DRM_DEBUG_KMS("Assuming SunrisePoint PCH\n");
+	}
+
+	return ret;
+}
+
 void intel_detect_pch(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
@@ -503,6 +531,8 @@ void intel_detect_pch(struct drm_device *dev)
 				dev_priv->pch_type = PCH_SPT;
 				DRM_DEBUG_KMS("Found SunrisePoint LP PCH\n");
 				WARN_ON(!IS_SKYLAKE(dev));
+			} else if (id == INTEL_PCH_P2X_DEVICE_ID_TYPE) {
+				dev_priv->pch_type = intel_virt_detect_pch(dev);
 			} else
 				continue;
 
drivers/gpu/drm/i915/i915_drv.h +1 -0
index 8c93845..6eb0230 100644
@@ -2584,6 +2584,7 @@ struct drm_i915_cmd_table {
 #define INTEL_PCH_LPT_LP_DEVICE_ID_TYPE		0x9c00
 #define INTEL_PCH_SPT_DEVICE_ID_TYPE		0xA100
 #define INTEL_PCH_SPT_LP_DEVICE_ID_TYPE		0x9D00
+#define INTEL_PCH_P2X_DEVICE_ID_TYPE		0x7100
 
 #define INTEL_PCH_TYPE(dev) (__I915__(dev)->pch_type)
 #define HAS_PCH_SPT(dev) (INTEL_PCH_TYPE(dev) == PCH_SPT)
Signature · 6 lines
1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw
Quoted 7 lines · Daniel Vetter
Quoted 6 lines · On Fri, Aug 28, 2015 at 01:10:22PM +0100, [email protected] wrote:

From: Robert Beckett <[email protected]>

Virtualized systems often use a virtual P2X4 south bridge. Detect this in intel_detect_pch and make a best guess as to which PCH we should be using.

Quoted 8 lines
Quoted 5 lines

This was seen on vmware esxi hypervisor. When passing the graphics device through to a guest, it can not pass through the PCH. Instead it simulates a P2X4 southbridge.

What changed here compared to your earlier submission a day before? -Daniel

Nothing functional, just corrected the "[PATCH]" tag in the subject. My email client was doing weird things...

Quoted 69 lines
Quoted 69 lines
---
  drivers/gpu/drm/i915/i915_drv.c |   30 ++++++++++++++++++++++++++++++
  drivers/gpu/drm/i915/i915_drv.h |    1 +
  2 files changed, 31 insertions(+)
drivers/gpu/drm/i915/i915_drv.c +30 -0
index ce3bd0c..8e158b3 100644
@@ -443,6 +443,34 @@ static const struct pci_device_id pciidlist[] = {		/* aka */
 
  MODULE_DEVICE_TABLE(pci, pciidlist);
 
+static enum intel_pch intel_virt_detect_pch(struct drm_device *dev)
+{
+	enum intel_pch ret = PCH_NOP;
+
+	/*
+	 * In a virtualized passthrough environment we can be in a
+	 * setup where the ISA bridge is not able to be passed through.
+	 * In this case, a south bridge can be emulated and we have to
+	 * make an educated guess as to which PCH is really there.
+	 */
+
+	if (IS_GEN5(dev)) {
+		ret = PCH_IBX;
+		DRM_DEBUG_KMS("Assuming Ibex Peak PCH\n");
+	} else if (IS_GEN6(dev) || IS_IVYBRIDGE(dev)) {
+		ret = PCH_CPT;
+		DRM_DEBUG_KMS("Assuming CouarPoint PCH\n");
+	} else if (IS_HASWELL(dev) || IS_BROADWELL(dev)) {
+		ret = PCH_LPT;
+		DRM_DEBUG_KMS("Assuming LynxPoint PCH\n");
+	} else if (IS_SKYLAKE(dev)) {
+		ret = PCH_SPT;
+		DRM_DEBUG_KMS("Assuming SunrisePoint PCH\n");
+	}
+
+	return ret;
+}
+
  void intel_detect_pch(struct drm_device *dev)
  {
  	struct drm_i915_private *dev_priv = dev->dev_private;
@@ -503,6 +531,8 @@ void intel_detect_pch(struct drm_device *dev)
  				dev_priv->pch_type = PCH_SPT;
  				DRM_DEBUG_KMS("Found SunrisePoint LP PCH\n");
  				WARN_ON(!IS_SKYLAKE(dev));
+			} else if (id == INTEL_PCH_P2X_DEVICE_ID_TYPE) {
+				dev_priv->pch_type = intel_virt_detect_pch(dev);
  			} else
  				continue;
 
drivers/gpu/drm/i915/i915_drv.h +1 -1
index 8c93845..6eb0230 100644
@@ -2584,6 +2584,7 @@ struct drm_i915_cmd_table {
  #define INTEL_PCH_LPT_LP_DEVICE_ID_TYPE		0x9c00
  #define INTEL_PCH_SPT_DEVICE_ID_TYPE		0xA100
  #define INTEL_PCH_SPT_LP_DEVICE_ID_TYPE		0x9D00
+#define INTEL_PCH_P2X_DEVICE_ID_TYPE		0x7100
 
  #define INTEL_PCH_TYPE(dev) (__I915__(dev)->pch_type)
  #define HAS_PCH_SPT(dev) (INTEL_PCH_TYPE(dev) == PCH_SPT)
--

1.7.9.5

Quoted 5 lines
Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reviewed-by on v1 1/1
#3 lore raw
In reply to [email protected]
Quoted 70 lines · On 08/28/2015 05:10 AM, [email protected] wrote:

From: Robert Beckett <[email protected]>

Virtualized systems often use a virtual P2X4 south bridge. Detect this in intel_detect_pch and make a best guess as to which PCH we should be using.

This was seen on vmware esxi hypervisor. When passing the graphics device through to a guest, it can not pass through the PCH. Instead it simulates a P2X4 southbridge.

---
 drivers/gpu/drm/i915/i915_drv.c |   30 ++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/i915_drv.h |    1 +
 2 files changed, 31 insertions(+)
drivers/gpu/drm/i915/i915_drv.c +30 -0
index ce3bd0c..8e158b3 100644
@@ -443,6 +443,34 @@ static const struct pci_device_id pciidlist[] = {		/* aka */
 
 MODULE_DEVICE_TABLE(pci, pciidlist);
 
+static enum intel_pch intel_virt_detect_pch(struct drm_device *dev)
+{
+	enum intel_pch ret = PCH_NOP;
+
+	/*
+	 * In a virtualized passthrough environment we can be in a
+	 * setup where the ISA bridge is not able to be passed through.
+	 * In this case, a south bridge can be emulated and we have to
+	 * make an educated guess as to which PCH is really there.
+	 */
+
+	if (IS_GEN5(dev)) {
+		ret = PCH_IBX;
+		DRM_DEBUG_KMS("Assuming Ibex Peak PCH\n");
+	} else if (IS_GEN6(dev) || IS_IVYBRIDGE(dev)) {
+		ret = PCH_CPT;
+		DRM_DEBUG_KMS("Assuming CouarPoint PCH\n");
+	} else if (IS_HASWELL(dev) || IS_BROADWELL(dev)) {
+		ret = PCH_LPT;
+		DRM_DEBUG_KMS("Assuming LynxPoint PCH\n");
+	} else if (IS_SKYLAKE(dev)) {
+		ret = PCH_SPT;
+		DRM_DEBUG_KMS("Assuming SunrisePoint PCH\n");
+	}
+
+	return ret;
+}
+
 void intel_detect_pch(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
@@ -503,6 +531,8 @@ void intel_detect_pch(struct drm_device *dev)
 				dev_priv->pch_type = PCH_SPT;
 				DRM_DEBUG_KMS("Found SunrisePoint LP PCH\n");
 				WARN_ON(!IS_SKYLAKE(dev));
+			} else if (id == INTEL_PCH_P2X_DEVICE_ID_TYPE) {
+				dev_priv->pch_type = intel_virt_detect_pch(dev);
 			} else
 				continue;
 
drivers/gpu/drm/i915/i915_drv.h +0 -0
index 8c93845..6eb0230 100644

drivers/gpu/drm/i915/i915_drv.h struct drm_i915_cmd_table { · line 2590

Quoted 7 lines
drivers/gpu/drm/i915/i915_drv.h +1 -0
@@ -2584,6 +2584,7 @@ struct drm_i915_cmd_table {
 #define INTEL_PCH_LPT_LP_DEVICE_ID_TYPE		0x9c00
 #define INTEL_PCH_SPT_DEVICE_ID_TYPE		0xA100
 #define INTEL_PCH_SPT_LP_DEVICE_ID_TYPE		0x9D00
+#define INTEL_PCH_P2X_DEVICE_ID_TYPE		0x7100
 
 #define INTEL_PCH_TYPE(dev) (__I915__(dev)->pch_type)
 #define HAS_PCH_SPT(dev) (INTEL_PCH_TYPE(dev) == PCH_SPT)

Assuming Kevin is ok with this:

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw
Quoted 80 lines

From: Jesse Barnes [mailto:[email protected]]
Sent: Friday, September 25, 2015 12:41 AM

Quoted 6 lines · On 08/28/2015 05:10 AM, [email protected] wrote:

From: Robert Beckett <[email protected]>

Virtualized systems often use a virtual P2X4 south bridge. Detect this in intel_detect_pch and make a best guess as to which PCH we should be using.

Quoted 7 lines

This was seen on vmware esxi hypervisor. When passing the graphics device through to a guest, it can not pass through the PCH. Instead it simulates a P2X4 southbridge.

---
 drivers/gpu/drm/i915/i915_drv.c |   30

++++++++++++++++++++++++++++++

drivers/gpu/drm/i915/i915_drv.c static const struct pci_device_id pciidlist[] = { /* aka

Quoted 8 lines
 drivers/gpu/drm/i915/i915_drv.h |    1 +
 2 files changed, 31 insertions(+)
drivers/gpu/drm/i915/i915_drv.c +0 -0
index ce3bd0c..8e158b3 100644
@@ -443,6 +443,34 @@ static const struct pci_device_id pciidlist[] = {		/* aka

*/

Quoted 53 lines
drivers/gpu/drm/i915/i915_drv.c +30 -0
 MODULE_DEVICE_TABLE(pci, pciidlist);
 
+static enum intel_pch intel_virt_detect_pch(struct drm_device *dev)
+{
+	enum intel_pch ret = PCH_NOP;
+
+	/*
+	 * In a virtualized passthrough environment we can be in a
+	 * setup where the ISA bridge is not able to be passed through.
+	 * In this case, a south bridge can be emulated and we have to
+	 * make an educated guess as to which PCH is really there.
+	 */
+
+	if (IS_GEN5(dev)) {
+		ret = PCH_IBX;
+		DRM_DEBUG_KMS("Assuming Ibex Peak PCH\n");
+	} else if (IS_GEN6(dev) || IS_IVYBRIDGE(dev)) {
+		ret = PCH_CPT;
+		DRM_DEBUG_KMS("Assuming CouarPoint PCH\n");
+	} else if (IS_HASWELL(dev) || IS_BROADWELL(dev)) {
+		ret = PCH_LPT;
+		DRM_DEBUG_KMS("Assuming LynxPoint PCH\n");
+	} else if (IS_SKYLAKE(dev)) {
+		ret = PCH_SPT;
+		DRM_DEBUG_KMS("Assuming SunrisePoint PCH\n");
+	}
+
+	return ret;
+}
+
 void intel_detect_pch(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
@@ -503,6 +531,8 @@ void intel_detect_pch(struct drm_device *dev)
 				dev_priv->pch_type = PCH_SPT;
 				DRM_DEBUG_KMS("Found SunrisePoint LP PCH\n");
 				WARN_ON(!IS_SKYLAKE(dev));
+			} else if (id == INTEL_PCH_P2X_DEVICE_ID_TYPE) {
+				dev_priv->pch_type = intel_virt_detect_pch(dev);
 			} else
 				continue;
 
drivers/gpu/drm/i915/i915_drv.h +1 -0
index 8c93845..6eb0230 100644
@@ -2584,6 +2584,7 @@ struct drm_i915_cmd_table {
 #define INTEL_PCH_LPT_LP_DEVICE_ID_TYPE		0x9c00
 #define INTEL_PCH_SPT_DEVICE_ID_TYPE		0xA100
 #define INTEL_PCH_SPT_LP_DEVICE_ID_TYPE		0x9D00
+#define INTEL_PCH_P2X_DEVICE_ID_TYPE		0x7100
 
Quoted 6 lines

drivers/gpu/drm/i915/i915_drv.h struct drm_i915_cmd_table { · line 2590

Quoted 3 lines
drivers/gpu/drm/i915/i915_drv.h +0 -0
 #define INTEL_PCH_TYPE(dev) (__I915__(dev)->pch_type)
 #define HAS_PCH_SPT(dev) (INTEL_PCH_TYPE(dev) == PCH_SPT)

Assuming Kevin is ok with this:

Yes, I'm OK with this change. Just one comment. Does it make sense to always have the guess as the fallback, instead of only for P2X? If native side is OK with this, it will remove the need to add more IDs for different hypervisors in the future...

Thanks
Kevin
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw
Quoted 87 lines · Kevin
Quoted 80 lines

From: Jesse Barnes [mailto:[email protected]]
Sent: Friday, September 25, 2015 12:41 AM

Quoted 6 lines · On 08/28/2015 05:10 AM, [email protected] wrote:

From: Robert Beckett <[email protected]>

Virtualized systems often use a virtual P2X4 south bridge. Detect this in intel_detect_pch and make a best guess as to which PCH we should be using.

Quoted 7 lines

This was seen on vmware esxi hypervisor. When passing the graphics device through to a guest, it can not pass through the PCH. Instead it simulates a P2X4 southbridge.

---
 drivers/gpu/drm/i915/i915_drv.c |   30

++++++++++++++++++++++++++++++

drivers/gpu/drm/i915/i915_drv.c static const struct pci_device_id pciidlist[] = { /* aka

Quoted 8 lines
 drivers/gpu/drm/i915/i915_drv.h |    1 +
 2 files changed, 31 insertions(+)
drivers/gpu/drm/i915/i915_drv.c +0 -0
index ce3bd0c..8e158b3 100644
@@ -443,6 +443,34 @@ static const struct pci_device_id pciidlist[] = {		/* aka

*/

Quoted 53 lines
drivers/gpu/drm/i915/i915_drv.c +30 -0
 MODULE_DEVICE_TABLE(pci, pciidlist);
 
+static enum intel_pch intel_virt_detect_pch(struct drm_device *dev)
+{
+	enum intel_pch ret = PCH_NOP;
+
+	/*
+	 * In a virtualized passthrough environment we can be in a
+	 * setup where the ISA bridge is not able to be passed through.
+	 * In this case, a south bridge can be emulated and we have to
+	 * make an educated guess as to which PCH is really there.
+	 */
+
+	if (IS_GEN5(dev)) {
+		ret = PCH_IBX;
+		DRM_DEBUG_KMS("Assuming Ibex Peak PCH\n");
+	} else if (IS_GEN6(dev) || IS_IVYBRIDGE(dev)) {
+		ret = PCH_CPT;
+		DRM_DEBUG_KMS("Assuming CouarPoint PCH\n");
+	} else if (IS_HASWELL(dev) || IS_BROADWELL(dev)) {
+		ret = PCH_LPT;
+		DRM_DEBUG_KMS("Assuming LynxPoint PCH\n");
+	} else if (IS_SKYLAKE(dev)) {
+		ret = PCH_SPT;
+		DRM_DEBUG_KMS("Assuming SunrisePoint PCH\n");
+	}
+
+	return ret;
+}
+
 void intel_detect_pch(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
@@ -503,6 +531,8 @@ void intel_detect_pch(struct drm_device *dev)
 				dev_priv->pch_type = PCH_SPT;
 				DRM_DEBUG_KMS("Found SunrisePoint LP PCH\n");
 				WARN_ON(!IS_SKYLAKE(dev));
+			} else if (id == INTEL_PCH_P2X_DEVICE_ID_TYPE) {
+				dev_priv->pch_type = intel_virt_detect_pch(dev);
 			} else
 				continue;
 
drivers/gpu/drm/i915/i915_drv.h +1 -0
index 8c93845..6eb0230 100644
@@ -2584,6 +2584,7 @@ struct drm_i915_cmd_table {
 #define INTEL_PCH_LPT_LP_DEVICE_ID_TYPE		0x9c00
 #define INTEL_PCH_SPT_DEVICE_ID_TYPE		0xA100
 #define INTEL_PCH_SPT_LP_DEVICE_ID_TYPE		0x9D00
+#define INTEL_PCH_P2X_DEVICE_ID_TYPE		0x7100
 
Quoted 6 lines

drivers/gpu/drm/i915/i915_drv.h struct drm_i915_cmd_table { · line 2590

Quoted 3 lines
drivers/gpu/drm/i915/i915_drv.h +0 -0
 #define INTEL_PCH_TYPE(dev) (__I915__(dev)->pch_type)
 #define HAS_PCH_SPT(dev) (INTEL_PCH_TYPE(dev) == PCH_SPT)

Assuming Kevin is ok with this:

Quoted 4 lines

Yes, I'm OK with this change. Just one comment. Does it make sense to always have the guess as the fallback, instead of only for P2X? If native side is OK with this, it will remove the need to add more IDs for different hypervisors in the future...

Yeah, at this point I don't think we have mix & match cases to worry about, so we could guess based on the GPU type across the board.

Jesse

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#6 lore raw
Quoted 88 lines · Jesse Barnes
Quoted 87 lines · Kevin
Quoted 86 lines

From: Jesse Barnes [mailto:[email protected]]
Sent: Friday, September 25, 2015 12:41 AM

Quoted 6 lines · On 08/28/2015 05:10 AM, [email protected] wrote:

From: Robert Beckett <[email protected]>

Virtualized systems often use a virtual P2X4 south bridge. Detect this in intel_detect_pch and make a best guess as to which PCH we should be using.

Quoted 7 lines

This was seen on vmware esxi hypervisor. When passing the graphics device through to a guest, it can not pass through the PCH. Instead it simulates a P2X4 southbridge.

---
 drivers/gpu/drm/i915/i915_drv.c |   30

++++++++++++++++++++++++++++++

drivers/gpu/drm/i915/i915_drv.c static const struct pci_device_id pciidlist[] = { /* aka

Quoted 8 lines
 drivers/gpu/drm/i915/i915_drv.h |    1 +
 2 files changed, 31 insertions(+)
drivers/gpu/drm/i915/i915_drv.c +0 -0
index ce3bd0c..8e158b3 100644
@@ -443,6 +443,34 @@ static const struct pci_device_id pciidlist[] = {		/* aka

*/

Quoted 49 lines
drivers/gpu/drm/i915/i915_drv.c +30 -0
 MODULE_DEVICE_TABLE(pci, pciidlist);
 
+static enum intel_pch intel_virt_detect_pch(struct drm_device *dev)
+{
+	enum intel_pch ret = PCH_NOP;
+
+	/*
+	 * In a virtualized passthrough environment we can be in a
+	 * setup where the ISA bridge is not able to be passed through.
+	 * In this case, a south bridge can be emulated and we have to
+	 * make an educated guess as to which PCH is really there.
+	 */
+
+	if (IS_GEN5(dev)) {
+		ret = PCH_IBX;
+		DRM_DEBUG_KMS("Assuming Ibex Peak PCH\n");
+	} else if (IS_GEN6(dev) || IS_IVYBRIDGE(dev)) {
+		ret = PCH_CPT;
+		DRM_DEBUG_KMS("Assuming CouarPoint PCH\n");
+	} else if (IS_HASWELL(dev) || IS_BROADWELL(dev)) {
+		ret = PCH_LPT;
+		DRM_DEBUG_KMS("Assuming LynxPoint PCH\n");
+	} else if (IS_SKYLAKE(dev)) {
+		ret = PCH_SPT;
+		DRM_DEBUG_KMS("Assuming SunrisePoint PCH\n");
+	}
+
+	return ret;
+}
+
 void intel_detect_pch(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
@@ -503,6 +531,8 @@ void intel_detect_pch(struct drm_device *dev)
 				dev_priv->pch_type = PCH_SPT;
 				DRM_DEBUG_KMS("Found SunrisePoint LP PCH\n");
 				WARN_ON(!IS_SKYLAKE(dev));
+			} else if (id == INTEL_PCH_P2X_DEVICE_ID_TYPE) {
+				dev_priv->pch_type = intel_virt_detect_pch(dev);
 			} else
 				continue;
 
drivers/gpu/drm/i915/i915_drv.h +0 -0
index 8c93845..6eb0230 100644

drivers/gpu/drm/i915/i915_drv.h struct drm_i915_cmd_table { · line 2590

Quoted 7 lines
drivers/gpu/drm/i915/i915_drv.h +1 -0
@@ -2584,6 +2584,7 @@ struct drm_i915_cmd_table {
 #define INTEL_PCH_LPT_LP_DEVICE_ID_TYPE		0x9c00
 #define INTEL_PCH_SPT_DEVICE_ID_TYPE		0xA100
 #define INTEL_PCH_SPT_LP_DEVICE_ID_TYPE		0x9D00
+#define INTEL_PCH_P2X_DEVICE_ID_TYPE		0x7100
 
 #define INTEL_PCH_TYPE(dev) (__I915__(dev)->pch_type)
 #define HAS_PCH_SPT(dev) (INTEL_PCH_TYPE(dev) == PCH_SPT)

Assuming Kevin is ok with this:

Quoted 7 lines
Quoted 4 lines

Yes, I'm OK with this change. Just one comment. Does it make sense to always have the guess as the fallback, instead of only for P2X? If native side is OK with this, it will remove the need to add more IDs for different hypervisors in the future...

Yeah, at this point I don't think we have mix & match cases to worry about, so we could guess based on the GPU type across the board.

On second thought, let's get this version merged first, then play with assuming a bridge type in a later patch, in case that breaks something.

Jesse

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#7 lore raw
Quoted 94 lines · Jesse Barnes
Quoted 93 lines · Jesse Barnes
Quoted 91 lines · Kevin
Quoted 80 lines

From: Jesse Barnes [mailto:[email protected]]
Sent: Friday, September 25, 2015 12:41 AM

Quoted 6 lines · On 08/28/2015 05:10 AM, [email protected] wrote:

From: Robert Beckett <[email protected]>

Virtualized systems often use a virtual P2X4 south bridge. Detect this in intel_detect_pch and make a best guess as to which PCH we should be using.

Quoted 7 lines

This was seen on vmware esxi hypervisor. When passing the graphics device through to a guest, it can not pass through the PCH. Instead it simulates a P2X4 southbridge.

---
 drivers/gpu/drm/i915/i915_drv.c |   30

++++++++++++++++++++++++++++++

drivers/gpu/drm/i915/i915_drv.c static const struct pci_device_id pciidlist[] = { /* aka

Quoted 8 lines
 drivers/gpu/drm/i915/i915_drv.h |    1 +
 2 files changed, 31 insertions(+)
drivers/gpu/drm/i915/i915_drv.c +0 -0
index ce3bd0c..8e158b3 100644
@@ -443,6 +443,34 @@ static const struct pci_device_id pciidlist[] = {		/* aka

*/

Quoted 53 lines
drivers/gpu/drm/i915/i915_drv.c +30 -0
 MODULE_DEVICE_TABLE(pci, pciidlist);
 
+static enum intel_pch intel_virt_detect_pch(struct drm_device *dev)
+{
+	enum intel_pch ret = PCH_NOP;
+
+	/*
+	 * In a virtualized passthrough environment we can be in a
+	 * setup where the ISA bridge is not able to be passed through.
+	 * In this case, a south bridge can be emulated and we have to
+	 * make an educated guess as to which PCH is really there.
+	 */
+
+	if (IS_GEN5(dev)) {
+		ret = PCH_IBX;
+		DRM_DEBUG_KMS("Assuming Ibex Peak PCH\n");
+	} else if (IS_GEN6(dev) || IS_IVYBRIDGE(dev)) {
+		ret = PCH_CPT;
+		DRM_DEBUG_KMS("Assuming CouarPoint PCH\n");
+	} else if (IS_HASWELL(dev) || IS_BROADWELL(dev)) {
+		ret = PCH_LPT;
+		DRM_DEBUG_KMS("Assuming LynxPoint PCH\n");
+	} else if (IS_SKYLAKE(dev)) {
+		ret = PCH_SPT;
+		DRM_DEBUG_KMS("Assuming SunrisePoint PCH\n");
+	}
+
+	return ret;
+}
+
 void intel_detect_pch(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
@@ -503,6 +531,8 @@ void intel_detect_pch(struct drm_device *dev)
 				dev_priv->pch_type = PCH_SPT;
 				DRM_DEBUG_KMS("Found SunrisePoint LP PCH\n");
 				WARN_ON(!IS_SKYLAKE(dev));
+			} else if (id == INTEL_PCH_P2X_DEVICE_ID_TYPE) {
+				dev_priv->pch_type = intel_virt_detect_pch(dev);
 			} else
 				continue;
 
drivers/gpu/drm/i915/i915_drv.h +1 -0
index 8c93845..6eb0230 100644
@@ -2584,6 +2584,7 @@ struct drm_i915_cmd_table {
 #define INTEL_PCH_LPT_LP_DEVICE_ID_TYPE		0x9c00
 #define INTEL_PCH_SPT_DEVICE_ID_TYPE		0xA100
 #define INTEL_PCH_SPT_LP_DEVICE_ID_TYPE		0x9D00
+#define INTEL_PCH_P2X_DEVICE_ID_TYPE		0x7100
 
Quoted 6 lines

drivers/gpu/drm/i915/i915_drv.h struct drm_i915_cmd_table { · line 2590

Quoted 3 lines
drivers/gpu/drm/i915/i915_drv.h +0 -0
 #define INTEL_PCH_TYPE(dev) (__I915__(dev)->pch_type)
 #define HAS_PCH_SPT(dev) (INTEL_PCH_TYPE(dev) == PCH_SPT)

Assuming Kevin is ok with this:

Yes, I'm OK with this change. Just one comment. Does it make sense to always have the guess as the fallback, instead of only for P2X? If native side is OK with this, it will remove the need to add more IDs for different hypervisors in the future...

Quoted 5 lines
Quoted 2 lines

Yeah, at this point I don't think we have mix & match cases to worry about, so we could guess based on the GPU type across the board.

On second thought, let's get this version merged first, then play with assuming a bridge type in a later patch, in case that breaks something.

Queued for -next, thanks for the patch.
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx