lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZMtmw8pzLXy/ndCw@phenom.ffwll.local>
Date:   Thu, 3 Aug 2023 10:35:15 +0200
From:   Daniel Vetter <daniel@...ll.ch>
To:     Rob Clark <robdclark@...il.com>
Cc:     dri-devel@...ts.freedesktop.org, freedreno@...ts.freedesktop.org,
        linux-arm-msm@...r.kernel.org, Rob Clark <robdclark@...omium.org>,
        Abhinav Kumar <quic_abhinavk@...cinc.com>,
        Dmitry Baryshkov <dmitry.baryshkov@...aro.org>,
        Sean Paul <sean@...rly.run>,
        Marijn Suijten <marijn.suijten@...ainline.org>,
        David Airlie <airlied@...il.com>,
        Daniel Vetter <daniel@...ll.ch>,
        Konrad Dybcio <konrad.dybcio@...aro.org>,
        Akhil P Oommen <quic_akhilpo@...cinc.com>,
        open list <linux-kernel@...r.kernel.org>
Subject: Re: [RFC] drm/msm: Disallow relocs on a6xx+

On Wed, Aug 02, 2023 at 03:10:44PM -0700, Rob Clark wrote:
> From: Rob Clark <robdclark@...omium.org>
> 
> Mesa stopped using these pretty early in a6xx bringup.  Take advantage
> of this to disallow some legacy UABI.
> 
> Signed-off-by: Rob Clark <robdclark@...omium.org>
> ---
> So, it was late 2018 when mesa stopped using relocs.  At that point a6xx
> support was still in a pretty early state.  I guess you _could_ use such
> an old version of mesa with a6xx hw.. but you really shouldn't.

Acked-by: Daniel Vetter <daniel.vetter@...ll.ch>

Might be good to cite the mesa commit that removed the a6xx reloc code in
the commit message.
-Sima

> 
>  drivers/gpu/drm/msm/adreno/adreno_gpu.c |  2 ++
>  drivers/gpu/drm/msm/msm_gem_submit.c    | 10 ++++++++++
>  drivers/gpu/drm/msm/msm_gpu.h           |  9 +++++++++
>  3 files changed, 21 insertions(+)
> 
> diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
> index ba35c2a87021..695cce82d914 100644
> --- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c
> +++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
> @@ -1078,6 +1078,8 @@ int adreno_gpu_init(struct drm_device *drm, struct platform_device *pdev,
>  	adreno_gpu->info = config->info;
>  	adreno_gpu->chip_id = config->chip_id;
>  
> +	gpu->allow_relocs = config->info->family < ADRENO_6XX_GEN1;
> +
>  	/* Only handle the core clock when GMU is not in use (or is absent). */
>  	if (adreno_has_gmu_wrapper(adreno_gpu) ||
>  	    adreno_gpu->info->family < ADRENO_6XX_GEN1) {
> diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c
> index 63c96416e183..3b908f9f5493 100644
> --- a/drivers/gpu/drm/msm/msm_gem_submit.c
> +++ b/drivers/gpu/drm/msm/msm_gem_submit.c
> @@ -882,6 +882,16 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
>  		if (submit->valid)
>  			continue;
>  
> +		if (!gpu->allow_relocs) {
> +			if (submit->cmd[i].nr_relocs) {
> +				DRM_ERROR("relocs not allowed\n");
> +				ret = -EINVAL;
> +				goto out;
> +			}
> +
> +			continue;
> +		}
> +
>  		ret = submit_reloc(submit, msm_obj, submit->cmd[i].offset * 4,
>  				submit->cmd[i].nr_relocs, submit->cmd[i].relocs);
>  		if (ret)
> diff --git a/drivers/gpu/drm/msm/msm_gpu.h b/drivers/gpu/drm/msm/msm_gpu.h
> index 7a4fa1b8655b..4252e3839fbc 100644
> --- a/drivers/gpu/drm/msm/msm_gpu.h
> +++ b/drivers/gpu/drm/msm/msm_gpu.h
> @@ -285,6 +285,15 @@ struct msm_gpu {
>  	/* True if the hardware supports expanded apriv (a650 and newer) */
>  	bool hw_apriv;
>  
> +	/**
> +	 * @allow_relocs: allow relocs in SUBMIT ioctl
> +	 *
> +	 * Mesa won't use relocs for driver version 1.4.0 and later.  This
> +	 * switch-over happened early enough in mesa a6xx bringup that we
> +	 * can disallow relocs for a6xx and newer.
> +	 */
> +	bool allow_relocs;
> +
>  	struct thermal_cooling_device *cooling;
>  };
>  
> -- 
> 2.41.0
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ