Skip to contentSkip to conversation

drm/amdgpu: add the accelerator pcie class

PATCH In review Shiwu Zhang 5 participants 9 messages May 23, 2023 – Jun 8, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: add the accelerator pcie class

v2: add the base class id for accelerator (lijo)

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 5 +++++
 include/linux/pci_ids.h                 | 3 +++
 2 files changed, 8 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +5 -0
index 3d91e123f9bd..5d652e6f0b1e 100644
@@ -2042,6 +2042,11 @@ static const struct pci_device_id pciidlist[] = {
 	  .class_mask = 0xffffff,
 	  .driver_data = CHIP_IP_DISCOVERY },
 
+	{ PCI_DEVICE(0x1002, PCI_ANY_ID),
+	  .class = PCI_CLASS_ACCELERATOR_PROCESSING << 8,
+	  .class_mask = 0xffffff,
+	  .driver_data = CHIP_IP_DISCOVERY },
+
 	{0, 0, 0}
 };
 
include/linux/pci_ids.h +3 -0
index b362d90eb9b0..4918ff26a987 100644
@@ -151,6 +151,9 @@
 #define PCI_CLASS_SP_DPIO		0x1100
 #define PCI_CLASS_SP_OTHER		0x1180
 
+#define PCI_BASE_CLASS_ACCELERATOR	0x12
+#define PCI_CLASS_ACCELERATOR_PROCESSING	0x1200
+
 #define PCI_CLASS_OTHERS		0xff
 
 /* Vendors and devices.  Sort key: vendor first, device next. */
Signature · 1 line
2.17.1
#1 lore raw

[AMD Official Use Only - General]

Hi Bjorn,

Can we merge the below change through amdgpu tree ? Thanks!

--Brs,
Morris Zhang
MLSE Linux ML SRDC
Ext. 25147

Quoted 50 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Shiwu Zhang
Sent: Tuesday, May 23, 2023 12:03 PM
To: [email protected]; [email protected]; [email protected]
Subject: [PATCH] drm/amdgpu: add the accelerator pcie class

v2: add the base class id for accelerator (lijo)

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 5 +++++
 include/linux/pci_ids.h                 | 3 +++
 2 files changed, 8 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +5 -0
index 3d91e123f9bd..5d652e6f0b1e 100644
@@ -2042,6 +2042,11 @@ static const struct pci_device_id pciidlist[] = {
        .class_mask = 0xffffff,
        .driver_data = CHIP_IP_DISCOVERY },
 
+     { PCI_DEVICE(0x1002, PCI_ANY_ID),
+       .class = PCI_CLASS_ACCELERATOR_PROCESSING << 8,
+       .class_mask = 0xffffff,
+       .driver_data = CHIP_IP_DISCOVERY },
+
      {0, 0, 0}
 };
 
include/linux/pci_ids.h index renamed from include/linux/pci_ids.h +0 -0

b362d90eb9b0..4918ff26a987 100644

include/linux/pci_ids.h +3 -1
@@ -151,6 +151,9 @@
 #define PCI_CLASS_SP_DPIO            0x1100
 #define PCI_CLASS_SP_OTHER           0x1180
 
+#define PCI_BASE_CLASS_ACCELERATOR   0x12
+#define PCI_CLASS_ACCELERATOR_PROCESSING     0x1200
+
 #define PCI_CLASS_OTHERS             0xff
 
 /* Vendors and devices.  Sort key: vendor first, device next. */
--

2.17.1

#2 lore raw
In reply to Shiwu Zhang

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c static const struct pci_device_id pciidlist[] = { · line 2048

Quoted 4 lines · Shiwu Zhang
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +4 -0
+	{ PCI_DEVICE(0x1002, PCI_ANY_ID),
+	  .class = PCI_CLASS_ACCELERATOR_PROCESSING << 8,
+	  .class_mask = 0xffffff,
+	  .driver_data = CHIP_IP_DISCOVERY },

Probing for every single device of a given class for a single vendor to a driver is just fundamentaly wrong. Please list the actual IDs that the driver can handle.

#3 lore raw
Quoted 10 lines · Christoph Hellwig

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c static const struct pci_device_id pciidlist[] = { · line 2048

Quoted 4 lines · Shiwu Zhang
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +4 -0
+     { PCI_DEVICE(0x1002, PCI_ANY_ID),
+       .class = PCI_CLASS_ACCELERATOR_PROCESSING << 8,
+       .class_mask = 0xffffff,
+       .driver_data = CHIP_IP_DISCOVERY },

Probing for every single device of a given class for a single vendor to a driver is just fundamentaly wrong. Please list the actual IDs that the driver can handle.

How so? The driver handles all devices of that class. We already do that for PCI_CLASS_DISPLAY_VGA and PCI_CLASS_DISPLAY_OTHER. Other drivers do similar things. The hda audio driver does the same thing for PCI_CLASS_MULTIMEDIA_HD_AUDIO for example.

Alex

#4 lore raw
Quoted 8 lines · Alex Deucher
Quoted 7 lines · Christoph Hellwig
Quoted 4 lines · Shiwu Zhang
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +4 -0
+     { PCI_DEVICE(0x1002, PCI_ANY_ID),
+       .class = PCI_CLASS_ACCELERATOR_PROCESSING << 8,
+       .class_mask = 0xffffff,
+       .driver_data = CHIP_IP_DISCOVERY },
Quoted 7 lines
Quoted 3 lines

Probing for every single device of a given class for a single vendor to a driver is just fundamentaly wrong. Please list the actual IDs that the driver can handle.

How so? The driver handles all devices of that class. We already do that for PCI_CLASS_DISPLAY_VGA and PCI_CLASS_DISPLAY_OTHER. Other drivers do similar things.

How is that going to work in the long run? The chances of totally incompatbile devices from the same vendor appearing is absolutely given.

Quoted 3 lines

The hda audio driver does the same thing
for PCI_CLASS_MULTIMEDIA_HD_AUDIO for example.

That, just like PCI_CLASS_STORAGE_EXPRESS is a different case, as the class is associated with an actual documented programming interface.

#5 lore raw

[AMD Official Use Only - General]

Quoted 24 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Christoph Hellwig
Sent: Thursday, May 25, 2023 5:47 AM
To: Alex Deucher <[email protected]>
Cc: Christoph Hellwig <[email protected]>; [email protected]; amd- [email protected]; Zhang, Morris <[email protected]>; linux- [email protected]
Subject: Re: [PATCH] drm/amdgpu: add the accelerator pcie class

Quoted 1 line · Alex Deucher

On Tue, May 23, 2023 at 5:25 AM Christoph Hellwig <[email protected]>

Quoted 11 lines · wrote:
Quoted 10 lines · Shiwu Zhang

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c static const struct pci_device_id pciidlist[] = { · line 2048

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +4 -0
+     { PCI_DEVICE(0x1002, PCI_ANY_ID),
+       .class = PCI_CLASS_ACCELERATOR_PROCESSING << 8,
+       .class_mask = 0xffffff,
+       .driver_data = CHIP_IP_DISCOVERY },

Probing for every single device of a given class for a single vendor to a driver is just fundamentaly wrong. Please list the actual IDs that the driver can handle.

Quoted 7 lines
Quoted 3 lines

How so? The driver handles all devices of that class. We already do that for PCI_CLASS_DISPLAY_VGA and PCI_CLASS_DISPLAY_OTHER. Other drivers do similar things.

How is that going to work in the long run? The chances of totally incompatbile devices from the same vendor appearing is absolutely given.

We already handle this today for CLASS_DISPLAY via a data table provided on our hardware that details the components on the board. The driver can then determine whether or not that combination of components is supported. If the data table doesn't exist or isn’t parse-able, or the components enumerated are not supported, the driver doesn't load.

Alex

#6 lore raw
Quoted 1 line · Alexander

We already handle this today for CLASS_DISPLAY via a data table provided on our hardware that details the components on the board. The driver can then determine whether or not that combination of components is supported. If the data table doesn't exist or isn’t parse-able, or the components enumerated are not supported, the driver doesn't load.

But things like module loading and initramfs generation still work off the ID table and not your internal tables.

#7 lore raw

[Public]

Quoted 11 lines

-----Original Message-----
From: Christoph Hellwig <[email protected]>
Sent: Friday, May 26, 2023 2:55 AM
To: Deucher, Alexander <[email protected]>
Cc: Christoph Hellwig <[email protected]>; Alex Deucher <[email protected]>; [email protected]; amd- [email protected]; Zhang, Morris <[email protected]>; linux- [email protected]
Subject: Re: [PATCH] drm/amdgpu: add the accelerator pcie class

On Thu, May 25, 2023 at 08:52:06PM +0000, Deucher, Alexander wrote:

Quoted 8 lines
Quoted 1 line

We already handle this today for CLASS_DISPLAY via a data table provided on

our hardware that details the components on the board. The driver can then determine whether or not that combination of components is supported. If the data table doesn't exist or isn’t parse-able, or the components enumerated are not supported, the driver doesn't load.

But things like module loading and initramfs generation still work off the ID table and not your internal tables.

Sure, and everything still works fine. If the device is too new and the driver doesn't have support for it, it doesn't bind and returns -ENODEV when it probes the device.

Alex

Acked-by on v1 1/1
#8 lore raw
In reply to Shiwu Zhang

s/pcie/PCIe/ in the subject.

Quoted 1 line · Shiwu Zhang

v2: add the base class id for accelerator (lijo)

Please include a commit log. For PCI, the "v2: ..." stuff would go below the "---" so it doesn't get included in the git commit. I don't know what the DRM convention is.

It's OK if the commit log repeats the subject. The subject is like the title of a story -- it's not the first sentence of the story.

Please include a spec citation for the PCI_BASE_CLASS_ACCELERATOR values in the commit log. I think it's something like "PCI Code and ID Assignment, r1.9, sec 1, 1.19".

Quoted 2 lines

With the above:

Quoted 38 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 5 +++++
 include/linux/pci_ids.h                 | 3 +++
 2 files changed, 8 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +5 -0
index 3d91e123f9bd..5d652e6f0b1e 100644
@@ -2042,6 +2042,11 @@ static const struct pci_device_id pciidlist[] = {
 	  .class_mask = 0xffffff,
 	  .driver_data = CHIP_IP_DISCOVERY },
 
+	{ PCI_DEVICE(0x1002, PCI_ANY_ID),
+	  .class = PCI_CLASS_ACCELERATOR_PROCESSING << 8,
+	  .class_mask = 0xffffff,
+	  .driver_data = CHIP_IP_DISCOVERY },
+
 	{0, 0, 0}
 };
 
include/linux/pci_ids.h +3 -0
index b362d90eb9b0..4918ff26a987 100644
@@ -151,6 +151,9 @@
 #define PCI_CLASS_SP_DPIO		0x1100
 #define PCI_CLASS_SP_OTHER		0x1180
 
+#define PCI_BASE_CLASS_ACCELERATOR	0x12
+#define PCI_CLASS_ACCELERATOR_PROCESSING	0x1200
+
 #define PCI_CLASS_OTHERS		0xff
 
 /* Vendors and devices.  Sort key: vendor first, device next. */
Signature · 1 line
2.17.1