From patchwork Wed Oct 16 20:28:31 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: 1178154 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 46tkQl1mBVz9sP3; Thu, 17 Oct 2019 07:28:47 +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 1iKpuU-0003OB-VZ; Wed, 16 Oct 2019 20:28:42 +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 1iKpuT-0003Na-HV for kernel-team@lists.ubuntu.com; Wed, 16 Oct 2019 20:28:41 +0000 Received: from mail-vs1-f70.google.com ([209.85.217.70]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1iKpuT-0000mB-96 for kernel-team@lists.ubuntu.com; Wed, 16 Oct 2019 20:28:41 +0000 Received: by mail-vs1-f70.google.com with SMTP id l2so3328763vsj.23 for ; Wed, 16 Oct 2019 13:28:41 -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=BXYT8Bk4aP7XJ7mvhZQvKJonNrduQbJfdFivMfoPEXU=; b=jX176Pp7ukxCsMTGFj8QDvSFoDBL9uSz/Jgzmqhvi634MxsLqOA0ymqsMu5W5yYZLh tz4GseRU3If1aa+Ax8PClq/vnvjsOTOgcBDUd7YZuddFQfoL+OjL2nWxTKt5gcChHrQ2 0AzOtg60kmzMjTPSf5CKtvfyCxQG7dTBdwJ3S7bbChlOjs1H2jJ8ZtUWM0QSkLGKPX0/ 5n/ijXV/Yc7zfF3PvkD/LNIMmaQ10GnshYBt5I2FOYdwn5L4FC0pMEOu0M5xnMnntllr D8N9/MU1nsqbAt20rVQASpe7VZHn4DSuQ6YEUIfqceHPRcO+fiTDLYu+pMQM7hbe+Sgh ChWg== X-Gm-Message-State: APjAAAVHV0/4yP771s2lX7PBGVV90tF5mE/w3uAQO79ukUB7plW1Ftlk 5D3DQk32Sx2wSLiH7f9NGa4MTF4VwmcPdNZlz/3UMoyZcM/HokgGomrJMKR4rfNdA2xD6OvSFqA N3wfWsKM02XaJyvq8JsHxtLs0torOZe2aNx1/yEJq X-Received: by 2002:ab0:3748:: with SMTP id i8mr161716uat.50.1571257719830; Wed, 16 Oct 2019 13:28:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqztfSniJwBBWG2Ul3Mwt1+Nsou8AVWxYpC7THvbkxN1Xt/iTciql86TeiRTHGxt9Z7S/DQANw== X-Received: by 2002:ab0:3748:: with SMTP id i8mr161702uat.50.1571257719493; Wed, 16 Oct 2019 13:28:39 -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.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2019 13:28:38 -0700 (PDT) From: Marcelo Henrique Cerri To: kernel-team@lists.ubuntu.com Subject: [disco:linux-azure][PATCH] PCI: hv: Use bytes 4 and 5 from instance ID as the PCI domain numbers Date: Wed, 16 Oct 2019 17:28:31 -0300 Message-Id: <20191016202831.7258-3-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/controller/pci-hyperv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c index 3bd94149b9d2..36b3c85f6574 100644 --- a/drivers/pci/controller/pci-hyperv.c +++ b/drivers/pci/controller/pci-hyperv.c @@ -2559,8 +2559,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; refcount_set(&hbus->remove_lock, 1);