From patchwork Mon Mar 26 17:34:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sridhar Pitchai X-Patchwork-Id: 891146 X-Patchwork-Delegate: lorenzo.pieralisi@arm.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=reject dis=none) header.from=microsoft.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=microsoft.com header.i=@microsoft.com header.b="iVdIY/XH"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 4091Tv2QB8z9s21 for ; Tue, 27 Mar 2018 04:34:11 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752596AbeCZReJ (ORCPT ); Mon, 26 Mar 2018 13:34:09 -0400 Received: from mail-bl2nam02on0105.outbound.protection.outlook.com ([104.47.38.105]:19376 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752131AbeCZReI (ORCPT ); Mon, 26 Mar 2018 13:34:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=hXKHELCXr9FGriJk7YWse668SRMuusoNbvY9TSD4o80=; b=iVdIY/XHB+Xl1qZ3frDXcfN1CU/2BQ6ewf7GCjkyvyHlvRnyf036UoqMnUB39eu32ly3fZ44rRsFkjssvIBLo8DMgOdMKug8NqLOQj7vU4V+GHI/ZK2cU4myD+Mgd/mnl4ceU52YLG7+vmNH5FTpghA7pexxrg8NlaMx+ra2iA4= Received: from DM5PR21MB0826.namprd21.prod.outlook.com (10.173.172.8) by DM5PR21MB0505.namprd21.prod.outlook.com (10.172.91.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.653.1; Mon, 26 Mar 2018 17:34:05 +0000 Received: from DM5PR21MB0826.namprd21.prod.outlook.com ([fe80::792b:8ed4:b80a:60ff]) by DM5PR21MB0826.namprd21.prod.outlook.com ([fe80::792b:8ed4:b80a:60ff%2]) with mapi id 15.20.0653.001; Mon, 26 Mar 2018 17:34:05 +0000 From: Sridhar Pitchai To: Lorenzo Pieralisi , Haiyang Zhang , Stephen Hemminger CC: Bjorn Helgaas , Jake Oshins , Dexuan Cui , KY Srinivasan , "Michael Kelley (EOSG)" , "devel@linuxdriverproject.org" , "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: [PATCH v5] PCI: hv: Make sure the bus domain is really unique Thread-Topic: [PATCH v5] PCI: hv: Make sure the bus domain is really unique Thread-Index: AQHTxSijoP6WPdZS9U+Gegx1alv9bg== Date: Mon, 26 Mar 2018 17:34:04 +0000 Message-ID: <4BF97B43-5339-4750-9704-23D6AAC4A01E@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [2001:4898:80e8:2::57b] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DM5PR21MB0505; 7:0HEhiJZoQYHciQ7Hsm3oViFG0jaemVCPKy1pljrocAz6SvztunOM1UBY6YBv92p3ZQ/Ao8y5PK/YSUML/zd46D+kzjcMuZxYRSVX5xQXOJ5eQcc7AOJ1uuvNCjsIiAyqi0iOQPYVyt/GSbwY+Uw34ACzISNjsGGF+fSSiz3YmCJxf+mV+E0Kuk1c9oyDMoxFVv4Qz25vjv+ynTxtLPMMRwygmw4IKq7mO2ZMiyjNc0ydEhXv5EzlwnNRnHwTrq+D; 20:qsQpaQMWaiREZwZR4AdPVBHTXnhFv6ubJdO6TADOKy17MjMhaeuNBWCrERkTHYBOmKx1LsdWwVyggo8OHT6JcsEfzEFd6tvNb31YWwE5maRFhAy8hIbKFTMQ28+HrHZv8FOmksPsUdFPXb1kZmHt28C9YLJU2zYNyGL07d9qtUI= x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: c59d6fb6-7a58-4234-45e9-08d5933fc5b5 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020); SRVR:DM5PR21MB0505; x-ms-traffictypediagnostic: DM5PR21MB0505: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(9452136761055); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(61425038)(6040522)(2401047)(5005006)(8121501046)(3231221)(944501327)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123564045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011); SRVR:DM5PR21MB0505; BCL:0; PCL:0; RULEID:; SRVR:DM5PR21MB0505; x-forefront-prvs: 06237E4555 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39860400002)(39380400002)(396003)(366004)(346002)(376002)(189003)(199004)(40224003)(81156014)(6116002)(106356001)(6346003)(8676002)(10290500003)(102836004)(2900100001)(97736004)(6506007)(53936002)(2906002)(54906003)(68736007)(22452003)(83716003)(486005)(486005)(10090500001)(86362001)(6436002)(59450400001)(110136005)(3280700002)(105586002)(2616005)(186003)(99286004)(478600001)(8936002)(72206003)(6486002)(33656002)(5250100002)(25786009)(82746002)(6512007)(5660300001)(36756003)(46003)(305945005)(6636002)(86612001)(14454004)(4326008)(316002)(7736002)(81166006)(1511001)(476003)(3660700001)(22906009); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR21MB0505; H:DM5PR21MB0826.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Sridhar.Pitchai@microsoft.com; x-microsoft-antispam-message-info: wTzRVhcUTrZKzQesBFx9+2G/c4wrv5UMvbBayxS7ONczPHrB6rL4h8bFtnU5k/pmEnR8CYJEA0s1plMnkQOU4vuOHitv7pcpqLbkK2JOS07eQ3oqEJspOy207PJITUf9Ui4lqgMqOlWGWU6WEVB25ncS8TG4beWr1oty92w42qJ/C19oBK9oTUXpj+4JayQgHy2SEMtTHfTOnE+SkMMCsGig8UcW6EmIbec8WoZ4Q0Wmr1eFp+thggbnVLkrvvmyq9MrYUQAwp7TG0iQw09Kjdn3vkL/Bw21DqXZK+9gVGwu7S4zgdplEk2NPrDm4qKFBSQIzpBSL1b6dm04TBj10g== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-ID: MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: c59d6fb6-7a58-4234-45e9-08d5933fc5b5 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Mar 2018 17:34:04.9815 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR21MB0505 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org When Linux runs as a guest VM in Hyper-V and Hyper-V adds the virtual PCI bus to the guest, Hyper-V always provides unique PCI domain. commit 4a9b0933bdfc ("PCI: hv: Use device serial number as PCI domain") overrode unique domain with the serial number of the first device added to the virtual PCI bus. The reason for that patch is to have a consistent and short name for the device. But commit 4a9b0933bdfc ("PCI: hv: Use device serial number as PCI domain") will not guarantee unique domain id. For example, if the serial number of the device is 0 and there exists a PCI bus with domain 0 already, this will cause the PCI bus registration with kernel fails. commit 4a9b0933bdfc ("PCI: hv: Use device serial number as PCI domain") need to be reverted. Also, we no longer need it as commit 4a1626dd233e ("netvsc: transparent VF management") remove the need for it. Revert commit 4a9b0933bdfc ("PCI: hv: Use device serial number as PCI domain") so we can reliably support multiple devices being assigned to a guest. This revert should only be backported to kernels that contain commit 4a1626dd233e ("netvsc: transparent VF management"). Fixes: 4a9b0933bdfc ("PCI: hv: Use device serial number as PCI domain") Signed-off-by: Sridhar Pitchai Cc: stable@vger.kernel.org --- Changes in v5: * fix the commit comment. [Lorenzo Pieralisi, Bjorn Helgaas] * fixed the patch white space. --- drivers/pci/host/pci-hyperv.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c index 2faf38eab785..ac67e56e451a 100644 --- a/drivers/pci/host/pci-hyperv.c +++ b/drivers/pci/host/pci-hyperv.c @@ -1518,17 +1518,6 @@ static struct hv_pci_dev *new_pcichild_device(struct hv_pcibus_device *hbus, get_pcichild(hpdev, hv_pcidev_ref_childlist); spin_lock_irqsave(&hbus->device_list_lock, flags); - /* - * When a device is being added to the bus, we set the PCI domain - * number to be the device serial number, which is non-zero and - * unique on the same VM. The serial numbers start with 1, and - * increase by 1 for each device. So device names including this - * can have shorter names than based on the bus instance UUID. - * Only the first device serial number is used for domain, so the - * domain number will not change after the first device is added. - */ - if (list_empty(&hbus->children)) - hbus->sysdata.domain = desc->ser; list_add_tail(&hpdev->list_entry, &hbus->children); spin_unlock_irqrestore(&hbus->device_list_lock, flags); return hpdev;