Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp5766719rwb; Tue, 9 Aug 2022 03:53:55 -0700 (PDT) X-Google-Smtp-Source: AA6agR7ubHKtGR3dWVuSB6QPKxr1BIkF7a1rDojSyWDXNEs2quIwBN92mgLw4wHhBfyc/PIbqBkW X-Received: by 2002:a17:907:168e:b0:731:4ba0:d5e9 with SMTP id hc14-20020a170907168e00b007314ba0d5e9mr8013019ejc.204.1660042435046; Tue, 09 Aug 2022 03:53:55 -0700 (PDT) Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gt20-20020a170906f21400b007309eb6dcbfsi1510287ejb.372.2022.08.09.03.53.29; Tue, 09 Aug 2022 03:53:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=OxsZ4brQ; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241585AbiHIKMR (ORCPT + 99 others); Tue, 9 Aug 2022 06:12:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240207AbiHIKMP (ORCPT ); Tue, 9 Aug 2022 06:12:15 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C72041F619; Tue, 9 Aug 2022 03:12:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1660039934; x=1691575934; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=W1dCdRa9i5IGxEl6YuB3pkY8PivI1PitIypXqQgXY6g=; b=OxsZ4brQgMrsT8n5Heq7MJyd30A4hw02oeLUHM5wm2bOQ7Vg3sm3Xwso LBv4CcvUPZd2MAuZC2GSoTpEd/bJgIS+0kTRtUM/5plChcMSkABUKwZU/ UNd+xWq6f1i5hJDUH0Cbi+ZTqIWxqeFeHvxP1BF3rJHmW3THYVTLdreui jyZpFjIy8OSYObNYjrRvyCH0iUp2u9U8RZ+ikIc3czxftmL0MvG6KYEel xWtenxxg9Xn9ucQusMbMDzNKW8IItrOuSGvjvzOc7Dt8kBpJIY5qFlKnH LJKuQ9TulIMRlryeDV8FQrMCUXJObccI+27g3LbiwABfPlx8bk59/VRxA Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10433"; a="377091665" X-IronPort-AV: E=Sophos;i="5.93,224,1654585200"; d="scan'208";a="377091665" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Aug 2022 03:12:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,224,1654585200"; d="scan'208";a="608163823" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by fmsmga007.fm.intel.com with ESMTP; 09 Aug 2022 03:12:14 -0700 Received: from orsmsx608.amr.corp.intel.com (10.22.229.21) 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.2375.28; Tue, 9 Aug 2022 03:12:13 -0700 Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) by ORSMSX608.amr.corp.intel.com (10.22.229.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Tue, 9 Aug 2022 03:12:13 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx607.amr.corp.intel.com (10.22.229.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28 via Frontend Transport; Tue, 9 Aug 2022 03:12:13 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.168) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.28; Tue, 9 Aug 2022 03:12:13 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Bw7qnHoFrItMxs5XOC02pdQsRExDtgsO0em237brNuIH3+YmRbLO03iX8Pfsq/CtSPvoC51SdP2yAUq3DG9D/2MjvN5+b1q5zeWoawVIyK3HGYRnKBhUV/v0GCUfUL0tjubNlK72rC5KNUqUR7JCNUIHpjtxml32nz7da+Tsj6iYNKMd5GRBmi0gwwN1vSDbiEGo5MAPXTvpZZMmkTQ6Msr1pUqeuAKUegdhKFey9YWBBLE7OtCue+pEcmBAwoUxpto/rHcxC94snhhTNqKJuKIn14Nhy2WsiLcP5uHsm326U2wWMvOtKxQReSm6rucYZyo2Dtb6rBFz7Rac8ZZOsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=jWN+290TYyB9Yney/EqL51r2ULfxK3dgNvqdOAMGJrM=; b=c2Adpaf2HXIHvQ5CQmdUfZb/cHpWEgFIckiTMRHUQCNrwm+t3PCI9xlKzjzP0NXRwAgZsM7JGX8+oKOqn2PwQ4eJ/mvJDDdAVIqwu3yYQZMFe+1CjeMV28dQsSNKYW2BxNnqsulZro5hRd41jEOfk88DxEtYWrMKED6UfbsnttJWgPCDXK2MQai564chIiHlfaXyx410c6j1XRjWOcveKCc/dbBLAIwosqmrQNujNMfKMu8CNXTa+FlCr3Gq07lPup6xoXeU0nal5W6x/JzUkSgKXrUaj73we4uz9H3AnvN+8fyy/3OnaKDYOnb+83rkyBCS8tmhavsS8wyIuin2qw== 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 MN0PR11MB6059.namprd11.prod.outlook.com (2603:10b6:208:377::9) by BN6PR11MB4052.namprd11.prod.outlook.com (2603:10b6:405:7a::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.15; Tue, 9 Aug 2022 10:12:11 +0000 Received: from MN0PR11MB6059.namprd11.prod.outlook.com ([fe80::a968:40aa:6163:5c79]) by MN0PR11MB6059.namprd11.prod.outlook.com ([fe80::a968:40aa:6163:5c79%6]) with mapi id 15.20.5504.014; Tue, 9 Aug 2022 10:12:11 +0000 Date: Tue, 9 Aug 2022 06:12:06 -0400 From: Rodrigo Vivi To: Mauro Carvalho Chehab CC: Thomas Zimmermann , Jonathan Corbet , David Airlie , , , , Maxime Ripard , Subject: Re: [Intel-gfx] [PATCH v2 38/39] drm/i915: add descriptions for some RPM macros at intel_gt_pm.h Message-ID: References: <37e3b9aac85f1d08c0a53bae86680d504308bf67.1657699522.git.mchehab@kernel.org> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <37e3b9aac85f1d08c0a53bae86680d504308bf67.1657699522.git.mchehab@kernel.org> X-ClientProxiedBy: SJ0PR13CA0183.namprd13.prod.outlook.com (2603:10b6:a03:2c3::8) To MN0PR11MB6059.namprd11.prod.outlook.com (2603:10b6:208:377::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 89c3c8fe-3196-4364-f2cd-08da79ef9fee X-MS-TrafficTypeDiagnostic: BN6PR11MB4052:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dR75t9JU0rrQV+9hWsDnmUvcFqJTeaTUo4/KowUDQ2AZfkq7PuGiIJqwTMYOwl9/a/3y7dXcLBg6VsGEi811Tl/UYaCIpgKQRDh7iLbeNhk9c3SRNoEFOZl/4o7WpR2oak4z20EO37vkT6uqvy6Z/itbFXzz9RFXzMDzZWlhK7z0ZfwotbtRhEsabKDA/bT1fRaVWijefEJdtPsUBAWFllzndVG0r8mErEAIpI79ajB4OYAyCLuncjZ/aQMCVZ3GZrR7bXhBCvmY2FePTssnGrsodkMPqLDKjmlB/aPj60l+wJp3ywMs9PPJS7/Lr+BfW3XqBdYJGyZzaUf+nzyALh41pkFHjSrQiyAFjQJn/kHHBOileUwMAT7SIWfcUGHSON/uhEZkw14S9MZQaYxUBofx5Hy58MQ7qr+wx8NKlecvHrpGfVwldhqxtQHG/o/Hdl14S+AmS0dzZYxGUf3lYDZEB1gx4bwshMuUF/YKk+jTWQ24jBJonzPj4eVSue29FGCIfB+QYfniYYIraaewnFuTlSFLayim10TAdndiLPGtiJ9tsy23+nWBP0V3nUJYAP4xvZlOowC0fXUorHiNKJyaJNy54ahU59Qw7Acscci08kW/ais+7Zuj2mzbWyR6/Qgc2Lr8LYusYSm1a9KCvj8tlg7kOTKyHtec/NSdCbERGe+BCMv8i380aQWRS/ChsMo0S2qttRyJQZPqgf9P3fG9X8/2bp5DQYYyco/u8EIC1R2WL2GJ2fD9b6m3bB//Og+HRNRd8ddpu00HiqoHEw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN0PR11MB6059.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(39860400002)(346002)(376002)(366004)(136003)(396003)(41300700001)(6666004)(6506007)(2906002)(2616005)(26005)(6512007)(82960400001)(86362001)(83380400001)(66476007)(8936002)(4326008)(966005)(66556008)(66946007)(6486002)(186003)(8676002)(38100700002)(5660300002)(54906003)(6916009)(36756003)(478600001)(44832011)(316002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?6UpbGqZ9w2sLL35n8Whvh4Qt3C2sE0VRJGEdDDV0ODzLd4AEm2z7AhJsQ4hN?= =?us-ascii?Q?C7+GjJyRHbunPJIgaJiS5QZzoZgCroGgW+LYZiipelp6q52g2hTC5TkXXHRq?= =?us-ascii?Q?xB6/ZpCs+6fxRMpus3mI/9BhKt0gcCpn73Ky81BAXxMJCQh+FZXh2Y2V+DT/?= =?us-ascii?Q?ZcrJ1t4Ac/apbNTUahitGiaSfZ7uIsXauuuvPy0HPOfYzw11ZozPCVVDo7Sm?= =?us-ascii?Q?qk+yC/Uhu3CpYSBx5J+3gGOEneYnf9qRf+FnfPnVz6EOMMWjj52BleEkDPaW?= =?us-ascii?Q?fQnV7FbYn8crXgWm/M1stv0clnbg8FC4rErn4hAJjZQVov9iZPfhiSBBhCy3?= =?us-ascii?Q?CcZf/uw/rSILHZBfDe0sOVESbMh+MuhCniLBGdw6GHbCYC1QZL7z+GFk3yke?= =?us-ascii?Q?7DlGzTE8NkG9IgCal40gQhGgl1MrOjuaHh3UBP2AnkIo5U+oLU07iphtpRVL?= =?us-ascii?Q?+DeLU3zdTu7yy0i4WJ9zeZzU4f3qxgxhmSYzKg+XQYqSCYQ7uXDA0XQ1MQYQ?= =?us-ascii?Q?phTMna6nsBgVOiK6t4Bucxm305ZjvWA7p20deDMnUi7UaXC2CPiSkVa6lvom?= =?us-ascii?Q?+dpBz+D1080tW/TBkmHJXXmqvdLKtFskLpoGRlueBDU/Zs4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DxA3hR386zrPLc71hO0r1zd5dmL9Idj/sgNvQTx7wYFz?= =?us-ascii?Q?WWsf/kQX+WBiwv5jMhSHqlG73xRzQj2kyGdSvkKQJxdj94hfOLU0RatSOffB?= =?us-ascii?Q?hw=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 89c3c8fe-3196-4364-f2cd-08da79ef9fee X-MS-Exchange-CrossTenant-AuthSource: MN0PR11MB6059.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2022 10:12:11.6084 (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: zRrpRxiJ2WU4ZJ/jmtZLWaFZFiyXYN6pN9uEj6UgZ2cOcuZTOzLum6jVkZ14/x7CxpptNGDUL35OHY2h6oOJNw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR11MB4052 X-OriginatorOrg: intel.com X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 13, 2022 at 09:12:26AM +0100, Mauro Carvalho Chehab wrote: > The intel_gt_pm.h file contains some convenient macros to be used > in GT code in order to get/put runtime PM references and for > checking them. > > Add descriptions based on the ones at intel_wakeref.h and > intel_runtime_pm.c. > > Signed-off-by: Mauro Carvalho Chehab > --- > > To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover. > See [PATCH v2 00/39] at: https://lore.kernel.org/all/cover.1657699522.git.mchehab@kernel.org/ > > Documentation/gpu/i915.rst | 2 + > drivers/gpu/drm/i915/gt/intel_gt_pm.h | 62 +++++++++++++++++++++++++++ > 2 files changed, 64 insertions(+) > > diff --git a/Documentation/gpu/i915.rst b/Documentation/gpu/i915.rst > index 6bb50edc6d79..9862d504df4d 100644 > --- a/Documentation/gpu/i915.rst > +++ b/Documentation/gpu/i915.rst > @@ -709,6 +709,8 @@ Table Manager (TTM) > > .. kernel-doc:: drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c > > +.. kernel-doc:: drivers/gpu/drm/i915/gt/intel_gt_pm.h I don't believe this is the right placement for this. the rest lgtm > + > Graphics Execution Manager (GEM) > -------------------------------- > > diff --git a/drivers/gpu/drm/i915/gt/intel_gt_pm.h b/drivers/gpu/drm/i915/gt/intel_gt_pm.h > index bc898df7a48c..a8ea6846980a 100644 > --- a/drivers/gpu/drm/i915/gt/intel_gt_pm.h > +++ b/drivers/gpu/drm/i915/gt/intel_gt_pm.h > @@ -11,21 +11,57 @@ > #include "intel_gt_types.h" > #include "intel_wakeref.h" > > +/** > + * intel_gt_pm_is_awake: Query whether the runtime PM is awake held > + * > + * @gt: pointer to the graphics engine > + * > + * Returns: true if a runtime pm reference is currently held and the GT is > + * awake. > + */ > static inline bool intel_gt_pm_is_awake(const struct intel_gt *gt) > { > return intel_wakeref_is_active(>->wakeref); > } > > +/** > + * intel_gt_pm_get: grab a runtime PM reference ensuring that GT is powered up > + * @gt: pointer to the graphics engine > + * > + * Any runtime pm reference obtained by this function must have a symmetric > + * call to intel_gt_pm_put() to release the reference again. > + * > + * Note that this is allowed to fail, in which case the runtime-pm wakeref > + * will be released and the acquisition unwound. > + */ > static inline void intel_gt_pm_get(struct intel_gt *gt) > { > intel_wakeref_get(>->wakeref); > } > > +/** > + * __intel_gt_pm_get: Acquire the runtime PM reference again > + * @gt: pointer to the graphics engine which contains the wakeref > + * > + * Increment the PM reference counter, only valid if it is already held by > + * the caller. > + * > + * See intel_gt_pm_get(). > + */ > static inline void __intel_gt_pm_get(struct intel_gt *gt) > { > __intel_wakeref_get(>->wakeref); > } > > +/** > + * intel_gt_pm_get_if_awake: Acquire the runtime PM reference if active > + * @gt: pointer to the graphics engine which contains the PM reference > + * > + * Acquire a hold on the PM reference, but only if the GT is already > + * active. > + * > + * Returns: true if the wakeref was acquired, false otherwise. > + */ > static inline bool intel_gt_pm_get_if_awake(struct intel_gt *gt) > { > return intel_wakeref_get_if_active(>->wakeref); > @@ -36,6 +72,14 @@ static inline void intel_gt_pm_might_get(struct intel_gt *gt) > intel_wakeref_might_get(>->wakeref); > } > > +/** > + * intel_gt_pm_put: Release the runtime PM reference > + * @gt: pointer to the graphics engine which contains the PM reference > + * > + * Release our hold on the runtime PM for GT. > + * > + * It might power down the GT right away if this is the last reference. > + */ > static inline void intel_gt_pm_put(struct intel_gt *gt) > { > intel_wakeref_put(>->wakeref); > @@ -51,10 +95,28 @@ static inline void intel_gt_pm_might_put(struct intel_gt *gt) > intel_wakeref_might_put(>->wakeref); > } > > +/** > + * with_intel_gt_pm - get a GT reference ensuring that GT is powered up, > + * run some code and then put the reference away. > + * > + * @gt: pointer to the gt > + * @tmp: pointer to a temporary wakeref. > + */ > #define with_intel_gt_pm(gt, tmp) \ > for (tmp = 1, intel_gt_pm_get(gt); tmp; \ > intel_gt_pm_put(gt), tmp = 0) > > +/** > + * intel_gt_pm_wait_for_idle: Wait until the runtime PM reference is idle > + * @gt: pointer to the graphics engine which contains the PM reference > + * > + * Wait for the earlier asynchronous release of the runtime PM reference. Note > + * this will wait for any third party as well, so make sure you only wait > + * when you have control over the GT runtime PM and trust no one else is > + * acquiring it. > + * > + * Return: 0 on success, error code if killed. > + */ > static inline int intel_gt_pm_wait_for_idle(struct intel_gt *gt) > { > return intel_wakeref_wait_for_idle(>->wakeref); > -- > 2.36.1 >