Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Zhenyu Wang <zhenyuw@linux.intel.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	Zhi Wang <zhiwang@kernel.rog>,
	Zhenyu Wang <zhenyuw@linux.intel.com>,
	Zhi Wang <zhi.wang.linux@gmail.com>,
	intel-gvt-dev@lists.freedesktop.org
Subject: Re: [RESEND 1/2] drm/i915/gvt: stop using drm_edid_block_valid()
Date: Wed, 14 Aug 2024 11:32:13 +0800	[thread overview]
Message-ID: <ZrwlPUVhp3v59rzS@debian-scheme> (raw)
In-Reply-To: <20240812142849.1588006-1-jani.nikula@intel.com>

[-- Attachment #1: Type: text/plain, Size: 2167 bytes --]

On 2024.08.12 17:28:48 +0300, Jani Nikula wrote:
> We'll want to stop drm_edid_block_valid() usage. KVMGT is the last
> user. Replace with drm_edid_valid(), which unfortunately requires an
> allocated drm_edid. However, on the plus side, this would be required to
> handle the TODO comment about EDID extension block support.
> 
> Acked-by: Zhi Wang <zhiwang@kernel.rog>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>

Looks fine to me. Feel free to merge.

Reviewed-by: Zhenyu Wang <zhenyuw@linux.intel.com>

> ---
> 
> Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
> Cc: Zhi Wang <zhi.wang.linux@gmail.com>
> Cc: intel-gvt-dev@lists.freedesktop.org
> Cc: intel-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> ---
>  drivers/gpu/drm/i915/gvt/kvmgt.c | 18 +++++++++++++-----
>  1 file changed, 13 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c
> index 38830818c120..ca0fb126b02d 100644
> --- a/drivers/gpu/drm/i915/gvt/kvmgt.c
> +++ b/drivers/gpu/drm/i915/gvt/kvmgt.c
> @@ -425,6 +425,18 @@ static const struct intel_vgpu_regops intel_vgpu_regops_opregion = {
>  	.release = intel_vgpu_reg_release_opregion,
>  };
>  
> +static bool edid_valid(const void *edid, size_t size)
> +{
> +	const struct drm_edid *drm_edid;
> +	bool is_valid;
> +
> +	drm_edid = drm_edid_alloc(edid, size);
> +	is_valid = drm_edid_valid(drm_edid);
> +	drm_edid_free(drm_edid);
> +
> +	return is_valid;
> +}
> +
>  static int handle_edid_regs(struct intel_vgpu *vgpu,
>  			struct vfio_edid_region *region, char *buf,
>  			size_t count, u16 offset, bool is_write)
> @@ -443,11 +455,7 @@ static int handle_edid_regs(struct intel_vgpu *vgpu,
>  		switch (offset) {
>  		case offsetof(struct vfio_region_gfx_edid, link_state):
>  			if (data == VFIO_DEVICE_GFX_LINK_STATE_UP) {
> -				if (!drm_edid_block_valid(
> -					(u8 *)region->edid_blob,
> -					0,
> -					true,
> -					NULL)) {
> +				if (!edid_valid(region->edid_blob, EDID_SIZE)) {
>  					gvt_vgpu_err("invalid EDID blob\n");
>  					return -EINVAL;
>  				}
> -- 
> 2.39.2
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

      parent reply	other threads:[~2024-08-14  3:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-12 14:28 [RESEND 1/2] drm/i915/gvt: stop using drm_edid_block_valid() Jani Nikula
2024-08-12 14:28 ` [RESEND 2/2] drm/edid: make drm_edid_block_valid() static Jani Nikula
2024-08-15 12:04   ` Jani Nikula
2024-08-12 16:55 ` ✓ Fi.CI.BAT: success for series starting with [RESEND,1/2] drm/i915/gvt: stop using drm_edid_block_valid() Patchwork
2024-08-13  5:55 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-08-14  3:32 ` Zhenyu Wang [this message]

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=ZrwlPUVhp3v59rzS@debian-scheme \
    --to=zhenyuw@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-gvt-dev@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=zhi.wang.linux@gmail.com \
    --cc=zhiwang@kernel.rog \
    /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