[PATCH] drm/amdgpu: fix typo in amdgpu_mn.c comments

2018-06-13 Thread Slava Abramov
In doc comments for struct amdgpu_mn: destrution -> destruction

Signed-off-by: Slava Abramov 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
index 417923ba8de6..b2a9716fa41f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
@@ -58,7 +58,7 @@
  * @adev: amdgpu device pointer
  * @mm: process address space
  * @mn: MMU notifier structur
- * @work: destrution work item
+ * @work: destruction work item
  * @node: hash table node to find structure by adev and mn
  * @lock: rw semaphore protecting the notifier nodes
  * @objects: interval tree containing amdgpu_mn_nodes
-- 
2.14.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH] drm/amdgpu: update documentation for amdgpu_irq.c v2

2018-06-12 Thread Slava Abramov
Add/update function level documentation and add reference to amdgpu_irq.c
in amdgpu.rst

v2:
Added DOC comment
Added more explanations for amdgpu_hotplug_work_func
Properly formatted unused parameters
Properly formatted return values
Fixed usage of acronyms
More consistent styling

Signed-off-by: Slava Abramov 
Acked-by: Christian König 
---
 Documentation/gpu/amdgpu.rst|   8 ++
 drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 202 ++--
 2 files changed, 147 insertions(+), 63 deletions(-)

diff --git a/Documentation/gpu/amdgpu.rst b/Documentation/gpu/amdgpu.rst
index 3ffb2a226fae..abf87360ab15 100644
--- a/Documentation/gpu/amdgpu.rst
+++ b/Documentation/gpu/amdgpu.rst
@@ -52,4 +52,12 @@ AMDGPU Virtual Memory
:doc: GPUVM
 
 .. kernel-doc:: drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+
+Interrupt Handling
+--
+
+.. kernel-doc:: drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
+   :doc: Interrupt Handling
+
+.. kernel-doc:: drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
:internal:
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
index 3a5ca462abf0..07545fcd2e65 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
@@ -25,6 +25,23 @@
  *  Alex Deucher
  *  Jerome Glisse
  */
+
+/**
+ * DOC: Interrupt Handling
+ *
+ * Interrupts generated within GPU hardware raise interrupt requests that are
+ * passed to amdgpu IRQ handler which is responsible for detecting source and
+ * type of the interrupt and dispatching matching handlers. If handling an
+ * interrupt requires calling kernel functions that may sleep processing is
+ * dispatched to work handlers.
+ *
+ * If MSI functionality is not not disabled by module parameter then MSI
+ * support will be enabled.
+ *
+ * For GPU interrupt sources that may be driven by another driver, IRQ domain
+ * support is used (with mapping between virtual and hardware IRQs).
+ */
+
 #include 
 #include 
 #include 
@@ -43,19 +60,21 @@
 
 #define AMDGPU_WAIT_IDLE_TIMEOUT 200
 
-/*
- * Handle hotplug events outside the interrupt handler proper.
- */
 /**
- * amdgpu_hotplug_work_func - display hotplug work handler
+ * amdgpu_hotplug_work_func - work handler for display hotplug event
  *
- * @work: work struct
+ * @work: work struct pointer
  *
- * This is the hot plug event work handler (all asics).
- * The work gets scheduled from the irq handler if there
- * was a hot plug interrupt.  It walks the connector table
- * and calls the hotplug handler for each one, then sends
- * a drm hotplug event to alert userspace.
+ * This is the hotplug event work handler (all ASICs).
+ * The work gets scheduled from the IRQ handler if there
+ * was a hotplug interrupt.  It walks through the connector table
+ * and calls hotplug handler for each connector. After this, it sends
+ * a DRM hotplug event to alert userspace.
+ *
+ * This design approach is required in order to defer hotplug event handling
+ * from the IRQ handler to a work handler because hotplug handler has to use
+ * mutexes which cannot be locked in an IRQ handler (since *mutex_lock* may
+ * sleep).
  */
 static void amdgpu_hotplug_work_func(struct work_struct *work)
 {
@@ -74,13 +93,12 @@ static void amdgpu_hotplug_work_func(struct work_struct 
*work)
 }
 
 /**
- * amdgpu_irq_reset_work_func - execute gpu reset
+ * amdgpu_irq_reset_work_func - execute GPU reset
  *
- * @work: work struct
+ * @work: work struct pointer
  *
- * Execute scheduled gpu reset (cayman+).
- * This function is called when the irq handler
- * thinks we need a gpu reset.
+ * Execute scheduled GPU reset (Cayman+).
+ * This function is called when the IRQ handler thinks we need a GPU reset.
  */
 static void amdgpu_irq_reset_work_func(struct work_struct *work)
 {
@@ -91,7 +109,13 @@ static void amdgpu_irq_reset_work_func(struct work_struct 
*work)
amdgpu_device_gpu_recover(adev, NULL, false);
 }
 
-/* Disable *all* interrupts */
+/**
+ * amdgpu_irq_disable_all - disable *all* interrupts
+ *
+ * @adev: amdgpu device pointer
+ *
+ * Disable all types of interrupts from all sources.
+ */
 void amdgpu_irq_disable_all(struct amdgpu_device *adev)
 {
unsigned long irqflags;
@@ -123,11 +147,15 @@ void amdgpu_irq_disable_all(struct amdgpu_device *adev)
 }
 
 /**
- * amdgpu_irq_handler - irq handler
+ * amdgpu_irq_handler - IRQ handler
+ *
+ * @irq: IRQ number (unused)
+ * @arg: pointer to DRM device
  *
- * @int irq, void *arg: args
+ * IRQ handler for amdgpu driver (all ASICs).
  *
- * This is the irq handler for the amdgpu driver (all asics).
+ * Returns:
+ * result of handling the IRQ, as defined by *irqreturn_t*
  */
 irqreturn_t amdgpu_irq_handler(int irq, void *arg)
 {
@@ -142,18 +170,18 @@ irqreturn_t amdgpu_irq_handler(int irq, void *arg)
 }
 
 /**
- * amdgpu_msi_ok - asic specific msi checks
+ * amdgpu_msi_ok - check whether MSI functionality is enabled
  *
- * @adev: amdgpu device pointer

[PATCH] drm/amdgpu: update documentation for amdgpu_irq.c

2018-06-07 Thread Slava Abramov
Add/update function level documentation and add reference to amdgpu_irq.c
in amdgpu.rst

Signed-off-by: Slava Abramov 
---
 Documentation/gpu/amdgpu.rst|   9 +++
 drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 102 ++--
 2 files changed, 80 insertions(+), 31 deletions(-)

diff --git a/Documentation/gpu/amdgpu.rst b/Documentation/gpu/amdgpu.rst
index a4852f9a6141..63b0bc3c30d1 100644
--- a/Documentation/gpu/amdgpu.rst
+++ b/Documentation/gpu/amdgpu.rst
@@ -44,3 +44,12 @@ MMU Notifier
 
 .. kernel-doc:: drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
:internal:
+
+Interrupt Handling
+--
+
+.. kernel-doc:: drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
+   :doc: Interrupt Handling
+
+.. kernel-doc:: drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
+   :internal:
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
index 3a5ca462abf0..07a2642de634 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
@@ -25,6 +25,11 @@
  *  Alex Deucher
  *  Jerome Glisse
  */
+
+/**
+ * DOC: Interrupt Handling
+ */
+
 #include 
 #include 
 #include 
@@ -44,7 +49,7 @@
 #define AMDGPU_WAIT_IDLE_TIMEOUT 200
 
 /*
- * Handle hotplug events outside the interrupt handler proper.
+ * XXX: handle hotplug events outside the interrupt handler proper.
  */
 /**
  * amdgpu_hotplug_work_func - display hotplug work handler
@@ -91,7 +96,13 @@ static void amdgpu_irq_reset_work_func(struct work_struct 
*work)
amdgpu_device_gpu_recover(adev, NULL, false);
 }
 
-/* Disable *all* interrupts */
+/**
+ * amdgpu_irq_disable_all - disable *all* interrupts
+ *
+ * @adev: amdgpu device pointer
+ *
+ * Disable all types of interrupts from all sources.
+ */
 void amdgpu_irq_disable_all(struct amdgpu_device *adev)
 {
unsigned long irqflags;
@@ -125,9 +136,10 @@ void amdgpu_irq_disable_all(struct amdgpu_device *adev)
 /**
  * amdgpu_irq_handler - irq handler
  *
- * @int irq, void *arg: args
+ * @irq: irq number (**not used**)
+ * @arg: pointer to drm device
  *
- * This is the irq handler for the amdgpu driver (all asics).
+ * Irq handler for amdgpu driver (all asics).
  */
 irqreturn_t amdgpu_irq_handler(int irq, void *arg)
 {
@@ -142,14 +154,12 @@ irqreturn_t amdgpu_irq_handler(int irq, void *arg)
 }
 
 /**
- * amdgpu_msi_ok - asic specific msi checks
+ * amdgpu_msi_ok - check whether MSI functionality is enabled
  *
- * @adev: amdgpu device pointer
+ * @adev: amdgpu device pointer (**not used**)
  *
- * Handles asic specific MSI checks to determine if
- * MSIs should be enabled on a particular chip (all asics).
- * Returns true if MSIs should be enabled, false if MSIs
- * should not be enabled.
+ * Checks whether MSI functionality has been disabled via module parameter.
+ * Returns true if MSIs are allowed to be enabled or false otherwise
  */
 static bool amdgpu_msi_ok(struct amdgpu_device *adev)
 {
@@ -163,12 +173,13 @@ static bool amdgpu_msi_ok(struct amdgpu_device *adev)
 }
 
 /**
- * amdgpu_irq_init - init driver interrupt info
+ * amdgpu_irq_init - initialize driver interrupt info
  *
  * @adev: amdgpu device pointer
  *
- * Sets up the work irq handlers, vblank init, MSIs, etc. (all asics).
- * Returns 0 for success, error for failure.
+ * Sets up work functions for hotplug and reset interrupts, enables MSI
+ * functionality, initializes vblank, hotplug and reset interrupt handling.
+ * Returns 0 on success, error code on failure.
  */
 int amdgpu_irq_init(struct amdgpu_device *adev)
 {
@@ -176,7 +187,7 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
 
spin_lock_init(>irq.lock);
 
-   /* enable msi */
+   /* enable msi if not disabled by module parameter */
adev->irq.msi_enabled = false;
 
if (amdgpu_msi_ok(adev)) {
@@ -224,7 +235,9 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
  *
  * @adev: amdgpu device pointer
  *
- * Tears down the work irq handlers, vblank handlers, MSIs, etc. (all asics).
+ * Tears down work functions for hotplug and reset interrupts, disables MSI
+ * functionality, shuts down vblank, hotplug and reset interrupt handling,
+ * turns off interrupts from all sources (all asics).
  */
 void amdgpu_irq_fini(struct amdgpu_device *adev)
 {
@@ -267,9 +280,12 @@ void amdgpu_irq_fini(struct amdgpu_device *adev)
  * amdgpu_irq_add_id - register irq source
  *
  * @adev: amdgpu device pointer
- * @src_id: source id for this source
- * @source: irq source
+ * @client_id: client id
+ * @src_id: source id
+ * @source: irq source pointer
  *
+ * Registers irq source on a client.
+ * Returns 0 on success or error code otherwise.
  */
 int amdgpu_irq_add_id(struct amdgpu_device *adev,
  unsigned client_id, unsigned src_id,
@@ -315,9 +331,9 @@ int amdgpu_irq_add_id(struct amdgpu_device *adev,
  * amdgpu_irq_dispatch - dispatch irq to IP blocks
  *
  * @adev: amdgpu device pointer
- * @entry: interrupt vector
+ * 

Re: [PATCH libdrm 0/3] amdgpu: amdgpu_get_marketing_name cleanups

2017-12-01 Thread Slava Abramov

On 2017-12-01 11:56 AM, Michel Dänzer wrote:

From: Michel Dänzer <michel.daen...@amd.com>

The first two patches are preparatory for patch 3, which is the meat of
the series.

Michel Dänzer (3):
   amdgpu: Clean up amdgpu_parse_asic_ids error handling
   amdgpu: Simplify error handling in parse_one_line
   amdgpu: Only remember the device's marketing name

  amdgpu/Android.mk|   3 +-
  amdgpu/Makefile.am   |   5 +-
  amdgpu/amdgpu_asic_id.c  | 139 ++-
  amdgpu/amdgpu_device.c   |  27 +
  amdgpu/amdgpu_internal.h |  11 +---
  5 files changed, 49 insertions(+), 136 deletions(-)



Series
Acked-by: Slava Abramov <slava.abra...@amd.com>
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx