Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Iddamsetty, Aravind" <aravind.iddamsetty@intel.com>
To: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>,
	<intel-gfx@lists.freedesktop.org>
Subject: Re: [Intel-gfx] [PATCH 1/1] drm/i915: Export LMEM max memory bandwidth via sysfs.
Date: Wed, 16 Nov 2022 15:09:42 +0530	[thread overview]
Message-ID: <62148f04-d9f9-82a7-5871-d5dae24ad818@intel.com> (raw)
In-Reply-To: <20221115080845.1793650-1-himal.prasad.ghimiray@intel.com>



On 15-11-2022 13:38, Himal Prasad Ghimiray wrote:
> Export lmem maximum memory bandwidth to the userspace via sysfs.
> 
> Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_reg.h   |  2 ++
>  drivers/gpu/drm/i915/i915_sysfs.c | 27 +++++++++++++++++++++++++++
>  2 files changed, 29 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index c4921c9a60770..3ba1efa995ca9 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -6603,6 +6603,8 @@
>  #define	    POWER_SETUP_I1_WATTS		REG_BIT(31)
>  #define	    POWER_SETUP_I1_SHIFT		6	/* 10.6 fixed point format */
>  #define	    POWER_SETUP_I1_DATA_MASK		REG_GENMASK(15, 0)
> +#define	  PCODE_MEMORY_CONFIG			0x70
> +#define	    MEMORY_CONFIG_SUBCOMMAND_READ_MAX_BANDWIDTH 0x0
>  #define GEN12_PCODE_READ_SAGV_BLOCK_TIME_US	0x23
>  #define   XEHP_PCODE_FREQUENCY_CONFIG		0x6e	/* xehpsdv, pvc */
>  /* XEHP_PCODE_FREQUENCY_CONFIG sub-commands (param1) */
> diff --git a/drivers/gpu/drm/i915/i915_sysfs.c b/drivers/gpu/drm/i915/i915_sysfs.c
> index 595e8b5749907..0a6efc300998b 100644
> --- a/drivers/gpu/drm/i915/i915_sysfs.c
> +++ b/drivers/gpu/drm/i915/i915_sysfs.c
> @@ -37,7 +37,10 @@
>  
>  #include "i915_drv.h"
>  #include "i915_sysfs.h"
> +#include "i915_reg.h"
>  #include "intel_pm.h"
> +#include "intel_pcode.h"
> +
>  
>  struct drm_i915_private *kdev_minor_to_i915(struct device *kdev)
>  {
> @@ -231,11 +234,35 @@ static void i915_setup_error_capture(struct device *kdev) {}
>  static void i915_teardown_error_capture(struct device *kdev) {}
>  #endif
>  

prelim naming shall not be used.

Thanks,
Aravind.
> +static ssize_t
> +prelim_lmem_max_bw_Mbps_show(struct device *dev, struct device_attribute *attr, char *buff)
> +{
> +	struct drm_i915_private *i915 = kdev_minor_to_i915(dev);
> +	u32 val;
> +	int err;
> +
> +	err = snb_pcode_read_p(&i915->uncore, PCODE_MEMORY_CONFIG,
> +			       MEMORY_CONFIG_SUBCOMMAND_READ_MAX_BANDWIDTH,
> +			       0x0, &val);
> +	if (err)
> +		return err;
> +
> +	return sysfs_emit(buff, "%u\n", val);
> +}
> +
> +static DEVICE_ATTR_RO(prelim_lmem_max_bw_Mbps);
> +
>  void i915_setup_sysfs(struct drm_i915_private *dev_priv)
>  {
>  	struct device *kdev = dev_priv->drm.primary->kdev;
>  	int ret;
>  
> +	if (IS_DG1(dev_priv) || IS_DG2(dev_priv)) {
> +		ret = sysfs_create_file(&kdev->kobj, &dev_attr_prelim_lmem_max_bw_Mbps.attr);
> +		if (ret)
> +			drm_err(&dev_priv->drm, "Setting up sysfs to read max B/W failed\n");
> +	}
> +
>  	if (HAS_L3_DPF(dev_priv)) {
>  		ret = device_create_bin_file(kdev, &dpf_attrs);
>  		if (ret)

  parent reply	other threads:[~2022-11-16  9:39 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-15  8:08 [Intel-gfx] [PATCH 1/1] drm/i915: Export LMEM max memory bandwidth via sysfs Himal Prasad Ghimiray
2022-11-15 14:53 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/1] " Patchwork
2022-11-15 15:47 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-11-15 19:24 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2022-11-16  9:39 ` Iddamsetty, Aravind [this message]
2022-11-16 10:08 ` [Intel-gfx] [PATCH 1/1] " Gupta, Anshuman
2022-11-16 10:48   ` Ghimiray, Himal Prasad
2022-11-21  6:49     ` Ghimiray, Himal Prasad
  -- strict thread matches above, loose matches on Subject: below --
2022-11-21 10:01 Himal Prasad Ghimiray
2022-11-21 11:29 ` Gupta, Anshuman
2022-11-23  5:04   ` Ghimiray, Himal Prasad
2022-11-21 11:47 ` Tvrtko Ursulin
2022-11-23  5:10   ` Ghimiray, Himal Prasad
2022-11-23  5:59     ` Dixit, Ashutosh
2022-11-23  6:01       ` Ghimiray, Himal Prasad

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=62148f04-d9f9-82a7-5871-d5dae24ad818@intel.com \
    --to=aravind.iddamsetty@intel.com \
    --cc=himal.prasad.ghimiray@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox