From: "Modem, Bhanuprakash" <bhanuprakash.modem@intel.com>
To: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>,
"Mauro Carvalho Chehab" <mauro.chehab@linux.intel.com>
Cc: igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [i-g-t 4/5] lib/intel_chipset: Add support to XE driver to get devid
Date: Tue, 14 Mar 2023 20:00:45 +0530 [thread overview]
Message-ID: <bf72f848-1dc0-b100-1cc2-7a207a6ce54e@intel.com> (raw)
In-Reply-To: <20230314122019.nmjrvhx7xloqdcky@zkempczy-mobl2>
On Tue-14-03-2023 05:50 pm, Zbigniew Kempczyński wrote:
> On Tue, Mar 14, 2023 at 01:08:05PM +0100, Mauro Carvalho Chehab wrote:
>> On Tue, 14 Mar 2023 16:24:51 +0530
>> Bhanuprakash Modem <bhanuprakash.modem@intel.com> wrote:
>>
>>> As many tests are using intel devid, add a helper to get it for
>>> XE driver.
>>>
>>> Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
>>> ---
>>> lib/intel_chipset.c | 30 ++++++++++++++++++++----------
>>> 1 file changed, 20 insertions(+), 10 deletions(-)
>>>
>>> diff --git a/lib/intel_chipset.c b/lib/intel_chipset.c
>>> index efb6f1771..73dbd813d 100644
>>> --- a/lib/intel_chipset.c
>>> +++ b/lib/intel_chipset.c
>>> @@ -41,6 +41,7 @@
>>> #include "drmtest.h"
>>> #include "intel_chipset.h"
>>> #include "igt_core.h"
>>> +#include "xe/xe_query.h"
>>>
>>> /**
>>> * SECTION:intel_chipset
>>> @@ -112,9 +113,22 @@ intel_get_pci_device(void)
>>> return pci_dev;
>>> }
>>>
>>> +static uint32_t __i915_get_drm_devid(int fd)
>>> +{
>>> + struct drm_i915_getparam gp;
>>> + int devid = 0;
>>> +
>>> + memset(&gp, 0, sizeof(gp));
>>> + gp.param = I915_PARAM_CHIPSET_ID;
>>> + gp.value = &devid;
>>> + ioctl(fd, DRM_IOCTL_I915_GETPARAM, &gp, sizeof(gp));
>>> +
>>> + return devid;
>>> +}
>>> +
>>
>> Hmm... Shouldn't it be cached? Anyway:
>>
>> Reviewed-by: Mauro Carvalho Chehab <mchehab@kernel.org>
>>
>>
>>> /**
>>> * intel_get_drm_devid:
>>> - * @fd: open i915 drm file descriptor
>>> + * @fd: open i915/xe drm file descriptor
>>> *
>>> * Queries the kernel for the pci device id corresponding to the drm file
>>> * descriptor.
>>> @@ -125,22 +139,18 @@ intel_get_pci_device(void)
>>> uint32_t
>>> intel_get_drm_devid(int fd)
>>> {
>>> - struct drm_i915_getparam gp;
>>> const char *override;
>>> - int devid = 0;
>>>
>>> - igt_assert(is_i915_device(fd));
>>> + igt_assert(is_intel_device(fd));
>>>
>>> override = getenv("INTEL_DEVID_OVERRIDE");
>>> if (override)
>>> return strtol(override, NULL, 0);
>>>
>>> - memset(&gp, 0, sizeof(gp));
>>> - gp.param = I915_PARAM_CHIPSET_ID;
>>> - gp.value = &devid;
>>> - ioctl(fd, DRM_IOCTL_I915_GETPARAM, &gp, sizeof(gp));
>>> -
>>> - return devid;
>>> + if (is_i915_device(fd))
>>> + return __i915_get_drm_devid(fd);
>>> + else
>>> + return xe_dev_id(fd);
>
> This call is problematic imo, it strongly depends on previously
> calling xe_device_get(). As this library part I would explicitly
> call config query ioctl() to get device id to avoid this dependency.
Every KMS test is supposed to call xe_device_get() before starting the
execution (Please check patch [5/5] in this series).
Still, having a separate helper to get the dev_id is a good option to
me. I'll float a new rev by adding this.
- Bhanu
>
> --
> Zbigniew
>
>
>>> }
>>>
>>> /**
next prev parent reply other threads:[~2023-03-14 14:31 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-14 10:54 [igt-dev] [i-g-t 0/5] Add basic helpers to support display in XE Bhanuprakash Modem
2023-03-14 10:54 ` [igt-dev] [i-g-t 1/5] lib/drmtest: Add helpers to check and require the XE driver Bhanuprakash Modem
2023-03-14 11:14 ` Zbigniew Kempczyński
2023-03-14 11:57 ` Mauro Carvalho Chehab
2023-03-14 10:54 ` [igt-dev] [i-g-t 2/5] i915: s/igt_require_intel/igt_require_i915 Bhanuprakash Modem
2023-03-14 11:15 ` Zbigniew Kempczyński
2023-03-14 12:03 ` Mauro Carvalho Chehab
2023-03-14 14:32 ` Modem, Bhanuprakash
2023-03-14 10:54 ` [igt-dev] [i-g-t 3/5] lib/xe/xe_query: Add dev_id() interface Bhanuprakash Modem
2023-03-14 11:17 ` Zbigniew Kempczyński
2023-03-14 12:06 ` Mauro Carvalho Chehab
2023-03-14 10:54 ` [igt-dev] [i-g-t 4/5] lib/intel_chipset: Add support to XE driver to get devid Bhanuprakash Modem
2023-03-14 11:20 ` Zbigniew Kempczyński
2023-03-14 12:08 ` Mauro Carvalho Chehab
2023-03-14 12:20 ` Zbigniew Kempczyński
2023-03-14 14:30 ` Modem, Bhanuprakash [this message]
2023-03-14 10:54 ` [igt-dev] [i-g-t 5/5] lib/igt_kms: Cache xe_device info for kms tests Bhanuprakash Modem
2023-03-14 11:38 ` Zbigniew Kempczyński
2023-03-14 12:08 ` Mauro Carvalho Chehab
2023-03-14 12:45 ` [igt-dev] ✓ Fi.CI.BAT: success for Add basic helpers to support display in XE Patchwork
2023-03-15 16:57 ` [igt-dev] ✓ Fi.CI.IGT: " 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=bf72f848-1dc0-b100-1cc2-7a207a6ce54e@intel.com \
--to=bhanuprakash.modem@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=mauro.chehab@linux.intel.com \
--cc=zbigniew.kempczynski@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