Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1627665 > unrolled thread

[PATCH] pci-hyperv: Use only 16 bit integer for PCI domain

Started byHaiyang Zhang <haiyangz@exchange.microsoft.com>
First post2017-04-20 18:40 +0200
Last post2017-04-20 20:40 +0200
Articles 4 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] pci-hyperv: Use only 16 bit integer for PCI domain Haiyang Zhang <haiyangz@exchange.microsoft.com> - 2017-04-20 18:40 +0200
    RE: [PATCH] pci-hyperv: Use only 16 bit integer for PCI domain Haiyang Zhang <haiyangz@microsoft.com> - 2017-04-20 20:40 +0200
      Re: [PATCH] pci-hyperv: Use only 16 bit integer for PCI domain Christoph Hellwig <hch@infradead.org> - 2017-04-20 21:20 +0200
    Re: [PATCH] pci-hyperv: Use only 16 bit integer for PCI domain Bjorn Helgaas <bhelgaas@google.com> - 2017-04-20 20:40 +0200

#1627665 — [PATCH] pci-hyperv: Use only 16 bit integer for PCI domain

FromHaiyang Zhang <haiyangz@exchange.microsoft.com>
Date2017-04-20 18:40 +0200
Subject[PATCH] pci-hyperv: Use only 16 bit integer for PCI domain
Message-ID<tynhE-2OS-19@gated-at.bofh.it>
From: Haiyang Zhang <haiyangz@microsoft.com>

This patch uses the lower 16 bits of the serial number as PCI
domain, otherwise some drivers may not be able to handle it.

Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
---
 drivers/pci/host/pci-hyperv.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c
index e73880c..b18dff3 100644
--- a/drivers/pci/host/pci-hyperv.c
+++ b/drivers/pci/host/pci-hyperv.c
@@ -1334,9 +1334,11 @@ static void put_pcichild(struct hv_pci_dev *hpdev,
 	 * 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.
+	 * The lower 16 bits of the serial number is used, otherwise some
+	 * drivers may not be able to handle it.
 	 */
 	if (list_empty(&hbus->children))
-		hbus->sysdata.domain = desc->ser;
+		hbus->sysdata.domain = desc->ser & 0xFFFF;
 	list_add_tail(&hpdev->list_entry, &hbus->children);
 	spin_unlock_irqrestore(&hbus->device_list_lock, flags);
 	return hpdev;
-- 
1.7.1

[toc] | [next] | [standalone]


#1627736

FromHaiyang Zhang <haiyangz@microsoft.com>
Date2017-04-20 20:40 +0200
Message-ID<typ9L-3Yq-7@gated-at.bofh.it>
In reply to#1627665
> -----Original Message-----
> From: Bjorn Helgaas [mailto:bhelgaas@google.com]
> Sent: Thursday, April 20, 2017 2:33 PM
> To: Haiyang Zhang <haiyangz@microsoft.com>
> Cc: linux-pci@vger.kernel.org; KY Srinivasan <kys@microsoft.com>;
> Stephen Hemminger <sthemmin@microsoft.com>; olaf@aepfle.de;
> vkuznets@redhat.com; driverdev-devel@linuxdriverproject.org; linux-
> kernel@vger.kernel.org
> Subject: Re: [PATCH] pci-hyperv: Use only 16 bit integer for PCI domain
> 
> On Thu, Apr 20, 2017 at 11:35 AM, Haiyang Zhang
> <haiyangz@exchange.microsoft.com> wrote:
> > From: Haiyang Zhang <haiyangz@microsoft.com>
> >
> > This patch uses the lower 16 bits of the serial number as PCI
> > domain, otherwise some drivers may not be able to handle it.
> 
> Can you give any more details about this?  Which drivers, for
> instance?  Why do drivers care about the domain at all?  Can we or
> should we make this more explicit and consistent in the PCI core,
> e.g., pci_domain_nr() is currently defined to return "int"; maybe it
> should be u32?  (Although I think "int" is the same size as "u32" on
> all arches anyway).

It's Nvidia driver.

Piotr, could you explain why the driver expects 16 bit domain number?

Thanks,
- Haiyang

[toc] | [prev] | [next] | [standalone]


#1627758

FromChristoph Hellwig <hch@infradead.org>
Date2017-04-20 21:20 +0200
Message-ID<typMu-4rW-19@gated-at.bofh.it>
In reply to#1627736
On Thu, Apr 20, 2017 at 06:37:35PM +0000, Haiyang Zhang wrote:
> It's Nvidia driver.

Which of the many nvidia drivers in the tree?  Just fix it instead of
coming up with stupid workarounds like this.

[toc] | [prev] | [next] | [standalone]


#1627737

FromBjorn Helgaas <bhelgaas@google.com>
Date2017-04-20 20:40 +0200
Message-ID<typ9L-3Yq-9@gated-at.bofh.it>
In reply to#1627665
On Thu, Apr 20, 2017 at 11:35 AM, Haiyang Zhang
<haiyangz@exchange.microsoft.com> wrote:
> From: Haiyang Zhang <haiyangz@microsoft.com>
>
> This patch uses the lower 16 bits of the serial number as PCI
> domain, otherwise some drivers may not be able to handle it.

Can you give any more details about this?  Which drivers, for
instance?  Why do drivers care about the domain at all?  Can we or
should we make this more explicit and consistent in the PCI core,
e.g., pci_domain_nr() is currently defined to return "int"; maybe it
should be u32?  (Although I think "int" is the same size as "u32" on
all arches anyway).

> Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
> ---
>  drivers/pci/host/pci-hyperv.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c
> index e73880c..b18dff3 100644
> --- a/drivers/pci/host/pci-hyperv.c
> +++ b/drivers/pci/host/pci-hyperv.c
> @@ -1334,9 +1334,11 @@ static void put_pcichild(struct hv_pci_dev *hpdev,
>          * 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.
> +        * The lower 16 bits of the serial number is used, otherwise some
> +        * drivers may not be able to handle it.
>          */
>         if (list_empty(&hbus->children))
> -               hbus->sysdata.domain = desc->ser;
> +               hbus->sysdata.domain = desc->ser & 0xFFFF;
>         list_add_tail(&hpdev->list_entry, &hbus->children);
>         spin_unlock_irqrestore(&hbus->device_list_lock, flags);
>         return hpdev;
> --
> 1.7.1
>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web