[PATCH] drm/i915/gvt: Remove duplicated MMIO entries

Zhenyu Wang zhenyu.z.wang at intel.com
Wed Jul 19 02:38:12 UTC 2017


On 2017.07.18 10:22:39 +0800, Jian Jun Chen wrote:
> Remove duplicated MMIO entries in the tracked MMIO list. -EEXIST
> is returned if duplicated MMIO entries are found when new MMIO
> entry is added.
> 
> Signed-off-by: Jian Jun Chen <jian.jun.chen at intel.com>
> Cc: Zhi Wang <zhi.a.wang at intel.com>
> Cc: Changbin Du <changbin.du at intel.com>
> Reviewed-by: Yulei Zhang <yulei.zhang at intel.com>
> ---
>  drivers/gpu/drm/i915/gvt/handlers.c | 16 +++++++++-------
>  1 file changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gvt/handlers.c b/drivers/gpu/drm/i915/gvt/handlers.c
> index 17febe830ff6..e7e6de03033e 100644
> --- a/drivers/gpu/drm/i915/gvt/handlers.c
> +++ b/drivers/gpu/drm/i915/gvt/handlers.c
> @@ -113,9 +113,17 @@ static int new_mmio_info(struct intel_gvt *gvt,
>  
>  		info->offset = i;
>  		p = find_mmio_info(gvt, info->offset);
> -		if (p)
> +		if (p) {
>  			gvt_err("dup mmio definition offset %x\n",
>  				info->offset);
> +			kfree(info);
> +
> +			/* We return -EEXIST here to make GVT-g load fail.
> +			 * So duplicated MMIO can be found as soon as
> +			 * possible.
> +			 */
> +			return -EEXIST;
> +		}

If fail as this badly, maybe we should change above gvt_err into WARN(1,...)
for more verbose message?

>  
>  		info->ro_mask = ro_mask;
>  		info->device = device;
> @@ -2581,7 +2589,6 @@ static int init_broadwell_mmio_info(struct intel_gvt *gvt)
>  	MMIO_F(0x24d0, 48, F_CMD_ACCESS, 0, 0, D_BDW_PLUS,
>  		NULL, force_nonpriv_write);
>  
> -	MMIO_D(0x22040, D_BDW_PLUS);
>  	MMIO_D(0x44484, D_BDW_PLUS);
>  	MMIO_D(0x4448c, D_BDW_PLUS);
>  
> @@ -2639,7 +2646,6 @@ static int init_skl_mmio_info(struct intel_gvt *gvt)
>  	MMIO_D(HSW_PWR_WELL_BIOS, D_SKL_PLUS);
>  	MMIO_DH(HSW_PWR_WELL_DRIVER, D_SKL_PLUS, NULL,
>  						skl_power_well_ctl_write);
> -	MMIO_DH(GEN6_PCODE_MAILBOX, D_SKL_PLUS, NULL, mailbox_write);
>  
>  	MMIO_D(0xa210, D_SKL_PLUS);
>  	MMIO_D(GEN9_MEDIA_PG_IDLE_HYSTERESIS, D_SKL_PLUS);
> @@ -2831,7 +2837,6 @@ static int init_skl_mmio_info(struct intel_gvt *gvt)
>  	MMIO_D(0x320f0, D_SKL | D_KBL);
>  
>  	MMIO_DFH(_REG_VCS2_EXCC, D_SKL_PLUS, F_CMD_ACCESS, NULL, NULL);
> -	MMIO_DFH(_REG_VECS_EXCC, D_SKL_PLUS, F_CMD_ACCESS, NULL, NULL);
>  	MMIO_D(0x70034, D_SKL_PLUS);
>  	MMIO_D(0x71034, D_SKL_PLUS);
>  	MMIO_D(0x72034, D_SKL_PLUS);
> @@ -2849,10 +2854,7 @@ static int init_skl_mmio_info(struct intel_gvt *gvt)
>  		NULL, NULL);
>  
>  	MMIO_D(0x4ab8, D_KBL);
> -	MMIO_D(0x940c, D_SKL_PLUS);
>  	MMIO_D(0x2248, D_SKL_PLUS | D_KBL);
> -	MMIO_D(0x4ab0, D_SKL | D_KBL);
> -	MMIO_D(0x20d4, D_SKL | D_KBL);
>  
>  	return 0;
>  }
> -- 
> 2.13.0
> 
> _______________________________________________
> intel-gvt-dev mailing list
> intel-gvt-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gvt-dev

-- 
Open Source Technology Center, Intel ltd.

$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/intel-gvt-dev/attachments/20170719/d705657d/attachment.sig>


More information about the intel-gvt-dev mailing list