From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Imre Deak <imre.deak@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 3/3] tests/pm_rps: vlv: round middle point to freq supported by HW
Date: Thu, 4 Dec 2014 18:31:04 +0200 [thread overview]
Message-ID: <20141204163104.GG10649@intel.com> (raw)
In-Reply-To: <1417709380-12178-4-git-send-email-imre.deak@intel.com>
On Thu, Dec 04, 2014 at 06:09:40PM +0200, Imre Deak wrote:
> Atm the test assumes that the calculated middle frequency point is
> supported by the HW, but it's not so at least on VLV. On my B0
> BYT-M there is a 22MHz step between the allowed values, so the test will
> fail trying to set the calculated middle freq that isn't aligned to
> this.
>
> To fix this get the nearest supported value by setting the target
> frequency as a min or max frequency and read it back. The kernel will
> round the returned value to the nearest supported.
>
> Signed-off-by: Imre Deak <imre.deak@intel.com>
> ---
> tests/pm_rps.c | 39 +++++++++++++++++++++++++++++++++------
> 1 file changed, 33 insertions(+), 6 deletions(-)
>
> diff --git a/tests/pm_rps.c b/tests/pm_rps.c
> index 1fd5995..8777a73 100644
> --- a/tests/pm_rps.c
> +++ b/tests/pm_rps.c
> @@ -120,7 +120,7 @@ static void wait_freq_settle(void)
> }
> }
>
> -static int do_writeval(FILE *filp, int val, int lerrno)
> +static int do_writeval(FILE *filp, int val, int lerrno, bool readback_check)
> {
> int ret, orig;
>
> @@ -131,18 +131,21 @@ static int do_writeval(FILE *filp, int val, int lerrno)
> if (lerrno) {
> /* Expecting specific error */
> igt_assert(ret == EOF && errno == lerrno);
> - igt_assert(readval(filp) == orig);
> + if (readback_check)
> + igt_assert_eq(readval(filp), orig);
> } else {
> /* Expecting no error */
> igt_assert_neq(ret, 0);
> wait_freq_settle();
> - igt_assert(readval(filp) == val);
> + if (readback_check)
> + igt_assert_eq(readval(filp), val);
> }
>
> return ret;
> }
> -#define writeval(filp, val) do_writeval(filp, val, 0)
> -#define writeval_inval(filp, val) do_writeval(filp, val, EINVAL)
> +#define writeval(filp, val) do_writeval(filp, val, 0, true)
> +#define writeval_inval(filp, val) do_writeval(filp, val, EINVAL, true)
> +#define writeval_nocheck(filp, val) do_writeval(filp, val, 0, false)
>
> static void checkit(const int *freqs)
> {
> @@ -342,12 +345,36 @@ static void do_load_gpu(void)
> load_helper_stop();
> }
>
> +/* Return a frequency rounded by HW to the nearest supported value */
> +static int get_hw_rounded_freq(int target)
> +{
> + int freqs[NUMFREQ];
> + int old_freq;
> + int idx;
> + int ret;
> +
> + read_freqs(freqs);
> +
> + if (freqs[MIN] > target)
> + idx = MIN;
> + else
> + idx = MAX;
> +
> + old_freq = freqs[idx];
> + writeval_nocheck(stuff[idx].filp, target);
> + read_freqs(freqs);
> + ret = freqs[idx];
> + writeval_nocheck(stuff[idx].filp, old_freq);
> +
> + return ret;
> +}
> +
> static void min_max_config(void (*check)(void), bool load_gpu)
> {
> int fmid = (origfreqs[RPn] + origfreqs[RP0]) / 2;
>
> /* hw (and so kernel) currently rounds to 50 MHz ... */
This comment could use a bit of updating as well.
> - fmid = fmid / 50 * 50;
> + fmid = get_hw_rounded_freq(fmid / 50 * 50);
>
> igt_debug("\nCheck original min and max...\n");
> if (load_gpu)
> --
> 1.8.4
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2014-12-04 16:31 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-04 16:09 [PATCH 0/3] igt/pm_rps: fix some subcases for vlv Imre Deak
2014-12-04 16:09 ` [PATCH 1/3] tests/pm_rps: vlv: wait for freq to settle Imre Deak
2014-12-04 16:09 ` [PATCH 2/3] tests/pm_rps: vlv: load gpu for idle min/max tests Imre Deak
2014-12-05 20:56 ` Daniel Vetter
2014-12-05 20:59 ` Chris Wilson
2014-12-05 21:06 ` Daniel Vetter
2014-12-05 21:01 ` Imre Deak
2014-12-04 16:09 ` [PATCH 3/3] tests/pm_rps: vlv: round middle point to freq supported by HW Imre Deak
2014-12-04 16:31 ` Ville Syrjälä [this message]
2014-12-05 14:27 ` [PATCH v2 " Imre Deak
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=20141204163104.GG10649@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=imre.deak@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