[PATCH v4 6/6] drm/i915/dgfx: Get VBT from rvda

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Since OpRegion ver 2.1 MBOX3 RVDA field is Relative address of Raw
VBT data from OpRegion Base.
Populate the opreion->rvda accordingly.
As Intel DGFX cards supports OpRegion version 2.2 or greater,
RVDA as an absolute VBT physical address (Ver 2.0) doesn't applicable
to DGFX cards.

v2:
- Add kzalloc NULL check for opreg_rvda pointer.
v3:
- Added kmemdup() insead of kzalloc() + memcpy() in
  intel_dgfx_alloc_rvda(), and added necessary
  credit to Manasi.
v4:
- Added IS_ERR(rvda)in free_rvda(). [Jani]
- Fix free_{opregion, rvda} abstraction level. [Jani]

Cc: Jani Nikula <jani.nikula@xxxxxxxxx>
Cc: Uma Shankar <uma.shankar@xxxxxxxxx>
Cc: Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx>
Cc: Badal Nilawar <badal.nilawar@xxxxxxxxx>
Signed-off-by: Manasi Navare <manasi.d.navare@xxxxxxxxx>
Signed-off-by: Anshuman Gupta <anshuman.gupta@xxxxxxxxx>
---
 drivers/gpu/drm/i915/display/intel_opregion.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/display/intel_opregion.c b/drivers/gpu/drm/i915/display/intel_opregion.c
index 18770e564044..0548fea0f2bc 100644
--- a/drivers/gpu/drm/i915/display/intel_opregion.c
+++ b/drivers/gpu/drm/i915/display/intel_opregion.c
@@ -1620,11 +1620,28 @@ static void *intel_dgfx_alloc_opregion(struct drm_i915_private *i915)
 
 static void *intel_dgfx_alloc_rvda(struct drm_i915_private *i915)
 {
-	return ERR_PTR(-EOPNOTSUPP);
+	struct intel_opregion *opregion = &i915->opregion;
+	void *opreg_rvda;
+
+	if (!opregion->dgfx_oprom_opreg)
+		return ERR_PTR(-EINVAL);
+
+	opreg_rvda = kmemdup(opregion->dgfx_oprom_opreg + opregion->asle->rvda,
+			     opregion->asle->rvds, GFP_KERNEL);
+
+	/* We got RVDA, OPROM opregion + vbt image not nedded anymore */
+	kfree(opregion->dgfx_oprom_opreg);
+	opregion->dgfx_oprom_opreg = NULL;
+
+	return opreg_rvda ?: ERR_PTR(-ENOMEM);
 }
 
 static void intel_dgfx_free_rvda(struct drm_i915_private *i915, void *rvda)
 {
+	if (IS_ERR(rvda))
+		return;
+
+	kfree(rvda);
 }
 
 static void intel_dgfx_free_opregion(struct drm_i915_private *i915, void *opreg)
-- 
2.26.2




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux