Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp5258625pxj; Wed, 26 May 2021 06:36:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzpLEQTvtmJLWN7jWFMvoYhD5PEMMuH8sXBlikm/Ker7WgGQMiSaAhFsbk95NuW6pblfD06 X-Received: by 2002:a02:b78c:: with SMTP id f12mr3329656jam.7.1622036217307; Wed, 26 May 2021 06:36:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622036217; cv=none; d=google.com; s=arc-20160816; b=h30XxlUftBsbSmWoo1HiJ5CSrxsF9ehch1qtesks6xrUmRFZKGuNc7G1epf47m1TC0 MMOYU/8xFigaKgYkUG1MZCj3PXbt3hEqlgNxP04J7twHREYziZhYex6OWuZmg4klMMX8 4kb4iVfOV+Hsnm8muSJZ5Y88iBG0B2vA7s/Rqbvz/ZuTj0f/uufdJWmkisGQdUs8jCE1 mbcbpuqeg62pa2XBuP7AH4XgnNtr5+6XOYZpEe6iKN2rasiK4RR7fgnEgUUVoRhJVdSp 3b/RfRCQSTMgvi4bVhsVpDdZZjcsBQoKCWhcEWC2WfyrvPaA5j2yl5rjZLgXTyUFg84s 9f7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=AtyNGkK8eQQ4yETujkNMVRNzBw+u/5DNWTIq6k0iVNo=; b=sJ6FxJVJ53jnno3GRvjEFnl4uO44LjJAL7aVJAxqh0jArbpQ2TYAT7DpXeMLc7VZhw GEKWJVyb9Il7etKW7SNHpQYddIZn9XvsYWHuClz33mZePXI1wLN+9nKkLtjR3vkMJZU8 aFvc7Oci3dEmRWgX8OrthtcwZp8vj0Vq8+qnK8C20SY0Ns11VhA9RNkyZWf9uFk4K0qe VW8xenxHKTD2dflav+r8t1IwwaXM5UqKWt9sR4jPfuqhUmYOdMY+2siFpQrrFZPrEHoC 9JJ7t2WFbm/tANRfQ+ABX7O54qHGrou1CkrRZCwrtpG8uqcYqpd5UuxMLt0C752m7mJP HsAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=HkQ97ZYa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s7si17274941ilu.37.2021.05.26.06.36.43; Wed, 26 May 2021 06:36:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=HkQ97ZYa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232868AbhEZNU2 (ORCPT + 99 others); Wed, 26 May 2021 09:20:28 -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!