From patchwork Mon Sep 8 21:19:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajat Jain X-Patchwork-Id: 4864751 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 649D09F371 for ; Mon, 8 Sep 2014 21:20:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8FFD420172 for ; Mon, 8 Sep 2014 21:20:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A6A4B20160 for ; Mon, 8 Sep 2014 21:20:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755291AbaIHVTd (ORCPT ); Mon, 8 Sep 2014 17:19:33 -0400 Received: from mail-pa0-f53.google.com ([209.85.220.53]:47159 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755256AbaIHVTc (ORCPT ); Mon, 8 Sep 2014 17:19:32 -0400 Received: by mail-pa0-f53.google.com with SMTP id rd3so3313410pab.40 for ; Mon, 08 Sep 2014 14:19:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :content-type:content-transfer-encoding; bh=Dlwa73/pyxknYXmqzsIv69DcTxbS2sS9qvj0zvJG2T4=; b=SyhpbyE2BreaFn8MH95ggwUC14eAM0k2ylR4fsOjWs5/ufWz0mOCi0/ART20fqjq4z Tm7mq/0GE8qE2Quc2nz78bsrviiwgtPh2EBoZNlyr3SGVqwqRsY8KtqEOerOcaiiKI5z 3L3xuHJyFGQz22uCp3Bj4FDBfGVXH8EGdfQVCeULbepveGasewDnhnDK+Ak/SxF3XB2B RXe59z0eTDknDuccBa7902EhjYbi+I3pZL3JNwvV57npzG5tCNxvApN2XnMjqerQsqKz HWv2cIfja1q9PJ3VHSxXVVaPsOH2X4T28QXw8rJMhDMlaDdmSmsfM4tBfuWSnNVKpJol AvYA== X-Received: by 10.68.136.232 with SMTP id qd8mr8530774pbb.162.1410211171634; Mon, 08 Sep 2014 14:19:31 -0700 (PDT) Received: from [192.168.95.130] ([66.129.239.12]) by mx.google.com with ESMTPSA id wc5sm2615511pab.2.2014.09.08.14.19.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 08 Sep 2014 14:19:31 -0700 (PDT) Message-ID: <540E1D75.5000500@gmail.com> Date: Mon, 08 Sep 2014 14:19:49 -0700 From: Rajat Jain User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130803 Thunderbird/17.0.8 MIME-Version: 1.0 To: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, bhelgaas@google.com CC: rajatjain@juniper.net, groeck@juniper.net Subject: [PATCH] pci/probe: Ignore the device id while handling CRS Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-9.3 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Some root ports may return the actual device id returned by the endpoint, instead of faking up a synthetic id (0xFFFF) as specified by the PCIe spec (sec 2.3.2). We have seen such broken devices in the past that match this behaviour: (Ref: https://lkml.org/lkml/2007/11/1/198) To take care of the same, CRS was disabled then, however, we want to enable CRS now (https://lkml.org/lkml/2014/9/2/509), but still do not want to break such devices. Thus check only against the (vendor id == 1) and ignore the device id. Signed-off-by: Rajat Jain Signed-off-by: Rajat Jain Signed-off-by: Guenter Roeck --- drivers/pci/probe.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 3c4c35c..0076a9b 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -1305,8 +1305,13 @@ bool pci_bus_read_dev_vendor_id(struct pci_bus *bus, int devfn, u32 *l, *l == 0x0000ffff || *l == 0xffff0000) return false; - /* Configuration request Retry Status */ - while (*l == 0xffff0001) { + /* + * Configuration request Retry Status. Note that some root ports + * are broken and may return actual device ID instead of a synthetic ID + * (0xFFFF) to be faked as per the PCIe spec. Hence ignore the device ID + * and only check for (vendor id == 1) + */ + while (*l & 0xffff == 0x0001) { if (!crs_timeout) return false;