From: "Laguna, Lukasz" <lukasz.laguna@intel.com>
To: "Bernatowicz, Marcin" <marcin.bernatowicz@linux.intel.com>,
<igt-dev@lists.freedesktop.org>
Cc: "Adam Miszczak" <adam.miszczak@linux.intel.com>,
"Jakub Kolakowski" <jakub1.kolakowski@intel.com>,
"Michał Wajdeczko" <michal.wajdeczko@intel.com>,
"Michał Winiarski" <michal.winiarski@intel.com>,
"Piotr Piórkowski" <piotr.piorkowski@intel.com>,
"Satyanarayana K V P" <satyanarayana.k.v.p@intel.com>,
"Tomasz Lis" <tomasz.lis@intel.com>
Subject: Re: [PATCH i-g-t 1/2] lib/igt_sriov_device: Add intel_is_vf_device helper
Date: Tue, 4 Mar 2025 08:24:31 +0100 [thread overview]
Message-ID: <30934360-442a-47c1-a8b9-3e5446f99a0c@intel.com> (raw)
In-Reply-To: <3bb27413-e2c5-4553-9992-f2505ec5c2ad@linux.intel.com>
On 3/3/2025 16:44, Bernatowicz, Marcin wrote:
>
>
> On 3/3/2025 9:20 AM, Laguna, Lukasz wrote:
>>
>> On 2/19/2025 12:53, Marcin Bernatowicz wrote:
>>> Introduce intel_is_vf_device helper to determine whether a given device
>>> is a Virtual Function (VF). The function reads the
>>> VF_CAPABILITY_REGISTER
>>> and checks if the least significant bit is set to identify VF device.
>>>
>>> Signed-off-by: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
>>> Cc: Adam Miszczak <adam.miszczak@linux.intel.com>
>>> Cc: Jakub Kolakowski <jakub1.kolakowski@intel.com>
>>> Cc: Lukasz Laguna <lukasz.laguna@intel.com>
Reviewed-by: Lukasz Laguna <lukasz.laguna@intel.com>
>>> Cc: Michał Wajdeczko <michal.wajdeczko@intel.com>
>>> Cc: Michał Winiarski <michal.winiarski@intel.com>
>>> Cc: Piotr Piórkowski <piotr.piorkowski@intel.com>
>>> Cc: Satyanarayana K V P <satyanarayana.k.v.p@intel.com>
>>> Cc: Tomasz Lis <tomasz.lis@intel.com>
>>> ---
>>> lib/igt_sriov_device.c | 26 ++++++++++++++++++++++++++
>>> lib/igt_sriov_device.h | 1 +
>>> 2 files changed, 27 insertions(+)
>>>
>>> diff --git a/lib/igt_sriov_device.c b/lib/igt_sriov_device.c
>>> index 2b83cd43c..ffa996d6b 100644
>>> --- a/lib/igt_sriov_device.c
>>> +++ b/lib/igt_sriov_device.c
>>> @@ -14,6 +14,7 @@
>>> #include "igt_device.h"
>>> #include "igt_sriov_device.h"
>>> #include "igt_sysfs.h"
>>> +#include "intel_io.h"
>>> #include "xe/xe_query.h"
>>> /**
>>> @@ -464,3 +465,28 @@ bool igt_sriov_device_reset(int pf, unsigned
>>> int vf_num)
>>> return ret;
>>> }
>>> +
>>> +/**
>>> + * intel_is_vf_device - Check if device is VF
>>> + * @device: device file descriptor
>>> + *
>>> + * Determines if a device is a Virtual Function (VF)
>>> + * by reading VF_CAPABILITY_REGISTER. If the least
>>> + * significant bit is set the device is VF.
>>> + *
>>> + * Return:
>>> + * True if device is VF, false otherwise.
>>> + */
>>> +bool intel_is_vf_device(int fd)
>>> +{
>>> +#define VF_CAP_REG 0x1901f8
>>> + struct intel_mmio_data mmio_data;
>>> + uint32_t value;
>>> +
>>> + intel_register_access_init(&mmio_data,
>>> igt_device_get_pci_device(fd), false);
>>> + value = intel_register_read(&mmio_data, VF_CAP_REG);
>>> + intel_register_access_fini(&mmio_data);
>>> + igt_require((value & ~1) == 0);
>>
>> Is it really needed?
>
> This should protect against 0xFFFFFFFF reads.
>
>>
>>> +
>>> + return (value & 1) != 0;
>>
>> just return value & 1 ?
>>
>>> +}
>>> diff --git a/lib/igt_sriov_device.h b/lib/igt_sriov_device.h
>>> index 2b6acb6d7..912449086 100644
>>> --- a/lib/igt_sriov_device.h
>>> +++ b/lib/igt_sriov_device.h
>>> @@ -33,6 +33,7 @@ void igt_sriov_unbind_vf_drm_driver(int pf,
>>> unsigned int vf_num);
>>> int igt_sriov_device_sysfs_open(int pf, unsigned int vf_num);
>>> bool igt_sriov_device_reset_exists(int pf, unsigned int vf_num);
>>> bool igt_sriov_device_reset(int pf, unsigned int vf_num);
>>> +bool intel_is_vf_device(int device);
>>> /**
>>> * __is_valid_range - Helper to check VF range is valid
>
next prev parent reply other threads:[~2025-03-04 7:24 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-19 11:53 [PATCH i-g-t 0/2] Add VF detection and skip devcoredump checks on VFs Marcin Bernatowicz
2025-02-19 11:53 ` [PATCH i-g-t 1/2] lib/igt_sriov_device: Add intel_is_vf_device helper Marcin Bernatowicz
2025-03-03 8:20 ` Laguna, Lukasz
2025-03-03 15:44 ` Bernatowicz, Marcin
2025-03-04 7:24 ` Laguna, Lukasz [this message]
2025-02-19 11:53 ` [PATCH i-g-t 2/2] tests/xe_exec_capture: Skip checks on VF devices Marcin Bernatowicz
2025-02-21 16:45 ` Dong, Zhanjun
2025-02-19 23:33 ` ✓ i915.CI.BAT: success for Add VF detection and skip devcoredump checks on VFs Patchwork
2025-02-19 23:50 ` ✓ Xe.CI.BAT: " Patchwork
2025-02-20 11:30 ` ✗ i915.CI.Full: failure " Patchwork
2025-02-20 21:58 ` ✗ Xe.CI.Full: " 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=30934360-442a-47c1-a8b9-3e5446f99a0c@intel.com \
--to=lukasz.laguna@intel.com \
--cc=adam.miszczak@linux.intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=jakub1.kolakowski@intel.com \
--cc=marcin.bernatowicz@linux.intel.com \
--cc=michal.wajdeczko@intel.com \
--cc=michal.winiarski@intel.com \
--cc=piotr.piorkowski@intel.com \
--cc=satyanarayana.k.v.p@intel.com \
--cc=tomasz.lis@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