OSDN Git Service

platform/x86: amd-pmc: Correct usage of SMU version
authorMario Limonciello <mario.limonciello@amd.com>
Thu, 20 Jan 2022 17:44:39 +0000 (11:44 -0600)
committerHans de Goede <hdegoede@redhat.com>
Mon, 24 Jan 2022 10:14:49 +0000 (11:14 +0100)
Yellow carp has been outputting versions like `1093.24.0`, but this
is supposed to be 69.24.0. That is the MSB is being interpreted
incorrectly.

The MSB is not part of the major version, but has generally been
treated that way thus far.  It's actually the program, and used to
distinguish between two programs from a similar family but different
codebase.

Link: https://patchwork.freedesktop.org/patch/469993/
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://lore.kernel.org/r/20220120174439.12770-1-mario.limonciello@amd.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
drivers/platform/x86/amd-pmc.c

index 85b6802..4c72ba6 100644 (file)
@@ -124,9 +124,10 @@ struct amd_pmc_dev {
        u32 cpu_id;
        u32 active_ips;
 /* SMU version information */
-       u16 major;
-       u16 minor;
-       u16 rev;
+       u8 smu_program;
+       u8 major;
+       u8 minor;
+       u8 rev;
        struct device *dev;
        struct pci_dev *rdev;
        struct mutex lock; /* generic mutex lock */
@@ -180,11 +181,13 @@ static int amd_pmc_get_smu_version(struct amd_pmc_dev *dev)
        if (rc)
                return rc;
 
-       dev->major = (val >> 16) & GENMASK(15, 0);
+       dev->smu_program = (val >> 24) & GENMASK(7, 0);
+       dev->major = (val >> 16) & GENMASK(7, 0);
        dev->minor = (val >> 8) & GENMASK(7, 0);
        dev->rev = (val >> 0) & GENMASK(7, 0);
 
-       dev_dbg(dev->dev, "SMU version is %u.%u.%u\n", dev->major, dev->minor, dev->rev);
+       dev_dbg(dev->dev, "SMU program %u version is %u.%u.%u\n",
+               dev->smu_program, dev->major, dev->minor, dev->rev);
 
        return 0;
 }