Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp6015143rwp; Mon, 17 Jul 2023 13:19:58 -0700 (PDT) X-Google-Smtp-Source: APBJJlEx8A9Ju0NMSP8bP37/cvH8WBWW0CD1iimmYnJMmJHblhUEj+xS+/wAliQBJFJOkj1VjNyT X-Received: by 2002:a17:906:779b:b0:997:beca:f9db with SMTP id s27-20020a170906779b00b00997becaf9dbmr4265339ejm.54.1689625198091; Mon, 17 Jul 2023 13:19:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689625198; cv=none; d=google.com; s=arc-20160816; b=IGPmniQW5yQeCNf6Qou6KxE9ctKm06ipCHgqMtrWq73CVcGkOV8GVJjNuKj1gFQmYK yYjXHjyVgDQlmSUHBwoNyBcY2jWnO1ER/23Ipl0atsibCVeRG4KCL9xRz6qpCuMMqEOJ QQyQGkAG6b/TDQLM0MS3nDUOB087Ey4ObDUzPDadc+sST5Mo4oDVJ99wAUTnCE85jFXP qIXkLEuuZs8e7DFrS2emFzBWsLwkahWwzbV/hSQSuBY8+bfpImsVS9ORK6fH9jxmemnO UmFPJxE2nIxutSY9wnbuoi44Xj85FDDGaF+6NryKjeGlvqGYhUwtSaog9Z1+HXvv2P0e +hOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=lrzZQnotf1VrBKrxx/1KSbw2D6XaslL2+kZIaAWSNMU=; fh=R4ZvNZWGg6IlKgk5n1zDvyneOEgr4zAUEpOHZQoDJ/M=; b=KXFw1jOeOnv6khJ0vmN5+nAa3vWhNfcrafc2Sylp53TC2PqRtELt/2veN8baneJ3KD qnM7elVtCH7Sn+zOdTiO6Jbnh7CLCLcUeG+H3ITGL8UleBeWnKus9WIR3jKvJ4OpXtIz rVb/bAFETh0Ee8A6BvUluFann1sz7cC6tCJR21cB7aIrzf6fCG43aFhIOPeAwfvoiuuW 3x9IQAEO8Ra4Qfys5d16b27vn7Bk2nlzLwp5AhhBjPyWWTIAWF6NqK26dFn5bSECoTyy TWFMH/2aYQvOzcYw29lM5PgALKVzigL8z9GgRh3+DotIez1yQWGKbpTtW8M+Wq1H4+Dc edRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="nO/xRwfU"; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z10-20020a1709063aca00b00991f5659833si125437ejd.152.2023.07.17.13.19.33; Mon, 17 Jul 2023 13:19:58 -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="nO/xRwfU"; 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 S231268AbjGQTy6 (ORCPT + 99 others); Mon, 17 Jul 2023 15:54:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230260AbjGQTyy (ORCPT ); Mon, 17 Jul 2023 15:54:54 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A63981B1; Mon, 17 Jul 2023 12:54:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689623693; x=1721159693; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lTo3Yud6uChlFvaxyEtnYv/+Do5A9H0JVT6jB8D4gS8=; b=nO/xRwfUfPbcGt83BIXUM4r+7jXuma8kTmvIGyPG+6x425zpBYfd6SbV 2rTcdkwi4466EkoLNvnyVxEvw/K1Xmv+nbCkKMpeXD5o7Kt7usxGbYEP9 7ezsLiJP66KmgLqZahOgCHLtQIjUOW4FO+rH/nt0r2aEUyvTV12no2mO4 Qiyu615Uaz22Tb824FAtyS36XWVwx63XR/6lAn6U6H91yrebb59BeGS55 nWhoVnbLFjKnXbFG0dNBAAY94vcdoS/IL5wAMSLn0htjDiVpyXzEKzjKX hdin0ZOyw4LCZD3QxSHx963IpK7rKK1zfsEtIYVkyR3y/wk68EXM5ZguM A==; X-IronPort-AV: E=McAfee;i="6600,9927,10774"; a="366064602" X-IronPort-AV: E=Sophos;i="6.01,211,1684825200"; d="scan'208";a="366064602" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jul 2023 12:54:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10774"; a="788770748" X-IronPort-AV: E=Sophos;i="6.01,211,1684825200"; d="scan'208";a="788770748" Received: from spandruv-desk.jf.intel.com ([10.54.75.8]) by fmsmga008.fm.intel.com with ESMTP; 17 Jul 2023 12:54:51 -0700 From: Srinivas Pandruvada To: daniel.lezcano@linaro.org, rafael@kernel.org, rui.zhang@intel.com Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Srinivas Pandruvada Subject: [PATCH v2 3/7] thermal: int340x: processor_thermal: Use non MSI interrupts Date: Mon, 17 Jul 2023 12:54:01 -0700 Message-Id: <20230717195405.730869-4-srinivas.pandruvada@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230717195405.730869-1-srinivas.pandruvada@linux.intel.com> References: <20230717195405.730869-1-srinivas.pandruvada@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, 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 There are issues in using MSI interrupts for processor thermal device. The support is not consistent across generations. But the legacy PCI interrupts work on all current generations. Hence always use legacy PCI interrupts by default, instead of MSI. Add a module param to use of MSI, so that MSI can be still used. Signed-off-by: Srinivas Pandruvada --- v2: Changed msi_enabled to type bool .../processor_thermal_device_pci.c | 33 ++++++++++++------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c b/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c index 5a2bcfff0a68..2be9b7f660d1 100644 --- a/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c +++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c @@ -15,6 +15,11 @@ #define DRV_NAME "proc_thermal_pci" +static bool msi_enabled; +module_param(msi_enabled, bool, 0644); +MODULE_PARM_DESC(msi_enabled, + "Use PCI MSI based interrupts for processor thermal device."); + struct proc_thermal_pci { struct pci_dev *pdev; struct proc_thermal_device *proc_priv; @@ -219,8 +224,6 @@ static int proc_thermal_pci_probe(struct pci_dev *pdev, const struct pci_device_ return ret; } - pci_set_master(pdev); - INIT_DELAYED_WORK(&pci_info->work, proc_thermal_threshold_work_fn); ret = proc_thermal_add(&pdev->dev, proc_priv); @@ -248,16 +251,23 @@ static int proc_thermal_pci_probe(struct pci_dev *pdev, const struct pci_device_ goto err_ret_mmio; } - /* request and enable interrupt */ - ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_ALL_TYPES); - if (ret < 0) { - dev_err(&pdev->dev, "Failed to allocate vectors!\n"); - goto err_ret_tzone; - } - if (!pdev->msi_enabled && !pdev->msix_enabled) + if (msi_enabled) { + pci_set_master(pdev); + /* request and enable interrupt */ + ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_ALL_TYPES); + if (ret < 0) { + dev_err(&pdev->dev, "Failed to allocate vectors!\n"); + goto err_ret_tzone; + } + if (!pdev->msi_enabled && !pdev->msix_enabled) + irq_flag = IRQF_SHARED; + + irq = pci_irq_vector(pdev, 0); + } else { irq_flag = IRQF_SHARED; + irq = pdev->irq; + } - irq = pci_irq_vector(pdev, 0); ret = devm_request_threaded_irq(&pdev->dev, irq, proc_thermal_irq_handler, NULL, irq_flag, KBUILD_MODNAME, pci_info); @@ -273,7 +283,8 @@ static int proc_thermal_pci_probe(struct pci_dev *pdev, const struct pci_device_ return 0; err_free_vectors: - pci_free_irq_vectors(pdev); + if (msi_enabled) + pci_free_irq_vectors(pdev); err_ret_tzone: thermal_zone_device_unregister(pci_info->tzone); err_ret_mmio: -- 2.38.1