From patchwork Tue Sep 14 14:59:21 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bounine, Alexandre" X-Patchwork-Id: 64708 X-Patchwork-Delegate: galak@kernel.crashing.org Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from bilbo.ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 5672710CD87 for ; Wed, 15 Sep 2010 01:14:35 +1000 (EST) Received: from mxout1.idt.com (mxout1.idt.com [157.165.5.25]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mxout1.idt.com", Issuer "idt.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id B6219B6EF0 for ; Wed, 15 Sep 2010 01:14:03 +1000 (EST) Received: from mail.idt.com (localhost [127.0.0.1]) by mxout1.idt.com (8.13.1/8.13.1) with ESMTP id o8EF2RI5014938; Tue, 14 Sep 2010 08:02:27 -0700 Received: from corpml1.corp.idt.com (corpml1.corp.idt.com [157.165.140.20]) by mail.idt.com (8.13.8/8.13.8) with ESMTP id o8EF2QAc000407; Tue, 14 Sep 2010 08:02:26 -0700 (PDT) Received: from corpvpnfw (localhost [127.0.0.1]) by corpml1.corp.idt.com (8.11.7p1+Sun/8.11.7) with SMTP id o8EF2QX16881; Tue, 14 Sep 2010 08:02:26 -0700 (PDT) Received: from atanerk.tundra.com ([10.1.0.17]) by corpvpnfw; Tue, 14 Sep 2010 15:02:23 +0000 (GMT) Received: from tomkin.tundra.com (tomkin [10.1.0.2]) by atanerk.tundra.com (8.13.6/8.13.6) with ESMTP id o8EF2MqO007244; Tue, 14 Sep 2010 11:02:22 -0400 (EDT) Received: from tomkin.tundra.com (localhost.localdomain [127.0.0.1]) by tomkin.tundra.com (8.13.1/8.13.1) with ESMTP id o8EF2HN8001830; Tue, 14 Sep 2010 11:02:17 -0400 Received: (from abounine@localhost) by tomkin.tundra.com (8.13.1/8.13.1/Submit) id o8EF2B1q001828; Tue, 14 Sep 2010 11:02:11 -0400 From: Alexandre Bounine To: akpm@linux-foundation.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH v2 08/10] RapidIO: Add device access check into the enumeration Date: Tue, 14 Sep 2010 10:59:21 -0400 Message-Id: <1284476363-1677-9-git-send-email-alexandre.bounine@idt.com> X-Mailer: git-send-email 1.7.0.5 In-Reply-To: <1284476363-1677-1-git-send-email-alexandre.bounine@idt.com> References: <1284476363-1677-1-git-send-email-alexandre.bounine@idt.com> X-Scanned-By: MIMEDefang 2.43 Cc: Alexandre Bounine , Thomas Moll X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Add explicit device access check before performing device enumeration. This gives a chance to clear possible link error conditions by issuing safe maintenance read request(s). Signed-off-by: Alexandre Bounine Cc: Thomas Moll Cc: Matt Porter Cc: Li Yang Cc: Kumar Gala Cc: Micha Nelissen --- drivers/rapidio/rio-scan.c | 6 ++++++ drivers/rapidio/rio.c | 2 +- drivers/rapidio/rio.h | 2 ++ 3 files changed, 9 insertions(+), 1 deletions(-) diff --git a/drivers/rapidio/rio-scan.c b/drivers/rapidio/rio-scan.c index d2ea018..e3efdf9 100644 --- a/drivers/rapidio/rio-scan.c +++ b/drivers/rapidio/rio-scan.c @@ -762,6 +762,12 @@ static int __devinit rio_enum_peer(struct rio_net *net, struct rio_mport *port, u16 destid; int tmp; + if (rio_mport_chk_dev_access(port, + RIO_ANY_DESTID(port->sys_size), hopcount)) { + pr_debug("RIO: device access check failed\n"); + return -1; + } + if (rio_get_host_deviceid_lock(port, hopcount) == port->host_deviceid) { pr_debug("RIO: PE already discovered by this host\n"); /* diff --git a/drivers/rapidio/rio.c b/drivers/rapidio/rio.c index aefc2a0..fa5e3cb 100644 --- a/drivers/rapidio/rio.c +++ b/drivers/rapidio/rio.c @@ -546,7 +546,7 @@ err_out: * @destid: Device destination ID in network * @hopcount: Number of hops into the network */ -static int +int rio_mport_chk_dev_access(struct rio_mport *mport, u16 destid, u8 hopcount) { int i = 0; diff --git a/drivers/rapidio/rio.h b/drivers/rapidio/rio.h index bc71ba1..d249a12 100644 --- a/drivers/rapidio/rio.h +++ b/drivers/rapidio/rio.h @@ -24,6 +24,8 @@ extern u32 rio_mport_get_physefb(struct rio_mport *port, int local, u16 destid, u8 hopcount); extern u32 rio_mport_get_efb(struct rio_mport *port, int local, u16 destid, u8 hopcount, u32 from); +extern int rio_mport_chk_dev_access(struct rio_mport *mport, u16 destid, + u8 hopcount); extern int rio_create_sysfs_dev_files(struct rio_dev *rdev); extern int rio_enum_mport(struct rio_mport *mport); extern int rio_disc_mport(struct rio_mport *mport);