Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 033CBC00140 for ; Mon, 8 Aug 2022 08:05:20 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DFB5A849AE; Mon, 8 Aug 2022 10:05:18 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="Zr9JSrKk"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 347C5849CE; Mon, 8 Aug 2022 10:05:17 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B19C1839F6 for ; Mon, 8 Aug 2022 10:05:14 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=michal.simek@amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RyoxCvd6xZi2NuJdMNuKQ14bnrtkNcIXcL8y5TW0lWEY6tIM9Y76Dg8ucusww6v2X52+Dn5VRiz/LT/1wWqBjJgDrd85g20wgHbxfNUkMXqYJQA7EVB5UsYDhdDkHRDpFFYIJf6uNHCy+s/li7smmq2mMGD9Td8cESErQOZdLK35udkZJcnURml0j27vWZaZJjPho0omU2eQghJGh+Yn6oiBvV8SvX6wEWst3XOyMx8rnapKpenDAFbNmWK/hZU/es4dUthDPmiw575Xqx6BWwFl8paseoO9D+LNuxrum2e0flkLSQT+NimeId+RYDLo16xwE1MwnfBK7fqe/cDtxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ANYNgSTbH4NJQxzzvlOdQC0rXGbsjwfXb0SDSDg4xlw=; b=A8fEijGIn5O15QTJbwBFOGxjkpHlZ7W4oBK/Qc8hHoko4m+6FLOJmPRx3ivVtWCln/iYRVNrd5q7uAOj3lXHJOyYKQ0CFCLIsb+/lx5CGXOjY4ss4jMy2QtdZvSFrCnYPzli9vhUtkKBGC3k/x9qwcb/p+jbVMAAgrNmeIJaWiUIVL8hm89mc61C1+Hx6L1AOoIKA3gjYHbpD3/l0GczIezt1pj5/trJknpPCwcaSZRxEKAsSgQDUe7/g7P7A0msYC3D9GW7Rp5JAQAD3zBWoN7jujk+aHDThSADcZGiTlavLdGSAyUTO7vHtlZvi1gg3lKIioaqh53vjGJMzpMeDA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=gmail.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ANYNgSTbH4NJQxzzvlOdQC0rXGbsjwfXb0SDSDg4xlw=; b=Zr9JSrKkCjvVIVhzMy3J7e1vo2GptihagxsB1niJ7zURNpxyLzx7zLysNDuwVN24FHsZvmiNLRhPdYi2Xblx9eXEYi/zDr0goV7FCJNaYVB7iWr9cs4D/p38ttZGsPF+wtE8hTAaFu+qQaOGZoj1Bv6LudbY+hhJtRXqskw9Wb8= Received: from MW2PR2101CA0028.namprd21.prod.outlook.com (2603:10b6:302:1::41) by BY5PR12MB3809.namprd12.prod.outlook.com (2603:10b6:a03:1aa::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.15; Mon, 8 Aug 2022 08:05:11 +0000 Received: from CO1NAM11FT005.eop-nam11.prod.protection.outlook.com (2603:10b6:302:1:cafe::b4) by MW2PR2101CA0028.outlook.office365.com (2603:10b6:302:1::41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.6 via Frontend Transport; Mon, 8 Aug 2022 08:05:11 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT005.mail.protection.outlook.com (10.13.174.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5504.14 via Frontend Transport; Mon, 8 Aug 2022 08:05:10 +0000 Received: from [10.254.241.52] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Mon, 8 Aug 2022 03:05:08 -0500 Message-ID: Date: Mon, 8 Aug 2022 10:04:31 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Subject: Re: [PATCH 2/3] net: emaclite: fix xemaclite_alignedread/write functions Content-Language: en-US To: Ramon Fried , Samuel Obuch CC: U-Boot Mailing List References: <20220713135204.233268-1-samuel.obuch@codasip.com> <20220713135204.233268-3-samuel.obuch@codasip.com> From: Michal Simek In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8db2e5ff-96e3-47c4-16a5-08da7914b776 X-MS-TrafficTypeDiagnostic: BY5PR12MB3809:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FwZBK4shfyOJplsxy0NI6f8qpi9JlgIprD2CI8RYs+S24hwxPVWp7kGKuzSXsGQTrOaOuPeK0nzZQgHnxJmR/6H0+stO9p3CMCQ+FA8rgHFctQWDi7h2qt6OGewsxVC5BjrWHkx9Q4lDMNdjnNa/d2sb6kGY+fGsctkHaoTvrJG1AGdIXTilxGk2CPfF8V8+L+4A8rlcGYGH4rpdnVdizSAfpPg8xKNEND3jIQPbD6DMjgWjkt0QNiddSM1gdVF53emsyLgf2BrCPjJAzt/ugmfrycvgq98o1zqAOWBXh1Ktruv/oZbn/1GoH9bV+ifl7GOMpuGLwds0txg5KSwZrm4kKA2dqdRd0zlHTV+3t6vEIZGTcqxMrhCNzPog+k1DXz+GNSeYuvG92vLmHuJwg96VC4xUyWq8y31wluANAv+aw2yqy595K3CVYAEJ3cOidxsYqVNsFhHQdrA2tNT14wEaDs0OlBVqvi8JUM3BvGP9TwlKF64QaNVHY4QehuBrPJaD8WKZngxC6VrNVHg51PwVKEO8bMBwYSdzGyWk9LVVFHs5dAqs5B9jtFmzOEJhaA2lRxZV+QeeAcxMCn66wEyTjYoy7w0YweEPiMLSSc73BdRtndvziqijoMRZksVra5pVv2n/zX4vmebIfw2rPdc4YhizqehfkW791vhkda2KjSXf/VXTR8V8WiyVrw6yKClP8UljWj02r/5RnUVXp0b0qUWHv1noaO24wuclajXBixhY67gMzmGeT56F3NJ1d2Hx+doGVr78giP1zMuGCQX5+zqFBMj7cawYGj315LQ50uXxv8qg4LhDjKjy3rZyLof40FANGHNtfAp9kqCyBoq4raVp+8lzoZfiACRawRc94d12y1GLchUV2AKe8XU/ X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230016)(4636009)(136003)(376002)(346002)(39860400002)(396003)(40470700004)(46966006)(36840700001)(44832011)(70206006)(478600001)(82740400003)(8676002)(8936002)(81166007)(356005)(82310400005)(5660300002)(40480700001)(31696002)(70586007)(110136005)(16576012)(86362001)(4326008)(316002)(426003)(336012)(26005)(83380400001)(31686004)(186003)(2616005)(36756003)(47076005)(16526019)(40460700003)(6666004)(41300700001)(36860700001)(53546011)(2906002)(36900700001)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Aug 2022 08:05:10.8904 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8db2e5ff-96e3-47c4-16a5-08da7914b776 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT005.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB3809 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean On 8/6/22 19:33, Ramon Fried wrote: > On Wed, Jul 13, 2022 at 5:02 PM Samuel Obuch wrote: >> >> Use __raw_read* and __raw_write* functions to ensure read/write >> is passed to the memory-mapped regions, as non-volatile accesses >> may get optimised out. >> >> Signed-off-by: Samuel Obuch >> --- >> drivers/net/xilinx_emaclite.c | 9 ++++----- >> 1 file changed, 4 insertions(+), 5 deletions(-) >> >> diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c >> index 5cd88e04fe..de7a2dee0b 100644 >> --- a/drivers/net/xilinx_emaclite.c >> +++ b/drivers/net/xilinx_emaclite.c >> @@ -113,12 +113,12 @@ static void xemaclite_alignedread(u32 *srcptr, void *destptr, u32 bytecount) >> /* Word aligned buffer, no correction needed. */ >> to32ptr = (u32 *) destptr; >> while (bytecount > 3) { >> - *to32ptr++ = *from32ptr++; >> + *to32ptr++ = __raw_readl(from32ptr++); >> bytecount -= 4; >> } >> to8ptr = (u8 *) to32ptr; >> >> - alignbuffer = *from32ptr++; >> + alignbuffer = __raw_readl(from32ptr++); >> from8ptr = (u8 *) &alignbuffer; >> >> for (i = 0; i < bytecount; i++) >> @@ -136,8 +136,7 @@ static void xemaclite_alignedwrite(void *srcptr, u32 *destptr, u32 bytecount) >> >> from32ptr = (u32 *) srcptr; >> while (bytecount > 3) { >> - >> - *to32ptr++ = *from32ptr++; >> + __raw_writel(*from32ptr++, to32ptr++); >> bytecount -= 4; >> } >> >> @@ -148,7 +147,7 @@ static void xemaclite_alignedwrite(void *srcptr, u32 *destptr, u32 bytecount) >> for (i = 0; i < bytecount; i++) >> *to8ptr++ = *from8ptr++; >> >> - *to32ptr++ = alignbuffer; >> + __raw_writel(alignbuffer, to32ptr++); >> } >> >> static int wait_for_bit(const char *func, u32 *reg, const u32 mask, >> -- >> 2.31.1 >> > I think that using readl/writel is fine, no need for raw_... For microblaze that should be fine but let me ask my team to rest it on ARM. I think that __raw version are safer because this IP can also run on big endian systems and I think that was the reason why readl/writel wasn't used in past. Thanks, Michal