From mboxrd@z Thu Jan 1 00:00:00 1970 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=-15.3 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,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 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 51629C433E0 for ; Wed, 3 Mar 2021 19:51:38 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 8D31B64EBA for ; Wed, 3 Mar 2021 19:51:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8D31B64EBA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com 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=desiato.20200630; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:Cc:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=f2ubBZaNiKgI6fmPGGnkOedCr0yWoE+d0zbWhA++SJQ=; b=qBpb73edTS8cIl9grE0larbUB O5ICuaoGh/h3EUrvt85QJifZDnzf73knL1un+QgPXDYz+dby/wqoRTxACJviqGi2varOmNksdkl+4 JipezapPtVfQw+RQMD1piBDk6x9caOfNP4jMo+7kbwF8Nbt0cg27bOeFPOa1Ehfl+RsXOqp8UBLZ1 nbq+K2QgRA9CruoE9UextUHD3zrl97bQue8h3zjuBOMlM/dTz0Aq91TCXbLMdyFcNINpIhBJYuC4K 0/Jpaf9jGKEnZKbpacZ68eI+lfmBWH5jAW76jsfdsb28fQSgJ+NpKy68GfyY+ODxA9B/DVDn2JsYV j7oQpqgHQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lHXUW-006I1j-DT; Wed, 03 Mar 2021 19:49:04 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lHT4P-005IMn-9L for linux-arm-kernel@desiato.infradead.org; Wed, 03 Mar 2021 15:05:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender :Reply-To:Content-ID:Content-Description; bh=GgbAyYe8Haw7NT2zRqZanIWmYlkGE1dV47alhKG06DU=; b=BFD+JhSMfxCnC0Jv+rf+IyvEzO 6zmQbTN8dsedWyKVhJFpL3U1ra82KD8aUMQoyhjT/esL1X3kwmuGpPKW9s7G702bYOQ7SVR3IL+Vb AdtsdThN7qpbwigv0DmEkxqlbw+F3cYil3C2YdqdeWXbEvoLlgXhBrDyDd3a/jII4SiXtfykAWHn6 6jRGXqPtY7orpggdMAUkWReZtd7CnNHYzd52IhW8zf6dUUN/jDWr8heydgR6QqZFcBTf6OTE/U+/N e+TGTrfn5CjnFjxB7j8SgAoH7AV6huOzZbO1N4EqqlDeNeMhFPTqUJ/ZUBtnubZ1UhOAXQf51C06A iPPAoE2Q==; Received: from foss.arm.com ([217.140.110.172]) by casper.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lH3DQ-00H0mS-Gs for linux-arm-kernel@lists.infradead.org; Tue, 02 Mar 2021 11:29:25 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 663B01042; Tue, 2 Mar 2021 03:29:18 -0800 (PST) Received: from [10.57.48.219] (unknown [10.57.48.219]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 08EA73F73C; Tue, 2 Mar 2021 03:29:15 -0800 (PST) Subject: Re: [RFC 02/13] driver core: Introduce MMIO configuration To: Nicolas Saenz Julienne , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: f.fainelli@gmail.com, robh+dt@kernel.org, ardb@kernel.org, hch@infradead.org, narmstrong@baylibre.com, dwmw2@infradead.org, linux@armlinux.org.uk, catalin.marinas@arm.com, arnd@arndb.de, will@kernel.org References: <20210226140305.26356-1-nsaenzjulienne@suse.de> <20210226140305.26356-3-nsaenzjulienne@suse.de> From: Robin Murphy Message-ID: <644fd416-ab64-f1cc-ffb0-ea5649e3b600@arm.com> Date: Tue, 2 Mar 2021 11:29:10 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <20210226140305.26356-3-nsaenzjulienne@suse.de> Content-Language: en-GB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210302_112925_366454_C6D01225 X-CRM114-Status: GOOD ( 24.25 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2021-02-26 14:02, Nicolas Saenz Julienne wrote: > 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. Devil's advocate: there already exist workarounds for 8-bit and/or 16-bit accesses not working in various places, does it make sense for a 64-bit workaround to be so wildly different and disjoint? > 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 As mentioned previously, 32-bit systems may not need the overrides for kernel I/O accessors, but they could still need the same workarounds for the memory-mapping implications (if this is to be a proper generic mechanism). > + default n Tip: it is always redundant to state that. Robin. > + 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; > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel