Skip to content

Commit

Permalink
platform/x86/amd: pmc: Hide SMU version and program attributes for Pi…
Browse files Browse the repository at this point in the history
…casso

As the command to get version isn't supported on Picasso, we shouldn't
be exposing this into sysfs either.

Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2449
Fixes: 7f1ea75 ("platform/x86/amd: pmc: Add sysfs files for SMU")
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://lore.kernel.org/r/20230409185348.556161-3-Shyam-sundar.S-k@amd.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
  • Loading branch information
Mario Limonciello authored and Hans de Goede committed Apr 11, 2023
1 parent b845772 commit 5ec9ee0
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion drivers/platform/x86/amd/pmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -452,12 +452,31 @@ static ssize_t smu_program_show(struct device *d, struct device_attribute *attr,
static DEVICE_ATTR_RO(smu_fw_version);
static DEVICE_ATTR_RO(smu_program);

static umode_t pmc_attr_is_visible(struct kobject *kobj, struct attribute *attr, int idx)
{
struct device *dev = kobj_to_dev(kobj);
struct amd_pmc_dev *pdev = dev_get_drvdata(dev);

if (pdev->cpu_id == AMD_CPU_ID_PCO)
return 0;
return 0444;
}

static struct attribute *pmc_attrs[] = {
&dev_attr_smu_fw_version.attr,
&dev_attr_smu_program.attr,
NULL,
};
ATTRIBUTE_GROUPS(pmc);

static struct attribute_group pmc_attr_group = {
.attrs = pmc_attrs,
.is_visible = pmc_attr_is_visible,
};

static const struct attribute_group *pmc_groups[] = {
&pmc_attr_group,
NULL,
};

static int smu_fw_info_show(struct seq_file *s, void *unused)
{
Expand Down

0 comments on commit 5ec9ee0

Please sign in to comment.