Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp763553imu; Wed, 23 Jan 2019 05:21:21 -0800 (PST) X-Google-Smtp-Source: ALg8bN6OcbqC2tHGnIpbZHAFLxHIdA9VR0oPC+PPfkfINOOB2worSOpu21yIP4gq8DvMUiy+qgH6 X-Received: by 2002:a17:902:280b:: with SMTP id e11mr2177733plb.269.1548249681219; Wed, 23 Jan 2019 05:21:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548249681; cv=none; d=google.com; s=arc-20160816; b=hO3YewMMjN/8yUrVn24LfaE2RJBZda5Dj6m0d8ifH6nmVU+ix2E2s9pGhAaQj3Yx9f /sZuwOY4Sr9h9Yk7YNFeqb9ur06IFP0e6uY1Khf2KQDD3Br1iWb8Ozk7ZLeg6rmn7xYz 8mh9uz6lQT9dAoUwIYyVsBIUHvAg7Y0bSHXArjEJADvEGgQ5fWrvozZoxtPOwbNYjina D5TTKYQEMG9pmK62EECsyeBG07MewssbVyBLST9LanrmDs8lF4lW3zWB1lKWGIwruobA z9BYaSkhd51zfE33/UEysS73sESaZrygwU9bHj6JLCBa9333qUbkJPfMtrLEfSXCXSZ/ JkkA== 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:message-id:date :subject:cc:to:from:dkim-signature; bh=y7IiTSYYlGgYVlFk/LzudBlD3TUdLxmGnj3nQr8qGSI=; b=kYvCB01AUpNWcTCViTx7gkH6VU9rqb3GlVpaV/ya2U79UWXEq1xbXlu57tIjgQIWkX EJqxGtGVL5jgDop0czuzwxhrAf9KpBByDJThaaGXj4gL3EANn/HkcH5POGTZ9KpRU/9n uaIO3NRAp2M3AyHpbthOtgEu6wNlFDePethTDll3qy+gpwpWkVHa4ZSWYstU5aSbNIZ1 5Nq7rZHBDzzShO6dgkztfMCfy2531JcszWvJnruTsuzR9EcSkkmjAiZ0NuwGnfnbQJCh js+B4RufNNSvzLNxUZM81gOlvIbgPs3JrGYCLlA9b86qyydETKCSpqvIFimTXVmXlL/J sbCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jFXvnEsF; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z67si3974399pfb.268.2019.01.23.05.21.05; Wed, 23 Jan 2019 05:21:21 -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=pass header.i=@gmail.com header.s=20161025 header.b=jFXvnEsF; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726358AbfAWNSk (ORCPT + 99 others); Wed, 23 Jan 2019 08:18:40 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:33078 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725991AbfAWNSk (ORCPT ); Wed, 23 Jan 2019 08:18:40 -0500 Received: by mail-pg1-f196.google.com with SMTP id z11so1090653pgu.0; Wed, 23 Jan 2019 05:18:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=y7IiTSYYlGgYVlFk/LzudBlD3TUdLxmGnj3nQr8qGSI=; b=jFXvnEsFGWsPvxoAiipPwqMdnC2T9sguh/rvj7aznT5m2/tpON/hQA0PUHIBML/um4 HcBTK7uRqSmf9get99ewORFrNodT+Iy0x7xWw9FsRwdEkWrMSMBlB5WRJoI24PDi8RSR Ea3ltIjfV032J0gzXBzIyJIoSC3ZsLrVWRNDs51egcgoP2qwPVLY4ZytuZy40IluphuQ nyP0t+b8PoGaLQiNrQBVM9cjQ+H4a1qWG1Vavo4oZjak4leOkZykRJyMVrWnT8OAfru6 nTZD/akLeY4QYnU2pjXBD1c1iNgfu9rszd5v5GwMRTCAyQH4Bhn2yYyStDQLO0B2xgZ5 YHiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=y7IiTSYYlGgYVlFk/LzudBlD3TUdLxmGnj3nQr8qGSI=; b=t37OE+W5nZ+4g/OSvHu86pcUWtTfCwjaW+VY+B+zQGpBgYunNld8H/NAGZ3TtA3Tnd EMU8juePX8klnud0LwowQQt4d+oYIQdXtF4hoZA6yLwoxWrytujiUcIrxCduPooIx1TJ OqkZEoNylDOqWzWtvABQaJakU7feAcqTiio2CRAj5+wGpF3+jrG5BI/r07tSetWayKMq hf32L2kP9SpKymQbbqt221Aq5FxIu0vexVoujQY7AvYtCCV4NJQ7c9jsYYj183CHNk4z h/oUWgJqxbpsC1siWlxcdHCcxrer8L9MilRAnIPkVg8mOLyGiSCpER2UayVyfpR6outO dWbw== X-Gm-Message-State: AJcUukclomC+gHALPGjjenHaIhlhXge2FdiNkdnaFY9R58oxdmlF3cA9 L/X5DPHJEC7UJCt5hKCl2ozpng1Y X-Received: by 2002:a63:184a:: with SMTP id 10mr1913288pgy.81.1548249519576; Wed, 23 Jan 2019 05:18:39 -0800 (PST) Received: from hyd1358.caveonetworks.com. ([115.113.156.2]) by smtp.googlemail.com with ESMTPSA id r187sm64600381pfc.63.2019.01.23.05.18.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Jan 2019 05:18:39 -0800 (PST) From: sundeep.lkml@gmail.com To: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Cc: sean.stalley@intel.com, sgoutham@marvell.com, helgaas@kernel.org, Subbaraya Sundeep Subject: [v3 PATCH 2/2] PCI: assign bus numbers present in EA capability for bridges Date: Wed, 23 Jan 2019 18:48:01 +0530 Message-Id: <1548249481-24645-2-git-send-email-sundeep.lkml@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1548249481-24645-1-git-send-email-sundeep.lkml@gmail.com> References: <1548249481-24645-1-git-send-email-sundeep.lkml@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Subbaraya Sundeep As per the spec - ECN_Enhanced_Allocation_23_Oct_2014_Final and section 6.9.1.2, bridges with EA capability work with fixed secondary and subordinate bus numbers. Hence consider assigning bus numbers to bridges from EA if the capability exists during the scan. Signed-off-by: Subbaraya Sundeep --- v3: removed function for reading fixed bus numbers instead those were captured in pci_ea_init v2: None just added Sean drivers/pci/probe.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 257b9f6..9215e2e 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -1064,6 +1064,7 @@ static int pci_scan_bridge_extend(struct pci_bus *bus, struct pci_dev *dev, u16 bctl; u8 primary, secondary, subordinate; int broken = 0; + int next_busnr; /* * Make sure the bridge is powered on to be able to access config @@ -1163,17 +1164,21 @@ static int pci_scan_bridge_extend(struct pci_bus *bus, struct pci_dev *dev, /* Clear errors */ pci_write_config_word(dev, PCI_STATUS, 0xffff); + next_busnr = max + 1; + /* Fixed secondary bus number from EA capability */ + if (dev->fixed_sec_busnr) + next_busnr = dev->fixed_sec_busnr; /* * Prevent assigning a bus number that already exists. * This can happen when a bridge is hot-plugged, so in this * case we only re-scan this bus. */ - child = pci_find_bus(pci_domain_nr(bus), max+1); + child = pci_find_bus(pci_domain_nr(bus), next_busnr); if (!child) { - child = pci_add_new_bus(bus, dev, max+1); + child = pci_add_new_bus(bus, dev, next_busnr); if (!child) goto out; - pci_bus_insert_busn_res(child, max+1, + pci_bus_insert_busn_res(child, next_busnr, bus->busn_res.end); } max++; @@ -1234,7 +1239,13 @@ static int pci_scan_bridge_extend(struct pci_bus *bus, struct pci_dev *dev, max += i; } - /* Set subordinate bus number to its real value */ + /* + * Set subordinate bus number to its real value. + * If fixed subordinate bus number exists from EA + * capability then use it. + */ + if (dev->fixed_sub_busnr) + max = dev->fixed_sub_busnr; pci_bus_update_busn_res_end(child, max); pci_write_config_byte(dev, PCI_SUBORDINATE_BUS, max); } -- 1.8.3.1