From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915/opregion: rvda is relative from opregion base, not absolute
Date: Thu, 31 Jan 2019 10:24:29 +0200 [thread overview]
Message-ID: <20190131082429.GV20097@intel.com> (raw)
In-Reply-To: <20190129133121.32564-1-jani.nikula@intel.com>
On Tue, Jan 29, 2019 at 03:31:21PM +0200, Jani Nikula wrote:
> We've supported the opregion RVDA/RVDS fields for VBT size >= 6 KB since
> commit 04ebaadb9f2d ("drm/i915/opregion: handle VBT sizes bigger than 6
> KB"). That's three years, almost to the date.
>
> The implementation was based on spec only, in anticipation of systems
> with big VBT. Now, the spec has been changed. The RVDA is supposed to be
> relative from the beginning of opregion, not absolute address.
>
> This is obviously a backward/forward incompatible change. I've been told
> there are no systems out there using the field. Fingers crossed. This
> will still be problematic for older kernels, and we can only try to
> backport the fix.
>
> Fix the error path while at it.
>
> Fixes: 04ebaadb9f2d ("drm/i915/opregion: handle VBT sizes bigger than 6 KB")
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Cc: Imre Deak <imre.deak@intel.com>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
> drivers/gpu/drm/i915/intel_opregion.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c
> index 30ae96c5c97c..30324b963e24 100644
> --- a/drivers/gpu/drm/i915/intel_opregion.c
> +++ b/drivers/gpu/drm/i915/intel_opregion.c
> @@ -118,7 +118,7 @@ struct opregion_asle {
> u64 fdss;
> u32 fdsp;
> u32 stat;
> - u64 rvda; /* Physical address of raw vbt data */
> + u64 rvda; /* Address of raw vbt data, relative from opregion */
> u32 rvds; /* Size of raw vbt data */
> u8 rsvd[58];
> } __packed;
> @@ -954,7 +954,13 @@ int intel_opregion_setup(struct drm_i915_private *dev_priv)
>
> if (opregion->header->opregion_ver >= 2 && opregion->asle &&
> opregion->asle->rvda && opregion->asle->rvds) {
> - opregion->rvda = memremap(opregion->asle->rvda,
> + /*
> + * rvda is unsigned, relative from opregion base, and should
> + * never point within opregion.
> + */
> + WARN_ON(opregion->asle->rvda < OPREGION_SIZE);
> +
> + opregion->rvda = memremap(asls + opregion->asle->rvda,
> opregion->asle->rvds,
> MEMREMAP_WB);
> vbt = opregion->rvda;
> @@ -966,6 +972,8 @@ int intel_opregion_setup(struct drm_i915_private *dev_priv)
> goto out;
> } else {
> DRM_DEBUG_KMS("Invalid VBT in ACPI OpRegion (RVDA)\n");
> + memunmap(opregion->rvda);
> + opregion->rvda = NULL;
> }
> }
>
> --
> 2.20.1
--
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2019-01-31 8:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-29 13:31 [PATCH] drm/i915/opregion: rvda is relative from opregion base, not absolute Jani Nikula
2019-01-29 13:54 ` ✗ Fi.CI.BAT: failure for drm/i915/opregion: rvda is relative from opregion base, not absolute (rev2) Patchwork
2019-01-31 8:24 ` Ville Syrjälä [this message]
2019-01-31 9:46 ` ✗ Fi.CI.BAT: failure for drm/i915/opregion: rvda is relative from opregion base, not absolute (rev3) Patchwork
2019-01-31 11:51 ` [PATCH] drm/i915/opregion: rvda is relative from opregion base, not absolute Jani Nikula
-- strict thread matches above, loose matches on Subject: below --
2018-12-13 13:47 Jani Nikula
2018-12-13 14:06 ` Jani Nikula
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=20190131082429.GV20097@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox