From patchwork Tue Oct 1 16:04:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 174891 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp8755577ill; Tue, 1 Oct 2019 09:07:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqyCWEqTljiDrP6bQ/p976Csqeclx9QEc5G8f9AadehDCG7tEZk5mpwYRMMndPgJ/rfKE7a2 X-Received: by 2002:a17:906:3281:: with SMTP id 1mr24957116ejw.181.1569946073427; Tue, 01 Oct 2019 09:07:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569946073; cv=none; d=google.com; s=arc-20160816; b=dbmu5zUlGXsQNKaGF+qWFRxRjEVdldJ3iLlqY61gOa7BGCkGdp3ksSCWTJN+O5aqJx XP/n+xonqwdckvRWqrOYkXAvlgGaWdLT74I3v4yWLuR5xKptDV8bgqWLuqI1IxfisM08 GsXryb0qIQwByQQjfek2yWddV3o1e8QAXAY4w4XhPOhsD9gkcnp2nxDERV5i1TQ2AnUX bXIubiZbJwxqsS1VR49Qt4zY3oWz27eP4e/w4kVSC0Keu69s6ahtjB0PE4kI6z+1bBBw uoOSknXANDVWmLYXnjT9E5C8WKIG4y10SRhVtCxDsnUnZ7vDI4+qk9hmq3EGA42oCQIE A0pQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=RIE+EgOtTrp9Aw3k4CsYN7GGPkAgexAC1RqFRA/UgKU=; b=QbRW9QBHN1voZpwta1yPP9ML8V0aPe5R0Yy7A8p5ZayIW54+5aPpuQ7VRof+h2ZJec wVutXN2PtKbxT7ujPoYQtEBGpp/OQaD2Wbpur5zCbcTy26FmYeKt7wsEE1+OvJTSsStA mxz86bs/AXdEA4CnTmNzJ4P32QoJRNuAmw7+E/Cg2dM+J7VYgEvCOOqMOVOEpWELRKQ0 Du98TrzneTfPjCi5GM0U9sY7Ihp3Dng2QzH/OnUEPxIQDAbLZzmuoK/aa9IrfnQqh5LO 8VRFZbwL6kC/Yjw/YsT09Svbw+q4tBjtfGpi+t/Y3Z7LvBEQ29Im6Hkl8UaYxp/3p2Ye Amzw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q30si10204449eda.5.2019.10.01.09.07.53; Tue, 01 Oct 2019 09:07:53 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730540AbfJAQHw (ORCPT + 27 others); Tue, 1 Oct 2019 12:07:52 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:44564 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1733278AbfJAQHs (ORCPT ); Tue, 1 Oct 2019 12:07:48 -0400 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 67E1F4656D2A73744456; Wed, 2 Oct 2019 00:07:45 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.439.0; Wed, 2 Oct 2019 00:07:15 +0800 From: John Garry To: CC: , , , , , John Garry Subject: [PATCH 1/3] lib: logic_pio: Enforce LOGIC_PIO_INDIRECT region ops are set at registration Date: Wed, 2 Oct 2019 00:04:25 +0800 Message-ID: <1569945867-82243-2-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1569945867-82243-1-git-send-email-john.garry@huawei.com> References: <1569945867-82243-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since the only LOGIC_PIO_INDIRECT host (hisi-lpc) now sets the ops prior to registration, enforce this check for accessors ops at registration instead of in the IO port accessors to simplify and marginally optimise the code. A slight misalignment is also tidied. Also add myself as an author. Suggested-by: Bjorn Helgaas Signed-off-by: John Garry --- lib/logic_pio.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) -- 2.17.1 diff --git a/lib/logic_pio.c b/lib/logic_pio.c index 905027574e5d..f511a99bb389 100644 --- a/lib/logic_pio.c +++ b/lib/logic_pio.c @@ -3,6 +3,7 @@ * Copyright (C) 2017 HiSilicon Limited, All Rights Reserved. * Author: Gabriele Paoloni * Author: Zhichang Yuan + * Author: John Garry */ #define pr_fmt(fmt) "LOGIC PIO: " fmt @@ -39,7 +40,8 @@ int logic_pio_register_range(struct logic_pio_hwaddr *new_range) resource_size_t iio_sz = MMIO_UPPER_LIMIT; int ret = 0; - if (!new_range || !new_range->fwnode || !new_range->size) + if (!new_range || !new_range->fwnode || !new_range->size || + (new_range->flags == LOGIC_PIO_INDIRECT && !new_range->ops)) return -EINVAL; start = new_range->hw_start; @@ -237,7 +239,7 @@ type logic_in##bw(unsigned long addr) \ } else if (addr >= MMIO_UPPER_LIMIT && addr < IO_SPACE_LIMIT) { \ struct logic_pio_hwaddr *entry = find_io_range(addr); \ \ - if (entry && entry->ops) \ + if (entry) \ ret = entry->ops->in(entry->hostdata, \ addr, sizeof(type)); \ else \ @@ -253,7 +255,7 @@ void logic_out##bw(type value, unsigned long addr) \ } else if (addr >= MMIO_UPPER_LIMIT && addr < IO_SPACE_LIMIT) { \ struct logic_pio_hwaddr *entry = find_io_range(addr); \ \ - if (entry && entry->ops) \ + if (entry) \ entry->ops->out(entry->hostdata, \ addr, value, sizeof(type)); \ else \ @@ -261,7 +263,7 @@ void logic_out##bw(type value, unsigned long addr) \ } \ } \ \ -void logic_ins##bw(unsigned long addr, void *buffer, \ +void logic_ins##bw(unsigned long addr, void *buffer, \ unsigned int count) \ { \ if (addr < MMIO_UPPER_LIMIT) { \ @@ -269,7 +271,7 @@ void logic_ins##bw(unsigned long addr, void *buffer, \ } else if (addr >= MMIO_UPPER_LIMIT && addr < IO_SPACE_LIMIT) { \ struct logic_pio_hwaddr *entry = find_io_range(addr); \ \ - if (entry && entry->ops) \ + if (entry) \ entry->ops->ins(entry->hostdata, \ addr, buffer, sizeof(type), count); \ else \ @@ -286,7 +288,7 @@ void logic_outs##bw(unsigned long addr, const void *buffer, \ } else if (addr >= MMIO_UPPER_LIMIT && addr < IO_SPACE_LIMIT) { \ struct logic_pio_hwaddr *entry = find_io_range(addr); \ \ - if (entry && entry->ops) \ + if (entry) \ entry->ops->outs(entry->hostdata, \ addr, buffer, sizeof(type), count); \ else \ From patchwork Tue Oct 1 16:04:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 174890 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp8755550ill; Tue, 1 Oct 2019 09:07:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqxjQ6TWLO63Hts80wbqEMApXLjqlgzOg7aN0onAUwm3psTmF51z9/DKHgNEH4zjVc420axG X-Received: by 2002:a17:906:4d0f:: with SMTP id r15mr25011020eju.147.1569946071975; Tue, 01 Oct 2019 09:07:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569946071; cv=none; d=google.com; s=arc-20160816; b=GVixtqAcD/3bneXgqrGFwOFQIGoZ+Kch9xFRt0Hv8KCYSFOVELMrv/XZnjEQZe1bOv yXD+GptWwrUylFpavWsVWchaapFbGQRPTgBi3gGzkyPDY2ieX+2/GiovBhVGzEX4Dh44 dT8qjJ18olJGeDo7w85Sqwp6mbBL1Q4NOgGByT85BvWROFfSCLRsI8mGEPwDyoF5XDZE c3r2zxR0PGrq1fCcYBI7eXffSvWD2Ngd6DZUc5AgXXocXr4/2bVtc2bnKZjsQvF0DA4H uqUaSXtbbLxQ3xmf7avr7Dn1aGrM3xFoPYWpiyi28eSyA3orqlyNIrepT3KRrP553LNE 8I+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=JdQFib1xvODx7RhbI3e4cwp5glGU2LMu5gkpRj2H6os=; b=TPEH02e/K6GWXJaBCmTpZLDwLqsVKKW6CxIm0A7+qYxC+z+s4FuCPy2mGn+Ubktx8X xdUWtlBxb+asAvzIVFFNItjPjqC+YCgAzUbMnfchKhteFO3MrP0QjLGoWncxw/M+xOui XIAiGTSJRJmUCqxeCX+vBtLe/4QvhuqvF3FVV4DShSBOvhH5XctngaU+ygsF5uvLIbXP 5ggxRdhIF2A5O0BlJCA43MDDpzzrlfZPNfAzshgOdEHiDv+XxCzG80jL6yMSLC1anf/Q W11qKLmsvetYpSPJRB1IC8iUWWOgLZ3WaHgfKJlEwz5xEsgK72D42TU0KV7U1Rh4tHn9 eceQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q30si10204449eda.5.2019.10.01.09.07.51; Tue, 01 Oct 2019 09:07:51 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387548AbfJAQHt (ORCPT + 27 others); Tue, 1 Oct 2019 12:07:49 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:44524 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1733280AbfJAQHs (ORCPT ); Tue, 1 Oct 2019 12:07:48 -0400 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 6C6B5E5304A984C54688; Wed, 2 Oct 2019 00:07:45 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.439.0; Wed, 2 Oct 2019 00:07:15 +0800 From: John Garry To: CC: , , , , , John Garry Subject: [PATCH 2/3] logic_pio: Define PIO_INDIRECT_SIZE for !CONFIG_INDIRECT_PIO Date: Wed, 2 Oct 2019 00:04:26 +0800 Message-ID: <1569945867-82243-3-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1569945867-82243-1-git-send-email-john.garry@huawei.com> References: <1569945867-82243-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org With the goal of expanding the test coverage of the HiSi LPC driver to !ARM64, define a dummy PIO_INDIRECT_SIZE for !CONFIG_INDIRECT_PIO, which is required by the named driver. Signed-off-by: John Garry --- include/linux/logic_pio.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/include/linux/logic_pio.h b/include/linux/logic_pio.h index 88e1e6304a71..54945aa824b4 100644 --- a/include/linux/logic_pio.h +++ b/include/linux/logic_pio.h @@ -108,10 +108,10 @@ void logic_outsl(unsigned long addr, const void *buffer, unsigned int count); * area by redefining the macro below. */ #define PIO_INDIRECT_SIZE 0x4000 -#define MMIO_UPPER_LIMIT (IO_SPACE_LIMIT - PIO_INDIRECT_SIZE) #else -#define MMIO_UPPER_LIMIT IO_SPACE_LIMIT +#define PIO_INDIRECT_SIZE 0 #endif /* CONFIG_INDIRECT_PIO */ +#define MMIO_UPPER_LIMIT (IO_SPACE_LIMIT - PIO_INDIRECT_SIZE) struct logic_pio_hwaddr *find_io_range_by_fwnode(struct fwnode_handle *fwnode); unsigned long logic_pio_trans_hwaddr(struct fwnode_handle *fwnode, From patchwork Tue Oct 1 16:04:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 174892 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp8755684ill; Tue, 1 Oct 2019 09:07:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqxhaFBnvJWv3ovZwn7VdQ6GjqlsTtJQN794JDsZgi1hCfLSFedRVlgvnHf2b4O0Z1jvcJFK X-Received: by 2002:a1c:cb83:: with SMTP id b125mr4617667wmg.43.1569946078303; Tue, 01 Oct 2019 09:07:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569946078; cv=none; d=google.com; s=arc-20160816; b=Pos3MOr5vT0n6jHQoCV4R2zcBSggG6tGHVVSAHWnQgDpJbQWout4Pg5VKmbeksLcHK Tc0K9m/1LYbuEZVjBvLMKkN21zrlJZssre3eQRRJV5HUijTwhCioUYMZat6WxPO4LD38 YiyP1BVFwF47cHeqva+PN8EpSvSi4wdAVk3RkpF73Tt0ehZLwtTTi4NXK2jBToWea/OX XvSWQkfL8RCrggUiPDmo7w0uuA8vDmbj+WaKoduC3g1VM4U0QF6xzeDDQWUjvLhCuC0r Gv9qsKVirzavfIDTZSRkVtcHlag5W0CPWJkLYOXyWiZOaJGFsa1Jh9i7cau9VdxBmHxG S3JA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=p0999uxYXtLmPWOkGpoEI+ni8yBRTqeTlosg1y2QpKk=; b=JqcwSYv6IQn9fGMt3cK7eb/azQgIUdH2+oIs75M0YWnqU1W5PMSGAUeVBffftzFQyA yIeBlIRDh+lS+9QAkKWpdYeLzp+s2v84VScZUFs5PR29TmqqNsnHW4v8/XZZ8IT5WBlx BTFmGn55TcGsMaPAOWfdyMr9FkCAc2jsr2j8Lvlarpy66fw+zYSuZLbkFFgynOa+8jQV eYQ6iDFRnrpSEiMRHb0VFwDGxnzvTzGlNLpXKnt/pfm2hfELakEcZHpW2FIPTWJq6dzM j6ZyqLFPmq6id115GcySy3bc3PbivyeX0JSj+Cd/3O7v4VomcHc4AlH/3UFryhwXEy7a WsKg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l15si8694524ejz.74.2019.10.01.09.07.58; Tue, 01 Oct 2019 09:07:58 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389831AbfJAQHv (ORCPT + 27 others); Tue, 1 Oct 2019 12:07:51 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:44562 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1733279AbfJAQHs (ORCPT ); Tue, 1 Oct 2019 12:07:48 -0400 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 70DFC3FA71A0965C69C2; Wed, 2 Oct 2019 00:07:45 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.439.0; Wed, 2 Oct 2019 00:07:15 +0800 From: John Garry To: CC: , , , , , John Garry Subject: [PATCH 3/3] bus: hisi_lpc: Expand build test coverage Date: Wed, 2 Oct 2019 00:04:27 +0800 Message-ID: <1569945867-82243-4-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1569945867-82243-1-git-send-email-john.garry@huawei.com> References: <1569945867-82243-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently the driver will only ever be built for ARM64 because it selects CONFIG_INDIRECT_PIO, which itself depends on ARM64. Expand build test coverage for the driver to other architectures by only selecting CONFIG_INDIRECT_PIO for ARM64, when we really want it. Signed-off-by: John Garry --- drivers/bus/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/drivers/bus/Kconfig b/drivers/bus/Kconfig index 6b331061d34b..44cb4b6bea18 100644 --- a/drivers/bus/Kconfig +++ b/drivers/bus/Kconfig @@ -41,8 +41,8 @@ config MOXTET config HISILICON_LPC bool "Support for ISA I/O space on HiSilicon Hip06/7" - depends on ARM64 && (ARCH_HISI || COMPILE_TEST) - select INDIRECT_PIO + depends on (ARM64 && ARCH_HISI) || COMPILE_TEST + select INDIRECT_PIO if ARM64 help Driver to enable I/O access to devices attached to the Low Pin Count bus on the HiSilicon Hip06/7 SoC.