From patchwork Mon Oct 12 15:20:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 54778 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by patches.linaro.org (Postfix) with ESMTPS id 179EA23001 for ; Mon, 12 Oct 2015 15:05:51 +0000 (UTC) Received: by wicgb1 with SMTP id gb1sf60944536wic.3 for ; Mon, 12 Oct 2015 08:05:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-type:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe; bh=t6tDLvkwbIsN5/gAC9nXb3Sjb29lu2m2m0G7xlFn8+Y=; b=evMXa4MLX4kqshjiZnwjzugNKKbZ+3K7ZHB+n+imEllhN4W07AJXwwuZWEMmDJoMhv 1wDw+QYfjVp/8kdCkrze1ichQ1M4FN/oDiB1FznYvtLC79TQW8UxFLFLwKGiW/2rdj0P 4VLYfAlhbo5QVSnwZEKUl/CECmpN/mJErqsbvcXOBnkpdVSub17Yq6xWx6dgePOxYeN/ qTdXwqanEnfra01EAnk4fenYYEAfknIYs+bId8FabGx3o9NI8T/5KvOr2VhLAdYG4AdA zsjFVQwlYkZ24k3D8KcuXoH9tga8nqoGzpXdZn4FcfeWycF1TJ4Rdu2w3gUaJj2lcob4 ZQXQ== X-Gm-Message-State: ALoCoQnY54QHOW4c+g1BlmPRlqs3RtF8wpQzmeeB8pkIlk/rUjlSmpujbQfvqpHU+Rj3lPSFlCXC X-Received: by 10.180.208.7 with SMTP id ma7mr3004203wic.5.1444662350321; Mon, 12 Oct 2015 08:05:50 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.79.85 with SMTP id d82ls507097lfb.47.gmail; Mon, 12 Oct 2015 08:05:50 -0700 (PDT) X-Received: by 10.25.25.83 with SMTP id 80mr6941310lfz.30.1444662350107; Mon, 12 Oct 2015 08:05:50 -0700 (PDT) Received: from mail-lb0-f175.google.com (mail-lb0-f175.google.com. [209.85.217.175]) by mx.google.com with ESMTPS id al9si11524491lbc.51.2015.10.12.08.05.50 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Oct 2015 08:05:50 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.175 as permitted sender) client-ip=209.85.217.175; Received: by lbbk10 with SMTP id k10so33784258lbb.0 for ; Mon, 12 Oct 2015 08:05:50 -0700 (PDT) X-Received: by 10.112.199.137 with SMTP id jk9mr12811184lbc.86.1444662349978; Mon, 12 Oct 2015 08:05:49 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1599368lbq; Mon, 12 Oct 2015 08:05:48 -0700 (PDT) X-Received: by 10.182.247.99 with SMTP id yd3mr15691030obc.37.1444662338889; Mon, 12 Oct 2015 08:05:38 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y6si8995502oei.53.2015.10.12.08.05.38 for ; Mon, 12 Oct 2015 08:05:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752077AbbJLPFh (ORCPT ); Mon, 12 Oct 2015 11:05:37 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:11758 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751616AbbJLPFf (ORCPT ); Mon, 12 Oct 2015 11:05:35 -0400 Received: from 172.24.1.51 (EHLO szxeml432-hub.china.huawei.com) ([172.24.1.51]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CUB61530; Mon, 12 Oct 2015 23:05:15 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by szxeml432-hub.china.huawei.com (10.82.67.209) with Microsoft SMTP Server id 14.3.235.1; Mon, 12 Oct 2015 23:05:05 +0800 From: John Garry To: CC: , , , , , , , , , John Garry Subject: [PATCH 24/25] scsi: hisi_sas: add fatal irq handler Date: Mon, 12 Oct 2015 23:20:36 +0800 Message-ID: <1444663237-238302-25-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1444663237-238302-1-git-send-email-john.garry@huawei.com> References: <1444663237-238302-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-scsi-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: john.garry@huawei.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.175 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Add handlers for fatal interrupts. Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_v1_hw.c | 118 +++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) diff --git a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c index b5ba46a..bc8e23e 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c @@ -1621,6 +1621,91 @@ static irqreturn_t cq_interrupt_v1_hw(int irq, void *p) return IRQ_HANDLED; } +static irqreturn_t fatal_ecc_int_v1_hw(int irq, void *p) +{ + struct hisi_hba *hisi_hba = p; + u32 ecc_int = hisi_sas_read32(hisi_hba, SAS_ECC_INTR); + + if (ecc_int & SAS_ECC_INTR_DQ_ECC1B_MSK) { + u32 ecc_err = hisi_sas_read32(hisi_hba, HGC_ECC_ERR); + + panic("Fatal DQ 1b ECC interrupt on controller %d (0x%x)\n", + hisi_hba->id, ecc_err); + } + + if (ecc_int & SAS_ECC_INTR_DQ_ECCBAD_MSK) { + u32 addr = (hisi_sas_read32(hisi_hba, HGC_DQ_ECC_ADDR) & + HGC_DQ_ECC_ADDR_BAD_MSK) >> + HGC_DQ_ECC_ADDR_BAD_OFF; + + panic("Fatal DQ RAM ECC interrupt on controller %d @ 0x%08x\n", + hisi_hba->id, addr); + } + + if (ecc_int & SAS_ECC_INTR_IOST_ECC1B_MSK) { + u32 ecc_err = hisi_sas_read32(hisi_hba, HGC_ECC_ERR); + + panic("Fatal IOST 1b ECC interrupt on controller %d (0x%x)\n", + hisi_hba->id, ecc_err); + } + + if (ecc_int & SAS_ECC_INTR_IOST_ECCBAD_MSK) { + u32 addr = (hisi_sas_read32(hisi_hba, HGC_IOST_ECC_ADDR) & + HGC_IOST_ECC_ADDR_BAD_MSK) >> + HGC_IOST_ECC_ADDR_BAD_OFF; + + panic("Fatal IOST RAM ECC interrupt on controller %d @ 0x%08x\n", + hisi_hba->id, addr); + } + + if (ecc_int & SAS_ECC_INTR_ITCT_ECCBAD_MSK) { + u32 addr = (hisi_sas_read32(hisi_hba, HGC_ITCT_ECC_ADDR) & + HGC_ITCT_ECC_ADDR_BAD_MSK) >> + HGC_ITCT_ECC_ADDR_BAD_OFF; + + panic("Fatal TCT RAM ECC interrupt on controller %d @ 0x%08x\n", + hisi_hba->id, addr); + } + + if (ecc_int & SAS_ECC_INTR_ITCT_ECC1B_MSK) { + u32 ecc_err = hisi_sas_read32(hisi_hba, HGC_ECC_ERR); + + panic("Fatal ITCT 1b ECC interrupt on controller %d (0x%x)\n", + hisi_hba->id, ecc_err); + } + + hisi_sas_write32(hisi_hba, SAS_ECC_INTR, ecc_int | 0x3f); + + return IRQ_HANDLED; +} + +static irqreturn_t fatal_axi_int_v1_hw(int irq, void *p) +{ + struct hisi_hba *hisi_hba = p; + u32 axi_int = hisi_sas_read32(hisi_hba, ENT_INT_SRC2); + u32 axi_info = hisi_sas_read32(hisi_hba, HGC_AXI_FIFO_ERR_INFO); + + if (axi_int & ENT_INT_SRC2_DQ_CFG_ERR_MSK) + panic("Fatal DQ_CFG_ERR interrupt on controller %d (0x%x)\n", + hisi_hba->id, axi_info); + + if (axi_int & ENT_INT_SRC2_CQ_CFG_ERR_MSK) + panic("Fatal CQ_CFG_ERR interrupt on controller %d (0x%x)\n", + hisi_hba->id, axi_info); + + if (axi_int & ENT_INT_SRC2_AXI_WRONG_INT_MSK) + panic("Fatal AXI_WRONG_INT interrupt on controller %d (0x%x)\n", + hisi_hba->id, axi_info); + + if (axi_int & ENT_INT_SRC2_AXI_OVERLF_INT_MSK) + panic("Fatal AXI_OVERLF_INT incorrect interrupt on controller %d (0x%x)\n", + hisi_hba->id, axi_info); + + hisi_sas_write32(hisi_hba, ENT_INT_SRC2, axi_int | 0x30000000); + + return IRQ_HANDLED; +} + static const char phy_int_names[HISI_SAS_PHY_INT_NR][32] = { {"Bcast"}, {"Phy Up"}, @@ -1628,6 +1713,10 @@ static const char phy_int_names[HISI_SAS_PHY_INT_NR][32] = { }; static const char cq_int_name[32] = "cq"; +static const char fatal_int_name[HISI_SAS_FATAL_INT_NR][32] = { + "fatal ecc", + "fatal axi" +}; static irq_handler_t phy_interrupts[HISI_SAS_PHY_INT_NR] = { int_bcast_v1_hw, @@ -1635,6 +1724,11 @@ static irq_handler_t phy_interrupts[HISI_SAS_PHY_INT_NR] = { int_abnormal_v1_hw }; +static irq_handler_t fatal_interrupts[HISI_SAS_MAX_QUEUES] = { + fatal_ecc_int_v1_hw, + fatal_axi_int_v1_hw +}; + int interrupt_init_v1_hw(struct hisi_hba *hisi_hba) { int i, j, irq, rc, id = hisi_hba->id; @@ -1697,6 +1791,30 @@ int interrupt_init_v1_hw(struct hisi_hba *hisi_hba) idx++; } + for (i = 0; i < HISI_SAS_FATAL_INT_NR; i++) { + int idx = (hisi_hba->n_phy * HISI_SAS_PHY_INT_NR) + + hisi_hba->queue_count + i; + + irq = irq_of_parse_and_map(np, idx); + if (!irq) { + dev_err(dev, "irq init: [%d] could not map fatal interrupt %d\n", + hisi_hba->id, idx); + return -ENOENT; + } + (void)snprintf(&int_names[idx * HISI_SAS_NAME_LEN], + HISI_SAS_NAME_LEN, + DRV_NAME" %s [%d]", fatal_int_name[i], id); + rc = devm_request_irq(dev, irq, fatal_interrupts[i], 0, + &int_names[idx * HISI_SAS_NAME_LEN], + hisi_hba); + if (rc) { + dev_err(dev, + "irq init: [%d] could not request fatal interrupt %d, rc=%d\n", + hisi_hba->id, irq, rc); + return -ENOENT; + } + idx++; + } return 0; }