Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp424056ybv; Wed, 5 Feb 2020 07:56:27 -0800 (PST) X-Google-Smtp-Source: APXvYqwnpwOZ6/u3wBqG7K7Tkh8yikdJj4zXVW5tuVO+A//jGIuWUC4mX3nwqOlMNEatLn7tzJCl X-Received: by 2002:a9d:6183:: with SMTP id g3mr26350255otk.304.1580918187415; Wed, 05 Feb 2020 07:56:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580918187; cv=none; d=google.com; s=arc-20160816; b=vl82FkCr4q/9rgm0jPub1yNAx2SwumCbZPJuz3aoUP1sLIdm13mE+n8V/+gf3CxFS0 oDvL+1pB5Am+BMH6hh2ttQIpLtrwYfMF7ytCgjk5kD/AYlCASRmvq+1lqlqwmUQ5A9pi fHdxDdDjsa3yh4FLYdczeWIUhN0FA57Gv6zVvwrebodh5x4fnKZcYk5Q05RRyjJiQ9VO NqH/2N2WtFVY1MTQPdA3I7PdYvtsIg1zyalD7JR7k647eTG325KqZX6Wg7dHtv2i71Eb nzveSCJrJVFc4P3jOaBc9HyElM1z2nOW4TX/jbVdGRNoRjxs4rxefWVrnSK85FUnmg0c tDwg== 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=kl3iIovPAXkFd81DfbgFsEB+vcJ/l3r5RhzJoBZ9OdY=; b=GaI4Ss8p/DxPI+Ms+deWoFaPHykdxgG7lTWtGBGOpWiMoMG6n5rmvoTGZijP/4wPSR DTMxKdudsB0X4Ub4OX1X9CjdmTtpXboUH1KAoo+I6KwMq0pafrQFXiennrl2XbVv/T6O H8Zofx4UIHvx3AXBuAOzbdyi0AeaC9Pec652F1zb/lHOxsC4NepcGSCjsGmHuvgxZCiS k+69HVT8O09xGvYuC/eunj9urOQH2NEhZpQxyxTnkm7DUzSfy03kSsq1kx6mBGqFmdvu 3oep3UrCbJIzp9ednGfoyG0rmrwAUxjKNCYRsJa/ETADjCDbZHlIDsK4ORvJ2H+PbieA 2UQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=J62veQDZ; 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 l17si7766267otq.59.2020.02.05.07.56.15; Wed, 05 Feb 2020 07:56:27 -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=J62veQDZ; 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 S1727546AbgBEPzF (ORCPT + 99 others); Wed, 5 Feb 2020 10:55:05 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:38437 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727496AbgBEPzE (ORCPT ); Wed, 5 Feb 2020 10:55:04 -0500 Received: by mail-pg1-f196.google.com with SMTP id a33so1162834pgm.5 for ; Wed, 05 Feb 2020 07:55:03 -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=kl3iIovPAXkFd81DfbgFsEB+vcJ/l3r5RhzJoBZ9OdY=; b=J62veQDZUS60iVY4Tlz48ya7YikXvICFzI5tkilkr/axUIwN38abRMd7KF1ZhTF/Zr TSlyly3nnAiNKlhLSMR5YjO2eqSmXtWBUCQEc/wuns5dwBOsY84RAJXb4vaLxN3kxR8/ Mx+mfDIRRZ9AdvEDQ3kSGpxTZ6zNUNelJn0UsX3CaINeg0sNZzHsA9WTrX7OBxakVNeo g0Te55AZfOLco/7duWlueQWQxwzmV4tRrmiMl35ft+i5VYXxBrKIiNCiRTS6nKSSH/gA XNodw9aPhQFiQsX8vKpTLnk2psWEDQQA+8GEYy+b5A+HmhYxteW9ChW8dhWxxjo8nHqD +mVQ== 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=kl3iIovPAXkFd81DfbgFsEB+vcJ/l3r5RhzJoBZ9OdY=; b=Via+UA601eV/tRlvbdE82+yG4MI1OeuCJDb+mmu/IB2Tx/ixID2B4FXGREpZCrW4zk GtmgtCcOd4ZZGsocEOryhVj+5IBxYepKP5TBRL6WjUEYx55cyMw+r/nMDfER6nKVn4eJ jK1ifiRMxVPTNGTrCfAcxp0eo+i88QcVBKR8X9dek33vr4FwmiMYg17zQXdcaR0CEYWw wO0XCiSo8ukravbZh45fmLJyI99GrMjEdBgZGSWs6OqGrD1ukgfEyjofXBSwMlyBpmXY ekga/c13x0H/2p5r8rTOtMke5HTn+uMDEL3iiQLtd2XH79VvOIealjRIr+3/tgfRitsp PUpw== X-Gm-Message-State: APjAAAUSzcRzc+J29QkJhXhZUh9pISnOUcEg6519TK3nQUa6ZR6M84L0 Yy3tSvXZwPayJlx5bkjmMPA= X-Received: by 2002:a63:7515:: with SMTP id q21mr38542031pgc.63.1580918103541; Wed, 05 Feb 2020 07:55:03 -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.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 07:55:03 -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 05/15] NTB: return the side info status from amd_poll_link Date: Wed, 5 Feb 2020 21:24:22 +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 Bit 1 of SIDE_INFO register is an indication that the driver on the other side of link is ready. We set this bit during driver initialization sequence. So rather than having separate macros to return the status, we can simply return the status of this bit from amd_poll_link(). So a return of 1 or 0 from this function will indicate to the caller whether the driver on the other side of link is ready or not, respectively. Signed-off-by: Arindam Nath --- drivers/ntb/hw/amd/ntb_hw_amd.c | 11 +++++------ drivers/ntb/hw/amd/ntb_hw_amd.h | 2 -- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/ntb/hw/amd/ntb_hw_amd.c b/drivers/ntb/hw/amd/ntb_hw_amd.c index f50537e0917b..84723420d70b 100644 --- a/drivers/ntb/hw/amd/ntb_hw_amd.c +++ b/drivers/ntb/hw/amd/ntb_hw_amd.c @@ -246,7 +246,7 @@ static int amd_ntb_get_link_status(struct amd_ntb_dev *ndev) static int amd_link_is_up(struct amd_ntb_dev *ndev) { if (!ndev->peer_sta) - return NTB_LNK_STA_ACTIVE(ndev->cntl_sta); + return ndev->cntl_sta; if (ndev->peer_sta & AMD_LINK_UP_EVENT) { ndev->peer_sta = 0; @@ -896,16 +896,15 @@ static int amd_poll_link(struct amd_ntb_dev *ndev) u32 reg; reg = readl(mmio + AMD_SIDEINFO_OFFSET); - reg &= NTB_LIN_STA_ACTIVE_BIT; + reg &= AMD_SIDE_READY; dev_dbg(&ndev->ntb.pdev->dev, "%s: reg_val = 0x%x.\n", __func__, reg); - if (reg == ndev->cntl_sta) - return 0; - ndev->cntl_sta = reg; - return amd_ntb_get_link_status(ndev); + amd_ntb_get_link_status(ndev); + + return ndev->cntl_sta; } static void amd_link_hb(struct work_struct *work) diff --git a/drivers/ntb/hw/amd/ntb_hw_amd.h b/drivers/ntb/hw/amd/ntb_hw_amd.h index 39e5d18e12ff..156a4a92b803 100644 --- a/drivers/ntb/hw/amd/ntb_hw_amd.h +++ b/drivers/ntb/hw/amd/ntb_hw_amd.h @@ -53,10 +53,8 @@ #include #define AMD_LINK_HB_TIMEOUT msecs_to_jiffies(1000) -#define NTB_LIN_STA_ACTIVE_BIT 0x00000002 #define NTB_LNK_STA_SPEED_MASK 0x000F0000 #define NTB_LNK_STA_WIDTH_MASK 0x03F00000 -#define NTB_LNK_STA_ACTIVE(x) (!!((x) & NTB_LIN_STA_ACTIVE_BIT)) #define NTB_LNK_STA_SPEED(x) (((x) & NTB_LNK_STA_SPEED_MASK) >> 16) #define NTB_LNK_STA_WIDTH(x) (((x) & NTB_LNK_STA_WIDTH_MASK) >> 20) -- 2.17.1