[Intel-xe] [PATCH 1/4] drm/xe: Return GMD_ID revid properly

Gustavo Sousa gustavo.sousa at intel.com
Fri Jun 16 14:07:08 UTC 2023


Quoting Gustavo Sousa (2023-06-16 11:05:43-03:00)
>Quoting Matt Roper (2023-06-14 17:51:59-03:00)
>>peek_gmdid() returns the IP version, not the raw value of the GMD_ID
>>register.  Make sure we extract and return the rev_id field as well so
>>that it can be used to determine the IP steppings properly.
>
>Hm... This has been fixed in a different way by Lucas in [1]. Adding him
>here so we can choose one of the fixes. Both look good to me.

Ugh... Forgot to add Lucas to the Cc list. Adding now.

>
>[1] https://patchwork.freedesktop.org/patch/542422/?series=119292&rev=1
>
>As suggested in Lucas', I would also take this opportunity to rename
>GMD_ID_REVID to GMD_ID_REVID_MASK for consistency.
>
>Reviewed-by: Gustavo Sousa <gustavo.sousa at intel.com>
>
>--
>Gustavo Sousa
>
>>
>>Signed-off-by: Matt Roper <matthew.d.roper at intel.com>
>>---
>> drivers/gpu/drm/xe/xe_pci.c | 23 +++++++++++++----------
>> 1 file changed, 13 insertions(+), 10 deletions(-)
>>
>>diff --git a/drivers/gpu/drm/xe/xe_pci.c b/drivers/gpu/drm/xe/xe_pci.c
>>index 2991cf5365d5..7926c2fa1433 100644
>>--- a/drivers/gpu/drm/xe/xe_pci.c
>>+++ b/drivers/gpu/drm/xe/xe_pci.c
>>@@ -392,23 +392,27 @@ find_subplatform(const struct xe_device *xe, const struct xe_device_desc *desc)
>>         return NULL;
>> }
>> 
>>-static u32 peek_gmdid(struct xe_device *xe, u32 gmdid_offset)
>>+static void peek_gmdid(struct xe_device *xe, u32 gmdid_offset, u32 *ver, u32 *revid)
>> {
>>         struct pci_dev *pdev = to_pci_dev(xe->drm.dev);
>>         void __iomem *map = pci_iomap_range(pdev, 0, gmdid_offset, sizeof(u32));
>>-        u32 ver;
>>+        u32 val;
>> 
>>         if (!map) {
>>                 drm_err(&xe->drm, "Failed to read GMD_ID (%#x) from PCI BAR.\n",
>>                         gmdid_offset);
>>-                return 0;
>>+                *ver = 0;
>>+                *revid = 0;
>>+
>>+                return;
>>         }
>> 
>>-        ver = ioread32(map);
>>+        val = ioread32(map);
>>         pci_iounmap(pdev, map);
>> 
>>-        return REG_FIELD_GET(GMD_ID_ARCH_MASK, ver) * 100 +
>>-                REG_FIELD_GET(GMD_ID_RELEASE_MASK, ver);
>>+        *ver = REG_FIELD_GET(GMD_ID_ARCH_MASK, val) * 100 +
>>+                REG_FIELD_GET(GMD_ID_RELEASE_MASK, val);
>>+        *revid = REG_FIELD_GET(GMD_ID_REVID, val);
>> }
>> 
>> /*
>>@@ -444,8 +448,7 @@ static void handle_gmdid(struct xe_device *xe,
>> {
>>         u32 ver;
>> 
>>-        ver = peek_gmdid(xe, GMD_ID.addr);
>>-        *graphics_revid = REG_FIELD_GET(GMD_ID_REVID, ver);
>>+        peek_gmdid(xe, GMD_ID.addr, &ver, graphics_revid);
>>         for (int i = 0; i < ARRAY_SIZE(graphics_ip_map); i++) {
>>                 if (ver == graphics_ip_map[i].ver) {
>>                         xe->info.graphics_verx100 = ver;
>>@@ -460,8 +463,8 @@ static void handle_gmdid(struct xe_device *xe,
>>                         ver / 100, ver % 100);
>>         }
>> 
>>-        ver = peek_gmdid(xe, GMD_ID.addr + 0x380000);
>>-        *media_revid = REG_FIELD_GET(GMD_ID_REVID, ver);
>>+        peek_gmdid(xe, GMD_ID.addr + 0x380000, &ver, media_revid);
>>+
>>         for (int i = 0; i < ARRAY_SIZE(media_ip_map); i++) {
>>                 if (ver == media_ip_map[i].ver) {
>>                         xe->info.media_verx100 = ver;
>>-- 
>>2.40.1
>>


More information about the Intel-xe mailing list