From patchwork Wed Mar 15 22:34:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Henrique Cerri X-Patchwork-Id: 739457 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 3vk5yS05KDz9s03; Thu, 16 Mar 2017 09:34:56 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical-com.20150623.gappssmtp.com header.i=@canonical-com.20150623.gappssmtp.com header.b="JAJmQH2n"; dkim-atps=neutral Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1coHVI-0001le-Vr; Wed, 15 Mar 2017 22:34:48 +0000 Received: from mail-qk0-f177.google.com ([209.85.220.177]) by huckleberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1coHVE-0001lO-FY for kernel-team@lists.ubuntu.com; Wed, 15 Mar 2017 22:34:44 +0000 Received: by mail-qk0-f177.google.com with SMTP id 1so25644715qkl.3 for ; Wed, 15 Mar 2017 15:34:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id; bh=LY/JfjLc4Tjn60fMSEvlfHNbOq0zKWqvukrjsndOHak=; b=JAJmQH2ncQWwP+GafMnsTS1Z8S3sCQPSINaqfbr+e/7YUg2rslPqH7BOtF2e0Qfx6e QjBa+qQirnYZ2AARDHi4SAvgr/5WpycamecentNpdUXthZvvBgE2Ih9btxvvUVcyzAf8 F71zR3X8fWt26ONhXpEyY5GKmAJdtkUlyNEuqyY8Sll2pYhXG6/E+Q+h9sTbTZClG7EU O+FK+LG19smLn+/+MAiSv4FGDh/uDtc5uu8g7zhXfHdvhQETodQKPON/T1KNUbTAjNtv HvUxnvci+iyavQgU1RETV7WuttX2PqL9kgEoPANLnQyXuhUX0KR2ObftQ2guf2b1+YTV 125g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=LY/JfjLc4Tjn60fMSEvlfHNbOq0zKWqvukrjsndOHak=; b=BLbB028yiRF8Bs4IgGYPtP2Vij1led1qy1WdvUfHOLZZFkcx/06RLUT1sc8B2hKbvV HmgDGREyiIwPPWSRjzsISrCO5V89/l6/EmCJ7HPpnC5NbCwHVBX1ULXoechEcbDhCA+l NNLPdM0at2nYUGMjdxVdAIgUgz7syIK/d0K494mLcBGHs2hh87f+kSiELX0A8h19j8dB Rv32lKOuHoBvVYRmZ1JGsu3uRQcf0VquIsM7wWeQe0YSbAouahyugIQamqenhMIhtD/r MIwKoyv9K3wX+c0ubcB6Ai8TXksKwB2nkl4ViNHCs9poXmtgGm1LXskTPYJmtGJBFvXp v34Q== X-Gm-Message-State: AFeK/H2DlacqsyyHv2h4X0vqLXMaQXSiXX9HRrhPXxzKBRvMUdRsbDm2ZciQnfKxB0LBbDoy X-Received: by 10.55.97.6 with SMTP id v6mr5686483qkb.80.1489617283151; Wed, 15 Mar 2017 15:34:43 -0700 (PDT) Received: from localhost.localdomain ([187.56.57.96]) by smtp.gmail.com with ESMTPSA id t25sm2260830qkl.29.2017.03.15.15.34.40 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 15 Mar 2017 15:34:41 -0700 (PDT) From: Marcelo Henrique Cerri To: kernel-team@lists.ubuntu.com Subject: [azure][PATCH] PCI: hv: Use device serial number as PCI domain Date: Wed, 15 Mar 2017 19:34:32 -0300 Message-Id: <1489617272-27135-1-git-send-email-marcelo.cerri@canonical.com> X-Mailer: git-send-email 2.7.4 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: kernel-team-bounces@lists.ubuntu.com From: Haiyang Zhang BugLink: https://bugs.launchpad.net/bugs/1670544 Use the device serial number as the PCI domain. The serial numbers start with 1 and are unique within a VM. So names, such as VF NIC names, that include domain number as part of the name, can be shorter than that based on part of bus UUID previously. The new names will also stay same for VMs created with copied VHD and same number of devices. Signed-off-by: Haiyang Zhang Signed-off-by: Stephen Hemminger Signed-off-by: Bjorn Helgaas Reviewed-by: K. Y. Srinivasan (cherry picked from commit 4a9b0933bdfcd85da840284bf5a0eb17b654b9c2) Signed-off-by: Marcelo Henrique Cerri --- All the commits in 4.9 and 4.10 are already included since the azure kernel is based on zesty. From the remaining commits, one was sauced for zesty and this commit applies cleanly from upstream. drivers/pci/host/pci-hyperv.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c index d096237f9591..a679b6acb438 100644 --- a/drivers/pci/host/pci-hyperv.c +++ b/drivers/pci/host/pci-hyperv.c @@ -1320,6 +1320,18 @@ static struct hv_pci_dev *new_pcichild_device(struct hv_pcibus_device *hbus, get_pcichild(hpdev, hv_pcidev_ref_initial); 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;