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 6227CECAAD5 for ; Mon, 12 Sep 2022 16:37:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 35FC510E597; Mon, 12 Sep 2022 16:37:56 +0000 (UTC) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTPS id AECCC10E597 for ; Mon, 12 Sep 2022 16:37:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663000673; x=1694536673; h=date:message-id:from:to:cc:subject:in-reply-to: references:mime-version; bh=0xat5XKTdseobaBb2a7q6MpkDPdQmY3erl4XQgtJht0=; b=PXSNt8I3WPdxqdVRat+InQUru1KzBpU1hO0ozinlf6HLzs4QdeavmyGc 2MUwIJ6Wyv7Mq7Bgk3JyGvTcS1lDgsfJ+rEWT2u08Y7xK6ATw6su3FiSK iWa+eO5IbpEEclfTN27VNNeMU7t8KYWf9RXWha3lZcPvrlfedGaSl8rYE 4OClCI/xKxrDXNF4t4CvjWr9A0kdfwBFNduVbcK1ChtsFECREWXkvQgBO QLyvqaRVz23FgGSpbh1ZIhsRlv73SibNR4/NUw290tGZbYmgqVtWkOwOu ev6XeXGFy95fSYtN3ezIvVSr8luI2hwiCE0XC6rSiHjksKWcSFISG+3Co Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10468"; a="324148844" X-IronPort-AV: E=Sophos;i="5.93,310,1654585200"; d="scan'208";a="324148844" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Sep 2022 09:37:53 -0700 X-IronPort-AV: E=Sophos;i="5.93,310,1654585200"; d="scan'208";a="616114031" Received: from adixit-mobl.amr.corp.intel.com (HELO adixit-arch.intel.com) ([10.209.54.92]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Sep 2022 09:37:52 -0700 Date: Mon, 12 Sep 2022 09:37:52 -0700 Message-ID: <87edwg5z1b.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" To: "Gupta, Anshuman" In-Reply-To: References: <20220825132118.784407-1-badal.nilawar@intel.com> <20220825132118.784407-3-badal.nilawar@intel.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/28.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Subject: Re: [Intel-gfx] [PATCH 2/7] drm/i915/hwmon: Add HWMON current voltage support X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "linux-hwmon@vger.kernel.org" , "intel-gfx@lists.freedesktop.org" Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On Mon, 12 Sep 2022 07:09:28 -0700, Gupta, Anshuman wrote: > > > +static int > > +hwm_in_read(struct hwm_drvdata *ddat, u32 attr, long *val) { > > + struct i915_hwmon *hwmon = ddat->hwmon; > > + intel_wakeref_t wakeref; > > + u32 reg_value; > > + > > + switch (attr) { > > + case hwmon_in_input: > > Other attributes in this series take hwmon->lock before accessing i915 > registers , So do we need lock here as well ? The lock is being taken only for RMW and for making sure energy counter updates happen atomically. We are not taking the lock for just reads so IMO no lock is needed here. > > + with_intel_runtime_pm(ddat->uncore->rpm, wakeref) > > + reg_value = intel_uncore_read(ddat->uncore, hwmon- > > >rg.gt_perf_status); > > + /* In units of 2.5 millivolt */ > > + *val = > > DIV_ROUND_CLOSEST(REG_FIELD_GET(GEN12_VOLTAGE_MASK, reg_value) * > > 25, 10); > > + return 0; > > + default: > > + return -EOPNOTSUPP; > > + } > > +} Thanks. -- Ashutosh