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!