Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp463842imm; Sat, 14 Jul 2018 05:01:40 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdKL2UGCsgU9577BpeUEGB1Axm/k5r87OjW8aOYSAkodpvhIYNfS4/KQ+mMVG2WG5YcOj4P X-Received: by 2002:a62:f909:: with SMTP id o9-v6mr10876884pfh.141.1531569700254; Sat, 14 Jul 2018 05:01:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531569700; cv=none; d=google.com; s=arc-20160816; b=udPCpJ/+Cla+WlG2NwarC6oz4FfcPZxCA37Yny3MWB1Vdh0AfS3+qB4XWX1FXVZbKd 8sVo39BGmU6HyqnDjA12U38tOP0HAwbMiwd4nKIN0xUlohlZceiIHhakdJAo446AHMYo 5us2GxHXPeI9FmKKxOupnV4fNg1QHCX5b/WJ2XgMIIbrhn82opFECKs7QUAPMwU6aIuK quXw923zJOVr2K01GOPfp0m6XRb5U43nLm+Zp+ROLDeiHaUzbgzwMkYQtDMyxksCGc8X 3Tqu3Sp6TQ6Mkci0vwpqWm5t3Qb02BSiKQQiCJZ50Cy8i/9ZY3MEf6iW+WYYlZDPo0E0 E7sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=FwZw+Vlttbdrdt3ctIXNZvaRDKvHEGTMXRdF8LOxb/Q=; b=Q0LiBsnO0y+CDEfLtSGHaX7rRfeuT1eTDBfdE5QSNCtfXPhataap/hI2gnnbAETUos q7OqMjEkL/BpfyRajoqy2L30ZXdn0LtYbO7nWH0MgdlrFoqzrk1gh52g0wZGDMYgFpKP +Wu5mW/JjQFjr/fYnFXK3TzZCiF0QsRHtY+RLmwH74uthgXsU56RlEC0IZLnrQkuuQD1 7+Su4MkzGllEex9ZvdDQWjIiSdfLg65C+xsgLcenEairIWPYOp6kskT2HOK6oaUC+VM2 Y7rVPtDvdHrcNgl+cmsEn3/Qtk5LwgjeEZHrO1cMklL+AC6/Elj8EGTfSjlia8PXnlED OJjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="lGz/FXtg"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i12-v6si9515473pgr.266.2018.07.14.05.01.24; Sat, 14 Jul 2018 05:01:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="lGz/FXtg"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728111AbeGNMSI (ORCPT + 99 others); Sat, 14 Jul 2018 08:18:08 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:39578 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726979AbeGNMR4 (ORCPT ); Sat, 14 Jul 2018 08:17:56 -0400 Received: by mail-lj1-f193.google.com with SMTP id l15-v6so6208192lji.6 for ; Sat, 14 Jul 2018 04:59:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=FwZw+Vlttbdrdt3ctIXNZvaRDKvHEGTMXRdF8LOxb/Q=; b=lGz/FXtgcX8sns9Na4+UIf9QxEMxCSPcSs/zPCwhjfm6rOM8huTUQOl8eoQ+WrQEwR 6C9g6US1csBY4qX1KBcu//CW5eu8TAqGSSOVBu+SmI12VDrQxf9Fh4RBefGKPAL0wcCU Irv6ScBqMdVyx4ZpYQtZGztIBg51y87Gl5KxcOVLkonoQNV08IR95x+pTl+xe9nZo27D CpzLNJuP2WdQIljowCzUm/s9HykN739HuVVi+6G3Z0pfi0tsKSFicPCHrG/ZesgQjq2z N9iGKUz9IXo914g/Cxj9wWOvBo72lnCM/MJ8hWUsUgCIXUmQ0FmauiE/tD/nGsxEkFHs RC+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=FwZw+Vlttbdrdt3ctIXNZvaRDKvHEGTMXRdF8LOxb/Q=; b=ua4L7CXG4d3DLCFuUeM/RFpSQrR8UabRF258J+nF9PMAJLRWzl5GNWZJKhmpfjFnK4 sNvPy7PmBxqYqEBld56vbkc4ZisrVaFVEedYTdUT54Dlml/TPT5NHQWJeBXZHpl1H1im WYExs6JS/aE6ptc2BW9Qb1tK/RCx201Kj8mJX8P1ukqH8VjePK/SqezcFT0JjJPjgsLf tM30trjNkp7QHIJ4nzhJwUFAnR9H5/er8t9kZXEy9Zf6CbfwCrVI+8BASelsvnOyFZg0 0uumEvLE7pOW/ZcBZkcxCiXdUM9TrdgzAxfEruuD3NP/uhzi/thqS8legWoBEGJVLQrr LX0g== X-Gm-Message-State: AOUpUlHTfX/mfFQN4w6hMkPd+DmsoOgNNBXGS2I0xhEzwv5Ll33wqwbs cQWtw+sw64rOedKjmgBs+hI= X-Received: by 2002:a2e:934d:: with SMTP id m13-v6mr22250ljh.45.1531569544845; Sat, 14 Jul 2018 04:59:04 -0700 (PDT) Received: from linux.local ([5.166.218.73]) by smtp.gmail.com with ESMTPSA id r64-v6sm7284222lff.90.2018.07.14.04.59.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 14 Jul 2018 04:59:04 -0700 (PDT) From: Serge Semin To: jdmason@kudzu.us, dave.jiang@intel.com, allenbh@gmail.com Cc: Sergey.Semin@t-platforms.ru, linux-ntb@googlegroups.com, linux-kernel@vger.kernel.org, Serge Semin Subject: [PATCH 3/4] ntb: idt: Discard temperature sensor IRQ handler Date: Sat, 14 Jul 2018 14:58:33 +0300 Message-Id: <20180714115834.3350-4-fancer.lancer@gmail.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20180714115834.3350-1-fancer.lancer@gmail.com> References: <20180714115834.3350-1-fancer.lancer@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/ntb/hw/idt/ntb_hw_idt.c | 41 +---------------------------------------- drivers/ntb/hw/idt/ntb_hw_idt.h | 5 ++--- 2 files changed, 3 insertions(+), 43 deletions(-) diff --git a/drivers/ntb/hw/idt/ntb_hw_idt.c b/drivers/ntb/hw/idt/ntb_hw_idt.c index af767a13556a..3d48267ae315 100644 --- a/drivers/ntb/hw/idt/ntb_hw_idt.c +++ b/drivers/ntb/hw/idt/ntb_hw_idt.c @@ -2076,38 +2076,6 @@ static struct attribute *idt_temp_attrs[] = { ATTRIBUTE_GROUPS(idt_temp); /* - * idt_temp_isr() - temperature sensor alarm events ISR - * @ndev: IDT NTB hardware driver descriptor - * @ntint_sts: NT-function interrupt status - * - * It handles events of temperature crossing alarm thresholds. Since reading - * of TMPALARM register clears it up, the function doesn't analyze the - * read value, instead the current temperature value just warningly printed to - * log. - * The method is called from PCIe ISR bottom-half routine. - */ -static void idt_temp_isr(struct idt_ntb_dev *ndev, u32 ntint_sts) -{ - unsigned long mdeg; - - /* Read the current temperature value */ - idt_read_temp(ndev, IDT_TEMP_CUR, &mdeg); - - /* Read the temperature alarm to clean the alarm status out */ - /*(void)idt_sw_read(ndev, IDT_SW_TMPALARM);*/ - - /* Clean the corresponding interrupt bit */ - idt_nt_write(ndev, IDT_NT_NTINTSTS, IDT_NTINTSTS_TMPSENSOR); - - dev_dbg(&ndev->ntb.pdev->dev, - "Temp sensor IRQ detected %#08x", ntint_sts); - - /* Print temperature value to log */ - dev_warn(&ndev->ntb.pdev->dev, "Temperature %hhd.%hhuC", - idt_get_deg(mdeg), idt_get_deg_frac(mdeg)); -} - -/* * idt_init_temp() - initialize temperature sensor interface * @ndev: IDT NTB hardware driver descriptor * @@ -2189,7 +2157,7 @@ static int idt_init_isr(struct idt_ntb_dev *ndev) goto err_free_vectors; } - /* Unmask Message/Doorbell/SE/Temperature interrupts */ + /* Unmask Message/Doorbell/SE interrupts */ ntint_mask = idt_nt_read(ndev, IDT_NT_NTINTMSK) & ~IDT_NTINTMSK_ALL; idt_nt_write(ndev, IDT_NT_NTINTMSK, ntint_mask); @@ -2204,7 +2172,6 @@ err_free_vectors: return ret; } - /* * idt_deinit_ist() - deinitialize PCIe interrupt handler * @ndev: IDT NTB hardware driver descriptor @@ -2265,12 +2232,6 @@ static irqreturn_t idt_thread_isr(int irq, void *devid) handled = true; } - /* Handle temperature sensor interrupt */ - if (ntint_sts & IDT_NTINTSTS_TMPSENSOR) { - idt_temp_isr(ndev, ntint_sts); - handled = true; - } - dev_dbg(&ndev->ntb.pdev->dev, "IDT IRQs 0x%08x handled", ntint_sts); return handled ? IRQ_HANDLED : IRQ_NONE; diff --git a/drivers/ntb/hw/idt/ntb_hw_idt.h b/drivers/ntb/hw/idt/ntb_hw_idt.h index 032f81cb4d44..3517cd2e2baa 100644 --- a/drivers/ntb/hw/idt/ntb_hw_idt.h +++ b/drivers/ntb/hw/idt/ntb_hw_idt.h @@ -688,15 +688,14 @@ * @IDT_NTINTMSK_DBELL: Doorbell interrupt mask bit * @IDT_NTINTMSK_SEVENT: Switch Event interrupt mask bit * @IDT_NTINTMSK_TMPSENSOR: Temperature sensor interrupt mask bit - * @IDT_NTINTMSK_ALL: All the useful interrupts mask + * @IDT_NTINTMSK_ALL: NTB-related interrupts mask */ #define IDT_NTINTMSK_MSG 0x00000001U #define IDT_NTINTMSK_DBELL 0x00000002U #define IDT_NTINTMSK_SEVENT 0x00000008U #define IDT_NTINTMSK_TMPSENSOR 0x00000080U #define IDT_NTINTMSK_ALL \ - (IDT_NTINTMSK_MSG | IDT_NTINTMSK_DBELL | \ - IDT_NTINTMSK_SEVENT | IDT_NTINTMSK_TMPSENSOR) + (IDT_NTINTMSK_MSG | IDT_NTINTMSK_DBELL | IDT_NTINTMSK_SEVENT) /* * NTGSIGNAL register fields related constants -- 2.12.0