Re: [PATCH] efi/fb: Convert PCI bus address to resource if translated by the bridge

2018-06-20 Thread Sinan Kaya
Hi Bjorn, On 6/19/2018 5:59 PM, Bjorn Helgaas wrote: > On Fri, May 18, 2018 at 10:20:29AM -0400, Sinan Kaya wrote: >> On 5/18/2018 6:42 AM, Robin Murphy wrote: >>> >>> FWIW, now that I've actually gone and looked, it appears you could simplify >>> the whole function quite a bit by getting rid of

Re: [PATCH] efi/fb: Convert PCI bus address to resource if translated by the bridge

2018-06-19 Thread Bjorn Helgaas
On Fri, May 18, 2018 at 10:20:29AM -0400, Sinan Kaya wrote: > On 5/18/2018 6:42 AM, Robin Murphy wrote: > > > > FWIW, now that I've actually gone and looked, it appears you could simplify > > the whole function quite a bit by getting rid of these and just using the > > new local resource directl

Re: [PATCH] efi/fb: Convert PCI bus address to resource if translated by the bridge

2018-05-21 Thread Sinan Kaya
On 5/18/2018 6:42 AM, Robin Murphy wrote: > > FWIW, now that I've actually gone and looked, it appears you could simplify > the whole function quite a bit by getting rid of these and just using the new > local resource directly, especially since the only actual use of size is an > open-coded re

Re: [PATCH] efi/fb: Convert PCI bus address to resource if translated by the bridge

2018-05-18 Thread Robin Murphy
On 17/05/18 14:22, Sinan Kaya wrote: A host bridge is allowed to remap BAR addresses using _TRA attribute in _CRS windows. pci_bus :00: root bus resource [mem 0x8010010-0x8011fff window] (bus address [0x0010-0x1fff]) pci :02:00.0: reg 0x10: [mem 0x8011e00-0x8011e

Re: [PATCH] efi/fb: Convert PCI bus address to resource if translated by the bridge

2018-05-18 Thread Ard Biesheuvel
On 17 May 2018 at 16:55, Peter Jones wrote: > On Thu, May 17, 2018 at 09:22:23AM -0400, Sinan Kaya wrote: >> A host bridge is allowed to remap BAR addresses using _TRA attribute in >> _CRS windows. >> >> pci_bus :00: root bus resource [mem 0x8010010-0x8011fff window] >> (bus address [

Re: [RFC PATCH] efi/fb: Convert PCI bus address to resource if translated by the bridge

2018-05-18 Thread Sinan Kaya
On 5/17/2018 6:17 AM, Robin Murphy wrote: >> +    } >> + > > Is this not pretty much just pcibios_bus_to_resource()? > Agreed, let me convert the code to use pcibios_bus_to_resource() API. I wasn't aware of its existence. > Robin. -- Sinan Kaya Qualcomm Datacenter Technologies, Inc. as an af

[PATCH] efi/fb: Convert PCI bus address to resource if translated by the bridge

2018-05-18 Thread Sinan Kaya
A host bridge is allowed to remap BAR addresses using _TRA attribute in _CRS windows. pci_bus :00: root bus resource [mem 0x8010010-0x8011fff window] (bus address [0x0010-0x1fff]) pci :02:00.0: reg 0x10: [mem 0x8011e00-0x8011eff] When a VGA device is behind such a

Re: [PATCH] efi/fb: Convert PCI bus address to resource if translated by the bridge

2018-05-17 Thread Peter Jones
On Thu, May 17, 2018 at 09:22:23AM -0400, Sinan Kaya wrote: > A host bridge is allowed to remap BAR addresses using _TRA attribute in > _CRS windows. > > pci_bus :00: root bus resource [mem 0x8010010-0x8011fff window] > (bus address [0x0010-0x1fff]) > pci :02:00.0: reg 0x1

Re: [RFC PATCH] efi/fb: Convert PCI bus address to resource if translated by the bridge

2018-05-17 Thread Robin Murphy
On 16/05/18 19:23, Sinan Kaya wrote: A host bridge is allowed to remap BAR addresses using _TRA attribute in _CRS windows. pci_bus :00: root bus resource [mem 0x8010010-0x8011fff window] (bus address [0x0010-0x1fff]) pci :02:00.0: reg 0x10: [mem 0x8011e00-0x8011e

Re: [RFC PATCH] efi/fb: Convert PCI bus address to resource if translated by the bridge

2018-05-17 Thread Sinan Kaya
On 5/16/2018 2:31 PM, Timur Tabi wrote: > On 05/16/2018 01:23 PM, Sinan Kaya wrote: >> +    win_start = window->res->start - window->offset; > > Can you guarantee that window->res->start is always >= window->offset? > Resource offset is generally 0 when not translating or a positive number t

[RFC PATCH] efi/fb: Convert PCI bus address to resource if translated by the bridge

2018-05-17 Thread Sinan Kaya
A host bridge is allowed to remap BAR addresses using _TRA attribute in _CRS windows. pci_bus :00: root bus resource [mem 0x8010010-0x8011fff window] (bus address [0x0010-0x1fff]) pci :02:00.0: reg 0x10: [mem 0x8011e00-0x8011eff] When a VGA device is behind such a

Re: [RFC PATCH] efi/fb: Convert PCI bus address to resource if translated by the bridge

2018-05-17 Thread Timur Tabi
On 05/16/2018 01:23 PM, Sinan Kaya wrote: + win_start = window->res->start - window->offset; Can you guarantee that window->res->start is always >= window->offset? + win_size = window->res->end - window->res->start + 1; Use resource_size() instead. -- Qualcomm D

Re: [RFC PATCH] efi/fb: Convert PCI bus address to resource if translated by the bridge

2018-05-17 Thread Sinan Kaya
On 5/16/2018 2:23 PM, Sinan Kaya wrote: > + if (win_start <= base && win_end >= base + win_size - 1) { > + base += window->offset; > + break; > + } I should probably add window->offset!=0 to the if statement in order not to break non-