Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp424773ybv; Wed, 5 Feb 2020 07:57:15 -0800 (PST) X-Google-Smtp-Source: APXvYqxNBZbW3I7Se0uyamUav1BnBEI4D9RSO8NH0ABuFF/15DLZfsmRQujUf95c3hyadtwzrNgs X-Received: by 2002:aca:2207:: with SMTP id b7mr3450330oic.109.1580918234936; Wed, 05 Feb 2020 07:57:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580918234; cv=none; d=google.com; s=arc-20160816; b=y+CNjEjfi2CroSeV1aJS9GueYpiZCBfgFjUwy95pxsA1/TIla/0JNsJcHYNj192qG0 1z/ywU+QRDa0RnOnQGjfGvvlqTteWLUQgWJoi1LYcyiHIYGdx+Ld3Rgu9AE5iXmsko9F Lv97bVN7z4YJWy4Vs5gPtlY2G9fWiy8cjYuYAjcZVMJvEEvo/3TwnJGRQXeGPWxzeg/N tDo+w6sMn+yWSi/9F24PAhmKXvG/tepZW0PaS2KWc/1EAHwKORLp+zQkEmmPSxX+blg+ LeqqKMTSKeIpp2pqG52T3wNVZI14KrzzbVqmFMSvz9tNV3DON47+6MC3dE4B+i5UzElN aU0w== 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=2uclY266m3vl3O6CK5JaBmW5CVIO6lWzMDS9vhDGfZU=; b=Vqe1SIy6NDrc50M1CXYh2Easak5U/451KjH8DghEAPULs7nVMKUtrNUeFyuoT/jGTN vYoMv0O7dzxsAlsn0VxGOpVB5mLxDyQ12tyWRqP9pLYZ34m1HskfpoVxTarM8byhvxiE 483UlCcH8w0ps/Xftor/cSGc0060h4rvON72jD9HFI59Age9XNe/QmO5POv5Q9YNzlP8 sB8yccyZZM2LW7TMqBGyTcAcA6wbA323wiQ+L3m8h27L3hCpUeoWub4TN8Y5CiZLhR5p pA6EGqswQznMutdop8IDl5f2i7bvPs2xgK2yWuArlX1SHKMqkMuTmn75KHOQPEGjp8tm G5IQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=iZFXdztB; 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 d14si190605oic.201.2020.02.05.07.57.02; Wed, 05 Feb 2020 07:57:14 -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=iZFXdztB; 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 S1727591AbgBEPzT (ORCPT + 99 others); Wed, 5 Feb 2020 10:55:19 -0500 Received: from mail-pg1-f194.google.com ([209.85.215.194]:45058 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727582AbgBEPzR (ORCPT ); Wed, 5 Feb 2020 10:55:17 -0500 Received: by mail-pg1-f194.google.com with SMTP id b9so1149105pgk.12 for ; Wed, 05 Feb 2020 07:55:15 -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=2uclY266m3vl3O6CK5JaBmW5CVIO6lWzMDS9vhDGfZU=; b=iZFXdztBj8ZRhOEgxAz0aFdE6IVn8NZ2fE0sQAxwXQaf6m8OFZo1TwzvyHpjxu5ntr FY0Fs4K8sVhh+hF40khH6blRydEPqpc/aV86rEx4E2sUoNcy1ZO/lNP9SblakXDqqFaK A+ei4lthsYJkSXWu8PbjaShL7Mie3NHLjhtlGOrubLVLdT6oOuGA/d6RLB0OsZel8Gc+ yaBjHQcecIsiK+5W2JA3EjnKuuQiaq33PrPScvk5B+WMUWHEfYln+7lgsJTugRLlwqjT O+dinAV++vFPyq1Kaa/xtWGJNbHh1r+0L5fzr54vq7lR8dKrm7ERB8aybw8nEak94+wD jHeA== 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=2uclY266m3vl3O6CK5JaBmW5CVIO6lWzMDS9vhDGfZU=; b=CBssClxg/Uez6A2wP4XlrZD//YMX6OdOSjtaCcmfHscCH0Gw7fz65mxCHyenDqkCwn Fy67TovapobLYUgN4YDgc5znRVYW8ZCtapTB7S9K73B6NM0qmAEhoPxcQy395sdC+7Qp ZvECXM8NGTXfBY9KyXegInmFLgthuWdRcKWe8dDSs2Hrez+/5vODFoUqp8VLOZfWe/A8 y3nKOtb4qenyh4Ua8cRGVPEWf5n8R9rR9ADqkThklZt1abGt+KiIrVaN88ld47RVD6Ty 5KN8WnjoUZn/OVRgCiYxRqOv+GeJByzteBWeTMmvdLaHktoDUivKqlJq7qE0jBUoiQ6F GwUw== X-Gm-Message-State: APjAAAVHyVSNWR92pmvXM1A632OUnp8WDOuu2Wx+h5hTNY3zXxQj06o2 GUBVwxtATKZA5FJMDjQ3D1E= X-Received: by 2002:a63:dc0d:: with SMTP id s13mr35858064pgg.129.1580918115197; Wed, 05 Feb 2020 07:55:15 -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.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 07:55:14 -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 09/15] NTB: handle link up, D0 and D3 events correctly Date: Wed, 5 Feb 2020 21:24:26 +0530 Message-Id: <4c07c3e337fe2343d9fa0ff234c2d85543198274.1580914232.git.arindam.nath@amd.com> 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 Just like for Link-Down event, Link-Up and D3 events are also mutually exclusive to Link-Down and D0 events respectively. So we clear the bitmasks in peer_sta depending on event type. Signed-off-by: Arindam Nath --- drivers/ntb/hw/amd/ntb_hw_amd.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/ntb/hw/amd/ntb_hw_amd.c b/drivers/ntb/hw/amd/ntb_hw_amd.c index d933a1dffdc6..a1c4a21c58c3 100644 --- a/drivers/ntb/hw/amd/ntb_hw_amd.c +++ b/drivers/ntb/hw/amd/ntb_hw_amd.c @@ -568,6 +568,11 @@ static void amd_handle_event(struct amd_ntb_dev *ndev, int vec) case AMD_PEER_PMETO_EVENT: case AMD_LINK_UP_EVENT: ndev->peer_sta |= status; + if (status == AMD_LINK_UP_EVENT) + ndev->peer_sta &= ~AMD_LINK_DOWN_EVENT; + else if (status == AMD_PEER_D3_EVENT) + ndev->peer_sta &= ~AMD_PEER_D0_EVENT; + amd_ack_smu(ndev, status); /* link down */ @@ -582,6 +587,7 @@ static void amd_handle_event(struct amd_ntb_dev *ndev, int vec) dev_info(dev, "Wakeup is done.\n"); ndev->peer_sta |= AMD_PEER_D0_EVENT; + ndev->peer_sta &= ~AMD_PEER_D3_EVENT; amd_ack_smu(ndev, AMD_PEER_D0_EVENT); /* start a timer to poll link status */ -- 2.17.1