From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
To: rafael@kernel.org, rui.zhang@intel.com, daniel.lezcano@linaro.org
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Subject: [PATCH 6/7] thermal/drivers/int340x: Support workload hint interrupts
Date: Tue, 20 Jun 2023 16:01:49 -0700 [thread overview]
Message-ID: <20230620230150.3068704-7-srinivas.pandruvada@linux.intel.com> (raw)
In-Reply-To: <20230620230150.3068704-1-srinivas.pandruvada@linux.intel.com>
On thermal device interrupt, if the interrupt is generated for passing
workload hint, call the callback to pass notification to the user
space.
First call proc_thermal_check_wlt_intr() to check interrupt, if this
callback returns true, wake IRQ thread. Call
proc_thermal_wlt_intr_callback() to notify user space.
While here remove function pkg_thermal_schedule_work() and move the
processing to the caller. The function pkg_thermal_schedule_work() just
called schedule_delayed_work().
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
---
.../processor_thermal_device_pci.c | 33 ++++++++++++++-----
1 file changed, 24 insertions(+), 9 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 edddebedf42e..7fa5c3d459bd 100644
--- a/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c
+++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c
@@ -115,27 +115,40 @@ static void proc_thermal_threshold_work_fn(struct work_struct *work)
proc_thermal_mmio_write(pci_info, PROC_THERMAL_MMIO_INT_ENABLE_0, 1);
}
-static void pkg_thermal_schedule_work(struct delayed_work *work)
+static irqreturn_t proc_thermal_irq_thread_handler(int irq, void *devid)
{
- unsigned long ms = msecs_to_jiffies(notify_delay_ms);
+ struct proc_thermal_pci *pci_info = devid;
+
+ proc_thermal_wlt_intr_callback(pci_info->pdev, pci_info->proc_priv);
- schedule_delayed_work(work, ms);
+ return IRQ_HANDLED;
}
static irqreturn_t proc_thermal_irq_handler(int irq, void *devid)
{
struct proc_thermal_pci *pci_info = devid;
+ struct proc_thermal_device *proc_priv;
+ int ret = IRQ_HANDLED;
u32 status;
+ proc_priv = pci_info->proc_priv;
+
+ if (proc_priv->mmio_feature_mask & PROC_THERMAL_FEATURE_WLT_HINT) {
+ if (proc_thermal_check_wlt_intr(pci_info->proc_priv))
+ ret = IRQ_WAKE_THREAD;
+ }
+
proc_thermal_mmio_read(pci_info, PROC_THERMAL_MMIO_INT_STATUS_0, &status);
+ if (status) {
+ unsigned long ms = msecs_to_jiffies(notify_delay_ms);
- /* Disable enable interrupt flag */
- proc_thermal_mmio_write(pci_info, PROC_THERMAL_MMIO_INT_ENABLE_0, 0);
+ /* Disable enable interrupt flag */
+ proc_thermal_mmio_write(pci_info, PROC_THERMAL_MMIO_INT_ENABLE_0, 0);
+ schedule_delayed_work(&pci_info->work, ms);
+ }
pci_write_config_byte(pci_info->pdev, 0xdc, 0x01);
- pkg_thermal_schedule_work(&pci_info->work);
-
- return IRQ_HANDLED;
+ return ret;
}
static int sys_get_curr_temp(struct thermal_zone_device *tzd, int *temp)
@@ -269,7 +282,7 @@ static int proc_thermal_pci_probe(struct pci_dev *pdev, const struct pci_device_
}
ret = devm_request_threaded_irq(&pdev->dev, irq,
- proc_thermal_irq_handler, NULL,
+ proc_thermal_irq_handler, proc_thermal_irq_thread_handler,
irq_flag, KBUILD_MODNAME, pci_info);
if (ret) {
dev_err(&pdev->dev, "Request IRQ %d failed\n", pdev->irq);
@@ -383,6 +396,8 @@ static struct pci_driver proc_thermal_pci_driver = {
module_pci_driver(proc_thermal_pci_driver);
+MODULE_IMPORT_NS(INT340X_THERMAL);
+
MODULE_AUTHOR("Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>");
MODULE_DESCRIPTION("Processor Thermal Reporting Device Driver");
MODULE_LICENSE("GPL v2");
--
2.38.1
next prev parent reply other threads:[~2023-06-20 23:02 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
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 ` Srinivas Pandruvada [this message]
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=20230620230150.3068704-7-srinivas.pandruvada@linux.intel.com \
--to=srinivas.pandruvada@linux.intel.com \
--cc=daniel.lezcano@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=rui.zhang@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).