Skip to content

Commit b8babac

Browse files
fancerjonmason
authored andcommitted
ntb: idt: Discard temperature sensor IRQ handler
IDT PCIe-switch temperature sensor interface is very broken. First of all only a few combinations of TMPCTL threshold enable bits really cause the interrupts unmasked. Even if an individual bit indicates the event unmasked, corresponding IRQ just isn't generated. Most of the threshold enable bits combinations are in fact useless and non of them can help to create a fully functional alarm interface. So to speak, we can't create a well defined hwmon alarms based on the IDT PCI-switch threshold IRQs. Secondly a single threshold IRQ (not a combination of thresholds) can be successfully enabled without the issue described above. But in this case we experienced an enormous number of interrupts generated by the chip if the temperature got near the enabled threshold value. Filter adjustment didn't help much. It also doesn't provide a hysteresis settings. Due to the temperature sample fluctuations near the threshold the interrupts spate makes the system nearly unusable until the temperature value finally settled so being pushed either to be fully higher or lower the threshold. All of these issues makes the temperature sensor alarm interface useless and even at some point dangerous to be used in the driver. In this case it is safer to completely discard it and disable the temperature alarm interrupts. Signed-off-by: Serge Semin <fancer.lancer@gmail.com> Signed-off-by: Jon Mason <jdmason@kudzu.us>
1 parent aed1b7b commit b8babac

File tree

2 files changed

+3
-43
lines changed

2 files changed

+3
-43
lines changed

drivers/ntb/hw/idt/ntb_hw_idt.c

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2074,38 +2074,6 @@ static struct attribute *idt_temp_attrs[] = {
20742074
};
20752075
ATTRIBUTE_GROUPS(idt_temp);
20762076

2077-
/*
2078-
* idt_temp_isr() - temperature sensor alarm events ISR
2079-
* @ndev: IDT NTB hardware driver descriptor
2080-
* @ntint_sts: NT-function interrupt status
2081-
*
2082-
* It handles events of temperature crossing alarm thresholds. Since reading
2083-
* of TMPALARM register clears it up, the function doesn't analyze the
2084-
* read value, instead the current temperature value just warningly printed to
2085-
* log.
2086-
* The method is called from PCIe ISR bottom-half routine.
2087-
*/
2088-
static void idt_temp_isr(struct idt_ntb_dev *ndev, u32 ntint_sts)
2089-
{
2090-
unsigned long mdeg;
2091-
2092-
/* Read the current temperature value */
2093-
idt_read_temp(ndev, IDT_TEMP_CUR, &mdeg);
2094-
2095-
/* Read the temperature alarm to clean the alarm status out */
2096-
/*(void)idt_sw_read(ndev, IDT_SW_TMPALARM);*/
2097-
2098-
/* Clean the corresponding interrupt bit */
2099-
idt_nt_write(ndev, IDT_NT_NTINTSTS, IDT_NTINTSTS_TMPSENSOR);
2100-
2101-
dev_dbg(&ndev->ntb.pdev->dev,
2102-
"Temp sensor IRQ detected %#08x", ntint_sts);
2103-
2104-
/* Print temperature value to log */
2105-
dev_warn(&ndev->ntb.pdev->dev, "Temperature %hhd.%hhuC",
2106-
idt_get_deg(mdeg), idt_get_deg_frac(mdeg));
2107-
}
2108-
21092077
/*
21102078
* idt_init_temp() - initialize temperature sensor interface
21112079
* @ndev: IDT NTB hardware driver descriptor
@@ -2188,7 +2156,7 @@ static int idt_init_isr(struct idt_ntb_dev *ndev)
21882156
goto err_free_vectors;
21892157
}
21902158

2191-
/* Unmask Message/Doorbell/SE/Temperature interrupts */
2159+
/* Unmask Message/Doorbell/SE interrupts */
21922160
ntint_mask = idt_nt_read(ndev, IDT_NT_NTINTMSK) & ~IDT_NTINTMSK_ALL;
21932161
idt_nt_write(ndev, IDT_NT_NTINTMSK, ntint_mask);
21942162

@@ -2203,7 +2171,6 @@ static int idt_init_isr(struct idt_ntb_dev *ndev)
22032171
return ret;
22042172
}
22052173

2206-
22072174
/*
22082175
* idt_deinit_ist() - deinitialize PCIe interrupt handler
22092176
* @ndev: IDT NTB hardware driver descriptor
@@ -2264,12 +2231,6 @@ static irqreturn_t idt_thread_isr(int irq, void *devid)
22642231
handled = true;
22652232
}
22662233

2267-
/* Handle temperature sensor interrupt */
2268-
if (ntint_sts & IDT_NTINTSTS_TMPSENSOR) {
2269-
idt_temp_isr(ndev, ntint_sts);
2270-
handled = true;
2271-
}
2272-
22732234
dev_dbg(&ndev->ntb.pdev->dev, "IDT IRQs 0x%08x handled", ntint_sts);
22742235

22752236
return handled ? IRQ_HANDLED : IRQ_NONE;

drivers/ntb/hw/idt/ntb_hw_idt.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -688,15 +688,14 @@
688688
* @IDT_NTINTMSK_DBELL: Doorbell interrupt mask bit
689689
* @IDT_NTINTMSK_SEVENT: Switch Event interrupt mask bit
690690
* @IDT_NTINTMSK_TMPSENSOR: Temperature sensor interrupt mask bit
691-
* @IDT_NTINTMSK_ALL: All the useful interrupts mask
691+
* @IDT_NTINTMSK_ALL: NTB-related interrupts mask
692692
*/
693693
#define IDT_NTINTMSK_MSG 0x00000001U
694694
#define IDT_NTINTMSK_DBELL 0x00000002U
695695
#define IDT_NTINTMSK_SEVENT 0x00000008U
696696
#define IDT_NTINTMSK_TMPSENSOR 0x00000080U
697697
#define IDT_NTINTMSK_ALL \
698-
(IDT_NTINTMSK_MSG | IDT_NTINTMSK_DBELL | \
699-
IDT_NTINTMSK_SEVENT | IDT_NTINTMSK_TMPSENSOR)
698+
(IDT_NTINTMSK_MSG | IDT_NTINTMSK_DBELL | IDT_NTINTMSK_SEVENT)
700699

701700
/*
702701
* NTGSIGNAL register fields related constants

0 commit comments

Comments
 (0)