From patchwork Mon Sep 8 17:03:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Murali Karicheri X-Patchwork-Id: 37013 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f198.google.com (mail-ie0-f198.google.com [209.85.223.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A3D8B20491 for ; Mon, 8 Sep 2014 17:03:42 +0000 (UTC) Received: by mail-ie0-f198.google.com with SMTP id tp5sf7498811ieb.9 for ; Mon, 08 Sep 2014 10:03:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :mime-version:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe:content-type; bh=DDKgTyPdGh8CPFInDE0CPM20WYvT6PSkFH8UkWcJj24=; b=cWavYHHkfMMEKiPLxv+ARruXLPJgnTL89UWwq0sB+Akui1Mirfr3P5geFYxi4X5eF0 /gTXxseKBiQbiuJPJrLugq7Ll9BaNPD9s6iBsG1o3UpN4T8CP0k7h89PRHenP4aa0eJt mV1ZJQYzmet6sv7Ym3Auu1b7RpuVHG+DhLeyKGcWaV3DViqfJQmreV9ZcDpknhmevgX/ wJAafS6AgRYA2qfu89P5g/fzf5+Ddz09CIDRwk20qcMyRMPZqX6XPHUkZQFYU5AT4BW8 FGZsmcNM1zYLHeF0KPn5356CUM18f1RZ7LGs8U1NQAbh9ShjaWJD5uM3GgiTyO+/wt3i YP7Q== X-Gm-Message-State: ALoCoQm61Y8blQTOz7X6OvGy6y+yZ+R2Vhlg1iR1UKV2nNi7wQyJn+jtnQojg+XfnoMplLH/10G7 X-Received: by 10.182.199.4 with SMTP id jg4mr18352574obc.43.1410195822264; Mon, 08 Sep 2014 10:03:42 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.93.34 with SMTP id c31ls1738143qge.92.gmail; Mon, 08 Sep 2014 10:03:42 -0700 (PDT) X-Received: by 10.52.33.231 with SMTP id u7mr1320362vdi.54.1410195822117; Mon, 08 Sep 2014 10:03:42 -0700 (PDT) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by mx.google.com with ESMTPS id vx5si4183923vcb.0.2014.09.08.10.03.42 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 08 Sep 2014 10:03:42 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.171 as permitted sender) client-ip=209.85.220.171; Received: by mail-vc0-f171.google.com with SMTP id id10so15674586vcb.16 for ; Mon, 08 Sep 2014 10:03:42 -0700 (PDT) X-Received: by 10.52.145.204 with SMTP id sw12mr773504vdb.79.1410195822007; Mon, 08 Sep 2014 10:03:42 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.45.67 with SMTP id uj3csp164050vcb; Mon, 8 Sep 2014 10:03:41 -0700 (PDT) X-Received: by 10.69.20.43 with SMTP id gz11mr6925225pbd.150.1410195821001; Mon, 08 Sep 2014 10:03:41 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id mm9si12571766pbc.141.2014.09.08.10.03.39 for ; Mon, 08 Sep 2014 10:03:40 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754818AbaIHRDi (ORCPT + 26 others); Mon, 8 Sep 2014 13:03:38 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:34395 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754306AbaIHRDg (ORCPT ); Mon, 8 Sep 2014 13:03:36 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id s88H3At0016774; Mon, 8 Sep 2014 12:03:10 -0500 Received: from DLEE70.ent.ti.com (dlemailx.itg.ti.com [157.170.170.113]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s88H3Afb016074; Mon, 8 Sep 2014 12:03:10 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.174.1; Mon, 8 Sep 2014 12:03:09 -0500 Received: from localhost.localdomain (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s88H39xg018440; Mon, 8 Sep 2014 12:03:09 -0500 From: Murali Karicheri To: , , , , CC: Murali Karicheri Subject: [PATCH - v4] PCI: keystone: add a pci quirk to limit mrrs Date: Mon, 8 Sep 2014 13:03:34 -0400 Message-ID: <1410195814-30414-1-git-send-email-m-karicheri2@ti.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: m-karicheri2@ti.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.171 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Keystone PCI controller has a limitation that memory read request size must not exceed 256 bytes. This is a hardware limitation and add a quirk to force this limit on all downstream devices by updating mrrs. Signed-off-by: Murali Karicheri --- -v4: re-send removing extra lines -v3: added check for vendor id and use pci_matc_id() to do matching -v2: made the quirk happens after tuning -v1: changed printk to indicate PCI bdf drivers/pci/host/pci-keystone.c | 45 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/drivers/pci/host/pci-keystone.c b/drivers/pci/host/pci-keystone.c index c1cfaef..ff8ed25 100644 --- a/drivers/pci/host/pci-keystone.c +++ b/drivers/pci/host/pci-keystone.c @@ -42,8 +42,53 @@ /* DEV_STAT_CTRL */ #define PCIE_CAP_BASE 0x70 +/* PCIE controller device IDs */ +#define PCIE_RC_K2HK 0xb008 +#define PCIE_RC_K2E 0xb009 +#define PCIE_RC_K2L 0xb00a + #define to_keystone_pcie(x) container_of(x, struct keystone_pcie, pp) +static void quirk_limit_mrrs(struct pci_dev *dev) +{ + struct pci_bus *bus = dev->bus; + struct pci_dev *bridge = bus->self; + static const struct pci_device_id rc_pci_devids[] = { + { PCI_DEVICE(PCI_VENDOR_ID_TI, PCIE_RC_K2HK), + .class = PCI_CLASS_BRIDGE_PCI << 8, .class_mask = ~0, }, + { PCI_DEVICE(PCI_VENDOR_ID_TI, PCIE_RC_K2E), + .class = PCI_CLASS_BRIDGE_PCI << 8, .class_mask = ~0, }, + { PCI_DEVICE(PCI_VENDOR_ID_TI, PCIE_RC_K2L), + .class = PCI_CLASS_BRIDGE_PCI << 8, .class_mask = ~0, }, + { 0, }, + }; + + if (pci_is_root_bus(bus)) + return; + + /* look for the host bridge */ + while (!pci_is_root_bus(bus)) { + bridge = bus->self; + bus = bus->parent; + } + + if (bridge) { + /* + * Keystone PCI controller has a h/w limitation of + * 256 bytes maximum read request size. It can't handle + * anything higher than this. So force this limit on + * all downstream devices + */ + if (pci_match_id(rc_pci_devids, bridge)) { + if (pcie_get_readrq(dev) > 256) { + dev_info(&dev->dev, "limiting mrrs to 256\n"); + pcie_set_readrq(dev, 256); + } + } + } +} +DECLARE_PCI_FIXUP_ENABLE(PCI_ANY_ID, PCI_ANY_ID, quirk_limit_mrrs); + static int ks_pcie_establish_link(struct keystone_pcie *ks_pcie) { struct pcie_port *pp = &ks_pcie->pp;