All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Bernatowicz, Marcin" <marcin.bernatowicz@linux.intel.com>
To: Lukasz Laguna <lukasz.laguna@intel.com>, igt-dev@lists.freedesktop.org
Cc: satyanarayana.k.v.p@intel.com, michal.wajdeczko@intel.com,
	adam.miszczak@linux.intel.com, jakub1.kolakowski@intel.com
Subject: Re: [PATCH i-g-t v2 1/4] lib/xe/xe_sriov_debugfs: Add helper to read VF's configuration data
Date: Mon, 10 Feb 2025 11:57:20 +0100	[thread overview]
Message-ID: <14a69a85-8068-4d29-938d-30467efc6ea7@linux.intel.com> (raw)
In-Reply-To: <9162314f-efd8-4180-ab29-5ca2c5f15704@linux.intel.com>



On 2/10/2025 11:43 AM, Bernatowicz, Marcin wrote:
> 
> 
> On 2/7/2025 10:40 AM, Lukasz Laguna wrote:
>> Add helper allowing to read configuration data that VF queried from GuC
>> during probe.
>>
>> v2:
>>   - remove redundant fd closing (Marcin)
>>   - move helper to xe_sriov_debugfs lib (Marcin)
>>
>> Signed-off-by: Lukasz Laguna <lukasz.laguna@intel.com>
>> Reviewed-by: Satyanarayana K V P <satyanarayana.k.v.p@intel.com>
>> ---
>>   lib/xe/xe_sriov_debugfs.c | 78 +++++++++++++++++++++++++++++++++++++++
>>   lib/xe/xe_sriov_debugfs.h |  5 +++
>>   2 files changed, 83 insertions(+)
>>
>> diff --git a/lib/xe/xe_sriov_debugfs.c b/lib/xe/xe_sriov_debugfs.c
>> index abb1bf7d5..fb8a7c3e3 100644
>> --- a/lib/xe/xe_sriov_debugfs.c
>> +++ b/lib/xe/xe_sriov_debugfs.c
>> @@ -471,3 +471,81 @@ DEFINE_XE_SRIOV_PF_DEBUGFS_FUNC(bool *, 
>> get_boolean, __igt_sysfs_get_boolean)
>>    * Return: 0 on success, negative error code on failure.
>>    */
>>   DEFINE_XE_SRIOV_PF_DEBUGFS_FUNC(bool, set_boolean, 
>> __igt_sysfs_set_boolean)
>> +
>> +
> 
> CHECK:LINE_SPACING: Please don't use multiple blank lines
> 
> 
>> +/**
>> + * __xe_sriov_vf_debugfs_get_selfconfig - Read VF's configuration data.
>> + * @vf: VF device file descriptor
>> + * @res: Shared resource type (see enum xe_sriov_shared_res)
>> + * @gt_num: GT number
>> + * @value: Pointer to store the read value
>> + *
>> + * Reads the specified shared resource @res from selfconfig of given 
>> VF device
>> + * @vf on GT @gt_num.
>> + *
>> + * Return: 0 on success, negative error code on failure.
>> + */
>> +int __xe_sriov_vf_debugfs_get_selfconfig(int vf, enum 
>> xe_sriov_shared_res res,
>> +                        unsigned int gt_num, uint64_t *value)
> 
> CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis
> 
>> +{
>> +    FILE *file;
>> +    size_t n = 0;
>> +    char *line = NULL;
>> +    int fd, ret = 0;
>> +
>> +    fd = igt_debugfs_gt_open(vf, gt_num, "vf/self_config", O_RDONLY);
>> +    if (fd < 0)
>> +        return fd;
>> +    file = fdopen(fd, "r");
>> +    if (!file) {
>> +        close(fd);
>> +        return -errno;
>> +    }
>> +
>> +    while (getline(&line, &n, file) >= 0) {
>> +        switch (res) {
>> +        case XE_SRIOV_SHARED_RES_CONTEXTS:
>> +            ret = sscanf(line, "GuC contexts: %lu", value);
>> +            break;
>> +        case XE_SRIOV_SHARED_RES_DOORBELLS:
>> +            ret = sscanf(line, "GuC doorbells: %lu", value);
>> +            break;
>> +        case XE_SRIOV_SHARED_RES_GGTT:
>> +            ret = sscanf(line, "GGTT size: %lu", value);
>> +            break;
>> +        case XE_SRIOV_SHARED_RES_LMEM:
>> +            ret = sscanf(line, "LMEM size: %lu", value);
>> +            break;
>> +        }
>> +
>> +        if (ret > 0)
>> +            break;
>> +    }
>> +
>> +    free(line);
>> +    fclose(file);
>> +
>> +    return ret ? 0 : -1;
>> +}
>> +/**
> 
> CHECK:LINE_SPACING: Please use a blank line after function/struct/union/ 
> enum declarations
> 
>> + * xe_sriov_vf_debugfs_get_selfconfig - Read VF's configuration data.
>> + * @pf: PF device file descriptor
>> + * @res: Shared resource type (see enum xe_sriov_shared_res)
>> + * @gt_num: GT number
>> + *
>> + * A throwing version of __xe_sriov_vf_debugfs_get_selfconfig().
>> + * Instead of returning an error code, it returns the quota value and 
>> asserts
>> + * in case of an error.
>> + *
>> + * Return: The quota for the given shared resource.
>> + *         Asserts in case of failure.
>> + */
>> +uint64_t xe_sriov_vf_debugfs_get_selfconfig(int vf, enum 
>> xe_sriov_shared_res res,
>> +                           unsigned int gt_num)
> 
> CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis
>

LGTM, with some style corrections.
Reviewed-by: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>


>> +{
>> +    uint64_t value;
>> +
>> +    igt_fail_on(__xe_sriov_vf_debugfs_get_selfconfig(vf, res, gt_num, 
>> &value));
>> +
>> +    return value;
>> +}
>> diff --git a/lib/xe/xe_sriov_debugfs.h b/lib/xe/xe_sriov_debugfs.h
>> index cd5f932be..4983afbb3 100644
>> --- a/lib/xe/xe_sriov_debugfs.h
>> +++ b/lib/xe/xe_sriov_debugfs.h
>> @@ -39,4 +39,9 @@ int __xe_sriov_pf_debugfs_set_boolean(int pf, 
>> unsigned int vf_num,
>>                         unsigned int gt_num, const char *attr,
>>                         bool value);
>> +int __xe_sriov_vf_debugfs_get_selfconfig(int vf, enum 
>> xe_sriov_shared_res res,
>> +                     unsigned int gt_num, uint64_t *value);
>> +uint64_t xe_sriov_vf_debugfs_get_selfconfig(int vf, enum 
>> xe_sriov_shared_res res,
>> +                        unsigned int gt_num);
>> +
>>   #endif /* __XE_SRIOV_DEBUGFS_H__ */
> 


  reply	other threads:[~2025-02-10 10:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-07  9:40 [PATCH i-g-t v2 0/4] Verify VF configuration data against provisioned values Lukasz Laguna
2025-02-07  9:40 ` [PATCH i-g-t v2 1/4] lib/xe/xe_sriov_debugfs: Add helper to read VF's configuration data Lukasz Laguna
2025-02-10 10:43   ` Bernatowicz, Marcin
2025-02-10 10:57     ` Bernatowicz, Marcin [this message]
2025-02-07  9:40 ` [PATCH i-g-t v2 2/4] lib/xe/xe_sriov_provisioning: Add helper to get VF's provisioned quota Lukasz Laguna
2025-02-07  9:40 ` [PATCH i-g-t v2 3/4] lib/igt_sriov_device: Add helper to iterate over VFs in specified range Lukasz Laguna
2025-02-11 11:23   ` Bernatowicz, Marcin
2025-02-07  9:40 ` [PATCH i-g-t v2 4/4] tests/xe_sriov_auto_provisioning: Add subtest to verify VF's configuration Lukasz Laguna
2025-02-10 10:52   ` Bernatowicz, Marcin
2025-02-08  0:26 ` ✓ i915.CI.BAT: success for Verify VF configuration data against provisioned values (rev2) Patchwork
2025-02-08  1:22 ` ✗ Xe.CI.BAT: failure " Patchwork
2025-02-08 16:45 ` ✗ i915.CI.Full: " Patchwork
2025-02-08 19:19 ` ✗ 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=14a69a85-8068-4d29-938d-30467efc6ea7@linux.intel.com \
    --to=marcin.bernatowicz@linux.intel.com \
    --cc=adam.miszczak@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=jakub1.kolakowski@intel.com \
    --cc=lukasz.laguna@intel.com \
    --cc=michal.wajdeczko@intel.com \
    --cc=satyanarayana.k.v.p@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.