From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6A3DCE77187 for ; Wed, 18 Dec 2024 14:28:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 28ED610EBB2; Wed, 18 Dec 2024 14:28:13 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="D5SYjKRB"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) by gabe.freedesktop.org (Postfix) with ESMTPS id EB7A310EBB2 for ; Wed, 18 Dec 2024 14:28:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1734532092; x=1766068092; h=message-id:date:subject:to:cc:references:from: in-reply-to:mime-version; bh=D8HHChOy36/n4JGK4rAKFgyrMPucWmXNRqu/1xYMSw0=; b=D5SYjKRBUaBwBRRBkyIfTFOsLHOhV7szXXwyYz32TrBjtvnFVcT4MFMJ o6IjG62idIkrC+ptxF0UihfFqtN51pFGmRVdt+IqZzvDA9VFzrHXMe4KZ DC2VaU8LDl38/ZJdJs0ixBTO5DUxE8mKFiW62I/Ci1erK6Q/1LgG91t+b DsCFJ6zuM/jK2sDP/cUbsZ1lQlitZJC07ETKE4kYsURq3obYnrN3Rxinn 7I6JebWVw+qcAbyHJJ6nDrGN3j/ARexcWPcJJaNrASfbua+MLZ+octuxO 0q2iSpItB98TYUyw1Q3gB9Okkrv96DvxOtC4FIN66AlH3TJBol3JBFAiE g==; X-CSE-ConnectionGUID: Cf0/EyKNSF6TqYslnLy28g== X-CSE-MsgGUID: ylw+selWRC6r/rlFnDgnxQ== X-IronPort-AV: E=McAfee;i="6700,10204,11290"; a="46426392" X-IronPort-AV: E=Sophos;i="6.12,244,1728975600"; d="scan'208,217";a="46426392" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Dec 2024 06:28:11 -0800 X-CSE-ConnectionGUID: krgZbsivRLaolIRy3G8y0A== X-CSE-MsgGUID: IRvUbxzLTmi/5ri77hnUJg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208,217";a="98697258" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orviesa008.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 18 Dec 2024 06:28:12 -0800 Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.44; Wed, 18 Dec 2024 06:28:11 -0800 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.44 via Frontend Transport; Wed, 18 Dec 2024 06:28:11 -0800 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.46) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.44; Wed, 18 Dec 2024 06:28:10 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=jv8LJp7XRHOQaGl4mqnoxudK35NfW0kby58Hriln0Yi+X7YdcdDnjzuLi/X0rC4SA/PfClYwPWKnw/JWASgNFpb+3LrLIpu0paP1tzTNVRH1Y19+lCjl/ygdNnAxFNB96xfcx8XhzbKjqBf2fhCMx6nXCdbl7JDCNzfwGXFbJwb5R/l9ry10ajesZRDXVtxvRkr8/4mCFO8fYx1Muif3uM0C/jalLE1kFECURBuK40ebbUJXmDuAI1skghZotW40DGf60V6LAM8q26veiHct2qkiTaXyrJcxIov8YXaxPbpIpSdYAT3xOB7jD3XuK5FAydZX8idWkyfgKNPXNJzq7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=mpsWnDxkkWzy7Ewzw534i+LvMd/maR4YguJ6j7kU14s=; b=mD3iYRjcPnIHNYrbdKIV1u639ZsyZwXen73Gx0bRBD7XPcoViOhbOemmL8pQE4ZKNF/a6ehMkLEdbBWVMrVhrO+bEujr//ggWeiyR0yj5yQJPwwcmMx1D2vAG1NDCFCl/M7/WWleJK+TR0MXTDr8iAODI82Fm4dkJhuQdlLWE70AhefxNT6r6O1PqYXtorr32zX+BXbtNnACidLtOini5lbX/gJ65/0emvzX7hLXHEUXQmzs9XxRc8BeAUbnfgivsB5CotXkSRzxCias2mku2tEHmJn19ms7W/VoOmrvSJkAXmipT0DoQwjiQqKULX5slhLB3Vh4M3358/jGeHi2XA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from BN9PR11MB5482.namprd11.prod.outlook.com (2603:10b6:408:103::16) by PH8PR11MB6951.namprd11.prod.outlook.com (2603:10b6:510:225::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8272.13; Wed, 18 Dec 2024 14:28:08 +0000 Received: from BN9PR11MB5482.namprd11.prod.outlook.com ([fe80::158b:b258:5e7:c229]) by BN9PR11MB5482.namprd11.prod.outlook.com ([fe80::158b:b258:5e7:c229%4]) with mapi id 15.20.8272.005; Wed, 18 Dec 2024 14:28:08 +0000 Content-Type: multipart/alternative; boundary="------------VTAcjvU0uAEWO3gGyCN4g046" Message-ID: <8243db83-99c5-45c8-9889-f352b3bed1fa@intel.com> Date: Wed, 18 Dec 2024 15:28:03 +0100 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH i-g-t 2/5] lib/xe/xe_sriov_provisioning: Add accessors for quota/spare attributes To: Marcin Bernatowicz , CC: Adam Miszczak , Jakub Kolakowski , =?UTF-8?Q?Micha=C5=82_Wajdeczko?= , =?UTF-8?Q?Micha=C5=82_Winiarski?= , Narasimha C V , =?UTF-8?Q?Piotr_Pi=C3=B3rkowski?= , "Satyanarayana K V P" , Tomasz Lis References: <20241218120056.779962-1-marcin.bernatowicz@linux.intel.com> <20241218120056.779962-3-marcin.bernatowicz@linux.intel.com> From: "Laguna, Lukasz" Content-Language: en-US In-Reply-To: <20241218120056.779962-3-marcin.bernatowicz@linux.intel.com> X-ClientProxiedBy: VI1PR07CA0217.eurprd07.prod.outlook.com (2603:10a6:802:58::20) To BN9PR11MB5482.namprd11.prod.outlook.com (2603:10b6:408:103::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN9PR11MB5482:EE_|PH8PR11MB6951:EE_ X-MS-Office365-Filtering-Correlation-Id: 82df7ce4-c9c2-4ea8-d555-08dd1f70315d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|376014|366016|7053199007|8096899003; X-Microsoft-Antispam-Message-Info: =?utf-8?B?R2R1QnFnVWJ6OFFYaFpVSyt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V0UWdD?= =?utf-8?B?Ulp3TGVScExzR3UycDJoMmhwd1lYbXdRUmd3OFR5dklyTm9MS2hWTWxsaU8w?= =?utf-8?Q?iRPA2P83FjBKM?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN9PR11MB5482.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(376014)(366016)(7053199007)(8096899003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?UXk5MUUvZlJGdW5QVE5OZ3c3QUVaM2k0eWJXa0xIR0w0YVVIV29tNEFjYXMy?= =?utf-8?B?R1hRbThSaklrMG1HWlRuRjduUVBTb3lTQ1dZR2VUNzA4VnZrZHZSTG41RFVQ?= =?utf-8?B?ak52YXA3ZWdQeXhNZUVmN1MrTGlwZy9OeTNtOXE3dTdrcmlFTXFxQW5ITlFr?= =?utf-8?B?VjZhclQvczdUOTVUMEhXOFdPYVo4dGhsTEV2bHo5cHgvTGxjQXF1OXFBUERk?= =?utf-8?B?QnBVVHRlcXNJaDZ4QktTcWVCUXUyMkViU1MzbVB0QUtsZFp1K2JNWklNdzZI?= =?utf-8?B?ejdZOEtDN2o0UXFzKzdkck1lVDViS1Nob3c2RXJuRGFVM3oxSkFQQktFMmQ1?= =?utf-8?B?Ty9JVy9mYXhJTldyc2R2UUtxajBjMFJqYWczNldoK2xQN2dqdFhlTlY3ZnJG?= =?utf-8?B?UmE2bHg2aDZJbThZV0FZR0pCcGRZb1lxUkRIRUNXQzFZU2gvYzN2Q1RHVHpj?= =?utf-8?B?bis4T3ZmSk03RkpqNEViNUZ1bVJEYlhzQzZ1K1VzRGR5cElBK2FackE1SVNH?= =?utf-8?B?MWhBUHpEUDVDSlhnaHU1aUVsaTFuODh0Z2xORm9EcTd5M1pwWjY0eXJuNGlz?= =?utf-8?B?bFJONWdj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nWUlxT3FuSFRU?= =?utf-8?B?QnZMT21YOGNTcFZGVWtHNUtYSlJsRnMzZHZGRjQ5ZFVCbWRoNEtiSlhZRkJ2?= =?utf-8?B?MVBPdGFhSCtSdXVjamp1UTVLcFBpSmp6NmV6M3hUQVN1TXkrT3hRRDVEOC9h?= =?utf-8?B?bkFJcmVQeDh6ajFDZmFOTWgxM0tqY01ET1YyVTNGNG9QSlVCNDFRSitWNExq?= =?utf-8?B?NUhsVW95Rjd4Z3MzL2JQSjlKZjNFYlZoVW1ETjdmZmQ0L2FocDFOL2Robk14?= =?utf-8?B?NVpaVzF4dkx3elNYMURuVkE3RkJOQkllT2NQV2djSjVobFNZQWNmdDBhS0hT?= =?utf-8?B?WUZtZFprUmVSWVkyUDVzUmwrWTZsanp1TzZscjROZlNlR3pMNXpXeXRsbnNj?= =?utf-8?B?MXJTYU9vOHNVNHExMXNYdlc2Z01pT3RHQXdja3JXVVRSdVdhVWZZSWlGUk5E?= =?utf-8?B?RFZlalNrUndpQ3lXN1RFSEJBTVB1WlNzeGM1ZUVESVF4a1J5R2t6N0VqNWIz?= =?utf-8?B?cXVEZ0U0MnVTb2F4ZUYySkVMUGthQ0Zvek1pc3gvbk5Hb0d3VFNaUjVDNzBO?= =?utf-8?B?VnZaZEJkS0RzcFNFbkNuNlJDRnJ2cCtjZVcxVWFjd1UvdXlsQldXMm0yU3pL?= =?utf-8?B?djMrQ04rTXZLVURCd2R5dlJCTHpJOE5jR0xVMG9xRkQ4Q3IvMmpSYkZJSGxV?= =?utf-8?B?RlE9PQ==?= X-MS-Exchange-CrossTenant-Network-Message-Id: 82df7ce4-c9c2-4ea8-d555-08dd1f70315d X-MS-Exchange-CrossTenant-AuthSource: BN9PR11MB5482.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Dec 2024 14:28:08.4036 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: rRb3WmpiwclgCoaujDtA0flFYpplxrVBEJboah20eZUaVSJMXozGANFIObiqYKjl8CL3rgkBecY6j3nUAFzsiQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR11MB6951 X-OriginatorOrg: intel.com X-BeenThere: igt-dev@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development mailing list for IGT GPU Tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" --------------VTAcjvU0uAEWO3gGyCN4g046 Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit On 12/18/2024 13:00, Marcin Bernatowicz wrote: > Introduce functions to get and set SR-IOV provisioning quota and spare > attributes. These functions provide access to shared resource attributes > such as GGTT, LMEM, contexts, and doorbells for both PF and VF contexts. > > Add returning and asserting variants to allow flexible error handling > based on usage scenarios. > > Signed-off-by: Marcin Bernatowicz > Cc: Adam Miszczak > Cc: Jakub Kolakowski > Cc: Lukasz Laguna > Cc: Michał Wajdeczko > Cc: Michał Winiarski > Cc: Narasimha C V > Cc: Piotr Piórkowski > Cc: Satyanarayana K V P > Cc: Tomasz Lis > --- > lib/xe/xe_sriov_provisioning.c | 124 +++++++++++++++++++++++++++++++++ > lib/xe/xe_sriov_provisioning.h | 14 ++++ > 2 files changed, 138 insertions(+) > > diff --git a/lib/xe/xe_sriov_provisioning.c b/lib/xe/xe_sriov_provisioning.c > index 67ae9cf54..536121931 100644 > --- a/lib/xe/xe_sriov_provisioning.c > +++ b/lib/xe/xe_sriov_provisioning.c > @@ -9,6 +9,7 @@ > #include "intel_chipset.h" > #include "linux_scaffold.h" > #include "xe/xe_mmio.h" > +#include "xe/xe_sriov_debugfs.h" > #include "xe/xe_sriov_provisioning.h" > > /** > @@ -150,3 +151,126 @@ int xe_sriov_find_ggtt_provisioned_pte_offsets(int pf_fd, int gt, struct xe_mmio > > return 0; > } > + > +/** > + * xe_sriov_shared_res_attr_name - Retrieve the attribute name for a shared resource > + * @res: Shared resource type (see enum xe_sriov_shared_res) > + * @vf_num: VF number (1-based) or 0 for PF > + * > + * Returns the attribute name corresponding to the specified > + * shared resource type and VF number. For VF (vf_num > 0), the "quota" > + * attribute name is returned (e.g., "contexts_quota"). For PF (vf_num == 0), > + * the "spare" attribute name is returned (e.g., "contexts_spare"). > + * > + * Return: > + * The attribute name as a string if the resource type is valid. > + * NULL if the resource type is invalid. > + */ > +const char *xe_sriov_shared_res_attr_name(enum xe_sriov_shared_res res, > + unsigned int vf_num) > +{ > + switch (res) { > + case XE_SRIOV_SHARED_RES_CONTEXTS: > + return vf_num ? "contexts_quota" : "contexts_spare"; > + case XE_SRIOV_SHARED_RES_DOORBELLS: > + return vf_num ? "doorbells_quota" : "doorbells_spare"; > + case XE_SRIOV_SHARED_RES_GGTT: > + return vf_num ? "ggtt_quota" : "ggtt_spare"; > + case XE_SRIOV_SHARED_RES_LMEM: > + return vf_num ? "lmem_quota" : "lmem_spare"; > + } > + > + return NULL; > +} > + > +/** > + * __xe_sriov_pf_get_shared_res_attr - Read shared resource attribute > + * @pf: PF device file descriptor > + * @res: Shared resource type (see enum xe_sriov_shared_res) > + * @vf_num: VF number (1-based) or 0 for PF > + * @gt_num: GT number > + * @value: Pointer to store the read attribute value > + * > + * Reads the specified shared resource attribute for the given PF device @pf, > + * VF number @vf_num, and GT @gt_num. The attribute depends on @vf_num: > + * - For VF (vf_num > 0), reads the "quota" attribute. > + * - For PF (vf_num == 0), reads the "spare" attribute. > + * > + * > + * Return: 0 on success, negative error code on failure. > + */ > +int __xe_sriov_pf_get_shared_res_attr(int pf, enum xe_sriov_shared_res res, > + unsigned int vf_num, unsigned int gt_num, > + uint64_t *value) > +{ > + return __xe_sriov_pf_debugfs_get_u64(pf, vf_num, gt_num, > + xe_sriov_shared_res_attr_name(res, vf_num), > + value); > +} > + > +/** > + * xe_sriov_pf_get_shared_res_attr - Read shared resource attribute > + * @pf: PF device file descriptor > + * @res: Shared resource type (see enum xe_sriov_shared_res) > + * @vf_num: VF number (1-based) or 0 for PF > + * @gt_num: GT number > + * > + * A throwing version of __xe_sriov_pf_get_shared_res_attr(). > + * Instead of returning an error code, it returns the quota value and asserts > + * in case of an error. > + * > + * Return: The value for the given shared resource attribute. > + * Asserts in case of failure. > + */ > +uint64_t xe_sriov_pf_get_shared_res_attr(int pf, enum xe_sriov_shared_res res, > + unsigned int vf_num, > + unsigned int gt_num) > +{ > + uint64_t value; > + > + igt_fail_on(__xe_sriov_pf_get_shared_res_attr(pf, res, vf_num, gt_num, &value)); > + > + return value; > +} > + > +/** > + * __xe_sriov_pf_set_shared_res_attr - Set a shared resource attribute > + * @pf: PF device file descriptor > + * @res: Shared resource type (see enum xe_sriov_shared_res) > + * @vf_num: VF number (1-based) or 0 for PF > + * @gt_num: GT number > + * @value: Value to set for the shared resource attribute > + * > + * Sets the specified shared resource attribute for the given PF device @pf, > + * VF number @vf_num, and GT @gt_num. The attribute depends on @vf_num: > + * - For VF (vf_num > 0), reads the "quota" attribute. > + * - For PF (vf_num == 0), reads the "spare" attribute. > + * > + * Return: 0 on success, negative error code on failure. > + */ > +int __xe_sriov_pf_set_shared_res_attr(int pf, enum xe_sriov_shared_res res, > + unsigned int vf_num, unsigned int gt_num, > + uint64_t value) > +{ > + return __xe_sriov_pf_debugfs_set_u64(pf, vf_num, gt_num, > + xe_sriov_shared_res_attr_name(res, vf_num), > + value); > +} > + > +/** > + * xe_sriov_pf_set_shared_res_attr - Set the shared resource attribute value > + * @pf: PF device file descriptor > + * @res: Shared resource type (see enum xe_sriov_shared_res) > + * @vf_num: VF number (1-based) or 0 for PF > + * @gt_num: GT number > + * @value: Value to set > + * > + * A throwing version of __xe_sriov_pf_set_shared_res_attr(). > + * Instead of returning an error code, it asserts in case of an error. > + */ > +void xe_sriov_pf_set_shared_res_attr(int pf, enum xe_sriov_shared_res res, > + unsigned int vf_num, unsigned int gt_num, > + uint64_t value) > +{ > + igt_fail_on(__xe_sriov_pf_set_shared_res_attr(pf, res, vf_num, gt_num, value)); > +} > diff --git a/lib/xe/xe_sriov_provisioning.h b/lib/xe/xe_sriov_provisioning.h > index aa2f08f52..168b50394 100644 > --- a/lib/xe/xe_sriov_provisioning.h > +++ b/lib/xe/xe_sriov_provisioning.h > @@ -46,5 +46,19 @@ const char *xe_sriov_shared_res_to_string(enum xe_sriov_shared_res res); > int xe_sriov_find_ggtt_provisioned_pte_offsets(int pf_fd, int gt, struct xe_mmio *mmio, > struct xe_sriov_provisioned_range **ranges, > unsigned int *nr_ranges); > +const char *xe_sriov_shared_res_attr_name(enum xe_sriov_shared_res res, > + unsigned int vf_num); > +int __xe_sriov_pf_get_shared_res_attr(int pf, enum xe_sriov_shared_res res, > + unsigned int vf_num, unsigned int gt_num, > + uint64_t *value); > +uint64_t xe_sriov_pf_get_shared_res_attr(int pf, enum xe_sriov_shared_res res, > + unsigned int vf_num, > + unsigned int gt_num); > +int __xe_sriov_pf_set_shared_res_attr(int pf, enum xe_sriov_shared_res res, > + unsigned int vf_num, unsigned int gt_num, > + uint64_t value); > +void xe_sriov_pf_set_shared_res_attr(int pf, enum xe_sriov_shared_res res, > + unsigned int vf_num, unsigned int gt_num, > + uint64_t value); > > #endif /* __XE_SRIOV_PROVISIONING_H__ */ LGTM, Reviewed-by: Lukasz Laguna --------------VTAcjvU0uAEWO3gGyCN4g046 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: 8bit
On 12/18/2024 13:00, Marcin Bernatowicz wrote:
Introduce functions to get and set SR-IOV provisioning quota and spare
attributes. These functions provide access to shared resource attributes
such as GGTT, LMEM, contexts, and doorbells for both PF and VF contexts.

Add returning and asserting variants to allow flexible error handling
based on usage scenarios.

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>
Cc: Michał Wajdeczko <michal.wajdeczko@intel.com>
Cc: Michał Winiarski <michal.winiarski@intel.com>
Cc: Narasimha C V <narasimha.c.v@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/xe/xe_sriov_provisioning.c | 124 +++++++++++++++++++++++++++++++++
 lib/xe/xe_sriov_provisioning.h |  14 ++++
 2 files changed, 138 insertions(+)

diff --git a/lib/xe/xe_sriov_provisioning.c b/lib/xe/xe_sriov_provisioning.c
index 67ae9cf54..536121931 100644
--- a/lib/xe/xe_sriov_provisioning.c
+++ b/lib/xe/xe_sriov_provisioning.c
@@ -9,6 +9,7 @@
 #include "intel_chipset.h"
 #include "linux_scaffold.h"
 #include "xe/xe_mmio.h"
+#include "xe/xe_sriov_debugfs.h"
 #include "xe/xe_sriov_provisioning.h"
 
 /**
@@ -150,3 +151,126 @@ int xe_sriov_find_ggtt_provisioned_pte_offsets(int pf_fd, int gt, struct xe_mmio
 
 	return 0;
 }
+
+/**
+ * xe_sriov_shared_res_attr_name - Retrieve the attribute name for a shared resource
+ * @res: Shared resource type (see enum xe_sriov_shared_res)
+ * @vf_num: VF number (1-based) or 0 for PF
+ *
+ * Returns the attribute name corresponding to the specified
+ * shared resource type and VF number. For VF (vf_num > 0), the "quota"
+ * attribute name is returned (e.g., "contexts_quota"). For PF (vf_num == 0),
+ * the "spare" attribute name is returned (e.g., "contexts_spare").
+ *
+ * Return:
+ * The attribute name as a string if the resource type is valid.
+ * NULL if the resource type is invalid.
+ */
+const char *xe_sriov_shared_res_attr_name(enum xe_sriov_shared_res res,
+					  unsigned int vf_num)
+{
+	switch (res) {
+	case XE_SRIOV_SHARED_RES_CONTEXTS:
+		return vf_num ? "contexts_quota" : "contexts_spare";
+	case XE_SRIOV_SHARED_RES_DOORBELLS:
+		return vf_num ? "doorbells_quota" : "doorbells_spare";
+	case XE_SRIOV_SHARED_RES_GGTT:
+		return vf_num ? "ggtt_quota" : "ggtt_spare";
+	case XE_SRIOV_SHARED_RES_LMEM:
+		return vf_num ? "lmem_quota" : "lmem_spare";
+	}
+
+	return NULL;
+}
+
+/**
+ * __xe_sriov_pf_get_shared_res_attr - Read shared resource attribute
+ * @pf: PF device file descriptor
+ * @res: Shared resource type (see enum xe_sriov_shared_res)
+ * @vf_num: VF number (1-based) or 0 for PF
+ * @gt_num: GT number
+ * @value: Pointer to store the read attribute value
+ *
+ * Reads the specified shared resource attribute for the given PF device @pf,
+ * VF number @vf_num, and GT @gt_num. The attribute depends on @vf_num:
+ * - For VF (vf_num > 0), reads the "quota" attribute.
+ * - For PF (vf_num == 0), reads the "spare" attribute.
+ *
+ *
+ * Return: 0 on success, negative error code on failure.
+ */
+int __xe_sriov_pf_get_shared_res_attr(int pf, enum xe_sriov_shared_res res,
+				      unsigned int vf_num, unsigned int gt_num,
+				      uint64_t *value)
+{
+	return __xe_sriov_pf_debugfs_get_u64(pf, vf_num, gt_num,
+					     xe_sriov_shared_res_attr_name(res, vf_num),
+					     value);
+}
+
+/**
+ * xe_sriov_pf_get_shared_res_attr - Read shared resource attribute
+ * @pf: PF device file descriptor
+ * @res: Shared resource type (see enum xe_sriov_shared_res)
+ * @vf_num: VF number (1-based) or 0 for PF
+ * @gt_num: GT number
+ *
+ * A throwing version of __xe_sriov_pf_get_shared_res_attr().
+ * Instead of returning an error code, it returns the quota value and asserts
+ * in case of an error.
+ *
+ * Return: The value for the given shared resource attribute.
+ *         Asserts in case of failure.
+ */
+uint64_t xe_sriov_pf_get_shared_res_attr(int pf, enum xe_sriov_shared_res res,
+					 unsigned int vf_num,
+					 unsigned int gt_num)
+{
+	uint64_t value;
+
+	igt_fail_on(__xe_sriov_pf_get_shared_res_attr(pf, res, vf_num, gt_num, &value));
+
+	return value;
+}
+
+/**
+ * __xe_sriov_pf_set_shared_res_attr - Set a shared resource attribute
+ * @pf: PF device file descriptor
+ * @res: Shared resource type (see enum xe_sriov_shared_res)
+ * @vf_num: VF number (1-based) or 0 for PF
+ * @gt_num: GT number
+ * @value: Value to set for the shared resource attribute
+ *
+ * Sets the specified shared resource attribute for the given PF device @pf,
+ * VF number @vf_num, and GT @gt_num. The attribute depends on @vf_num:
+ * - For VF (vf_num > 0), reads the "quota" attribute.
+ * - For PF (vf_num == 0), reads the "spare" attribute.
+ *
+ * Return: 0 on success, negative error code on failure.
+ */
+int __xe_sriov_pf_set_shared_res_attr(int pf, enum xe_sriov_shared_res res,
+				      unsigned int vf_num, unsigned int gt_num,
+				      uint64_t value)
+{
+	return __xe_sriov_pf_debugfs_set_u64(pf, vf_num, gt_num,
+					     xe_sriov_shared_res_attr_name(res, vf_num),
+					     value);
+}
+
+/**
+ * xe_sriov_pf_set_shared_res_attr - Set the shared resource attribute value
+ * @pf: PF device file descriptor
+ * @res: Shared resource type (see enum xe_sriov_shared_res)
+ * @vf_num: VF number (1-based) or 0 for PF
+ * @gt_num: GT number
+ * @value: Value to set
+ *
+ * A throwing version of __xe_sriov_pf_set_shared_res_attr().
+ * Instead of returning an error code, it asserts in case of an error.
+ */
+void xe_sriov_pf_set_shared_res_attr(int pf, enum xe_sriov_shared_res res,
+				     unsigned int vf_num, unsigned int gt_num,
+				     uint64_t value)
+{
+	igt_fail_on(__xe_sriov_pf_set_shared_res_attr(pf, res, vf_num, gt_num, value));
+}
diff --git a/lib/xe/xe_sriov_provisioning.h b/lib/xe/xe_sriov_provisioning.h
index aa2f08f52..168b50394 100644
--- a/lib/xe/xe_sriov_provisioning.h
+++ b/lib/xe/xe_sriov_provisioning.h
@@ -46,5 +46,19 @@ const char *xe_sriov_shared_res_to_string(enum xe_sriov_shared_res res);
 int xe_sriov_find_ggtt_provisioned_pte_offsets(int pf_fd, int gt, struct xe_mmio *mmio,
 					       struct xe_sriov_provisioned_range **ranges,
 					       unsigned int *nr_ranges);
+const char *xe_sriov_shared_res_attr_name(enum xe_sriov_shared_res res,
+					  unsigned int vf_num);
+int __xe_sriov_pf_get_shared_res_attr(int pf, enum xe_sriov_shared_res res,
+				      unsigned int vf_num, unsigned int gt_num,
+				      uint64_t *value);
+uint64_t xe_sriov_pf_get_shared_res_attr(int pf, enum xe_sriov_shared_res res,
+					 unsigned int vf_num,
+					 unsigned int gt_num);
+int __xe_sriov_pf_set_shared_res_attr(int pf, enum xe_sriov_shared_res res,
+				      unsigned int vf_num, unsigned int gt_num,
+				      uint64_t value);
+void xe_sriov_pf_set_shared_res_attr(int pf, enum xe_sriov_shared_res res,
+				     unsigned int vf_num, unsigned int gt_num,
+				     uint64_t value);
 
 #endif /* __XE_SRIOV_PROVISIONING_H__ */

LGTM,
Reviewed-by: Lukasz Laguna <lukasz.laguna@intel.com>

--------------VTAcjvU0uAEWO3gGyCN4g046--