Skip to contentSkip to conversation

amd-gfx Digest, Vol 40, Issue 37

DISCUSSION Jiang, Sonny 1 participant 1 message Sep 6, 2019 2 messages not in the archive

Subsystems (3)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): mailman.5655.1567559843.1466.amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org

Jiang, Sonny

author Reviewed-by Dave Airlie Reviewed-by Dave Airlie Reviewed-by Dave Airlie
#2 lore raw

Ping...

Review 2. [PATCH] drm: add drm device name (Jiang, Sonny), please.

Thanks,
Sonny
________________________________
From: amd-gfx <[email protected]> on behalf of [email protected] <[email protected]>
Sent: Tuesday, September 3, 2019 9:17 PM
To: [email protected] <[email protected]>
Subject: amd-gfx Digest, Vol 40, Issue 37

Send amd-gfx mailing list submissions to
[email protected]

To subscribe or unsubscribe via the World Wide Web, visit
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
or, via email, send a message with subject or body 'help' to
[email protected]

You can reach the person managing the list at
[email protected]

When replying, please edit your Subject line so it is more specific than "Re: Contents of amd-gfx digest..."

Today's Topics:

1. Re: [PATCH v2 06/27] drm/dp_mst: Combine redundant cases in drm_dp_encode_sideband_req() (Dave Airlie)
2. [PATCH] drm: add drm device name (Jiang, Sonny)
3. Re: [PATCH v2 11/27] drm/dp_mst: Constify guid in drm_dp_get_mst_branch_by_guid() (Dave Airlie)
4. Re: [PATCH v2 15/27] drm/dp_mst: Cleanup drm_dp_send_link_address() a bit (Dave Airlie)
5. RE: [PATCH] drm/amd/powerplay: replace smu->table_count with SMU_TABLE_COUNT in smu (Quan, Evan)

----------------------------------------------------------------------

Message: 1
Date: Wed, 4 Sep 2019 07:35:59 +1000
From: Dave Airlie <[email protected]>
To: Lyude Paul <[email protected]>
Cc: dri-devel <[email protected]>, nouveau
<[email protected]>, amd-gfx mailing list <[email protected]>, Sean Paul <[email protected]>, David Airlie <[email protected]>, Daniel Vetter <[email protected]>, Imre Deak <[email protected]>, Maarten Lankhorst <[email protected]>, LKML <[email protected]>, Maxime Ripard <[email protected]>, Juston Li <[email protected]>, Daniel Vetter <[email protected]>, Harry Wentland <[email protected]>, Ville Syrjälä <[email protected]>
Subject: Re: [PATCH v2 06/27] drm/dp_mst: Combine redundant cases in
drm_dp_encode_sideband_req()
Message-ID:
<CAPM=9tx1vQMEsw4VjDVCbDYFUiaeHNCfP09aiSxnPnucQuB1JQ@mail.gmail.com>
Content-Type: text/plain; charset="UTF-8"

Quoted 4 lines · Lyude Paul

Noticed this while working on adding a drm_dp_decode_sideband_req(). DP_POWER_DOWN_PHY/DP_POWER_UP_PHY both use the same struct, so we can just combine their cases.

both use the same struct as enum path resources?

Since otherwise the patch doesn't make sense.

With that fixed:

------------------------------

Message: 2
Date: Tue, 3 Sep 2019 21:41:10 +0000
From: "Jiang, Sonny" <[email protected]>
To: "[email protected]" <[email protected]>
Cc: "Jiang, Sonny" <[email protected]>
Subject: [PATCH] drm: add drm device name
Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"

Add DRM device name and use DRM_IOCTL_VERSION ioctl drmVersion::desc passing it to user space instead of unused DRM driver name descriptor.

Change-Id I809f6d3e057111417efbe8fa7cab8f0113ba4b21
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  2 ++
 drivers/gpu/drm/drm_drv.c                  | 17 +++++++++++++++++
 drivers/gpu/drm/drm_ioctl.c                |  2 +-
 include/drm/drm_device.h                   |  3 +++
 include/drm/drm_drv.h                      |  1 +
 5 files changed, 24 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -0
index 67b09cb2a9e2..8f0971cea363 100644
@@ -2809,6 +2809,8 @@ int amdgpu_device_init(struct amdgpu_device *adev,
         /* init the mode config */
         drm_mode_config_init(adev->ddev);
 
+       drm_dev_set_name(adev->ddev, amdgpu_asic_name[adev->asic_type]);
+
         r = amdgpu_device_ip_init(adev);
         if (r) {
                 /* failed in exclusive mode due to timeout */
drivers/gpu/drm/drm_drv.c +17 -0
index 862621494a93..6c33879bb538 100644
@@ -802,6 +802,7 @@ void drm_dev_fini(struct drm_device *dev)
         mutex_destroy(&dev->struct_mutex);
         drm_legacy_destroy_members(dev);
         kfree(dev->unique);
+       kfree(dev->name);
 }
 EXPORT_SYMBOL(drm_dev_fini);
 
@@ -1078,6 +1079,22 @@ int drm_dev_set_unique(struct drm_device *dev, const char *name)
 }
 EXPORT_SYMBOL(drm_dev_set_unique);
 
+/**
+ * drm_dev_set_name - Set the name of a DRM device
+ * @dev: device of which to set the name
+ * @name: name to be set
+ *
+ * Return: 0 on success or a negative error code on failure.
+ */
+int drm_dev_set_name(struct drm_device *dev, const char *name)
+{
+       kfree(dev->name);
+       dev->name = kstrdup(name, GFP_KERNEL);
+
+       return dev->name ? 0 : -ENOMEM;
+}
+EXPORT_SYMBOL(drm_dev_set_name);
+
 /*
  * DRM Core
  * The DRM core module initializes all global DRM objects and makes them
drivers/gpu/drm/drm_ioctl.c +1 -1
index 2263e3ddd822..61f02965106b 100644
@@ -506,7 +506,7 @@ int drm_version(struct drm_device *dev, void *data,
                                 dev->driver->date);
         if (!err)
                 err = drm_copy_field(version->desc, &version->desc_len,
-                               dev->driver->desc);
+                               dev->name);
 
         return err;
 }
include/drm/drm_device.h +3 -0
index 7f9ef709b2b6..e29912c484e4 100644
@@ -123,6 +123,9 @@ struct drm_device {
         /** @unique: Unique name of the device */
         char *unique;
 
+       /** @name: device name */
+       char *name;
+
         /**
          * @struct_mutex:
          *
include/drm/drm_drv.h +1 -0
index 68ca736c548d..f742e2bde467 100644
@@ -798,6 +798,7 @@ static inline bool drm_drv_uses_atomic_modeset(struct drm_device *dev)
 
 
 int drm_dev_set_unique(struct drm_device *dev, const char *name);
+int drm_dev_set_name(struct drm_device *dev, const char *name);
 
 
 #endif

--
2.17.1

------------------------------

Message: 3
Date: Wed, 4 Sep 2019 07:41:07 +1000
From: Dave Airlie <[email protected]>
To: Lyude Paul <[email protected]>
Cc: dri-devel <[email protected]>, nouveau
<[email protected]>, amd-gfx mailing list <[email protected]>, Sean Paul <[email protected]>, David Airlie <[email protected]>, Daniel Vetter <[email protected]>, Imre Deak <[email protected]>, Maarten Lankhorst <[email protected]>, LKML <[email protected]>, Maxime Ripard <[email protected]>, Juston Li <[email protected]>, Daniel Vetter <[email protected]>, Harry Wentland <[email protected]>, Ville Syrjälä <[email protected]>
Subject: Re: [PATCH v2 11/27] drm/dp_mst: Constify guid in

        drm_dp_get_mst_branch_by_guid()

Message-ID:
<CAPM=9tz0fdZpfFAfQ0aCQ4D+0XQGm=zqeFKDHPFNwVEUeM1f5g@mail.gmail.com>
Content-Type: text/plain; charset="UTF-8"

Quoted 3 lines · Lyude Paul

And it's helper, we'll be using this in just a moment.

Quoted 35 lines
Cc Juston Li <[email protected]>
Cc Imre Deak <[email protected]>
Cc Ville Syrjälä <[email protected]>
Cc Harry Wentland <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +2 -3
index 43452872efad..b44d3696c09a 100644
@@ -2060,7 +2060,7 @@ static struct drm_dp_mst_branch *drm_dp_get_mst_branch_device(struct drm_dp_mst_
 
 static struct drm_dp_mst_branch *get_mst_branch_device_by_guid_helper(
        struct drm_dp_mst_branch *mstb,
-       uint8_t *guid)
+       const uint8_t *guid)
 {
        struct drm_dp_mst_branch *found_mstb;
        struct drm_dp_mst_port *port;
@@ -2084,7 +2084,7 @@ static struct drm_dp_mst_branch *get_mst_branch_device_by_guid_helper(
 
 static struct drm_dp_mst_branch *
 drm_dp_get_mst_branch_device_by_guid(struct drm_dp_mst_topology_mgr *mgr,
-                                    uint8_t *guid)
+                                    const uint8_t *guid)
 {
        struct drm_dp_mst_branch *mstb;
        int ret;
--

2.21.0

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

------------------------------

Message: 4
Date: Wed, 4 Sep 2019 07:42:16 +1000
From: Dave Airlie <[email protected]>
To: Lyude Paul <[email protected]>
Cc: dri-devel <[email protected]>, nouveau
<[email protected]>, amd-gfx mailing list <[email protected]>, Sean Paul <[email protected]>, David Airlie <[email protected]>, Daniel Vetter <[email protected]>, Imre Deak <[email protected]>, Maarten Lankhorst <[email protected]>, LKML <[email protected]>, Maxime Ripard <[email protected]>, Juston Li <[email protected]>, Daniel Vetter <[email protected]>, Harry Wentland <[email protected]>, Ville Syrjälä <[email protected]>
Subject: Re: [PATCH v2 15/27] drm/dp_mst: Cleanup
drm_dp_send_link_address() a bit
Message-ID:

        <CAPM=9ty-264nFotVRy7VwMw_BQPo-=7su7y3J2MjC9Sdkxcu+A@mail.gmail.com>

Content-Type: text/plain; charset="UTF-8"

Quoted 7 lines · Lyude Paul

Declare local pointer to the drm_dp_link_address_ack_reply struct instead of constantly dereferencing it through the union in txmsg->reply. Then, invert the order of conditionals so we don't have to do the bulk of the work inside them, and can wrap lines even less. Then finally, rearrange variable declarations a bit.

Quoted 6 lines
Cc Juston Li <[email protected]>
Cc Imre Deak <[email protected]>
Cc Ville Syrjälä <[email protected]>
Cc Harry Wentland <[email protected]>
Cc Daniel Vetter <[email protected]>

------------------------------

Message: 5
Date: Wed, 4 Sep 2019 01:17:19 +0000
From: "Quan, Evan" <[email protected]>
To: "Wang, Kevin(Yang)" <[email protected]>,
"[email protected]" <[email protected]>, "Huang, Ray" <[email protected]>
Cc: "Wang, Kevin(Yang)" <[email protected]>
Subject: RE: [PATCH] drm/amd/powerplay: replace smu->table_count with
SMU_TABLE_COUNT in smu
Message-ID:

        <MN2PR12MB3344CB5D45A7FE830BDC4E34E4B80@MN2PR12MB3344.namprd12.prod.outlook.com>

Content-Type: text/plain; charset="utf-8"

Please drop the table_count member from the smu_table structure as it's totally unused. With that fixed, the patch is reviewed-by: Evan Quan <[email protected]>

Quoted 162 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Wang, Kevin(Yang)
Sent: 2019年9月3日 16:17
To: [email protected]; Huang, Ray <[email protected]>
Cc: Wang, Kevin(Yang) <[email protected]>
Subject: [PATCH] drm/amd/powerplay: replace smu->table_count with SMU_TABLE_COUNT in smu

fix bellow patch issue:
drm/amd/powerplay: introduce smu table id type to handle the smu table for each asic
----
"This patch introduces new smu table type, it's to handle the different smu table defines for each asic with the same smu ip."

before:
use smu->table_count to represent the actual table count in smc firmware use actual table count to check smu function parameter about smu table after:
use logic table count "SMU_TABLE_COUNT" to check function parameter because table id already mapped in smu driver, and smu function will use logic table id not actual table id to check func parameter.

---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c   | 13 ++++---------
 drivers/gpu/drm/amd/powerplay/arcturus_ppt.c |  1 -
 drivers/gpu/drm/amd/powerplay/navi10_ppt.c   |  1 -
 drivers/gpu/drm/amd/powerplay/renoir_ppt.c   |  1 -
 drivers/gpu/drm/amd/powerplay/smu_v11_0.c    |  5 ++---
 drivers/gpu/drm/amd/powerplay/vega20_ppt.c   |  1 -
 6 files changed, 6 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +0 -0
index 6f435d60fe86..c71a82a6a785 100644
@@ -462,7 +462,7 @@ int smu_update_table(struct smu_context *smu,

enum smu_table_id table_index, int

       int ret = 0;
       int table_id = smu_table_get_index(smu, table_index);
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +1 -1
-     if (!table_data || table_id >= smu_table->table_count || table_id < 0)
+     if (!table_data || table_id >= SMU_TABLE_COUNT || table_id < 0)
               return -EINVAL;
 
       table = &smu_table->tables[table_index]; @@ -940,14 +940,10 @@

static int smu_init_fb_allocations(struct smu_context *smu)

       struct amdgpu_device *adev = smu->adev;
       struct smu_table_context *smu_table = &smu->smu_table;
       struct smu_table *tables = smu_table->tables;
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +3 -8
-     uint32_t table_count = smu_table->table_count;
       uint32_t i = 0;
       int32_t ret = 0;
 
-     if (table_count <= 0)
-             return -EINVAL;
-
-     for (i = 0 ; i < table_count; i++) {
+     for (i = 0; i < SMU_TABLE_COUNT; i++) {
               if (tables[i].size == 0)
                       continue;
               ret = amdgpu_bo_create_kernel(adev,
@@ -978,13 +974,12 @@ static int smu_fini_fb_allocations(struct
 smu_context *smu)  {
       struct smu_table_context *smu_table = &smu->smu_table;
       struct smu_table *tables = smu_table->tables;
-     uint32_t table_count = smu_table->table_count;
       uint32_t i = 0;
 
-     if (table_count == 0 || tables == NULL)
+     if (!tables)
               return 0;
 
-     for (i = 0 ; i < table_count; i++) {
+     for (i = 0; i < SMU_TABLE_COUNT; i++) {
               if (tables[i].size == 0)
                       continue;
               amdgpu_bo_free_kernel(&tables[i].bo,
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +0 -1
index f1f072012fac..6e8eb0f94c8b 100644
@@ -1934,5 +1934,4 @@ void arcturus_set_ppt_funcs(struct smu_context
 *smu)
       struct smu_table_context *smu_table = &smu->smu_table;
 
       smu->ppt_funcs = &arcturus_ppt_funcs;
-     smu_table->table_count = TABLE_COUNT;

}

drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -1
index 744b7501c34d..e3add8b59291 100644
@@ -1633,5 +1633,4 @@ void navi10_set_ppt_funcs(struct smu_context
 *smu)
       struct smu_table_context *smu_table = &smu->smu_table;
 
       smu->ppt_funcs = &navi10_ppt_funcs;
-     smu_table->table_count = TABLE_COUNT;

}

drivers/gpu/drm/amd/powerplay/renoir_ppt.c +0 -1
index de43159564a5..2b953f7431b6 100644
@@ -169,5 +169,4 @@ void renoir_set_ppt_funcs(struct smu_context *smu)
 
       smu->ppt_funcs = &renoir_ppt_funcs;
       smu->smc_if_version = SMU12_DRIVER_IF_VERSION;
-     smu_table->table_count = TABLE_COUNT;
 }
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +1 -1
index deca9f85764c..3709e4d77338 100644
@@ -439,7 +439,7 @@ static int smu_v11_0_init_smc_tables(struct
 smu_context *smu)
       struct smu_table *tables = NULL;
       int ret = 0;
 
-     if (smu_table->tables || smu_table->table_count == 0)
+     if (smu_table->tables)
               return -EINVAL;
 

tables = kcalloc(SMU_TABLE_COUNT, sizeof(struct smu_table), @@ -
465,13 +465,12 @@ static int smu_v11_0_fini_smc_tables(struct smu_context *smu)

       struct smu_table_context *smu_table = &smu->smu_table;
       int ret = 0;
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +1 -2
-     if (!smu_table->tables || smu_table->table_count == 0)
+     if (!smu_table->tables)
               return -EINVAL;
 
       kfree(smu_table->tables);
       kfree(smu_table->metrics_table);
       smu_table->tables = NULL;
-     smu_table->table_count = 0;
       smu_table->metrics_table = NULL;
       smu_table->metrics_time = 0;
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -1
index 899bf96b23e1..68548ba9b6ea 100644
@@ -3189,5 +3189,4 @@ void vega20_set_ppt_funcs(struct smu_context
 *smu)
       struct smu_table_context *smu_table = &smu->smu_table;
 
       smu->ppt_funcs = &vega20_ppt_funcs;
-     smu_table->table_count = TABLE_COUNT;

}
--
2.22.0

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

------------------------------

Subject: Digest Footer

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

------------------------------

End of amd-gfx Digest, Vol 40, Issue 37
***************************************

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx