Skip to content

Commit 088f16f

Browse files
spandruvadarafaeljw
authored andcommitted
thermal: int340x: processor_thermal: Common function to clear SOC interrupt
The SOC interrupt status register contains multiple interrupt sources (workload hint interrupt and power floor interrupt). It is not possible to clear individual interrupt source with read-modify-write, as it may clear the new interrupt from the firmware after a read operation. It is also not possible to set the interrupt status bit to 1 for the other interrupt source, which is not part of clearing. Hence, create a common function, to clear all status bits at once. Call this function after processing all interrupt sources. Signed-off-by: Srinivas Pandruvada <[email protected]> [ rjw: Changelog edits ] Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 24e4c26 commit 088f16f

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

drivers/thermal/intel/int340x_thermal/processor_thermal_device.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ void proc_thermal_wt_req_remove(struct pci_dev *pdev);
9292
#define MBOX_DATA_BIT_VALID 31
9393

9494
#define SOC_WT_RES_INT_STATUS_OFFSET 0x5B18
95+
#define SOC_WT_RES_INT_STATUS_MASK GENMASK_ULL(3, 2)
9596

9697
int processor_thermal_send_mbox_read_cmd(struct pci_dev *pdev, u16 id, u64 *resp);
9798
int processor_thermal_send_mbox_write_cmd(struct pci_dev *pdev, u16 id, u32 data);

drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,24 @@ static void pkg_thermal_schedule_work(struct delayed_work *work)
122122
schedule_delayed_work(work, ms);
123123
}
124124

125+
static void proc_thermal_clear_soc_int_status(struct proc_thermal_device *proc_priv)
126+
{
127+
u64 status;
128+
129+
if (!(proc_priv->mmio_feature_mask & PROC_THERMAL_FEATURE_WT_HINT))
130+
return;
131+
132+
status = readq(proc_priv->mmio_base + SOC_WT_RES_INT_STATUS_OFFSET);
133+
writeq(status & ~SOC_WT_RES_INT_STATUS_MASK,
134+
proc_priv->mmio_base + SOC_WT_RES_INT_STATUS_OFFSET);
135+
}
136+
125137
static irqreturn_t proc_thermal_irq_thread_handler(int irq, void *devid)
126138
{
127139
struct proc_thermal_pci *pci_info = devid;
128140

129141
proc_thermal_wt_intr_callback(pci_info->pdev, pci_info->proc_priv);
142+
proc_thermal_clear_soc_int_status(pci_info->proc_priv);
130143

131144
return IRQ_HANDLED;
132145
}

drivers/thermal/intel/int340x_thermal/processor_thermal_wt_hint.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,6 @@ void proc_thermal_wt_intr_callback(struct pci_dev *pdev, struct proc_thermal_dev
215215
if (!(status & SOC_WT_PREDICTION_INT_ACTIVE))
216216
return;
217217

218-
writeq(status & ~SOC_WT_PREDICTION_INT_ACTIVE,
219-
proc_priv->mmio_base + SOC_WT_RES_INT_STATUS_OFFSET);
220218
sysfs_notify(&pdev->dev.kobj, "workload_hint", "workload_type_index");
221219
}
222220
EXPORT_SYMBOL_NS_GPL(proc_thermal_wt_intr_callback, INT340X_THERMAL);

0 commit comments

Comments
 (0)