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=-5.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 4D1A3C4708A for ; Wed, 26 May 2021 15:01:11 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 1FCD9613CA for ; Wed, 26 May 2021 15:01:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1FCD9613CA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=armlinux.org.uk 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=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=TWnBWQWiWNxSJAGfT7H4O9nAXWLkMPDDYnRU7Vkd680=; b=W4mmXAUMuUH/D5 gDu1/MCSkQwOFG1yXDuT2+myMhqNaJ99eOO4+4LFYwV2PomZUcV1+dolEnXw2pOTAu4nFEUS02/Vp zX/RmMJFL7qG9nnHeCUh8HgE0vc7AVlq2VxgRgJ3w8SrAYbbbywcjKI1jhlneEdVXYuQr4gBReZxd EnqoPSwP/FM1Cy3cvekwD99wEAu3X18HwxBinBaSo9nk3+d1aRa6N1cExXl6hsweGHMGT8xDepUXP Q6atrMC2MefNbpJdxIDtAgq4ffEhlOdq2i6vlSlSxXAjnCyi7iOyh97weCYJtJflZD7ngESSI/18Z fRFxifOtJcXOpH5w2XEQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lluzt-00F8dS-Ul; Wed, 26 May 2021 14:59:03 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lltR5-00EMuF-7u for linux-arm-kernel@lists.infradead.org; Wed, 26 May 2021 13:19:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To: Content-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=AtyNGkK8eQQ4yETujkNMVRNzBw+u/5DNWTIq6k0iVNo=; b=HkQ97ZYa2u/HpSIixOgyTqLgU N81a37GEKox0QE4c9Ic6y88IPgXM/Fox8WCERAlzUnE4lbIEAU1gXqqsAsSYqXMNLNpVUJUIobJmB zAtOdg1Mt7Ky/4Zl6fZfY1Vzlc8nS6o/pCg1rWYvoNFGuQqAxiWSTodvcRBfRA0JLGiFBp1tM9jZa PExb1/6+lchstl7fOj8CV0vELRQzW2XZKetI7qbrbIUimjRj7uuyYUWTR29nUKR5a2dhOpbKRelMr umySRo0g9BaGm7iVHI1EYHa1LNIrkRcpR7mbwgSomU7EmCUo7m13QpVWMFI/U78u3qp9yAFFyvwKC WHLGNsUVA==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:44374) by pandora.armlinux.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lltQz-0005e5-Mq; Wed, 26 May 2021 14:18:53 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1lltQz-0002ps-Dl; Wed, 26 May 2021 14:18:53 +0100 Date: Wed, 26 May 2021 14:18:53 +0100 From: "Russell King (Oracle)" To: Krzysztof =?utf-8?Q?Ha=C5=82asa?= Cc: linux-arm-kernel , lkml Subject: Re: Data corruption on i.MX6 IPU in arm_copy_from_user() Message-ID: <20210526131853.GE30436@shell.armlinux.org.uk> References: <20210526100843.GD30436@shell.armlinux.org.uk> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210526_061859_323222_1E1DEEFA X-CRM114-Status: GOOD ( 14.79 ) 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org T24gV2VkLCBNYXkgMjYsIDIwMjEgYXQgMDI6Mjk6MDdQTSArMDIwMCwgS3J6eXN6dG9mIEhhxYJh c2Egd3JvdGU6Cj4gIlJ1c3NlbGwgS2luZyAoT3JhY2xlKSIgPGxpbnV4QGFybWxpbnV4Lm9yZy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CBzZWVpbmcgd2hh dCBlZmZlY3QKaXQgaGFzIHdoZW4gcmVhZGluZyB0aGUgSVBVPyBBIHNpbXBsZSB0ZXN0IG1vZHVs ZSBzaG91bGQgYmUgc3VmZmljaWVudC4KSSBzdXNwZWN0IGl0J2xsIHNob3cgdGhlIHNhbWUgdGhp bmcgLSBiYXNpY2FsbHksIHRoYXQgdXNpbmcgTERNIHRvIHRoZQpJUFUgaXMgYnJva2VuLgoKVGhh bmtzLgoKLS0gClJNSydzIFBhdGNoIHN5c3RlbTogaHR0cHM6Ly93d3cuYXJtbGludXgub3JnLnVr L2RldmVsb3Blci9wYXRjaGVzLwpGVFRQIGlzIGhlcmUhIDQwTWJwcyBkb3duIDEwTWJwcyB1cC4g RGVjZW50IGNvbm5lY3Rpdml0eSBhdCBsYXN0IQoKX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX18KbGludXgtYXJtLWtlcm5lbCBtYWlsaW5nIGxpc3QKbGludXgt YXJtLWtlcm5lbEBsaXN0cy5pbmZyYWRlYWQub3JnCmh0dHA6Ly9saXN0cy5pbmZyYWRlYWQub3Jn L21haWxtYW4vbGlzdGluZm8vbGludXgtYXJtLWtlcm5lbAo= 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=-5.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 C5020C47082 for ; Wed, 26 May 2021 13:19:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A42B0613B9 for ; Wed, 26 May 2021 13:19:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232911AbhEZNU3 (ORCPT ); Wed, 26 May 2021 09:20:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232808AbhEZNU1 (ORCPT ); Wed, 26 May 2021 09:20:27 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2081EC061756 for ; Wed, 26 May 2021 06:18:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To: Content-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=AtyNGkK8eQQ4yETujkNMVRNzBw+u/5DNWTIq6k0iVNo=; b=HkQ97ZYa2u/HpSIixOgyTqLgU N81a37GEKox0QE4c9Ic6y88IPgXM/Fox8WCERAlzUnE4lbIEAU1gXqqsAsSYqXMNLNpVUJUIobJmB zAtOdg1Mt7Ky/4Zl6fZfY1Vzlc8nS6o/pCg1rWYvoNFGuQqAxiWSTodvcRBfRA0JLGiFBp1tM9jZa PExb1/6+lchstl7fOj8CV0vELRQzW2XZKetI7qbrbIUimjRj7uuyYUWTR29nUKR5a2dhOpbKRelMr umySRo0g9BaGm7iVHI1EYHa1LNIrkRcpR7mbwgSomU7EmCUo7m13QpVWMFI/U78u3qp9yAFFyvwKC WHLGNsUVA==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:44374) by pandora.armlinux.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lltQz-0005e5-Mq; Wed, 26 May 2021 14:18:53 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1lltQz-0002ps-Dl; Wed, 26 May 2021 14:18:53 +0100 Date: Wed, 26 May 2021 14:18:53 +0100 From: "Russell King (Oracle)" To: Krzysztof =?utf-8?Q?Ha=C5=82asa?= Cc: linux-arm-kernel , lkml Subject: Re: Data corruption on i.MX6 IPU in arm_copy_from_user() Message-ID: <20210526131853.GE30436@shell.armlinux.org.uk> References: <20210526100843.GD30436@shell.armlinux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: Russell King (Oracle) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 26, 2021 at 02:29:07PM +0200, Krzysztof HaƂasa wrote: > "Russell King (Oracle)" writes: > > > Surely someone is not using copy_*_user() to copy data from userspace > > direct to MMIO space... that would be crazy. > > No, it's the other way around: reading MMIO mapped to userspace (mmap > on /dev/mem) and copying it to simple kernel buffer (e.g. pipe buffer). > I.e., the MMIO is the userspace here (thus copy_from_user()). Ah. I think we assume copy_from_user() will be used on memory only and not device mappings. In any case, looking at the architecture reference manual, LDM is permitted on device and strongly ordered mappings, and the memory subsystem is required to decompose it into a series of 32-bit accesses. So, it sounds to me like there could be a hardware bug in the buses/IPU causing this. Can you try using LDM directly inside the kernel and seeing what effect it has when reading the IPU? A simple test module should be sufficient. I suspect it'll show the same thing - basically, that using LDM to the IPU is broken. Thanks. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!