Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp424091ybv; Wed, 5 Feb 2020 07:56:30 -0800 (PST) X-Google-Smtp-Source: APXvYqyQ9cvXJaBpHHxrsllFgRg8AwXt8sEjDPZ8aPFamxevi155eem/sHtlGME7b8hkWnliTgwB X-Received: by 2002:aca:d985:: with SMTP id q127mr3225624oig.132.1580918189846; Wed, 05 Feb 2020 07:56:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580918189; cv=none; d=google.com; s=arc-20160816; b=OvfJ/YZFw+uoiJB/F+oo4x+28DfmDFSt7BtJjPnaO6VNaTU1NnghGYwr8nt2J6u4Sr u+Sja1guAhlTSPiHJnAbXrrZ7efGANKPDV8cZ8ogLOrAO4MFprzEVTMI3jTYM9KwsHc2 Q+5TKexonFhcGjJkKkfrJuBLEaFzFgFuzCYBT+coAx3VXVki6KvDUNLPIg0eC2U5wHW+ J+drJctQ0sGNJq0RMeYI+YzWPDTQUYmxReeynL818d+6hiZ/nUtz4MRpejjPtldLkEi5 TbZGOqTHaV/W/BexsZvxcO9Hcq50dPUBvRF0kJyCXUNdJmyr68Wn67ADthMMSKJ6xsv/ 9HMQ== 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=r6M3muC17wmFBo6gGHeq8kEyee20Ea6YYRIE9th2DHM=; b=u+lFfPsSe/VGbmSxfET1TBc2QCu2HOL5ie4rJA48Vxle4u2laDv+ZHVVp9u/kz6sVz LuhNmewBdjiSTte4MNDeTQeYJST1RlAb+HPrzSNgfJP6n/6qYQxk/3Ps8lzsYC4zwdME 5Lx/N4p9PqlXG4ci0DfcMSeFGeM8UD76OMmnVq3fTExY7ut7TX/2tg3cmHT8chwke+p8 8ermJMW+geq8HLKHk/icCjxnYW4omraPknoK8MUPHA2o1pujtolFIB9sXsUfpeD2t4We 9f0xpRsNxRJnBkhcgRFdZbBx1U+BSftuYFowB3bXjUAAedbbL6fOaXe+WR28lfR+Fnne qnog== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=hFEF6DGw; 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 q6si16362202otg.248.2020.02.05.07.56.18; Wed, 05 Feb 2020 07:56:29 -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=hFEF6DGw; 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 S1727558AbgBEPzJ (ORCPT + 99 others); Wed, 5 Feb 2020 10:55:09 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:38803 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727441AbgBEPzH (ORCPT ); Wed, 5 Feb 2020 10:55:07 -0500 Received: by mail-pf1-f194.google.com with SMTP id x185so1417563pfc.5 for ; Wed, 05 Feb 2020 07:55:06 -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=r6M3muC17wmFBo6gGHeq8kEyee20Ea6YYRIE9th2DHM=; b=hFEF6DGw7r2FGdEhuSp7tjL/ZgbEyEOOx8MDcq/UArDrC+2o8J+ZM5WrEe2FIZzjJc 2nWMxqn4rv3DpWzdaZRUVNvkSpu/kpmJOvbWRtfYaqdtSSXLh/993hdHeYUE9SDIoxeR 5mfnVzfnXD4WOFc8eLJmCiMqP4nFy82CitrMctVwqcZQX6nBjvyh2IU9pNLfBaMwVmfh 7qeLQEUZDtAHntyKmAbKXHSGdB18uho4JvMtw/aKizZN6d/dk60i/FIFwUTiL/rFPSQX ML/KC7TbSpbNuFK7gSKdR9dperY8hwJ0YLIvP0eWm24+mwN0oz9nzmqOKhDALBgtOiPv JKMQ== 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=r6M3muC17wmFBo6gGHeq8kEyee20Ea6YYRIE9th2DHM=; b=GIlh7kL0SyXV9r6wbqWaGvrWbzp7dd01mYm5nazlVcgiB9qSHX9fairde7Vm8Fv9/d PXZPUNYEIbzj1r0l5yaGMNUBmM8uNtVjAwNKmmYjOwqvkPYbFbosOSKM58G3ZMKy1fAk 77dnu7venXyS5Lv9EoNm45+GKZkzr92GCdA58q/UPRq8elGWrCu97KT2IHLJ/9VVWkvp QpDZE/XJLDRuZQacv4+j05kgvq82/ghyIjgusRtUmxd60+eQe5KuNGvXnClXVURaB2AT ClG4R6hShX7RUd76In1ZSaz6dqEy5vSUCL/r/nbLGNjK1DDVgqbKabkIBm5IbTUKR/go IjlQ== X-Gm-Message-State: APjAAAVs+LOvuGBgTmarphmcJrjSVaigDARXIvxSxnqc0/ywnqfdI52+ VthmZUkeWcAv9IGSq7Bee2g= X-Received: by 2002:a63:7a1a:: with SMTP id v26mr717429pgc.51.1580918106459; Wed, 05 Feb 2020 07:55:06 -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.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 07:55:06 -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 06/15] NTB: set peer_sta within event handler itself Date: Wed, 5 Feb 2020 21:24:23 +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 amd_ack_smu() should only set the corresponding bits into SMUACK register. Setting the bitmask of peer_sta should be done within the event handler. They are two different things, and so should be handled differently and at different places. Signed-off-by: Arindam Nath --- drivers/ntb/hw/amd/ntb_hw_amd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/ntb/hw/amd/ntb_hw_amd.c b/drivers/ntb/hw/amd/ntb_hw_amd.c index 84723420d70b..b85af150f2c6 100644 --- a/drivers/ntb/hw/amd/ntb_hw_amd.c +++ b/drivers/ntb/hw/amd/ntb_hw_amd.c @@ -541,8 +541,6 @@ static void amd_ack_smu(struct amd_ntb_dev *ndev, u32 bit) reg = readl(mmio + AMD_SMUACK_OFFSET); reg |= bit; writel(reg, mmio + AMD_SMUACK_OFFSET); - - ndev->peer_sta |= bit; } static void amd_handle_event(struct amd_ntb_dev *ndev, int vec) @@ -560,9 +558,11 @@ static void amd_handle_event(struct amd_ntb_dev *ndev, int vec) status &= AMD_EVENT_INTMASK; switch (status) { case AMD_PEER_FLUSH_EVENT: + ndev->peer_sta |= AMD_PEER_FLUSH_EVENT; 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); /* link down first */ @@ -575,6 +575,7 @@ static void amd_handle_event(struct amd_ntb_dev *ndev, int vec) case AMD_PEER_PMETO_EVENT: case AMD_LINK_UP_EVENT: case AMD_LINK_DOWN_EVENT: + ndev->peer_sta |= status; amd_ack_smu(ndev, status); /* link down */ @@ -588,6 +589,7 @@ static void amd_handle_event(struct amd_ntb_dev *ndev, int vec) if (status & 0x1) dev_info(dev, "Wakeup is done.\n"); + ndev->peer_sta |= AMD_PEER_D0_EVENT; amd_ack_smu(ndev, AMD_PEER_D0_EVENT); /* start a timer to poll link status */ -- 2.17.1