All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anshuman Gupta <anshuman.gupta@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: jani.nikula@intel.com, lucas.demarchi@intel.com, rodrigo.vivi@intel.com
Subject: [Intel-gfx] [PATCH v3 6/6] drm/i915/dgfx: Get VBT from rvda
Date: Sun, 20 Feb 2022 22:07:30 +0530	[thread overview]
Message-ID: <20220220163730.5021-7-anshuman.gupta@intel.com> (raw)
In-Reply-To: <20220220163730.5021-1-anshuman.gupta@intel.com>

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.

Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Uma Shankar <uma.shankar@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Badal Nilawar <badal.nilawar@intel.com>
Signed-off-by: Manasi Navare <manasi.d.navare@intel.com>
Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com>
---
 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 ea201c602755..5de1bc3e6e69 100644
--- a/drivers/gpu/drm/i915/display/intel_opregion.c
+++ b/drivers/gpu/drm/i915/display/intel_opregion.c
@@ -1621,11 +1621,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)
 {
+	struct intel_opregion *opregion = &i915->opregion;
+
+	kfree(opregion->rvda);
+	opregion->rvda = NULL;
 }
 
 static void intel_dgfx_free_opregion(struct drm_i915_private *i915)
-- 
2.26.2


  parent reply	other threads:[~2022-02-20 16:38 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-20 16:37 [Intel-gfx] [PATCH v3 0/6] DGFX OpRegion Anshuman Gupta
2022-02-20 16:37 ` [Intel-gfx] [PATCH v3 1/6] drm/i915/opregion: Add intel_opregion_init() wrapper Anshuman Gupta
2022-02-20 16:37 ` [Intel-gfx] [PATCH v3 2/6] drm/i915/opregion: Abstract opregion function Anshuman Gupta
2022-03-16  9:25   ` Jani Nikula
2022-04-01 13:26     ` Anshuman Gupta
2022-03-16  9:26   ` Jani Nikula
2022-02-20 16:37 ` [Intel-gfx] [PATCH v3 3/6] drm/i915/opregion: Add dgfx opregion func Anshuman Gupta
2022-02-20 16:37 ` [Intel-gfx] [PATCH v3 4/6] drm/i915/opregion: Cond dgfx opregion func registration Anshuman Gupta
2022-03-16  9:30   ` Jani Nikula
2022-02-20 16:37 ` [Intel-gfx] [PATCH v3 5/6] drm/i915/dgfx: OPROM OpRegion Setup Anshuman Gupta
2022-02-20 16:37 ` Anshuman Gupta [this message]
2022-02-20 17:00 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for DGFX OpRegion (rev3) Patchwork
2022-02-20 17:01 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2022-02-20 17:24 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-02-20 18:49 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220220163730.5021-7-anshuman.gupta@intel.com \
    --to=anshuman.gupta@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=lucas.demarchi@intel.com \
    --cc=rodrigo.vivi@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.