Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Lucas De Marchi <lucas.demarchi@intel.com>,
	intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 3/3] drm/i915/bios: assume vbt is 4-byte aligned into oprom
Date: Fri, 29 Nov 2019 12:00:14 +0200	[thread overview]
Message-ID: <87o8wvkno1.fsf@intel.com> (raw)
In-Reply-To: <20191126225110.8127-4-lucas.demarchi@intel.com>

On Tue, 26 Nov 2019, Lucas De Marchi <lucas.demarchi@intel.com> wrote:
> The unaligned ioread32() will make us read byte by byte looking for the
> vbt. We could just as well have done a ioread8() + a shift and avoid the
> extra confusion on how we are looking for "$VBT".
>
> However when using ACPI it's guaranteed the VBT is 4-byte aligned
> per spec, so we can probably assume it here as well.
>
> v2: do not try to simplify the loop by eliminating the auxiliary counter
> (Jani and Ville)
>
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>

Reviewed-by: Jani Nikula <jani.nikula@intel.com>


> ---
>  drivers/gpu/drm/i915/display/intel_bios.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
> index 56e566945e98..fec6752b1f56 100644
> --- a/drivers/gpu/drm/i915/display/intel_bios.c
> +++ b/drivers/gpu/drm/i915/display/intel_bios.c
> @@ -1909,7 +1909,7 @@ static struct vbt_header *oprom_get_vbt(struct drm_i915_private *dev_priv)
>  		return NULL;
>  
>  	/* Scour memory looking for the VBT signature. */
> -	for (i = 0; i + 4 < size; i++) {
> +	for (i = 0; i + 4 < size; i += 4) {
>  		if (ioread32(oprom + i) != *((const u32 *)"$VBT"))
>  			continue;

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

WARNING: multiple messages have this Message-ID (diff)
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Lucas De Marchi <lucas.demarchi@intel.com>,
	intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH 3/3] drm/i915/bios: assume vbt is 4-byte aligned into oprom
Date: Fri, 29 Nov 2019 12:00:14 +0200	[thread overview]
Message-ID: <87o8wvkno1.fsf@intel.com> (raw)
Message-ID: <20191129100014.5Z5DsvJ6cypu1wPz3_kSm1ZWf-6m8ZhAOt2BvHYxoD4@z> (raw)
In-Reply-To: <20191126225110.8127-4-lucas.demarchi@intel.com>

On Tue, 26 Nov 2019, Lucas De Marchi <lucas.demarchi@intel.com> wrote:
> The unaligned ioread32() will make us read byte by byte looking for the
> vbt. We could just as well have done a ioread8() + a shift and avoid the
> extra confusion on how we are looking for "$VBT".
>
> However when using ACPI it's guaranteed the VBT is 4-byte aligned
> per spec, so we can probably assume it here as well.
>
> v2: do not try to simplify the loop by eliminating the auxiliary counter
> (Jani and Ville)
>
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>

Reviewed-by: Jani Nikula <jani.nikula@intel.com>


> ---
>  drivers/gpu/drm/i915/display/intel_bios.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
> index 56e566945e98..fec6752b1f56 100644
> --- a/drivers/gpu/drm/i915/display/intel_bios.c
> +++ b/drivers/gpu/drm/i915/display/intel_bios.c
> @@ -1909,7 +1909,7 @@ static struct vbt_header *oprom_get_vbt(struct drm_i915_private *dev_priv)
>  		return NULL;
>  
>  	/* Scour memory looking for the VBT signature. */
> -	for (i = 0; i + 4 < size; i++) {
> +	for (i = 0; i + 4 < size; i += 4) {
>  		if (ioread32(oprom + i) != *((const u32 *)"$VBT"))
>  			continue;

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2019-11-29 10:00 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-26 22:51 [PATCH 0/3] bios: dot not discard address space Lucas De Marchi
2019-11-26 22:51 ` [Intel-gfx] " Lucas De Marchi
2019-11-26 22:51 ` [PATCH 1/3] drm/i915/bios: do " Lucas De Marchi
2019-11-26 22:51   ` [Intel-gfx] " Lucas De Marchi
2019-11-26 22:51 ` [PATCH 2/3] drm/i915/bios: fold pci rom map/unmap into copy function Lucas De Marchi
2019-11-26 22:51   ` [Intel-gfx] " Lucas De Marchi
2019-11-26 22:51 ` [PATCH 3/3] drm/i915/bios: assume vbt is 4-byte aligned into oprom Lucas De Marchi
2019-11-26 22:51   ` [Intel-gfx] " Lucas De Marchi
2019-11-29 10:00   ` Jani Nikula [this message]
2019-11-29 10:00     ` Jani Nikula
2019-11-27  0:14 ` ✗ Fi.CI.BAT: failure for bios: dot not discard address space Patchwork
2019-11-27  0:14   ` [Intel-gfx] " Patchwork
2019-11-27  0:53   ` Lucas De Marchi
2019-11-27  0:53     ` [Intel-gfx] " Lucas De Marchi
2019-11-27 11:27 ` ✓ Fi.CI.BAT: success for bios: dot not discard address space (rev2) Patchwork
2019-11-27 11:27   ` [Intel-gfx] " Patchwork
2019-11-27 20:12 ` ✗ Fi.CI.IGT: failure " Patchwork
2019-11-27 20:12   ` [Intel-gfx] " Patchwork
2019-11-29 18:28   ` Lucas De Marchi
2019-11-29 18:28     ` [Intel-gfx] " Lucas De Marchi

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=87o8wvkno1.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=lucas.demarchi@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