Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp424278ybv; Wed, 5 Feb 2020 07:56:41 -0800 (PST) X-Google-Smtp-Source: APXvYqwbB7k74n3FE8XQsJniJxuUKjjZUur0WfdnaJ2/vIxAIZwCGuhOz0x+or3v1k7TVMECIOBq X-Received: by 2002:a05:6830:99:: with SMTP id a25mr27496104oto.130.1580918201552; Wed, 05 Feb 2020 07:56:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580918201; cv=none; d=google.com; s=arc-20160816; b=zSbzOgENJwFyepM4vqG5/uYpXag1fPE8+oiiZCL6adinc9WNVQvkCgJCi7W+ZEILwu Pfig6zbaied6XggE0x0XzCJ+gTUfZsyGs3DpArtdL4ybNJ3O0NgNavb8ePZIbt+3bHo9 lJP4S/8Xl5C+teh0KDmvaV3or79gj+tCbT1Xg1yPxgz7sVY3SKgptzvRTfyn50uEGAsx 4URJYpJeregi8cqDhYkxswLK6FAk+E3H/8ajDvHOdCdzhA7Nc3tHVLpMIvIPtzQkBsAj JtcLVrwgYMLV+aEAxKwyw4oNSBzHvYGoqR71Z6WUNa7Z3FO/MoRENVcOKSy6A6VKxuiY hmtw== 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:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=JUnWYUYj9WgMqnGKXdAvUINkhyodp4ZrOWa+ysolFos=; b=c20LSUsXbW/vcGASwszD95loPmBeNNcxyobLIpIL+KNsXoQ3TRdvc78dDglTkiTHsX OKrWezcg70pkpCryUccZ6h3lrajcYgkz/bfDvk5N8ndQEDIh0fPLujJVIRBzg1MqlLxH Ocl4cr02q5SaFY+VLb1006ozjk2c3lWPrYgNUkkQzSOylj/irhaaRNvuR0Xg7mjFmpe5 9xZxGvQ3O1jS5rx/b0r/N0w7EU8BhlLM9LsYWYwGeyAbN0QhW5mratPPYhXnc4CWolAD REWy6DrijxzQmvRsnymDWHoI/Fjl/N0sL2ps+Aiz31CNoNVRiqkzrXrrpg3vYojsnhVf BLqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=Jc0FOqid; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h139si219395oib.85.2020.02.05.07.56.29; Wed, 05 Feb 2020 07:56:41 -0800 (PST) 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=fail header.i=@gmail.com header.s=20161025 header.b=Jc0FOqid; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727579AbgBEPzQ (ORCPT + 99 others); Wed, 5 Feb 2020 10:55:16 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:38810 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727081AbgBEPzO (ORCPT ); Wed, 5 Feb 2020 10:55:14 -0500 Received: by mail-pf1-f196.google.com with SMTP id x185so1417684pfc.5 for ; Wed, 05 Feb 2020 07:55:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=JUnWYUYj9WgMqnGKXdAvUINkhyodp4ZrOWa+ysolFos=; b=Jc0FOqidGoKA7WGPDdKWEGrn8qI9pIynpbD98+YhltsUo/+1GpLwq6trZnTwiGYttO Piwq+MnVZEGurft6/qQLob2clQGJA8fr8UR992di1P64uQP+jT2w2zr5Iuz98dzO+b95 PSX/5/SBSh5/JO9Jb/M/gjHcewPYSfJKOUwcEE8a79t6UoR2Irq6juuPj4cGhBApyuCu wDNTYa2T+RtNLhnM3v8x08B2jvAAQHsjf9DaeYl1psZ9OIyLkYpggwS2SrrWbi6ZfR2K 71QeI1s9tO67e20rzSt3KnfP8cnw44DwYtrcMH5zCWrDS00S9L9CVVzf9eWq2cJBslVb bF8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:in-reply-to:references; bh=JUnWYUYj9WgMqnGKXdAvUINkhyodp4ZrOWa+ysolFos=; b=Ofd1XRuawgUaeLkuZQHv80mfTK4TDcEATyF7TtC1hTEfzHGqMk3HiJCYVTODrQbJ01 WPq/f8eYNEQds+lkSTNX82EaJoa8kd49ANtEscXLS5MHLNtm2htuvt6YXv2UKB7JIkQf x5QlCtb3FLss0QXkBRJUjojQpD615nIr4SX+II1MLPsBnlqKizDLtfpqoxnA7+J7m5MP +v3MaoE0dCxc0M3parYbgBf/32i7/aBt0jbikCymj3zrD0EkHbY8PHMJ/LNwigaUUwiZ 9WEsfgvYYIZLGcF7iyPu9aiawYbq+sZ66+Zhd+q9BnKaJ7M3BhLk3S/N6vA+vCTI5HOm NPkA== X-Gm-Message-State: APjAAAVRiY+xEhusS/DXkATAH6J6MRg5U/iQeRxBiFp2KoNV+zBnsbNb rNihynhLZV2Of+QexhWKv2F6c8N+jmOpBQ== X-Received: by 2002:a62:5547:: with SMTP id j68mr38413261pfb.6.1580918112263; Wed, 05 Feb 2020 07:55:12 -0800 (PST) Received: from emb-wallaby.amd.com ([165.204.156.251]) by smtp.gmail.com with ESMTPSA id z10sm195678pgz.88.2020.02.05.07.55.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 07:55:11 -0800 (PST) From: Arindam Nath To: Shyam Sundar S K , Jon Mason , Dave Jiang , Allen Hubbe , Jiasen Lin , Sanjay R Mehta Cc: linux-ntb@googlegroups.com, linux-kernel@vger.kernel.org, Arindam Nath Subject: [PATCH 08/15] NTB: handle link down event correctly Date: Wed, 5 Feb 2020 21:24:25 +0530 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Link-Up and Link-Down are mutually exclusive events. So when we receive a Link-Down event, we should also clear the bitmask for Link-Up event in peer_sta. Signed-off-by: Arindam Nath --- drivers/ntb/hw/amd/ntb_hw_amd.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/ntb/hw/amd/ntb_hw_amd.c b/drivers/ntb/hw/amd/ntb_hw_amd.c index e964442ae2c3..d933a1dffdc6 100644 --- a/drivers/ntb/hw/amd/ntb_hw_amd.c +++ b/drivers/ntb/hw/amd/ntb_hw_amd.c @@ -551,8 +551,12 @@ static void amd_handle_event(struct amd_ntb_dev *ndev, int vec) dev_info(dev, "Flush is done.\n"); break; case AMD_PEER_RESET_EVENT: - ndev->peer_sta |= AMD_PEER_RESET_EVENT; - amd_ack_smu(ndev, AMD_PEER_RESET_EVENT); + case AMD_LINK_DOWN_EVENT: + ndev->peer_sta |= status; + if (status == AMD_LINK_DOWN_EVENT) + ndev->peer_sta &= ~AMD_LINK_UP_EVENT; + + amd_ack_smu(ndev, status); /* link down first */ ntb_link_event(&ndev->ntb); @@ -563,7 +567,6 @@ static void amd_handle_event(struct amd_ntb_dev *ndev, int vec) case AMD_PEER_D3_EVENT: case AMD_PEER_PMETO_EVENT: case AMD_LINK_UP_EVENT: - case AMD_LINK_DOWN_EVENT: ndev->peer_sta |= status; amd_ack_smu(ndev, status); -- 2.17.1