All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dixit, Ashutosh" <ashutosh.dixit@intel.com>
To: "Sundaresan, Sujaritha" <sujaritha.sundaresan@intel.com>
Cc: "intel-xe@lists.freedesktop.org" <intel-xe@lists.freedesktop.org>
Subject: Re: [Intel-xe] [PATCH] [RFC]drm/xe: Sysfs entries to query fused min, max frequency of lmem
Date: Wed, 07 Jun 2023 13:26:43 -0700	[thread overview]
Message-ID: <87cz27m324.wl-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <01542752-02A7-4368-BF36-F4B568F63AD8@intel.com>

On Tue, 06 Jun 2023 20:38:34 -0700, Sundaresan, Sujaritha wrote:
>
> > On Jun 6, 2023, at 9:27 PM, Dixit, Ashutosh <ashutosh.dixit@intel.com> wrote:
> >
> > On Tue, 06 Jun 2023 01:21:42 -0700, Sujaritha Sundaresan wrote:
> >>
> >
> > Hi Suja,
> >
> > Once again sysfs_create_files is missing from the patch.
> >
> > Also xe calls lmem vram, so sysfs file names should something like
> > vram_rp0/rpn_freq_mhz, "mem" is too general.
> >
> > Ashutosh
>
> Hi Ashutosh,
>
> Yeah this is not the complete patch. I was hoping to get some feedback on
> the naming and placing of the code.
>
> Thanks for the review. I will rename the attributes to reflect the vram.
>
> Is it okay to leave the code in the current file ? Should the PCODE
> definitions be here or another regs file ?

Not sure whether the vram sysfs functions belong in xe_guc_pc.c, but the
pcode definitions should be in xe_pcode_api.h.

>
> Regards,
> Suja
> >
> >
> >> Signed-off-by: Sujaritha Sundaresan <sujaritha.sundaresan@intel.com>
> >> ---
> >> drivers/gpu/drm/xe/regs/xe_regs.h |  7 +++++
> >> drivers/gpu/drm/xe/xe_guc_pc.c    | 44 +++++++++++++++++++++++++++++++
> >> 2 files changed, 51 insertions(+)
> >>
> >> diff --git a/drivers/gpu/drm/xe/regs/xe_regs.h b/drivers/gpu/drm/xe/regs/xe_regs.h
> >> index 8be616a1bd51..bd7b26296402 100644
> >> --- a/drivers/gpu/drm/xe/regs/xe_regs.h
> >> +++ b/drivers/gpu/drm/xe/regs/xe_regs.h
> >> @@ -101,4 +101,11 @@
> >> #define DSMBASE                    XE_REG(0x1080C0)
> >> #define   BDSM_MASK                REG_GENMASK64(63, 20)
> >>
> >> +#define   XEHP_PCODE_FREQUENCY_CONFIG           0x6e
> >> +/* XEHP_PCODE_FREQUENCY_CONFIG sub-commands (param1) */
> >> +#define     PCODE_MBOX_FC_SC_READ_FUSED_P0      0x0
> >> +#define     PCODE_MBOX_FC_SC_READ_FUSED_PN      0x1
> >> +/* PCODE_MBOX_DOMAIN_* - mailbox domain IDs */
> >> +#define     PCODE_MBOX_DOMAIN_HBM               0x2
> >> +
> >> #endif
> >> diff --git a/drivers/gpu/drm/xe/xe_guc_pc.c b/drivers/gpu/drm/xe/xe_guc_pc.c
> >> index 67faa9ee0006..1b349ce74c3d 100644
> >> --- a/drivers/gpu/drm/xe/xe_guc_pc.c
> >> +++ b/drivers/gpu/drm/xe/xe_guc_pc.c
> >> @@ -453,6 +453,48 @@ static ssize_t freq_rpn_show(struct device *dev,
> >> }
> >> static DEVICE_ATTR_RO(freq_rpn);
> >>
> >> +static ssize_t freq_mem_rp0_show(struct device *dev,
> >> +                 struct device_attribute *attr, char *buff)
> >> +{
> >> +    struct kobject *kobj = &dev->kobj;
> >> +    struct xe_gt *gt = kobj_to_gt(kobj);
> >> +    u32 val;
> >> +    int err;
> >> +
> >> +    err = xe_pcode_read(dev, XEHPSDV_PCODE_FREQUENCY_CONFIG,
> >> +                PCODE_MBOX_FC_SC_READ_FUSED_P0,
> >> +                PCODE_MBOX_DOMAIN_HBM, &val);
> >> +    if (err)
> >> +        return err;
> >> +
> >> +    /* data_out - Fused P0 for domain ID in units of 50 MHz */
> >> +    val *= GT_FREQUENCY_MULTIPLIER;
> >> +
> >> +    return sysfs_emit(buff, "%u\n", val);
> >> +}
> >> +static DEVICE_ATTR_RO(freq_mem_rp0);
> >> +
> >> +static ssize_t freq_mem_rpn_show(struct device *dev,
> >> +                 struct device_attribute *attr, char *buff)
> >> +{
> >> +    struct kobject *kobj = &dev->kobj;
> >> +    struct xe_gt *gt = kobj_to_gt(kobj);
> >> +    u32 val;
> >> +    int err;
> >> +
> >> +    err = xe_pcode_read(dev, XEHPSDV_PCODE_FREQUENCY_CONFIG,
> >> +                PCODE_MBOX_FC_SC_READ_FUSED_PN,
> >> +                PCODE_MBOX_DOMAIN_HBM, &val);
> >> +    if (err)
> >> +        return err;
> >> +
> >> +    /* data_out - Fused P0 for domain ID in units of 50 MHz */
> >> +    val *= GT_FREQUENCY_MULTIPLIER;
> >> +
> >> +    return sysfs_emit(buff, "%u\n", val);
> >> +}
> >> +static DEVICE_ATTR_RO(freq_mem_rpn);
> >> +
> >> static ssize_t freq_min_show(struct device *dev,
> >>                 struct device_attribute *attr, char *buf)
> >> {
> >> @@ -631,6 +673,8 @@ static const struct attribute *pc_attrs[] = {
> >>    &dev_attr_freq_rp0.attr,
> >>    &dev_attr_freq_rpe.attr,
> >>    &dev_attr_freq_rpn.attr,
> >> +    &dev_attr_freq_mem_rp0.attr,
> >> +    &dev_attr_freq_mem_rpn.attr,
> >>    &dev_attr_freq_min.attr,
> >>    &dev_attr_freq_max.attr,
> >>    &dev_attr_rc_status.attr,
> >> --
> >> 2.39.1
> >>

  reply	other threads:[~2023-06-07 20:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-06  8:21 [Intel-xe] [PATCH] [RFC]drm/xe: Sysfs entries to query fused min, max frequency of lmem Sujaritha Sundaresan
2023-06-06  9:25 ` [Intel-xe] ✓ CI.Patch_applied: success for drm/xe: " Patchwork
2023-06-06  9:25 ` [Intel-xe] ✗ CI.checkpatch: warning " Patchwork
2023-06-06  9:26 ` [Intel-xe] ✗ CI.KUnit: failure " Patchwork
2023-06-06 15:56 ` [Intel-xe] [PATCH] [RFC]drm/xe: " Dixit, Ashutosh
2023-06-07  3:38   ` Sundaresan, Sujaritha
2023-06-07 20:26     ` Dixit, Ashutosh [this message]
2023-06-07  4:37 ` Nilawar, Badal
2023-06-07 18:21 ` Matt Roper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87cz27m324.wl-ashutosh.dixit@intel.com \
    --to=ashutosh.dixit@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=sujaritha.sundaresan@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.