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]
Date:   Tue, 20 Feb 2018 16:36:59 +0200
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     John Garry <john.garry@...wei.com>
Cc:     Mika Westerberg <mika.westerberg@...ux.intel.com>,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
        "Rafael J. Wysocki" <rjw@...ysocki.net>,
        Hanjun Guo <hanjun.guo@...aro.org>,
        Rob Herring <robh+dt@...nel.org>,
        Bjorn Helgaas <bhelgaas@...gle.com>,
        Arnd Bergmann <arnd@...db.de>,
        Mark Rutland <mark.rutland@....com>,
        Olof Johansson <olof@...om.net>,
        Dann Frazier <dann.frazier@...onical.com>,
        Rob Herring <robh@...nel.org>, Joe Perches <joe@...ches.com>,
        Benjamin Herrenschmidt <benh@...nel.crashing.org>,
        linux-pci@...r.kernel.org,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
        Linuxarm <linuxarm@...wei.com>, Corey Minyard <minyard@....org>,
        devicetree <devicetree@...r.kernel.org>,
        Linux-Arch <linux-arch@...r.kernel.org>,
        Randy Dunlap <rdunlap@...radead.org>
Subject: Re: [PATCH v14 5/9] OF: Add missing I/O range exception for
 indirect-IO devices

On Mon, Feb 19, 2018 at 7:48 PM, John Garry <john.garry@...wei.com> wrote:
> From: Zhichang Yuan <yuanzhichang@...ilicon.com>
>
> There are some special ISA/LPC devices that work on a specific I/O range
> where it is not correct to specify a 'ranges' property in DTS parent node
> as cpu addresses translated from DTS node are only for memory space on
> some architectures, such as Arm64. Without the parent 'ranges' property,
> current of_translate_address() return an error.
> Here we add special handlings for this case.
> During the OF address translation, some checkings will be perfromed to
> identify whether the device node is registered as indirect-IO. If yes,
> the I/O translation will be done in a different way from that one of PCI
> MMIO. In this way, the I/O 'reg' property of the special ISA/LPC devices
> will be parsed correctly.

> +               /*
> +                * For indirectIO device which has no ranges property, get
> +                * the address from reg directly.
> +                */
> +               iorange = find_io_range_by_fwnode(&dev->fwnode);
> +               if (iorange && (iorange->flags != PIO_CPU_MMIO)) {
> +                       result = of_read_number(addr + 1, na - 1);
> +                       pr_debug("indirectIO matched(%s) 0x%llx\n",
> +                                       of_node_full_name(dev), result);

%pOF ?

> +                       *host = of_node_get(dev);
> +                       break;
> +               }

> +static u64 of_translate_ioport(struct device_node *dev, const __be32 *in_addr,
> +                       u64 size)
> +{
> +       u64 taddr;
> +       unsigned long port;
> +       struct device_node *host;
> +
> +       taddr = __of_translate_address(dev, in_addr, "ranges", &host);
> +       if (host) {
> +               /* host specific port access */
> +               port = logic_pio_trans_hwaddr(&host->fwnode, taddr, size);
> +               of_node_put(host);
> +       } else {
> +               /* memory mapped I/O range */
> +               port = pci_address_to_pio(taddr);
> +       }
> +
> +       if (port == (unsigned long)-1)
> +               return OF_BAD_ADDR;

~0UL ?

Ah, okay, old code on plate.

> +
> +       return port;
> +}

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ