Re: [PATCH v2 4/5] PCI: generic: Correct, and avoid overflow, in bus_max calculation.

2015-09-23 Thread Arnd Bergmann
On Wednesday 23 September 2015 20:35:45 Will Deacon wrote: > On Wed, Sep 23, 2015 at 08:27:41PM +0100, Arnd Bergmann wrote: > > On Wednesday 23 September 2015 11:21:56 David Daney wrote: > > > >> > > > >> /* Limit the bus-range to fit within reg */ > > > >> -bus_max =

Re: [PATCH v2 4/5] PCI: generic: Correct, and avoid overflow, in bus_max calculation.

2015-09-23 Thread Will Deacon
On Wed, Sep 23, 2015 at 08:39:27PM +0100, Arnd Bergmann wrote: > On Wednesday 23 September 2015 20:35:45 Will Deacon wrote: > > On Wed, Sep 23, 2015 at 08:27:41PM +0100, Arnd Bergmann wrote: > > > On Wednesday 23 September 2015 11:21:56 David Daney wrote: > > > > >> > > > > >> /* Limit the

Re: [PATCH v2 4/5] PCI: generic: Correct, and avoid overflow, in bus_max calculation.

2015-09-23 Thread Will Deacon
On Wed, Sep 23, 2015 at 07:21:56PM +0100, David Daney wrote: > On 09/23/2015 11:01 AM, Will Deacon wrote: > > On Thu, Sep 17, 2015 at 11:02:11PM +0100, David Daney wrote: > [...] > > > >> Properties of the /chosen node: > >> diff --git a/drivers/pci/host/pci-host-generic.c > >>

Re: [PATCH v2 4/5] PCI: generic: Correct, and avoid overflow, in bus_max calculation.

2015-09-23 Thread Will Deacon
On Thu, Sep 17, 2015 at 11:02:11PM +0100, David Daney wrote: > From: David Daney > > There are two problems with the bus_max calculation: > > 1) The u8 data type can overflow for large config space windows. > > 2) The calculation is incorrect for a bus range that

Re: [PATCH v2 4/5] PCI: generic: Correct, and avoid overflow, in bus_max calculation.

2015-09-23 Thread David Daney
On 09/23/2015 11:01 AM, Will Deacon wrote: On Thu, Sep 17, 2015 at 11:02:11PM +0100, David Daney wrote: [...] Properties of the /chosen node: diff --git a/drivers/pci/host/pci-host-generic.c b/drivers/pci/host/pci-host-generic.c index 77cf4bd..0a9c453 100644 ---

Re: [PATCH v2 4/5] PCI: generic: Correct, and avoid overflow, in bus_max calculation.

2015-09-23 Thread Arnd Bergmann
On Wednesday 23 September 2015 11:21:56 David Daney wrote: > >> > >> /* Limit the bus-range to fit within reg */ > >> -bus_max = pci->cfg.bus_range->start + > >> - (resource_size(>cfg.res) >> pci->cfg.ops.bus_shift) - > >> 1; > >> +bus_max = (resource_size(>cfg.res) >>

Re: [PATCH v2 4/5] PCI: generic: Correct, and avoid overflow, in bus_max calculation.

2015-09-23 Thread Will Deacon
On Wed, Sep 23, 2015 at 08:27:41PM +0100, Arnd Bergmann wrote: > On Wednesday 23 September 2015 11:21:56 David Daney wrote: > > >> > > >> /* Limit the bus-range to fit within reg */ > > >> -bus_max = pci->cfg.bus_range->start + > > >> - (resource_size(>cfg.res) >>

Re: [PATCH v2 4/5] PCI: generic: Correct, and avoid overflow, in bus_max calculation.

2015-09-23 Thread Arnd Bergmann
On Wednesday 23 September 2015 21:39:27 Arnd Bergmann wrote: > On Wednesday 23 September 2015 20:35:45 Will Deacon wrote: > > > > From what Lorenzo was saying, ACPI shares the interpretation that David is > > implementing here and, given that the DT version seems to be subjective, > > aligning

[PATCH v2 4/5] PCI: generic: Correct, and avoid overflow, in bus_max calculation.

2015-09-17 Thread David Daney
From: David Daney There are two problems with the bus_max calculation: 1) The u8 data type can overflow for large config space windows. 2) The calculation is incorrect for a bus range that doesn't start at zero. Since the configuration space is relative to bus zero,