From: "Teres Alexis, Alan Previn" <alan.previn.teres.alexis@intel.com>
To: "igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>,
"kamil.konieczny@linux.intel.com"
<kamil.konieczny@linux.intel.com>
Cc: "Konieczny, Kamil" <kamil.konieczny@intel.com>
Subject: Re: [igt-dev] [PATCH i-g-t] lib/i915: Add a helper lib to read mmio registers via ioctl
Date: Fri, 25 Aug 2023 17:25:06 +0000 [thread overview]
Message-ID: <97e776c356d5a7b7bc7a78423e4f0502c97810e4.camel@intel.com> (raw)
In-Reply-To: <20230816142739.k2ycx6vn5rrx33rt@kamilkon-desk1>
Thanks the reviewing Kamil
On Wed, 2023-08-16 at 16:27 +0200, Kamil Konieczny wrote:
> Hi Alan,
>
> On 2023-08-15 at 10:36:59 -0700, Alan Previn wrote:
> > Add a helper lib function to call DRM_IOCTL_I915_REG_READ to
> > read whitelisted registers.
> >
> > Signed-off-by: Alan Previn <alan.previn.teres.alexis@intel.com>
> > ---
> > lib/i915/i915_reg_read_ioctl.c | 34 ++++++++++++++++++++++++++++++++++
> ---------------- ^^^^^^^^^^^^^^
>
> imho better name would be i915_mmio_reg
alan: i assume we'll go with the other suggestion to move into the ioctl_wrapper.*
> > +/**
> > + * i915_reg_read_ioctl:
> > + * @drmfd: device file descriptor
> > + * @offset: mmio register to read from
> > + * @value: ptr to fill with results from read
> > + *
> > + * This function uses DRM_IOCTL_I915_REG_READ to read the
> > + * register and so it can return NOACCES if i915 doesn't allow.
> > + *
> > + * Returns:
> > + * -errno
> > + */
> > +int i915_reg_read_ioctl(int drmfd, __u64 offset, __u64 *value)
>
> There is convention in igt to have "__function" without error asserts
> and "function" failing when ioctl fails, so maybe better is:
>
> int __i915_reg_read_ioctl(int drmfd, __u64 offset, __u64 *value)
alna: okay - good point - i guess i should relook at the callers to see
if we need both exports (one wrapping the other) ... or not depending
if we already have users.
>
> > +{
> > + struct drm_i915_reg_read reg_read = {0};
> > + int ret = 0;
> > +
> > + reg_read.offset = offset;
> > + if (igt_ioctl(drmfd, DRM_IOCTL_I915_REG_READ, ®_read))
> > + ret = -errno;
> > + else if (value)
> > + *value = reg_read.val;
> > +
> > + return ret;
> > +}
> > +
> >
> >
> >
[alan:snip]
> > *
> > @@ -1852,13 +1855,11 @@ static void gem_evict_pwrite_subtest(void)
> > /* This also triggered WARNs on dmesg at some point. */
> > static void reg_read_ioctl_subtest(void)
> > {
> > - struct drm_i915_reg_read rr = {
> > - .offset = 0x2358, /* render ring timestamp */
> > - };
> > + __u64 val;
> >
> > disable_all_screens_and_wait(&ms_data);
[alan:snip]
> >
> > - do_ioctl(drm_fd, DRM_IOCTL_I915_REG_READ, &rr);
> > + i915_reg_read_ioctl(drm_fd, 0x2358, &val);
> ----------------------------------- ^^^^^^
> Maybe define it at i915_mmio_reg.h ?
>
> #define MMIO_REG_RENDER_RING_TIMESTAMP 0x2358
>
alan: yes - my bad - i should have done that up front.
next prev parent reply other threads:[~2023-08-25 17:25 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-15 17:36 [igt-dev] [PATCH i-g-t] lib/i915: Add a helper lib to read mmio registers via ioctl Alan Previn
2023-08-15 18:11 ` [igt-dev] ○ CI.xeBAT: info for " Patchwork
2023-08-15 18:25 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2023-08-15 20:13 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2023-08-16 14:27 ` [igt-dev] [PATCH i-g-t] " Kamil Konieczny
2023-08-17 13:23 ` Dixit, Ashutosh
2023-08-17 17:12 ` Kamil Konieczny
2023-08-25 17:19 ` Teres Alexis, Alan Previn
2023-08-25 17:25 ` Teres Alexis, Alan Previn [this message]
2023-08-25 17:41 ` Teres Alexis, Alan Previn
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=97e776c356d5a7b7bc7a78423e4f0502c97810e4.camel@intel.com \
--to=alan.previn.teres.alexis@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=kamil.konieczny@intel.com \
--cc=kamil.konieczny@linux.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox