All of lore.kernel.org
 help / color / mirror / Atom feed
From: Raag Jadav <raag.jadav@intel.com>
To: Riana Tauro <riana.tauro@intel.com>
Cc: lucas.demarchi@intel.com, rodrigo.vivi@intel.com,
	intel-xe@lists.freedesktop.org, anshuman.gupta@intel.com,
	badal.nilawar@intel.com
Subject: Re: [PATCH v2 1/3] drm/xe: Move xe_device_sysfs_init() to xe_pci_probe()
Date: Thu, 17 Apr 2025 10:54:59 +0300	[thread overview]
Message-ID: <aACz02tjPQSThiKd@black.fi.intel.com> (raw)
In-Reply-To: <5c6726de-dcdf-4bd8-9522-492608738177@intel.com>

On Thu, Apr 17, 2025 at 10:52:54AM +0530, Riana Tauro wrote:
> On 4/16/2025 10:07 PM, Raag Jadav wrote:
> > On Wed, Apr 16, 2025 at 08:15:48PM +0530, Riana Tauro wrote:
> > > Hi Raag
> > > 
> > > On 4/16/2025 4:19 PM, Raag Jadav wrote:
> > > > On Wed, Apr 16, 2025 at 03:34:43PM +0530, Riana Tauro wrote:
> > > > > On 4/16/2025 1:25 PM, Riana Tauro wrote:
> > > > > > Hi Raag
> > > > > > 
> > > > > > On 4/3/2025 11:17 PM, Raag Jadav wrote:
> > > > > > > Move xe_device_sysfs_init() to xe_pci_probe() so that we can expose
> > > > > > > non-PM attributes as well.
> > > > > > > 
> > > > > > > Signed-off-by: Raag Jadav <raag.jadav@intel.com>
> > > > > > > ---
> > > > > > >     drivers/gpu/drm/xe/xe_device_sysfs.c | 11 +++++++----
> > > > > > >     drivers/gpu/drm/xe/xe_pci.c          |  6 ++++++
> > > > > > >     drivers/gpu/drm/xe/xe_pm.c           |  5 -----
> > > > > > >     3 files changed, 13 insertions(+), 9 deletions(-)
> > > > > > > 
> > > > > > > diff --git a/drivers/gpu/drm/xe/xe_device_sysfs.c b/drivers/gpu/drm/
> > > > > > > xe/xe_device_sysfs.c
> > > > > > > index 7efbd4c52791..d4c73acea1cf 100644
> > > > > > > --- a/drivers/gpu/drm/xe/xe_device_sysfs.c
> > > > > > > +++ b/drivers/gpu/drm/xe/xe_device_sysfs.c
> > > > > > > @@ -67,7 +67,8 @@ static void xe_device_sysfs_fini(void *arg)
> > > > > > >     {
> > > > > > >         struct xe_device *xe = arg;
> > > > > > > -    sysfs_remove_file(&xe->drm.dev->kobj,
> > > > > > > &dev_attr_vram_d3cold_threshold.attr);
> > > > > > > +    if (xe->d3cold.capable)
> > > > > > > +        sysfs_remove_file(&xe->drm.dev->kobj,
> > > > > > > &dev_attr_vram_d3cold_threshold.attr);
> > > > > > >     }
> > > > > > >     int xe_device_sysfs_init(struct xe_device *xe)
> > > > > > > @@ -75,9 +76,11 @@ int xe_device_sysfs_init(struct xe_device *xe)
> > > > > > >         struct device *dev = xe->drm.dev;
> > > > > > >         int ret;
> > > > > > > -    ret = sysfs_create_file(&dev->kobj,
> > > > > > > &dev_attr_vram_d3cold_threshold.attr);
> > > > > > > -    if (ret)
> > > > > > > -        return ret;
> > > > > > > +    if (xe->d3cold.capable) {
> > > > > > > +        ret = sysfs_create_file(&dev->kobj,
> > > > > > > &dev_attr_vram_d3cold_threshold.attr);
> > > > > > > +        if (ret)
> > > > > > > +            return ret;
> > > > > > > +    }
> > > > > > >         return devm_add_action_or_reset(dev, xe_device_sysfs_fini, xe);
> > > > > > >     }
> > > > > > > diff --git a/drivers/gpu/drm/xe/xe_pci.c b/drivers/gpu/drm/xe/xe_pci.c
> > > > > > > index 58347fa91841..246682b2a2be 100644
> > > > > > > --- a/drivers/gpu/drm/xe/xe_pci.c
> > > > > > > +++ b/drivers/gpu/drm/xe/xe_pci.c
> > > > > > > @@ -18,6 +18,7 @@
> > > > > > >     #include "display/xe_display.h"
> > > > > > >     #include "regs/xe_gt_regs.h"
> > > > > > >     #include "xe_device.h"
> > > > > > > +#include "xe_device_sysfs.h"
> > > > > > >     #include "xe_drv.h"
> > > > > > >     #include "xe_gt.h"
> > > > > > >     #include "xe_gt_sriov_vf.h"
> > > > > > > @@ -864,6 +865,11 @@ static int xe_pci_probe(struct pci_dev *pdev,
> > > > > > > const struct pci_device_id *ent)
> > > > > > >         if (err)
> > > > > > >             goto err_driver_cleanup;
> > > > > > > +    /* We have PM related attributes, so do it after xe_pm_init(). */
> > > > > > > +    err = xe_device_sysfs_init(xe);
> > > > > > Layering doesn't seem right. This should in xe_device_probe.
> > > > > > d3cold capable can be moved to pm_init_early and this to device_probe
> > > > 
> > > > Are you sure if we can use ttm_manager_type() in pm_init_early()?
> > > 
> > > you need only d3cold.capable to setup sysfs. This call is using only pci
> > > calls. So this should work
> > > 
> > > xe->d3cold.capable = xe_pm_pci_d3cold_capable(xe);
> > 
> > Sure, but should we expose vram_d3cold_threshold before calculating its
> > value?
> 
> pm_init anyway fails if it's not able to set vram_d3cold_threshold.

Which means we should make sure it's valid before exposing it.

> Adding it to xe pci layer seemed wrong to me because there are no other
> sysfs init calls in probe.
> 
> But upto you

Sure, we can change if there's an alternative that doesn't break one rule
of thumb for another.

Raag

  reply	other threads:[~2025-04-17  7:55 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-03 17:47 [PATCH v2 0/3] BMG PCIe Gen4 downspeed attributes and usage Raag Jadav
2025-04-03 17:47 ` [PATCH v2 1/3] drm/xe: Move xe_device_sysfs_init() to xe_pci_probe() Raag Jadav
2025-04-16  7:55   ` Riana Tauro
2025-04-16 10:04     ` Riana Tauro
2025-04-16 10:49       ` Raag Jadav
2025-04-16 14:45         ` Riana Tauro
2025-04-16 16:37           ` Raag Jadav
2025-04-17  5:22             ` Riana Tauro
2025-04-17  7:54               ` Raag Jadav [this message]
2025-04-03 17:47 ` [PATCH v2 2/3] drm/xe: Expose PCIe Gen4 downspeed attributes Raag Jadav
2025-04-16 10:06   ` Riana Tauro
2025-04-16 10:58     ` Raag Jadav
2025-04-16 14:52       ` Riana Tauro
2025-04-16 15:26         ` Raag Jadav
2025-04-17  5:17           ` Riana Tauro
2025-04-17  7:48             ` Raag Jadav
2025-04-03 17:47 ` [PATCH v2 3/3] drm/xe/doc: Wire up PCIe Gen5 update limitations Raag Jadav
2025-04-03 23:39 ` ✓ CI.Patch_applied: success for BMG PCIe Gen4 downspeed attributes and usage Patchwork
2025-04-03 23:39 ` ✗ CI.checkpatch: warning " Patchwork
2025-04-03 23:40 ` ✓ CI.KUnit: success " Patchwork
2025-04-03 23:57 ` ✓ CI.Build: " Patchwork
2025-04-03 23:59 ` ✓ CI.Hooks: " Patchwork
2025-04-04  0:00 ` ✓ CI.checksparse: " Patchwork
2025-04-04  0:18 ` ✓ Xe.CI.BAT: " Patchwork
2025-04-04  9:19 ` ✗ Xe.CI.Full: failure " Patchwork

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=aACz02tjPQSThiKd@black.fi.intel.com \
    --to=raag.jadav@intel.com \
    --cc=anshuman.gupta@intel.com \
    --cc=badal.nilawar@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=lucas.demarchi@intel.com \
    --cc=riana.tauro@intel.com \
    --cc=rodrigo.vivi@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.