Received: by 10.223.185.116 with SMTP id b49csp707292wrg; Tue, 20 Feb 2018 06:38:01 -0800 (PST) X-Google-Smtp-Source: AH8x226YYjc6E50vdX1Vdq5iIgAzjeas+JijrrlusWnutd2pOQBzdWMkT3Sjo6z6CPCZqlDKde9h X-Received: by 2002:a17:902:8214:: with SMTP id x20-v6mr641175pln.182.1519137481076; Tue, 20 Feb 2018 06:38:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519137481; cv=none; d=google.com; s=arc-20160816; b=gEvORQ2Kbraj2T4qXQJyuWjSzpNwNEz58CNvzwcfpUkoTKQ1ocqe1sqNrXqDbAkeJ/ iDBX1C4+nsRJ+4U0CVEqquO0FIobcCIbrqc17V4Dx7KibpvIFngIqq/nkBFOhJB+V/hD eIB/n3HmeKZFDIJ1PbNcNNUdxk042HBGLB/pLjiey2ikGgrvxdfsusgFfF4W00jx2Xc8 rQEdcqSQyX77nE+XM1b2pJqeh2z2vmY8LiTrbky85OzORProcm/hHyUAeCawy7casQul LQpgHbg4TYq78+6Pbr5hqL0UMhsANwWseBncnfEXlJmdSPqc19SumU0adkUsgP1+PvP0 8PDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=mK2JhLrxDuHEfY0EzWDE9lyD1+Zig0jPpb36H7iX9a0=; b=v08QmlVwLcPUk95dqbV+IgDVajdEI2yB3YIoy5L9i9VngDZo1aEJuewoBWuZqZfRC0 B7dDej+/t4uGy2EF5cALns6Ff7vo4QqpemamImXkApjVxmIT8yIIoQ/i+gmYh2D8k1Hf /JzbP9+9V1p6rdenVBl+71MjycK8xOEOxbk5RXqubjzLZ9JjJKd0q6oT/COgmvM0Cns3 Q4F9kFkVEoc61s2Q4i7ZI6tyQ2CGThS3i2/ce5VwvZ9bux0ifez1hyjEZOKo/4DHfso7 FXjmPQs2tH/KeZ5llx867N1h1/0YEjZKrLtvW8W/2f+cXLzzr4UXky8irCJDEQdNjaxD BAtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sncJY4NF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u86si6594723pfa.69.2018.02.20.06.37.46; Tue, 20 Feb 2018 06:38:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sncJY4NF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751931AbeBTOhF (ORCPT + 99 others); Tue, 20 Feb 2018 09:37:05 -0500 Received: from mail-qt0-f171.google.com ([209.85.216.171]:33056 "EHLO mail-qt0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751420AbeBTOhB (ORCPT ); Tue, 20 Feb 2018 09:37:01 -0500 Received: by mail-qt0-f171.google.com with SMTP id d8so16586587qtm.0; Tue, 20 Feb 2018 06:37:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=mK2JhLrxDuHEfY0EzWDE9lyD1+Zig0jPpb36H7iX9a0=; b=sncJY4NFDU1c8LKEASZTlOFuE6tYa5Miy9cFQ0P7pF1pwIDHG4L890LpKLo6ywxy3N dlWbMUy+Lx5Eyo6AjsUW2KSkiYaf2+Q+JF66MSWIRD3UVkdmY8q397UXRr52t/oXj3ui oG7+/3JEX4HBNwAzS+onTVZC4S16qaSqklrMQUJZ/alxgB0OeN50T4gi+YEX64ksabL0 EsEx+Vm/WWVPkAKvnWY5MhTGXwx5KicqE7Kdl7kxJR5RVRok4YgOd64vNrswy3M87qI/ 0kTcNmQgufKqfNNShWECe5UZIwEpQe208oItdFhb47M9qeZlieqdFMdCutCaC1sON5iv 3XrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=mK2JhLrxDuHEfY0EzWDE9lyD1+Zig0jPpb36H7iX9a0=; b=WvYnjKpvmb9sw9gqQ7Wsx+KaE3Hfmcf3RQIYVuLqNYR/3T+tsn3AbhqzNlnmTutBgv R0zwe9cbIfpmyLca7vBfBNvM1NMk2iIoFqZ1KqZHNJSBQxMi34sk8DCTqGJ8Jt1Pre4t slzNqK9R249ItlcpFpQg3ctbpjL/OWTncmxrfcGuyr4+wvD33ZzTF59GrTY6YfYoxyHd JhTUeYa0IeOYvQ70fXiAWhqNbZHy0+i8zfUHrClYLZA5TEwaPD4b1PL2MTEPyLz0Ijsj Sh0nHvonnSgAFZUCBH8TYzded9FisiG83I8aHC6t4tLirT99QoiAXf4lH1/QVA/pj/1v 5UcA== X-Gm-Message-State: APf1xPBJaB6YRrwspt/Xhrd8y3+huJZpa7Unlodf5SJ2mOm18MwNqrPL RibCWiTmyA5pngfyES0ArdHDcQDos2RJWNaJOeg= X-Received: by 10.200.18.3 with SMTP id x3mr22878639qti.40.1519137420363; Tue, 20 Feb 2018 06:37:00 -0800 (PST) MIME-Version: 1.0 Received: by 10.12.195.80 with HTTP; Tue, 20 Feb 2018 06:36:59 -0800 (PST) In-Reply-To: <1519062520-198902-6-git-send-email-john.garry@huawei.com> References: <1519062520-198902-1-git-send-email-john.garry@huawei.com> <1519062520-198902-6-git-send-email-john.garry@huawei.com> From: Andy Shevchenko Date: Tue, 20 Feb 2018 16:36:59 +0200 Message-ID: Subject: Re: [PATCH v14 5/9] OF: Add missing I/O range exception for indirect-IO devices To: John Garry Cc: Mika Westerberg , "Rafael J. Wysocki" , Lorenzo Pieralisi , "Rafael J. Wysocki" , Hanjun Guo , Rob Herring , Bjorn Helgaas , Arnd Bergmann , Mark Rutland , Olof Johansson , Dann Frazier , Rob Herring , Joe Perches , Benjamin Herrenschmidt , linux-pci@vger.kernel.org, Linux Kernel Mailing List , ACPI Devel Maling List , Linuxarm , Corey Minyard , devicetree , Linux-Arch , Randy Dunlap Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 19, 2018 at 7:48 PM, John Garry wrote: > From: Zhichang Yuan > > 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