From patchwork Wed Oct 16 20:28:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Henrique Cerri X-Patchwork-Id: 1178153 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46tkQj0qVHz9sNw; Thu, 17 Oct 2019 07:28:45 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1iKpuS-0003N5-Qp; Wed, 16 Oct 2019 20:28:40 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1iKpuR-0003Mc-It for kernel-team@lists.ubuntu.com; Wed, 16 Oct 2019 20:28:39 +0000 Received: from mail-vs1-f71.google.com ([209.85.217.71]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1iKpuR-0000m2-BS for kernel-team@lists.ubuntu.com; Wed, 16 Oct 2019 20:28:39 +0000 Received: by mail-vs1-f71.google.com with SMTP id y68so3343897vsy.13 for ; Wed, 16 Oct 2019 13:28:39 -0700 (PDT) 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=jBl12C23R3rxVdwvDsIqvIp0Pueitd1NP1t3nhWDW5w=; b=B7/FkLRPBrxHjMAjXGFYig45Xi+g9MvYbzVTFjY37AajmFhkgy0o/KPJek2c9Yyoyt j3ftRop4cpXXIpQb/PqRZpVlqhr1AGAYvF4ibtjDuf4u46SSDKL64PKAqx5U1S8Q5Z9W Av64ChQM0RD0nJUJ1yIjvUsxblYA+wYlEh69W4VjvNKTDtCCgTCxNGOlNnGRB5RgPQW3 ibrrpz1ZYbbZzzxfwEO1X8UVPAOFGf2rC/CjciS6bC85EahrlyCFpInxCzjxZjIK5j6f wOIQ4ZGJft7DVoRTCsX+lnw4Kpn75wqUzMh0I2kXTTayM5yoBrIOlCP7JQThbJfB122/ XUzQ== X-Gm-Message-State: APjAAAWIZ7gQapV8+vVqdYUzJu+PsDImgt2LyIRyOxnVVQHaLR5ABCqC abGSXHoTWc36u6l43C8PpWbuAyhAAipgIAzJt78quqWlelOXlCG1ynQnAc2wFj2buU/gT8c2uky YlL4kHAW8qR4gLvU6N984kTk4DJ7wT7NR67knbWAc X-Received: by 2002:a05:6102:22d1:: with SMTP id a17mr146694vsh.27.1571257718074; Wed, 16 Oct 2019 13:28:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqyeZz+ODZ7d2Iv5S+CbuEPKPwc3iQZLOmYURp7x30IiV5ZZ5BjsqzsMCna4bqX9++SExPGpYQ== X-Received: by 2002:a05:6102:22d1:: with SMTP id a17mr146673vsh.27.1571257717737; Wed, 16 Oct 2019 13:28:37 -0700 (PDT) Received: from gallifrey.lan ([2804:14c:4e6:443:8843:bead:68d0:8039]) by smtp.gmail.com with ESMTPSA id 206sm36899vkt.0.2019.10.16.13.28.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2019 13:28:36 -0700 (PDT) From: Marcelo Henrique Cerri To: kernel-team@lists.ubuntu.com Subject: [xenial:linux-azure][PATCH 1/1] PCI: hv: Use bytes 4 and 5 from instance ID as the PCI domain numbers Date: Wed, 16 Oct 2019 17:28:30 -0300 Message-Id: <20191016202831.7258-2-marcelo.cerri@canonical.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191016202831.7258-1-marcelo.cerri@canonical.com> References: <20191016202831.7258-1-marcelo.cerri@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Haiyang Zhang BugLink: https://bugs.launchpad.net/bugs/1847139 As recommended by Azure host team, the bytes 4, 5 have more uniqueness (info entropy) than bytes 8, 9 so use them as the PCI domain numbers. On older hosts, bytes 4, 5 can also be used -- no backward compatibility issues are introduced and the chance of collision is greatly reduced. In the rare cases of collision, the driver code detects and finds another number that is not in use. Suggested-by: Michael Kelley Signed-off-by: Haiyang Zhang Signed-off-by: Lorenzo Pieralisi Acked-by: Sasha Levin (cherry picked from commit f73f8a504e27959576a2f4d85182202561e426f2) [marcelo.cerri@canonical.com: adjustments due to the context difference] Signed-off-by: Marcelo Henrique Cerri --- drivers/pci/host/pci-hyperv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c index 088e73642bb8..04aab2dffe2b 100644 --- a/drivers/pci/host/pci-hyperv.c +++ b/drivers/pci/host/pci-hyperv.c @@ -2601,8 +2601,8 @@ static int hv_pci_probe(struct hv_device *hdev, * between domains derived from these instance IDs in the same * VM. */ - hbus->sysdata.domain = hdev->dev_instance.b[9] | - hdev->dev_instance.b[8] << 8; + hbus->sysdata.domain = hdev->dev_instance.b[4] | + hdev->dev_instance.b[5] << 8; hbus->hdev = hdev; atomic_inc(&hbus->remove_lock);