Re: Linux 5.10-rc4; graphics alignment

2020-11-24 Thread Thomas Zimmermann

Hi

Am 24.11.20 um 17:27 schrieb David Laight:

From: David Laight

Sent: 20 November 2020 15:39

From: Thomas Zimmermann

Sent: 20 November 2020 13:42

...

I did a diff from v5.10-rc4 to drm-tip to look for suspicious changes.
Some candidates are

8e3784dfef8a ("drm/ast: Reload gamma LUT after changing primary
plane's color format")


Ok, that one fixes the screen colours (etc).
So 8e3784dfef8a was good and then HEAD^ was bad.

I might try to bisect the breakage.

The stack splat is entirely different.
I'll try to bisect that on Linus's tree.


The good news is I'm not getting the stack splat on rc5.
I'm not sure I can be bothered to find out when :-)

Applying 8e3784dfef8a to rc5 by hand also fixes the display colours.


Sounds good. I'm counting this as solved then. Thanks for putting all 
this work into it.


Best regards
Thomas



David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, 
UK
Registration No: 1397386 (Wales)



--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


OpenPGP_0x680DC11D530B7A23.asc
Description: application/pgp-keys


OpenPGP_signature
Description: OpenPGP digital signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [Intel-wired-lan] [PATCH 000/141] Fix fall-through warnings for Clang

2020-11-24 Thread James Bottomley
On Tue, 2020-11-24 at 13:32 -0800, Kees Cook wrote:
> On Mon, Nov 23, 2020 at 08:31:30AM -0800, James Bottomley wrote:
> > Really, no ... something which produces no improvement has no value
> > at all ... we really shouldn't be wasting maintainer time with it
> > because it has a cost to merge.  I'm not sure we understand where
> > the balance lies in value vs cost to merge but I am confident in
> > the zero value case.
> 
> What? We can't measure how many future bugs aren't introduced because
> the kernel requires explicit case flow-control statements for all new
> code.

No but we can measure how vulnerable our current coding habits are to
the mistake this warning would potentially prevent.  I don't think it's
wrong to extrapolate that if we had no instances at all of prior coding
problems we likely wouldn't have any in future either making adopting
the changes needed to enable the warning valueless ... that's the zero
value case I was referring to above.

Now, what we have seems to be about 6 cases (at least what's been shown
in this thread) where a missing break would cause potentially user
visible issues.  That means the value of this isn't zero, but it's not
a no-brainer massive win either.  That's why I think asking what we've
invested vs the return isn't a useless exercise.

> We already enable -Wimplicit-fallthrough globally, so that's not the
> discussion. The issue is that Clang is (correctly) even more strict
> than GCC for this, so these are the remaining ones to fix for full
> Clang coverage too.
> 
> People have spent more time debating this already than it would have
> taken to apply the patches. :)

You mean we've already spent 90% of the effort to come this far so we
might as well go the remaining 10% because then at least we get some
return? It's certainly a clinching argument in defence procurement ...

> This is about robustness and language wrangling. It's a big code-
> base, and this is the price of our managing technical debt for
> permanent robustness improvements. (The numbers I ran from Gustavo's
> earlier patches were that about 10% of the places adjusted were
> identified as legitimate bugs being fixed. This final series may be
> lower, but there are still bugs being found from it -- we need to
> finish this and shut the door on it for good.)

I got my six patches by analyzing the lwn.net report of the fixes that
was cited which had 21 of which 50% didn't actually change the emitted
code, and 25% didn't have a user visible effect.

But the broader point I'm making is just because the compiler people
come up with a shiny new warning doesn't necessarily mean the problem
it's detecting is one that causes us actual problems in the code base. 
I'd really be happier if we had a theory about what classes of CVE or
bug we could eliminate before we embrace the next new warning.

James



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


Re: [RFC] dcss: fix attaching to sn56dsi86 bridge

2020-11-24 Thread Laurentiu Palcu
Hi Lukas,

On Tue, Nov 24, 2020 at 06:19:57PM +0100, Lukas F. Hartmann wrote:
> The sn56dsi86 DSI to eDP bridge driver does not support attaching
> without a drm connector.

I think the SN65DSI86 driver is exactly what you should focus on, so
that it works when connector is optional. The ADV7511/ADV7533/ADV7535
driver provides the best example on how it should be done.

Thanks,
laurentiu

> This patch makes the attachment work. Required for the display chain
> in MNT Reform 2.0 (DCSS->NWL DSI->SN56DSI86->EDP).
> 
> Signed-off-by: Lukas F. Hartmann 
> ---
>  drivers/gpu/drm/imx/dcss/dcss-kms.c | 15 ---
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/imx/dcss/dcss-kms.c 
> b/drivers/gpu/drm/imx/dcss/dcss-kms.c
> index 135a62366..4967f828b 100644
> --- a/drivers/gpu/drm/imx/dcss/dcss-kms.c
> +++ b/drivers/gpu/drm/imx/dcss/dcss-kms.c
> @@ -82,6 +82,7 @@ static int dcss_kms_bridge_connector_init(struct 
> dcss_kms_dev *kms)
>   struct drm_crtc *crtc = (struct drm_crtc *)>crtc;
>   struct drm_panel *panel;
>   struct drm_bridge *bridge;
> + struct drm_connector_list_iter iter;
>   int ret;
> 
>   ret = drm_of_find_panel_or_bridge(ddev->dev->of_node, 0, 0,
> @@ -104,19 +105,19 @@ static int dcss_kms_bridge_connector_init(struct 
> dcss_kms_dev *kms)
>   return ret;
>   }
> 
> - ret = drm_bridge_attach(encoder, bridge, NULL,
> - DRM_BRIDGE_ATTACH_NO_CONNECTOR);
> + ret = drm_bridge_attach(encoder, bridge, NULL, 0);
>   if (ret < 0) {
>   dev_err(ddev->dev, "Unable to attach bridge %pOF\n",
>   bridge->of_node);
>   return ret;
>   }
> 
> - kms->connector = drm_bridge_connector_init(ddev, encoder);
> - if (IS_ERR(kms->connector)) {
> - dev_err(ddev->dev, "Unable to create bridge connector.\n");
> - return PTR_ERR(kms->connector);
> - }
> + /*
> +  * This hack to look up the connector is copied from mxsfb.
> +  */
> + drm_connector_list_iter_begin(ddev, );
> + kms->connector = drm_connector_list_iter_next();
> + drm_connector_list_iter_end();
> 
>   drm_connector_attach_encoder(kms->connector, encoder);
> 
> --
> 2.28.0
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 3/6] drm/scheduler: Job timeout handler returns status

2020-11-24 Thread kernel test robot
Hi Luben,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.10-rc5 next-20201124]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:
https://github.com/0day-ci/linux/commits/Luben-Tuikov/Allow-to-extend-the-timeout-without-jobs-disappearing/20201125-111945
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
127c501a03d5db8b833e953728d3bcf53c8832a9
config: nds32-randconfig-s032-20201125 (attached as .config)
compiler: nds32le-linux-gcc (GCC) 9.3.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.3-151-g540c2c4b-dirty
# 
https://github.com/0day-ci/linux/commit/14b618148200370c3b43498550534c17d50218fc
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review 
Luben-Tuikov/Allow-to-extend-the-timeout-without-jobs-disappearing/20201125-111945
git checkout 14b618148200370c3b43498550534c17d50218fc
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 
CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=nds32 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

All errors (new ones prefixed by >>):

>> drivers/gpu/drm/etnaviv/etnaviv_sched.c:140:18: error: initialization of 
>> 'int (*)(struct drm_sched_job *)' from incompatible pointer type 'void 
>> (*)(struct drm_sched_job *)' [-Werror=incompatible-pointer-types]
 140 |  .timedout_job = etnaviv_sched_timedout_job,
 |  ^~
   drivers/gpu/drm/etnaviv/etnaviv_sched.c:140:18: note: (near initialization 
for 'etnaviv_sched_ops.timedout_job')
   cc1: some warnings being treated as errors
--
   drivers/gpu/drm/lima/lima_sched.c: In function 'lima_sched_run_job':
   drivers/gpu/drm/lima/lima_sched.c:226:20: warning: variable 'ret' set but 
not used [-Wunused-but-set-variable]
 226 |  struct dma_fence *ret;
 |^~~
   drivers/gpu/drm/lima/lima_sched.c: At top level:
>> drivers/gpu/drm/lima/lima_sched.c:472:18: error: initialization of 'int 
>> (*)(struct drm_sched_job *)' from incompatible pointer type 'void (*)(struct 
>> drm_sched_job *)' [-Werror=incompatible-pointer-types]
 472 |  .timedout_job = lima_sched_timedout_job,
 |  ^~~
   drivers/gpu/drm/lima/lima_sched.c:472:18: note: (near initialization for 
'lima_sched_ops.timedout_job')
   cc1: some warnings being treated as errors

vim +140 drivers/gpu/drm/etnaviv/etnaviv_sched.c

e93b6deeb45a78 Lucas Stach 2017-12-04  136  
e93b6deeb45a78 Lucas Stach 2017-12-04  137  static const struct 
drm_sched_backend_ops etnaviv_sched_ops = {
e93b6deeb45a78 Lucas Stach 2017-12-04  138  .dependency = 
etnaviv_sched_dependency,
e93b6deeb45a78 Lucas Stach 2017-12-04  139  .run_job = 
etnaviv_sched_run_job,
e93b6deeb45a78 Lucas Stach 2017-12-04 @140  .timedout_job = 
etnaviv_sched_timedout_job,
e93b6deeb45a78 Lucas Stach 2017-12-04  141  .free_job = 
etnaviv_sched_free_job,
e93b6deeb45a78 Lucas Stach 2017-12-04  142  };
e93b6deeb45a78 Lucas Stach 2017-12-04  143  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org


.config.gz
Description: application/gzip
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 3/6] drm/scheduler: Job timeout handler returns status

2020-11-24 Thread Luben Tuikov
The job timeout handler now returns status
indicating back to the DRM layer whether the job
was successfully cancelled or whether more time
should be given to the job to complete.

Signed-off-by: Luben Tuikov 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_job.c |  6 --
 include/drm/gpu_scheduler.h | 13 ++---
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
index ff48101bab55..81b73790ecc6 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
@@ -28,7 +28,7 @@
 #include "amdgpu.h"
 #include "amdgpu_trace.h"
 
-static void amdgpu_job_timedout(struct drm_sched_job *s_job)
+static int amdgpu_job_timedout(struct drm_sched_job *s_job)
 {
struct amdgpu_ring *ring = to_amdgpu_ring(s_job->sched);
struct amdgpu_job *job = to_amdgpu_job(s_job);
@@ -41,7 +41,7 @@ static void amdgpu_job_timedout(struct drm_sched_job *s_job)
amdgpu_ring_soft_recovery(ring, job->vmid, s_job->s_fence->parent)) 
{
DRM_ERROR("ring %s timeout, but soft recovered\n",
  s_job->sched->name);
-   return;
+   return 0;
}
 
amdgpu_vm_get_task_info(ring->adev, job->pasid, );
@@ -53,10 +53,12 @@ static void amdgpu_job_timedout(struct drm_sched_job *s_job)
 
if (amdgpu_device_should_recover_gpu(ring->adev)) {
amdgpu_device_gpu_recover(ring->adev, job);
+   return 0;
} else {
drm_sched_suspend_timeout(>sched);
if (amdgpu_sriov_vf(adev))
adev->virt.tdr_debug = true;
+   return 1;
}
 }
 
diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h
index 2e0c368e19f6..61f7121e1c19 100644
--- a/include/drm/gpu_scheduler.h
+++ b/include/drm/gpu_scheduler.h
@@ -230,10 +230,17 @@ struct drm_sched_backend_ops {
struct dma_fence *(*run_job)(struct drm_sched_job *sched_job);
 
/**
- * @timedout_job: Called when a job has taken too long to execute,
- * to trigger GPU recovery.
+* @timedout_job: Called when a job has taken too long to execute,
+* to trigger GPU recovery.
+*
+* Return 0, if the job has been aborted successfully and will
+* never be heard of from the device. Return non-zero if the
+* job wasn't able to be aborted, i.e. if more time should be
+* given to this job. The result is not "bool" as this
+* function is not a predicate, although its result may seem
+* as one.
 */
-   void (*timedout_job)(struct drm_sched_job *sched_job);
+   int (*timedout_job)(struct drm_sched_job *sched_job);
 
/**
  * @free_job: Called once the job's finished fence has been signaled
-- 
2.29.2.154.g7f7ebe054a

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


[PATCH 5/6] drm/amdgpu: Don't hardcode thread name length

2020-11-24 Thread Luben Tuikov
Introduce a macro DRM_THREAD_NAME_LEN
and use that to define ring name size,
instead of hardcoding it to 16.

Signed-off-by: Luben Tuikov 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 2 +-
 include/drm/gpu_scheduler.h  | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
index 7112137689db..bbd46c6dec65 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
@@ -230,7 +230,7 @@ struct amdgpu_ring {
unsignedwptr_offs;
unsignedfence_offs;
uint64_tcurrent_ctx;
-   charname[16];
+   charname[DRM_THREAD_NAME_LEN];
u32 trail_seq;
unsignedtrail_fence_offs;
u64 trail_fence_gpu_addr;
diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h
index 61f7121e1c19..3a5686c3b5e9 100644
--- a/include/drm/gpu_scheduler.h
+++ b/include/drm/gpu_scheduler.h
@@ -30,6 +30,8 @@
 
 #define MAX_WAIT_SCHED_ENTITY_Q_EMPTY msecs_to_jiffies(1000)
 
+#define DRM_THREAD_NAME_LEN TASK_COMM_LEN
+
 struct drm_gpu_scheduler;
 struct drm_sched_rq;
 
-- 
2.29.2.154.g7f7ebe054a

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


[PATCH 6/6] drm/sched: Make use of a "done" thread

2020-11-24 Thread Luben Tuikov
Add a "done" list to which all completed jobs are added
to be freed. The drm_sched_job_done() callback is the
producer of jobs to this list.

Add a "done" thread which consumes from the done list
and frees up jobs. Now, the main scheduler thread only
pushes jobs to the GPU and the "done" thread frees them
up, on the way out of the GPU when they've completed
execution.

Make use of the status returned by the GPU driver
timeout handler to decide whether to leave the job in
the pending list, or to send it off to the done list.
If a job is done, it is added to the done list and the
done thread woken up. If a job needs more time, it is
left on the pending list and the timeout timer
restarted.

Eliminate the polling mechanism of picking out done
jobs from the pending list, i.e. eliminate
drm_sched_get_cleanup_job(). Now the main scheduler
thread only pushes jobs down to the GPU.

Various other optimizations to the GPU scheduler
and job recovery are possible with this format.

Signed-off-by: Luben Tuikov 
---
 drivers/gpu/drm/scheduler/sched_main.c | 173 +
 include/drm/gpu_scheduler.h|  14 ++
 2 files changed, 101 insertions(+), 86 deletions(-)

diff --git a/drivers/gpu/drm/scheduler/sched_main.c 
b/drivers/gpu/drm/scheduler/sched_main.c
index 3eb7618a627d..289ae68cd97f 100644
--- a/drivers/gpu/drm/scheduler/sched_main.c
+++ b/drivers/gpu/drm/scheduler/sched_main.c
@@ -164,7 +164,8 @@ drm_sched_rq_select_entity(struct drm_sched_rq *rq)
  * drm_sched_job_done - complete a job
  * @s_job: pointer to the job which is done
  *
- * Finish the job's fence and wake up the worker thread.
+ * Finish the job's fence, move it to the done list,
+ * and wake up the done thread.
  */
 static void drm_sched_job_done(struct drm_sched_job *s_job)
 {
@@ -179,7 +180,12 @@ static void drm_sched_job_done(struct drm_sched_job *s_job)
dma_fence_get(_fence->finished);
drm_sched_fence_finished(s_fence);
dma_fence_put(_fence->finished);
-   wake_up_interruptible(>wake_up_worker);
+
+   spin_lock(>job_list_lock);
+   list_move(_job->list, >done_list);
+   spin_unlock(>job_list_lock);
+
+   wake_up_interruptible(>done_wait_q);
 }
 
 /**
@@ -221,11 +227,10 @@ bool drm_sched_dependency_optimized(struct dma_fence* 
fence,
 EXPORT_SYMBOL(drm_sched_dependency_optimized);
 
 /**
- * drm_sched_start_timeout - start timeout for reset worker
- *
- * @sched: scheduler instance to start the worker for
+ * drm_sched_start_timeout - start a timeout timer
+ * @sched: scheduler instance whose job we're timing
  *
- * Start the timeout for the given scheduler.
+ * Start a timeout timer for the given scheduler.
  */
 static void drm_sched_start_timeout(struct drm_gpu_scheduler *sched)
 {
@@ -305,8 +310,8 @@ static void drm_sched_job_begin(struct drm_sched_job *s_job)
 
spin_lock(>job_list_lock);
list_add_tail(_job->list, >pending_list);
-   drm_sched_start_timeout(sched);
spin_unlock(>job_list_lock);
+   drm_sched_start_timeout(sched);
 }
 
 static void drm_sched_job_timedout(struct work_struct *work)
@@ -316,37 +321,30 @@ static void drm_sched_job_timedout(struct work_struct 
*work)
 
sched = container_of(work, struct drm_gpu_scheduler, work_tdr.work);
 
-   /* Protects against concurrent deletion in drm_sched_get_cleanup_job */
spin_lock(>job_list_lock);
job = list_first_entry_or_null(>pending_list,
   struct drm_sched_job, list);
+   spin_unlock(>job_list_lock);
 
if (job) {
-   /*
-* Remove the bad job so it cannot be freed by concurrent
-* drm_sched_cleanup_jobs. It will be reinserted back after 
sched->thread
-* is parked at which point it's safe.
-*/
-   list_del_init(>list);
-   spin_unlock(>job_list_lock);
+   int res;
 
-   job->sched->ops->timedout_job(job);
+   job->job_status |= DRM_JOB_STATUS_TIMEOUT;
+   res = job->sched->ops->timedout_job(job);
+   if (res == 0) {
+   /* The job is out of the device.
+*/
+   spin_lock(>job_list_lock);
+   list_move(>list, >done_list);
+   spin_unlock(>job_list_lock);
 
-   /*
-* Guilty job did complete and hence needs to be manually 
removed
-* See drm_sched_stop doc.
-*/
-   if (sched->free_guilty) {
-   job->sched->ops->free_job(job);
-   sched->free_guilty = false;
+   wake_up_interruptible(>done_wait_q);
+   } else {
+   /* The job needs more time.
+*/
+   drm_sched_start_timeout(sched);
}
-   } else {
-   

[PATCH 4/6] drm/scheduler: Essentialize the job done callback

2020-11-24 Thread Luben Tuikov
The job done callback is called from various
places, in two ways: in job done role, and
as a fence callback role.

Essentialize the callback to an atom
function to just complete the job,
and into a second function as a prototype
of fence callback which calls to complete
the job.

This is used in latter patches by the completion
code.

Signed-off-by: Luben Tuikov 
---
 drivers/gpu/drm/scheduler/sched_main.c | 73 ++
 1 file changed, 40 insertions(+), 33 deletions(-)

diff --git a/drivers/gpu/drm/scheduler/sched_main.c 
b/drivers/gpu/drm/scheduler/sched_main.c
index b694df12aaba..3eb7618a627d 100644
--- a/drivers/gpu/drm/scheduler/sched_main.c
+++ b/drivers/gpu/drm/scheduler/sched_main.c
@@ -60,8 +60,6 @@
 #define to_drm_sched_job(sched_job)\
container_of((sched_job), struct drm_sched_job, queue_node)
 
-static void drm_sched_process_job(struct dma_fence *f, struct dma_fence_cb 
*cb);
-
 /**
  * drm_sched_rq_init - initialize a given run queue struct
  *
@@ -162,6 +160,40 @@ drm_sched_rq_select_entity(struct drm_sched_rq *rq)
return NULL;
 }
 
+/**
+ * drm_sched_job_done - complete a job
+ * @s_job: pointer to the job which is done
+ *
+ * Finish the job's fence and wake up the worker thread.
+ */
+static void drm_sched_job_done(struct drm_sched_job *s_job)
+{
+   struct drm_sched_fence *s_fence = s_job->s_fence;
+   struct drm_gpu_scheduler *sched = s_fence->sched;
+
+   atomic_dec(>hw_rq_count);
+   atomic_dec(>score);
+
+   trace_drm_sched_process_job(s_fence);
+
+   dma_fence_get(_fence->finished);
+   drm_sched_fence_finished(s_fence);
+   dma_fence_put(_fence->finished);
+   wake_up_interruptible(>wake_up_worker);
+}
+
+/**
+ * drm_sched_job_done_cb - the callback for a done job
+ * @f: fence
+ * @cb: fence callbacks
+ */
+static void drm_sched_job_done_cb(struct dma_fence *f, struct dma_fence_cb *cb)
+{
+   struct drm_sched_job *s_job = container_of(cb, struct drm_sched_job, 
cb);
+
+   drm_sched_job_done(s_job);
+}
+
 /**
  * drm_sched_dependency_optimized
  *
@@ -473,14 +505,14 @@ void drm_sched_start(struct drm_gpu_scheduler *sched, 
bool full_recovery)
 
if (fence) {
r = dma_fence_add_callback(fence, _job->cb,
-  drm_sched_process_job);
+  drm_sched_job_done_cb);
if (r == -ENOENT)
-   drm_sched_process_job(fence, _job->cb);
+   drm_sched_job_done(s_job);
else if (r)
DRM_ERROR("fence add callback failed (%d)\n",
  r);
} else
-   drm_sched_process_job(NULL, _job->cb);
+   drm_sched_job_done(s_job);
}
 
if (full_recovery) {
@@ -635,31 +667,6 @@ drm_sched_select_entity(struct drm_gpu_scheduler *sched)
return entity;
 }
 
-/**
- * drm_sched_process_job - process a job
- *
- * @f: fence
- * @cb: fence callbacks
- *
- * Called after job has finished execution.
- */
-static void drm_sched_process_job(struct dma_fence *f, struct dma_fence_cb *cb)
-{
-   struct drm_sched_job *s_job = container_of(cb, struct drm_sched_job, 
cb);
-   struct drm_sched_fence *s_fence = s_job->s_fence;
-   struct drm_gpu_scheduler *sched = s_fence->sched;
-
-   atomic_dec(>hw_rq_count);
-   atomic_dec(>score);
-
-   trace_drm_sched_process_job(s_fence);
-
-   dma_fence_get(_fence->finished);
-   drm_sched_fence_finished(s_fence);
-   dma_fence_put(_fence->finished);
-   wake_up_interruptible(>wake_up_worker);
-}
-
 /**
  * drm_sched_get_cleanup_job - fetch the next finished job to be destroyed
  *
@@ -809,9 +816,9 @@ static int drm_sched_main(void *param)
if (!IS_ERR_OR_NULL(fence)) {
s_fence->parent = dma_fence_get(fence);
r = dma_fence_add_callback(fence, _job->cb,
-  drm_sched_process_job);
+  drm_sched_job_done_cb);
if (r == -ENOENT)
-   drm_sched_process_job(fence, _job->cb);
+   drm_sched_job_done(sched_job);
else if (r)
DRM_ERROR("fence add callback failed (%d)\n",
  r);
@@ -820,7 +827,7 @@ static int drm_sched_main(void *param)
if (IS_ERR(fence))
dma_fence_set_error(_fence->finished, 
PTR_ERR(fence));
 
-   drm_sched_process_job(NULL, _job->cb);
+   drm_sched_job_done(sched_job);
}
 
wake_up(>job_scheduled);
-- 
2.29.2.154.g7f7ebe054a


[PATCH 2/6] gpu/drm: ring_mirror_list --> pending_list

2020-11-24 Thread Luben Tuikov
Rename "ring_mirror_list" to "pending_list",
to describe what something is, not what it does,
how it's used, or how the hardware implements it.

This also abstracts the actual hardware
implementation, i.e. how the low-level driver
communicates with the device it drives, ring, CAM,
etc., shouldn't be exposed to DRM.

The pending_list keeps jobs submitted, which are
out of our control. Usually this means they are
pending execution status in hardware, but the
latter definition is a more general (inclusive)
definition.

Signed-off-by: Luben Tuikov 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c |  4 +--
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c  |  4 +--
 drivers/gpu/drm/amd/amdgpu/amdgpu_job.c |  2 +-
 drivers/gpu/drm/scheduler/sched_main.c  | 34 ++---
 include/drm/gpu_scheduler.h | 10 +++---
 5 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
index 8358cae0b5a4..db77a5bdfa45 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
@@ -1427,7 +1427,7 @@ static void amdgpu_ib_preempt_job_recovery(struct 
drm_gpu_scheduler *sched)
struct dma_fence *fence;
 
spin_lock(>job_list_lock);
-   list_for_each_entry(s_job, >ring_mirror_list, list) {
+   list_for_each_entry(s_job, >pending_list, list) {
fence = sched->ops->run_job(s_job);
dma_fence_put(fence);
}
@@ -1459,7 +1459,7 @@ static void amdgpu_ib_preempt_mark_partial_job(struct 
amdgpu_ring *ring)
 
 no_preempt:
spin_lock(>job_list_lock);
-   list_for_each_entry_safe(s_job, tmp, >ring_mirror_list, list) {
+   list_for_each_entry_safe(s_job, tmp, >pending_list, list) {
if (dma_fence_is_signaled(_job->s_fence->finished)) {
/* remove job from ring_mirror_list */
list_del_init(_job->list);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 4df6de81cd41..fbae600aa5f9 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -4127,8 +4127,8 @@ bool amdgpu_device_has_job_running(struct amdgpu_device 
*adev)
continue;
 
spin_lock(>sched.job_list_lock);
-   job = list_first_entry_or_null(>sched.ring_mirror_list,
-   struct drm_sched_job, list);
+   job = list_first_entry_or_null(>sched.pending_list,
+  struct drm_sched_job, list);
spin_unlock(>sched.job_list_lock);
if (job)
return true;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
index aca52a46b93d..ff48101bab55 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
@@ -271,7 +271,7 @@ void amdgpu_job_stop_all_jobs_on_sched(struct 
drm_gpu_scheduler *sched)
}
 
/* Signal all jobs already scheduled to HW */
-   list_for_each_entry(s_job, >ring_mirror_list, list) {
+   list_for_each_entry(s_job, >pending_list, list) {
struct drm_sched_fence *s_fence = s_job->s_fence;
 
dma_fence_set_error(_fence->finished, -EHWPOISON);
diff --git a/drivers/gpu/drm/scheduler/sched_main.c 
b/drivers/gpu/drm/scheduler/sched_main.c
index c52eba407ebd..b694df12aaba 100644
--- a/drivers/gpu/drm/scheduler/sched_main.c
+++ b/drivers/gpu/drm/scheduler/sched_main.c
@@ -198,7 +198,7 @@ EXPORT_SYMBOL(drm_sched_dependency_optimized);
 static void drm_sched_start_timeout(struct drm_gpu_scheduler *sched)
 {
if (sched->timeout != MAX_SCHEDULE_TIMEOUT &&
-   !list_empty(>ring_mirror_list))
+   !list_empty(>pending_list))
schedule_delayed_work(>work_tdr, sched->timeout);
 }
 
@@ -258,7 +258,7 @@ void drm_sched_resume_timeout(struct drm_gpu_scheduler 
*sched,
 {
spin_lock(>job_list_lock);
 
-   if (list_empty(>ring_mirror_list))
+   if (list_empty(>pending_list))
cancel_delayed_work(>work_tdr);
else
mod_delayed_work(system_wq, >work_tdr, remaining);
@@ -272,7 +272,7 @@ static void drm_sched_job_begin(struct drm_sched_job *s_job)
struct drm_gpu_scheduler *sched = s_job->sched;
 
spin_lock(>job_list_lock);
-   list_add_tail(_job->list, >ring_mirror_list);
+   list_add_tail(_job->list, >pending_list);
drm_sched_start_timeout(sched);
spin_unlock(>job_list_lock);
 }
@@ -286,7 +286,7 @@ static void drm_sched_job_timedout(struct work_struct *work)
 
/* Protects against concurrent deletion in drm_sched_get_cleanup_job */
spin_lock(>job_list_lock);
-   job = list_first_entry_or_null(>ring_mirror_list,
+   job = 

[PATCH 0/6] Allow to extend the timeout without jobs disappearing

2020-11-24 Thread Luben Tuikov
Hi guys,

This series of patches implements a pending list for
jobs which are in the hardware, and a done list for
tasks which are done and need to be freed.

It implements a second thread, dedicated to freeing
tasks from the done list. The main scheduler thread no
longer frees (cleans up) done tasks by polling the head
of the pending list (drm_sched_get_cleanup_task() is
now gone)--it only pushes tasks down to the GPU. As
tasks complete and call their DRM callback, their
fences are signalled and tasks are queued to the done
list and the done thread woken up to free them. This
can take place concurrently with the main scheduler
thread pushing tasks down to the GPU.

When a task times out, the timeout function prototype
now is made to return a value back to DRM. The reason
for this is that the GPU driver has intimate knowledge
of the hardware and can pass back information to DRM on
what to do. Whether to attempt to abort the task (by
say calling a driver abort function, etc., as the
implementation dictates), or whether the task needs
more time. Note that the task is not moved away from
the pending list, unless it is no longer in the GPU.
(The pending list holds tasks which are pending from
DRM's point of view, i.e. the GPU has control over
them--that could be things like DMA is active, CU's are
active, for the task, etc.)

The idea really is that what DRM wants to know is
whether the task is in the GPU or not. So now
drm_sched_backend_ops::timedout_job() returns
0 of the task is no longer with the GPU, or 1
if the task needs more time.

Tested up to patch 5. Running with patch 6 seems to
make X/GDM just sleep, and I'm looking into this now.

This series applies to drm-misc-next.

Luben Tuikov (6):
  drm/scheduler: "node" --> "list"
  gpu/drm: ring_mirror_list --> pending_list
  drm/scheduler: Job timeout handler returns status
  drm/scheduler: Essentialize the job done callback
  drm/amdgpu: Don't hardcode thread name length
  drm/sched: Make use of a "done" thread

 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c |   6 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c  |   4 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_job.c |   8 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h|   2 +-
 drivers/gpu/drm/scheduler/sched_main.c  | 275 ++--
 include/drm/gpu_scheduler.h |  43 ++-
 6 files changed, 186 insertions(+), 152 deletions(-)

-- 
2.29.2.154.g7f7ebe054a

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


[PATCH 1/6] drm/scheduler: "node" --> "list"

2020-11-24 Thread Luben Tuikov
Rename "node" to "list" in struct drm_sched_job,
in order to make it consistent with what we see
being used throughout gpu_scheduler.h, for
instance in struct drm_sched_entity, as well as
the rest of DRM and the kernel.

Signed-off-by: Luben Tuikov 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c |  6 +++---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_job.c |  2 +-
 drivers/gpu/drm/scheduler/sched_main.c  | 23 +++--
 include/drm/gpu_scheduler.h |  4 ++--
 5 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
index 5c1f3725c741..8358cae0b5a4 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
@@ -1427,7 +1427,7 @@ static void amdgpu_ib_preempt_job_recovery(struct 
drm_gpu_scheduler *sched)
struct dma_fence *fence;
 
spin_lock(>job_list_lock);
-   list_for_each_entry(s_job, >ring_mirror_list, node) {
+   list_for_each_entry(s_job, >ring_mirror_list, list) {
fence = sched->ops->run_job(s_job);
dma_fence_put(fence);
}
@@ -1459,10 +1459,10 @@ static void amdgpu_ib_preempt_mark_partial_job(struct 
amdgpu_ring *ring)
 
 no_preempt:
spin_lock(>job_list_lock);
-   list_for_each_entry_safe(s_job, tmp, >ring_mirror_list, node) {
+   list_for_each_entry_safe(s_job, tmp, >ring_mirror_list, list) {
if (dma_fence_is_signaled(_job->s_fence->finished)) {
/* remove job from ring_mirror_list */
-   list_del_init(_job->node);
+   list_del_init(_job->list);
sched->ops->free_job(s_job);
continue;
}
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 7560b05e4ac1..4df6de81cd41 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -4128,7 +4128,7 @@ bool amdgpu_device_has_job_running(struct amdgpu_device 
*adev)
 
spin_lock(>sched.job_list_lock);
job = list_first_entry_or_null(>sched.ring_mirror_list,
-   struct drm_sched_job, node);
+   struct drm_sched_job, list);
spin_unlock(>sched.job_list_lock);
if (job)
return true;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
index dcfe8a3b03ff..aca52a46b93d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
@@ -271,7 +271,7 @@ void amdgpu_job_stop_all_jobs_on_sched(struct 
drm_gpu_scheduler *sched)
}
 
/* Signal all jobs already scheduled to HW */
-   list_for_each_entry(s_job, >ring_mirror_list, node) {
+   list_for_each_entry(s_job, >ring_mirror_list, list) {
struct drm_sched_fence *s_fence = s_job->s_fence;
 
dma_fence_set_error(_fence->finished, -EHWPOISON);
diff --git a/drivers/gpu/drm/scheduler/sched_main.c 
b/drivers/gpu/drm/scheduler/sched_main.c
index c6332d75025e..c52eba407ebd 100644
--- a/drivers/gpu/drm/scheduler/sched_main.c
+++ b/drivers/gpu/drm/scheduler/sched_main.c
@@ -272,7 +272,7 @@ static void drm_sched_job_begin(struct drm_sched_job *s_job)
struct drm_gpu_scheduler *sched = s_job->sched;
 
spin_lock(>job_list_lock);
-   list_add_tail(_job->node, >ring_mirror_list);
+   list_add_tail(_job->list, >ring_mirror_list);
drm_sched_start_timeout(sched);
spin_unlock(>job_list_lock);
 }
@@ -287,7 +287,7 @@ static void drm_sched_job_timedout(struct work_struct *work)
/* Protects against concurrent deletion in drm_sched_get_cleanup_job */
spin_lock(>job_list_lock);
job = list_first_entry_or_null(>ring_mirror_list,
-  struct drm_sched_job, node);
+  struct drm_sched_job, list);
 
if (job) {
/*
@@ -295,7 +295,7 @@ static void drm_sched_job_timedout(struct work_struct *work)
 * drm_sched_cleanup_jobs. It will be reinserted back after 
sched->thread
 * is parked at which point it's safe.
 */
-   list_del_init(>node);
+   list_del_init(>list);
spin_unlock(>job_list_lock);
 
job->sched->ops->timedout_job(job);
@@ -392,7 +392,7 @@ void drm_sched_stop(struct drm_gpu_scheduler *sched, struct 
drm_sched_job *bad)
 * Add at the head of the queue to reflect it was the earliest
 * job extracted.
 */
-   list_add(>node, >ring_mirror_list);
+   list_add(>list, >ring_mirror_list);
 
/*
 * 

Re: [PATCH v4 20/21] drm/tegra: Implement job submission part of new UAPI

2020-11-24 Thread kernel test robot
Hi Mikko,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on tegra/for-next]
[also build test WARNING on linus/master v5.10-rc5]
[cannot apply to tegra-drm/drm/tegra/for-next next-20201124]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:
https://github.com/0day-ci/linux/commits/Mikko-Perttunen/Host1x-TegraDRM-UAPI/20201120-192927
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux.git for-next
config: arm-randconfig-r036-20201124 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 
df9ae5992889560a8f3c6760b54d5051b47c7bf5)
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# install arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# 
https://github.com/0day-ci/linux/commit/d5a3a653d37f5c7e8dfda77be51cc68ed7192b70
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review 
Mikko-Perttunen/Host1x-TegraDRM-UAPI/20201120-192927
git checkout d5a3a653d37f5c7e8dfda77be51cc68ed7192b70
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

All warnings (new ones prefixed by >>):

>> drivers/gpu/drm/tegra/uapi/submit.c:114:18: warning: shift count >= width of 
>> type [-Wshift-count-overflow]
   written_ptr |= BIT(39);
  ^~~
   include/vdso/bits.h:7:26: note: expanded from macro 'BIT'
   #define BIT(nr) (UL(1) << (nr))
  ^  
   1 warning generated.

vim +114 drivers/gpu/drm/tegra/uapi/submit.c

   104  
   105  static int submit_write_reloc(struct gather_bo *bo,
   106struct drm_tegra_submit_buf *buf,
   107struct tegra_drm_mapping *mapping)
   108  {
   109  /* TODO check that target_offset is within bounds */
   110  dma_addr_t iova = mapping->iova + buf->reloc.target_offset;
   111  u32 written_ptr = (u32)(iova >> buf->reloc.shift);
   112  
   113  if (buf->flags & DRM_TEGRA_SUBMIT_BUF_RELOC_BLOCKLINEAR)
 > 114  written_ptr |= BIT(39);
   115  
   116  if (buf->reloc.gather_offset_words >= bo->gather_data_words)
   117  return -EINVAL;
   118  
   119  buf->reloc.gather_offset_words = array_index_nospec(
   120  buf->reloc.gather_offset_words, bo->gather_data_words);
   121  
   122  bo->gather_data[buf->reloc.gather_offset_words] = written_ptr;
   123  
   124  return 0;
   125  }
   126  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org


.config.gz
Description: application/gzip
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v3 10/12] drm/amdgpu: Avoid sysfs dirs removal post device unplug

2020-11-24 Thread Andrey Grodzovsky



On 11/24/20 9:49 AM, Daniel Vetter wrote:

On Sat, Nov 21, 2020 at 12:21:20AM -0500, Andrey Grodzovsky wrote:

Avoids NULL ptr due to kobj->sd being unset on device removal.

Signed-off-by: Andrey Grodzovsky 
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c   | 4 +++-
  drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 4 +++-
  2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
index caf828a..812e592 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
@@ -27,6 +27,7 @@
  #include 
  #include 
  #include 
+#include 
  
  #include "amdgpu.h"

  #include "amdgpu_ras.h"
@@ -1043,7 +1044,8 @@ static int amdgpu_ras_sysfs_remove_feature_node(struct 
amdgpu_device *adev)
.attrs = attrs,
};
  
-	sysfs_remove_group(>dev->kobj, );

+   if (!drm_dev_is_unplugged(>ddev))
+   sysfs_remove_group(>dev->kobj, );

This looks wrong. sysfs, like any other interface, should be
unconditionally thrown out when we do the drm_dev_unregister. Whether
hotunplugged or not should matter at all. Either this isn't needed at all,
or something is wrong with the ordering here. But definitely fishy.
-Daniel



So technically this is needed because kobejct's sysfs directory entry kobj->sd 
is set to NULL

on device removal (from sysfs_remove_dir) but because we don't finalize the 
device
until last reference to drm file is dropped (which can happen later) we end up 
calling sysfs_remove_file/dir after
this pointer is NULL. sysfs_remove_file checks for NULL and aborts while 
sysfs_remove_dir

is not and that why I guard against calls to sysfs_remove_dir.
But indeed the whole approach in the driver is incorrect, as Greg pointed out - 
we should use
default groups attributes instead of explicit calls to sysfs interface and this 
would save those troubles.
But again. the issue here of scope of work, converting all of amdgpu to default 
groups attributes is somewhat
lengthy process with extra testing as the entire driver is papered with sysfs 
references and seems to me more of a standalone
cleanup, just like switching to devm_ and drmm_ work. To me at least it seems 
that it makes more sense
to finalize and push the hot unplug patches so that this new functionality can 
be part of the driver sooner
and then incrementally improve it by working on those other topics. Just as 
devm_/drmm_ I also added sysfs cleanup

to my TODO list in the RFC patch.

Andrey




  
  	return 0;

  }
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
index 2b7c90b..54331fc 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
@@ -24,6 +24,7 @@
  #include 
  #include 
  #include 
+#include 
  
  #include "amdgpu.h"

  #include "amdgpu_ucode.h"
@@ -464,7 +465,8 @@ int amdgpu_ucode_sysfs_init(struct amdgpu_device *adev)
  
  void amdgpu_ucode_sysfs_fini(struct amdgpu_device *adev)

  {
-   sysfs_remove_group(>dev->kobj, _attr_group);
+   if (!drm_dev_is_unplugged(>ddev))
+   sysfs_remove_group(>dev->kobj, _attr_group);
  }
  
  static int amdgpu_ucode_init_single_fw(struct amdgpu_device *adev,

--
2.7.4


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


Re: [PATCH v4 60/80] drm/panel: panel-dsi-cm: set column & page at setup

2020-11-24 Thread Tomi Valkeinen
On 24/11/2020 19:30, Sam Ravnborg wrote:
> On Tue, Nov 24, 2020 at 02:45:18PM +0200, Tomi Valkeinen wrote:
>> Set the column & page address once during setup, instead of relying the
>> DSI host driver to set those.
>>
>> Signed-off-by: Tomi Valkeinen 
> Reviewed-by: Sam Ravnborg 
> 
> But one comment below.
> 
>> ---
>>  drivers/gpu/drm/panel/panel-dsi-cm.c | 24 
>>  1 file changed, 24 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/panel/panel-dsi-cm.c 
>> b/drivers/gpu/drm/panel/panel-dsi-cm.c
>> index 59e8e6b18e97..1e7f73340736 100644
>> --- a/drivers/gpu/drm/panel/panel-dsi-cm.c
>> +++ b/drivers/gpu/drm/panel/panel-dsi-cm.c
>> @@ -171,6 +171,26 @@ static int dsicm_get_id(struct panel_drv_data *ddata, 
>> u8 *id1, u8 *id2, u8 *id3)
>>  return 0;
>>  }
>>  
>> +static int dsicm_set_update_window(struct panel_drv_data *ddata)
>> +{
>> +struct mipi_dsi_device *dsi = ddata->dsi;
>> +int r;
>> +u16 x1 = 0;
>> +u16 x2 = ddata->mode.hdisplay - 1;
>> +u16 y1 = 0;
>> +u16 y2 = ddata->mode.vdisplay - 1;
> 
> It does not help the readability with the variables.
> 
> Using
> 
>   r = mipi_dsi_dcs_set_column_address(dsi, 0, ddata->mode.hdisplay - 1);
> 
> would IMO be easier to parse.
> 
> Then the pointless assignment of x1 and y1 are dropped too.

I think I agree with you here, although the variables do make it clearer to the 
reader that the
parameters are x1 and x2, not x and w.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCHv8 0/8] System Cache support for GPU and required SMMU support

2020-11-24 Thread Rob Clark
On Tue, Nov 24, 2020 at 1:43 PM Will Deacon  wrote:
>
> On Tue, Nov 24, 2020 at 11:05:39AM -0800, Rob Clark wrote:
> > On Tue, Nov 24, 2020 at 3:10 AM Will Deacon  wrote:
> > > On Tue, Nov 24, 2020 at 09:32:54AM +0530, Sai Prakash Ranjan wrote:
> > > > On 2020-11-24 00:52, Rob Clark wrote:
> > > > > On Mon, Nov 23, 2020 at 9:01 AM Sai Prakash Ranjan
> > > > >  wrote:
> > > > > > On 2020-11-23 20:51, Will Deacon wrote:
> > > > > > > Modulo some minor comments I've made, this looks good to me. What 
> > > > > > > is
> > > > > > > the
> > > > > > > plan for merging it? I can take the IOMMU parts, but patches 4-6 
> > > > > > > touch
> > > > > > > the
> > > > > > > MSM GPU driver and I'd like to avoid conflicts with that.
> > > > > > >
> > > > > >
> > > > > > SMMU bits are pretty much independent and GPU relies on the domain
> > > > > > attribute
> > > > > > and the quirk exposed, so as long as SMMU changes go in first it
> > > > > > should
> > > > > > be good.
> > > > > > Rob?
> > > > >
> > > > > I suppose one option would be to split out the patch that adds the
> > > > > attribute into it's own patch, and merge that both thru drm and iommu?
> > > > >
> > > >
> > > > Ok I can split out domain attr and quirk into its own patch if Will is
> > > > fine with that approach.
> > >
> > > Why don't I just queue the first two patches on their own branch and we
> > > both pull that?
> >
> > Ok, that works for me.  I normally base msm-next on -rc1 but I guess
> > as long as we base the branch on the older or our two -next branches,
> > that should work out nicely
>
> Turns out we're getting a v10 of Sai's stuff, so I've asked him to split
> patch two up anyway. Then I'll make a branch based on -rc1 that we can
> both pull.

Sounds good, thx

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


Re: [PATCH 00/15] drm: Move struct drm_device.pdev to legacy

2020-11-24 Thread Sam Ravnborg
Hi Thomas.

Nice clean-up series - quite an effort to move one member to deprecated!

I have read through most of the patches. I left a few notes in my
replies but nothing buggy. Just nitpicks.


On Tue, Nov 24, 2020 at 12:38:09PM +0100, Thomas Zimmermann wrote:
> The pdev field in struct drm_device points to a PCI device structure and
> goes back to UMS-only days when all DRM drivers where for PCI devices.
> Meanwhile we also support USB, SPI and platform devices. Each of those
> uses the generic device stored in struct drm_device.dev.
> 
> To reduce duplications and remove the special case of PCI, this patchset
> converts all modesetting drivers from pdev to dev and makes pdev a field
> for legacy UMS drivers.
> 
> For PCI devices, the pointer in struct drm_device.dev can be upcasted to
> struct pci_device; or tested for PCI with dev_is_pci(). In several places
> the code can use the dev field directly.
> 
> After converting all drivers and the DRM core, the pdev fields becomes
> only relevant for legacy drivers. In a later patchset, we may want to
> convert these as well and remove pdev entirely.
> 
> The patchset touches many files, but the individual changes are mostly
> trivial. I suggest to merge each driver's patch through the respective
> tree and later the rest through drm-misc-next.
> 
> Thomas Zimmermann (15):
>   drm/amdgpu: Remove references to struct drm_device.pdev
>   drm/ast: Remove references to struct drm_device.pdev
>   drm/bochs: Remove references to struct drm_device.pdev
>   drm/cirrus: Remove references to struct drm_device.pdev
>   drm/gma500: Remove references to struct drm_device.pdev
>   drm/hibmc: Remove references to struct drm_device.pdev
>   drm/mgag200: Remove references to struct drm_device.pdev
>   drm/qxl: Remove references to struct drm_device.pdev
>   drm/vboxvideo: Remove references to struct drm_device.pdev
>   drm/virtgpu: Remove references to struct drm_device.pdev
>   drm/vmwgfx: Remove references to struct drm_device.pdev
>   drm: Upcast struct drm_device.dev to struct pci_device; replace pdev
All above are:
Acked-by: Sam Ravnborg 

>   drm/nouveau: Remove references to struct drm_device.pdev
I lost my confidence in my reading of this code.

>   drm/i915: Remove references to struct drm_device.pdev
>   drm/radeon: Remove references to struct drm_device.pdev
I did not look at these at all. I hope someone else find time to do so.

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


Re: [PATCH 15/15] drm: Upcast struct drm_device.dev to struct pci_device; replace pdev

2020-11-24 Thread Sam Ravnborg
Hi Thomas,

On Tue, Nov 24, 2020 at 12:38:24PM +0100, Thomas Zimmermann wrote:
> We have DRM drivers based on USB, SPI and platform devices. All of them
> are fine with storing their device reference in struct drm_device.dev.
> PCI devices should be no exception. Therefore struct drm_device.pdev is
> deprecated.
> 
> Instead upcast from struct drm_device.dev with to_pci_dev(). PCI-specific
> code can use dev_is_pci() to test for a PCI device. This patch changes
> the DRM core code and documentation accordingly. Struct drm_device.pdev
> is being moved to legacy status.
> 
> Signed-off-by: Thomas Zimmermann 
> ---
>  drivers/gpu/drm/drm_agpsupport.c |  9 ++---
>  drivers/gpu/drm/drm_bufs.c   |  4 ++--
>  drivers/gpu/drm/drm_edid.c   |  7 ++-
>  drivers/gpu/drm/drm_irq.c| 12 +++-
>  drivers/gpu/drm/drm_pci.c| 26 +++---
>  drivers/gpu/drm/drm_vm.c |  2 +-
>  include/drm/drm_device.h | 12 +---
>  7 files changed, 46 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_agpsupport.c 
> b/drivers/gpu/drm/drm_agpsupport.c
> index 4c7ad46fdd21..a4040fe4f4ba 100644
> --- a/drivers/gpu/drm/drm_agpsupport.c
> +++ b/drivers/gpu/drm/drm_agpsupport.c
> @@ -103,11 +103,13 @@ int drm_agp_info_ioctl(struct drm_device *dev, void 
> *data,
>   */
>  int drm_agp_acquire(struct drm_device *dev)
>  {
> + struct pci_dev *pdev = to_pci_dev(dev->dev);
> +
>   if (!dev->agp)
>   return -ENODEV;
>   if (dev->agp->acquired)
>   return -EBUSY;
> - dev->agp->bridge = agp_backend_acquire(dev->pdev);
> + dev->agp->bridge = agp_backend_acquire(pdev);
>   if (!dev->agp->bridge)
>   return -ENODEV;
>   dev->agp->acquired = 1;
> @@ -402,14 +404,15 @@ int drm_agp_free_ioctl(struct drm_device *dev, void 
> *data,
>   */
>  struct drm_agp_head *drm_agp_init(struct drm_device *dev)
>  {
> + struct pci_dev *pdev = to_pci_dev(dev->dev);
>   struct drm_agp_head *head = NULL;
>  
>   head = kzalloc(sizeof(*head), GFP_KERNEL);
>   if (!head)
>   return NULL;
> - head->bridge = agp_find_bridge(dev->pdev);
> + head->bridge = agp_find_bridge(pdev);
>   if (!head->bridge) {
> - head->bridge = agp_backend_acquire(dev->pdev);
> + head->bridge = agp_backend_acquire(pdev);
>   if (!head->bridge) {
>   kfree(head);
>   return NULL;
> diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
> index 7a01d0918861..1da8b360b60a 100644
> --- a/drivers/gpu/drm/drm_bufs.c
> +++ b/drivers/gpu/drm/drm_bufs.c
> @@ -325,7 +325,7 @@ static int drm_addmap_core(struct drm_device *dev, 
> resource_size_t offset,
>* As we're limiting the address to 2^32-1 (or less),
>* casting it down to 32 bits is no problem, but we
>* need to point to a 64bit variable first. */
> - map->handle = dma_alloc_coherent(>pdev->dev,
> + map->handle = dma_alloc_coherent(dev->dev,
>map->size,
>>offset,
>GFP_KERNEL);
> @@ -555,7 +555,7 @@ int drm_legacy_rmmap_locked(struct drm_device *dev, 
> struct drm_local_map *map)
>   case _DRM_SCATTER_GATHER:
>   break;
>   case _DRM_CONSISTENT:
> - dma_free_coherent(>pdev->dev,
> + dma_free_coherent(dev->dev,
> map->size,
> map->handle,
> map->offset);
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index 74f5a3197214..555a04ce2179 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -32,6 +32,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  
> @@ -2075,9 +2076,13 @@ EXPORT_SYMBOL(drm_get_edid);
>  struct edid *drm_get_edid_switcheroo(struct drm_connector *connector,
>struct i2c_adapter *adapter)
>  {
> - struct pci_dev *pdev = connector->dev->pdev;
> + struct drm_device *dev = connector->dev;
> + struct pci_dev *pdev = to_pci_dev(dev->dev);
>   struct edid *edid;

Maybe add a comment that explain why this can trigger - so people are
helped it they are catched by this.
As it is now it is not even mentioned in the changelog.

> + if (drm_WARN_ON_ONCE(dev, !dev_is_pci(dev->dev)))
> + return NULL;
> +
>   vga_switcheroo_lock_ddc(pdev);
>   edid = drm_get_edid(connector, adapter);
>   vga_switcheroo_unlock_ddc(pdev);
> diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
> index 09d6e9e2e075..22986a9a593b 100644
> --- a/drivers/gpu/drm/drm_irq.c
> +++ b/drivers/gpu/drm/drm_irq.c
> @@ -122,7 +122,7 @@ int drm_irq_install(struct drm_device *dev, int 

Re: [PATCHv8 0/8] System Cache support for GPU and required SMMU support

2020-11-24 Thread Will Deacon
On Tue, Nov 24, 2020 at 11:05:39AM -0800, Rob Clark wrote:
> On Tue, Nov 24, 2020 at 3:10 AM Will Deacon  wrote:
> > On Tue, Nov 24, 2020 at 09:32:54AM +0530, Sai Prakash Ranjan wrote:
> > > On 2020-11-24 00:52, Rob Clark wrote:
> > > > On Mon, Nov 23, 2020 at 9:01 AM Sai Prakash Ranjan
> > > >  wrote:
> > > > > On 2020-11-23 20:51, Will Deacon wrote:
> > > > > > Modulo some minor comments I've made, this looks good to me. What is
> > > > > > the
> > > > > > plan for merging it? I can take the IOMMU parts, but patches 4-6 
> > > > > > touch
> > > > > > the
> > > > > > MSM GPU driver and I'd like to avoid conflicts with that.
> > > > > >
> > > > >
> > > > > SMMU bits are pretty much independent and GPU relies on the domain
> > > > > attribute
> > > > > and the quirk exposed, so as long as SMMU changes go in first it
> > > > > should
> > > > > be good.
> > > > > Rob?
> > > >
> > > > I suppose one option would be to split out the patch that adds the
> > > > attribute into it's own patch, and merge that both thru drm and iommu?
> > > >
> > >
> > > Ok I can split out domain attr and quirk into its own patch if Will is
> > > fine with that approach.
> >
> > Why don't I just queue the first two patches on their own branch and we
> > both pull that?
> 
> Ok, that works for me.  I normally base msm-next on -rc1 but I guess
> as long as we base the branch on the older or our two -next branches,
> that should work out nicely

Turns out we're getting a v10 of Sai's stuff, so I've asked him to split
patch two up anyway. Then I'll make a branch based on -rc1 that we can
both pull.

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


Re: [PATCH 09/15] drm/nouveau: Remove references to struct drm_device.pdev

2020-11-24 Thread Sam Ravnborg
Hi Thomas.

On Tue, Nov 24, 2020 at 12:38:18PM +0100, Thomas Zimmermann wrote:
> Using struct drm_device.pdev is deprecated. Convert nouveau to struct
> drm_device.dev. No functional changes.
> 
> Signed-off-by: Thomas Zimmermann 
> Cc: Ben Skeggs 

Suggestion to an alternative implmentation below.

> ---
>  drivers/gpu/drm/nouveau/dispnv04/arb.c  | 12 +++-
>  drivers/gpu/drm/nouveau/dispnv04/disp.h | 14 --
>  drivers/gpu/drm/nouveau/dispnv04/hw.c   | 10 ++
>  drivers/gpu/drm/nouveau/nouveau_abi16.c |  7 ---
>  drivers/gpu/drm/nouveau/nouveau_acpi.c  |  2 +-
>  drivers/gpu/drm/nouveau/nouveau_bios.c  | 11 ---
>  drivers/gpu/drm/nouveau/nouveau_connector.c | 10 ++
>  drivers/gpu/drm/nouveau/nouveau_drm.c   |  5 ++---
>  drivers/gpu/drm/nouveau/nouveau_fbcon.c |  6 --
>  drivers/gpu/drm/nouveau/nouveau_vga.c   | 20 
>  10 files changed, 58 insertions(+), 39 deletions(-)
> 

> diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.c 
> b/drivers/gpu/drm/nouveau/nouveau_bios.c
> index d204ea8a5618..7cc683b8dc7a 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_bios.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_bios.c
> @@ -110,6 +110,9 @@ static int call_lvds_manufacturer_script(struct 
> drm_device *dev, struct dcb_outp
>   struct nvbios *bios = >vbios;
>   uint8_t sub = bios->data[bios->fp.xlated_entry + script] + 
> (bios->fp.link_c_increment && dcbent->or & DCB_OUTPUT_C ? 1 : 0);
>   uint16_t scriptofs = ROM16(bios->data[bios->init_script_tbls_ptr + sub 
> * 2]);
> +#ifdef __powerpc__
> + struct pci_dev *pdev = to_pci_dev(dev->dev);
> +#endif
Or
int device = 0;
>  
>   if (!bios->fp.xlated_entry || !sub || !scriptofs)
>   return -EINVAL;
> @@ -123,8 +126,8 @@ static int call_lvds_manufacturer_script(struct 
> drm_device *dev, struct dcb_outp
>  #ifdef __powerpc__
>   /* Powerbook specific quirks */
device = to_pci_dev(dev->dev)->device;
if (script == LVDS_RESET && (device == 0x0179 || device == 0x0189 || 
device == 0x0329))

>   if (script == LVDS_RESET &&
> - (dev->pdev->device == 0x0179 || dev->pdev->device == 0x0189 ||
> -  dev->pdev->device == 0x0329))
> + (pdev->device == 0x0179 || pdev->device == 0x0189 ||
> +  pdev->device == 0x0329))
>   nv_write_tmds(dev, dcbent->or, 0, 0x02, 0x72);
>  #endif
>  


> diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c 
> b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
> index 24ec5339efb4..4fc0fa696461 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
> @@ -396,7 +396,9 @@ nouveau_fbcon_create(struct drm_fb_helper *helper,
>   NV_INFO(drm, "allocated %dx%d fb: 0x%llx, bo %p\n",
>   fb->width, fb->height, nvbo->offset, nvbo);
>  
> - vga_switcheroo_client_fb_set(dev->pdev, info);
> + if (dev_is_pci(dev->dev))
> + vga_switcheroo_client_fb_set(to_pci_dev(dev->dev), info);
> +
I cannot see why dev_is_pci() is needed here.
So I am obviously missing something :-(

>   return 0;
>  
>  out_unlock:
> @@ -548,7 +550,7 @@ nouveau_fbcon_init(struct drm_device *dev)
>   int ret;
>  
>   if (!dev->mode_config.num_crtc ||
> - (dev->pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA)
> + (to_pci_dev(dev->dev)->class >> 8) != PCI_CLASS_DISPLAY_VGA)
>   return 0;
>  
>   fbcon = kzalloc(sizeof(struct nouveau_fbdev), GFP_KERNEL);
> diff --git a/drivers/gpu/drm/nouveau/nouveau_vga.c 
> b/drivers/gpu/drm/nouveau/nouveau_vga.c
> index c85dd8afa3c3..7c4b374b3eca 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_vga.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_vga.c
> @@ -87,18 +87,20 @@ nouveau_vga_init(struct nouveau_drm *drm)
>  {
>   struct drm_device *dev = drm->dev;
>   bool runtime = nouveau_pmops_runtime();
> + struct pci_dev *pdev;
>  
>   /* only relevant for PCI devices */
> - if (!dev->pdev)
> + if (!dev_is_pci(dev->dev))
>   return;
> + pdev = to_pci_dev(dev->dev);
>  
> - vga_client_register(dev->pdev, dev, NULL, nouveau_vga_set_decode);
> + vga_client_register(pdev, dev, NULL, nouveau_vga_set_decode);
>  
>   /* don't register Thunderbolt eGPU with vga_switcheroo */
> - if (pci_is_thunderbolt_attached(dev->pdev))
> + if (pci_is_thunderbolt_attached(pdev))
>   return;
>  
> - vga_switcheroo_register_client(dev->pdev, _switcheroo_ops, 
> runtime);
> + vga_switcheroo_register_client(pdev, _switcheroo_ops, runtime);
>  
>   if (runtime && nouveau_is_v1_dsm() && !nouveau_is_optimus())
>   vga_switcheroo_init_domain_pm_ops(drm->dev->dev, 
> >vga_pm_domain);
> @@ -109,17 +111,19 @@ nouveau_vga_fini(struct nouveau_drm *drm)
>  {
>   struct drm_device *dev = drm->dev;
>   bool runtime = nouveau_pmops_runtime();
> + struct pci_dev *pdev;
>  
>   /* only 

Re: [PATCHv9 2/8] iommu/arm-smmu: Add domain attribute for pagetable configuration

2020-11-24 Thread Will Deacon
On Mon, Nov 23, 2020 at 10:35:55PM +0530, Sai Prakash Ranjan wrote:
> Add iommu domain attribute for pagetable configuration which
> initially will be used to set quirks like for system cache aka
> last level cache to be used by client drivers like GPU to set
> right attributes for caching the hardware pagetables into the
> system cache and later can be extended to include other page
> table configuration data.
> 
> Signed-off-by: Sai Prakash Ranjan 
> ---
>  drivers/iommu/arm/arm-smmu/arm-smmu.c | 20 
>  drivers/iommu/arm/arm-smmu/arm-smmu.h |  1 +
>  include/linux/io-pgtable.h|  4 
>  include/linux/iommu.h |  1 +
>  4 files changed, 26 insertions(+)

Given that we're heading for a v10 to address my comments on patch 3,
then I guess you may as well split this into two patches so that I can
share just the atttibute with Rob rather than the driver parts.

Please keep it all as one series though, with the common parts at the
beginning, and I'll figure it out.

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


Re: [PATCHv9 3/8] iommu/arm-smmu: Move non-strict mode to use io_pgtable_domain_attr

2020-11-24 Thread Will Deacon
On Mon, Nov 23, 2020 at 10:35:56PM +0530, Sai Prakash Ranjan wrote:
> Now that we have a struct io_pgtable_domain_attr with quirks,
> use that for non_strict mode as well thereby removing the need
> for more members of arm_smmu_domain in the future.
> 
> Signed-off-by: Sai Prakash Ranjan 
> ---
>  drivers/iommu/arm/arm-smmu/arm-smmu.c | 8 +++-
>  drivers/iommu/arm/arm-smmu/arm-smmu.h | 1 -
>  2 files changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c 
> b/drivers/iommu/arm/arm-smmu/arm-smmu.c
> index 4b9b10fe50ed..f56f266ebdf7 100644
> --- a/drivers/iommu/arm/arm-smmu/arm-smmu.c
> +++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c
> @@ -786,9 +786,6 @@ static int arm_smmu_init_domain_context(struct 
> iommu_domain *domain,
>   goto out_clear_smmu;
>   }
>  
> - if (smmu_domain->non_strict)
> - pgtbl_cfg.quirks |= IO_PGTABLE_QUIRK_NON_STRICT;
> -
>   if (smmu_domain->pgtbl_cfg.quirks)
>   pgtbl_cfg.quirks |= smmu_domain->pgtbl_cfg.quirks;
>  
> @@ -1527,7 +1524,8 @@ static int arm_smmu_domain_get_attr(struct iommu_domain 
> *domain,
>   case IOMMU_DOMAIN_DMA:
>   switch (attr) {
>   case DOMAIN_ATTR_DMA_USE_FLUSH_QUEUE:
> - *(int *)data = smmu_domain->non_strict;
> + if (smmu_domain->pgtbl_cfg.quirks & 
> IO_PGTABLE_QUIRK_NON_STRICT)
> + *(int *)data = smmu_domain->pgtbl_cfg.quirks;

I still don't think this is right :(
We need to set *data to 1 or 0 depending on whether or not the non-strict
quirk is set, i.e:

bool non_strict = smmu_domain->pgtbl_cfg.quirks & 
IO_PGTABLE_QUIRK_NON_STRICT;
*(int *)data = non_strict;

Your code above leaves *data uninitialised if non_strict is not set.

>   return 0;
>   default:
>   return -ENODEV;
> @@ -1578,7 +1576,7 @@ static int arm_smmu_domain_set_attr(struct iommu_domain 
> *domain,
>   case IOMMU_DOMAIN_DMA:
>   switch (attr) {
>   case DOMAIN_ATTR_DMA_USE_FLUSH_QUEUE:
> - smmu_domain->non_strict = *(int *)data;
> + smmu_domain->pgtbl_cfg.quirks |= 
> IO_PGTABLE_QUIRK_NON_STRICT;

And this is broken because if *data is 0, then you _set_ the quirk, which is
the opposite of what we should be doing.

In other words, although the implementation has changed, the semantics have
not.

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


Re: [Intel-wired-lan] [PATCH 000/141] Fix fall-through warnings for Clang

2020-11-24 Thread Kees Cook
On Mon, Nov 23, 2020 at 08:31:30AM -0800, James Bottomley wrote:
> Really, no ... something which produces no improvement has no value at
> all ... we really shouldn't be wasting maintainer time with it because
> it has a cost to merge.  I'm not sure we understand where the balance
> lies in value vs cost to merge but I am confident in the zero value
> case.

What? We can't measure how many future bugs aren't introduced because the
kernel requires explicit case flow-control statements for all new code.

We already enable -Wimplicit-fallthrough globally, so that's not the
discussion. The issue is that Clang is (correctly) even more strict
than GCC for this, so these are the remaining ones to fix for full Clang
coverage too.

People have spent more time debating this already than it would have
taken to apply the patches. :)

This is about robustness and language wrangling. It's a big code-base,
and this is the price of our managing technical debt for permanent
robustness improvements. (The numbers I ran from Gustavo's earlier
patches were that about 10% of the places adjusted were identified as
legitimate bugs being fixed. This final series may be lower, but there
are still bugs being found from it -- we need to finish this and shut
the door on it for good.)

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


Re: [PATCH 05/15] drm/gma500: Remove references to struct drm_device.pdev

2020-11-24 Thread Sam Ravnborg
Hi Thomas.

On Tue, Nov 24, 2020 at 12:38:14PM +0100, Thomas Zimmermann wrote:
> Using struct drm_device.pdev is deprecated. Convert gma500 to struct
> drm_device.dev. No functional changes.
> 
> Signed-off-by: Thomas Zimmermann 
> Cc: Patrik Jakobsson 

This patch includes several whitespace changes too.
It would be nice to avoid these as the patch is already large enough.

Browsing the patch it was not so many, it looked like more in the start
of the patch.

Sam

> ---
>  drivers/gpu/drm/gma500/cdv_device.c| 30 +++---
>  drivers/gpu/drm/gma500/cdv_intel_crt.c |  3 +-
>  drivers/gpu/drm/gma500/cdv_intel_lvds.c|  4 +--
>  drivers/gpu/drm/gma500/framebuffer.c   |  9 +++---
>  drivers/gpu/drm/gma500/gma_device.c|  3 +-
>  drivers/gpu/drm/gma500/gma_display.c   |  4 +--
>  drivers/gpu/drm/gma500/gtt.c   | 20 ++--
>  drivers/gpu/drm/gma500/intel_bios.c|  6 ++--
>  drivers/gpu/drm/gma500/intel_gmbus.c   |  4 +--
>  drivers/gpu/drm/gma500/intel_i2c.c |  2 +-
>  drivers/gpu/drm/gma500/mdfld_device.c  |  4 ++-
>  drivers/gpu/drm/gma500/mdfld_dsi_dpi.c |  8 ++---
>  drivers/gpu/drm/gma500/mid_bios.c  |  9 --
>  drivers/gpu/drm/gma500/oaktrail_device.c   |  5 +--
>  drivers/gpu/drm/gma500/oaktrail_lvds.c |  2 +-
>  drivers/gpu/drm/gma500/oaktrail_lvds_i2c.c |  2 +-
>  drivers/gpu/drm/gma500/opregion.c  |  3 +-
>  drivers/gpu/drm/gma500/power.c | 13 
>  drivers/gpu/drm/gma500/psb_drv.c   | 16 +-
>  drivers/gpu/drm/gma500/psb_drv.h   |  8 ++---
>  drivers/gpu/drm/gma500/psb_intel_lvds.c|  6 ++--
>  drivers/gpu/drm/gma500/psb_intel_sdvo.c|  2 +-
>  drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c | 36 +++---
>  23 files changed, 109 insertions(+), 90 deletions(-)
> 
> diff --git a/drivers/gpu/drm/gma500/cdv_device.c 
> b/drivers/gpu/drm/gma500/cdv_device.c
> index e75293e4a52f..19e055dbd4c2 100644
> --- a/drivers/gpu/drm/gma500/cdv_device.c
> +++ b/drivers/gpu/drm/gma500/cdv_device.c
> @@ -95,13 +95,14 @@ static u32 cdv_get_max_backlight(struct drm_device *dev)
>  static int cdv_get_brightness(struct backlight_device *bd)
>  {
>   struct drm_device *dev = bl_get_data(bd);
> + struct pci_dev *pdev = to_pci_dev(dev->dev);
>   u32 val = REG_READ(BLC_PWM_CTL) & BACKLIGHT_DUTY_CYCLE_MASK;
>  
>   if (cdv_backlight_combination_mode(dev)) {
>   u8 lbpc;
>  
>   val &= ~1;
> - pci_read_config_byte(dev->pdev, 0xF4, );
> + pci_read_config_byte(pdev, 0xF4, );
>   val *= lbpc;
>   }
>   return (val * 100)/cdv_get_max_backlight(dev);
> @@ -111,6 +112,7 @@ static int cdv_get_brightness(struct backlight_device *bd)
>  static int cdv_set_brightness(struct backlight_device *bd)
>  {
>   struct drm_device *dev = bl_get_data(bd);
> + struct pci_dev *pdev = to_pci_dev(dev->dev);
>   int level = bd->props.brightness;
>   u32 blc_pwm_ctl;
>  
> @@ -128,7 +130,7 @@ static int cdv_set_brightness(struct backlight_device *bd)
>   lbpc = level * 0xfe / max + 1;
>   level /= lbpc;
>  
> - pci_write_config_byte(dev->pdev, 0xF4, lbpc);
> + pci_write_config_byte(pdev, 0xF4, lbpc);
>   }
>  
>   blc_pwm_ctl = REG_READ(BLC_PWM_CTL) & ~BACKLIGHT_DUTY_CYCLE_MASK;
> @@ -205,8 +207,9 @@ static inline void CDV_MSG_WRITE32(int domain, uint port, 
> uint offset,
>  static void cdv_init_pm(struct drm_device *dev)
>  {
>   struct drm_psb_private *dev_priv = dev->dev_private;
> + struct pci_dev *pdev = to_pci_dev(dev->dev);
>   u32 pwr_cnt;
> - int domain = pci_domain_nr(dev->pdev->bus);
> + int domain = pci_domain_nr(pdev->bus);
>   int i;
>  
>   dev_priv->apm_base = CDV_MSG_READ32(domain, PSB_PUNIT_PORT,
> @@ -234,6 +237,8 @@ static void cdv_init_pm(struct drm_device *dev)
>  
>  static void cdv_errata(struct drm_device *dev)
>  {
> + struct pci_dev *pdev = to_pci_dev(dev->dev);
> +
>   /* Disable bonus launch.
>*  CPU and GPU competes for memory and display misses updates and
>*  flickers. Worst with dual core, dual displays.
> @@ -242,7 +247,7 @@ static void cdv_errata(struct drm_device *dev)
>*  Bonus Launch to work around the issue, by degrading
>*  performance.
>*/
> -  CDV_MSG_WRITE32(pci_domain_nr(dev->pdev->bus), 3, 0x30, 0x08027108);
> +  CDV_MSG_WRITE32(pci_domain_nr(pdev->bus), 3, 0x30, 0x08027108);
>  }
>  
>  /**
> @@ -255,12 +260,13 @@ static void cdv_errata(struct drm_device *dev)
>  static int cdv_save_display_registers(struct drm_device *dev)
>  {
>   struct drm_psb_private *dev_priv = dev->dev_private;
> + struct pci_dev *pdev = to_pci_dev(dev->dev);
>   struct psb_save_area *regs = _priv->regs;
>   struct drm_connector *connector;
>  
>   dev_dbg(dev->dev, "Saving GPU registers.\n");
> 

Re: [PATCH 000/141] Fix fall-through warnings for Clang

2020-11-24 Thread Kees Cook
On Mon, Nov 23, 2020 at 05:32:51PM -0800, Nick Desaulniers wrote:
> On Sun, Nov 22, 2020 at 8:17 AM Kees Cook  wrote:
> >
> > On Fri, Nov 20, 2020 at 11:51:42AM -0800, Jakub Kicinski wrote:
> > > If none of the 140 patches here fix a real bug, and there is no change
> > > to machine code then it sounds to me like a W=2 kind of a warning.
> >
> > FWIW, this series has found at least one bug so far:
> > https://lore.kernel.org/lkml/CAFCwf11izHF=g1mGry1fE5kvFFFrxzhPSM6qKAO8gxSp=kr...@mail.gmail.com/
> 
> So looks like the bulk of these are:
> switch (x) {
>   case 0:
> ++x;
>   default:
> break;
> }
> 
> I have a patch that fixes those up for clang:
> https://reviews.llvm.org/D91895

I still think this isn't right -- it's a case statement that runs off
the end without an explicit flow control determination. I think Clang is
right to warn for these, and GCC should also warn.

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


[PATCH rdma-core v2 3/6] mlx5: Support dma-buf based memory region

2020-11-24 Thread Jianxin Xiong
Implement the new provider method for registering dma-buf based memory
regions.

Signed-off-by: Jianxin Xiong 
---
 providers/mlx5/mlx5.c  |  2 ++
 providers/mlx5/mlx5.h  |  3 +++
 providers/mlx5/verbs.c | 22 ++
 3 files changed, 27 insertions(+)

diff --git a/providers/mlx5/mlx5.c b/providers/mlx5/mlx5.c
index 1378acf..b3e2d57 100644
--- a/providers/mlx5/mlx5.c
+++ b/providers/mlx5/mlx5.c
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2012 Mellanox Technologies, Inc.  All rights reserved.
+ * Copyright (c) 2020 Intel Corporation.  All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -96,6 +97,7 @@ static const struct verbs_context_ops mlx5_ctx_common_ops = {
.async_event   = mlx5_async_event,
.dealloc_pd= mlx5_free_pd,
.reg_mr= mlx5_reg_mr,
+   .reg_dmabuf_mr = mlx5_reg_dmabuf_mr,
.rereg_mr  = mlx5_rereg_mr,
.dereg_mr  = mlx5_dereg_mr,
.alloc_mw  = mlx5_alloc_mw,
diff --git a/providers/mlx5/mlx5.h b/providers/mlx5/mlx5.h
index 8c94f72..17a2470 100644
--- a/providers/mlx5/mlx5.h
+++ b/providers/mlx5/mlx5.h
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2012 Mellanox Technologies, Inc.  All rights reserved.
+ * Copyright (c) 2020 Intel Corporation.  All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -903,6 +904,8 @@ void mlx5_async_event(struct ibv_context *context,
 struct ibv_mr *mlx5_alloc_null_mr(struct ibv_pd *pd);
 struct ibv_mr *mlx5_reg_mr(struct ibv_pd *pd, void *addr, size_t length,
   uint64_t hca_va, int access);
+struct ibv_mr *mlx5_reg_dmabuf_mr(struct ibv_pd *pd, uint64_t offset, size_t 
length,
+ uint64_t iova, int fd, int access);
 int mlx5_rereg_mr(struct verbs_mr *mr, int flags, struct ibv_pd *pd, void 
*addr,
  size_t length, int access);
 int mlx5_dereg_mr(struct verbs_mr *mr);
diff --git a/providers/mlx5/verbs.c b/providers/mlx5/verbs.c
index b956156..a7fc3b0 100644
--- a/providers/mlx5/verbs.c
+++ b/providers/mlx5/verbs.c
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2012 Mellanox Technologies, Inc.  All rights reserved.
+ * Copyright (c) 2020 Intel Corporation.  All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -647,6 +648,27 @@ struct ibv_mr *mlx5_reg_mr(struct ibv_pd *pd, void *addr, 
size_t length,
return >vmr.ibv_mr;
 }
 
+struct ibv_mr *mlx5_reg_dmabuf_mr(struct ibv_pd *pd, uint64_t offset, size_t 
length,
+ uint64_t iova, int fd, int acc)
+{
+   struct mlx5_mr *mr;
+   int ret;
+
+   mr = calloc(1, sizeof(*mr));
+   if (!mr)
+   return NULL;
+
+   ret = ibv_cmd_reg_dmabuf_mr(pd, offset, length, iova, fd, acc,
+   >vmr);
+   if (ret) {
+   free(mr);
+   return NULL;
+   }
+   mr->alloc_flags = acc;
+
+   return >vmr.ibv_mr;
+}
+
 struct ibv_mr *mlx5_alloc_null_mr(struct ibv_pd *pd)
 {
struct mlx5_mr *mr;
-- 
1.8.3.1

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


[PATCH rdma-core v2 4/6] pyverbs: Add dma-buf based MR support

2020-11-24 Thread Jianxin Xiong
Define a new sub-class of 'MR' that uses dma-buf object for the memory
region. Define a new class 'DmaBuf' for dma-buf object allocation.

Signed-off-by: Jianxin Xiong 
---
 pyverbs/CMakeLists.txt |  2 ++
 pyverbs/dmabuf.pxd | 13 
 pyverbs/dmabuf.pyx | 85 ++
 pyverbs/libibverbs.pxd |  2 ++
 pyverbs/mr.pxd |  5 +++
 pyverbs/mr.pyx | 77 +++--
 6 files changed, 182 insertions(+), 2 deletions(-)
 create mode 100644 pyverbs/dmabuf.pxd
 create mode 100644 pyverbs/dmabuf.pyx

diff --git a/pyverbs/CMakeLists.txt b/pyverbs/CMakeLists.txt
index 9542c4b..5aee02b 100644
--- a/pyverbs/CMakeLists.txt
+++ b/pyverbs/CMakeLists.txt
@@ -1,5 +1,6 @@
 # SPDX-License-Identifier: (GPL-2.0 OR Linux-OpenIB)
 # Copyright (c) 2019, Mellanox Technologies. All rights reserved. See COPYING 
file
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
 
 rdma_cython_module(pyverbs ""
   addr.pyx
@@ -16,6 +17,7 @@ rdma_cython_module(pyverbs ""
   wr.pyx
   xrcd.pyx
   srq.pyx
+  dmabuf.pyx
   )
 
 rdma_python_module(pyverbs
diff --git a/pyverbs/dmabuf.pxd b/pyverbs/dmabuf.pxd
new file mode 100644
index 000..040db4b
--- /dev/null
+++ b/pyverbs/dmabuf.pxd
@@ -0,0 +1,13 @@
+# SPDX-License-Identifier: (GPL-2.0 OR Linux-OpenIB)
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
+
+#cython: language_level=3
+
+cdef class DmaBuf:
+cdef int dri_fd
+cdef int handle
+cdef int fd
+cdef unsigned long size
+cdef unsigned long map_offset
+cdef object dmabuf_mrs
+cdef add_ref(self, obj)
diff --git a/pyverbs/dmabuf.pyx b/pyverbs/dmabuf.pyx
new file mode 100644
index 000..a72d808
--- /dev/null
+++ b/pyverbs/dmabuf.pyx
@@ -0,0 +1,85 @@
+# SPDX-License-Identifier: (GPL-2.0 OR Linux-OpenIB)
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
+
+#cython: language_level=3
+
+import weakref
+
+from os import open, close, O_RDWR
+from fcntl import ioctl
+from struct import pack_into, unpack
+from pyverbs.base cimport close_weakrefs
+from pyverbs.mr cimport DmaBufMR
+
+cdef extern from "drm/drm.h":
+cdef int DRM_IOCTL_MODE_CREATE_DUMB
+cdef int DRM_IOCTL_MODE_MAP_DUMB
+cdef int DRM_IOCTL_MODE_DESTROY_DUMB
+cdef int DRM_IOCTL_PRIME_HANDLE_TO_FD
+
+cdef class DmaBuf:
+def __init__(self, size, unit=0):
+"""
+Allocate DmaBuf object from a GPU device. This is done through the
+DRI device interface (/dev/dri/card*). Usually this requires the
+effective user id being root or being a member of the 'video' group.
+:param size: The size (in number of bytes) of the buffer.
+:param unit: The unit number of the GPU to allocate the buffer from.
+:return: The newly created DmaBuf object on success.
+"""
+self.dmabuf_mrs = weakref.WeakSet()
+self.dri_fd = open('/dev/dri/card'+str(unit), O_RDWR)
+
+# create a dumb scanout buffer:
+# struct drm_mode_create_dumb {
+#__u32 height;
+#__u32 width;
+#__u32 bpp;
+#__u32 flags;
+#__u32 handle; /* output */
+#__u32 pitch; /* output */
+#__u64 size; /* output */
+#};
+create_dumb = bytearray(32)
+pack_into('=iiq', create_dumb, 0, 1, size, 8, 0, 0, 0, 0)
+ioctl(self.dri_fd, DRM_IOCTL_MODE_CREATE_DUMB, create_dumb)
+a, b, c, d, self.handle, e, self.size = unpack('=iiq', create_dumb)
+
+# get dma-buf file descriptor from a PRIME handle:
+# struct drm_prime_handle {
+# __u32 handle;
+# __u32 flags;
+# __s32 fd; /* output */
+# };
+prime_handle = bytearray(12)
+pack_into('=iii', prime_handle, 0, self.handle, O_RDWR, 0)
+ioctl(self.dri_fd, DRM_IOCTL_PRIME_HANDLE_TO_FD, prime_handle)
+a, b, self.fd = unpack('=iii', prime_handle)
+
+# set up for mmap of a dumb scanout buffer:
+# struct drm_mode_map_dumb {
+# __u32 handle;
+# __u32 pad;
+# __u64 offset; /* output */
+# };
+map_dumb = bytearray(16)
+pack_into('=iiq', map_dumb, 0, self.handle, 0, 0)
+ioctl(self.dri_fd, DRM_IOCTL_MODE_MAP_DUMB, map_dumb);
+a, b, self.map_offset = unpack('=iiq', map_dumb);
+
+def __dealloc__(self):
+close_weakrefs([self.dmabuf_mrs])
+
+# destroy a dumb scanout buffer:
+# struct drm_mode_destroy_dumb {
+# __u32 handle;
+# };
+destroy_dumb = bytearray(4)
+pack_into('=i', destroy_dumb, 0, self.handle)
+ioctl(self.dri_fd, DRM_IOCTL_MODE_DESTROY_DUMB, destroy_dumb)
+close(self.dri_fd)
+
+cdef add_ref(self, obj):
+if isinstance(obj, DmaBufMR):
+self.dmabuf_mrs.add(obj)
+
diff 

[PATCH rdma-core v2 1/6] Update kernel headers

2020-11-24 Thread Jianxin Xiong
To commit 2eef437c4669 ("RDMA/uverbs: Add uverbs command for dma-buf based
MR registration").

Signed-off-by: Jianxin Xiong 
---
 kernel-headers/rdma/ib_user_ioctl_cmds.h | 14 ++
 kernel-headers/rdma/ib_user_verbs.h  | 14 --
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/kernel-headers/rdma/ib_user_ioctl_cmds.h 
b/kernel-headers/rdma/ib_user_ioctl_cmds.h
index 7968a18..dafc7eb 100644
--- a/kernel-headers/rdma/ib_user_ioctl_cmds.h
+++ b/kernel-headers/rdma/ib_user_ioctl_cmds.h
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2018, Mellanox Technologies inc.  All rights reserved.
+ * Copyright (c) 2020, Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -251,6 +252,7 @@ enum uverbs_methods_mr {
UVERBS_METHOD_MR_DESTROY,
UVERBS_METHOD_ADVISE_MR,
UVERBS_METHOD_QUERY_MR,
+   UVERBS_METHOD_REG_DMABUF_MR,
 };
 
 enum uverbs_attrs_mr_destroy_ids {
@@ -272,6 +274,18 @@ enum uverbs_attrs_query_mr_cmd_attr_ids {
UVERBS_ATTR_QUERY_MR_RESP_IOVA,
 };
 
+enum uverbs_attrs_reg_dmabuf_mr_cmd_attr_ids {
+   UVERBS_ATTR_REG_DMABUF_MR_HANDLE,
+   UVERBS_ATTR_REG_DMABUF_MR_PD_HANDLE,
+   UVERBS_ATTR_REG_DMABUF_MR_OFFSET,
+   UVERBS_ATTR_REG_DMABUF_MR_LENGTH,
+   UVERBS_ATTR_REG_DMABUF_MR_IOVA,
+   UVERBS_ATTR_REG_DMABUF_MR_FD,
+   UVERBS_ATTR_REG_DMABUF_MR_ACCESS_FLAGS,
+   UVERBS_ATTR_REG_DMABUF_MR_RESP_LKEY,
+   UVERBS_ATTR_REG_DMABUF_MR_RESP_RKEY,
+};
+
 enum uverbs_attrs_create_counters_cmd_attr_ids {
UVERBS_ATTR_CREATE_COUNTERS_HANDLE,
 };
diff --git a/kernel-headers/rdma/ib_user_verbs.h 
b/kernel-headers/rdma/ib_user_verbs.h
index 456438c..7ee73a0 100644
--- a/kernel-headers/rdma/ib_user_verbs.h
+++ b/kernel-headers/rdma/ib_user_verbs.h
@@ -596,20 +596,6 @@ enum {
IB_UVERBS_CREATE_QP_SUP_COMP_MASK = IB_UVERBS_CREATE_QP_MASK_IND_TABLE,
 };
 
-enum {
-   /*
-* This value is equal to IB_QP_DEST_QPN.
-*/
-   IB_USER_LEGACY_LAST_QP_ATTR_MASK = 1ULL << 20,
-};
-
-enum {
-   /*
-* This value is equal to IB_QP_RATE_LIMIT.
-*/
-   IB_USER_LAST_QP_ATTR_MASK = 1ULL << 25,
-};
-
 struct ib_uverbs_ex_create_qp {
__aligned_u64 user_handle;
__u32 pd_handle;
-- 
1.8.3.1

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


[PATCH rdma-core v2 0/6] Add user space dma-buf support

2020-11-24 Thread Jianxin Xiong
This is the user space counter-part of the kernel patch set to add
dma-buf support to the RDMA subsystem.

This is the second version of the patch series. Most of the issues found
so far in v1 are addressed except for the use of /dev/dri/card* and
dumb_buf for allocating dma-buf object. The current implementation at
least provides a testing setup that works for most GPUs. Alternatives
are being investigated.

Change log:

v2:
* Put the kernel header updates into a separate commit
* Add comments for the data structure used in python ioctl calls
* Fix issues related to symbol versioning
* Fix styling issues: extra spaces, unncecessary variable, typo
* Fix an inproper error code usage
* Put the new op into ibv_context_ops instead if verbs_context

v1: https://www.spinics.net/lists/linux-rdma/msg97865.html
* Add user space API for registering dma-buf based memory regions
* Update pyverbs with the new API
* Add new tests

This series consists of six patches. The first patch updates the
kernel headers for dma-buf support. Patch 2 adds the new API function
and updates the man pages. Patch 3 implements the new API in the mlx5
provider. Patch 3 adds new class definitions to pyverbs for the new API.
Patch 4 adds a set of new tests for the new API. Patch 5 fixes bug in
the utility code of the tests.

Pull request at github: https://github.com/linux-rdma/rdma-core/pull/895

Jianxin Xiong (6):
  Update kernel headers
  verbs: Support dma-buf based memory region
  mlx5: Support dma-buf based memory region
  pyverbs: Add dma-buf based MR support
  tests: Add tests for dma-buf based memory regions
  tests: Bug fix for get_access_flags()

 debian/libibverbs1.symbols   |   2 +
 kernel-headers/rdma/ib_user_ioctl_cmds.h |  14 
 kernel-headers/rdma/ib_user_verbs.h  |  14 
 libibverbs/CMakeLists.txt|   2 +-
 libibverbs/cmd_mr.c  |  38 +
 libibverbs/driver.h  |   7 ++
 libibverbs/dummy_ops.c   |  11 +++
 libibverbs/libibverbs.map.in |   6 ++
 libibverbs/man/ibv_reg_mr.3  |  21 -
 libibverbs/verbs.c   |  17 
 libibverbs/verbs.h   |  11 +++
 providers/mlx5/mlx5.c|   2 +
 providers/mlx5/mlx5.h|   3 +
 providers/mlx5/verbs.c   |  22 ++
 pyverbs/CMakeLists.txt   |   2 +
 pyverbs/dmabuf.pxd   |  13 
 pyverbs/dmabuf.pyx   |  85 
 pyverbs/libibverbs.pxd   |   2 +
 pyverbs/mr.pxd   |   5 ++
 pyverbs/mr.pyx   |  77 +-
 tests/test_mr.py | 130 ++-
 tests/utils.py   |  29 ++-
 22 files changed, 491 insertions(+), 22 deletions(-)
 create mode 100644 pyverbs/dmabuf.pxd
 create mode 100644 pyverbs/dmabuf.pyx

-- 
1.8.3.1

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


[PATCH rdma-core v2 2/6] verbs: Support dma-buf based memory region

2020-11-24 Thread Jianxin Xiong
Add new API function and new provider method for registering dma-buf
based memory region. Update the man page and bump the API version.

Signed-off-by: Jianxin Xiong 
---
 debian/libibverbs1.symbols   |  2 ++
 libibverbs/CMakeLists.txt|  2 +-
 libibverbs/cmd_mr.c  | 38 ++
 libibverbs/driver.h  |  7 +++
 libibverbs/dummy_ops.c   | 11 +++
 libibverbs/libibverbs.map.in |  6 ++
 libibverbs/man/ibv_reg_mr.3  | 21 +++--
 libibverbs/verbs.c   | 17 +
 libibverbs/verbs.h   | 11 +++
 9 files changed, 112 insertions(+), 3 deletions(-)

diff --git a/debian/libibverbs1.symbols b/debian/libibverbs1.symbols
index 9130f41..fcf4d87 100644
--- a/debian/libibverbs1.symbols
+++ b/debian/libibverbs1.symbols
@@ -9,6 +9,7 @@ libibverbs.so.1 libibverbs1 #MINVER#
  IBVERBS_1.9@IBVERBS_1.9 30
  IBVERBS_1.10@IBVERBS_1.10 31
  IBVERBS_1.11@IBVERBS_1.11 32
+ IBVERBS_1.12@IBVERBS_1.12 33
  (symver)IBVERBS_PRIVATE_33 33
  _ibv_query_gid_ex@IBVERBS_1.11 32
  _ibv_query_gid_table@IBVERBS_1.11 32
@@ -99,6 +100,7 @@ libibverbs.so.1 libibverbs1 #MINVER#
  ibv_rate_to_mbps@IBVERBS_1.1 1.1.8
  ibv_rate_to_mult@IBVERBS_1.0 1.1.6
  ibv_read_sysfs_file@IBVERBS_1.0 1.1.6
+ ibv_reg_dmabuf_mr@IBVERBS_1.12 33
  ibv_reg_mr@IBVERBS_1.0 1.1.6
  ibv_reg_mr@IBVERBS_1.1 1.1.6
  ibv_reg_mr_iova@IBVERBS_1.7 25
diff --git a/libibverbs/CMakeLists.txt b/libibverbs/CMakeLists.txt
index 0fe4256..d075225 100644
--- a/libibverbs/CMakeLists.txt
+++ b/libibverbs/CMakeLists.txt
@@ -21,7 +21,7 @@ configure_file("libibverbs.map.in"
 
 rdma_library(ibverbs "${CMAKE_CURRENT_BINARY_DIR}/libibverbs.map"
   # See Documentation/versioning.md
-  1 1.11.${PACKAGE_VERSION}
+  1 1.12.${PACKAGE_VERSION}
   all_providers.c
   cmd.c
   cmd_ah.c
diff --git a/libibverbs/cmd_mr.c b/libibverbs/cmd_mr.c
index 42dbe42..95ed2d1 100644
--- a/libibverbs/cmd_mr.c
+++ b/libibverbs/cmd_mr.c
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2018 Mellanox Technologies, Ltd.  All rights reserved.
+ * Copyright (c) 2020 Intel Corporation.  All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -116,3 +117,40 @@ int ibv_cmd_query_mr(struct ibv_pd *pd, struct verbs_mr 
*vmr,
return 0;
 }
 
+int ibv_cmd_reg_dmabuf_mr(struct ibv_pd *pd, uint64_t offset, size_t length,
+ uint64_t iova, int fd, int access,
+ struct verbs_mr *vmr)
+{
+   DECLARE_COMMAND_BUFFER(cmdb, UVERBS_OBJECT_MR,
+  UVERBS_METHOD_REG_DMABUF_MR,
+  9);
+   struct ib_uverbs_attr *handle;
+   uint32_t lkey, rkey;
+   int ret;
+
+   handle = fill_attr_out_obj(cmdb, UVERBS_ATTR_REG_DMABUF_MR_HANDLE);
+   fill_attr_out_ptr(cmdb, UVERBS_ATTR_REG_DMABUF_MR_RESP_LKEY, );
+   fill_attr_out_ptr(cmdb, UVERBS_ATTR_REG_DMABUF_MR_RESP_RKEY, );
+
+   fill_attr_in_obj(cmdb, UVERBS_ATTR_REG_DMABUF_MR_PD_HANDLE, pd->handle);
+   fill_attr_in_uint64(cmdb, UVERBS_ATTR_REG_DMABUF_MR_OFFSET, offset);
+   fill_attr_in_uint64(cmdb, UVERBS_ATTR_REG_DMABUF_MR_LENGTH, length);
+   fill_attr_in_uint64(cmdb, UVERBS_ATTR_REG_DMABUF_MR_IOVA, iova);
+   fill_attr_in_uint32(cmdb, UVERBS_ATTR_REG_DMABUF_MR_FD, fd);
+   fill_attr_in_uint32(cmdb, UVERBS_ATTR_REG_DMABUF_MR_ACCESS_FLAGS, 
access);
+
+   ret = execute_ioctl(pd->context, cmdb);
+   if (ret)
+   return errno;
+
+   vmr->ibv_mr.handle = read_attr_obj(UVERBS_ATTR_REG_DMABUF_MR_HANDLE,
+  handle);
+   vmr->ibv_mr.context = pd->context;
+   vmr->ibv_mr.lkey = lkey;
+   vmr->ibv_mr.rkey = rkey;
+   vmr->ibv_mr.pd = pd;
+   vmr->ibv_mr.addr = (void *)offset;
+   vmr->ibv_mr.length = length;
+   vmr->mr_type = IBV_MR_TYPE_MR;
+   return 0;
+}
diff --git a/libibverbs/driver.h b/libibverbs/driver.h
index ab80f4b..d6a9d0a 100644
--- a/libibverbs/driver.h
+++ b/libibverbs/driver.h
@@ -2,6 +2,7 @@
  * Copyright (c) 2004, 2005 Topspin Communications.  All rights reserved.
  * Copyright (c) 2005, 2006 Cisco Systems, Inc.  All rights reserved.
  * Copyright (c) 2005 PathScale, Inc.  All rights reserved.
+ * Copyright (c) 2020 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -373,6 +374,9 @@ struct verbs_context_ops {
struct ibv_mr *(*reg_dm_mr)(struct ibv_pd *pd, struct ibv_dm *dm,
uint64_t dm_offset, size_t length,
unsigned int access);
+   struct ibv_mr *(*reg_dmabuf_mr)(struct ibv_pd *pd, uint64_t offset,
+   size_t length, uint64_t iova,
+   int fd, 

[PATCH rdma-core v2 6/6] tests: Bug fix for get_access_flags()

2020-11-24 Thread Jianxin Xiong
The filter definition is wrong and causes get_access_flags() always
returning empty list. As the result the MR tests using this function
are effectively skipped (but report success).

Signed-off-by: Jianxin Xiong 
---
 tests/utils.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/utils.py b/tests/utils.py
index 0ad7110..9ff2603 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -55,8 +55,8 @@ def filter_illegal_access_flags(element):
 :param element: A list of access flags to check
 :return: True if this list is legal, else False
 """
-if e.IBV_ACCESS_REMOTE_ATOMIC in element or e.IBV_ACCESS_REMOTE_WRITE:
-if e.IBV_ACCESS_LOCAL_WRITE:
+if e.IBV_ACCESS_REMOTE_ATOMIC in element or e.IBV_ACCESS_REMOTE_WRITE in 
element:
+if not e.IBV_ACCESS_LOCAL_WRITE in element:
 return False
 return True
 
-- 
1.8.3.1

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


[PATCH rdma-core v2 5/6] tests: Add tests for dma-buf based memory regions

2020-11-24 Thread Jianxin Xiong
Define a full set of tests similar to regular MR tests. Add a utility
function to generate access flags for dma-buf based MRs because the
set of supported flags is smaller.

Signed-off-by: Jianxin Xiong 
---
 tests/test_mr.py | 130 ++-
 tests/utils.py   |  25 +++
 2 files changed, 154 insertions(+), 1 deletion(-)

diff --git a/tests/test_mr.py b/tests/test_mr.py
index adc649c..8d7f002 100644
--- a/tests/test_mr.py
+++ b/tests/test_mr.py
@@ -9,9 +9,10 @@ import errno
 
 from tests.base import PyverbsAPITestCase, RCResources, RDMATestCase
 from pyverbs.pyverbs_error import PyverbsRDMAError, PyverbsError
-from pyverbs.mr import MR, MW, DMMR, MWBindInfo, MWBind
+from pyverbs.mr import MR, MW, DMMR, DmaBufMR, MWBindInfo, MWBind
 from pyverbs.qp import QPCap, QPInitAttr, QPAttr, QP
 from pyverbs.wr import SendWR
+from pyverbs.dmabuf import DmaBuf
 import pyverbs.device as d
 from pyverbs.pd import PD
 import pyverbs.enums as e
@@ -366,3 +367,130 @@ class DMMRTest(PyverbsAPITestCase):
 dm_mr = DMMR(pd, dm_mr_len, e.IBV_ACCESS_ZERO_BASED,
  dm=dm, offset=dm_mr_offset)
 dm_mr.close()
+
+class DmaBufMRTest(PyverbsAPITestCase):
+"""
+Test various functionalities of the DmaBufMR class.
+"""
+def test_dmabuf_reg_mr(self):
+"""
+Test ibv_reg_dmabuf_mr()
+"""
+for ctx, attr, attr_ex in self.devices:
+with PD(ctx) as pd:
+flags = u.get_dmabuf_access_flags(ctx)
+for f in flags:
+len = u.get_mr_length()
+off = random.randint(0, len//2)
+with DmaBufMR(pd, len, f, offset=off) as mr:
+pass
+
+def test_dmabuf_dereg_mr(self):
+"""
+Test ibv_dereg_mr() with DmaBufMR
+"""
+for ctx, attr, attr_ex in self.devices:
+with PD(ctx) as pd:
+flags = u.get_dmabuf_access_flags(ctx)
+for f in flags:
+len = u.get_mr_length()
+off = random.randint(0, len//2)
+with DmaBufMR(pd, len, f, offset=off) as mr:
+mr.close()
+
+def test_dmabuf_dereg_mr_twice(self):
+"""
+Verify that explicit call to DmaBufMR's close() doesn't fail
+"""
+for ctx, attr, attr_ex in self.devices:
+with PD(ctx) as pd:
+flags = u.get_dmabuf_access_flags(ctx)
+for f in flags:
+len = u.get_mr_length()
+off = random.randint(0, len//2)
+with DmaBufMR(pd, len, f, offset=off) as mr:
+# Pyverbs supports multiple destruction of objects,
+# we are not expecting an exception here.
+mr.close()
+mr.close()
+
+def test_dmabuf_reg_mr_bad_flags(self):
+"""
+Verify that illegal flags combination fails as expected
+"""
+for ctx, attr, attr_ex in self.devices:
+with PD(ctx) as pd:
+for i in range(5):
+flags = random.sample([e.IBV_ACCESS_REMOTE_WRITE,
+   e.IBV_ACCESS_REMOTE_ATOMIC],
+  random.randint(1, 2))
+mr_flags = 0
+for i in flags:
+mr_flags += i.value
+try:
+DmaBufMR(pd, u.get_mr_length(), mr_flags)
+except PyverbsRDMAError as err:
+assert 'Failed to register a dma-buf MR' in err.args[0]
+else:
+raise PyverbsRDMAError('Registered a dma-buf MR with 
illegal falgs')
+
+def test_dmabuf_write(self):
+"""
+Test writing to DmaBufMR's buffer
+"""
+for ctx, attr, attr_ex in self.devices:
+with PD(ctx) as pd:
+for i in range(10):
+mr_len = u.get_mr_length()
+mr_off = random.randint(0, mr_len//2)
+flags = u.get_dmabuf_access_flags(ctx)
+for f in flags:
+with DmaBufMR(pd, mr_len, f, offset=mr_off) as mr:
+write_len = min(random.randint(1, MAX_IO_LEN),
+mr_len)
+mr.write('a' * write_len, write_len)
+
+def test_dmabuf_read(self):
+"""
+Test reading from DmaBufMR's buffer
+"""
+for ctx, attr, attr_ex in self.devices:
+with PD(ctx) as pd:
+for i in range(10):
+mr_len = u.get_mr_length()
+mr_off = random.randint(0, mr_len//2)
+flags = 

[PATCH v12 4/4] RDMA/mlx5: Support dma-buf based userspace memory region

2020-11-24 Thread Jianxin Xiong
Implement the new driver method 'reg_user_mr_dmabuf'.  Utilize the core
functions to import dma-buf based memory region and update the mappings.

Add code to handle dma-buf related page fault.

Signed-off-by: Jianxin Xiong 
Reviewed-by: Sean Hefty 
Acked-by: Michael J. Ruhl 
Acked-by: Christian Koenig 
Acked-by: Daniel Vetter 
---
 drivers/infiniband/hw/mlx5/main.c|   2 +
 drivers/infiniband/hw/mlx5/mlx5_ib.h |  18 
 drivers/infiniband/hw/mlx5/mr.c  | 128 +--
 drivers/infiniband/hw/mlx5/odp.c |  86 +-
 4 files changed, 225 insertions(+), 9 deletions(-)

diff --git a/drivers/infiniband/hw/mlx5/main.c 
b/drivers/infiniband/hw/mlx5/main.c
index 36b15a063e68..e647ea4bf9ce 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
 /*
  * Copyright (c) 2013-2020, Mellanox Technologies inc. All rights reserved.
+ * Copyright (c) 2020, Intel Corporation. All rights reserved.
  */
 
 #include 
@@ -4055,6 +4056,7 @@ static const struct ib_device_ops mlx5_ib_dev_ops = {
.query_srq = mlx5_ib_query_srq,
.query_ucontext = mlx5_ib_query_ucontext,
.reg_user_mr = mlx5_ib_reg_user_mr,
+   .reg_user_mr_dmabuf = mlx5_ib_reg_user_mr_dmabuf,
.req_notify_cq = mlx5_ib_arm_cq,
.rereg_user_mr = mlx5_ib_rereg_user_mr,
.resize_cq = mlx5_ib_resize_cq,
diff --git a/drivers/infiniband/hw/mlx5/mlx5_ib.h 
b/drivers/infiniband/hw/mlx5/mlx5_ib.h
index bb44080170be..3ef6872fa258 100644
--- a/drivers/infiniband/hw/mlx5/mlx5_ib.h
+++ b/drivers/infiniband/hw/mlx5/mlx5_ib.h
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
 /*
  * Copyright (c) 2013-2020, Mellanox Technologies inc. All rights reserved.
+ * Copyright (c) 2020, Intel Corporation. All rights reserved.
  */
 
 #ifndef MLX5_IB_H
@@ -665,6 +666,12 @@ static inline bool is_odp_mr(struct mlx5_ib_mr *mr)
   mr->umem->is_odp;
 }
 
+static inline bool is_dmabuf_mr(struct mlx5_ib_mr *mr)
+{
+   return IS_ENABLED(CONFIG_INFINIBAND_ON_DEMAND_PAGING) && mr->umem &&
+  mr->umem->is_dmabuf;
+}
+
 struct mlx5_ib_mw {
struct ib_mwibmw;
struct mlx5_core_mkey   mmkey;
@@ -1200,6 +1207,10 @@ struct ib_mr *mlx5_ib_get_dma_mr(struct ib_pd *pd, int 
acc);
 struct ib_mr *mlx5_ib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
  u64 virt_addr, int access_flags,
  struct ib_udata *udata);
+struct ib_mr *mlx5_ib_reg_user_mr_dmabuf(struct ib_pd *pd, u64 start,
+u64 length, u64 virt_addr,
+int fd, int access_flags,
+struct ib_udata *udata);
 int mlx5_ib_advise_mr(struct ib_pd *pd,
  enum ib_uverbs_advise_mr_advice advice,
  u32 flags,
@@ -1210,11 +1221,13 @@ int mlx5_ib_alloc_mw(struct ib_mw *mw, struct ib_udata 
*udata);
 int mlx5_ib_dealloc_mw(struct ib_mw *mw);
 int mlx5_ib_update_xlt(struct mlx5_ib_mr *mr, u64 idx, int npages,
   int page_shift, int flags);
+int mlx5_ib_update_mr_pas(struct mlx5_ib_mr *mr, unsigned int flags);
 struct mlx5_ib_mr *mlx5_ib_alloc_implicit_mr(struct mlx5_ib_pd *pd,
 struct ib_udata *udata,
 int access_flags);
 void mlx5_ib_free_implicit_mr(struct mlx5_ib_mr *mr);
 void mlx5_ib_fence_odp_mr(struct mlx5_ib_mr *mr);
+void mlx5_ib_fence_dmabuf_mr(struct mlx5_ib_mr *mr);
 int mlx5_ib_rereg_user_mr(struct ib_mr *ib_mr, int flags, u64 start,
  u64 length, u64 virt_addr, int access_flags,
  struct ib_pd *pd, struct ib_udata *udata);
@@ -1306,6 +1319,7 @@ int mlx5_ib_advise_mr_prefetch(struct ib_pd *pd,
   enum ib_uverbs_advise_mr_advice advice,
   u32 flags, struct ib_sge *sg_list, u32 num_sge);
 int mlx5_ib_init_odp_mr(struct mlx5_ib_mr *mr, bool enable);
+int mlx5_ib_init_dmabuf_mr(struct mlx5_ib_mr *mr);
 #else /* CONFIG_INFINIBAND_ON_DEMAND_PAGING */
 static inline void mlx5_ib_internal_fill_odp_caps(struct mlx5_ib_dev *dev)
 {
@@ -1331,6 +1345,10 @@ static inline int mlx5_ib_init_odp_mr(struct mlx5_ib_mr 
*mr, bool enable)
 {
return -EOPNOTSUPP;
 }
+static inline int mlx5_ib_init_dmabuf_mr(struct mlx5_ib_mr *mr)
+{
+   return -EOPNOTSUPP;
+}
 #endif /* CONFIG_INFINIBAND_ON_DEMAND_PAGING */
 
 extern const struct mmu_interval_notifier_ops mlx5_mn_ops;
diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c
index 9f653b4a5438..4551d41596f9 100644
--- a/drivers/infiniband/hw/mlx5/mr.c
+++ b/drivers/infiniband/hw/mlx5/mr.c
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved.
+ * Copyright (c) 

[PATCH v12 1/4] RDMA/umem: Support importing dma-buf as user memory region

2020-11-24 Thread Jianxin Xiong
Dma-buf is a standard cross-driver buffer sharing mechanism that can be
used to support peer-to-peer access from RDMA devices.

Device memory exported via dma-buf is associated with a file descriptor.
This is passed to the user space as a property associated with the
buffer allocation. When the buffer is registered as a memory region,
the file descriptor is passed to the RDMA driver along with other
parameters.

Implement the common code for importing dma-buf object and mapping
dma-buf pages.

Signed-off-by: Jianxin Xiong 
Reviewed-by: Sean Hefty 
Acked-by: Michael J. Ruhl 
Acked-by: Christian Koenig 
Acked-by: Daniel Vetter 
---
 drivers/infiniband/core/Makefile  |   2 +-
 drivers/infiniband/core/umem.c|   3 +
 drivers/infiniband/core/umem_dmabuf.c | 173 ++
 include/rdma/ib_umem.h|  41 +-
 4 files changed, 217 insertions(+), 2 deletions(-)
 create mode 100644 drivers/infiniband/core/umem_dmabuf.c

diff --git a/drivers/infiniband/core/Makefile b/drivers/infiniband/core/Makefile
index ccf2670ef45e..8ab4eea5a0a5 100644
--- a/drivers/infiniband/core/Makefile
+++ b/drivers/infiniband/core/Makefile
@@ -40,5 +40,5 @@ ib_uverbs-y :=uverbs_main.o 
uverbs_cmd.o uverbs_marshall.o \
uverbs_std_types_srq.o \
uverbs_std_types_wq.o \
uverbs_std_types_qp.o
-ib_uverbs-$(CONFIG_INFINIBAND_USER_MEM) += umem.o
+ib_uverbs-$(CONFIG_INFINIBAND_USER_MEM) += umem.o umem_dmabuf.o
 ib_uverbs-$(CONFIG_INFINIBAND_ON_DEMAND_PAGING) += umem_odp.o
diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c
index f1fc7e39c782..a025ce831076 100644
--- a/drivers/infiniband/core/umem.c
+++ b/drivers/infiniband/core/umem.c
@@ -2,6 +2,7 @@
  * Copyright (c) 2005 Topspin Communications.  All rights reserved.
  * Copyright (c) 2005 Cisco Systems.  All rights reserved.
  * Copyright (c) 2005 Mellanox Technologies. All rights reserved.
+ * Copyright (c) 2020 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -278,6 +279,8 @@ void ib_umem_release(struct ib_umem *umem)
 {
if (!umem)
return;
+   if (umem->is_dmabuf)
+   return ib_umem_dmabuf_release(to_ib_umem_dmabuf(umem));
if (umem->is_odp)
return ib_umem_odp_release(to_ib_umem_odp(umem));
 
diff --git a/drivers/infiniband/core/umem_dmabuf.c 
b/drivers/infiniband/core/umem_dmabuf.c
new file mode 100644
index ..e50b9846
--- /dev/null
+++ b/drivers/infiniband/core/umem_dmabuf.c
@@ -0,0 +1,173 @@
+// SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
+/*
+ * Copyright (c) 2020 Intel Corporation. All rights reserved.
+ */
+
+#include 
+#include 
+#include 
+
+#include "uverbs.h"
+
+int ib_umem_dmabuf_map_pages(struct ib_umem_dmabuf *umem_dmabuf)
+{
+   struct sg_table *sgt;
+   struct scatterlist *sg;
+   struct dma_fence *fence;
+   unsigned long start, end, cur;
+   unsigned int nmap;
+   int i;
+
+   dma_resv_assert_held(umem_dmabuf->attach->dmabuf->resv);
+
+   if (umem_dmabuf->sgt)
+   return 0;
+
+   sgt = dma_buf_map_attachment(umem_dmabuf->attach, DMA_BIDIRECTIONAL);
+   if (IS_ERR(sgt))
+   return PTR_ERR(sgt);
+
+   /* modify the sg list in-place to match umem address and length */
+
+   start = ALIGN_DOWN(umem_dmabuf->umem.address, PAGE_SIZE);
+   end = ALIGN(umem_dmabuf->umem.address + umem_dmabuf->umem.length,
+   PAGE_SIZE);
+   cur = 0;
+   nmap = 0;
+   for_each_sgtable_dma_sg(sgt, sg, i) {
+   if (start < cur + sg_dma_len(sg) && cur < end)
+   nmap++;
+   if (cur <= start && start < cur + sg_dma_len(sg)) {
+   unsigned long offset = start - cur;
+
+   umem_dmabuf->first_sg = sg;
+   umem_dmabuf->first_sg_offset = offset;
+   sg_dma_address(sg) += offset;
+   sg_dma_len(sg) -= offset;
+   cur += offset;
+   }
+   if (cur < end && end <= cur + sg_dma_len(sg)) {
+   unsigned long trim = cur + sg_dma_len(sg) - end;
+
+   umem_dmabuf->last_sg = sg;
+   umem_dmabuf->last_sg_trim = trim;
+   sg_dma_len(sg) -= trim;
+   break;
+   }
+   cur += sg_dma_len(sg);
+   }
+
+   umem_dmabuf->umem.sg_head.sgl = umem_dmabuf->first_sg;
+   umem_dmabuf->umem.sg_head.nents = nmap;
+   umem_dmabuf->umem.nmap = nmap;
+   umem_dmabuf->sgt = sgt;
+
+   /*
+* Although the sg list is valid now, the content of the pages
+* may be not up-to-date. Wait for the 

[PATCH v12 3/4] RDMA/uverbs: Add uverbs command for dma-buf based MR registration

2020-11-24 Thread Jianxin Xiong
Implement a new uverbs ioctl method for memory registration with file
descriptor as an extra parameter.

Signed-off-by: Jianxin Xiong 
Reviewed-by: Sean Hefty 
Acked-by: Michael J. Ruhl 
Acked-by: Christian Koenig 
Acked-by: Daniel Vetter 
---
 drivers/infiniband/core/uverbs_std_types_mr.c | 114 +-
 include/uapi/rdma/ib_user_ioctl_cmds.h|  14 +++
 2 files changed, 126 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/core/uverbs_std_types_mr.c 
b/drivers/infiniband/core/uverbs_std_types_mr.c
index 9b22bb553e8b..e9028ea5b321 100644
--- a/drivers/infiniband/core/uverbs_std_types_mr.c
+++ b/drivers/infiniband/core/uverbs_std_types_mr.c
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2018, Mellanox Technologies inc.  All rights reserved.
+ * Copyright (c) 2020, Intel Corporation.  All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -178,6 +179,83 @@ static int UVERBS_HANDLER(UVERBS_METHOD_QUERY_MR)(
return IS_UVERBS_COPY_ERR(ret) ? ret : 0;
 }
 
+static int UVERBS_HANDLER(UVERBS_METHOD_REG_DMABUF_MR)(
+   struct uverbs_attr_bundle *attrs)
+{
+   struct ib_uobject *uobj =
+   uverbs_attr_get_uobject(attrs, 
UVERBS_ATTR_REG_DMABUF_MR_HANDLE);
+   struct ib_pd *pd =
+   uverbs_attr_get_obj(attrs, UVERBS_ATTR_REG_DMABUF_MR_PD_HANDLE);
+   struct ib_device *ib_dev = pd->device;
+
+   u64 offset, length, virt_addr;
+   u32 fd, access_flags;
+   struct ib_mr *mr;
+   int ret;
+
+   if (!ib_dev->ops.reg_user_mr_dmabuf)
+   return -EOPNOTSUPP;
+
+   ret = uverbs_copy_from(, attrs,
+  UVERBS_ATTR_REG_DMABUF_MR_OFFSET);
+   if (ret)
+   return ret;
+
+   ret = uverbs_copy_from(, attrs,
+  UVERBS_ATTR_REG_DMABUF_MR_LENGTH);
+   if (ret)
+   return ret;
+
+   ret = uverbs_copy_from(_addr, attrs,
+  UVERBS_ATTR_REG_DMABUF_MR_IOVA);
+   if (ret)
+   return ret;
+
+   ret = uverbs_copy_from(, attrs,
+  UVERBS_ATTR_REG_DMABUF_MR_FD);
+   if (ret)
+   return ret;
+
+   ret = uverbs_get_flags32(_flags, attrs,
+UVERBS_ATTR_REG_DMABUF_MR_ACCESS_FLAGS,
+IB_ACCESS_LOCAL_WRITE |
+IB_ACCESS_REMOTE_READ |
+IB_ACCESS_REMOTE_WRITE |
+IB_ACCESS_REMOTE_ATOMIC |
+IB_ACCESS_RELAXED_ORDERING);
+   if (ret)
+   return ret;
+
+   ret = ib_check_mr_access(access_flags);
+   if (ret)
+   return ret;
+
+   mr = pd->device->ops.reg_user_mr_dmabuf(pd, offset, length, virt_addr,
+   fd, access_flags,
+   >driver_udata);
+   if (IS_ERR(mr))
+   return PTR_ERR(mr);
+
+   mr->device = pd->device;
+   mr->pd = pd;
+   mr->type = IB_MR_TYPE_USER;
+   mr->uobject = uobj;
+   atomic_inc(>usecnt);
+
+   uobj->object = mr;
+
+   uverbs_finalize_uobj_create(attrs, UVERBS_ATTR_REG_DMABUF_MR_HANDLE);
+
+   ret = uverbs_copy_to(attrs, UVERBS_ATTR_REG_DMABUF_MR_RESP_LKEY,
+>lkey, sizeof(mr->lkey));
+   if (ret)
+   return ret;
+
+   ret = uverbs_copy_to(attrs, UVERBS_ATTR_REG_DMABUF_MR_RESP_RKEY,
+>rkey, sizeof(mr->rkey));
+   return ret;
+}
+
 DECLARE_UVERBS_NAMED_METHOD(
UVERBS_METHOD_ADVISE_MR,
UVERBS_ATTR_IDR(UVERBS_ATTR_ADVISE_MR_PD_HANDLE,
@@ -243,6 +321,37 @@ DECLARE_UVERBS_NAMED_METHOD(
UVERBS_ATTR_TYPE(u32),
UA_MANDATORY));
 
+DECLARE_UVERBS_NAMED_METHOD(
+   UVERBS_METHOD_REG_DMABUF_MR,
+   UVERBS_ATTR_IDR(UVERBS_ATTR_REG_DMABUF_MR_HANDLE,
+   UVERBS_OBJECT_MR,
+   UVERBS_ACCESS_NEW,
+   UA_MANDATORY),
+   UVERBS_ATTR_IDR(UVERBS_ATTR_REG_DMABUF_MR_PD_HANDLE,
+   UVERBS_OBJECT_PD,
+   UVERBS_ACCESS_READ,
+   UA_MANDATORY),
+   UVERBS_ATTR_PTR_IN(UVERBS_ATTR_REG_DMABUF_MR_OFFSET,
+  UVERBS_ATTR_TYPE(u64),
+  UA_MANDATORY),
+   UVERBS_ATTR_PTR_IN(UVERBS_ATTR_REG_DMABUF_MR_LENGTH,
+  UVERBS_ATTR_TYPE(u64),
+  UA_MANDATORY),
+   UVERBS_ATTR_PTR_IN(UVERBS_ATTR_REG_DMABUF_MR_IOVA,
+  UVERBS_ATTR_TYPE(u64),
+  UA_MANDATORY),
+   UVERBS_ATTR_PTR_IN(UVERBS_ATTR_REG_DMABUF_MR_FD,
+  UVERBS_ATTR_TYPE(u32),
+  

[PATCH v12 0/4] RDMA: Add dma-buf support

2020-11-24 Thread Jianxin Xiong
This is the twelfth version of the patch set. Changelog:

v12:
* Move the prototype of function ib_umem_dmabuf_release() to ib_umem.h
  and remove umem_dmabuf.h
* Break a line that is too long

v11: https://www.spinics.net/lists/linux-rdma/msg97860.html
* Rework the parameter checking code inside ib_umem_dmabuf_get() 
* Fix incorrect error handling in the new verbs command handler
* Put a duplicated code sequence for checking iova and setting page size
  into a function
* In the invalidation callback, check for if the buffer has been mapped
  and thus the presence of a valid driver mr is ensured
* The patch that checks for dma_virt_ops is dropped because it is no
  longer needed
* The patch that documents that dma-buf size is fixed has landed at:
  https://cgit.freedesktop.org/drm/drm-misc/commit/?id=476b485be03c
  and thus is no longer included here
* The matching user space patch set is sent separately

v10: https://www.spinics.net/lists/linux-rdma/msg97483.html
* Don't map the pages in ib_umem_dmabuf_get(); use the size information
  of the dma-buf object to validate the umem size instead
* Use PAGE_SIZE directly instead of use ib_umem_find_best_pgsz() when
  the MR is created since the pages have not been mapped yet and dma-buf
  requires PAGE_SIZE anyway
* Always call mlx5_umem_find_best_pgsz() after mapping the pages to
  verify that the page size requirement is satisfied
* Add a patch to document that dma-buf size is fixed

v9: https://www.spinics.net/lists/linux-rdma/msg97432.html
* Clean up the code for sg list in-place modification
* Prevent dma-buf pages from being mapped multiple times
* Map the pages in ib_umem_dmabuf_get() so that inproper values of
  address/length/iova can be caught early
* Check for unsupported flags in the new uverbs command
* Add missing uverbs_finalize_uobj_create()
* Sort uverbs objects by name
* Fix formating issue -- unnecessary alignment of '='
* Unmap pages in mlx5_ib_fence_dmabuf_mr()
* Remove address range checking from pagefault_dmabuf_mr()

v8: https://www.spinics.net/lists/linux-rdma/msg97370.html
* Modify the dma-buf sg list in place to get a proper umem sg list and
  restore it before calling dma_buf_unmap_attachment()
* Validate the umem sg list with ib_umem_find_best_pgsz()
* Remove the logic for slicing the sg list at runtime

v7: https://www.spinics.net/lists/linux-rdma/msg97297.html
* Rebase on top of latest mlx5 MR patch series
* Slice dma-buf sg list at runtime instead of creating a new list
* Preload the buffer page mapping when the MR is created
* Move the 'dma_virt_ops' check into dma_buf_dynamic_attach()

v6: https://www.spinics.net/lists/linux-rdma/msg96923.html
* Move the dma-buf invalidation callback from the core to the device
  driver
* Move mapping update from work queue to pagefault handler
* Add dma-buf based MRs to the xarray of mmkeys so that the pagefault
  handler can be reached
* Update the new driver method and uverbs command signature by changing
  the paramter 'addr' to 'offset'
* Modify the sg list returned from dma_buf_map_attachment() based on
  the parameters 'offset' and 'length'
* Don't import dma-buf if 'dma_virt_ops' is used by the dma device
* The patch that clarifies dma-buf sg lists alignment has landed at
  https://cgit.freedesktop.org/drm/drm-misc/commit/?id=ac80cd17a615
  and thus is no longer included with this set

v5: https://www.spinics.net/lists/linux-rdma/msg96786.html
* Fix a few warnings reported by kernel test robot:
- no previous prototype for function 'ib_umem_dmabuf_release' 
- no previous prototype for function 'ib_umem_dmabuf_map_pages'
- comparison of distinct pointer types in 'check_add_overflow'
* Add comment for the wait between getting the dma-buf sg tagle and
  updating the NIC page table

v4: https://www.spinics.net/lists/linux-rdma/msg96767.html
* Add a new ib_device method reg_user_mr_dmabuf() instead of expanding
  the existing method reg_user_mr()
* Use a separate code flow for dma-buf instead of adding special cases
  to the ODP memory region code path
* In invalidation callback, new mapping is updated as whole using work
  queue instead of being updated in page granularity in the page fault
  handler
* Use dma_resv_get_excl() and dma_fence_wait() to ensure the content of
  the pages have been moved to the new location before the new mapping
  is programmed into the NIC
* Add code to the ODP page fault handler to check the mapping status
* The new access flag added in v3 is removed.
* The checking for on-demand paging support in the new uverbs command
  is removed because it is implied by implementing the new ib_device
  method
* Clarify that dma-buf sg lists are page aligned

v3: https://www.spinics.net/lists/linux-rdma/msg96330.html
* Use dma_buf_dynamic_attach() instead of dma_buf_attach()
* Use on-demand paging mechanism to avoid pinning the GPU memory
* Instead of adding a new parameter to the device method for memory
  registration, pass all the attributes including the 

[PATCH v12 2/4] RDMA/core: Add device method for registering dma-buf based memory region

2020-11-24 Thread Jianxin Xiong
Dma-buf based memory region requires one extra parameter and is processed
quite differently. Adding a separate method allows clean separation from
regular memory regions.

Signed-off-by: Jianxin Xiong 
Reviewed-by: Sean Hefty 
Acked-by: Michael J. Ruhl 
Acked-by: Christian Koenig 
Acked-by: Daniel Vetter 
---
 drivers/infiniband/core/device.c | 1 +
 include/rdma/ib_verbs.h  | 6 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index ce26564d4edf..6768a193ca41 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -2689,6 +2689,7 @@ void ib_set_device_ops(struct ib_device *dev, const 
struct ib_device_ops *ops)
SET_DEVICE_OP(dev_ops, read_counters);
SET_DEVICE_OP(dev_ops, reg_dm_mr);
SET_DEVICE_OP(dev_ops, reg_user_mr);
+   SET_DEVICE_OP(dev_ops, reg_user_mr_dmabuf);
SET_DEVICE_OP(dev_ops, req_ncomp_notif);
SET_DEVICE_OP(dev_ops, req_notify_cq);
SET_DEVICE_OP(dev_ops, rereg_user_mr);
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 9420827d2421..3d1d0982da41 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -2,7 +2,7 @@
 /*
  * Copyright (c) 2004 Mellanox Technologies Ltd.  All rights reserved.
  * Copyright (c) 2004 Infinicon Corporation.  All rights reserved.
- * Copyright (c) 2004 Intel Corporation.  All rights reserved.
+ * Copyright (c) 2004, 2020 Intel Corporation.  All rights reserved.
  * Copyright (c) 2004 Topspin Corporation.  All rights reserved.
  * Copyright (c) 2004 Voltaire Corporation.  All rights reserved.
  * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
@@ -2433,6 +2433,10 @@ struct ib_device_ops {
struct ib_mr *(*reg_user_mr)(struct ib_pd *pd, u64 start, u64 length,
 u64 virt_addr, int mr_access_flags,
 struct ib_udata *udata);
+   struct ib_mr *(*reg_user_mr_dmabuf)(struct ib_pd *pd, u64 offset,
+u64 length, u64 virt_addr, int fd,
+int mr_access_flags,
+struct ib_udata *udata);
int (*rereg_user_mr)(struct ib_mr *mr, int flags, u64 start, u64 length,
 u64 virt_addr, int mr_access_flags,
 struct ib_pd *pd, struct ib_udata *udata);
-- 
2.29.2

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


RE: [PATCH rdma-core 5/5] tests: Bug fix for get_access_flags()

2020-11-24 Thread Xiong, Jianxin
> -Original Message-
> From: John Hubbard 
> Sent: Tuesday, November 24, 2020 12:27 PM
> To: Xiong, Jianxin ; linux-r...@vger.kernel.org; 
> dri-devel@lists.freedesktop.org
> Cc: Doug Ledford ; Jason Gunthorpe ; Leon 
> Romanovsky ; Sumit Semwal
> ; Christian Koenig ; 
> Vetter, Daniel 
> Subject: Re: [PATCH rdma-core 5/5] tests: Bug fix for get_access_flags()
> 
> Just some silly nits I stumbled across while trying to understand the tests.
> 
> On 11/23/20 9:53 AM, Jianxin Xiong wrote:
> > The filter defintion is wrong and causes get_access_flags() always
> 
>   definition

Thanks.

> 
> > returning empty list. As the result the MR tests using this function
> > are effectively skipped (but report success).
> >
> > Also fix a typo in the comments.
> 
> Was there another typo somewhere? All I see is an *added* typo...
> 
> >
> > Signed-off-by: Jianxin Xiong 
> > ---
> >   tests/utils.py | 6 +++---
> >   1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/tests/utils.py b/tests/utils.py index 0ad7110..eee44b4
> > 100644
> > --- a/tests/utils.py
> > +++ b/tests/utils.py
> > @@ -55,8 +55,8 @@ def filter_illegal_access_flags(element):
> >   :param element: A list of access flags to check
> >   :return: True if this list is legal, else False
> >   """
> > -if e.IBV_ACCESS_REMOTE_ATOMIC in element or e.IBV_ACCESS_REMOTE_WRITE:
> > -if e.IBV_ACCESS_LOCAL_WRITE:
> > +if e.IBV_ACCESS_REMOTE_ATOMIC in element or e.IBV_ACCESS_REMOTE_WRITE 
> > in element:
> > +if not e.IBV_ACCESS_LOCAL_WRITE in element:
> >   return False
> >   return True
> >
> > @@ -69,7 +69,7 @@ def get_access_flags(ctx):
> >   added as well.
> >   After verifying that the flags selection is legal, it is appended to 
> > an
> >   array, assuming it wasn't previously appended.
> > -:param ctx: Device Context to check capabilities
> > +:param ctx: Device Coyyntext to check capabilities
> 
> I liked the old spelling. "Coyyntext" just doesn't sound as good. :)

Hmm, I don't know what happened  I was seeing the other way around.

> 
> >   :param num: Size of initial collection
> >   :return: A random legal value for MR flags
> >   """
> >
> 
> thanks,
> --
> John Hubbard
> NVIDIA
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v4 55/80] drm/panel: panel-dsi-cm: use MIPI_DCS_GET_ERROR_COUNT_ON_DSI

2020-11-24 Thread Tomi Valkeinen
Hi Sam,

On 24/11/2020 18:18, Sam Ravnborg wrote:
> Hi Tomi,
> 
> On Tue, Nov 24, 2020 at 02:45:13PM +0200, Tomi Valkeinen wrote:
>> Use the common MIPI_DCS_GET_ERROR_COUNT_ON_DSI define instead of
>> driver's own.
>>
> They are both 5 - OK
> 
>> Signed-off-by: Tomi Valkeinen 
> Reviewed-by: Sam Ravnborg 
> 
> IMO you should get all the patches at least up including this patch applied.
> They are all reviewed/acked. And then you have a much smaller stack of
> patches to spam us with.

Yes, I think that makes sense. I did not want to merge them earlier, as with 
the v3, I could not get
videomode panels work at all (while cmd mode panels did work). So I was not 
sure if something is
totally silly and broken in the series.

Now that I can get video mode panels work with some hacks on top, I'm fine with 
merging these.

But it's too late for 5.11, as we need testing and work on the video mode 
panels. So targeting 5.12.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH rdma-core 5/5] tests: Bug fix for get_access_flags()

2020-11-24 Thread John Hubbard

Just some silly nits I stumbled across while trying to understand the tests.

On 11/23/20 9:53 AM, Jianxin Xiong wrote:

The filter defintion is wrong and causes get_access_flags() always


 definition


returning empty list. As the result the MR tests using this function
are effectively skipped (but report success).

Also fix a typo in the comments.


Was there another typo somewhere? All I see is an *added* typo...



Signed-off-by: Jianxin Xiong 
---
  tests/utils.py | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/utils.py b/tests/utils.py
index 0ad7110..eee44b4 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -55,8 +55,8 @@ def filter_illegal_access_flags(element):
  :param element: A list of access flags to check
  :return: True if this list is legal, else False
  """
-if e.IBV_ACCESS_REMOTE_ATOMIC in element or e.IBV_ACCESS_REMOTE_WRITE:
-if e.IBV_ACCESS_LOCAL_WRITE:
+if e.IBV_ACCESS_REMOTE_ATOMIC in element or e.IBV_ACCESS_REMOTE_WRITE in 
element:
+if not e.IBV_ACCESS_LOCAL_WRITE in element:
  return False
  return True
  
@@ -69,7 +69,7 @@ def get_access_flags(ctx):

  added as well.
  After verifying that the flags selection is legal, it is appended to an
  array, assuming it wasn't previously appended.
-:param ctx: Device Context to check capabilities
+:param ctx: Device Coyyntext to check capabilities


I liked the old spelling. "Coyyntext" just doesn't sound as good. :)


  :param num: Size of initial collection
  :return: A random legal value for MR flags
  """



thanks,
--
John Hubbard
NVIDIA
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[radeon-alex:drm-next 219/295] drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c:1677:6: warning: no previous prototype for 'vcn_v3_0_dec_sw_ring_emit_fence'

2020-11-24 Thread kernel test robot
tree:   git://people.freedesktop.org/~agd5f/linux.git drm-next
head:   7ff818f97c306f3e557d724bcebb1df31685f122
commit: 52f9535ca4f4268aa7c27975da330cb8dd6a9bf7 [219/295] drm/amdgpu/vcn3.0: 
add dec software ring vm functions to support
config: riscv-randconfig-r006-20201124 (attached as .config)
compiler: riscv64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
git remote add radeon-alex git://people.freedesktop.org/~agd5f/linux.git
git fetch --no-tags radeon-alex drm-next
git checkout 52f9535ca4f4268aa7c27975da330cb8dd6a9bf7
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross 
ARCH=riscv 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

All warnings (new ones prefixed by >>):

   drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c: In function 'vcn_v3_0_start_sriov':
   drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c:1243:3: warning: variable 
'direct_poll' set but not used [-Wunused-but-set-variable]
1243 |   direct_poll = { {0} };
 |   ^~~
   drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c: At top level:
>> drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c:1677:6: warning: no previous prototype 
>> for 'vcn_v3_0_dec_sw_ring_emit_fence' [-Wmissing-prototypes]
1677 | void vcn_v3_0_dec_sw_ring_emit_fence(struct amdgpu_ring *ring, u64 
addr,
 |  ^~~
>> drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c:1689:6: warning: no previous prototype 
>> for 'vcn_v3_0_dec_sw_ring_insert_end' [-Wmissing-prototypes]
1689 | void vcn_v3_0_dec_sw_ring_insert_end(struct amdgpu_ring *ring)
 |  ^~~
>> drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c:1694:6: warning: no previous prototype 
>> for 'vcn_v3_0_dec_sw_ring_emit_ib' [-Wmissing-prototypes]
1694 | void vcn_v3_0_dec_sw_ring_emit_ib(struct amdgpu_ring *ring,
 |  ^~~~
>> drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c:1708:6: warning: no previous prototype 
>> for 'vcn_v3_0_dec_sw_ring_emit_reg_wait' [-Wmissing-prototypes]
1708 | void vcn_v3_0_dec_sw_ring_emit_reg_wait(struct amdgpu_ring *ring, 
uint32_t reg,
 |  ^~
>> drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c:1717:6: warning: no previous prototype 
>> for 'vcn_v3_0_dec_sw_ring_emit_vm_flush' [-Wmissing-prototypes]
1717 | void vcn_v3_0_dec_sw_ring_emit_vm_flush(struct amdgpu_ring *ring,
 |  ^~
>> drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c:1732:6: warning: no previous prototype 
>> for 'vcn_v3_0_dec_sw_ring_emit_wreg' [-Wmissing-prototypes]
1732 | void vcn_v3_0_dec_sw_ring_emit_wreg(struct amdgpu_ring *ring, 
uint32_t reg, uint32_t val)
 |  ^~

vim +/vcn_v3_0_dec_sw_ring_emit_fence +1677 
drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c

  1676  
> 1677  void vcn_v3_0_dec_sw_ring_emit_fence(struct amdgpu_ring *ring, u64 addr,
  1678  u64 seq, uint32_t flags)
  1679  {
  1680  WARN_ON(flags & AMDGPU_FENCE_FLAG_64BIT);
  1681  
  1682  amdgpu_ring_write(ring, VCN_DEC_SW_CMD_FENCE);
  1683  amdgpu_ring_write(ring, addr);
  1684  amdgpu_ring_write(ring, upper_32_bits(addr));
  1685  amdgpu_ring_write(ring, seq);
  1686  amdgpu_ring_write(ring, VCN_DEC_SW_CMD_TRAP);
  1687  }
  1688  
> 1689  void vcn_v3_0_dec_sw_ring_insert_end(struct amdgpu_ring *ring)
  1690  {
  1691  amdgpu_ring_write(ring, VCN_DEC_SW_CMD_END);
  1692  }
  1693  
> 1694  void vcn_v3_0_dec_sw_ring_emit_ib(struct amdgpu_ring *ring,
  1695 struct amdgpu_job *job,
  1696 struct amdgpu_ib *ib,
  1697 uint32_t flags)
  1698  {
  1699  uint32_t vmid = AMDGPU_JOB_GET_VMID(job);
  1700  
  1701  amdgpu_ring_write(ring, VCN_DEC_SW_CMD_IB);
  1702  amdgpu_ring_write(ring, vmid);
  1703  amdgpu_ring_write(ring, lower_32_bits(ib->gpu_addr));
  1704  amdgpu_ring_write(ring, upper_32_bits(ib->gpu_addr));
  1705  amdgpu_ring_write(ring, ib->length_dw);
  1706  }
  1707  
> 1708  void vcn_v3_0_dec_sw_ring_emit_reg_wait(struct amdgpu_ring *ring, 
> uint32_t reg,
  1709  uint32_t val, uint32_t mask)
  1710  {
  1711  amdgpu_ring_write(ring, VCN_DEC_SW_CMD_REG_WAIT);
  1712  amdgpu_ring_write(ring, reg << 2);
  1713  amdgpu_ring_write(ring, mask);
  1714  amdgpu_ring_write(ring, val);
  1715  }
  1716  
> 1717  void vcn_v3_0_dec_sw_ring_emit_vm_flush(struct amdgpu_ring *ring,
  1718   

[PATCH 40/40] drm/amd/amdgpu/amdgpu_uvd: Add description for amdgpu_uvd_cs_msg_decode()'s 'buf_sizes' param

2020-11-24 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c:555: warning: Function parameter or 
member 'buf_sizes' not described in 'amdgpu_uvd_cs_msg_decode'

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Sumit Semwal 
Cc: amd-...@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Cc: linux-me...@vger.kernel.org
Cc: linaro-mm-...@lists.linaro.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
index f8f0384a8d9ad..7c5b60e534822 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
@@ -547,6 +547,7 @@ static int amdgpu_uvd_cs_pass1(struct amdgpu_uvd_cs_ctx 
*ctx)
  *
  * @adev: amdgpu_device pointer
  * @msg: pointer to message structure
+ * @buf_sizes: placeholder to put the different buffer lengths
  *
  * Peek into the decode message and calculate the necessary buffer sizes.
  */
-- 
2.25.1

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


[PATCH 29/40] drm/amd/amdgpu/vcn_v1_0: Fix a few kernel-doc misdemeanours

2020-11-24 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c:439: warning: Excess function parameter 
'sw' description in 'vcn_v1_0_disable_clock_gating'
 drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c:566: warning: Excess function parameter 
'sw' description in 'vcn_v1_0_enable_clock_gating'
 drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c:1454: warning: Function parameter or 
member 'addr' not described in 'vcn_v1_0_dec_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c:1454: warning: Function parameter or 
member 'seq' not described in 'vcn_v1_0_dec_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c:1454: warning: Function parameter or 
member 'flags' not described in 'vcn_v1_0_dec_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c:1454: warning: Excess function parameter 
'fence' description in 'vcn_v1_0_dec_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c:1495: warning: Function parameter or 
member 'job' not described in 'vcn_v1_0_dec_ring_emit_ib'
 drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c:1495: warning: Function parameter or 
member 'flags' not described in 'vcn_v1_0_dec_ring_emit_ib'
 drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c:1628: warning: Function parameter or 
member 'addr' not described in 'vcn_v1_0_enc_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c:1628: warning: Function parameter or 
member 'seq' not described in 'vcn_v1_0_enc_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c:1628: warning: Function parameter or 
member 'flags' not described in 'vcn_v1_0_enc_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c:1628: warning: Excess function parameter 
'fence' description in 'vcn_v1_0_enc_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c:1655: warning: Function parameter or 
member 'job' not described in 'vcn_v1_0_enc_ring_emit_ib'
 drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c:1655: warning: Function parameter or 
member 'flags' not described in 'vcn_v1_0_enc_ring_emit_ib'

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: amd-...@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c | 14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c 
b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
index 86e1ef732ebec..72148f3b27d04 100644
--- a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
@@ -431,7 +431,6 @@ static void vcn_v1_0_mc_resume_dpg_mode(struct 
amdgpu_device *adev)
  * vcn_v1_0_disable_clock_gating - disable VCN clock gating
  *
  * @adev: amdgpu_device pointer
- * @sw: enable SW clock gating
  *
  * Disable clock gating for VCN block
  */
@@ -558,7 +557,6 @@ static void vcn_v1_0_disable_clock_gating(struct 
amdgpu_device *adev)
  * vcn_v1_0_enable_clock_gating - enable VCN clock gating
  *
  * @adev: amdgpu_device pointer
- * @sw: enable SW clock gating
  *
  * Enable clock gating for VCN block
  */
@@ -1445,7 +1443,9 @@ static void vcn_v1_0_dec_ring_insert_end(struct 
amdgpu_ring *ring)
  * vcn_v1_0_dec_ring_emit_fence - emit an fence & trap command
  *
  * @ring: amdgpu_ring pointer
- * @fence: fence to emit
+ * @addr: address
+ * @seq: sequence number
+ * @flags: fence related flags
  *
  * Write a fence and a trap command to the ring.
  */
@@ -1484,7 +1484,9 @@ static void vcn_v1_0_dec_ring_emit_fence(struct 
amdgpu_ring *ring, u64 addr, u64
  * vcn_v1_0_dec_ring_emit_ib - execute indirect buffer
  *
  * @ring: amdgpu_ring pointer
+ * @job: job to retrive vmid from
  * @ib: indirect buffer to execute
+ * @flags: unused
  *
  * Write ring commands to execute the indirect buffer
  */
@@ -1619,7 +1621,9 @@ static void vcn_v1_0_enc_ring_set_wptr(struct amdgpu_ring 
*ring)
  * vcn_v1_0_enc_ring_emit_fence - emit an enc fence & trap command
  *
  * @ring: amdgpu_ring pointer
- * @fence: fence to emit
+ * @addr: address
+ * @seq: sequence number
+ * @flags: fence related flags
  *
  * Write enc a fence and a trap command to the ring.
  */
@@ -1644,7 +1648,9 @@ static void vcn_v1_0_enc_ring_insert_end(struct 
amdgpu_ring *ring)
  * vcn_v1_0_enc_ring_emit_ib - enc execute indirect buffer
  *
  * @ring: amdgpu_ring pointer
+ * @job: job to retrive vmid from
  * @ib: indirect buffer to execute
+ * @flags: unused
  *
  * Write enc ring commands to execute the indirect buffer
  */
-- 
2.25.1

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


[PATCH 34/40] drm/amd/amdgpu/amdgpu_acp: Fix doc-rot issues pertaining to a couple of 'handle' params

2020-11-24 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c:183: warning: Function parameter or 
member 'handle' not described in 'acp_hw_init'
 drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c:183: warning: Excess function 
parameter 'adev' description in 'acp_hw_init'
 drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c:412: warning: Function parameter or 
member 'handle' not described in 'acp_hw_fini'
 drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c:412: warning: Excess function 
parameter 'adev' description in 'acp_hw_fini'

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: amd-...@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c
index 1400957034a12..b8655ff73a658 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c
@@ -176,7 +176,7 @@ static struct device *get_mfd_cell_dev(const char 
*device_name, int r)
 /**
  * acp_hw_init - start and test ACP block
  *
- * @adev: amdgpu_device pointer
+ * @handle: handle used to pass amdgpu_device pointer
  *
  */
 static int acp_hw_init(void *handle)
@@ -405,7 +405,7 @@ static int acp_hw_init(void *handle)
 /**
  * acp_hw_fini - stop the hardware block
  *
- * @adev: amdgpu_device pointer
+ * @handle: handle used to pass amdgpu_device pointer
  *
  */
 static int acp_hw_fini(void *handle)
-- 
2.25.1

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


[PATCH 27/40] drm/amd/amdgpu/uvd_v7_0: Fix a bunch of kernel-doc function documentation issues

2020-11-24 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c:219: warning: Function parameter or 
member 'bo' not described in 'uvd_v7_0_enc_get_create_msg'
 drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c:219: warning: Excess function parameter 
'adev' description in 'uvd_v7_0_enc_get_create_msg'
 drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c:282: warning: Function parameter or 
member 'bo' not described in 'uvd_v7_0_enc_get_destroy_msg'
 drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c:282: warning: Excess function parameter 
'adev' description in 'uvd_v7_0_enc_get_destroy_msg'
 drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c:339: warning: Function parameter or 
member 'timeout' not described in 'uvd_v7_0_enc_ring_test_ib'
 drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c:527: warning: Function parameter or 
member 'handle' not described in 'uvd_v7_0_hw_init'
 drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c:527: warning: Excess function parameter 
'adev' description in 'uvd_v7_0_hw_init'
 drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c:605: warning: Function parameter or 
member 'handle' not described in 'uvd_v7_0_hw_fini'
 drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c:605: warning: Excess function parameter 
'adev' description in 'uvd_v7_0_hw_fini'
 drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c:1156: warning: Function parameter or 
member 'addr' not described in 'uvd_v7_0_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c:1156: warning: Function parameter or 
member 'seq' not described in 'uvd_v7_0_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c:1156: warning: Function parameter or 
member 'flags' not described in 'uvd_v7_0_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c:1156: warning: Excess function parameter 
'fence' description in 'uvd_v7_0_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c:1195: warning: Function parameter or 
member 'addr' not described in 'uvd_v7_0_enc_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c:1195: warning: Function parameter or 
member 'seq' not described in 'uvd_v7_0_enc_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c:1195: warning: Function parameter or 
member 'flags' not described in 'uvd_v7_0_enc_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c:1195: warning: Excess function parameter 
'fence' description in 'uvd_v7_0_enc_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c:1293: warning: Function parameter or 
member 'job' not described in 'uvd_v7_0_ring_emit_ib'
 drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c:1293: warning: Function parameter or 
member 'flags' not described in 'uvd_v7_0_ring_emit_ib'
 drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c:1324: warning: Function parameter or 
member 'job' not described in 'uvd_v7_0_enc_ring_emit_ib'
 drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c:1324: warning: Function parameter or 
member 'flags' not described in 'uvd_v7_0_enc_ring_emit_ib'

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Sumit Semwal 
Cc: amd-...@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Cc: linux-me...@vger.kernel.org
Cc: linaro-mm-...@lists.linaro.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c | 21 +++--
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c 
b/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c
index b44c8677ce8d5..9911ff80a6776 100644
--- a/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c
@@ -206,9 +206,9 @@ static int uvd_v7_0_enc_ring_test_ring(struct amdgpu_ring 
*ring)
 /**
  * uvd_v7_0_enc_get_create_msg - generate a UVD ENC create msg
  *
- * @adev: amdgpu_device pointer
  * @ring: ring we should submit the msg to
  * @handle: session handle to use
+ * @bo: amdgpu object for which we query the offset
  * @fence: optional fence to return
  *
  * Open up a stream for HW test
@@ -269,9 +269,9 @@ static int uvd_v7_0_enc_get_create_msg(struct amdgpu_ring 
*ring, uint32_t handle
 /**
  * uvd_v7_0_enc_get_destroy_msg - generate a UVD ENC destroy msg
  *
- * @adev: amdgpu_device pointer
  * @ring: ring we should submit the msg to
  * @handle: session handle to use
+ * @bo: amdgpu object for which we query the offset
  * @fence: optional fence to return
  *
  * Close up a stream for HW test or if userspace failed to do so
@@ -333,6 +333,7 @@ static int uvd_v7_0_enc_get_destroy_msg(struct amdgpu_ring 
*ring, uint32_t handl
  * uvd_v7_0_enc_ring_test_ib - test if UVD ENC IBs are working
  *
  * @ring: the engine to test on
+ * @timeout: timeout value in jiffies, or MAX_SCHEDULE_TIMEOUT
  *
  */
 static int uvd_v7_0_enc_ring_test_ib(struct amdgpu_ring *ring, long timeout)
@@ -519,7 +520,7 @@ static int uvd_v7_0_sw_fini(void *handle)
 /**
  * uvd_v7_0_hw_init - start and test UVD block
  *
- * @adev: amdgpu_device pointer
+ * @handle: handle used to pass amdgpu_device pointer
  *
  * Initialize the hardware, boot up the VCPU and do some testing
  */
@@ -597,7 +598,7 @@ static int uvd_v7_0_hw_init(void *handle)
 /**

[PATCH 35/40] drm/amd/pm/swsmu/smu11/vangogh_ppt: Make local function 'vangogh_set_default_dpm_tables()' static

2020-11-24 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu11/vangogh_ppt.c: At top level:
 drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu11/vangogh_ppt.c:764:5: warning: no 
previous prototype for ‘vangogh_set_default_dpm_tables’ [-Wmissing-prototypes]
 764 | int vangogh_set_default_dpm_tables(struct smu_context *smu)
 | ^~

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Xiaojian Du 
Cc: amd-...@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c | 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c 
b/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c
index 9a2f72f21ed86..05c32be3a7496 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c
@@ -400,16 +400,13 @@ static int vangogh_get_current_activity_percent(struct 
smu_context *smu,
   enum amd_pp_sensors sensor,
   uint32_t *value)
 {
-   int ret = 0;
-
if (!value)
return -EINVAL;
 
switch (sensor) {
case AMDGPU_PP_SENSOR_GPU_LOAD:
-   ret = vangogh_get_smu_metrics_data(smu,
- METRICS_AVERAGE_GFXACTIVITY,
- value);
+   vangogh_get_smu_metrics_data(smu, METRICS_AVERAGE_GFXACTIVITY,
+value);
break;
default:
dev_err(smu->adev->dev, "Invalid sensor for retrieving clock 
activity\n");
@@ -761,7 +758,7 @@ static int vangogh_od_edit_dpm_table(struct smu_context 
*smu, enum PP_OD_DPM_TAB
return ret;
 }
 
-int vangogh_set_default_dpm_tables(struct smu_context *smu)
+static int vangogh_set_default_dpm_tables(struct smu_context *smu)
 {
struct smu_table_context *smu_table = >smu_table;
 
-- 
2.25.1

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


[PATCH 14/40] drm/amd/amdgpu/gfx_v9_0: Make called-by-reference only function static

2020-11-24 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:2998:6: warning: no previous prototype 
for ‘gfx_v9_0_rlc_stop’ [-Wmissing-prototypes]

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Sumit Semwal 
Cc: amd-...@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Cc: linux-me...@vger.kernel.org
Cc: linaro-mm-...@lists.linaro.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
index 8a6c050cb6caf..eae81fc412556 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
@@ -2995,7 +2995,7 @@ static void gfx_v9_0_init_pg(struct amdgpu_device *adev)
}
 }
 
-void gfx_v9_0_rlc_stop(struct amdgpu_device *adev)
+static void gfx_v9_0_rlc_stop(struct amdgpu_device *adev)
 {
WREG32_FIELD15(GC, 0, RLC_CNTL, RLC_ENABLE_F32, 0);
gfx_v9_0_enable_gui_idle_interrupt(adev, false);
-- 
2.25.1

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


[PATCH 33/40] drm/amd/amdgpu/vcn_v3_0: Remove unused variable 'direct_poll' from 'vcn_v3_0_start_sriov()'

2020-11-24 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c: In function ‘vcn_v3_0_start_sriov’:
 drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c:1242:3: warning: variable ‘direct_poll’ 
set but not used [-Wunused-but-set-variable]

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: amd-...@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c 
b/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c
index c5e0a531cabaf..e05af69651723 100644
--- a/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c
@@ -1238,8 +1238,6 @@ static int vcn_v3_0_start_sriov(struct amdgpu_device 
*adev)
direct_wt = { {0} };
struct mmsch_v3_0_cmd_direct_read_modify_write
direct_rd_mod_wt = { {0} };
-   struct mmsch_v3_0_cmd_direct_polling
-   direct_poll = { {0} };
struct mmsch_v3_0_cmd_end end = { {0} };
struct mmsch_v3_0_init_header header;
 
@@ -1247,8 +1245,6 @@ static int vcn_v3_0_start_sriov(struct amdgpu_device 
*adev)
MMSCH_COMMAND__DIRECT_REG_WRITE;
direct_rd_mod_wt.cmd_header.command_type =
MMSCH_COMMAND__DIRECT_REG_READ_MODIFY_WRITE;
-   direct_poll.cmd_header.command_type =
-   MMSCH_COMMAND__DIRECT_REG_POLLING;
end.cmd_header.command_type =
MMSCH_COMMAND__END;
 
-- 
2.25.1

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


[PATCH 38/40] drm/amd/pm/swsmu/smu11/navi10_ppt: Remove unused 'struct i2c_algorithm navi10_i2c_algo'

2020-11-24 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Evan Quan 
Cc: amd-...@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Lee Jones 
---
 .../gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c   | 204 --
 1 file changed, 204 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c 
b/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
index ef1a62e86a0ee..59bd7cd3ca8df 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
@@ -2325,210 +2325,6 @@ static int navi10_run_umc_cdr_workaround(struct 
smu_context *smu)
return 0;
 }
 
-static void navi10_fill_i2c_req(SwI2cRequest_t  *req, bool write,
- uint8_t address, uint32_t numbytes,
- uint8_t *data)
-{
-   int i;
-
-   req->I2CcontrollerPort = 0;
-   req->I2CSpeed = 2;
-   req->SlaveAddress = address;
-   req->NumCmds = numbytes;
-
-   for (i = 0; i < numbytes; i++) {
-   SwI2cCmd_t *cmd =  >SwI2cCmds[i];
-
-   /* First 2 bytes are always write for lower 2b EEPROM address */
-   if (i < 2)
-   cmd->Cmd = 1;
-   else
-   cmd->Cmd = write;
-
-
-   /* Add RESTART for read  after address filled */
-   cmd->CmdConfig |= (i == 2 && !write) ? CMDCONFIG_RESTART_MASK : 
0;
-
-   /* Add STOP in the end */
-   cmd->CmdConfig |= (i == (numbytes - 1)) ? CMDCONFIG_STOP_MASK : 
0;
-
-   /* Fill with data regardless if read or write to simplify code 
*/
-   cmd->RegisterAddr = data[i];
-   }
-}
-
-static int navi10_i2c_read_data(struct i2c_adapter *control,
-  uint8_t address,
-  uint8_t *data,
-  uint32_t numbytes)
-{
-   uint32_t  i, ret = 0;
-   SwI2cRequest_t req;
-   struct amdgpu_device *adev = to_amdgpu_device(control);
-   struct smu_table_context *smu_table = >smu.smu_table;
-   struct smu_table *table = _table->driver_table;
-
-   if (numbytes > MAX_SW_I2C_COMMANDS) {
-   dev_err(adev->dev, "numbytes requested %d is over max allowed 
%d\n",
-   numbytes, MAX_SW_I2C_COMMANDS);
-   return -EINVAL;
-   }
-
-   memset(, 0, sizeof(req));
-   navi10_fill_i2c_req(, false, address, numbytes, data);
-
-   mutex_lock(>smu.mutex);
-   /* Now read data starting with that address */
-   ret = smu_cmn_update_table(>smu, SMU_TABLE_I2C_COMMANDS, 0, ,
-  true);
-   mutex_unlock(>smu.mutex);
-
-   if (!ret) {
-   SwI2cRequest_t *res = (SwI2cRequest_t *)table->cpu_addr;
-
-   /* Assume SMU  fills res.SwI2cCmds[i].Data with read bytes */
-   for (i = 0; i < numbytes; i++)
-   data[i] = res->SwI2cCmds[i].Data;
-
-   dev_dbg(adev->dev, "navi10_i2c_read_data, address = %x, bytes = 
%d, data :",
- (uint16_t)address, numbytes);
-
-   print_hex_dump(KERN_DEBUG, "data: ", DUMP_PREFIX_NONE,
-  8, 1, data, numbytes, false);
-   } else
-   dev_err(adev->dev, "navi10_i2c_read_data - error occurred :%x", 
ret);
-
-   return ret;
-}
-
-static int navi10_i2c_write_data(struct i2c_adapter *control,
-   uint8_t address,
-   uint8_t *data,
-   uint32_t numbytes)
-{
-   uint32_t ret;
-   SwI2cRequest_t req;
-   struct amdgpu_device *adev = to_amdgpu_device(control);
-
-   if (numbytes > MAX_SW_I2C_COMMANDS) {
-   dev_err(adev->dev, "numbytes requested %d is over max allowed 
%d\n",
-   numbytes, MAX_SW_I2C_COMMANDS);
-   return -EINVAL;
-   }
-
-   memset(, 0, sizeof(req));
-   navi10_fill_i2c_req(, true, address, numbytes, data);
-
-   mutex_lock(>smu.mutex);
-   ret = smu_cmn_update_table(>smu, SMU_TABLE_I2C_COMMANDS, 0, , 
true);
-   mutex_unlock(>smu.mutex);
-
-   if (!ret) {
-   dev_dbg(adev->dev, "navi10_i2c_write(), address = %x, bytes = 
%d , data: ",
-(uint16_t)address, numbytes);
-
-   print_hex_dump(KERN_DEBUG, "data: ", DUMP_PREFIX_NONE,
-  8, 1, data, numbytes, false);
-   /*
-* According to EEPROM spec there is a MAX of 10 ms required for
-* EEPROM to flush internal RX buffer after STOP was issued at 
the
-* end of write transaction. During this time the EEPROM will 
not 

[PATCH 39/40] drm/amd/pm/powerplay/smumgr/fiji_smumgr: Remove unused variable 'result'

2020-11-24 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/amd/amdgpu/../pm/powerplay/smumgr/fiji_smumgr.c: In function 
‘fiji_populate_smc_boot_level’:
 drivers/gpu/drm/amd/amdgpu/../pm/powerplay/smumgr/fiji_smumgr.c:1603:6: 
warning: variable ‘result’ set but not used [-Wunused-but-set-variable]

Cc: Evan Quan 
Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: amd-...@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Lee Jones 
---
 .../gpu/drm/amd/pm/powerplay/smumgr/fiji_smumgr.c   | 13 ++---
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/powerplay/smumgr/fiji_smumgr.c 
b/drivers/gpu/drm/amd/pm/powerplay/smumgr/fiji_smumgr.c
index fef9d3906fccd..fea008cc1f254 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/smumgr/fiji_smumgr.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/smumgr/fiji_smumgr.c
@@ -1600,20 +1600,19 @@ static int fiji_populate_smc_uvd_level(struct pp_hwmgr 
*hwmgr,
 static int fiji_populate_smc_boot_level(struct pp_hwmgr *hwmgr,
struct SMU73_Discrete_DpmTable *table)
 {
-   int result = 0;
struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);
 
table->GraphicsBootLevel = 0;
table->MemoryBootLevel = 0;
 
/* find boot level from dpm table */
-   result = phm_find_boot_level(&(data->dpm_table.sclk_table),
-   data->vbios_boot_state.sclk_bootup_value,
-   (uint32_t *)&(table->GraphicsBootLevel));
+   phm_find_boot_level(&(data->dpm_table.sclk_table),
+   data->vbios_boot_state.sclk_bootup_value,
+   (uint32_t *)&(table->GraphicsBootLevel));
 
-   result = phm_find_boot_level(&(data->dpm_table.mclk_table),
-   data->vbios_boot_state.mclk_bootup_value,
-   (uint32_t *)&(table->MemoryBootLevel));
+   phm_find_boot_level(&(data->dpm_table.mclk_table),
+   data->vbios_boot_state.mclk_bootup_value,
+   (uint32_t *)&(table->MemoryBootLevel));
 
table->BootVddc  = data->vbios_boot_state.vddc_bootup_value *
VOLTAGE_SCALE;
-- 
2.25.1

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


[PATCH 12/40] drm/amd/amdgpu/dce_v10_0: Supply description for function param 'async'

2020-11-24 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c:237: warning: Function parameter or 
member 'async' not described in 'dce_v10_0_page_flip'

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Luben Tuikov 
Cc: amd-...@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c 
b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
index da240f8fafcf8..7944781e1086b 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
@@ -228,6 +228,7 @@ static void dce_v10_0_pageflip_interrupt_fini(struct 
amdgpu_device *adev)
  * @adev: amdgpu_device pointer
  * @crtc_id: crtc to cleanup pageflip on
  * @crtc_base: new address of the crtc (GPU MC address)
+ * @async: asynchronous flip
  *
  * Triggers the actual pageflip by updating the primary
  * surface base address.
-- 
2.25.1

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


[PATCH 17/40] drm/amd/amdgpu/sdma_v2_4: Fix a bunch of kernel-doc function documentation issues

2020-11-24 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c:254: warning: Function parameter or 
member 'job' not described in 'sdma_v2_4_ring_emit_ib'
 drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c:254: warning: Function parameter or 
member 'flags' not described in 'sdma_v2_4_ring_emit_ib'
 drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c:310: warning: Function parameter or 
member 'addr' not described in 'sdma_v2_4_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c:310: warning: Function parameter or 
member 'seq' not described in 'sdma_v2_4_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c:310: warning: Function parameter or 
member 'flags' not described in 'sdma_v2_4_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c:310: warning: Excess function parameter 
'fence' description in 'sdma_v2_4_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c:598: warning: Function parameter or 
member 'timeout' not described in 'sdma_v2_4_ring_test_ib'
 drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c:747: warning: Function parameter or 
member 'ring' not described in 'sdma_v2_4_ring_pad_ib'
 drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c:799: warning: Function parameter or 
member 'vmid' not described in 'sdma_v2_4_ring_emit_vm_flush'
 drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c:799: warning: Function parameter or 
member 'pd_addr' not described in 'sdma_v2_4_ring_emit_vm_flush'
 drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c:799: warning: Excess function parameter 
'vm' description in 'sdma_v2_4_ring_emit_vm_flush'
 drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c:1205: warning: Function parameter or 
member 'ib' not described in 'sdma_v2_4_emit_copy_buffer'
 drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c:1205: warning: Function parameter or 
member 'tmz' not described in 'sdma_v2_4_emit_copy_buffer'
 drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c:1205: warning: Excess function 
parameter 'ring' description in 'sdma_v2_4_emit_copy_buffer'
 drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c:1230: warning: Function parameter or 
member 'ib' not described in 'sdma_v2_4_emit_fill_buffer'
 drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c:1230: warning: Excess function 
parameter 'ring' description in 'sdma_v2_4_emit_fill_buffer'

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Sumit Semwal 
Cc: amd-...@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Cc: linux-me...@vger.kernel.org
Cc: linaro-mm-...@lists.linaro.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c | 16 
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c 
b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
index 5f304d61999eb..22e9e4fe561d9 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
@@ -243,7 +243,9 @@ static void sdma_v2_4_ring_insert_nop(struct amdgpu_ring 
*ring, uint32_t count)
  * sdma_v2_4_ring_emit_ib - Schedule an IB on the DMA engine
  *
  * @ring: amdgpu ring pointer
+ * @job: job to retrive vmid from
  * @ib: IB object to schedule
+ * @flags: unused
  *
  * Schedule an IB in the DMA ring (VI).
  */
@@ -299,7 +301,9 @@ static void sdma_v2_4_ring_emit_hdp_flush(struct 
amdgpu_ring *ring)
  * sdma_v2_4_ring_emit_fence - emit a fence on the DMA ring
  *
  * @ring: amdgpu ring pointer
- * @fence: amdgpu fence object
+ * @addr: address
+ * @seq: sequence number
+ * @flags: fence related flags
  *
  * Add a DMA fence packet to the ring to write
  * the fence seq number and DMA trap packet to generate
@@ -590,6 +594,7 @@ static int sdma_v2_4_ring_test_ring(struct amdgpu_ring 
*ring)
  * sdma_v2_4_ring_test_ib - test an IB on the DMA engine
  *
  * @ring: amdgpu_ring structure holding ring information
+ * @timeout: timeout value in jiffies, or MAX_SCHEDULE_TIMEOUT
  *
  * Test a simple IB in the DMA ring (VI).
  * Returns 0 on success, error on failure.
@@ -740,6 +745,7 @@ static void sdma_v2_4_vm_set_pte_pde(struct amdgpu_ib *ib, 
uint64_t pe,
 /**
  * sdma_v2_4_ring_pad_ib - pad the IB to the required number of dw
  *
+ * @ring: amdgpu_ring structure holding ring information
  * @ib: indirect buffer to fill with padding
  *
  */
@@ -789,7 +795,8 @@ static void sdma_v2_4_ring_emit_pipeline_sync(struct 
amdgpu_ring *ring)
  * sdma_v2_4_ring_emit_vm_flush - cik vm flush using sDMA
  *
  * @ring: amdgpu_ring pointer
- * @vm: amdgpu_vm pointer
+ * @vmid: vmid number to use
+ * @pd_addr: address
  *
  * Update the page table base and flush the VM TLB
  * using sDMA (VI).
@@ -1188,10 +1195,11 @@ static void sdma_v2_4_set_irq_funcs(struct 
amdgpu_device *adev)
 /**
  * sdma_v2_4_emit_copy_buffer - copy buffer using the sDMA engine
  *
- * @ring: amdgpu_ring structure holding ring information
+ * @ib: indirect buffer to copy to
  * @src_offset: src GPU address
  * @dst_offset: dst GPU address
  * @byte_count: number of bytes to xfer
+ * @tmz: unused
  *
  * Copy GPU buffers using the DMA engine (VI).
  * Used by the amdgpu ttm 

[PATCH 19/40] drm/amd/amdgpu/sdma_v3_0: Fix incorrect param doc-rot issue

2020-11-24 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c:1651: warning: Function parameter or 
member 'ib' not described in 'sdma_v3_0_emit_copy_buffer'
 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c:1651: warning: Excess function 
parameter 'ring' description in 'sdma_v3_0_emit_copy_buffer'

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Sumit Semwal 
Cc: amd-...@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Cc: linux-me...@vger.kernel.org
Cc: linaro-mm-...@lists.linaro.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c 
b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
index 43410a7bccc25..8ca7fba9c035f 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
@@ -1633,7 +1633,7 @@ static void sdma_v3_0_set_irq_funcs(struct amdgpu_device 
*adev)
 /**
  * sdma_v3_0_emit_copy_buffer - copy buffer using the sDMA engine
  *
- * @ring: amdgpu_ring structure holding ring information
+ * @ib: indirect buffer to copy to
  * @src_offset: src GPU address
  * @dst_offset: dst GPU address
  * @byte_count: number of bytes to xfer
-- 
2.25.1

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


[PATCH 36/40] drm/amd/pm/inc/smu_v11_0: Mark 'smu11_thermal_policy' as __maybe_unused

2020-11-24 Thread Lee Jones
It's used in some, but not all source files which include 'smu_v11_0.h'.

Fixes the following W=1 kernel build warning(s):

 In file included from 
drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu11/smu_v11_0.c:36:
 drivers/gpu/drm/amd/amdgpu/../pm/inc/smu_v11_0.h:61:43: warning: 
‘smu11_thermal_policy’ defined but not used [-Wunused-const-variable=]
 61 | static const struct smu_temperature_range smu11_thermal_policy[] =
 | ^~~~

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: amd-...@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/amd/pm/inc/smu_v11_0.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/pm/inc/smu_v11_0.h 
b/drivers/gpu/drm/amd/pm/inc/smu_v11_0.h
index eff396c7a281f..9742a02e7b16b 100644
--- a/drivers/gpu/drm/amd/pm/inc/smu_v11_0.h
+++ b/drivers/gpu/drm/amd/pm/inc/smu_v11_0.h
@@ -58,7 +58,8 @@
 #define CTF_OFFSET_HOTSPOT 5
 #define CTF_OFFSET_MEM 5
 
-static const struct smu_temperature_range smu11_thermal_policy[] =
+static const
+struct smu_temperature_range __maybe_unused smu11_thermal_policy[] =
 {
{-273150,  99000, 99000, -273150, 99000, 99000, -273150, 99000, 99000},
{ 12, 12, 12, 12, 12, 12, 12, 12, 
12},
-- 
2.25.1

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


[PATCH 23/40] drm/amd/amdgpu/sdma_v5_0: Provide some missing and repair other function params

2020-11-24 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c:403: warning: Function parameter or 
member 'job' not described in 'sdma_v5_0_ring_emit_ib'
 drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c:403: warning: Function parameter or 
member 'flags' not described in 'sdma_v5_0_ring_emit_ib'
 drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c:480: warning: Function parameter or 
member 'addr' not described in 'sdma_v5_0_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c:480: warning: Function parameter or 
member 'seq' not described in 'sdma_v5_0_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c:480: warning: Function parameter or 
member 'flags' not described in 'sdma_v5_0_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c:480: warning: Excess function parameter 
'fence' description in 'sdma_v5_0_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c:967: warning: Function parameter or 
member 'timeout' not described in 'sdma_v5_0_ring_test_ib'
 drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c:1074: warning: Function parameter or 
member 'value' not described in 'sdma_v5_0_vm_write_pte'
 drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c:1074: warning: Excess function 
parameter 'addr' description in 'sdma_v5_0_vm_write_pte'
 drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c:1074: warning: Excess function 
parameter 'flags' description in 'sdma_v5_0_vm_write_pte'
 drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c:1126: warning: Function parameter or 
member 'ring' not described in 'sdma_v5_0_ring_pad_ib'
 drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c:1180: warning: Function parameter or 
member 'vmid' not described in 'sdma_v5_0_ring_emit_vm_flush'
 drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c:1180: warning: Function parameter or 
member 'pd_addr' not described in 'sdma_v5_0_ring_emit_vm_flush'
 drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c:1180: warning: Excess function 
parameter 'vm' description in 'sdma_v5_0_ring_emit_vm_flush'
 drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c:1703: warning: Function parameter or 
member 'ib' not described in 'sdma_v5_0_emit_copy_buffer'
 drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c:1703: warning: Function parameter or 
member 'tmz' not described in 'sdma_v5_0_emit_copy_buffer'
 drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c:1703: warning: Excess function 
parameter 'ring' description in 'sdma_v5_0_emit_copy_buffer'
 drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c:1729: warning: Function parameter or 
member 'ib' not described in 'sdma_v5_0_emit_fill_buffer'
 drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c:1729: warning: Excess function 
parameter 'ring' description in 'sdma_v5_0_emit_fill_buffer'

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Sumit Semwal 
Cc: amd-...@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Cc: linux-me...@vger.kernel.org
Cc: linaro-mm-...@lists.linaro.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 19 +--
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c 
b/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c
index 9c72b95b74639..5180a52a79a54 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c
@@ -392,7 +392,9 @@ static void sdma_v5_0_ring_insert_nop(struct amdgpu_ring 
*ring, uint32_t count)
  * sdma_v5_0_ring_emit_ib - Schedule an IB on the DMA engine
  *
  * @ring: amdgpu ring pointer
+ * @job: job to retrive vmid from
  * @ib: IB object to schedule
+ * @flags: unused
  *
  * Schedule an IB in the DMA ring (NAVI10).
  */
@@ -469,7 +471,9 @@ static void sdma_v5_0_ring_emit_hdp_flush(struct 
amdgpu_ring *ring)
  * sdma_v5_0_ring_emit_fence - emit a fence on the DMA ring
  *
  * @ring: amdgpu ring pointer
- * @fence: amdgpu fence object
+ * @addr: address
+ * @seq: sequence number
+ * @flags: fence related flags
  *
  * Add a DMA fence packet to the ring to write
  * the fence seq number and DMA trap packet to generate
@@ -959,6 +963,7 @@ static int sdma_v5_0_ring_test_ring(struct amdgpu_ring 
*ring)
  * sdma_v5_0_ring_test_ib - test an IB on the DMA engine
  *
  * @ring: amdgpu_ring structure holding ring information
+ * @timeout: timeout value in jiffies, or MAX_SCHEDULE_TIMEOUT
  *
  * Test a simple IB in the DMA ring (NAVI10).
  * Returns 0 on success, error on failure.
@@ -1061,10 +1066,9 @@ static void sdma_v5_0_vm_copy_pte(struct amdgpu_ib *ib,
  *
  * @ib: indirect buffer to fill with commands
  * @pe: addr of the page entry
- * @addr: dst addr to write into pe
+ * @value: dst addr to write into pe
  * @count: number of page entries to update
  * @incr: increase next addr by incr bytes
- * @flags: access flags
  *
  * Update PTEs by writing them manually using sDMA (NAVI10).
  */
@@ -1118,6 +1122,7 @@ static void sdma_v5_0_vm_set_pte_pde(struct amdgpu_ib *ib,
 
 /**
  * sdma_v5_0_ring_pad_ib - pad the IB
+ * @ring: amdgpu_ring structure holding ring information
  * @ib: indirect buffer to fill with padding
  *
  * Pad the IB with 

[PATCH 37/40] drm/amd/pm/swsmu/smu12/renoir_ppt: Demote kernel-doc formatting abuse

2020-11-24 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: amd-...@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c 
b/drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c
index 46c44f0abdfb8..d3641a8ed99c0 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c
@@ -170,7 +170,7 @@ static int renoir_init_smc_tables(struct smu_context *smu)
return -ENOMEM;
 }
 
-/**
+/*
  * This interface just for getting uclk ultimate freq and should't introduce
  * other likewise function result in overmuch callback.
  */
@@ -656,7 +656,7 @@ static int renoir_get_power(struct smu_context *smu, 
uint32_t *value)
return 0;
 }
 
-/**
+/*
  * This interface get dpm clock table for dc
  */
 static int renoir_get_dpm_clock_table(struct smu_context *smu, struct 
dpm_clocks *clock_table)
-- 
2.25.1

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


[PATCH 11/40] drm/amd/amdgpu/psp_v11_0: Make local function 'psp_v11_0_wait_for_bootloader()' static

2020-11-24 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/amd/amdgpu/psp_v11_0.c:223:5: warning: no previous prototype 
for ‘psp_v11_0_wait_for_bootloader’ [-Wmissing-prototypes]

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Hawking Zhang 
Cc: amd-...@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/amd/amdgpu/psp_v11_0.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c 
b/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c
index edd2d6bd1d86a..bd4248c93c49f 100644
--- a/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c
@@ -220,7 +220,7 @@ static int psp_v11_0_init_microcode(struct psp_context *psp)
return err;
 }
 
-int psp_v11_0_wait_for_bootloader(struct psp_context *psp)
+static int psp_v11_0_wait_for_bootloader(struct psp_context *psp)
 {
struct amdgpu_device *adev = psp->adev;
 
-- 
2.25.1

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


[PATCH 30/40] drm/amd/amdgpu/jpeg_v1_0: Add some missing function param descriptions

2020-11-24 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/amd/amdgpu/jpeg_v1_0.c:219: warning: Function parameter or 
member 'addr' not described in 'jpeg_v1_0_decode_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/jpeg_v1_0.c:219: warning: Function parameter or 
member 'seq' not described in 'jpeg_v1_0_decode_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/jpeg_v1_0.c:219: warning: Function parameter or 
member 'flags' not described in 'jpeg_v1_0_decode_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/jpeg_v1_0.c:219: warning: Excess function parameter 
'fence' description in 'jpeg_v1_0_decode_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/jpeg_v1_0.c:293: warning: Function parameter or 
member 'job' not described in 'jpeg_v1_0_decode_ring_emit_ib'
 drivers/gpu/drm/amd/amdgpu/jpeg_v1_0.c:293: warning: Function parameter or 
member 'flags' not described in 'jpeg_v1_0_decode_ring_emit_ib'
 drivers/gpu/drm/amd/amdgpu/jpeg_v1_0.c:518: warning: Function parameter or 
member 'mode' not described in 'jpeg_v1_0_start'

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Veerabadhran G 
Cc: amd-...@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/amd/amdgpu/jpeg_v1_0.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/jpeg_v1_0.c 
b/drivers/gpu/drm/amd/amdgpu/jpeg_v1_0.c
index c600b61b5f45d..c87102b238e48 100644
--- a/drivers/gpu/drm/amd/amdgpu/jpeg_v1_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/jpeg_v1_0.c
@@ -210,7 +210,9 @@ static void jpeg_v1_0_decode_ring_insert_end(struct 
amdgpu_ring *ring)
  * jpeg_v1_0_decode_ring_emit_fence - emit an fence & trap command
  *
  * @ring: amdgpu_ring pointer
- * @fence: fence to emit
+ * @addr: address
+ * @seq: sequence number
+ * @flags: fence related flags
  *
  * Write a fence and a trap command to the ring.
  */
@@ -282,7 +284,9 @@ static void jpeg_v1_0_decode_ring_emit_fence(struct 
amdgpu_ring *ring, u64 addr,
  * jpeg_v1_0_decode_ring_emit_ib - execute indirect buffer
  *
  * @ring: amdgpu_ring pointer
+ * @job: job to retrive vmid from
  * @ib: indirect buffer to execute
+ * @flags: unused
  *
  * Write ring commands to execute the indirect buffer.
  */
@@ -511,6 +515,7 @@ void jpeg_v1_0_sw_fini(void *handle)
  * jpeg_v1_0_start - start JPEG block
  *
  * @adev: amdgpu_device pointer
+ * @mode: SPG or DPG mode
  *
  * Setup and start the JPEG block
  */
-- 
2.25.1

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


[PATCH 32/40] drm/amd/amdgpu/vcn_v2_0: Fix a few kernel-doc misdemeanours

2020-11-24 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c:483: warning: Excess function parameter 
'sw' description in 'vcn_v2_0_disable_clock_gating'
 drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c:644: warning: Excess function parameter 
'sw' description in 'vcn_v2_0_enable_clock_gating'
 drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c:1404: warning: Function parameter or 
member 'count' not described in 'vcn_v2_0_dec_ring_insert_nop'
 drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c:1426: warning: Function parameter or 
member 'addr' not described in 'vcn_v2_0_dec_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c:1426: warning: Function parameter or 
member 'seq' not described in 'vcn_v2_0_dec_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c:1426: warning: Function parameter or 
member 'flags' not described in 'vcn_v2_0_dec_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c:1426: warning: Excess function parameter 
'fence' description in 'vcn_v2_0_dec_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c:1465: warning: Function parameter or 
member 'job' not described in 'vcn_v2_0_dec_ring_emit_ib'
 drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c:1465: warning: Function parameter or 
member 'flags' not described in 'vcn_v2_0_dec_ring_emit_ib'
 drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c:1609: warning: Function parameter or 
member 'addr' not described in 'vcn_v2_0_enc_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c:1609: warning: Function parameter or 
member 'seq' not described in 'vcn_v2_0_enc_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c:1609: warning: Function parameter or 
member 'flags' not described in 'vcn_v2_0_enc_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c:1609: warning: Excess function parameter 
'fence' description in 'vcn_v2_0_enc_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c:1636: warning: Function parameter or 
member 'job' not described in 'vcn_v2_0_enc_ring_emit_ib'
 drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c:1636: warning: Function parameter or 
member 'flags' not described in 'vcn_v2_0_enc_ring_emit_ib'

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: amd-...@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c | 15 +++
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c 
b/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
index e285f9c9d460e..5687c5ed0fb99 100644
--- a/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
@@ -475,7 +475,6 @@ static void vcn_v2_0_mc_resume_dpg_mode(struct 
amdgpu_device *adev, bool indirec
  * vcn_v2_0_disable_clock_gating - disable VCN clock gating
  *
  * @adev: amdgpu_device pointer
- * @sw: enable SW clock gating
  *
  * Disable clock gating for VCN block
  */
@@ -636,7 +635,6 @@ static void vcn_v2_0_clock_gating_dpg_mode(struct 
amdgpu_device *adev,
  * vcn_v2_0_enable_clock_gating - enable VCN clock gating
  *
  * @adev: amdgpu_device pointer
- * @sw: enable SW clock gating
  *
  * Enable clock gating for VCN block
  */
@@ -1397,6 +1395,7 @@ void vcn_v2_0_dec_ring_insert_end(struct amdgpu_ring 
*ring)
  * vcn_v2_0_dec_ring_insert_nop - insert a nop command
  *
  * @ring: amdgpu_ring pointer
+ * @count: the number of NOP packets to insert
  *
  * Write a nop command to the ring.
  */
@@ -1417,7 +1416,9 @@ void vcn_v2_0_dec_ring_insert_nop(struct amdgpu_ring 
*ring, uint32_t count)
  * vcn_v2_0_dec_ring_emit_fence - emit an fence & trap command
  *
  * @ring: amdgpu_ring pointer
- * @fence: fence to emit
+ * @addr: address
+ * @seq: sequence number
+ * @flags: fence related flags
  *
  * Write a fence and a trap command to the ring.
  */
@@ -1454,7 +1455,9 @@ void vcn_v2_0_dec_ring_emit_fence(struct amdgpu_ring 
*ring, u64 addr, u64 seq,
  * vcn_v2_0_dec_ring_emit_ib - execute indirect buffer
  *
  * @ring: amdgpu_ring pointer
+ * @job: job to retrive vmid from
  * @ib: indirect buffer to execute
+ * @flags: unused
  *
  * Write ring commands to execute the indirect buffer
  */
@@ -1600,7 +1603,9 @@ static void vcn_v2_0_enc_ring_set_wptr(struct amdgpu_ring 
*ring)
  * vcn_v2_0_enc_ring_emit_fence - emit an enc fence & trap command
  *
  * @ring: amdgpu_ring pointer
- * @fence: fence to emit
+ * @addr: address
+ * @seq: sequence number
+ * @flags: fence related flags
  *
  * Write enc a fence and a trap command to the ring.
  */
@@ -1625,7 +1630,9 @@ void vcn_v2_0_enc_ring_insert_end(struct amdgpu_ring 
*ring)
  * vcn_v2_0_enc_ring_emit_ib - enc execute indirect buffer
  *
  * @ring: amdgpu_ring pointer
+ * @job: job to retrive vmid from
  * @ib: indirect buffer to execute
+ * @flags: unused
  *
  * Write enc ring commands to execute the indirect buffer
  */
-- 
2.25.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org

[PATCH 28/40] drm/amd/amdgpu/gfx_v10_0: Make local function 'gfx_v10_0_rlc_stop()' static

2020-11-24 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c:5008:6: warning: no previous prototype 
for ‘gfx_v10_0_rlc_stop’ [-Wmissing-prototypes]

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Sumit Semwal 
Cc: amd-...@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Cc: linux-me...@vger.kernel.org
Cc: linaro-mm-...@lists.linaro.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
index d4760f4e269a1..9eb886ae5a35e 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
@@ -5005,7 +5005,7 @@ static int gfx_v10_0_init_csb(struct amdgpu_device *adev)
return 0;
 }
 
-void gfx_v10_0_rlc_stop(struct amdgpu_device *adev)
+static void gfx_v10_0_rlc_stop(struct amdgpu_device *adev)
 {
u32 tmp = RREG32_SOC15(GC, 0, mmRLC_CNTL);
 
-- 
2.25.1

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


[PATCH 31/40] drm/amd/amdgpu/jpeg_v2_0: Add some missing kernel-doc descriptions

2020-11-24 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c:498: warning: Function parameter or 
member 'addr' not described in 'jpeg_v2_0_dec_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c:498: warning: Function parameter or 
member 'seq' not described in 'jpeg_v2_0_dec_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c:498: warning: Function parameter or 
member 'flags' not described in 'jpeg_v2_0_dec_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c:498: warning: Excess function parameter 
'fence' description in 'jpeg_v2_0_dec_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c:549: warning: Function parameter or 
member 'job' not described in 'jpeg_v2_0_dec_ring_emit_ib'
 drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c:549: warning: Function parameter or 
member 'flags' not described in 'jpeg_v2_0_dec_ring_emit_ib'

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: amd-...@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c 
b/drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c
index 6b80dcea80ec8..15c0224d48b06 100644
--- a/drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c
@@ -489,7 +489,9 @@ void jpeg_v2_0_dec_ring_insert_end(struct amdgpu_ring *ring)
  * jpeg_v2_0_dec_ring_emit_fence - emit an fence & trap command
  *
  * @ring: amdgpu_ring pointer
- * @fence: fence to emit
+ * @addr: address
+ * @seq: sequence number
+ * @flags: fence related flags
  *
  * Write a fence and a trap command to the ring.
  */
@@ -538,7 +540,9 @@ void jpeg_v2_0_dec_ring_emit_fence(struct amdgpu_ring 
*ring, u64 addr, u64 seq,
  * jpeg_v2_0_dec_ring_emit_ib - execute indirect buffer
  *
  * @ring: amdgpu_ring pointer
+ * @job: job to retrive vmid from
  * @ib: indirect buffer to execute
+ * @flags: unused
  *
  * Write ring commands to execute the indirect buffer.
  */
-- 
2.25.1

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


[PATCH 21/40] drm/amd/amdgpu/sdma_v4_0: Repair a bunch of kernel-doc problems

2020-11-24 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c:848: warning: Function parameter or 
member 'job' not described in 'sdma_v4_0_ring_emit_ib'
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c:848: warning: Function parameter or 
member 'flags' not described in 'sdma_v4_0_ring_emit_ib'
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c:923: warning: Function parameter or 
member 'addr' not described in 'sdma_v4_0_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c:923: warning: Function parameter or 
member 'seq' not described in 'sdma_v4_0_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c:923: warning: Function parameter or 
member 'flags' not described in 'sdma_v4_0_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c:923: warning: Excess function parameter 
'fence' description in 'sdma_v4_0_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c:1117: warning: Function parameter or 
member 'ring' not described in 'sdma_v4_0_rb_cntl'
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c:1117: warning: Function parameter or 
member 'rb_cntl' not described in 'sdma_v4_0_rb_cntl'
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c:1581: warning: Function parameter or 
member 'timeout' not described in 'sdma_v4_0_ring_test_ib'
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c:1682: warning: Function parameter or 
member 'value' not described in 'sdma_v4_0_vm_write_pte'
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c:1682: warning: Excess function 
parameter 'addr' description in 'sdma_v4_0_vm_write_pte'
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c:1682: warning: Excess function 
parameter 'flags' description in 'sdma_v4_0_vm_write_pte'
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c:1734: warning: Function parameter or 
member 'ring' not described in 'sdma_v4_0_ring_pad_ib'
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c:1782: warning: Function parameter or 
member 'vmid' not described in 'sdma_v4_0_ring_emit_vm_flush'
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c:1782: warning: Function parameter or 
member 'pd_addr' not described in 'sdma_v4_0_ring_emit_vm_flush'
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c:1782: warning: Excess function 
parameter 'vm' description in 'sdma_v4_0_ring_emit_vm_flush'
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c:2508: warning: Function parameter or 
member 'ib' not described in 'sdma_v4_0_emit_copy_buffer'
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c:2508: warning: Function parameter or 
member 'tmz' not described in 'sdma_v4_0_emit_copy_buffer'
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c:2508: warning: Excess function 
parameter 'ring' description in 'sdma_v4_0_emit_copy_buffer'
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c:2534: warning: Function parameter or 
member 'ib' not described in 'sdma_v4_0_emit_fill_buffer'
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c:2534: warning: Excess function 
parameter 'ring' description in 'sdma_v4_0_emit_fill_buffer'

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Sumit Semwal 
Cc: amd-...@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Cc: linux-me...@vger.kernel.org
Cc: linaro-mm-...@lists.linaro.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 22 ++
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c 
b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
index dc74ca2aa8926..512efb31cc9fe 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
@@ -837,7 +837,9 @@ static void sdma_v4_0_ring_insert_nop(struct amdgpu_ring 
*ring, uint32_t count)
  * sdma_v4_0_ring_emit_ib - Schedule an IB on the DMA engine
  *
  * @ring: amdgpu ring pointer
+ * @job: job to retrive vmid from
  * @ib: IB object to schedule
+ * @flags: unused
  *
  * Schedule an IB in the DMA ring (VEGA10).
  */
@@ -912,7 +914,9 @@ static void sdma_v4_0_ring_emit_hdp_flush(struct 
amdgpu_ring *ring)
  * sdma_v4_0_ring_emit_fence - emit a fence on the DMA ring
  *
  * @ring: amdgpu ring pointer
- * @fence: amdgpu fence object
+ * @addr: address
+ * @seq: sequence number
+ * @flags: fence related flags
  *
  * Add a DMA fence packet to the ring to write
  * the fence seq number and DMA trap packet to generate
@@ -1110,7 +1114,7 @@ static void sdma_v4_0_enable(struct amdgpu_device *adev, 
bool enable)
}
 }
 
-/**
+/*
  * sdma_v4_0_rb_cntl - get parameters for rb_cntl
  */
 static uint32_t sdma_v4_0_rb_cntl(struct amdgpu_ring *ring, uint32_t rb_cntl)
@@ -1573,6 +1577,7 @@ static int sdma_v4_0_ring_test_ring(struct amdgpu_ring 
*ring)
  * sdma_v4_0_ring_test_ib - test an IB on the DMA engine
  *
  * @ring: amdgpu_ring structure holding ring information
+ * @timeout: timeout value in jiffies, or MAX_SCHEDULE_TIMEOUT
  *
  * Test a simple IB in the DMA ring (VEGA10).
  * Returns 0 on success, error on failure.
@@ -1669,10 +1674,9 @@ static void sdma_v4_0_vm_copy_pte(struct amdgpu_ib *ib,
  *
  * @ib: indirect buffer to fill with commands
  * @pe: addr of the page entry

[PATCH 25/40] drm/amd/amdgpu/amdgpu_vce: Provide some missing and repair other function params

2020-11-24 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c:97: warning: Function parameter or 
member 'size' not described in 'amdgpu_vce_sw_init'
 drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c:441: warning: Function parameter or 
member 'bo' not described in 'amdgpu_vce_get_create_msg'
 drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c:441: warning: Excess function 
parameter 'adev' description in 'amdgpu_vce_get_create_msg'
 drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c:521: warning: Function parameter or 
member 'direct' not described in 'amdgpu_vce_get_destroy_msg'
 drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c:521: warning: Excess function 
parameter 'adev' description in 'amdgpu_vce_get_destroy_msg'
 drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c:588: warning: Function parameter or 
member 'ib_idx' not described in 'amdgpu_vce_validate_bo'
 drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c:636: warning: Function parameter or 
member 'ib_idx' not described in 'amdgpu_vce_cs_reloc'
 drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c:636: warning: Function parameter or 
member 'index' not described in 'amdgpu_vce_cs_reloc'
 drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c:720: warning: Function parameter or 
member 'ib_idx' not described in 'amdgpu_vce_ring_parse_cs'
 drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c:956: warning: Function parameter or 
member 'ib_idx' not described in 'amdgpu_vce_ring_parse_cs_vm'
 drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c:1050: warning: Function parameter or 
member 'job' not described in 'amdgpu_vce_ring_emit_ib'
 drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c:1050: warning: Function parameter or 
member 'flags' not described in 'amdgpu_vce_ring_emit_ib'
 drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c:1066: warning: Function parameter or 
member 'addr' not described in 'amdgpu_vce_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c:1066: warning: Function parameter or 
member 'seq' not described in 'amdgpu_vce_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c:1066: warning: Function parameter or 
member 'flags' not described in 'amdgpu_vce_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c:1066: warning: Excess function 
parameter 'fence' description in 'amdgpu_vce_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c:1122: warning: Function parameter or 
member 'timeout' not described in 'amdgpu_vce_ring_test_ib'

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Sumit Semwal 
Cc: amd-...@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Cc: linux-me...@vger.kernel.org
Cc: linaro-mm-...@lists.linaro.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 19 ++-
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
index ecaa2d7483b20..1d8db318b0758 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
@@ -90,6 +90,7 @@ static int amdgpu_vce_get_destroy_msg(struct amdgpu_ring 
*ring, uint32_t handle,
  * amdgpu_vce_init - allocate memory, load vce firmware
  *
  * @adev: amdgpu_device pointer
+ * @size: size for the new BO
  *
  * First step to get VCE online, allocate memory and load the firmware
  */
@@ -428,9 +429,9 @@ void amdgpu_vce_free_handles(struct amdgpu_device *adev, 
struct drm_file *filp)
 /**
  * amdgpu_vce_get_create_msg - generate a VCE create msg
  *
- * @adev: amdgpu_device pointer
  * @ring: ring we should submit the msg to
  * @handle: VCE session handle to use
+ * @bo: amdgpu object for which we query the offset
  * @fence: optional fence to return
  *
  * Open up a stream for HW test
@@ -509,9 +510,9 @@ static int amdgpu_vce_get_create_msg(struct amdgpu_ring 
*ring, uint32_t handle,
 /**
  * amdgpu_vce_get_destroy_msg - generate a VCE destroy msg
  *
- * @adev: amdgpu_device pointer
  * @ring: ring we should submit the msg to
  * @handle: VCE session handle to use
+ * @direct: direct or delayed pool
  * @fence: optional fence to return
  *
  * Close up a stream for HW test or if userspace failed to do so
@@ -576,6 +577,7 @@ static int amdgpu_vce_get_destroy_msg(struct amdgpu_ring 
*ring, uint32_t handle,
  * amdgpu_vce_cs_validate_bo - make sure not to cross 4GB boundary
  *
  * @p: parser context
+ * @ib_idx: indirect buffer to use
  * @lo: address of lower dword
  * @hi: address of higher dword
  * @size: minimum size
@@ -625,9 +627,11 @@ static int amdgpu_vce_validate_bo(struct amdgpu_cs_parser 
*p, uint32_t ib_idx,
  * amdgpu_vce_cs_reloc - command submission relocation
  *
  * @p: parser context
+ * @ib_idx: indirect buffer to use
  * @lo: address of lower dword
  * @hi: address of higher dword
  * @size: minimum size
+ * @index: bs/fb index
  *
  * Patch relocation inside command stream with real buffer address
  */
@@ -714,7 +718,7 @@ static int amdgpu_vce_validate_handle(struct 
amdgpu_cs_parser *p,
  * amdgpu_vce_cs_parse - parse and validate the command 

[PATCH 26/40] drm/amd/amdgpu/uvd_v6_0: Fix a bunch of kernel-doc function documentation issues

2020-11-24 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c:211: warning: Function parameter or 
member 'bo' not described in 'uvd_v6_0_enc_get_create_msg'
 drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c:211: warning: Excess function parameter 
'adev' description in 'uvd_v6_0_enc_get_create_msg'
 drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c:275: warning: Function parameter or 
member 'bo' not described in 'uvd_v6_0_enc_get_destroy_msg'
 drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c:275: warning: Excess function parameter 
'adev' description in 'uvd_v6_0_enc_get_destroy_msg'
 drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c:332: warning: Function parameter or 
member 'timeout' not described in 'uvd_v6_0_enc_ring_test_ib'
 drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c:472: warning: Function parameter or 
member 'handle' not described in 'uvd_v6_0_hw_init'
 drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c:472: warning: Excess function parameter 
'adev' description in 'uvd_v6_0_hw_init'
 drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c:541: warning: Function parameter or 
member 'handle' not described in 'uvd_v6_0_hw_fini'
 drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c:541: warning: Excess function parameter 
'adev' description in 'uvd_v6_0_hw_fini'
 drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c:900: warning: Function parameter or 
member 'addr' not described in 'uvd_v6_0_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c:900: warning: Function parameter or 
member 'seq' not described in 'uvd_v6_0_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c:900: warning: Function parameter or 
member 'flags' not described in 'uvd_v6_0_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c:900: warning: Excess function parameter 
'fence' description in 'uvd_v6_0_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c:930: warning: Function parameter or 
member 'addr' not described in 'uvd_v6_0_enc_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c:930: warning: Function parameter or 
member 'seq' not described in 'uvd_v6_0_enc_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c:930: warning: Function parameter or 
member 'flags' not described in 'uvd_v6_0_enc_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c:930: warning: Excess function parameter 
'fence' description in 'uvd_v6_0_enc_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c:997: warning: Function parameter or 
member 'job' not described in 'uvd_v6_0_ring_emit_ib'
 drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c:997: warning: Function parameter or 
member 'flags' not described in 'uvd_v6_0_ring_emit_ib'
 drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c:1023: warning: Function parameter or 
member 'job' not described in 'uvd_v6_0_enc_ring_emit_ib'
 drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c:1023: warning: Function parameter or 
member 'flags' not described in 'uvd_v6_0_enc_ring_emit_ib'

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Sumit Semwal 
Cc: amd-...@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Cc: linux-me...@vger.kernel.org
Cc: linaro-mm-...@lists.linaro.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 21 +++--
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c 
b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
index 666bfa4a0b8ea..69cf7edf4cc61 100644
--- a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
@@ -198,9 +198,9 @@ static int uvd_v6_0_enc_ring_test_ring(struct amdgpu_ring 
*ring)
 /**
  * uvd_v6_0_enc_get_create_msg - generate a UVD ENC create msg
  *
- * @adev: amdgpu_device pointer
  * @ring: ring we should submit the msg to
  * @handle: session handle to use
+ * @bo: amdgpu object for which we query the offset
  * @fence: optional fence to return
  *
  * Open up a stream for HW test
@@ -261,9 +261,9 @@ static int uvd_v6_0_enc_get_create_msg(struct amdgpu_ring 
*ring, uint32_t handle
 /**
  * uvd_v6_0_enc_get_destroy_msg - generate a UVD ENC destroy msg
  *
- * @adev: amdgpu_device pointer
  * @ring: ring we should submit the msg to
  * @handle: session handle to use
+ * @bo: amdgpu object for which we query the offset
  * @fence: optional fence to return
  *
  * Close up a stream for HW test or if userspace failed to do so
@@ -326,6 +326,7 @@ static int uvd_v6_0_enc_get_destroy_msg(struct amdgpu_ring 
*ring,
  * uvd_v6_0_enc_ring_test_ib - test if UVD ENC IBs are working
  *
  * @ring: the engine to test on
+ * @timeout: timeout value in jiffies, or MAX_SCHEDULE_TIMEOUT
  *
  */
 static int uvd_v6_0_enc_ring_test_ib(struct amdgpu_ring *ring, long timeout)
@@ -464,7 +465,7 @@ static int uvd_v6_0_sw_fini(void *handle)
 /**
  * uvd_v6_0_hw_init - start and test UVD block
  *
- * @adev: amdgpu_device pointer
+ * @handle: handle used to pass amdgpu_device pointer
  *
  * Initialize the hardware, boot up the VCPU and do some testing
  */
@@ -533,7 +534,7 @@ static int uvd_v6_0_hw_init(void *handle)
 /**
  * uvd_v6_0_hw_fini - 

[PATCH 24/40] drm/amd/amdgpu/sdma_v5_2: Provide some missing and repair other function params

2020-11-24 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c:367: warning: Function parameter or 
member 'job' not described in 'sdma_v5_2_ring_emit_ib'
 drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c:367: warning: Function parameter or 
member 'flags' not described in 'sdma_v5_2_ring_emit_ib'
 drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c:429: warning: Function parameter or 
member 'addr' not described in 'sdma_v5_2_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c:429: warning: Function parameter or 
member 'seq' not described in 'sdma_v5_2_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c:429: warning: Function parameter or 
member 'flags' not described in 'sdma_v5_2_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c:429: warning: Excess function parameter 
'fence' description in 'sdma_v5_2_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c:924: warning: Function parameter or 
member 'timeout' not described in 'sdma_v5_2_ring_test_ib'
 drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c:1030: warning: Function parameter or 
member 'value' not described in 'sdma_v5_2_vm_write_pte'
 drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c:1030: warning: Excess function 
parameter 'addr' description in 'sdma_v5_2_vm_write_pte'
 drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c:1030: warning: Excess function 
parameter 'flags' description in 'sdma_v5_2_vm_write_pte'
 drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c:1083: warning: Function parameter or 
member 'ring' not described in 'sdma_v5_2_ring_pad_ib'
 drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c:1137: warning: Function parameter or 
member 'vmid' not described in 'sdma_v5_2_ring_emit_vm_flush'
 drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c:1137: warning: Function parameter or 
member 'pd_addr' not described in 'sdma_v5_2_ring_emit_vm_flush'
 drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c:1137: warning: Excess function 
parameter 'vm' description in 'sdma_v5_2_ring_emit_vm_flush'
 drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c:1717: warning: Function parameter or 
member 'ib' not described in 'sdma_v5_2_emit_copy_buffer'
 drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c:1717: warning: Function parameter or 
member 'tmz' not described in 'sdma_v5_2_emit_copy_buffer'
 drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c:1717: warning: Excess function 
parameter 'ring' description in 'sdma_v5_2_emit_copy_buffer'
 drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c:1743: warning: Function parameter or 
member 'ib' not described in 'sdma_v5_2_emit_fill_buffer'
 drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c:1743: warning: Excess function 
parameter 'ring' description in 'sdma_v5_2_emit_fill_buffer'

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Sumit Semwal 
Cc: amd-...@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Cc: linux-me...@vger.kernel.org
Cc: linaro-mm-...@lists.linaro.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c | 19 +--
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c 
b/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
index cb5a6f1437f81..e8736360d1a9f 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
@@ -356,7 +356,9 @@ static void sdma_v5_2_ring_insert_nop(struct amdgpu_ring 
*ring, uint32_t count)
  * sdma_v5_2_ring_emit_ib - Schedule an IB on the DMA engine
  *
  * @ring: amdgpu ring pointer
+ * @job: job to retrive vmid from
  * @ib: IB object to schedule
+ * @flags: unused
  *
  * Schedule an IB in the DMA ring.
  */
@@ -418,7 +420,9 @@ static void sdma_v5_2_ring_emit_hdp_flush(struct 
amdgpu_ring *ring)
  * sdma_v5_2_ring_emit_fence - emit a fence on the DMA ring
  *
  * @ring: amdgpu ring pointer
- * @fence: amdgpu fence object
+ * @addr: address
+ * @seq: sequence number
+ * @flags: fence related flags
  *
  * Add a DMA fence packet to the ring to write
  * the fence seq number and DMA trap packet to generate
@@ -916,6 +920,7 @@ static int sdma_v5_2_ring_test_ring(struct amdgpu_ring 
*ring)
  * sdma_v5_2_ring_test_ib - test an IB on the DMA engine
  *
  * @ring: amdgpu_ring structure holding ring information
+ * @timeout: timeout value in jiffies, or MAX_SCHEDULE_TIMEOUT
  *
  * Test a simple IB in the DMA ring.
  * Returns 0 on success, error on failure.
@@ -1017,10 +1022,9 @@ static void sdma_v5_2_vm_copy_pte(struct amdgpu_ib *ib,
  *
  * @ib: indirect buffer to fill with commands
  * @pe: addr of the page entry
- * @addr: dst addr to write into pe
+ * @value: dst addr to write into pe
  * @count: number of page entries to update
  * @incr: increase next addr by incr bytes
- * @flags: access flags
  *
  * Update PTEs by writing them manually using sDMA.
  */
@@ -1076,6 +1080,7 @@ static void sdma_v5_2_vm_set_pte_pde(struct amdgpu_ib *ib,
  * sdma_v5_2_ring_pad_ib - pad the IB
  *
  * @ib: indirect buffer to fill with padding
+ * @ring: amdgpu_ring structure holding ring information
  *
  * Pad the IB with NOPs to a boundary multiple of 8.

[PATCH 20/40] drm/amd/amdgpu/uvd_v5_0: Fix a bunch of kernel-doc function documentation issues

2020-11-24 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c:153: warning: Function parameter or 
member 'handle' not described in 'uvd_v5_0_hw_init'
 drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c:153: warning: Excess function parameter 
'adev' description in 'uvd_v5_0_hw_init'
 drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c:210: warning: Function parameter or 
member 'handle' not described in 'uvd_v5_0_hw_fini'
 drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c:210: warning: Excess function parameter 
'adev' description in 'uvd_v5_0_hw_fini'
 drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c:463: warning: Function parameter or 
member 'addr' not described in 'uvd_v5_0_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c:463: warning: Function parameter or 
member 'seq' not described in 'uvd_v5_0_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c:463: warning: Function parameter or 
member 'flags' not described in 'uvd_v5_0_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c:463: warning: Excess function parameter 
'fence' description in 'uvd_v5_0_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c:529: warning: Function parameter or 
member 'job' not described in 'uvd_v5_0_ring_emit_ib'
 drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c:529: warning: Function parameter or 
member 'flags' not described in 'uvd_v5_0_ring_emit_ib'

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Nirmoy Das 
Cc: amd-...@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c 
b/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c
index 6e57001f6d0ac..3a748ec58bec5 100644
--- a/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c
@@ -145,7 +145,7 @@ static int uvd_v5_0_sw_fini(void *handle)
 /**
  * uvd_v5_0_hw_init - start and test UVD block
  *
- * @adev: amdgpu_device pointer
+ * @handle: handle used to pass amdgpu_device pointer
  *
  * Initialize the hardware, boot up the VCPU and do some testing
  */
@@ -202,7 +202,7 @@ static int uvd_v5_0_hw_init(void *handle)
 /**
  * uvd_v5_0_hw_fini - stop the hardware block
  *
- * @adev: amdgpu_device pointer
+ * @handle: handle used to pass amdgpu_device pointer
  *
  * Stop the UVD block, mark ring as not ready any more
  */
@@ -454,7 +454,9 @@ static void uvd_v5_0_stop(struct amdgpu_device *adev)
  * uvd_v5_0_ring_emit_fence - emit an fence & trap command
  *
  * @ring: amdgpu_ring pointer
- * @fence: fence to emit
+ * @addr: address
+ * @seq: sequence number
+ * @flags: fence related flags
  *
  * Write a fence and a trap command to the ring.
  */
@@ -518,7 +520,9 @@ static int uvd_v5_0_ring_test_ring(struct amdgpu_ring *ring)
  * uvd_v5_0_ring_emit_ib - execute indirect buffer
  *
  * @ring: amdgpu_ring pointer
+ * @job: job to retrive vmid from
  * @ib: indirect buffer to execute
+ * @flags: unused
  *
  * Write ring commands to execute the indirect buffer
  */
-- 
2.25.1

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


[PATCH 22/40] drm/amd/amdgpu/amdgpu_uvd: Fix some function documentation headers

2020-11-24 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c:95: warning: cannot understand 
function prototype: 'struct amdgpu_uvd_cs_ctx '
 drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c:555: warning: Function parameter or 
member 'adev' not described in 'amdgpu_uvd_cs_msg_decode'
 drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c:1012: warning: Function parameter or 
member 'ib_idx' not described in 'amdgpu_uvd_ring_parse_cs'
 drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c:1286: warning: Function parameter or 
member 'timeout' not described in 'amdgpu_uvd_ring_test_ib'

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Sumit Semwal 
Cc: amd-...@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Cc: linux-me...@vger.kernel.org
Cc: linaro-mm-...@lists.linaro.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
index f8bebf18ee362..f8f0384a8d9ad 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
@@ -87,7 +87,7 @@
 #define UVD_NO_OP  0x03ff
 #define UVD_BASE_SI0x3800
 
-/**
+/*
  * amdgpu_uvd_cs_ctx - Command submission parser context
  *
  * Used for emulating virtual memory support on UVD 4.2.
@@ -545,8 +545,8 @@ static int amdgpu_uvd_cs_pass1(struct amdgpu_uvd_cs_ctx 
*ctx)
 /**
  * amdgpu_uvd_cs_msg_decode - handle UVD decode message
  *
+ * @adev: amdgpu_device pointer
  * @msg: pointer to message structure
- * @buf_sizes: returned buffer sizes
  *
  * Peek into the decode message and calculate the necessary buffer sizes.
  */
@@ -1005,6 +1005,7 @@ static int amdgpu_uvd_cs_packets(struct amdgpu_uvd_cs_ctx 
*ctx,
  * amdgpu_uvd_ring_parse_cs - UVD command submission parser
  *
  * @parser: Command submission parser context
+ * @ib_idx: Which indirect buffer to use
  *
  * Parse the command stream, patch in addresses as necessary.
  */
@@ -1279,6 +1280,7 @@ void amdgpu_uvd_ring_end_use(struct amdgpu_ring *ring)
  * amdgpu_uvd_ring_test_ib - test ib execution
  *
  * @ring: amdgpu_ring pointer
+ * @timeout: timeout value in jiffies, or MAX_SCHEDULE_TIMEOUT
  *
  * Test if we can successfully execute an IB
  */
-- 
2.25.1

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


[PATCH 06/40] drm/amd/amdgpu/cz_ih: Add missing function param descriptions for 'ih' and 'entry'

2020-11-24 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/amd/amdgpu/cz_ih.c:191: warning: Function parameter or member 
'ih' not described in 'cz_ih_get_wptr'
 drivers/gpu/drm/amd/amdgpu/cz_ih.c:223: warning: Function parameter or member 
'ih' not described in 'cz_ih_decode_iv'
 drivers/gpu/drm/amd/amdgpu/cz_ih.c:223: warning: Function parameter or member 
'entry' not described in 'cz_ih_decode_iv'
 drivers/gpu/drm/amd/amdgpu/cz_ih.c:253: warning: Function parameter or member 
'ih' not described in 'cz_ih_set_rptr'

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: amd-...@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/amd/amdgpu/cz_ih.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/cz_ih.c 
b/drivers/gpu/drm/amd/amdgpu/cz_ih.c
index 1dca0cabc326a..da37f8a900afb 100644
--- a/drivers/gpu/drm/amd/amdgpu/cz_ih.c
+++ b/drivers/gpu/drm/amd/amdgpu/cz_ih.c
@@ -179,6 +179,7 @@ static void cz_ih_irq_disable(struct amdgpu_device *adev)
  * cz_ih_get_wptr - get the IH ring buffer wptr
  *
  * @adev: amdgpu_device pointer
+ * @ih: IH ring buffer to fetch wptr
  *
  * Get the IH ring buffer wptr from either the register
  * or the writeback memory buffer (VI).  Also check for
@@ -213,6 +214,8 @@ static u32 cz_ih_get_wptr(struct amdgpu_device *adev,
  * cz_ih_decode_iv - decode an interrupt vector
  *
  * @adev: amdgpu_device pointer
+ * @ih: IH ring buffer to decode
+ * @entry: IV entry to place decoded information into
  *
  * Decodes the interrupt vector at the current rptr
  * position and also advance the position.
@@ -245,6 +248,7 @@ static void cz_ih_decode_iv(struct amdgpu_device *adev,
  * cz_ih_set_rptr - set the IH ring buffer rptr
  *
  * @adev: amdgpu_device pointer
+ * @ih: IH ring buffer to set rptr
  *
  * Set the IH ring buffer rptr.
  */
-- 
2.25.1

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


[PATCH 09/40] drm/amd/amdgpu/vega10_ih: Add descriptions for 'ih' and 'entry'

2020-11-24 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/amd/amdgpu/vega10_ih.c:377: warning: Function parameter or 
member 'ih' not described in 'vega10_ih_get_wptr'
 drivers/gpu/drm/amd/amdgpu/vega10_ih.c:440: warning: Function parameter or 
member 'ih' not described in 'vega10_ih_decode_iv'
 drivers/gpu/drm/amd/amdgpu/vega10_ih.c:440: warning: Function parameter or 
member 'entry' not described in 'vega10_ih_decode_iv'
 drivers/gpu/drm/amd/amdgpu/vega10_ih.c:480: warning: Function parameter or 
member 'ih' not described in 'vega10_ih_irq_rearm'
 drivers/gpu/drm/amd/amdgpu/vega10_ih.c:513: warning: Function parameter or 
member 'ih' not described in 'vega10_ih_set_rptr'

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Zhigang Luo 
Cc: amd-...@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/amd/amdgpu/vega10_ih.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/vega10_ih.c 
b/drivers/gpu/drm/amd/amdgpu/vega10_ih.c
index 407c6093c2ec0..578fdee5b9758 100644
--- a/drivers/gpu/drm/amd/amdgpu/vega10_ih.c
+++ b/drivers/gpu/drm/amd/amdgpu/vega10_ih.c
@@ -366,6 +366,7 @@ static void vega10_ih_irq_disable(struct amdgpu_device 
*adev)
  * vega10_ih_get_wptr - get the IH ring buffer wptr
  *
  * @adev: amdgpu_device pointer
+ * @ih: IH ring buffer to fetch wptr
  *
  * Get the IH ring buffer wptr from either the register
  * or the writeback memory buffer (VEGA10).  Also check for
@@ -430,6 +431,8 @@ static u32 vega10_ih_get_wptr(struct amdgpu_device *adev,
  * vega10_ih_decode_iv - decode an interrupt vector
  *
  * @adev: amdgpu_device pointer
+ * @ih: IH ring buffer to decode
+ * @entry: IV entry to place decoded information into
  *
  * Decodes the interrupt vector at the current rptr
  * position and also advance the position.
@@ -473,6 +476,7 @@ static void vega10_ih_decode_iv(struct amdgpu_device *adev,
  * vega10_ih_irq_rearm - rearm IRQ if lost
  *
  * @adev: amdgpu_device pointer
+ * @ih: IH ring to match
  *
  */
 static void vega10_ih_irq_rearm(struct amdgpu_device *adev,
@@ -505,6 +509,7 @@ static void vega10_ih_irq_rearm(struct amdgpu_device *adev,
  * vega10_ih_set_rptr - set the IH ring buffer rptr
  *
  * @adev: amdgpu_device pointer
+ * @ih: IH ring buffer to set rptr
  *
  * Set the IH ring buffer rptr.
  */
-- 
2.25.1

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


[PATCH 15/40] drm/amd/amdgpu/gfx_v8_0: Functions must follow directly after their headers

2020-11-24 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c:3698: warning: Excess function parameter 
'adev' description in 'DEFAULT_SH_MEM_BASES'

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Sumit Semwal 
Cc: amd-...@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Cc: linux-me...@vger.kernel.org
Cc: linaro-mm-...@lists.linaro.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
index 5e6d15f44560a..9a905531f8377 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
@@ -3687,6 +3687,7 @@ static void gfx_v8_0_setup_rb(struct amdgpu_device *adev)
mutex_unlock(>grbm_idx_mutex);
 }
 
+#define DEFAULT_SH_MEM_BASES   (0x6000)
 /**
  * gfx_v8_0_init_compute_vmid - gart enable
  *
@@ -3695,7 +3696,6 @@ static void gfx_v8_0_setup_rb(struct amdgpu_device *adev)
  * Initialize compute vmid sh_mem registers
  *
  */
-#define DEFAULT_SH_MEM_BASES   (0x6000)
 static void gfx_v8_0_init_compute_vmid(struct amdgpu_device *adev)
 {
int i;
-- 
2.25.1

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


[PATCH 16/40] drm/amd/amdgpu/gfx_v10_0: Remove a bunch of set but unused variables

2020-11-24 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c: In function ‘gfx_v10_rlcg_wreg’:
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c:1416:18: warning: variable ‘grbm_idx’ 
set but not used [-Wunused-but-set-variable]
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c:1415:18: warning: variable ‘grbm_cntl’ 
set but not used [-Wunused-but-set-variable]
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c:1413:15: warning: variable 
‘scratch_reg3’ set but not used [-Wunused-but-set-variable]
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c:1412:15: warning: variable 
‘scratch_reg2’ set but not used [-Wunused-but-set-variable]

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Sumit Semwal 
Cc: amd-...@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Cc: linux-me...@vger.kernel.org
Cc: linaro-mm-...@lists.linaro.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 9 -
 1 file changed, 9 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
index a6d03931f7fa4..d4760f4e269a1 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
@@ -1409,23 +1409,14 @@ static void gfx_v10_rlcg_wreg(struct amdgpu_device 
*adev, u32 offset, u32 v)
 {
static void *scratch_reg0;
static void *scratch_reg1;
-   static void *scratch_reg2;
-   static void *scratch_reg3;
static void *spare_int;
-   static uint32_t grbm_cntl;
-   static uint32_t grbm_idx;
uint32_t i = 0;
uint32_t retries = 5;
 
scratch_reg0 = adev->rmmio + 
(adev->reg_offset[GC_HWIP][0][mmSCRATCH_REG0_BASE_IDX] + mmSCRATCH_REG0)*4;
scratch_reg1 = adev->rmmio + 
(adev->reg_offset[GC_HWIP][0][mmSCRATCH_REG1_BASE_IDX] + mmSCRATCH_REG1)*4;
-   scratch_reg2 = adev->rmmio + 
(adev->reg_offset[GC_HWIP][0][mmSCRATCH_REG1_BASE_IDX] + mmSCRATCH_REG2)*4;
-   scratch_reg3 = adev->rmmio + 
(adev->reg_offset[GC_HWIP][0][mmSCRATCH_REG1_BASE_IDX] + mmSCRATCH_REG3)*4;
spare_int = adev->rmmio + 
(adev->reg_offset[GC_HWIP][0][mmRLC_SPARE_INT_BASE_IDX] + mmRLC_SPARE_INT)*4;
 
-   grbm_cntl = adev->reg_offset[GC_HWIP][0][mmGRBM_GFX_CNTL_BASE_IDX] + 
mmGRBM_GFX_CNTL;
-   grbm_idx = adev->reg_offset[GC_HWIP][0][mmGRBM_GFX_INDEX_BASE_IDX] + 
mmGRBM_GFX_INDEX;
-
if (amdgpu_sriov_runtime(adev)) {
pr_err("shouldn't call rlcg write register during runtime\n");
return;
-- 
2.25.1

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


[PATCH 05/40] drm/amd/amdgpu/tonga_ih: Provide some missing descriptions for 'ih' and 'entry'

2020-11-24 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/amd/amdgpu/tonga_ih.c:193: warning: Function parameter or 
member 'ih' not described in 'tonga_ih_get_wptr'
 drivers/gpu/drm/amd/amdgpu/tonga_ih.c:225: warning: Function parameter or 
member 'ih' not described in 'tonga_ih_decode_iv'
 drivers/gpu/drm/amd/amdgpu/tonga_ih.c:225: warning: Function parameter or 
member 'entry' not described in 'tonga_ih_decode_iv'
 drivers/gpu/drm/amd/amdgpu/tonga_ih.c:255: warning: Function parameter or 
member 'ih' not described in 'tonga_ih_set_rptr'

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: amd-...@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/amd/amdgpu/tonga_ih.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/tonga_ih.c 
b/drivers/gpu/drm/amd/amdgpu/tonga_ih.c
index e40140bf6699c..ce3319993b4bd 100644
--- a/drivers/gpu/drm/amd/amdgpu/tonga_ih.c
+++ b/drivers/gpu/drm/amd/amdgpu/tonga_ih.c
@@ -181,6 +181,7 @@ static void tonga_ih_irq_disable(struct amdgpu_device *adev)
  * tonga_ih_get_wptr - get the IH ring buffer wptr
  *
  * @adev: amdgpu_device pointer
+ * @ih: IH ring buffer to fetch wptr
  *
  * Get the IH ring buffer wptr from either the register
  * or the writeback memory buffer (VI).  Also check for
@@ -215,6 +216,8 @@ static u32 tonga_ih_get_wptr(struct amdgpu_device *adev,
  * tonga_ih_decode_iv - decode an interrupt vector
  *
  * @adev: amdgpu_device pointer
+ * @ih: IH ring buffer to decode
+ * @entry: IV entry to place decoded information into
  *
  * Decodes the interrupt vector at the current rptr
  * position and also advance the position.
@@ -247,6 +250,7 @@ static void tonga_ih_decode_iv(struct amdgpu_device *adev,
  * tonga_ih_set_rptr - set the IH ring buffer rptr
  *
  * @adev: amdgpu_device pointer
+ * @ih: IH ring buffer to set rptr
  *
  * Set the IH ring buffer rptr.
  */
-- 
2.25.1

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


[PATCH 13/40] drm/amd/amdgpu/dce_v11_0: Supply description for function param 'async'

2020-11-24 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c:255: warning: Function parameter or 
member 'async' not described in 'dce_v11_0_page_flip'

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Luben Tuikov 
Cc: amd-...@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c 
b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
index c62c56a69fda6..1b6ff04700118 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
@@ -246,6 +246,7 @@ static void dce_v11_0_pageflip_interrupt_fini(struct 
amdgpu_device *adev)
  * @adev: amdgpu_device pointer
  * @crtc_id: crtc to cleanup pageflip on
  * @crtc_base: new address of the crtc (GPU MC address)
+ * @async: asynchronous flip
  *
  * Triggers the actual pageflip by updating the primary
  * surface base address.
-- 
2.25.1

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


[PATCH 18/40] drm/amd/amdgpu/sdma_v3_0: Fix a bunch of kernel-doc function documentation issues

2020-11-24 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c:428: warning: Function parameter or 
member 'job' not described in 'sdma_v3_0_ring_emit_ib'
 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c:428: warning: Function parameter or 
member 'flags' not described in 'sdma_v3_0_ring_emit_ib'
 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c:484: warning: Function parameter or 
member 'addr' not described in 'sdma_v3_0_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c:484: warning: Function parameter or 
member 'seq' not described in 'sdma_v3_0_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c:484: warning: Function parameter or 
member 'flags' not described in 'sdma_v3_0_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c:484: warning: Excess function parameter 
'fence' description in 'sdma_v3_0_ring_emit_fence'
 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c:870: warning: Function parameter or 
member 'timeout' not described in 'sdma_v3_0_ring_test_ib'
 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c:1018: warning: Function parameter or 
member 'ring' not described in 'sdma_v3_0_ring_pad_ib'
 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c:1070: warning: Function parameter or 
member 'vmid' not described in 'sdma_v3_0_ring_emit_vm_flush'
 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c:1070: warning: Function parameter or 
member 'pd_addr' not described in 'sdma_v3_0_ring_emit_vm_flush'
 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c:1070: warning: Excess function 
parameter 'vm' description in 'sdma_v3_0_ring_emit_vm_flush'
 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c:1643: warning: Function parameter or 
member 'ib' not described in 'sdma_v3_0_emit_copy_buffer'
 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c:1643: warning: Function parameter or 
member 'tmz' not described in 'sdma_v3_0_emit_copy_buffer'
 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c:1643: warning: Excess function 
parameter 'ring' description in 'sdma_v3_0_emit_copy_buffer'
 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c:1668: warning: Function parameter or 
member 'ib' not described in 'sdma_v3_0_emit_fill_buffer'
 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c:1668: warning: Excess function 
parameter 'ring' description in 'sdma_v3_0_emit_fill_buffer'

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Sumit Semwal 
Cc: amd-...@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Cc: linux-me...@vger.kernel.org
Cc: linaro-mm-...@lists.linaro.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c | 14 +++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c 
b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
index c59f6f6f4c091..43410a7bccc25 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
@@ -417,7 +417,9 @@ static void sdma_v3_0_ring_insert_nop(struct amdgpu_ring 
*ring, uint32_t count)
  * sdma_v3_0_ring_emit_ib - Schedule an IB on the DMA engine
  *
  * @ring: amdgpu ring pointer
+ * @job: job to retrive vmid from
  * @ib: IB object to schedule
+ * @flags: unused
  *
  * Schedule an IB in the DMA ring (VI).
  */
@@ -473,7 +475,9 @@ static void sdma_v3_0_ring_emit_hdp_flush(struct 
amdgpu_ring *ring)
  * sdma_v3_0_ring_emit_fence - emit a fence on the DMA ring
  *
  * @ring: amdgpu ring pointer
- * @fence: amdgpu fence object
+ * @addr: address
+ * @seq: sequence number
+ * @flags: fence related flags
  *
  * Add a DMA fence packet to the ring to write
  * the fence seq number and DMA trap packet to generate
@@ -862,6 +866,7 @@ static int sdma_v3_0_ring_test_ring(struct amdgpu_ring 
*ring)
  * sdma_v3_0_ring_test_ib - test an IB on the DMA engine
  *
  * @ring: amdgpu_ring structure holding ring information
+ * @timeout: timeout value in jiffies, or MAX_SCHEDULE_TIMEOUT
  *
  * Test a simple IB in the DMA ring (VI).
  * Returns 0 on success, error on failure.
@@ -1011,6 +1016,7 @@ static void sdma_v3_0_vm_set_pte_pde(struct amdgpu_ib 
*ib, uint64_t pe,
 /**
  * sdma_v3_0_ring_pad_ib - pad the IB to the required number of dw
  *
+ * @ring: amdgpu_ring structure holding ring information
  * @ib: indirect buffer to fill with padding
  *
  */
@@ -1060,7 +1066,8 @@ static void sdma_v3_0_ring_emit_pipeline_sync(struct 
amdgpu_ring *ring)
  * sdma_v3_0_ring_emit_vm_flush - cik vm flush using sDMA
  *
  * @ring: amdgpu_ring pointer
- * @vm: amdgpu_vm pointer
+ * @vmid: vmid number to use
+ * @pd_addr: address
  *
  * Update the page table base and flush the VM TLB
  * using sDMA (VI).
@@ -1630,6 +1637,7 @@ static void sdma_v3_0_set_irq_funcs(struct amdgpu_device 
*adev)
  * @src_offset: src GPU address
  * @dst_offset: dst GPU address
  * @byte_count: number of bytes to xfer
+ * @tmz: unused
  *
  * Copy GPU buffers using the DMA engine (VI).
  * Used by the amdgpu ttm implementation to move pages if
@@ -1654,7 +1662,7 @@ static void sdma_v3_0_emit_copy_buffer(struct amdgpu_ib 
*ib,
 /**
  * sdma_v3_0_emit_fill_buffer - fill buffer 

[PATCH 08/40] drm/msm/dp/dp_ctrl: Move 'tu' from the stack to the heap

2020-11-24 Thread Lee Jones
'struct tu_algo_data' is huge ~400 Bytes.

Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/msm/dp/dp_ctrl.c: In function ‘_dp_ctrl_calc_tu.constprop’:
 drivers/gpu/drm/msm/dp/dp_ctrl.c:938:1: warning: the frame size of 1184 bytes 
is larger than 1024 bytes [-Wframe-larger-than=]

Cc: Rob Clark 
Cc: Sean Paul 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Chandan Uddaraju 
Cc: Kuogee Hsieh 
Cc: linux-arm-...@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: freedr...@lists.freedesktop.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/msm/dp/dp_ctrl.c | 338 ---
 1 file changed, 171 insertions(+), 167 deletions(-)

diff --git a/drivers/gpu/drm/msm/dp/dp_ctrl.c b/drivers/gpu/drm/msm/dp/dp_ctrl.c
index c569e97c82a6c..e3462f5d96d75 100644
--- a/drivers/gpu/drm/msm/dp/dp_ctrl.c
+++ b/drivers/gpu/drm/msm/dp/dp_ctrl.c
@@ -614,7 +614,7 @@ static void _tu_valid_boundary_calc(struct tu_algo_data *tu)
 static void _dp_ctrl_calc_tu(struct dp_tu_calc_input *in,
   struct dp_vc_tu_mapping_table *tu_table)
 {
-   struct tu_algo_data tu;
+   struct tu_algo_data *tu;
int compare_result_1, compare_result_2;
u64 temp = 0;
s64 temp_fp = 0, temp1_fp = 0, temp2_fp = 0;
@@ -629,298 +629,300 @@ static void _dp_ctrl_calc_tu(struct dp_tu_calc_input 
*in,
uint EXTRA_PIXCLK_CYCLE_DELAY = 4;
uint HBLANK_MARGIN = 4;
 
-   memset(, 0, sizeof(tu));
+   tu = kzalloc(sizeof(*tu), GFP_KERNEL);
+   if (!tu)
+   return
 
-   dp_panel_update_tu_timings(in, );
+   dp_panel_update_tu_timings(in, tu);
 
-   tu.err_fp = drm_fixp_from_fraction(1000, 1); /* 1000 */
+   tu->err_fp = drm_fixp_from_fraction(1000, 1); /* 1000 */
 
temp1_fp = drm_fixp_from_fraction(4, 1);
-   temp2_fp = drm_fixp_mul(temp1_fp, tu.lclk_fp);
-   temp_fp = drm_fixp_div(temp2_fp, tu.pclk_fp);
-   tu.extra_buffer_margin = drm_fixp2int_ceil(temp_fp);
+   temp2_fp = drm_fixp_mul(temp1_fp, tu->lclk_fp);
+   temp_fp = drm_fixp_div(temp2_fp, tu->pclk_fp);
+   tu->extra_buffer_margin = drm_fixp2int_ceil(temp_fp);
 
-   temp1_fp = drm_fixp_from_fraction(tu.bpp, 8);
-   temp2_fp = drm_fixp_mul(tu.pclk_fp, temp1_fp);
-   temp1_fp = drm_fixp_from_fraction(tu.nlanes, 1);
+   temp1_fp = drm_fixp_from_fraction(tu->bpp, 8);
+   temp2_fp = drm_fixp_mul(tu->pclk_fp, temp1_fp);
+   temp1_fp = drm_fixp_from_fraction(tu->nlanes, 1);
temp2_fp = drm_fixp_div(temp2_fp, temp1_fp);
-   tu.ratio_fp = drm_fixp_div(temp2_fp, tu.lclk_fp);
-
-   tu.original_ratio_fp = tu.ratio_fp;
-   tu.boundary_moderation_en = false;
-   tu.upper_boundary_count = 0;
-   tu.lower_boundary_count = 0;
-   tu.i_upper_boundary_count = 0;
-   tu.i_lower_boundary_count = 0;
-   tu.valid_lower_boundary_link = 0;
-   tu.even_distribution_BF = 0;
-   tu.even_distribution_legacy = 0;
-   tu.even_distribution = 0;
-   tu.delay_start_time_fp = 0;
-
-   tu.err_fp = drm_fixp_from_fraction(1000, 1);
-   tu.n_err_fp = 0;
-   tu.n_n_err_fp = 0;
-
-   tu.ratio = drm_fixp2int(tu.ratio_fp);
-   temp1_fp = drm_fixp_from_fraction(tu.nlanes, 1);
-   div64_u64_rem(tu.lwidth_fp, temp1_fp, _fp);
+   tu->ratio_fp = drm_fixp_div(temp2_fp, tu->lclk_fp);
+
+   tu->original_ratio_fp = tu->ratio_fp;
+   tu->boundary_moderation_en = false;
+   tu->upper_boundary_count = 0;
+   tu->lower_boundary_count = 0;
+   tu->i_upper_boundary_count = 0;
+   tu->i_lower_boundary_count = 0;
+   tu->valid_lower_boundary_link = 0;
+   tu->even_distribution_BF = 0;
+   tu->even_distribution_legacy = 0;
+   tu->even_distribution = 0;
+   tu->delay_start_time_fp = 0;
+
+   tu->err_fp = drm_fixp_from_fraction(1000, 1);
+   tu->n_err_fp = 0;
+   tu->n_n_err_fp = 0;
+
+   tu->ratio = drm_fixp2int(tu->ratio_fp);
+   temp1_fp = drm_fixp_from_fraction(tu->nlanes, 1);
+   div64_u64_rem(tu->lwidth_fp, temp1_fp, _fp);
if (temp2_fp != 0 &&
-   !tu.ratio && tu.dsc_en == 0) {
-   tu.ratio_fp = drm_fixp_mul(tu.ratio_fp, RATIO_SCALE_fp);
-   tu.ratio = drm_fixp2int(tu.ratio_fp);
-   if (tu.ratio)
-   tu.ratio_fp = drm_fixp_from_fraction(1, 1);
+   !tu->ratio && tu->dsc_en == 0) {
+   tu->ratio_fp = drm_fixp_mul(tu->ratio_fp, RATIO_SCALE_fp);
+   tu->ratio = drm_fixp2int(tu->ratio_fp);
+   if (tu->ratio)
+   tu->ratio_fp = drm_fixp_from_fraction(1, 1);
}
 
-   if (tu.ratio > 1)
-   tu.ratio = 1;
+   if (tu->ratio > 1)
+   tu->ratio = 1;
 
-   if (tu.ratio == 1)
+   if (tu->ratio == 1)
goto tu_size_calc;
 
-   compare_result_1 = _tu_param_compare(tu.ratio_fp, const_p49_fp);
+   

[PATCH 10/40] drm/amd/amdgpu/navi10_ih: Add descriptions for 'ih' and 'entry'

2020-11-24 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/amd/amdgpu/navi10_ih.c:453: warning: Function parameter or 
member 'ih' not described in 'navi10_ih_get_wptr'
 drivers/gpu/drm/amd/amdgpu/navi10_ih.c:512: warning: Function parameter or 
member 'ih' not described in 'navi10_ih_decode_iv'
 drivers/gpu/drm/amd/amdgpu/navi10_ih.c:512: warning: Function parameter or 
member 'entry' not described in 'navi10_ih_decode_iv'
 drivers/gpu/drm/amd/amdgpu/navi10_ih.c:552: warning: Function parameter or 
member 'ih' not described in 'navi10_ih_irq_rearm'
 drivers/gpu/drm/amd/amdgpu/navi10_ih.c:585: warning: Function parameter or 
member 'ih' not described in 'navi10_ih_set_rptr'

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Alex Sierra 
Cc: amd-...@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/amd/amdgpu/navi10_ih.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/navi10_ih.c 
b/drivers/gpu/drm/amd/amdgpu/navi10_ih.c
index 837769fcb35b7..3338052b080b6 100644
--- a/drivers/gpu/drm/amd/amdgpu/navi10_ih.c
+++ b/drivers/gpu/drm/amd/amdgpu/navi10_ih.c
@@ -442,6 +442,7 @@ static void navi10_ih_irq_disable(struct amdgpu_device 
*adev)
  * navi10_ih_get_wptr - get the IH ring buffer wptr
  *
  * @adev: amdgpu_device pointer
+ * @ih: IH ring buffer to fetch wptr
  *
  * Get the IH ring buffer wptr from either the register
  * or the writeback memory buffer (NAVI10).  Also check for
@@ -502,6 +503,8 @@ static u32 navi10_ih_get_wptr(struct amdgpu_device *adev,
  * navi10_ih_decode_iv - decode an interrupt vector
  *
  * @adev: amdgpu_device pointer
+ * @ih: IH ring buffer to decode
+ * @entry: IV entry to place decoded information into
  *
  * Decodes the interrupt vector at the current rptr
  * position and also advance the position.
@@ -545,6 +548,7 @@ static void navi10_ih_decode_iv(struct amdgpu_device *adev,
  * navi10_ih_irq_rearm - rearm IRQ if lost
  *
  * @adev: amdgpu_device pointer
+ * @ih: IH ring to match
  *
  */
 static void navi10_ih_irq_rearm(struct amdgpu_device *adev,
@@ -578,6 +582,7 @@ static void navi10_ih_irq_rearm(struct amdgpu_device *adev,
  *
  * @adev: amdgpu_device pointer
  *
+ * @ih: IH ring buffer to set rptr
  * Set the IH ring buffer rptr.
  */
 static void navi10_ih_set_rptr(struct amdgpu_device *adev,
-- 
2.25.1

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


[PATCH 07/40] drm/amd/amdgpu/amdgpu_psp: Make local function 'parse_ta_bin_descriptor' static

2020-11-24 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c:2576:5: warning: no previous prototype 
for ‘parse_ta_bin_descriptor’ [-Wmissing-prototypes]

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: amd-...@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
index 74cbaf2126982..910e89dc324b8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
@@ -2573,9 +2573,9 @@ int psp_init_sos_microcode(struct psp_context *psp,
return err;
 }
 
-int parse_ta_bin_descriptor(struct psp_context *psp,
-   const struct ta_fw_bin_desc *desc,
-   const struct ta_firmware_header_v2_0 *ta_hdr)
+static int parse_ta_bin_descriptor(struct psp_context *psp,
+  const struct ta_fw_bin_desc *desc,
+  const struct ta_firmware_header_v2_0 *ta_hdr)
 {
uint8_t *ucode_start_addr  = NULL;
 
-- 
2.25.1

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


[PATCH 03/40] drm/msm/adreno/a6xx_gpu_state: Make some local functions static

2020-11-24 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c:83:7: warning: no previous 
prototype for ‘state_kcalloc’ [-Wmissing-prototypes]
 drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c:95:7: warning: no previous 
prototype for ‘state_kmemdup’ [-Wmissing-prototypes]
 drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c:947:6: warning: no previous 
prototype for ‘a6xx_gpu_state_destroy’ [-Wmissing-prototypes]

Cc: Rob Clark 
Cc: Sean Paul 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: linux-arm-...@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: freedr...@lists.freedesktop.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c 
b/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c
index e9ede19193b0e..c1699b4f9a897 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c
@@ -80,7 +80,7 @@ struct a6xx_state_memobj {
unsigned long long data[];
 };
 
-void *state_kcalloc(struct a6xx_gpu_state *a6xx_state, int nr, size_t objsize)
+static void *state_kcalloc(struct a6xx_gpu_state *a6xx_state, int nr, size_t 
objsize)
 {
struct a6xx_state_memobj *obj =
kzalloc((nr * objsize) + sizeof(*obj), GFP_KERNEL);
@@ -92,7 +92,7 @@ void *state_kcalloc(struct a6xx_gpu_state *a6xx_state, int 
nr, size_t objsize)
return >data;
 }
 
-void *state_kmemdup(struct a6xx_gpu_state *a6xx_state, void *src,
+static void *state_kmemdup(struct a6xx_gpu_state *a6xx_state, void *src,
size_t size)
 {
void *dst = state_kcalloc(a6xx_state, 1, size);
@@ -944,7 +944,7 @@ struct msm_gpu_state *a6xx_gpu_state_get(struct msm_gpu 
*gpu)
return  _state->base;
 }
 
-void a6xx_gpu_state_destroy(struct kref *kref)
+static void a6xx_gpu_state_destroy(struct kref *kref)
 {
struct a6xx_state_memobj *obj, *tmp;
struct msm_gpu_state *state = container_of(kref,
-- 
2.25.1

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


[PATCH 02/40] drm/amd/amdgpu/gmc_v10_0: Suppy some missing function doc descriptions

2020-11-24 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c:278: warning: Function parameter or 
member 'vmhub' not described in 'gmc_v10_0_flush_gpu_tlb'
 drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c:278: warning: Function parameter or 
member 'flush_type' not described in 'gmc_v10_0_flush_gpu_tlb'
 drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c:371: warning: Function parameter or 
member 'flush_type' not described in 'gmc_v10_0_flush_gpu_tlb_pasid'
 drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c:371: warning: Function parameter or 
member 'all_hub' not described in 'gmc_v10_0_flush_gpu_tlb_pasid'

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Sumit Semwal 
Cc: amd-...@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Cc: linux-me...@vger.kernel.org
Cc: linaro-mm-...@lists.linaro.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c 
b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
index d9399324be474..4887b0e66e975 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
@@ -270,6 +270,8 @@ static void gmc_v10_0_flush_vm_hub(struct amdgpu_device 
*adev, uint32_t vmid,
  *
  * @adev: amdgpu_device pointer
  * @vmid: vm instance to flush
+ * @vmhub: vmhub type
+ * @flush_type: the flush type
  *
  * Flush the TLB for the requested page table.
  */
@@ -362,6 +364,8 @@ static void gmc_v10_0_flush_gpu_tlb(struct amdgpu_device 
*adev, uint32_t vmid,
  *
  * @adev: amdgpu_device pointer
  * @pasid: pasid to be flush
+ * @flush_type: the flush type
+ * @all_hub: Used with PACKET3_INVALIDATE_TLBS_ALL_HUB()
  *
  * Flush the TLB for the requested pasid.
  */
-- 
2.25.1

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


[PATCH 04/40] drm/amd/amdgpu/iceland_ih: Add missing function param descriptions for 'ih' and 'entry'

2020-11-24 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/amd/amdgpu/iceland_ih.c:191: warning: Function parameter or 
member 'ih' not described in 'iceland_ih_get_wptr'
 drivers/gpu/drm/amd/amdgpu/iceland_ih.c:223: warning: Function parameter or 
member 'ih' not described in 'iceland_ih_decode_iv'
 drivers/gpu/drm/amd/amdgpu/iceland_ih.c:223: warning: Function parameter or 
member 'entry' not described in 'iceland_ih_decode_iv'
 drivers/gpu/drm/amd/amdgpu/iceland_ih.c:253: warning: Function parameter or 
member 'ih' not described in 'iceland_ih_set_rptr'

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: amd-...@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/amd/amdgpu/iceland_ih.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/iceland_ih.c 
b/drivers/gpu/drm/amd/amdgpu/iceland_ih.c
index a13dd9a51149a..37d8b6ca4dab8 100644
--- a/drivers/gpu/drm/amd/amdgpu/iceland_ih.c
+++ b/drivers/gpu/drm/amd/amdgpu/iceland_ih.c
@@ -179,6 +179,7 @@ static void iceland_ih_irq_disable(struct amdgpu_device 
*adev)
  * iceland_ih_get_wptr - get the IH ring buffer wptr
  *
  * @adev: amdgpu_device pointer
+ * @ih: IH ring buffer to fetch wptr
  *
  * Get the IH ring buffer wptr from either the register
  * or the writeback memory buffer (VI).  Also check for
@@ -213,6 +214,8 @@ static u32 iceland_ih_get_wptr(struct amdgpu_device *adev,
  * iceland_ih_decode_iv - decode an interrupt vector
  *
  * @adev: amdgpu_device pointer
+ * @ih: IH ring buffer to decode
+ * @entry: IV entry to place decoded information into
  *
  * Decodes the interrupt vector at the current rptr
  * position and also advance the position.
@@ -245,6 +248,7 @@ static void iceland_ih_decode_iv(struct amdgpu_device *adev,
  * iceland_ih_set_rptr - set the IH ring buffer rptr
  *
  * @adev: amdgpu_device pointer
+ * @ih: IH ring buffer to set rptr
  *
  * Set the IH ring buffer rptr.
  */
-- 
2.25.1

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


[PATCH 01/40] drm/msm/msm_gem_shrinker: Fix descriptions for 'drm_device'

2020-11-24 Thread Lee Jones
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/msm/msm_gem_shrinker.c:108: warning: Function parameter or 
member 'dev' not described in 'msm_gem_shrinker_init'
 drivers/gpu/drm/msm/msm_gem_shrinker.c:108: warning: Excess function parameter 
'dev_priv' description in 'msm_gem_shrinker_init'
 drivers/gpu/drm/msm/msm_gem_shrinker.c:126: warning: Function parameter or 
member 'dev' not described in 'msm_gem_shrinker_cleanup'
 drivers/gpu/drm/msm/msm_gem_shrinker.c:126: warning: Excess function parameter 
'dev_priv' description in 'msm_gem_shrinker_cleanup'

Cc: Rob Clark 
Cc: Sean Paul 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: linux-arm-...@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: freedr...@lists.freedesktop.org
Signed-off-by: Lee Jones 
---
 drivers/gpu/drm/msm/msm_gem_shrinker.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_gem_shrinker.c 
b/drivers/gpu/drm/msm/msm_gem_shrinker.c
index 6f4b1355725f4..caf032e5bf2f1 100644
--- a/drivers/gpu/drm/msm/msm_gem_shrinker.c
+++ b/drivers/gpu/drm/msm/msm_gem_shrinker.c
@@ -100,7 +100,7 @@ msm_gem_shrinker_vmap(struct notifier_block *nb, unsigned 
long event, void *ptr)
 
 /**
  * msm_gem_shrinker_init - Initialize msm shrinker
- * @dev_priv: msm device
+ * @dev: drm device
  *
  * This function registers and sets up the msm shrinker.
  */
@@ -118,7 +118,7 @@ void msm_gem_shrinker_init(struct drm_device *dev)
 
 /**
  * msm_gem_shrinker_cleanup - Clean up msm shrinker
- * @dev_priv: msm device
+ * @dev: drm device
  *
  * This function unregisters the msm shrinker.
  */
-- 
2.25.1

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


[PATCH 00/40] [Set 9] Rid W=1 warnings from GPU

2020-11-24 Thread Lee Jones
This set is part of a larger effort attempting to clean-up W=1
kernel builds, which are currently overwhelmingly riddled with
niggly little warnings.

730 out of 5000 left.

Lee Jones (40):
  drm/msm/msm_gem_shrinker: Fix descriptions for 'drm_device'
  drm/amd/amdgpu/gmc_v10_0: Suppy some missing function doc descriptions
  drm/msm/adreno/a6xx_gpu_state: Make some local functions static
  drm/amd/amdgpu/iceland_ih: Add missing function param descriptions for
'ih' and 'entry'
  drm/amd/amdgpu/tonga_ih: Provide some missing descriptions for 'ih'
and 'entry'
  drm/amd/amdgpu/cz_ih: Add missing function param descriptions for 'ih'
and 'entry'
  drm/amd/amdgpu/amdgpu_psp: Make local function
'parse_ta_bin_descriptor' static
  drm/msm/dp/dp_ctrl: Move 'tu' from the stack to the heap
  drm/amd/amdgpu/vega10_ih: Add descriptions for 'ih' and 'entry'
  drm/amd/amdgpu/navi10_ih: Add descriptions for 'ih' and 'entry'
  drm/amd/amdgpu/psp_v11_0: Make local function
'psp_v11_0_wait_for_bootloader()' static
  drm/amd/amdgpu/dce_v10_0: Supply description for function param
'async'
  drm/amd/amdgpu/dce_v11_0: Supply description for function param
'async'
  drm/amd/amdgpu/gfx_v9_0: Make called-by-reference only function static
  drm/amd/amdgpu/gfx_v8_0: Functions must follow directly after their
headers
  drm/amd/amdgpu/gfx_v10_0: Remove a bunch of set but unused variables
  drm/amd/amdgpu/sdma_v2_4: Fix a bunch of kernel-doc function
documentation issues
  drm/amd/amdgpu/sdma_v3_0: Fix a bunch of kernel-doc function
documentation issues
  drm/amd/amdgpu/sdma_v3_0: Fix incorrect param doc-rot issue
  drm/amd/amdgpu/uvd_v5_0: Fix a bunch of kernel-doc function
documentation issues
  drm/amd/amdgpu/sdma_v4_0: Repair a bunch of kernel-doc problems
  drm/amd/amdgpu/amdgpu_uvd: Fix some function documentation headers
  drm/amd/amdgpu/sdma_v5_0: Provide some missing and repair other
function params
  drm/amd/amdgpu/sdma_v5_2: Provide some missing and repair other
function params
  drm/amd/amdgpu/amdgpu_vce: Provide some missing and repair other
function params
  drm/amd/amdgpu/uvd_v6_0: Fix a bunch of kernel-doc function
documentation issues
  drm/amd/amdgpu/uvd_v7_0: Fix a bunch of kernel-doc function
documentation issues
  drm/amd/amdgpu/gfx_v10_0: Make local function 'gfx_v10_0_rlc_stop()'
static
  drm/amd/amdgpu/vcn_v1_0: Fix a few kernel-doc misdemeanours
  drm/amd/amdgpu/jpeg_v1_0: Add some missing function param descriptions
  drm/amd/amdgpu/jpeg_v2_0: Add some missing kernel-doc descriptions
  drm/amd/amdgpu/vcn_v2_0: Fix a few kernel-doc misdemeanours
  drm/amd/amdgpu/vcn_v3_0: Remove unused variable 'direct_poll' from
'vcn_v3_0_start_sriov()'
  drm/amd/amdgpu/amdgpu_acp: Fix doc-rot issues pertaining to a couple
of 'handle' params
  drm/amd/pm/swsmu/smu11/vangogh_ppt: Make local function
'vangogh_set_default_dpm_tables()' static
  drm/amd/pm/inc/smu_v11_0: Mark 'smu11_thermal_policy' as
__maybe_unused
  drm/amd/pm/swsmu/smu12/renoir_ppt: Demote kernel-doc formatting abuse
  drm/amd/pm/swsmu/smu11/navi10_ppt: Remove unused 'struct i2c_algorithm
navi10_i2c_algo'
  drm/amd/pm/powerplay/smumgr/fiji_smumgr: Remove unused variable
'result'
  drm/amd/amdgpu/amdgpu_uvd: Add description for
amdgpu_uvd_cs_msg_decode()'s 'buf_sizes' param

 drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c   |   4 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c   |   6 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c   |   7 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c   |  19 +-
 drivers/gpu/drm/amd/amdgpu/cz_ih.c|   4 +
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c|   1 +
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c|   1 +
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c|  11 +-
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c |   2 +-
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c |   2 +-
 drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c|   4 +
 drivers/gpu/drm/amd/amdgpu/iceland_ih.c   |   4 +
 drivers/gpu/drm/amd/amdgpu/jpeg_v1_0.c|   7 +-
 drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c|   6 +-
 drivers/gpu/drm/amd/amdgpu/navi10_ih.c|   5 +
 drivers/gpu/drm/amd/amdgpu/psp_v11_0.c|   2 +-
 drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c|  16 +-
 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c|  16 +-
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c|  22 +-
 drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c|  19 +-
 drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c|  19 +-
 drivers/gpu/drm/amd/amdgpu/tonga_ih.c |   4 +
 drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c |  10 +-
 drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c |  21 +-
 drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c |  21 +-
 drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c |  14 +-
 drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c |  15 +-
 drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c |   4 -
 drivers/gpu/drm/amd/amdgpu/vega10_ih.c|   5 +
 

[PATCH v2 3/3] drm/msm: Improve the a6xx page fault handler

2020-11-24 Thread Jordan Crouse
Use the new adreno-smmu-priv fault info function to get more SMMU
debug registers and print the current TTBR0 to debug per-instance
pagetables and figure out which GPU block generated the request.

Signed-off-by: Jordan Crouse 
---

 drivers/gpu/drm/msm/adreno/a5xx_gpu.c |  4 +-
 drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 76 +--
 drivers/gpu/drm/msm/msm_iommu.c   | 11 +++-
 drivers/gpu/drm/msm/msm_mmu.h |  4 +-
 4 files changed, 87 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c 
b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
index d6804a802355..ed4cb81af874 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
@@ -933,7 +933,7 @@ bool a5xx_idle(struct msm_gpu *gpu, struct msm_ringbuffer 
*ring)
return true;
 }
 
-static int a5xx_fault_handler(void *arg, unsigned long iova, int flags)
+static int a5xx_fault_handler(void *arg, unsigned long iova, int flags, void 
*data)
 {
struct msm_gpu *gpu = arg;
pr_warn_ratelimited("*** gpu fault: iova=%08lx, flags=%d 
(%u,%u,%u,%u)\n",
@@ -943,7 +943,7 @@ static int a5xx_fault_handler(void *arg, unsigned long 
iova, int flags)
gpu_read(gpu, REG_A5XX_CP_SCRATCH_REG(6)),
gpu_read(gpu, REG_A5XX_CP_SCRATCH_REG(7)));
 
-   return -EFAULT;
+   return 0;
 }
 
 static void a5xx_cp_err_irq(struct msm_gpu *gpu)
diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c 
b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
index 948f3656c20c..ac6e8cd5cf1a 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
@@ -905,18 +905,88 @@ static void a6xx_recover(struct msm_gpu *gpu)
msm_gpu_hw_init(gpu);
 }
 
-static int a6xx_fault_handler(void *arg, unsigned long iova, int flags)
+static const char *a6xx_uche_fault_block(struct msm_gpu *gpu, u32 mid)
+{
+   static const char *uche_clients[7] = {
+   "VFD", "SP", "VSC", "VPC", "HLSQ", "PC", "LRZ",
+   };
+   u32 val;
+
+   if (mid < 1 || mid > 3)
+   return "UNKNOWN";
+
+   /*
+* The source of the data depends on the mid ID read from FSYNR1.
+* and the client ID read from the UCHE block
+*/
+   val = gpu_read(gpu, REG_A6XX_UCHE_CLIENT_PF);
+
+   /* mid = 3 is most precise and refers to only one block per client */
+   if (mid == 3)
+   return uche_clients[val & 7];
+
+   /* For mid=2 the source is TP or VFD except when the client id is 0 */
+   if (mid == 2)
+   return ((val & 7) == 0) ? "TP" : "TP|VFD";
+
+   /* For mid=1 just return "UCHE" as a catchall for everything else */
+   return "UCHE";
+}
+
+static const char *a6xx_fault_block(struct msm_gpu *gpu, u32 id)
+{
+   if (id == 0)
+   return "CP";
+   else if (id == 4)
+   return "CCU";
+   else if (id == 6)
+   return "CDP Prefetch";
+
+   return a6xx_uche_fault_block(gpu, id);
+}
+
+#define ARM_SMMU_FSR_TF BIT(1)
+#define ARM_SMMU_FSR_PFBIT(3)
+#define ARM_SMMU_FSR_EFBIT(4)
+
+static int a6xx_fault_handler(void *arg, unsigned long iova, int flags, void 
*data)
 {
struct msm_gpu *gpu = arg;
+   struct adreno_smmu_fault_info *info = data;
+   const char *type = "UNKNOWN";
 
-   pr_warn_ratelimited("*** gpu fault: iova=%08lx, flags=%d 
(%u,%u,%u,%u)\n",
+   /*
+* Print a default message if we couldn't get the data from the
+* adreno-smmu-priv
+*/
+   if (!info) {
+   pr_warn_ratelimited("*** gpu fault: iova=%.16lx flags=%d 
(%u,%u,%u,%u)\n",
iova, flags,
gpu_read(gpu, REG_A6XX_CP_SCRATCH_REG(4)),
gpu_read(gpu, REG_A6XX_CP_SCRATCH_REG(5)),
gpu_read(gpu, REG_A6XX_CP_SCRATCH_REG(6)),
gpu_read(gpu, REG_A6XX_CP_SCRATCH_REG(7)));
 
-   return -EFAULT;
+   return 0;
+   }
+
+   if (info->fsr & ARM_SMMU_FSR_TF)
+   type = "TRANSLATION";
+   else if (info->fsr & ARM_SMMU_FSR_PF)
+   type = "PERMISSION";
+   else if (info->fsr & ARM_SMMU_FSR_EF)
+   type = "EXTERNAL";
+
+   pr_warn_ratelimited("*** gpu fault: ttbr0=%.16llx iova=%.16lx dir=%s 
type=%s source=%s (%u,%u,%u,%u)\n",
+   info->ttbr0, iova,
+   flags & IOMMU_FAULT_WRITE ? "WRITE" : "READ", type,
+   a6xx_fault_block(gpu, info->fsynr1 & 0xff),
+   gpu_read(gpu, REG_A6XX_CP_SCRATCH_REG(4)),
+   gpu_read(gpu, REG_A6XX_CP_SCRATCH_REG(5)),
+   gpu_read(gpu, REG_A6XX_CP_SCRATCH_REG(6)),
+   gpu_read(gpu, REG_A6XX_CP_SCRATCH_REG(7)));
+
+   return 0;
 }
 
 static void a6xx_cp_hw_err_irq(struct msm_gpu *gpu)

[PATCH v2 0/3] iommu/arm-smmu: adreno-smmu page fault handling

2020-11-24 Thread Jordan Crouse
This is a stack to add an Adreno GPU specific handler for pagefaults. The first
patch starts by wiring up report_iommu_fault for arm-smmu. The next patch adds
a adreno-smmu-priv function hook to capture a handful of important debugging
registers such as TTBR0, CONTEXTIDR, FSYNR0 and others. This is used by the
third patch to print more detailed information on page fault such as the TTBR0
for the pagetable that caused the fault and the source of the fault as
determined by a combination of the FSYNR1 register and an internal GPU
register.

This code provides a solid base that we can expand on later for even more
extensive GPU side page fault debugging capabilities.

v2: Fix comment wording and function pointer check per Rob Clark

Jordan Crouse (3):
  iommu/arm-smmu: Add support for driver IOMMU fault handlers
  drm/msm: Add an adreno-smmu-priv callback to get pagefault info
  drm/msm: Improve the a6xx page fault handler

 drivers/gpu/drm/msm/adreno/a5xx_gpu.c  |  4 +-
 drivers/gpu/drm/msm/adreno/a6xx_gpu.c  | 76 +-
 drivers/gpu/drm/msm/msm_iommu.c| 11 +++-
 drivers/gpu/drm/msm/msm_mmu.h  |  4 +-
 drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 19 ++
 drivers/iommu/arm/arm-smmu/arm-smmu.c  | 16 -
 drivers/iommu/arm/arm-smmu/arm-smmu.h  |  2 +
 include/linux/adreno-smmu-priv.h   | 31 -
 8 files changed, 151 insertions(+), 12 deletions(-)

-- 
2.25.1

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


Re: [PATCHv8 0/8] System Cache support for GPU and required SMMU support

2020-11-24 Thread Rob Clark
On Tue, Nov 24, 2020 at 3:10 AM Will Deacon  wrote:
>
> On Tue, Nov 24, 2020 at 09:32:54AM +0530, Sai Prakash Ranjan wrote:
> > On 2020-11-24 00:52, Rob Clark wrote:
> > > On Mon, Nov 23, 2020 at 9:01 AM Sai Prakash Ranjan
> > >  wrote:
> > > >
> > > > On 2020-11-23 20:51, Will Deacon wrote:
> > > > > On Tue, Nov 17, 2020 at 08:00:39PM +0530, Sai Prakash Ranjan wrote:
> > > > >> Some hardware variants contain a system cache or the last level
> > > > >> cache(llc). This cache is typically a large block which is shared
> > > > >> by multiple clients on the SOC. GPU uses the system cache to cache
> > > > >> both the GPU data buffers(like textures) as well the SMMU pagetables.
> > > > >> This helps with improved render performance as well as lower power
> > > > >> consumption by reducing the bus traffic to the system memory.
> > > > >>
> > > > >> The system cache architecture allows the cache to be split into 
> > > > >> slices
> > > > >> which then be used by multiple SOC clients. This patch series is an
> > > > >> effort to enable and use two of those slices preallocated for the 
> > > > >> GPU,
> > > > >> one for the GPU data buffers and another for the GPU SMMU hardware
> > > > >> pagetables.
> > > > >>
> > > > >> Patch 1 - Patch 6 adds system cache support in SMMU and GPU driver.
> > > > >> Patch 7 and 8 are minor cleanups for arm-smmu impl.
> > > > >>
> > > > >> Changes in v8:
> > > > >>  * Introduce a generic domain attribute for pagetable config (Will)
> > > > >>  * Rename quirk to more generic IO_PGTABLE_QUIRK_ARM_OUTER_WBWA 
> > > > >> (Will)
> > > > >>  * Move non-strict mode to use new struct domain_attr_io_pgtbl_config
> > > > >> (Will)
> > > > >
> > > > > Modulo some minor comments I've made, this looks good to me. What is
> > > > > the
> > > > > plan for merging it? I can take the IOMMU parts, but patches 4-6 touch
> > > > > the
> > > > > MSM GPU driver and I'd like to avoid conflicts with that.
> > > > >
> > > >
> > > > SMMU bits are pretty much independent and GPU relies on the domain
> > > > attribute
> > > > and the quirk exposed, so as long as SMMU changes go in first it
> > > > should
> > > > be good.
> > > > Rob?
> > >
> > > I suppose one option would be to split out the patch that adds the
> > > attribute into it's own patch, and merge that both thru drm and iommu?
> > >
> >
> > Ok I can split out domain attr and quirk into its own patch if Will is
> > fine with that approach.
>
> Why don't I just queue the first two patches on their own branch and we
> both pull that?

Ok, that works for me.  I normally base msm-next on -rc1 but I guess
as long as we base the branch on the older or our two -next branches,
that should work out nicely

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


Re: [PATCH 01/40] drm/radeon/radeon_device: Consume our own header where the prototypes are located

2020-11-24 Thread Lee Jones
On Tue, 24 Nov 2020, Alex Deucher wrote:

> On Mon, Nov 23, 2020 at 6:19 AM Lee Jones  wrote:
> >
> > Fixes the following W=1 kernel build warning(s):
> >
> >  drivers/gpu/drm/radeon/radeon_device.c:637:6: warning: no previous 
> > prototype for ‘radeon_device_is_virtual’ [-Wmissing-prototypes]
> >
> > Cc: Alex Deucher 
> > Cc: "Christian König" 
> > Cc: David Airlie 
> > Cc: Daniel Vetter 
> > Cc: amd-...@lists.freedesktop.org
> > Cc: dri-devel@lists.freedesktop.org
> > Signed-off-by: Lee Jones 
> 
> Applied.  Thanks!

Thanks again Alex.  Great work!

Almost there now ...

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


RE: [PATCH rdma-core 3/5] pyverbs: Add dma-buf based MR support

2020-11-24 Thread Xiong, Jianxin
> -Original Message-
> From: Daniel Vetter 
> Sent: Tuesday, November 24, 2020 7:17 AM
> To: Jason Gunthorpe 
> Cc: Xiong, Jianxin ; Leon Romanovsky 
> ; linux-r...@vger.kernel.org; dri-
> de...@lists.freedesktop.org; Doug Ledford ; Vetter, 
> Daniel ; Christian Koenig
> 
> Subject: Re: [PATCH rdma-core 3/5] pyverbs: Add dma-buf based MR support
> 
> On Mon, Nov 23, 2020 at 02:05:04PM -0400, Jason Gunthorpe wrote:
> > On Mon, Nov 23, 2020 at 09:53:02AM -0800, Jianxin Xiong wrote:
> >
> > > +cdef class DmaBuf:
> > > +def __init__(self, size, unit=0):
> > > +"""
> > > +Allocate DmaBuf object from a GPU device. This is done through 
> > > the
> > > +DRI device interface (/dev/dri/card*). Usually this
> > > +requires the
> 
> Please use /dev/dri/renderD* instead. That's the interface meant for 
> unpriviledged rendering access. card* is the legacy interface with
> backwards compat galore, don't use.
> 
> Specifically if you do this on a gpu which also has display (maybe some 
> testing on a local developer machine, no idea ...) then you mess with
> compositors and stuff.
> 
> Also wherever you copied this from, please also educate those teams that 
> using /dev/dri/card* for rendering stuff is a Bad Idea (tm)

/dev/dri/renderD* is not always available (e.g. for many iGPUs) and doesn't 
support
mode setting commands (including dumb_buf). The original intention here is to
have something to support the new tests added, not for general compute. 

> 
> > > +effective user id being root or being a member of the 'video' 
> > > group.
> > > +:param size: The size (in number of bytes) of the buffer.
> > > +:param unit: The unit number of the GPU to allocate the buffer 
> > > from.
> > > +:return: The newly created DmaBuf object on success.
> > > +"""
> > > +self.dmabuf_mrs = weakref.WeakSet()
> > > +self.dri_fd = open('/dev/dri/card'+str(unit), O_RDWR)
> > > +
> > > +args = bytearray(32)
> > > +pack_into('=iiq', args, 0, 1, size, 8, 0, 0, 0, 0)
> > > +ioctl(self.dri_fd, DRM_IOCTL_MODE_CREATE_DUMB, args)
> > > +a, b, c, d, self.handle, e, self.size = unpack('=iiq',
> > > + args)
> 
> Yeah no, don't allocate render buffers with create_dumb. Every time this 
> comes up I'm wondering whether we should just completely
> disable dma-buf operations on these. Dumb buffers are explicitly only for 
> software rendering for display purposes when the gpu userspace
> stack isn't fully running yet, aka boot splash.
> 
> And yes I know there's endless amounts of abuse of that stuff floating 
> around, especially on arm-soc/android systems.

One alternative is to use the GEM_CREATE method which can be done via the 
renderD*
device, but the command is vendor specific, so the logic is a little bit more 
complex. 

> 
> > > +
> > > +args = bytearray(12)
> > > +pack_into('=iii', args, 0, self.handle, O_RDWR, 0)
> > > +ioctl(self.dri_fd, DRM_IOCTL_PRIME_HANDLE_TO_FD, args)
> > > +a, b, self.fd = unpack('=iii', args)
> > > +
> > > +args = bytearray(16)
> > > +pack_into('=iiq', args, 0, self.handle, 0, 0)
> > > +ioctl(self.dri_fd, DRM_IOCTL_MODE_MAP_DUMB, args);
> > > +a, b, self.map_offset = unpack('=iiq', args);
> >
> > Wow, OK
> >
> > Is it worth using ctypes here instead? Can you at least add a comment
> > before each pack specifying the 'struct XXX' this is following?
> >
> > Does this work with normal Intel GPUs, like in a Laptop? AMD too?
> >
> > Christian, I would be very happy to hear from you that this entire
> > work is good for AMD as well
> 
> I think the smallest generic interface for allocating gpu buffers which are 
> more useful than the stuff you get from CREATE_DUMB is gbm.
> That's used by compositors to get bare metal opengl going on linux. Ofc 
> Android has gralloc for the same purpose, and cros has minigbm
> (which isn't the same as gbm at all). So not so cool.

Again, would the "renderD* + GEM_CREATE" combination be an acceptable 
alternative? 
That would be much simpler than going with gbm and less dependency in setting up
the testing evrionment.

> 
> The other generic option is using vulkan, which works directly on bare metal 
> (without a compositor or anything running), and is cross vendor.
> So cool, except not used for compute, which is generally the thing you want 
> if you have an rdma card.
> 
> Both gbm-egl/opengl and vulkan have extensions to hand you a dma-buf back, 
> properly.
> 
> Compute is the worst, because opencl is widely considered a mistake (maybe 
> opencl 3 is better, but nvidia is stuck on 1.2). The actually used
> stuff is cuda (nvidia-only), rocm (amd-only) and now with intel also playing 
> we have xe (intel-only).
> 
> It's pretty glorious :-/
> 
> Also I think we discussed this already, but for actual p2p the intel patches 
> aren't in upstream yet. We have some internally, but with very
> 

RE: [PATCH v11 1/4] RDMA/umem: Support importing dma-buf as user memory region

2020-11-24 Thread Xiong, Jianxin
> -Original Message-
> From: Christoph Hellwig 
> Sent: Tuesday, November 24, 2020 1:34 AM
> To: Xiong, Jianxin 
> Cc: linux-r...@vger.kernel.org; dri-devel@lists.freedesktop.org; Doug Ledford 
> ; Jason Gunthorpe ;
> Leon Romanovsky ; Sumit Semwal ; 
> Christian Koenig ; Vetter,
> Daniel 
> Subject: Re: [PATCH v11 1/4] RDMA/umem: Support importing dma-buf as user 
> memory region
> 
> As these are mostly trivial wrappers around the EXPORT_SYMBOL_GPL dmabuf 
> exports please stick to that export style.
> 
> > --- /dev/null
> > +++ b/drivers/infiniband/core/umem_dmabuf.h
> > @@ -0,0 +1,11 @@
> > +/* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */
> > +/*
> > + * Copyright (c) 2020 Intel Corporation. All rights reserved.
> > + */
> > +
> > +#ifndef UMEM_DMABUF_H
> > +#define UMEM_DMABUF_H
> > +
> > +void ib_umem_dmabuf_release(struct ib_umem_dmabuf *umem_dmabuf);
> > +
> > +#endif /* UMEM_DMABUF_H */
> 
> Does this really need a separate header?

The symbol doesn't need to be exported otherwise it can be put into "ib_umem.h".
Although the prototype could be put into the file where it is called directly, 
using a
separate header file provides a cleaner interface.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


RE: [PATCH rdma-core 1/5] verbs: Support dma-buf based memory region

2020-11-24 Thread Xiong, Jianxin
> -Original Message-
> From: Yishai Hadas 
> Sent: Tuesday, November 24, 2020 2:32 AM
> To: Xiong, Jianxin 
> Cc: linux-r...@vger.kernel.org; dri-devel@lists.freedesktop.org; Doug Ledford 
> ; Jason Gunthorpe ;
> Leon Romanovsky ; Sumit Semwal ; 
> Christian Koenig ; Vetter,
> Daniel ; Yishai Hadas 
> Subject: Re: [PATCH rdma-core 1/5] verbs: Support dma-buf based memory region
> 
> On 11/23/2020 7:53 PM, Jianxin Xiong wrote:
> > Add new API function and new provider method for registering dma-buf
> > based memory region. Update the man page and bump the API version.
> >
> > Signed-off-by: Jianxin Xiong 
> > ---
> >   kernel-headers/rdma/ib_user_ioctl_cmds.h | 14 
> >   libibverbs/cmd_mr.c  | 38 
> > 
> >   libibverbs/driver.h  |  7 ++
> >   libibverbs/dummy_ops.c   | 11 +
> >   libibverbs/libibverbs.map.in |  6 +
> >   libibverbs/man/ibv_reg_mr.3  | 21 --
> >   libibverbs/verbs.c   | 19 
> >   libibverbs/verbs.h   | 10 +
> >   8 files changed, 124 insertions(+), 2 deletions(-)
> >
> > diff --git a/kernel-headers/rdma/ib_user_ioctl_cmds.h
> > b/kernel-headers/rdma/ib_user_ioctl_cmds.h
> > index 7968a18..dafc7eb 100644
> > --- a/kernel-headers/rdma/ib_user_ioctl_cmds.h
> > +++ b/kernel-headers/rdma/ib_user_ioctl_cmds.h
> > @@ -1,5 +1,6 @@
> >   /*
> >* Copyright (c) 2018, Mellanox Technologies inc.  All rights reserved.
> > + * Copyright (c) 2020, Intel Corporation. All rights reserved.
> >*
> >* This software is available to you under a choice of one of two
> >* licenses.  You may choose to be licensed under the terms of the
> > GNU @@ -251,6 +252,7 @@ enum uverbs_methods_mr {
> > UVERBS_METHOD_MR_DESTROY,
> > UVERBS_METHOD_ADVISE_MR,
> > UVERBS_METHOD_QUERY_MR,
> > +   UVERBS_METHOD_REG_DMABUF_MR,
> >   };
> >
> >   enum uverbs_attrs_mr_destroy_ids {
> > @@ -272,6 +274,18 @@ enum uverbs_attrs_query_mr_cmd_attr_ids {
> > UVERBS_ATTR_QUERY_MR_RESP_IOVA,
> >   };
> >
> > +enum uverbs_attrs_reg_dmabuf_mr_cmd_attr_ids {
> > +   UVERBS_ATTR_REG_DMABUF_MR_HANDLE,
> > +   UVERBS_ATTR_REG_DMABUF_MR_PD_HANDLE,
> > +   UVERBS_ATTR_REG_DMABUF_MR_OFFSET,
> > +   UVERBS_ATTR_REG_DMABUF_MR_LENGTH,
> > +   UVERBS_ATTR_REG_DMABUF_MR_IOVA,
> > +   UVERBS_ATTR_REG_DMABUF_MR_FD,
> > +   UVERBS_ATTR_REG_DMABUF_MR_ACCESS_FLAGS,
> > +   UVERBS_ATTR_REG_DMABUF_MR_RESP_LKEY,
> > +   UVERBS_ATTR_REG_DMABUF_MR_RESP_RKEY,
> > +};
> > +
> >   enum uverbs_attrs_create_counters_cmd_attr_ids {
> > UVERBS_ATTR_CREATE_COUNTERS_HANDLE,
> >   };
> > diff --git a/libibverbs/cmd_mr.c b/libibverbs/cmd_mr.c index
> > 42dbe42..91ce2ef 100644
> > --- a/libibverbs/cmd_mr.c
> > +++ b/libibverbs/cmd_mr.c
> > @@ -1,5 +1,6 @@
> >   /*
> >* Copyright (c) 2018 Mellanox Technologies, Ltd.  All rights reserved.
> > + * Copyright (c) 2020 Intel Corporation.  All rights reserved.
> >*
> >* This software is available to you under a choice of one of two
> >* licenses.  You may choose to be licensed under the terms of the
> > GNU @@ -116,3 +117,40 @@ int ibv_cmd_query_mr(struct ibv_pd *pd, struct 
> > verbs_mr *vmr,
> > return 0;
> >   }
> >
> > +int ibv_cmd_reg_dmabuf_mr(struct ibv_pd *pd, uint64_t offset, size_t 
> > length,
> > + uint64_t iova, int fd, int access,
> > + struct verbs_mr *vmr)
> > +{
> > +   DECLARE_COMMAND_BUFFER(cmdb, UVERBS_OBJECT_MR,
> > +  UVERBS_METHOD_REG_DMABUF_MR,
> > +  9);
> > +   struct ib_uverbs_attr *handle;
> > +   uint32_t lkey, rkey;
> > +   int ret;
> > +
> > +   handle = fill_attr_out_obj(cmdb, UVERBS_ATTR_REG_DMABUF_MR_HANDLE);
> > +   fill_attr_out_ptr(cmdb, UVERBS_ATTR_REG_DMABUF_MR_RESP_LKEY, );
> > +   fill_attr_out_ptr(cmdb, UVERBS_ATTR_REG_DMABUF_MR_RESP_RKEY, );
> > +
> > +   fill_attr_in_obj(cmdb, UVERBS_ATTR_REG_DMABUF_MR_PD_HANDLE, pd->handle);
> > +   fill_attr_in_uint64(cmdb, UVERBS_ATTR_REG_DMABUF_MR_OFFSET, offset);
> > +   fill_attr_in_uint64(cmdb, UVERBS_ATTR_REG_DMABUF_MR_LENGTH, length);
> > +   fill_attr_in_uint64(cmdb, UVERBS_ATTR_REG_DMABUF_MR_IOVA, iova);
> > +   fill_attr_in_uint32(cmdb, UVERBS_ATTR_REG_DMABUF_MR_FD, fd);
> > +   fill_attr_in_uint32(cmdb, UVERBS_ATTR_REG_DMABUF_MR_ACCESS_FLAGS,
> > +access);
> > +
> > +   ret = execute_ioctl(pd->context, cmdb);
> > +   if (ret)
> > +   return errno;
> > +
> > +   vmr->ibv_mr.handle =
> > +   read_attr_obj(UVERBS_ATTR_REG_DMABUF_MR_HANDLE, handle);
> > +   vmr->ibv_mr.context = pd->context;
> > +   vmr->ibv_mr.lkey= lkey;
> > +   vmr->ibv_mr.rkey= rkey;
> > +   vmr->ibv_mr.pd  = pd;
> > +   vmr->ibv_mr.addr= (void *)offset;
> > +   vmr->ibv_mr.length  = length;
> > +   vmr->mr_type= IBV_MR_TYPE_MR;
> > +   return 0;
> > +}
> > diff --git 

Re: [PATCH 1/2] panel-simple: add Innolux N125HCE-GN1

2020-11-24 Thread Sam Ravnborg
Hi Lukas.

On Tue, Nov 24, 2020 at 06:26:04PM +0100, Lukas F. Hartmann wrote:
> The Innolux N125HCE-GN1 display is used in the MNT Reform 2.0 laptop,
> attached via eDP to a SN65DSI86 MIPI-DSI to eDP bridge.
> 
> Signed-off-by: Lukas F. Hartmann 

Danke, applied to drm-misc-next.

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


Re: [PATCH 2/2] dt-bindings: display/panel: add Innolux N125HCE-GN1

2020-11-24 Thread Sam Ravnborg
Hi Lukas

On Tue, Nov 24, 2020 at 06:26:06PM +0100, Lukas F. Hartmann wrote:
> The Innolux N125HCE-GN1 display is used in the MNT Reform 2.0 laptop,
> attached via eDP to a SN65DSI86 MIPI-DSI to eDP bridge. This patch
> contains the DT binding for "innolux,n125hce-gn1".
> 
> Signed-off-by: Lukas F. Hartmann 

bindings before their usage, so this should be first patch.

> ---
>  .../devicetree/bindings/display/panel/panel-simple.yaml | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git 
> a/Documentation/devicetree/bindings/display/panel/panel-simple.yaml 
> b/Documentation/devicetree/bindings/display/panel/panel-simple.yaml
> index edb53ab0d..03b3e0b9d 100644
> --- a/Documentation/devicetree/bindings/display/panel/panel-simple.yaml
> +++ b/Documentation/devicetree/bindings/display/panel/panel-simple.yaml
> @@ -160,6 +160,8 @@ properties:
>  # Innolux Corporation 11.6" WXGA (1366x768) TFT LCD panel
>- innolux,n116bge
>  # InnoLux 15.6" WXGA TFT LCD panel
> +  - innolux,n125hce-gn1
> +# InnoLux 13.3" FHD (1920x1080) eDP TFT LCD panel

Comments before the compatible.

I applied this first and reordered the comment - so both details are
handled.

Applied to drm-misc-next.

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


Re: [PATCH v3 07/12] drm/sched: Prevent any job recoveries after device is unplugged.

2020-11-24 Thread Luben Tuikov
On 2020-11-24 12:40 p.m., Christian König wrote:
> Am 24.11.20 um 18:11 schrieb Luben Tuikov:
>> On 2020-11-24 2:50 a.m., Christian König wrote:
>>> Am 24.11.20 um 02:12 schrieb Luben Tuikov:
 On 2020-11-23 3:06 a.m., Christian König wrote:
> Am 23.11.20 um 06:37 schrieb Andrey Grodzovsky:
>> On 11/22/20 6:57 AM, Christian König wrote:
>>> Am 21.11.20 um 06:21 schrieb Andrey Grodzovsky:
 No point to try recovery if device is gone, it's meaningless.
>>> I think that this should go into the device specific recovery
>>> function and not in the scheduler.
>> The timeout timer is rearmed here, so this prevents any new recovery
>> work to restart from here
>> after drm_dev_unplug was executed from amdgpu_pci_remove.It will not
>> cover other places like
>> job cleanup or starting new job but those should stop once the
>> scheduler thread is stopped later.
> Yeah, but this is rather unclean. We should probably return an error
> code instead if the timer should be rearmed or not.
 Christian, this is exactly my work I told you about
 last week on Wednesday in our weekly meeting. And
 which I wrote to you in an email last year about this
 time.
>>> Yeah, that's why I'm suggesting it here as well.
>> It seems you're suggesting that Andrey do it, while
>> all too well you know I've been working on this
>> for some time now.
> 
> Changing the return value is just a minimal change and I didn't want to 
> block Andrey in any way.
> 

But it is the suggestion I had last year this time.
It is the whole root of my changes--it's a gamechanger.

>>
>> I wrote you about this last year same time
>> in an email. And I discussed it on the Wednesday
>> meeting.
>>
>> You could've mentioned that here the first time.
>>
 So what do we do now?
>>> Split your patches into smaller parts and submit them chunk by chunk.
>>>
>>> E.g. renames first and then functional changes grouped by area they change.
>> I have, but my final patch, a tiny one but which implements
>> the core reason for the change seems buggy, and I'm looking
>> for a way to debug it.
> 
> Just send it out in chunks, e.g. non functional changes like renames 
> shouldn't cause any problems and having them in the branch early 
> minimizes conflicts with work from others.

Yeah, I agree, that's a good idea.

My final tiny patch is causing me grief and I'd rather
have had it working. :'-(

Regards,
Luben

> 
> Regards,
> Christian.
> 
>>
>> Regards,
>> Luben
>>
>>
>>> Regards,
>>> Christian.
>>>
 I can submit those changes without the last part,
 which builds on this change.

 I'm still testing the last part and was hoping
 to submit it all in one sequence of patches,
 after my testing.

 Regards,
 Luben

> Christian.
>
>> Andrey
>>
>>
>>> Christian.
>>>
 Signed-off-by: Andrey Grodzovsky 
 ---
     drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c |  2 +-
     drivers/gpu/drm/etnaviv/etnaviv_sched.c   |  3 ++-
     drivers/gpu/drm/lima/lima_sched.c |  3 ++-
     drivers/gpu/drm/panfrost/panfrost_job.c   |  2 +-
     drivers/gpu/drm/scheduler/sched_main.c    | 15 ++-
     drivers/gpu/drm/v3d/v3d_sched.c   | 15 ++-
     include/drm/gpu_scheduler.h   |  6 +-
     7 files changed, 35 insertions(+), 11 deletions(-)

 diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
 b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
 index d56f402..d0b0021 100644
 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
 +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
 @@ -487,7 +487,7 @@ int amdgpu_fence_driver_init_ring(struct
 amdgpu_ring *ring,
       r = drm_sched_init(>sched, _sched_ops,
    num_hw_submission, amdgpu_job_hang_limit,
 -   timeout, ring->name);
 +   timeout, ring->name, >ddev);
     if (r) {
     DRM_ERROR("Failed to create scheduler on ring %s.\n",
       ring->name);
 diff --git a/drivers/gpu/drm/etnaviv/etnaviv_sched.c
 b/drivers/gpu/drm/etnaviv/etnaviv_sched.c
 index cd46c88..7678287 100644
 --- a/drivers/gpu/drm/etnaviv/etnaviv_sched.c
 +++ b/drivers/gpu/drm/etnaviv/etnaviv_sched.c
 @@ -185,7 +185,8 @@ int etnaviv_sched_init(struct etnaviv_gpu *gpu)
       ret = drm_sched_init(>sched, _sched_ops,
      etnaviv_hw_jobs_limit, etnaviv_job_hang_limit,
 - msecs_to_jiffies(500), dev_name(gpu->dev));
 + msecs_to_jiffies(500), dev_name(gpu->dev),
 + gpu->drm);
     if (ret)
     return ret;
     diff --git 

Re: [PATCH v3 07/12] drm/sched: Prevent any job recoveries after device is unplugged.

2020-11-24 Thread Luben Tuikov
On 2020-11-24 12:17 p.m., Andrey Grodzovsky wrote:
> 
> On 11/24/20 12:11 PM, Luben Tuikov wrote:
>> On 2020-11-24 2:50 a.m., Christian König wrote:
>>> Am 24.11.20 um 02:12 schrieb Luben Tuikov:
 On 2020-11-23 3:06 a.m., Christian König wrote:
> Am 23.11.20 um 06:37 schrieb Andrey Grodzovsky:
>> On 11/22/20 6:57 AM, Christian König wrote:
>>> Am 21.11.20 um 06:21 schrieb Andrey Grodzovsky:
 No point to try recovery if device is gone, it's meaningless.
>>> I think that this should go into the device specific recovery
>>> function and not in the scheduler.
>> The timeout timer is rearmed here, so this prevents any new recovery
>> work to restart from here
>> after drm_dev_unplug was executed from amdgpu_pci_remove.It will not
>> cover other places like
>> job cleanup or starting new job but those should stop once the
>> scheduler thread is stopped later.
> Yeah, but this is rather unclean. We should probably return an error
> code instead if the timer should be rearmed or not.
 Christian, this is exactly my work I told you about
 last week on Wednesday in our weekly meeting. And
 which I wrote to you in an email last year about this
 time.
>>> Yeah, that's why I'm suggesting it here as well.
>> It seems you're suggesting that Andrey do it, while
>> all too well you know I've been working on this
>> for some time now.
>>
>> I wrote you about this last year same time
>> in an email. And I discussed it on the Wednesday
>> meeting.
>>
>> You could've mentioned that here the first time.
> 
> 
> Luben, I actually strongly prefer that you do it and share ur patch with me 
> since I don't
> want to do unneeded refactoring which will conflict with with ur work. Also, 
> please
> usedrm-misc for this since it's not amdgpu specific work and will be easier 
> for me.
> 
> Andrey

No problem, Andrey--will do.

Regards,
Luben

> 
> 
>>
 So what do we do now?
>>> Split your patches into smaller parts and submit them chunk by chunk.
>>>
>>> E.g. renames first and then functional changes grouped by area they change.
>> I have, but my final patch, a tiny one but which implements
>> the core reason for the change seems buggy, and I'm looking
>> for a way to debug it.
>>
>> Regards,
>> Luben
>>
>>
>>> Regards,
>>> Christian.
>>>
 I can submit those changes without the last part,
 which builds on this change.

 I'm still testing the last part and was hoping
 to submit it all in one sequence of patches,
 after my testing.

 Regards,
 Luben

> Christian.
>
>> Andrey
>>
>>
>>> Christian.
>>>
 Signed-off-by: Andrey Grodzovsky 
 ---
     drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c |  2 +-
     drivers/gpu/drm/etnaviv/etnaviv_sched.c   |  3 ++-
     drivers/gpu/drm/lima/lima_sched.c |  3 ++-
     drivers/gpu/drm/panfrost/panfrost_job.c   |  2 +-
     drivers/gpu/drm/scheduler/sched_main.c    | 15 ++-
     drivers/gpu/drm/v3d/v3d_sched.c   | 15 ++-
     include/drm/gpu_scheduler.h   |  6 +-
     7 files changed, 35 insertions(+), 11 deletions(-)

 diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
 b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
 index d56f402..d0b0021 100644
 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
 +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
 @@ -487,7 +487,7 @@ int amdgpu_fence_driver_init_ring(struct
 amdgpu_ring *ring,
       r = drm_sched_init(>sched, _sched_ops,
    num_hw_submission, amdgpu_job_hang_limit,
 -   timeout, ring->name);
 +   timeout, ring->name, >ddev);
     if (r) {
     DRM_ERROR("Failed to create scheduler on ring %s.\n",
       ring->name);
 diff --git a/drivers/gpu/drm/etnaviv/etnaviv_sched.c
 b/drivers/gpu/drm/etnaviv/etnaviv_sched.c
 index cd46c88..7678287 100644
 --- a/drivers/gpu/drm/etnaviv/etnaviv_sched.c
 +++ b/drivers/gpu/drm/etnaviv/etnaviv_sched.c
 @@ -185,7 +185,8 @@ int etnaviv_sched_init(struct etnaviv_gpu *gpu)
       ret = drm_sched_init(>sched, _sched_ops,
      etnaviv_hw_jobs_limit, etnaviv_job_hang_limit,
 - msecs_to_jiffies(500), dev_name(gpu->dev));
 + msecs_to_jiffies(500), dev_name(gpu->dev),
 + gpu->drm);
     if (ret)
     return ret;
     diff --git a/drivers/gpu/drm/lima/lima_sched.c
 b/drivers/gpu/drm/lima/lima_sched.c
 index dc6df9e..8a7e5d7ca 100644
 --- a/drivers/gpu/drm/lima/lima_sched.c
 +++ b/drivers/gpu/drm/lima/lima_sched.c
 

[Bug 205675] Display locks up. AMDGPU timeout

2020-11-24 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=205675

swrbrsestryt (febola5...@opetron.com) changed:

   What|Removed |Added

 CC||febola5...@opetron.com

--- Comment #39 from swrbrsestryt (febola5...@opetron.com) ---
https://www.deviantart.com/eawearnt/commission/Official-LiVe-STrEaM-Man-United-vs-Istanbul-Basaksehir-LivE-Stream-Fr-1413866
https://www.deviantart.com/eawearnt/commission/StrEaM-Man-United-vs-Istanbul-Basaksehir-LivE-FreE-1413867
https://www.deviantart.com/eawearnt/commission/LIVESTREAM-Official-Man-United-vs-Istanbul-Basaksehir-Live-Stream-1413868
https://www.deviantart.com/eawearnt/commission/LIVE-Man-United-vs-Istanbul-Basaksehir-Live-Stream-Free-UCL-2020-1413869
https://www.deviantart.com/eawearnt/commission/WATCH-LiveStrEaM-Man-United-vs-Istanbul-Basaksehir-Live-LiVe-Stre-1413870
https://www.deviantart.com/eawearnt/commission/Official-LIVESTREAM-Manchester-United-vs-Istanbul-Basaksehir-STrEa-1413871https://www.deviantart.com/eawearnt/commission/WATCH-Tv-Manchester-United-vs-Istanbul-Basaksehir-2020-Live-Stream-1413872
https://www.deviantart.com/eawearnt/commission/official-LiVeStrEAM-Manchester-United-vs-Istanbul-Basaksehir-202-1413873
https://www.deviantart.com/eawearnt/commission/Livestream-UCL-Manchester-United-vs-Istanbul-Basaksehir-2020-Live-Free-1413874
https://www.deviantart.com/eawearnt/commission/Reddit-Streams-Man-United-vs-Istanbul-Basaksehir-2020-Live-Stre-1413875
https://paiza.io/projects/gHbzxd7LNQb-C_-FWYjsDQ?language=php
https://blog.goo.ne.jp/swrwretryty/e/2f5207fc118efcf28e869e79427d22ba
https://note.com/sernsertrytuy/n/n651e525c68da
https://caribbeanfever.com/photo/albums/streams-man-utd-vs-istanbul-basaksehir-live-stream
https://www.postads.ph/ad/livestreams-man-united-vs-istanbul-online

-- 
You are receiving this mail because:
You are watching the assignee of the bug.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v3 07/12] drm/sched: Prevent any job recoveries after device is unplugged.

2020-11-24 Thread Christian König

Am 24.11.20 um 18:11 schrieb Luben Tuikov:

On 2020-11-24 2:50 a.m., Christian König wrote:

Am 24.11.20 um 02:12 schrieb Luben Tuikov:

On 2020-11-23 3:06 a.m., Christian König wrote:

Am 23.11.20 um 06:37 schrieb Andrey Grodzovsky:

On 11/22/20 6:57 AM, Christian König wrote:

Am 21.11.20 um 06:21 schrieb Andrey Grodzovsky:

No point to try recovery if device is gone, it's meaningless.

I think that this should go into the device specific recovery
function and not in the scheduler.

The timeout timer is rearmed here, so this prevents any new recovery
work to restart from here
after drm_dev_unplug was executed from amdgpu_pci_remove.It will not
cover other places like
job cleanup or starting new job but those should stop once the
scheduler thread is stopped later.

Yeah, but this is rather unclean. We should probably return an error
code instead if the timer should be rearmed or not.

Christian, this is exactly my work I told you about
last week on Wednesday in our weekly meeting. And
which I wrote to you in an email last year about this
time.

Yeah, that's why I'm suggesting it here as well.

It seems you're suggesting that Andrey do it, while
all too well you know I've been working on this
for some time now.


Changing the return value is just a minimal change and I didn't want to 
block Andrey in any way.




I wrote you about this last year same time
in an email. And I discussed it on the Wednesday
meeting.

You could've mentioned that here the first time.


So what do we do now?

Split your patches into smaller parts and submit them chunk by chunk.

E.g. renames first and then functional changes grouped by area they change.

I have, but my final patch, a tiny one but which implements
the core reason for the change seems buggy, and I'm looking
for a way to debug it.


Just send it out in chunks, e.g. non functional changes like renames 
shouldn't cause any problems and having them in the branch early 
minimizes conflicts with work from others.


Regards,
Christian.



Regards,
Luben



Regards,
Christian.


I can submit those changes without the last part,
which builds on this change.

I'm still testing the last part and was hoping
to submit it all in one sequence of patches,
after my testing.

Regards,
Luben


Christian.


Andrey



Christian.


Signed-off-by: Andrey Grodzovsky 
---
    drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c |  2 +-
    drivers/gpu/drm/etnaviv/etnaviv_sched.c   |  3 ++-
    drivers/gpu/drm/lima/lima_sched.c |  3 ++-
    drivers/gpu/drm/panfrost/panfrost_job.c   |  2 +-
    drivers/gpu/drm/scheduler/sched_main.c    | 15 ++-
    drivers/gpu/drm/v3d/v3d_sched.c   | 15 ++-
    include/drm/gpu_scheduler.h   |  6 +-
    7 files changed, 35 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
index d56f402..d0b0021 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
@@ -487,7 +487,7 @@ int amdgpu_fence_driver_init_ring(struct
amdgpu_ring *ring,
      r = drm_sched_init(>sched, _sched_ops,
   num_hw_submission, amdgpu_job_hang_limit,
-   timeout, ring->name);
+   timeout, ring->name, >ddev);
    if (r) {
    DRM_ERROR("Failed to create scheduler on ring %s.\n",
      ring->name);
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_sched.c
b/drivers/gpu/drm/etnaviv/etnaviv_sched.c
index cd46c88..7678287 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_sched.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_sched.c
@@ -185,7 +185,8 @@ int etnaviv_sched_init(struct etnaviv_gpu *gpu)
      ret = drm_sched_init(>sched, _sched_ops,
     etnaviv_hw_jobs_limit, etnaviv_job_hang_limit,
- msecs_to_jiffies(500), dev_name(gpu->dev));
+ msecs_to_jiffies(500), dev_name(gpu->dev),
+ gpu->drm);
    if (ret)
    return ret;
    diff --git a/drivers/gpu/drm/lima/lima_sched.c
b/drivers/gpu/drm/lima/lima_sched.c
index dc6df9e..8a7e5d7ca 100644
--- a/drivers/gpu/drm/lima/lima_sched.c
+++ b/drivers/gpu/drm/lima/lima_sched.c
@@ -505,7 +505,8 @@ int lima_sched_pipe_init(struct lima_sched_pipe
*pipe, const char *name)
      return drm_sched_init(>base, _sched_ops, 1,
      lima_job_hang_limit, msecs_to_jiffies(timeout),
-  name);
+  name,
+  pipe->ldev->ddev);
    }
      void lima_sched_pipe_fini(struct lima_sched_pipe *pipe)
diff --git a/drivers/gpu/drm/panfrost/panfrost_job.c
b/drivers/gpu/drm/panfrost/panfrost_job.c
index 30e7b71..37b03b01 100644
--- a/drivers/gpu/drm/panfrost/panfrost_job.c
+++ b/drivers/gpu/drm/panfrost/panfrost_job.c
@@ -520,7 +520,7 @@ int panfrost_job_init(struct panfrost_device
*pfdev)
    ret = drm_sched_init(>queue[j].sched,
     _sched_ops,
  

Re: [PATCH v4 70/80] drm/panel: panel-dsi-cm: drop unneeded includes

2020-11-24 Thread Sam Ravnborg
On Tue, Nov 24, 2020 at 02:45:28PM +0200, Tomi Valkeinen wrote:
> Drop unneeded includes.
> 
> Signed-off-by: Tomi Valkeinen 
I trust the compiler here.
Reviewed-by: Sam Ravnborg 

> ---
>  drivers/gpu/drm/panel/panel-dsi-cm.c | 5 -
>  1 file changed, 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-dsi-cm.c 
> b/drivers/gpu/drm/panel/panel-dsi-cm.c
> index ec87b785871f..91ed8237a1c2 100644
> --- a/drivers/gpu/drm/panel/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/panel/panel-dsi-cm.c
> @@ -9,12 +9,7 @@
>  #include 
>  #include 
>  #include 
> -#include 
>  #include 
> -#include 
> -#include 
> -#include 
> -#include 
>  #include 
>  
>  #include 
> -- 
> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
> Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v4 69/80] drm/panel: panel-dsi-cm: add panel database to driver

2020-11-24 Thread Sam Ravnborg
On Tue, Nov 24, 2020 at 02:45:27PM +0200, Tomi Valkeinen wrote:
> Add a panel database to the driver instead of reading propertes from DT
> data. This is similar to panel-simple, and I believe it's more future
> safe way to handle the panels.
> 
> Signed-off-by: Tomi Valkeinen 

Looks good, and you remembered to drop the unsed includes - nice.

Reviewed-by: Sam Ravnborg 


> ---
>  drivers/gpu/drm/panel/panel-dsi-cm.c | 107 +--
>  1 file changed, 69 insertions(+), 38 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-dsi-cm.c 
> b/drivers/gpu/drm/panel/panel-dsi-cm.c
> index c17ed728c695..ec87b785871f 100644
> --- a/drivers/gpu/drm/panel/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/panel/panel-dsi-cm.c
> @@ -22,10 +22,7 @@
>  #include 
>  #include 
>  
> -#include 
>  #include 
> -#include 
> -#include 
>  
>  #define DCS_GET_ID1  0xda
>  #define DCS_GET_ID2  0xdb
> @@ -33,6 +30,18 @@
>  
>  #define DCS_REGULATOR_SUPPLY_NUM 2
>  
> +static const struct of_device_id dsicm_of_match[];
> +
> +struct dsic_panel_data {
> + u32 xres;
> + u32 yres;
> + u32 refresh;
> + u32 width_mm;
> + u32 height_mm;
> + u32 max_hs_rate;
> + u32 max_lp_rate;
> +};
> +
>  struct panel_drv_data {
>   struct mipi_dsi_device *dsi;
>   struct drm_panel panel;
> @@ -48,16 +57,14 @@ struct panel_drv_data {
>*/
>   unsigned long   hw_guard_wait;  /* max guard time in jiffies */
>  
> - /* panel HW configuration from DT or platform data */
> + const struct dsic_panel_data *panel_data;
> +
>   struct gpio_desc *reset_gpio;
>  
>   struct regulator_bulk_data supplies[DCS_REGULATOR_SUPPLY_NUM];
>  
>   bool use_dsi_backlight;
>  
> - int width_mm;
> - int height_mm;
> -
>   /* runtime variables */
>   bool enabled;
>  
> @@ -455,11 +462,8 @@ static int dsicm_get_modes(struct drm_panel *panel,
>   return -ENOMEM;
>   }
>  
> - drm_mode_set_name(mode);
> - mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
> -
> - connector->display_info.width_mm = ddata->width_mm;
> - connector->display_info.height_mm = ddata->height_mm;
> + connector->display_info.width_mm = ddata->panel_data->width_mm;
> + connector->display_info.height_mm = ddata->panel_data->height_mm;
>  
>   drm_mode_probed_add(connector, mode);
>  
> @@ -476,15 +480,10 @@ static const struct drm_panel_funcs dsicm_panel_funcs = 
> {
>  
>  static int dsicm_probe_of(struct mipi_dsi_device *dsi)
>  {
> - struct device_node *node = dsi->dev.of_node;
>   struct backlight_device *backlight;
>   struct panel_drv_data *ddata = mipi_dsi_get_drvdata(dsi);
> - struct display_timing timing;
> - struct videomode vm = {
> - .hactive = 864,
> - .vactive = 480,
> - };
>   int err;
> + struct drm_display_mode *mode = >mode;
>  
>   ddata->reset_gpio = devm_gpiod_get(>dev, "reset", GPIOD_OUT_LOW);
>   if (IS_ERR(ddata->reset_gpio)) {
> @@ -493,23 +492,16 @@ static int dsicm_probe_of(struct mipi_dsi_device *dsi)
>   return err;
>   }
>  
> - err = of_get_display_timing(node, "panel-timing", );
> - if (!err) {
> - videomode_from_timing(, );
> - } else {
> - dev_warn(>dev,
> -  "failed to get video timing, using defaults\n");
> - }
> -
> - if (!vm.pixelclock)
> - vm.pixelclock = vm.hactive * vm.vactive * 60;
> - drm_display_mode_from_videomode(, >mode);
> -
> - ddata->width_mm = 0;
> - of_property_read_u32(node, "width-mm", >width_mm);
> -
> - ddata->height_mm = 0;
> - of_property_read_u32(node, "height-mm", >height_mm);
> + mode->hdisplay = mode->hsync_start = mode->hsync_end = mode->htotal =
> + ddata->panel_data->xres;
> + mode->vdisplay = mode->vsync_start = mode->vsync_end = mode->vtotal =
> + ddata->panel_data->yres;
> + mode->clock = ddata->panel_data->xres * ddata->panel_data->yres *
> + ddata->panel_data->refresh / 1000;
> + mode->width_mm = ddata->panel_data->width_mm;
> + mode->height_mm = ddata->panel_data->height_mm;
> + mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
> + drm_mode_set_name(mode);
>  
>   ddata->supplies[0].supply = "vpnl";
>   ddata->supplies[1].supply = "vddi";
> @@ -536,6 +528,7 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>   struct panel_drv_data *ddata;
>   struct backlight_device *bldev = NULL;
>   struct device *dev = >dev;
> + const struct of_device_id *id;
>   int r;
>  
>   dev_dbg(dev, "probe\n");
> @@ -547,6 +540,12 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>   mipi_dsi_set_drvdata(dsi, ddata);
>   ddata->dsi = dsi;
>  
> + id = of_match_node(dsicm_of_match, dev->of_node);
> + if (!id)
> + return -ENODEV;
> +
> + 

Re: [PATCH v4 68/80] drm/panel: panel-dsi-cm: remove extra 'if'

2020-11-24 Thread Sam Ravnborg
Hi Tomi,

On Tue, Nov 24, 2020 at 02:45:26PM +0200, Tomi Valkeinen wrote:
> We have a useless 'if' in the dsicm_bl_update_status(), a left over from
> the conversion to DRM model. Drop the if.
> 
> Signed-off-by: Tomi Valkeinen 
Reviewed-by: Sam Ravnborg 

But with a few comments.

> ---
>  drivers/gpu/drm/panel/panel-dsi-cm.c | 10 --
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-dsi-cm.c 
> b/drivers/gpu/drm/panel/panel-dsi-cm.c
> index 1e7f73340736..c17ed728c695 100644
> --- a/drivers/gpu/drm/panel/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/panel/panel-dsi-cm.c
> @@ -194,7 +194,7 @@ static int dsicm_set_update_window(struct panel_drv_data 
> *ddata)
>  static int dsicm_bl_update_status(struct backlight_device *dev)
>  {
>   struct panel_drv_data *ddata = dev_get_drvdata(>dev);
> - int r = 0;
> + int r;
>   int level;
>  
>   if (dev->props.fb_blank == FB_BLANK_UNBLANK &&

Unrelated to this patch - but here it would be better to use
level = backlight_get_brightness(dev);

level is 0 is backlight is off.

Sam


> @@ -207,11 +207,9 @@ static int dsicm_bl_update_status(struct 
> backlight_device *dev)
>  
>   mutex_lock(>lock);
>  
> - if (ddata->enabled) {
> - if (!r)
> - r = dsicm_dcs_write_1(
> - ddata, MIPI_DCS_SET_DISPLAY_BRIGHTNESS, level);
> - }
> + if (ddata->enabled)
> + r = dsicm_dcs_write_1(ddata, MIPI_DCS_SET_DISPLAY_BRIGHTNESS,
> +   level);
>  
>   mutex_unlock(>lock);
>  
> -- 
> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
> Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v4 60/80] drm/panel: panel-dsi-cm: set column & page at setup

2020-11-24 Thread Sam Ravnborg
On Tue, Nov 24, 2020 at 02:45:18PM +0200, Tomi Valkeinen wrote:
> Set the column & page address once during setup, instead of relying the
> DSI host driver to set those.
> 
> Signed-off-by: Tomi Valkeinen 
Reviewed-by: Sam Ravnborg 

But one comment below.

> ---
>  drivers/gpu/drm/panel/panel-dsi-cm.c | 24 
>  1 file changed, 24 insertions(+)
> 
> diff --git a/drivers/gpu/drm/panel/panel-dsi-cm.c 
> b/drivers/gpu/drm/panel/panel-dsi-cm.c
> index 59e8e6b18e97..1e7f73340736 100644
> --- a/drivers/gpu/drm/panel/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/panel/panel-dsi-cm.c
> @@ -171,6 +171,26 @@ static int dsicm_get_id(struct panel_drv_data *ddata, u8 
> *id1, u8 *id2, u8 *id3)
>   return 0;
>  }
>  
> +static int dsicm_set_update_window(struct panel_drv_data *ddata)
> +{
> + struct mipi_dsi_device *dsi = ddata->dsi;
> + int r;
> + u16 x1 = 0;
> + u16 x2 = ddata->mode.hdisplay - 1;
> + u16 y1 = 0;
> + u16 y2 = ddata->mode.vdisplay - 1;

It does not help the readability with the variables.

Using

r = mipi_dsi_dcs_set_column_address(dsi, 0, ddata->mode.hdisplay - 1);

would IMO be easier to parse.

Then the pointless assignment of x1 and y1 are dropped too.

But nitpicking, ignore if think the current code is better.

Sam


> +
> + r = mipi_dsi_dcs_set_column_address(dsi, x1, x2);
> + if (r < 0)
> + return r;
> +
> + r = mipi_dsi_dcs_set_page_address(dsi, y1, y2);
> + if (r < 0)
> + return r;
> +
> + return 0;
> +}
> +
>  static int dsicm_bl_update_status(struct backlight_device *dev)
>  {
>   struct panel_drv_data *ddata = dev_get_drvdata(>dev);
> @@ -308,6 +328,10 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>   if (r)
>   goto err;
>  
> + r = dsicm_set_update_window(ddata);
> + if (r)
> + goto err;
> +
>   r = mipi_dsi_dcs_set_display_on(ddata->dsi);
>   if (r)
>   goto err;
> -- 
> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
> Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v4 56/80] drm/panel: panel-dsi-cm: cleanup tear enable

2020-11-24 Thread Sam Ravnborg
On Tue, Nov 24, 2020 at 02:45:14PM +0200, Tomi Valkeinen wrote:
> Simplify the code by moving code from _dsicm_enable_te() into
> dsicm_power_on().
> 
> Signed-off-by: Tomi Valkeinen 
Reviewed-by: Sam Ravnborg 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v3 07/12] drm/sched: Prevent any job recoveries after device is unplugged.

2020-11-24 Thread Andrey Grodzovsky


On 11/24/20 12:11 PM, Luben Tuikov wrote:

On 2020-11-24 2:50 a.m., Christian König wrote:

Am 24.11.20 um 02:12 schrieb Luben Tuikov:

On 2020-11-23 3:06 a.m., Christian König wrote:

Am 23.11.20 um 06:37 schrieb Andrey Grodzovsky:

On 11/22/20 6:57 AM, Christian König wrote:

Am 21.11.20 um 06:21 schrieb Andrey Grodzovsky:

No point to try recovery if device is gone, it's meaningless.

I think that this should go into the device specific recovery
function and not in the scheduler.

The timeout timer is rearmed here, so this prevents any new recovery
work to restart from here
after drm_dev_unplug was executed from amdgpu_pci_remove.It will not
cover other places like
job cleanup or starting new job but those should stop once the
scheduler thread is stopped later.

Yeah, but this is rather unclean. We should probably return an error
code instead if the timer should be rearmed or not.

Christian, this is exactly my work I told you about
last week on Wednesday in our weekly meeting. And
which I wrote to you in an email last year about this
time.

Yeah, that's why I'm suggesting it here as well.

It seems you're suggesting that Andrey do it, while
all too well you know I've been working on this
for some time now.

I wrote you about this last year same time
in an email. And I discussed it on the Wednesday
meeting.

You could've mentioned that here the first time.



Luben, I actually strongly prefer that you do it and share ur patch with me 
since I don't

want to do unneeded refactoring which will conflict with with ur work. Also, 
please
usedrm-misc for this since it's not amdgpu specific work and will be easier for 
me.

Andrey





So what do we do now?

Split your patches into smaller parts and submit them chunk by chunk.

E.g. renames first and then functional changes grouped by area they change.

I have, but my final patch, a tiny one but which implements
the core reason for the change seems buggy, and I'm looking
for a way to debug it.

Regards,
Luben



Regards,
Christian.


I can submit those changes without the last part,
which builds on this change.

I'm still testing the last part and was hoping
to submit it all in one sequence of patches,
after my testing.

Regards,
Luben


Christian.


Andrey



Christian.


Signed-off-by: Andrey Grodzovsky 
---
    drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c |  2 +-
    drivers/gpu/drm/etnaviv/etnaviv_sched.c   |  3 ++-
    drivers/gpu/drm/lima/lima_sched.c |  3 ++-
    drivers/gpu/drm/panfrost/panfrost_job.c   |  2 +-
    drivers/gpu/drm/scheduler/sched_main.c    | 15 ++-
    drivers/gpu/drm/v3d/v3d_sched.c   | 15 ++-
    include/drm/gpu_scheduler.h   |  6 +-
    7 files changed, 35 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
index d56f402..d0b0021 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
@@ -487,7 +487,7 @@ int amdgpu_fence_driver_init_ring(struct
amdgpu_ring *ring,
      r = drm_sched_init(>sched, _sched_ops,
   num_hw_submission, amdgpu_job_hang_limit,
-   timeout, ring->name);
+   timeout, ring->name, >ddev);
    if (r) {
    DRM_ERROR("Failed to create scheduler on ring %s.\n",
      ring->name);
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_sched.c
b/drivers/gpu/drm/etnaviv/etnaviv_sched.c
index cd46c88..7678287 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_sched.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_sched.c
@@ -185,7 +185,8 @@ int etnaviv_sched_init(struct etnaviv_gpu *gpu)
      ret = drm_sched_init(>sched, _sched_ops,
     etnaviv_hw_jobs_limit, etnaviv_job_hang_limit,
- msecs_to_jiffies(500), dev_name(gpu->dev));
+ msecs_to_jiffies(500), dev_name(gpu->dev),
+ gpu->drm);
    if (ret)
    return ret;
    diff --git a/drivers/gpu/drm/lima/lima_sched.c
b/drivers/gpu/drm/lima/lima_sched.c
index dc6df9e..8a7e5d7ca 100644
--- a/drivers/gpu/drm/lima/lima_sched.c
+++ b/drivers/gpu/drm/lima/lima_sched.c
@@ -505,7 +505,8 @@ int lima_sched_pipe_init(struct lima_sched_pipe
*pipe, const char *name)
      return drm_sched_init(>base, _sched_ops, 1,
      lima_job_hang_limit, msecs_to_jiffies(timeout),
-  name);
+  name,
+  pipe->ldev->ddev);
    }
      void lima_sched_pipe_fini(struct lima_sched_pipe *pipe)
diff --git a/drivers/gpu/drm/panfrost/panfrost_job.c
b/drivers/gpu/drm/panfrost/panfrost_job.c
index 30e7b71..37b03b01 100644
--- a/drivers/gpu/drm/panfrost/panfrost_job.c
+++ b/drivers/gpu/drm/panfrost/panfrost_job.c
@@ -520,7 +520,7 @@ int panfrost_job_init(struct panfrost_device
*pfdev)
    ret = drm_sched_init(>queue[j].sched,
     _sched_ops,
     1, 0, 

  1   2   3   4   >