lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YHm0iXB/XubJcw5H@e110455-lin.cambridge.arm.com>
Date:   Fri, 16 Apr 2021 17:00:09 +0100
From:   Liviu Dudau <Liviu.Dudau@....com>
To:     Ilya Lipnitskiy <ilya.lipnitskiy@...il.com>
Cc:     Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
        linux-mips@...r.kernel.org, linux-kernel@...r.kernel.org,
        Sergey Ryazanov <ryazanov.s.a@...il.com>
Subject: Re: [PATCH v2 5/8] MIPS: pci-legacy: stop using
 of_pci_range_to_resource

Hi Ilya,

On Tue, Apr 13, 2021 at 08:12:37PM -0700, Ilya Lipnitskiy wrote:
> Mirror commit aeba3731b150 ("powerpc/pci: Fix IO space breakage after
> of_pci_range_to_resource() change").
> 
> Most MIPS platforms do not define PCI_IOBASE, nor implement
> pci_address_to_pio(). Moreover, IO_SPACE_LIMIT is 0xffff for most MIPS
> platforms. of_pci_range_to_resource passes the _start address_ of the IO
> range into pci_address_to_pio, which then checks it against
> IO_SPACE_LIMIT and fails, because for MIPS platforms that use
> pci-legacy (pci-lantiq, pci-rt3883, pci-mt7620), IO ranges start much
> higher than 0xffff.

I think defining PCI_IOBASE and implementing pci_address_to_pio() would be
easier in the long run as you will then let the core PCI code do most of
the work, but given that this is legacy code I can understand that testing
it would not be simple.

> 
> In fact, pci-mt7621 in staging already works around this problem, see
> commit 09dd629eeabb ("staging: mt7621-pci: fix io space and properly set
> resource limits")
> 
> So just stop using of_pci_range_to_resource, which does not work for
> MIPS.
> 
> Fixes PCI errors like:
>   pci_bus 0000:00: root bus resource [io  0xffffffff]
> 
> Fixes: 0b0b0893d49b ("of/pci: Fix the conversion of IO ranges into IO resources")
> Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@...il.com>
> Cc: Liviu Dudau <Liviu.Dudau@....com>
> ---
>  arch/mips/pci/pci-legacy.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/mips/pci/pci-legacy.c b/arch/mips/pci/pci-legacy.c
> index 39052de915f3..3a909194284a 100644
> --- a/arch/mips/pci/pci-legacy.c
> +++ b/arch/mips/pci/pci-legacy.c
> @@ -166,8 +166,13 @@ void pci_load_of_ranges(struct pci_controller *hose, struct device_node *node)
>  			res = hose->mem_resource;
>  			break;
>  		}
> -		if (res != NULL)
> -			of_pci_range_to_resource(&range, node, res);
> +		if (res != NULL) {
> +			res->name = node->full_name;
> +			res->flags = range.flags;
> +			res->start = range.cpu_addr;
> +			res->end = range.cpu_addr + range.size - 1;
> +			res->parent = res->child = res->sibling = NULL;
> +		}

Change looks reasonable to me.
Reviewed-by: Liviu Dudau <liviu.dudau@....com>

Best regards,
Liviu

>  	}
>  }
>  
> -- 
> 2.31.1
> 

-- 
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ