Re: [PATCH v3 3/3] drm/panfrost: Add initial panfrost driver

2019-04-12 Thread Steven Price
On 09/04/2019 21:54, Rob Herring wrote:
> This adds the initial driver for panfrost which supports Arm Mali
> Midgard and Bifrost family of GPUs. Currently, only the T860 and
> T760 Midgard GPUs have been tested.
> 
> v2:
> - Add GPU reset on job hangs (Tomeu)
> - Add RuntimePM and devfreq support (Tomeu)
> - Fix T760 support (Tomeu)
> - Add a TODO file (Rob, Tomeu)
> - Support multiple in fences (Tomeu)
> - Drop support for shared fences (Tomeu)
> - Fill in MMU de-init (Rob)
> - Move register definitions back to single header (Rob)
> - Clean-up hardcoded job submit todos (Rob)
> - Implement feature setup based on features/issues (Rob)
> - Add remaining Midgard DT compatible strings (Rob)
> 
> v3:
> - Add support for reset lines (Neil)
> - Add a MAINTAINERS entry (Rob)
> - Call dma_set_mask_and_coherent (Rob)
> - Do MMU invalidate on map and unmap. Restructure to do a single
>   operation per map/unmap call. (Rob)
> - Add a missing explicit padding to struct drm_panfrost_create_bo (Rob)
> - Fix 0-day error: "panfrost_devfreq.c:151:9-16: ERROR: PTR_ERR applied after 
> initialization to constant on line 150"
> - Drop HW_FEATURE_AARCH64_MMU conditional (Rob)
> - s/DRM_PANFROST_PARAM_GPU_ID/DRM_PANFROST_PARAM_GPU_PROD_ID/ (Rob)
> - Check drm_gem_shmem_prime_import_sg_table() error code (Rob)
> - Re-order power on sequence (Rob)
> - Move panfrost_acquire_object_fences() before scheduling job (Rob)
> - Add NULL checks on array pointers in job clean-up (Rob)
> - Rework devfreq (Tomeu)
> - Fix devfreq init with no regulator (Rob)
> - Various WS and comments clean-up (Rob)
> 
> Cc: Maarten Lankhorst 
> Cc: Maxime Ripard 
> Cc: Sean Paul 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: Lyude Paul 
> Reviewed-by: Alyssa Rosenzweig 
> Reviewed-by: Eric Anholt 
> Signed-off-by: Marty E. Plummer 
> Signed-off-by: Tomeu Vizoso 
> Signed-off-by: Neil Armstrong 
> Signed-off-by: Rob Herring 
> ---

This looks like it has addressed my comments, so:

Reviewed-by: Steven Price 


There's a couple of nits below if you do respin, but these shouldn't
block merging the driver.

[...]
> +static int panfrost_ioctl_submit(struct drm_device *dev, void *data,
> + struct drm_file *file)
> +{
> + struct panfrost_device *pfdev = dev->dev_private;
> + struct drm_panfrost_submit *args = data;
> + struct drm_syncobj *sync_out;
> + struct panfrost_job *job;
> + int ret = 0;
> +
> + job = kcalloc(1, sizeof(*job), GFP_KERNEL);

Why not simply kzalloc()? I think you're going to want a new ioctl
if/when adding support for multiple job submissions in one ioctl.

[...]

> +static int panfrost_probe(struct platform_device *pdev)
> +{
> + struct panfrost_device *pfdev;
> + struct drm_device *ddev;
> + int err;
> +
> + pfdev = devm_kzalloc(>dev, sizeof(*pfdev), GFP_KERNEL);
> + if (!pfdev)
> + return -ENOMEM;
> +
> + pfdev->pdev = pdev;
> + pfdev->dev = >dev;
> +
> + platform_set_drvdata(pdev, pfdev);
> + dma_set_mask_and_coherent(>dev, DMA_BIT_MASK(40));

The hardware reports the correct mask, from kbase:

>   err = dma_set_mask(kbdev->dev,
>   DMA_BIT_MASK(kbdev->gpu_props.mmu.pa_bits));
>   if (err)
>   goto dma_set_mask_failed;
> 
>   err = dma_set_coherent_mask(kbdev->dev,
>   DMA_BIT_MASK(kbdev->gpu_props.mmu.pa_bits));
>   if (err)
>   goto dma_set_mask_failed;

Although I'm not sure if it has ever varied.

Thanks,

Steve
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH v3 3/3] drm/panfrost: Add initial panfrost driver

2019-04-09 Thread Eric Anholt
Eric Anholt  writes:

> [ Unknown signature status ]
> Rob Herring  writes:
>
>> This adds the initial driver for panfrost which supports Arm Mali
>> Midgard and Bifrost family of GPUs. Currently, only the T860 and
>> T760 Midgard GPUs have been tested.
>
>> +static int panfrost_ioctl_get_bo_offset(struct drm_device *dev, void *data,
>> +struct drm_file *file_priv)
>> +{
>> +struct drm_panfrost_get_bo_offset *args = data;
>> +struct drm_gem_object *gem_obj;
>> +struct panfrost_gem_object *bo;
>> +
>
> Missing check for pad == 0.  With that fixed,
>
> Reviewed-by: Eric Anholt 

I suppose you could also drop both flags and pad from uapi, since both
of them must be 0 filled and you could just add a new flags at the end
of the create struct if you ever need one.


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH v3 3/3] drm/panfrost: Add initial panfrost driver

2019-04-09 Thread Eric Anholt
Rob Herring  writes:

> This adds the initial driver for panfrost which supports Arm Mali
> Midgard and Bifrost family of GPUs. Currently, only the T860 and
> T760 Midgard GPUs have been tested.

> +static int panfrost_ioctl_get_bo_offset(struct drm_device *dev, void *data,
> + struct drm_file *file_priv)
> +{
> + struct drm_panfrost_get_bo_offset *args = data;
> + struct drm_gem_object *gem_obj;
> + struct panfrost_gem_object *bo;
> +

Missing check for pad == 0.  With that fixed,

Reviewed-by: Eric Anholt 

> + gem_obj = drm_gem_object_lookup(file_priv, args->handle);
> + if (!gem_obj) {
> + DRM_DEBUG("Failed to look up GEM BO %d\n", args->handle);
> + return -ENOENT;
> + }
> + bo = to_panfrost_bo(gem_obj);
> +
> + args->offset = bo->node.start << PAGE_SHIFT;
> +
> + drm_gem_object_put_unlocked(gem_obj);
> + return 0;
> +}


> +static void panfrost_job_timedout(struct drm_sched_job *sched_job)
> +{
> + struct panfrost_job *job = to_panfrost_job(sched_job);
> + struct panfrost_device *pfdev = job->pfdev;
> + int js = panfrost_job_get_slot(job);
> + int i;
> +
> + /*
> +  * If the GPU managed to complete this jobs fence, the timeout is
> +  * spurious. Bail out.
> +  */
> + if (dma_fence_is_signaled(job->done_fence))
> + return;

Note: The scheduler calls cancel_delayed_work_sync() in
s_job->finish_work, so this is just reducing the race for the job
successfully completing near the timeout but finish_work being in the
workqueue across the timeout boundary.  I dropped it from v3d.


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel