From: "Zhang, Rui" <rui.zhang@intel.com>
To: "srinivas.pandruvada@linux.intel.com"
<srinivas.pandruvada@linux.intel.com>,
"rafael@kernel.org" <rafael@kernel.org>,
"daniel.lezcano@linaro.org" <daniel.lezcano@linaro.org>
Cc: "linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 3/7] thermal: int340x: processor_thermal: Use non MSI interrupts
Date: Wed, 21 Jun 2023 14:53:47 +0000 [thread overview]
Message-ID: <b692f9a983d45a50aeae43dce3082551059f6bfe.camel@intel.com> (raw)
In-Reply-To: <20230620230150.3068704-4-srinivas.pandruvada@linux.intel.com>
On Tue, 2023-06-20 at 16:01 -0700, Srinivas Pandruvada wrote:
> There are issues in using MSI interrupts for processor thermal
> device.
> The support is not consistent, across generations. Even in the same
> generation, there are issue in getting interrupts via MSI.
>
> 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
> <srinivas.pandruvada@linux.intel.com>
> ---
> .../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..057778f7bece 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 int msi_enabled;
> +module_param(msi_enabled, int, 0644);
why not use
static bool msi_enabled;
module_params(msi_enabled, bool, 0644);
thanks,
rui
> +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:
next prev parent reply other threads:[~2023-06-21 15:01 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-20 23:01 [PATCH 0/7] thermal: processor_thermal: Suport workload hint Srinivas Pandruvada
2023-06-20 23:01 ` [PATCH 1/7] thermal: int340x: processor_thermal: Move mailbox code to common module Srinivas Pandruvada
2023-06-21 14:35 ` Zhang, Rui
2023-06-20 23:01 ` [PATCH 2/7] thermal: int340x: processor_thermal: Add interrupt configuration Srinivas Pandruvada
2023-06-21 14:50 ` Zhang, Rui
2023-06-21 15:02 ` srinivas pandruvada
2023-06-20 23:01 ` [PATCH 3/7] thermal: int340x: processor_thermal: Use non MSI interrupts Srinivas Pandruvada
2023-06-21 14:53 ` Zhang, Rui [this message]
2023-06-21 15:02 ` srinivas pandruvada
2023-06-20 23:01 ` [PATCH 4/7] thermal/drivers/int340x: Remove PROC_THERMAL_FEATURE_WLT_REQ for Meteor Lake Srinivas Pandruvada
2023-06-21 14:54 ` Zhang, Rui
2023-06-20 23:01 ` [PATCH 5/7] thermal: int340x: processor_thermal: Add workload type hint Srinivas Pandruvada
2023-06-21 14:12 ` Zhang, Rui
2023-06-20 23:01 ` [PATCH 6/7] thermal/drivers/int340x: Support workload hint interrupts Srinivas Pandruvada
2023-06-20 23:01 ` [PATCH 7/7] selftests/thermel/intel: Add test to read workload hint Srinivas Pandruvada
2023-06-21 14:30 ` Zhang, Rui
2023-06-21 14:40 ` srinivas pandruvada
2023-06-21 14:58 ` Zhang, Rui
2023-06-21 14:58 ` [PATCH 0/7] thermal: processor_thermal: Suport " Rafael J. Wysocki
2023-06-21 15:45 ` srinivas pandruvada
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b692f9a983d45a50aeae43dce3082551059f6bfe.camel@intel.com \
--to=rui.zhang@intel.com \
--cc=daniel.lezcano@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=srinivas.pandruvada@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).