From patchwork Fri Feb 26 14:02:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Saenz Julienne X-Patchwork-Id: 12106695 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B273C433DB for ; Fri, 26 Feb 2021 14:05:28 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E99AD64EF6 for ; Fri, 26 Feb 2021 14:05:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E99AD64EF6 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=esjJwCvH4mUHNMwJAtBctwiTML0XDz4pxaWihdaEo58=; b=itZm/177KFTyNlqWTjya9tz8W PWTvitEISNELAnAW+555uEVwBLHzqK13xpprC6qOBDmDTJL/4i2xSu2Z/CZCxlvi7U3IMxgnekITW 4anJUoW2KTPv5hlxIJYbMLUxLl13QA1ga9CzJXtX6eXD+n/cImJbB8jFMyFHLwFKkv4vmIKxqziWP /7jlAJ7NzdjdItAjrQ39TMC356KXuFX9+IR3+3QuumfktOkMyN4/ucKIQIjlU+b23iQinQln4UFuv Ob1WTzT/fcIwh46TKUg9NXF1v6tglEzpRKmAK+36wtipE7/QZS8ByYno+ywaoj0Ht3oxLaMRmD6Tj IL8njCGZg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lFdiZ-0003yj-NE; Fri, 26 Feb 2021 14:03:43 +0000 Received: from mx2.suse.de ([195.135.220.15]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lFdiD-0003n6-FT for linux-arm-kernel@lists.infradead.org; Fri, 26 Feb 2021 14:03:24 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 6F9FEB040; Fri, 26 Feb 2021 14:03:16 +0000 (UTC) From: Nicolas Saenz Julienne To: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC 01/13] dt-bindings: Introduce 64bit-mmio-broken Date: Fri, 26 Feb 2021 15:02:53 +0100 Message-Id: <20210226140305.26356-2-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210226140305.26356-1-nsaenzjulienne@suse.de> References: <20210226140305.26356-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210226_090321_786843_C478B0DB X-CRM114-Status: GOOD ( 11.14 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: f.fainelli@gmail.com, arnd@arndb.de, narmstrong@baylibre.com, dwmw2@infradead.org, linux@armlinux.org.uk, hch@infradead.org, will@kernel.org, robh+dt@kernel.org, catalin.marinas@arm.com, robin.murphy@arm.com, ardb@kernel.org, Nicolas Saenz Julienne Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Some buses might not be able to handle 64-bit sized MMIO accesses, on otherwise 64-bit systems. Introduce a boolean property to cater for this limitation. Signed-off-by: Nicolas Saenz Julienne --- .../devicetree/bindings/common-properties.txt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Documentation/devicetree/bindings/common-properties.txt b/Documentation/devicetree/bindings/common-properties.txt index 98a28130e100..3783510102c3 100644 --- a/Documentation/devicetree/bindings/common-properties.txt +++ b/Documentation/devicetree/bindings/common-properties.txt @@ -83,3 +83,18 @@ gpio@0 { #gpio-cells = <2>; #daisy-chained-devices = <3>; }; + +Broken 64-bit buses +------------------- + +Some buses might not be able to handle 64-bit sized MMIO accesses, on otherwise +64-bit systems. This property is only relevant to MMIO bus nodes. + +Optional properties: + - 64bit-mmio-broken: Boolean + +Example: +pcie@0 { + compatible = "name"; + 64bit-mmio-broken; +}; From patchwork Fri Feb 26 14:02:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Saenz Julienne X-Patchwork-Id: 12106701 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06190C433E0 for ; Fri, 26 Feb 2021 14:05:31 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A5D8F64EF0 for ; Fri, 26 Feb 2021 14:05:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A5D8F64EF0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=4tJ7iNAQAL7jCQ0IIBQUTufu24I91y3FNP0XwpNDCQc=; b=bJdb79hMghA7W6kngngFdaZfT mOP75xwEdCQP8l3OMrjfw5b2U7qZqykxNZra2Z7gzbS2qm6yvPy7dg2wnW6qh/eAB/ra3L9jPu0+G CLo1+rxulwQ9RXWR5OfBWbe/QnXYj36kvjsTo8Y9HbKSFtgY3hzCojGby6VHrpBwzCnry2/rejf9h vZHzSyoQPjOFozs0XrLJUAzt5OXtE76BfoziuyacDXTP10twlqGFeaMehpE/yPRy9ijndXnRMUkR1 bSYrX9YnrYIZmaMqkGxg6R3hACrwuVpPjiPdZsqln+pSOFfjOGc1wAvTEdK4MaVP3XUN3czDovZHN 7md4SyLhQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lFdic-0003zD-59; Fri, 26 Feb 2021 14:03:46 +0000 Received: from mx2.suse.de ([195.135.220.15]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lFdiD-0003n9-Ev for linux-arm-kernel@lists.infradead.org; Fri, 26 Feb 2021 14:03:25 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 1C466B03D; Fri, 26 Feb 2021 14:03:17 +0000 (UTC) From: Nicolas Saenz Julienne To: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC 02/13] driver core: Introduce MMIO configuration Date: Fri, 26 Feb 2021 15:02:54 +0100 Message-Id: <20210226140305.26356-3-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210226140305.26356-1-nsaenzjulienne@suse.de> References: <20210226140305.26356-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210226_090321_830110_45218428 X-CRM114-Status: GOOD ( 17.05 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: f.fainelli@gmail.com, arnd@arndb.de, narmstrong@baylibre.com, dwmw2@infradead.org, linux@armlinux.org.uk, hch@infradead.org, will@kernel.org, robh+dt@kernel.org, catalin.marinas@arm.com, robin.murphy@arm.com, ardb@kernel.org, Nicolas Saenz Julienne Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Some devices might inadvertently sit on buses that don't support 64bit MMIO access, and need a mechanism to query these limitations without prejudice to other buses in the system (i.e. defaulting to 32bit access system wide isn't an option). Introduce a new bus callback, 'mmio_configure(),' which will take care of populating the relevant device properties based on the bus' limitations. Signed-off-by: Nicolas Saenz Julienne --- arch/Kconfig | 8 ++++++++ drivers/base/dd.c | 6 ++++++ include/linux/device.h | 3 +++ include/linux/device/bus.h | 3 +++ 4 files changed, 20 insertions(+) diff --git a/arch/Kconfig b/arch/Kconfig index 2bb30673d8e6..ba7f246b6b9d 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -1191,6 +1191,14 @@ config ARCH_SPLIT_ARG64 config ARCH_HAS_ELFCORE_COMPAT bool +config ARCH_HAS_64BIT_MMIO_BROKEN + bool + depends on 64BIT + default n + help + Arch might contain busses unable to perform 64bit mmio accessses on + an otherwise 64bit system. + source "kernel/gcov/Kconfig" source "scripts/gcc-plugins/Kconfig" diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 9179825ff646..8086ce8f17a6 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -538,6 +538,12 @@ static int really_probe(struct device *dev, struct device_driver *drv) goto probe_failed; } + if (dev->bus->mmio_configure) { + ret = dev->bus->mmio_configure(dev); + if (ret) + goto probe_failed; + } + if (driver_sysfs_add(dev)) { pr_err("%s: driver_sysfs_add(%s) failed\n", __func__, dev_name(dev)); diff --git a/include/linux/device.h b/include/linux/device.h index ba660731bd25..bd94aa0cbd72 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -553,6 +553,9 @@ struct device { #ifdef CONFIG_DMA_OPS_BYPASS bool dma_ops_bypass : 1; #endif +#if defined(CONFIG_ARCH_HAS_64BIT_MMIO_BROKEN) + bool mmio_64bit_broken:1; +#endif }; /** diff --git a/include/linux/device/bus.h b/include/linux/device/bus.h index 1ea5e1d1545b..680dfc3b4744 100644 --- a/include/linux/device/bus.h +++ b/include/linux/device/bus.h @@ -59,6 +59,8 @@ struct fwnode_handle; * bus supports. * @dma_configure: Called to setup DMA configuration on a device on * this bus. + * @mmio_configure: Called to setup MMIO configuration on a device on + * this bus. * @pm: Power management operations of this bus, callback the specific * device driver's pm-ops. * @iommu_ops: IOMMU specific operations for this bus, used to attach IOMMU @@ -103,6 +105,7 @@ struct bus_type { int (*num_vf)(struct device *dev); int (*dma_configure)(struct device *dev); + int (*mmio_configure)(struct device *dev); const struct dev_pm_ops *pm; From patchwork Fri Feb 26 14:02:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Saenz Julienne X-Patchwork-Id: 12106697 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 933B0C433E0 for ; Fri, 26 Feb 2021 14:05:28 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2D22F64E54 for ; Fri, 26 Feb 2021 14:05:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2D22F64E54 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=PC7Uv8n3G4lGF+mJw7PN6XNgBnGxSapRvwfSPCATqp8=; b=UF5GqVoHNEkZv4CEwk2X5HP2J gHsgaiBHkMwwZjYqWE/ZD0MoMreRLJF0ZGrCuiT02afZcCu30mPzjPdmo5so0hHbp83/S5Baq19oO u/ONvfZtvRmZjNrrW1xloGjdb5YAZO0GoOjt7FCEWTX0ggISIiNg4fCOxoKi6KevdOMzKaAq8PQv/ 286BjcUeYnMDFNZmlDCTro75E6JmU+jqcIoI8CN/prKrY+Te2MjiVLxyoakz3zll/3qViJ0hqoAlf Y03Z5nUzJzw2zIm+3VcbJErfrPZcJRIZ5xBYZPDGjpKjt345Pa6c2guKCfFi+ZVFztlDHUmMkNo8d hyhiafBQA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lFdiO-0003un-1V; Fri, 26 Feb 2021 14:03:32 +0000 Received: from mx2.suse.de ([195.135.220.15]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lFdiD-0003nJ-EO for linux-arm-kernel@lists.infradead.org; Fri, 26 Feb 2021 14:03:22 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id C3E23AD73; Fri, 26 Feb 2021 14:03:17 +0000 (UTC) From: Nicolas Saenz Julienne To: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC 03/13] of: device: Introduce of_mmio_configure() Date: Fri, 26 Feb 2021 15:02:55 +0100 Message-Id: <20210226140305.26356-4-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210226140305.26356-1-nsaenzjulienne@suse.de> References: <20210226140305.26356-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210226_090321_637128_B7CC175B X-CRM114-Status: GOOD ( 14.68 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: f.fainelli@gmail.com, arnd@arndb.de, narmstrong@baylibre.com, dwmw2@infradead.org, linux@armlinux.org.uk, hch@infradead.org, will@kernel.org, robh+dt@kernel.org, catalin.marinas@arm.com, robin.murphy@arm.com, ardb@kernel.org, Nicolas Saenz Julienne Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The function will traverse a device's bus hierarchy looking for MMIO limited buses. If found it'll populate the relevant struct device quirks. Signed-off-by: Nicolas Saenz Julienne --- drivers/of/device.c | 19 +++++++++++++++++++ include/linux/of_device.h | 8 ++++++++ 2 files changed, 27 insertions(+) diff --git a/drivers/of/device.c b/drivers/of/device.c index 6cb86de404f1..b80367a2764b 100644 --- a/drivers/of/device.c +++ b/drivers/of/device.c @@ -169,6 +169,25 @@ int of_dma_configure_id(struct device *dev, struct device_node *np, } EXPORT_SYMBOL_GPL(of_dma_configure_id); +int of_mmio_configure(struct device *dev, struct device_node *np) +{ +#if defined(CONFIG_ARCH_HAS_64BIT_MMIO_BROKEN) + struct device_node *node = of_node_get(np); + + do { + if (of_property_read_bool(node, "64bit-mmio-broken")) { + dev->mmio_64bit_broken = true; + dev_dbg(dev, "device behind 64bit mmio broken bus\n"); + break; + } + } while ((node = of_get_next_parent(node))); + + of_node_put(node); +#endif + return 0; +} +EXPORT_SYMBOL_GPL(of_mmio_configure); + int of_device_register(struct platform_device *pdev) { device_initialize(&pdev->dev); diff --git a/include/linux/of_device.h b/include/linux/of_device.h index 1d7992a02e36..c465edd509c7 100644 --- a/include/linux/of_device.h +++ b/include/linux/of_device.h @@ -56,6 +56,9 @@ static inline int of_dma_configure(struct device *dev, { return of_dma_configure_id(dev, np, force_dma, NULL); } + +int of_mmio_configure(struct device *dev, struct device_node *np); + #else /* CONFIG_OF */ static inline int of_driver_match_device(struct device *dev, @@ -112,6 +115,11 @@ static inline int of_dma_configure(struct device *dev, { return 0; } + +static inline int of_mmio_configure(struct device *dev, struct device_node *np); +{ + return 0; +} #endif /* CONFIG_OF */ #endif /* _LINUX_OF_DEVICE_H */ From patchwork Fri Feb 26 14:02:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Saenz Julienne X-Patchwork-Id: 12106691 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B5A7C433DB for ; Fri, 26 Feb 2021 14:05:19 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E534B64EF6 for ; Fri, 26 Feb 2021 14:05:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E534B64EF6 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=EoympU5nKskHbDAstVERokvTCmNygxXHWX0zuWsKNH4=; b=B7uETCHqxAjLdsYjO78egILhL t5qraXW5f2ynpqTm5HDawtM1fQkj3KCsfxFr3i6EOws3A9D7Wxnsg4Fec5MDmxEk9uZer+DPlVlsh SpwL3pR7Dna/GIYuHqtrCJUe5ul93CxrGyxnktKf7rXBFiJCsn3knu9EA8nQ4HrmbaiT/6jGuGYgF 812MDXDIJq+GfUH1gND8g9StpGch2vwBsA1St6G+Em7TOI1rNrq1hGFWi3Gnj7wQTVeRryeEWw+Xh kQCZRCCGoPhQe2/NuTdQr76j+4od4v4TX8+ZqvOMexnV1DXMGwNXtdJWHT64JSDY5zGdKSi6iWMFX ljRiQdOGg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lFdiH-0003rR-M5; Fri, 26 Feb 2021 14:03:25 +0000 Received: from mx2.suse.de ([195.135.220.15]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lFdiD-0003nN-D6 for linux-arm-kernel@lists.infradead.org; Fri, 26 Feb 2021 14:03:22 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 70AB3B06A; Fri, 26 Feb 2021 14:03:18 +0000 (UTC) From: Nicolas Saenz Julienne To: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC 04/13] driver core: plafrom: Introduce platform_mmio_configure() Date: Fri, 26 Feb 2021 15:02:56 +0100 Message-Id: <20210226140305.26356-5-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210226140305.26356-1-nsaenzjulienne@suse.de> References: <20210226140305.26356-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210226_090321_559942_EB211ACF X-CRM114-Status: GOOD ( 12.81 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: f.fainelli@gmail.com, arnd@arndb.de, narmstrong@baylibre.com, dwmw2@infradead.org, linux@armlinux.org.uk, hch@infradead.org, will@kernel.org, robh+dt@kernel.org, catalin.marinas@arm.com, robin.murphy@arm.com, ardb@kernel.org, Nicolas Saenz Julienne Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The function will traverse the platform device's bus hierarchy and set the relevant MMIO access flags. Signed-off-by: Nicolas Saenz Julienne --- drivers/base/platform.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 6e1f8e0b661c..31772fd4ca1d 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c @@ -1504,6 +1504,14 @@ int platform_dma_configure(struct device *dev) return ret; } +static int platform_mmio_configure(struct device *dev) +{ + if (dev->parent && dev->parent->of_node) + return of_mmio_configure(dev, dev->parent->of_node); + + return 0; +} + static const struct dev_pm_ops platform_dev_pm_ops = { .runtime_suspend = pm_generic_runtime_suspend, .runtime_resume = pm_generic_runtime_resume, @@ -1519,6 +1527,7 @@ struct bus_type platform_bus_type = { .remove = platform_remove, .shutdown = platform_shutdown, .dma_configure = platform_dma_configure, + .mmio_configure = platform_mmio_configure, .pm = &platform_dev_pm_ops, }; EXPORT_SYMBOL_GPL(platform_bus_type); From patchwork Fri Feb 26 14:02:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Saenz Julienne X-Patchwork-Id: 12106707 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7EFAFC433E0 for ; Fri, 26 Feb 2021 14:05:59 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 39F7A64F04 for ; Fri, 26 Feb 2021 14:05:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 39F7A64F04 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=46YJiUB7olN3CO4uwIfn6sl9RE2wddWtcsnuKsc+Yj0=; b=QEaC9kf1CIDUHScHyXCMD79ip KTRwKWD1mJehQMUwFoi2gHnGjubDSWDJsfzVuOuaFPVIfoIUXL9jYh/dgzGM1RyOHqzEls9vmt+wO L5leoCUIlmAqi1xokuCd4fJLGftOV2BISfh9msfGQ0V9SatANqWJWIu5QFmGz9HQ60/tVbQczk78E imvQWRdXVsrt+/OggltR1xFraG6iPmIsxrgRDi/UOGdnOzLBZe7AcztvE2zHhod0RPe+GOk7UBwzy czWnGJ26DAwCb8u2MqpfLbFZTUco3k5Gs8xFWAB9S1cdEMSeWl4j/p74mV6iZDV6rk/TUa5S78RyT tQcihaF0Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lFdj1-00047X-JU; Fri, 26 Feb 2021 14:04:11 +0000 Received: from mx2.suse.de ([195.135.220.15]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lFdiF-0003qO-OQ for linux-arm-kernel@lists.infradead.org; Fri, 26 Feb 2021 14:03:33 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 24D19AF4F; Fri, 26 Feb 2021 14:03:19 +0000 (UTC) From: Nicolas Saenz Julienne To: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC 05/13] pci: Introduce pci_mmio_configure() Date: Fri, 26 Feb 2021 15:02:57 +0100 Message-Id: <20210226140305.26356-6-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210226140305.26356-1-nsaenzjulienne@suse.de> References: <20210226140305.26356-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210226_090324_053650_F1DCEE98 X-CRM114-Status: GOOD ( 15.28 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: f.fainelli@gmail.com, arnd@arndb.de, narmstrong@baylibre.com, dwmw2@infradead.org, linux@armlinux.org.uk, hch@infradead.org, will@kernel.org, robh+dt@kernel.org, catalin.marinas@arm.com, robin.murphy@arm.com, ardb@kernel.org, Nicolas Saenz Julienne Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The function will traverse the pci device's bus hierarchy and set the relevant MMIO access flags. Signed-off-by: Nicolas Saenz Julienne --- drivers/pci/pci-driver.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index ec44a79e951a..554d91e7ec52 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c @@ -1596,6 +1596,31 @@ static int pci_dma_configure(struct device *dev) return ret; } +/** + * pci_mmio_configure - Setup MMIO configuration + * @dev: ptr to dev structure + * + * Function to update PCI devices's MMIO configuration using the same + * info from the OF node of host bridge's parent (if any). + */ +static int pci_mmio_configure(struct device *dev) +{ + struct device *bridge; + int ret = 0; + + bridge = pci_get_host_bridge_device(to_pci_dev(dev)); + + dev_info(dev, "MMIO CONFIGURATION\n"); + if (IS_ENABLED(CONFIG_OF) && bridge->parent && + bridge->parent->of_node) { + dev_info(dev, "MMIO CONFIGURATION, %pOF\n", bridge->parent->of_node); + ret = of_mmio_configure(dev, bridge->parent->of_node); + } + + pci_put_host_bridge_device(bridge); + return ret; +} + struct bus_type pci_bus_type = { .name = "pci", .match = pci_bus_match, @@ -1609,6 +1634,7 @@ struct bus_type pci_bus_type = { .pm = PCI_PM_OPS_PTR, .num_vf = pci_bus_num_vf, .dma_configure = pci_dma_configure, + .mmio_configure = pci_mmio_configure, }; EXPORT_SYMBOL(pci_bus_type); From patchwork Fri Feb 26 14:02:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Saenz Julienne X-Patchwork-Id: 12106699 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6AF67C433E9 for ; Fri, 26 Feb 2021 14:05:29 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1D05F64EF6 for ; Fri, 26 Feb 2021 14:05:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1D05F64EF6 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=FLGpqI0rvOtTDy1iwK8AKO2i6bVzleJ9RqfkNwm01ZI=; b=Qm8MgspVsQEdtNIGoZsqeZblT 4eLlP0TB3S8Pxnxs74YEAGw+BU3Z+FSYcQw0697VtEhVRrGLNpinsve5W7Az5VFCDLCfGn86mFXqT 3UksSWsJq3BW+SnYSS1dFFaQUzr/GzZj86+PvSsIu6JHJ3dGQ/vvAWuLlKYLIXQ0OWDpkInKBvINR zvwHeuqYsVdSji+PdsMfukp8G9m3DZxSfj7vnKymtq+t3cgjgRTIJsksoQqsq3B5nYNdLYSFVtZfm FnRrO7JuJ/ogoFXJ4Lzu2loY2S6RirwEaqeUGEF4vt8q1Cp+4pOotgnilz+434hMZaQ1liXWE/Nqa UisNl6kvQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lFdij-000413-HT; Fri, 26 Feb 2021 14:03:53 +0000 Received: from mx2.suse.de ([195.135.220.15]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lFdiF-0003qP-OU for linux-arm-kernel@lists.infradead.org; Fri, 26 Feb 2021 14:03:30 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id C7C26AE07; Fri, 26 Feb 2021 14:03:19 +0000 (UTC) From: Nicolas Saenz Julienne To: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC 06/13] device core: Introduce dev_64bit_mmio_supported() Date: Fri, 26 Feb 2021 15:02:58 +0100 Message-Id: <20210226140305.26356-7-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210226140305.26356-1-nsaenzjulienne@suse.de> References: <20210226140305.26356-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210226_090324_054828_FA3BBF94 X-CRM114-Status: GOOD ( 11.83 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: f.fainelli@gmail.com, arnd@arndb.de, narmstrong@baylibre.com, dwmw2@infradead.org, linux@armlinux.org.uk, hch@infradead.org, will@kernel.org, robh+dt@kernel.org, catalin.marinas@arm.com, robin.murphy@arm.com, ardb@kernel.org, Nicolas Saenz Julienne Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This helper function will be help drivers ascertain whether they can use 64-bit memory accesses. Signed-off-by: Nicolas Saenz Julienne --- include/linux/device.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/include/linux/device.h b/include/linux/device.h index bd94aa0cbd72..e9b4b2f99a44 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -826,6 +826,23 @@ static inline int dev_num_vf(struct device *dev) return 0; } +#if defined(CONFIG_ARCH_HAS_64BIT_MMIO_BROKEN) +static inline bool dev_64bit_mmio_supported(struct device *dev) +{ + return !dev->mmio_64bit_broken; +} +#elif defined(CONFIG_64BIT) +static inline bool dev_64bit_mmio_supported(struct device *dev) +{ + return true; +} +#else +static inline bool dev_64bit_mmio_supported(struct device *dev) +{ + return false; +} +#endif + /* * Root device objects for grouping under /sys/devices */ From patchwork Fri Feb 26 14:02:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Saenz Julienne X-Patchwork-Id: 12106703 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD277C433DB for ; Fri, 26 Feb 2021 14:05:36 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5D54364F03 for ; Fri, 26 Feb 2021 14:05:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5D54364F03 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=uHep/rHSddmt+5EJa/tDWZr7VrVPjbMkKXJ3hR2EMzc=; b=IvUQlwUQ3Y9QGcaWnoI5PAVtL onP1juCx/6t33LSelUZ1YlAGD4MRntg3p6zHG1yISPVdGs+Lna4XqSOa6bclNohJw1yiZqLQ7Mh3x pENPvSE53i3yvW5MAoS81EBEuWWCZYreB7GUxucfpb4sPd/hDpekHXnA2GBdXyrZkwhkAvP/gOE9d v43fIb/NG7i1CuFTcFCB2LfhXRMvAhz8edHJNkcWhCwiyQwZb7uWWF1FYxuppnE3icL2CfEv1Ojh5 JN8c1fo1vGWn2apdLJ4UHY5U5GR98YTCMUNcmNUtBTS6Whho3A535+ETAH4imfLofm77YFjY086BS 555VSAx6g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lFdiu-00044L-07; Fri, 26 Feb 2021 14:04:04 +0000 Received: from mx2.suse.de ([195.135.220.15]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lFdiF-0003qS-P5 for linux-arm-kernel@lists.infradead.org; Fri, 26 Feb 2021 14:03:33 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 782A7AD57; Fri, 26 Feb 2021 14:03:20 +0000 (UTC) From: Nicolas Saenz Julienne To: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC 07/13] arm64: Mark ARCH_MVEBU as needing broken 64bit MMIO support Date: Fri, 26 Feb 2021 15:02:59 +0100 Message-Id: <20210226140305.26356-8-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210226140305.26356-1-nsaenzjulienne@suse.de> References: <20210226140305.26356-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210226_090324_135029_8066D849 X-CRM114-Status: GOOD ( 11.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: f.fainelli@gmail.com, arnd@arndb.de, narmstrong@baylibre.com, dwmw2@infradead.org, linux@armlinux.org.uk, hch@infradead.org, will@kernel.org, robh+dt@kernel.org, catalin.marinas@arm.com, robin.murphy@arm.com, ardb@kernel.org, Nicolas Saenz Julienne Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The bus AP806's IOMMU sits on can't handle 64bit MMIO accesses[1]. So select 'ARCH_HAS_64BIT_MMIO_BROKEN' for the platform. Signed-off-by: Nicolas Saenz Julienne [1] See Armada-AP806 erratum #582743 --- arch/arm64/Kconfig.platforms | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms index cdfd5fed457f..04a97cf486c5 100644 --- a/arch/arm64/Kconfig.platforms +++ b/arch/arm64/Kconfig.platforms @@ -175,6 +175,7 @@ config ARCH_MESON config ARCH_MVEBU bool "Marvell EBU SoC Family" + select ARCH_HAS_64BIT_MMIO_BROKEN select ARMADA_AP806_SYSCON select ARMADA_CP110_SYSCON select ARMADA_37XX_CLK From patchwork Fri Feb 26 14:03:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Saenz Julienne X-Patchwork-Id: 12106705 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 931EAC433DB for ; Fri, 26 Feb 2021 14:05:53 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3818A64F0D for ; Fri, 26 Feb 2021 14:05:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3818A64F0D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=zeFip13e+5EOTf8BWaEzcDS1ixwA8RcJhDznfxx1II0=; b=UODjD/kmS93ULWWudLtppCNAX aB4DTFTNbcSlQFSwajjZfq9Gn16Tuz5UTLL0RLVhjAkIa3mpbUCI0CggTfToH5ozeUaILIHhVVtwI oaGdBNwotPnyoO9PUR2ZnOKM0Nx5lzeR79oaowjcktjd9uPNXZxVkCAqlbKgcB6Sb+LRBBgQ+e2O4 5hR0bFFgzRTEDAmeQVAce65W+kabQXN/q2xoXOBH74YWoFmMDYOI/xxDuE6haxniz0tgkj8gf2e7G ihVd3yw2x10MzXBwcT4KgVeXuP3X65O9bv40+jP2x79NtTzJeKMR6W7cZM1vL8Q/6YjT9W6eneFAX +cf0zeySQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lFdj9-0004AQ-Cf; Fri, 26 Feb 2021 14:04:19 +0000 Received: from mx2.suse.de ([195.135.220.15]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lFdiF-0003qQ-OW for linux-arm-kernel@lists.infradead.org; Fri, 26 Feb 2021 14:03:32 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 244BCB080; Fri, 26 Feb 2021 14:03:21 +0000 (UTC) From: Nicolas Saenz Julienne To: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC 08/13] arm64: dts: marvell: armada-ap80x: Mark config-space bus as 64bit-mmio-broken Date: Fri, 26 Feb 2021 15:03:00 +0100 Message-Id: <20210226140305.26356-9-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210226140305.26356-1-nsaenzjulienne@suse.de> References: <20210226140305.26356-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210226_090324_067394_CF58C885 X-CRM114-Status: GOOD ( 11.88 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: f.fainelli@gmail.com, arnd@arndb.de, narmstrong@baylibre.com, dwmw2@infradead.org, linux@armlinux.org.uk, hch@infradead.org, will@kernel.org, robh+dt@kernel.org, catalin.marinas@arm.com, robin.murphy@arm.com, ardb@kernel.org, Nicolas Saenz Julienne Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org As per Marvell's Armada-AP806 erratum #582743 the bus can't handle 64bit MMIO accesses. Signed-off-by: Nicolas Saenz Julienne --- arch/arm64/boot/dts/marvell/armada-ap80x.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/boot/dts/marvell/armada-ap80x.dtsi b/arch/arm64/boot/dts/marvell/armada-ap80x.dtsi index 6614472100c2..a009458edf24 100644 --- a/arch/arm64/boot/dts/marvell/armada-ap80x.dtsi +++ b/arch/arm64/boot/dts/marvell/armada-ap80x.dtsi @@ -54,6 +54,7 @@ config-space@f0000000 { #address-cells = <1>; #size-cells = <1>; compatible = "simple-bus"; + 64bit-mmio-broken; ranges = <0x0 0x0 0xf0000000 0x1000000>; smmu: iommu@5000000 { From patchwork Fri Feb 26 14:03:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Saenz Julienne X-Patchwork-Id: 12106709 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8CD40C433E0 for ; Fri, 26 Feb 2021 14:06:07 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3129764EF6 for ; Fri, 26 Feb 2021 14:06:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3129764EF6 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=z0xaZiepHbfphvoZPVZECCmc2Oo8vj/ulMebrwCdGJc=; b=HzF649nI8dI3FdSpkz+YH4RAZ FaG44GtIuim3E+RWo0OcH8xpBn1yW0B+VnNZBs88Z5zDEPMsMjdQmp+XfBaC3nnt0XQ6R2gmUn1Tw FbTPTzolwQpb8pXSG3wi9Y3JpQoLu5kG5N6mbwIfyN2UT6xs98vToGLtM0jAZGn6Y8EH2s1td+lXx nTO7lmEQk40n5V4OSmLzFFRIFwk8jjud13V5GPK4WKxTYgOk4OyI/cV5R7IKDFYesjSSnbXEfpCNx WgxfJGfAd8YH4pT+gVEh1vp1mPUqHXvgCqtGiWWz5eZyuZ348rE/7kmL526LpdjZwlQslT/mCiG8s uevwONAFg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lFdjQ-0004FV-5Q; Fri, 26 Feb 2021 14:04:36 +0000 Received: from mx2.suse.de ([195.135.220.15]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lFdiH-0003rY-OP for linux-arm-kernel@lists.infradead.org; Fri, 26 Feb 2021 14:03:34 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id D637FB077; Fri, 26 Feb 2021 14:03:21 +0000 (UTC) From: Nicolas Saenz Julienne To: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC 09/13] iommu/arm-smmu: Make use of dev_64bit_mmio_supported() Date: Fri, 26 Feb 2021 15:03:01 +0100 Message-Id: <20210226140305.26356-10-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210226140305.26356-1-nsaenzjulienne@suse.de> References: <20210226140305.26356-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210226_090326_017723_AD428D20 X-CRM114-Status: GOOD ( 16.01 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: f.fainelli@gmail.com, arnd@arndb.de, narmstrong@baylibre.com, dwmw2@infradead.org, linux@armlinux.org.uk, hch@infradead.org, will@kernel.org, robh+dt@kernel.org, catalin.marinas@arm.com, robin.murphy@arm.com, ardb@kernel.org, Nicolas Saenz Julienne Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Some arm SMMU implementations might sit on a bus that doesn't support 64bit memory accesses. In that case default to using hi_lo_{readq, writeq}() and BUG if such platform tries to use AArch64 formats as they rely on writeq()'s atomicity. Signed-off-by: Nicolas Saenz Julienne --- drivers/iommu/arm/arm-smmu/arm-smmu.c | 9 +++++++++ drivers/iommu/arm/arm-smmu/arm-smmu.h | 9 +++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-smmu/arm-smmu.c index d8c6bfde6a61..239ff42b20c3 100644 --- a/drivers/iommu/arm/arm-smmu/arm-smmu.c +++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c @@ -1889,6 +1889,15 @@ static int arm_smmu_device_cfg_probe(struct arm_smmu_device *smmu) smmu->features |= ARM_SMMU_FEAT_FMT_AARCH64_64K; } + /* + * 64bit accesses not possible through the interconnect, AArch64 + * formats depend on it. + */ + BUG_ON(!dev_64bit_mmio_supported(smmu->dev) && + smmu->features & (ARM_SMMU_FEAT_FMT_AARCH64_4K | + ARM_SMMU_FEAT_FMT_AARCH64_16K | + ARM_SMMU_FEAT_FMT_AARCH64_64K)); + if (smmu->impl && smmu->impl->cfg_probe) { ret = smmu->impl->cfg_probe(smmu); if (ret) diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.h b/drivers/iommu/arm/arm-smmu/arm-smmu.h index d2a2d1bc58ba..997d13a21717 100644 --- a/drivers/iommu/arm/arm-smmu/arm-smmu.h +++ b/drivers/iommu/arm/arm-smmu/arm-smmu.h @@ -477,15 +477,20 @@ static inline void arm_smmu_writel(struct arm_smmu_device *smmu, int page, { if (smmu->impl && unlikely(smmu->impl->write_reg)) smmu->impl->write_reg(smmu, page, offset, val); - else + else if (dev_64bit_mmio_supported(smmu->dev)) writel_relaxed(val, arm_smmu_page(smmu, page) + offset); + else + hi_lo_writeq_relaxed(val, arm_smmu_page(smmu, page) + offset); } static inline u64 arm_smmu_readq(struct arm_smmu_device *smmu, int page, int offset) { if (smmu->impl && unlikely(smmu->impl->read_reg64)) return smmu->impl->read_reg64(smmu, page, offset); - return readq_relaxed(arm_smmu_page(smmu, page) + offset); + else if (dev_64bit_mmio_supported(smmu->dev)) + return readq_relaxed(arm_smmu_page(smmu, page) + offset); + else + return hi_lo_readq_relaxed(arm_smmu_page(smmu, page) + offset); } static inline void arm_smmu_writeq(struct arm_smmu_device *smmu, int page, From patchwork Fri Feb 26 14:03:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Saenz Julienne X-Patchwork-Id: 12106713 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6C9AC433E6 for ; Fri, 26 Feb 2021 14:06:21 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3F3EB64F04 for ; Fri, 26 Feb 2021 14:06:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3F3EB64F04 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=4t3zWjXeuT6LSYTO7xal24e9pvWO3pu30ppKa3mHELw=; b=UrUHxuEWqVPRwsLYOiqPNopWx xWG3gbhYKYAYTo2uNnrLx50TOExVe5ml209OlxV2DJlFGgQ1jXQ9MXcxfkLqOdRpGx9pxQoyHRQUO nFjaq/skEkVO502q9svuvJyVTNTv15WPVw8LwAX5bs5N/+7kQzr+cTWdZ73ZTdFZIVJO7/DapVaW3 jY+wkcO97WTnzqCLkoj7SPkvEwNGWigI8GJ0QOUpPVxkPCO6XNeJbqavew3+K35YNwz8Vgd/V56Tr diCUCVq/MKYzNaLHFtK/fEkpOUZc5nbp1UR6WihSus36ljYMjF8mmSidviFq8P2xfvpXxDqqrAlCU okOIdQMMg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lFdjd-0004Ky-Pw; Fri, 26 Feb 2021 14:04:51 +0000 Received: from mx2.suse.de ([195.135.220.15]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lFdiH-0003rZ-OP for linux-arm-kernel@lists.infradead.org; Fri, 26 Feb 2021 14:03:34 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 8613FB03F; Fri, 26 Feb 2021 14:03:22 +0000 (UTC) From: Nicolas Saenz Julienne To: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC 10/13] iommu/arm-smmu-impl: Get rid of Marvell's implementation details Date: Fri, 26 Feb 2021 15:03:02 +0100 Message-Id: <20210226140305.26356-11-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210226140305.26356-1-nsaenzjulienne@suse.de> References: <20210226140305.26356-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210226_090326_035973_1A2365B2 X-CRM114-Status: GOOD ( 12.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: f.fainelli@gmail.com, arnd@arndb.de, narmstrong@baylibre.com, dwmw2@infradead.org, linux@armlinux.org.uk, hch@infradead.org, will@kernel.org, robh+dt@kernel.org, catalin.marinas@arm.com, robin.murphy@arm.com, ardb@kernel.org, Nicolas Saenz Julienne Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org arm-smmu can now deal with integrations on buses that don't support 64bit MMIO accesses. No need to create a special case for that on Marvell's integration. Signed-off-by: Nicolas Saenz Julienne --- drivers/iommu/arm/arm-smmu/arm-smmu-impl.c | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-impl.c b/drivers/iommu/arm/arm-smmu/arm-smmu-impl.c index 136872e77195..55d40e37e144 100644 --- a/drivers/iommu/arm/arm-smmu/arm-smmu-impl.c +++ b/drivers/iommu/arm/arm-smmu/arm-smmu-impl.c @@ -145,25 +145,6 @@ static const struct arm_smmu_impl arm_mmu500_impl = { .reset = arm_mmu500_reset, }; -static u64 mrvl_mmu500_readq(struct arm_smmu_device *smmu, int page, int off) -{ - /* - * Marvell Armada-AP806 erratum #582743. - * Split all the readq to double readl - */ - return hi_lo_readq_relaxed(arm_smmu_page(smmu, page) + off); -} - -static void mrvl_mmu500_writeq(struct arm_smmu_device *smmu, int page, int off, - u64 val) -{ - /* - * Marvell Armada-AP806 erratum #582743. - * Split all the writeq to double writel - */ - hi_lo_writeq_relaxed(val, arm_smmu_page(smmu, page) + off); -} - static int mrvl_mmu500_cfg_probe(struct arm_smmu_device *smmu) { @@ -181,8 +162,6 @@ static int mrvl_mmu500_cfg_probe(struct arm_smmu_device *smmu) } static const struct arm_smmu_impl mrvl_mmu500_impl = { - .read_reg64 = mrvl_mmu500_readq, - .write_reg64 = mrvl_mmu500_writeq, .cfg_probe = mrvl_mmu500_cfg_probe, .reset = arm_mmu500_reset, }; From patchwork Fri Feb 26 14:03:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Saenz Julienne X-Patchwork-Id: 12106715 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B27CC433E0 for ; Fri, 26 Feb 2021 14:06:40 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E954B64E54 for ; Fri, 26 Feb 2021 14:06:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E954B64E54 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=A0kGw7SZ84nKmnh22EcSmWo5z+f1ryKI8h2EejkQaRs=; b=bK9/uMTPEeJ//lL8XOUI0pI2W 52Od3n0wAf3QM71IVgoog3LBPAa2Ovyg9PfAu+DU8dSWZ/plTNhw1ZXT6Bu3rJCVQ3zo/GkIiO+Qt Esn78p74eIMNG8f9mnq7/TVCL3Tot4iWsj3yX/peNRCyzHk7ldv1W8n4tsrf8zdfqYvFUosa89mFv 9yx6CeyE1z0tT4MCdhPC69Qu9J7x+7NBn5HPUkQ1ldQmpjVGQHe99xE4bsRA7m8jh1E/MZFdvafzQ 4e4ZjTG5aOVWAhZvbUqu26f4SDwM6+a553Fnw4M1vdgMiEJfqT5VJjud68V/KhhIC32zBiq/k+r/a 64+KJvwTg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lFdk5-0004Uw-3F; Fri, 26 Feb 2021 14:05:17 +0000 Received: from mx2.suse.de ([195.135.220.15]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lFdiJ-0003sK-08 for linux-arm-kernel@lists.infradead.org; Fri, 26 Feb 2021 14:03:37 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 395EEB066; Fri, 26 Feb 2021 14:03:23 +0000 (UTC) From: Nicolas Saenz Julienne To: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC 11/13] arm64: Mark ARCH_BCM2835 as needing broken 64bit MMIO support Date: Fri, 26 Feb 2021 15:03:03 +0100 Message-Id: <20210226140305.26356-12-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210226140305.26356-1-nsaenzjulienne@suse.de> References: <20210226140305.26356-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210226_090327_384158_C30DC446 X-CRM114-Status: GOOD ( 11.80 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: f.fainelli@gmail.com, arnd@arndb.de, narmstrong@baylibre.com, dwmw2@infradead.org, linux@armlinux.org.uk, hch@infradead.org, will@kernel.org, robh+dt@kernel.org, catalin.marinas@arm.com, robin.murphy@arm.com, ardb@kernel.org, Nicolas Saenz Julienne Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The PCIe bus present in BCM2711 can't handle 64bit accesses on device memory. So select 'ARCH_HAS_64BIT_MMIO_BROKEN.' Signed-off-by: Nicolas Saenz Julienne --- arch/arm64/Kconfig.platforms | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms index 04a97cf486c5..0178a46cc10a 100644 --- a/arch/arm64/Kconfig.platforms +++ b/arch/arm64/Kconfig.platforms @@ -38,6 +38,7 @@ config ARCH_ALPINE config ARCH_BCM2835 bool "Broadcom BCM2835 family" + select ARCH_HAS_64BIT_MMIO_BROKEN select TIMER_OF select GPIOLIB select MFD_CORE From patchwork Fri Feb 26 14:03:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Saenz Julienne X-Patchwork-Id: 12106711 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F999C433E0 for ; Fri, 26 Feb 2021 14:06:21 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B362B64F0E for ; Fri, 26 Feb 2021 14:06:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B362B64F0E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=HSylpZlyAPxGABOBdCkRSFMhgPXJryXPTQQdrQYmuog=; b=Y1PC3ry2mFqhujmVkarTJCbC0 o1zA4WZHt6GFqIXSRE9Kex6yuNMegMjw2Ku+As56ZfiPeDEa0tr+NdJzDR+r3g7hRfbuB2aVL4J0u DexepWkIGn7HKB0VhyUbRFmBk6zrlQJakSDSd9pVHdZILkmvCtjyXm2D7UYNQLcGKmm4iMDJrxD7a F0l0pEsLCZU99/xU7RfXGW6/Y5FvHjxBCeNPHDvnrliW9kj6RwjxZKBKV2XBofcQTmVNJgzyGbQL2 jEe+NtgZvuupP8sj1oHouN5ehYADS9k5y56BDUZiC8Lruhqp4uSLsXxlWRS8CvoBS/op2lH2tPKa4 YTq3XLGaw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lFdjo-0004Rj-VM; Fri, 26 Feb 2021 14:05:01 +0000 Received: from mx2.suse.de ([195.135.220.15]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lFdiI-0003sJ-WE for linux-arm-kernel@lists.infradead.org; Fri, 26 Feb 2021 14:03:35 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id D7C71AD5C; Fri, 26 Feb 2021 14:03:23 +0000 (UTC) From: Nicolas Saenz Julienne To: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC 12/13] ARM: dts: bcm2711: Mark PCIe bus as 64bit-mmio-broken Date: Fri, 26 Feb 2021 15:03:04 +0100 Message-Id: <20210226140305.26356-13-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210226140305.26356-1-nsaenzjulienne@suse.de> References: <20210226140305.26356-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210226_090327_299130_5BF8B201 X-CRM114-Status: GOOD ( 11.43 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: f.fainelli@gmail.com, arnd@arndb.de, narmstrong@baylibre.com, dwmw2@infradead.org, linux@armlinux.org.uk, hch@infradead.org, will@kernel.org, robh+dt@kernel.org, catalin.marinas@arm.com, robin.murphy@arm.com, ardb@kernel.org, Nicolas Saenz Julienne Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The bus implementation can't handle 64bit MMIO accesses. Signed-off-by: Nicolas Saenz Julienne --- arch/arm/boot/dts/bcm2711.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/boot/dts/bcm2711.dtsi b/arch/arm/boot/dts/bcm2711.dtsi index 462b1dfb0385..825abdbc0d76 100644 --- a/arch/arm/boot/dts/bcm2711.dtsi +++ b/arch/arm/boot/dts/bcm2711.dtsi @@ -529,6 +529,7 @@ pcie0: pcie@7d500000 { dma-ranges = <0x02000000 0x0 0x00000000 0x0 0x00000000 0x0 0xc0000000>; brcm,enable-ssc; + 64bit-mmio-broken; }; genet: ethernet@7d580000 { From patchwork Fri Feb 26 14:03:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Saenz Julienne X-Patchwork-Id: 12106719 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E0BAC433DB for ; Fri, 26 Feb 2021 14:06:42 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0527264E54 for ; Fri, 26 Feb 2021 14:06:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0527264E54 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=FSPINC4Xr91JFnqk7AVhWOrHANMeS9GKmaAPvjtg8C0=; b=tUJN1HwPblgJgCTj4ivoHVate qTr18d9G40zuYxwKsnhM0uv2G2pe5dn1F8e3NhMtqUzTYCL/9ktF7Ez0Spy0njgy4Z5IzFZGg/39B VO2D+xjpHvOBBEcENcy0oJmKRCrUhB5evJaqkXssnjj8wGs/EuPNhOzc8qg54yH9TTv8JtYBv9Ovd +1Q6hhfijoUH3bbA29UIYF5x1rXBhMTCKem3IeEDorOOptzrpK/xCbVED67MxVnDp59exvKsuqxHx CzxJJAumN0NL82CdtqXFHOw4QduIZVIhWivivaC0v0Yp4r2xHH3Vz5mv9nBxMaqUfTHpJqP/HhbIG 6uYwf0WZw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lFdkA-0004dT-RV; Fri, 26 Feb 2021 14:05:22 +0000 Received: from mx2.suse.de ([195.135.220.15]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lFdiJ-0003sW-Fl for linux-arm-kernel@lists.infradead.org; Fri, 26 Feb 2021 14:03:38 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 87AABAFE2; Fri, 26 Feb 2021 14:03:24 +0000 (UTC) From: Nicolas Saenz Julienne To: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC 13/13] scsi: megaraid: Make use of dev_64bit_mmio_supported() Date: Fri, 26 Feb 2021 15:03:05 +0100 Message-Id: <20210226140305.26356-14-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210226140305.26356-1-nsaenzjulienne@suse.de> References: <20210226140305.26356-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210226_090327_753346_445E5CCF X-CRM114-Status: GOOD ( 13.48 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: f.fainelli@gmail.com, arnd@arndb.de, narmstrong@baylibre.com, dwmw2@infradead.org, linux@armlinux.org.uk, hch@infradead.org, will@kernel.org, robh+dt@kernel.org, catalin.marinas@arm.com, robin.murphy@arm.com, ardb@kernel.org, Nicolas Saenz Julienne Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Instead of relying on defines use dev_64bit_mmio_supported(), which provides the same functionality. On top of that convert the implementation to lo_hi_writeq(), for a cleaner end result. Signed-off-by: Nicolas Saenz Julienne --- drivers/scsi/megaraid/megaraid_sas_fusion.c | 23 ++++++++++----------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index 38fc9467c625..d4933a591330 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -259,19 +260,17 @@ static void megasas_write_64bit_req_desc(struct megasas_instance *instance, union MEGASAS_REQUEST_DESCRIPTOR_UNION *req_desc) { -#if defined(writeq) && defined(CONFIG_64BIT) - u64 req_data = (((u64)le32_to_cpu(req_desc->u.high) << 32) | - le32_to_cpu(req_desc->u.low)); - writeq(req_data, &instance->reg_set->inbound_low_queue_port); -#else + u64 req_data = ((u64)le32_to_cpu(req_desc->u.high) << 32) | + le32_to_cpu(req_desc->u.low); unsigned long flags; - spin_lock_irqsave(&instance->hba_lock, flags); - writel(le32_to_cpu(req_desc->u.low), - &instance->reg_set->inbound_low_queue_port); - writel(le32_to_cpu(req_desc->u.high), - &instance->reg_set->inbound_high_queue_port); - spin_unlock_irqrestore(&instance->hba_lock, flags); -#endif + + if (dev_64bit_mmio_supported(&instance->pdev->dev)) { + writeq(req_data, &instance->reg_set->inbound_low_queue_port); + } else { + spin_lock_irqsave(&instance->hba_lock, flags); + lo_hi_writeq(req_data, &instance->reg_set->inbound_low_queue_port); + spin_unlock_irqrestore(&instance->hba_lock, flags); + } } /**