From patchwork Tue Oct 3 16:32:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: srinivas pandruvada X-Patchwork-Id: 13407781 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73606E7AD78 for ; Tue, 3 Oct 2023 16:32:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240436AbjJCQcl (ORCPT ); Tue, 3 Oct 2023 12:32:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240421AbjJCQcl (ORCPT ); Tue, 3 Oct 2023 12:32:41 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B11699E; Tue, 3 Oct 2023 09:32:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696350758; x=1727886758; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=J8G0SXT1YoMI6eryPCFeRwYtEfFd6ZmcJRUCAjCwNUs=; b=VpHWl0qPncQPnZ37z0nrG+m8CAeqAak4Tm/mrMv9F51Z3rbZG9z8wKgU lGebvCPBg7XHTlcUYRzOdf/1OZJ9AxCMzAWHSBYWRvNtrTMy1UcKcQzPb 3hESsan7+T4N6/QAMlwRZ110gB8WnEuUHg0TLxpfQyhyoHQ/1aRJhhcY1 amSZ5NcVSj0vxFOZrQoOyOEoNTWBKaiDSIx8ALd85WXvVW7MogcxFyrkw 3ueVghvJQ10/jvxiIVEZZEZC9yaF8ZCCet9tjFqnb5gE0XCtlsiAgmNk7 6gd+KJVHRA3e63+4RQNc4DDJfECFYrjJYcWc7Pbl24To7z5Jxz/sJPZy8 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10852"; a="381799119" X-IronPort-AV: E=Sophos;i="6.03,197,1694761200"; d="scan'208";a="381799119" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2023 09:32:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10852"; a="1082069889" X-IronPort-AV: E=Sophos;i="6.03,197,1694761200"; d="scan'208";a="1082069889" Received: from spandruv-desk.jf.intel.com ([10.54.75.14]) by fmsmga005.fm.intel.com with ESMTP; 03 Oct 2023 09:32:37 -0700 From: Srinivas Pandruvada To: hdegoede@redhat.com, markgross@kernel.org, ilpo.jarvinen@linux.intel.com, andriy.shevchenko@linux.intel.com Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Srinivas Pandruvada Subject: [PATCH v2 1/4] platform/x86: ISST: Use fuse enabled mask instead of allowed levels Date: Tue, 3 Oct 2023 09:32:31 -0700 Message-Id: <20231003163234.1856669-2-srinivas.pandruvada@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231003163234.1856669-1-srinivas.pandruvada@linux.intel.com> References: <20231003163234.1856669-1-srinivas.pandruvada@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org Allowed level mask is a mask of levels, which are currently allowed to dynamically switch by the OS. Fused mask is a mask of all levels even if OS is not allowed to switch. Even if OS is not allowed to dynamically switch, it is still possible for user to boot to a level by using BIOS option. To decide which level to boot next time, user wants to check parameters (power, performance or thermal) of that level to decide. So, when passing the level mask for display to user space, use fuse enabled mask, which has all levels. Signed-off-by: Srinivas Pandruvada --- v2: - Updated the commit description drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c b/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c index 63faa2ea8327..a672a1c814af 100644 --- a/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c +++ b/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c @@ -704,7 +704,7 @@ static int isst_if_get_perf_level(void __user *argp) return -EINVAL; perf_level.max_level = power_domain_info->max_level; - perf_level.level_mask = power_domain_info->pp_header.allowed_level_mask; + perf_level.level_mask = power_domain_info->pp_header.level_en_mask; perf_level.feature_rev = power_domain_info->pp_header.feature_rev; _read_pp_info("current_level", perf_level.current_level, SST_PP_STATUS_OFFSET, SST_PP_LEVEL_START, SST_PP_LEVEL_WIDTH, SST_MUL_FACTOR_NONE) From patchwork Tue Oct 3 16:32:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: srinivas pandruvada X-Patchwork-Id: 13407782 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40FF1E7AD76 for ; Tue, 3 Oct 2023 16:32:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240570AbjJCQcm (ORCPT ); Tue, 3 Oct 2023 12:32:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239961AbjJCQcl (ORCPT ); Tue, 3 Oct 2023 12:32:41 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECB2EAC; Tue, 3 Oct 2023 09:32:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696350758; x=1727886758; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=bpCe5F6Deb5HmkgRu6OwyVxAqzVowHxGy4Bqa5oyCR8=; b=SjLNEMTiu/6ZiLv4TW/XyNdUgdBX9RQYzOWBCnDqJp8AWto2Gspp1qeM Z87Jxz9p3D+wcD2RQSzBCn9BUXPfHu7kwaRQl1g77Te6GjPQkpwnyza+j leVIDT6gFwD/BzGrLftI1r/rMznFaarjcm1cLQFDXj2Tm5tOiLV+yNCG0 eD9uosiEU8tUx7JuJ/w2XS3vn7+iS27jMazVzUCPKUYXWBW29dxYGYsCt qEfyd0AYdFd7BrCjA2uK/NVLUvXNyIJC6qKnu45AsAsLEpt7cwiGyoihN 0+aFlFbwjTwIUOi6XCzrtWax7fahOxTvV3Dx7ULUbQYkAoKvageLwXPCw Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10852"; a="381799122" X-IronPort-AV: E=Sophos;i="6.03,197,1694761200"; d="scan'208";a="381799122" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2023 09:32:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10852"; a="1082069901" X-IronPort-AV: E=Sophos;i="6.03,197,1694761200"; d="scan'208";a="1082069901" Received: from spandruv-desk.jf.intel.com ([10.54.75.14]) by fmsmga005.fm.intel.com with ESMTP; 03 Oct 2023 09:32:37 -0700 From: Srinivas Pandruvada To: hdegoede@redhat.com, markgross@kernel.org, ilpo.jarvinen@linux.intel.com, andriy.shevchenko@linux.intel.com Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Srinivas Pandruvada Subject: [PATCH v2 2/4] platform/x86: ISST: Allow level 0 to be not present Date: Tue, 3 Oct 2023 09:32:32 -0700 Message-Id: <20231003163234.1856669-3-srinivas.pandruvada@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231003163234.1856669-1-srinivas.pandruvada@linux.intel.com> References: <20231003163234.1856669-1-srinivas.pandruvada@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org It is possible that SST level 0 or base level is not present in some configurations. So don't set level 0 mask in level_en_mask by default. Signed-off-by: Srinivas Pandruvada Reviewed-by: Ilpo Järvinen --- v2: No change, just added Reviewed by drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c b/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c index a672a1c814af..ac5c6a812592 100644 --- a/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c +++ b/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c @@ -364,9 +364,6 @@ static int sst_main(struct auxiliary_device *auxdev, struct tpmi_per_power_domai /* Read PP header */ *((u64 *)&pd_info->pp_header) = readq(pd_info->sst_base + pd_info->sst_header.pp_offset); - /* Force level_en_mask level 0 */ - pd_info->pp_header.level_en_mask |= 0x01; - mask = 0x01; levels = 0; for (i = 0; i < 8; ++i) { From patchwork Tue Oct 3 16:32:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: srinivas pandruvada X-Patchwork-Id: 13407783 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 116E3E7AD7A for ; Tue, 3 Oct 2023 16:32:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240580AbjJCQcm (ORCPT ); Tue, 3 Oct 2023 12:32:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240568AbjJCQcm (ORCPT ); Tue, 3 Oct 2023 12:32:42 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43D36BD; Tue, 3 Oct 2023 09:32:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696350759; x=1727886759; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dIOmsETpjPNDSE37tvKoqMLlpEG4W2dQUly3WREZunk=; b=BgzaHYPd86VG2Y0nZIBS+n9PGx16Dy/EidhSam/aiX9XTQtBa2mcJPWl /WlH/pZJ1JVKnqlu1j5ACZMnxWOcj2XrMc9QVgfUdR9zePS3wpFrPvGKd 41LfMpsfJw7V/WYiLeAYG04b/4c0zkqWsmzLy7kuLBAk332gHHP5TwxVj Tlt5VWN9aqiMiK1bieVkHYPF6HKHWaCVvZfL73aVePC8KAu5PlRxfnPIh SLmxwRaD8w7lahOvkAycC/oI/U3ZV71nesPzz9VnA9Nkk3GCPtFrYjxf0 hdys+6IJNkpyD1bcbdxIymDHty/+TkoImWcnO1Z45Eo+oHjo94K8MHCZo w==; X-IronPort-AV: E=McAfee;i="6600,9927,10852"; a="381799126" X-IronPort-AV: E=Sophos;i="6.03,197,1694761200"; d="scan'208";a="381799126" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2023 09:32:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10852"; a="1082069913" X-IronPort-AV: E=Sophos;i="6.03,197,1694761200"; d="scan'208";a="1082069913" Received: from spandruv-desk.jf.intel.com ([10.54.75.14]) by fmsmga005.fm.intel.com with ESMTP; 03 Oct 2023 09:32:37 -0700 From: Srinivas Pandruvada To: hdegoede@redhat.com, markgross@kernel.org, ilpo.jarvinen@linux.intel.com, andriy.shevchenko@linux.intel.com Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Srinivas Pandruvada Subject: [PATCH v2 3/4] platform/x86: intel_speed_select_if: Remove hardcoded map size Date: Tue, 3 Oct 2023 09:32:33 -0700 Message-Id: <20231003163234.1856669-4-srinivas.pandruvada@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231003163234.1856669-1-srinivas.pandruvada@linux.intel.com> References: <20231003163234.1856669-1-srinivas.pandruvada@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org The driver is using 256 as the size while calling devm_ioremap(). The maximum offset can be obtained from isst_mmio_range. Add a field "size" to the isst_mmio_range and use it instead of hardcoding. No functional impact is expected. Signed-off-by: Srinivas Pandruvada Reviewed-by: Andy Shevchenko Reviewed-by: Ilpo Järvinen --- v2 No change except additional Reviewed-by .../x86/intel/speed_select_if/isst_if_mmio.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c b/drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c index ff49025ec085..13e068c77d50 100644 --- a/drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c +++ b/drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c @@ -18,16 +18,17 @@ struct isst_mmio_range { int beg; int end; + int size; }; static struct isst_mmio_range mmio_range_devid_0[] = { - {0x04, 0x14}, - {0x20, 0xD0}, + {0x04, 0x14, 0x18}, + {0x20, 0xD0, 0xD4}, }; static struct isst_mmio_range mmio_range_devid_1[] = { - {0x04, 0x14}, - {0x20, 0x11C}, + {0x04, 0x14, 0x18}, + {0x20, 0x11C, 0x120}, }; struct isst_if_device { @@ -114,13 +115,16 @@ static int isst_if_probe(struct pci_dev *pdev, const struct pci_device_id *ent) pcu_base &= GENMASK(10, 0); base_addr = (u64)mmio_base << 23 | (u64) pcu_base << 12; - punit_dev->punit_mmio = devm_ioremap(&pdev->dev, base_addr, 256); + + punit_dev->mmio_range = (struct isst_mmio_range *) ent->driver_data; + + punit_dev->punit_mmio = devm_ioremap(&pdev->dev, base_addr, + punit_dev->mmio_range[1].size); if (!punit_dev->punit_mmio) return -ENOMEM; mutex_init(&punit_dev->mutex); pci_set_drvdata(pdev, punit_dev); - punit_dev->mmio_range = (struct isst_mmio_range *) ent->driver_data; memset(&cb, 0, sizeof(cb)); cb.cmd_size = sizeof(struct isst_if_io_reg); From patchwork Tue Oct 3 16:32:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: srinivas pandruvada X-Patchwork-Id: 13407784 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6551DE7AD7C for ; Tue, 3 Oct 2023 16:32:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231592AbjJCQcn (ORCPT ); Tue, 3 Oct 2023 12:32:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240572AbjJCQcm (ORCPT ); Tue, 3 Oct 2023 12:32:42 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5D24C6; Tue, 3 Oct 2023 09:32:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696350759; x=1727886759; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=naeM4Hr3CRD+DTUV5/XFL2W5c7Jq+1AMKWCZV/jYYy8=; b=aVbvvf6N/U1jlCgIuWZFIls13psdXA2G6Mxs5MARakSRGnvLdA9jUqDN Vp6/pAxRA6faBlwXkUe4fHSxr0Mnh7IcAndln+NMFZHW/MpAZ2IS+DhSx ACxeVlUjRh75zDvK/AA+DRGHjvqW0X1N1fBxLNKwxE4zpJdFttWQfpktZ 0BlESStDbI5HHUJOAt4nrs1RgIuc3OpCBEoB3PyddXBiVJLnOBgj0Z8tI 6iBt8U2XE1Txcse7D2CcLQjgmrN6TdN/Kz3z08lr+XHXAF8BeUw72eDYD UexDHrqD+sUdp8q8zlbQ7stK7uj0J5FJnfFWcc1jk1HCYmp3j8pFrB9eE g==; X-IronPort-AV: E=McAfee;i="6600,9927,10852"; a="381799131" X-IronPort-AV: E=Sophos;i="6.03,197,1694761200"; d="scan'208";a="381799131" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2023 09:32:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10852"; a="1082069924" X-IronPort-AV: E=Sophos;i="6.03,197,1694761200"; d="scan'208";a="1082069924" Received: from spandruv-desk.jf.intel.com ([10.54.75.14]) by fmsmga005.fm.intel.com with ESMTP; 03 Oct 2023 09:32:38 -0700 From: Srinivas Pandruvada To: hdegoede@redhat.com, markgross@kernel.org, ilpo.jarvinen@linux.intel.com, andriy.shevchenko@linux.intel.com Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Srinivas Pandruvada Subject: [PATCH v2 4/4] platform/x86: intel_speed_select_if: Use devm_ioremap_resource Date: Tue, 3 Oct 2023 09:32:34 -0700 Message-Id: <20231003163234.1856669-5-srinivas.pandruvada@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231003163234.1856669-1-srinivas.pandruvada@linux.intel.com> References: <20231003163234.1856669-1-srinivas.pandruvada@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org Replace devm_ioremap() with devm_ioremap_resource() by defining a resource. Signed-off-by: Srinivas Pandruvada Suggested-by: Andy Shevchenko Reviewed-by: Andy Shevchenko --- v2 New patch in the series. Moved from indepedent patch to the SST series. Updated commit log and added Reviewed-by. .../platform/x86/intel/speed_select_if/isst_if_mmio.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c b/drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c index 13e068c77d50..3f4343147dad 100644 --- a/drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c +++ b/drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c @@ -94,6 +94,7 @@ static int isst_if_probe(struct pci_dev *pdev, const struct pci_device_id *ent) struct isst_if_device *punit_dev; struct isst_if_cmd_cb cb; u32 mmio_base, pcu_base; + struct resource r; u64 base_addr; int ret; @@ -118,10 +119,10 @@ static int isst_if_probe(struct pci_dev *pdev, const struct pci_device_id *ent) punit_dev->mmio_range = (struct isst_mmio_range *) ent->driver_data; - punit_dev->punit_mmio = devm_ioremap(&pdev->dev, base_addr, - punit_dev->mmio_range[1].size); - if (!punit_dev->punit_mmio) - return -ENOMEM; + r = DEFINE_RES_MEM(base_addr, punit_dev->mmio_range[1].size); + punit_dev->punit_mmio = devm_ioremap_resource(&pdev->dev, &r); + if (IS_ERR(punit_dev->punit_mmio)) + return PTR_ERR(punit_dev->punit_mmio); mutex_init(&punit_dev->mutex); pci_set_drvdata(pdev, punit_dev);