From patchwork Wed May 30 16:45:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10439413 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C17D4601D3 for ; Wed, 30 May 2018 16:46:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B839228FBD for ; Wed, 30 May 2018 16:46:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AC0D4290A4; Wed, 30 May 2018 16:46:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3293328FBD for ; Wed, 30 May 2018 16:46:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753617AbeE3Qqe (ORCPT ); Wed, 30 May 2018 12:46:34 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:57498 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752850AbeE3Qqa (ORCPT ); Wed, 30 May 2018 12:46:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=XmGMlbwIuglgbVpXIYRO7zjavSeg1CTto0s0O3wvUzk=; b=qbI09TZLoImHKUPkCxxsOepTr zuCI0HUYdpDc07hWv7lv/1/jEmDoFpEUPYrFCaM8GWbgB1AG6EGco6q+vSKiNEjXIl62mZVUdVPk4 VqVu3mqcC9xuWWCZ7g7E+86wJhk3/GbCx+w3UEekQtaDPOavlaUa8Av7LFRS4lDML23i5ssHAPPrU yvKDnYNlk+f0ViAq9MqVO4+q6KRPA45Wu5dDdZ9N3JHKhk3Xubx3GrrMI/xrHO6+3wc9qIxm2T7Tp K+5ND2nIXX5FCmq1toUsLIubDWZnZuo1ncWDk7TAinCr/lORPBNl00DD0/NeHfQXIxdKllWTHU/wH BsKgKg0Fw==; Received: from 213-225-38-123.nat.highway.a1.net ([213.225.38.123] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fO4Eh-0008Uh-QV; Wed, 30 May 2018 16:46:08 +0000 From: Christoph Hellwig To: linux-nvme@lists.infradead.org Cc: Jens Axboe , Keith Busch , Sagi Grimberg , Hannes Reinecke , linux-block@vger.kernel.org Subject: [PATCH 01/12] nvme.h: untangle AEN notice definitions Date: Wed, 30 May 2018 18:45:49 +0200 Message-Id: <20180530164600.26856-2-hch@lst.de> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180530164600.26856-1-hch@lst.de> References: <20180530164600.26856-1-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Stop including the event type in the definitions for the notice type. Signed-off-by: Christoph Hellwig Reviewed-by: Johannes Thumshirn Reviewed-by: Sagi Grimberg Reviewed-by: Hannes Reinecke Reviewed-by: Hannes Reinecke --- drivers/nvme/host/core.c | 30 ++++++++++++++++++------------ include/linux/nvme.h | 8 ++++++-- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 2c4cf65641a6..86cb78653155 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -3321,6 +3321,21 @@ static void nvme_fw_act_work(struct work_struct *work) nvme_get_fw_slot_info(ctrl); } +static void nvme_handle_aen_notice(struct nvme_ctrl *ctrl, u32 result) +{ + switch ((result & 0xff00) >> 8) { + case NVME_AER_NOTICE_NS_CHANGED: + dev_info(ctrl->device, "rescanning\n"); + nvme_queue_scan(ctrl); + break; + case NVME_AER_NOTICE_FW_ACT_STARTING: + queue_work(nvme_wq, &ctrl->fw_act_work); + break; + default: + dev_warn(ctrl->device, "async event result %08x\n", result); + } +} + void nvme_complete_async_event(struct nvme_ctrl *ctrl, __le16 status, volatile union nvme_result *res) { @@ -3330,6 +3345,9 @@ void nvme_complete_async_event(struct nvme_ctrl *ctrl, __le16 status, return; switch (result & 0x7) { + case NVME_AER_NOTICE: + nvme_handle_aen_notice(ctrl, result); + break; case NVME_AER_ERROR: case NVME_AER_SMART: case NVME_AER_CSS: @@ -3339,18 +3357,6 @@ void nvme_complete_async_event(struct nvme_ctrl *ctrl, __le16 status, default: break; } - - switch (result & 0xff07) { - case NVME_AER_NOTICE_NS_CHANGED: - dev_info(ctrl->device, "rescanning\n"); - nvme_queue_scan(ctrl); - break; - case NVME_AER_NOTICE_FW_ACT_STARTING: - queue_work(nvme_wq, &ctrl->fw_act_work); - break; - default: - dev_warn(ctrl->device, "async event result %08x\n", result); - } queue_work(nvme_wq, &ctrl->async_event_work); } EXPORT_SYMBOL_GPL(nvme_complete_async_event); diff --git a/include/linux/nvme.h b/include/linux/nvme.h index 4112e2bd747f..c37103a4ad38 100644 --- a/include/linux/nvme.h +++ b/include/linux/nvme.h @@ -436,10 +436,14 @@ enum { enum { NVME_AER_ERROR = 0, NVME_AER_SMART = 1, + NVME_AER_NOTICE = 2, NVME_AER_CSS = 6, NVME_AER_VS = 7, - NVME_AER_NOTICE_NS_CHANGED = 0x0002, - NVME_AER_NOTICE_FW_ACT_STARTING = 0x0102, +}; + +enum { + NVME_AER_NOTICE_NS_CHANGED = 0x00, + NVME_AER_NOTICE_FW_ACT_STARTING = 0x01, }; struct nvme_lba_range_type {