Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp6099511rwl; Mon, 9 Jan 2023 04:18:58 -0800 (PST) X-Google-Smtp-Source: AMrXdXulOOrImLc9r5WweosPriMdtpfHqrz5wZYdAiDZVwz8RAuKlGhD5wrX89SeDLym+YR161Eq X-Received: by 2002:a17:902:b08d:b0:193:1f24:41c9 with SMTP id p13-20020a170902b08d00b001931f2441c9mr6501931plr.65.1673266738189; Mon, 09 Jan 2023 04:18:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673266738; cv=pass; d=google.com; s=arc-20160816; b=V7jKlk8tHHi2KRIjQV+WNISvlF5xua1qZaA9wyrANF/p7h5am1WA5FgHDP0eanbN20 EYKvjLE097jfLwUBRPzNlyWiIdnq7v6t22hXE+ANEnSWLAe8gdu3eccUHsEABHUPbp7d iUswSw6Zjn1aF7yKa4JrOgj3WylggwIkmQQcN8Ev6o4PnJ0/d2Zn/eVxwiICW0sIQmFB v7DI1jiDtE2WrYRTkIXrA6GkT9E841QcUgnRWuw82DCeF54EjLPjWCIanBhr4Ohc8MMs RgVUtaYqXgCooNYabPLnJjkLBFFrlXyGJIydOjWUR5yhsH/DlfHgo/3IZi59SfFE+0qT uq5Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to:content-disposition :references:message-id:subject:cc:to:from:date:dkim-signature; bh=LtsGF99Xzr4uqDBj2kDgx7Vo+UbdtLaqx9hP0XKFK9o=; b=BBNkiHAo4dRL5ziLT42aqukdLYAMgME2MBHoDwPRwU6Y4hY2V64oiaMd2VK7z1Yo2y 8dzsK3gEQV1Uu6wr72a7oJTvdLdk5h3oWFgbVHsoZiZ4MdX6XZs0tU+Y+pLY+0ZLk4rN wWaaijvU8wALN+Wn5XQ9WUfs3qS49s1GAUl9WmvncWYs/4/wXdThwh2uALP2IPraohAu MFU4XBJZUa41PtdxaUelU+irza5PflFvmCGy9wASODnQIN2p+nWMRhVwm4zMu5ngrdVJ bs8s1IrndzpT51PvccCsGBdunXnhTwfXW+5njqn/kXyfaoRQF+26gybt7cWNT6xU2zn4 atqw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=OhseKkbL; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jh19-20020a170903329300b00174ea015ee8si8250801plb.592.2023.01.09.04.18.51; Mon, 09 Jan 2023 04:18:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=OhseKkbL; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234198AbjAILkd (ORCPT + 53 others); Mon, 9 Jan 2023 06:40:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237054AbjAILkX (ORCPT ); Mon, 9 Jan 2023 06:40:23 -0500 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2060.outbound.protection.outlook.com [40.107.6.60]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AD531F1; Mon, 9 Jan 2023 03:40:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Taid3Rw6DjtWA48MgtDcD+bUhA9USIjBKJlpbJExUwyWxPOBBD1vrBLA+S+CMY2Mz67Oe1Chlij/AjBmL3fRuvuTOeBE605KJTbgZcCAMM2iszV/VB1HbVzZS1OKgyPdFkZVUZ53omR2qKb5D73A1tXC4yXQcY2kRq6Z7OM1E1mZUs67SIN7SyyLlU226V59rTppFjTHemKz3E+3zbkNYRjCRfDRU2vuqOzzY9D9ITzBop8ZFWUASW/loR4G15fvfZq7KldZJ/PGLumK2mmBdUFhkI3wO4Ok6JY/Prh3zDQOry9LthD+nEiXY5NEon15dyReD+N/a9JdvVMkj2qCOg== 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=LtsGF99Xzr4uqDBj2kDgx7Vo+UbdtLaqx9hP0XKFK9o=; b=JocZUTJvwUsP/jF1NlfkNLxqsLQPIOWzQycYGarTRlLxHLIsTamdGdbTz1wGeOrP7rS9zCinmlr+vlp2q4jOOlgodveW1O0p1lmeGeMkuwjsS56gxQzpwYl77VcgJqt2kD+zrRpmEX0jXY1St8+0V8isvFPwsi6GE572rpLFX3wERlNuflG5AXn5QZHlJcy1f0e2LP8/YVszFWkQE/cVodjHVw1Pqtb/meKzN9UXjso9k6+bzGj2Zc9BlKjOfJrGB7N8iD96smsr41jt47T3MyCWGu6T2MCf4zkPShbC9959mmnvBiaNhA06a8ao6gyPC8XdWemOGBMvnGkAfL126g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LtsGF99Xzr4uqDBj2kDgx7Vo+UbdtLaqx9hP0XKFK9o=; b=OhseKkbLuIzA1D7NR+gcoA3nXuHdw5LKvp7eN3Gt4vYkgXruNYA4+S0t7wxSYf6/kkxTT0PMS4H7X81yn/Zt1lxsynbWMrou5aFDuFafRBCA6hnt6N7geW02iP+GYPHXLJ9/GrsyG8XudxMFag95fRZH8RPg8iB/UNVofTM0eRg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by DU2PR04MB8903.eurprd04.prod.outlook.com (2603:10a6:10:2e2::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18; Mon, 9 Jan 2023 11:40:20 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b%4]) with mapi id 15.20.5986.018; Mon, 9 Jan 2023 11:40:19 +0000 Date: Mon, 9 Jan 2023 13:40:16 +0200 From: Vladimir Oltean To: Arnd Bergmann Cc: Linux-Arch , linux-kernel@vger.kernel.org Subject: Re: Sparse warning when using ioread64() from include/asm-generic/io.h Message-ID: <20230109114016.z6qowgppuh7uoj75@skbuf> References: <20230109104054.gabdvjxyawdfbqii@skbuf> <9105d6fc-880b-4734-857d-e3d30b87ccf6@app.fastmail.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9105d6fc-880b-4734-857d-e3d30b87ccf6@app.fastmail.com> X-ClientProxiedBy: FR2P281CA0025.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:14::12) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|DU2PR04MB8903:EE_ X-MS-Office365-Filtering-Correlation-Id: 341ada09-5cb0-4d2b-6262-08daf2364941 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tO/cFYfFgbFB6+pYh2vMbyomzp8mBfNJJoD6o32sj4QXC1nkM/tdUVcUzghd+qvOVZQbXKJM83OqYIN5YYH2QXP+X8RstkzL6rDg9XBpvO9KAty/IETS8O2tPzGNLK/03Ax9Ix+XBzxTYaCuOzjFpmcDTRDICt+Nub+Xi6ER7vxVURtlyL66Oh8/LufoOUwOLOzDdyvNLnYYQbc5z9wS8ytgcWZDhsxIFK54r0IBGGSwPc7HDy17oEV5Nd5wQcCQN3/TpzBYq/QuAtm2ZMJ0Sc2i/LskjyKVi2/2TRnMqHILVk5QiFoyU1/ZoaurT5jqSZil2u+5bTDM/G6jriENMm29cGhWaAuR5pAIkrXV9ZvglfHkyb7+uPFQQMkcMyRtJezl6Lx4PI6Cx39vjwJ2EemFZLtAbXF6yGFQqoIsS/eh+/f3pVTI+/2NTzgmd0qR/7TBFVltr4y8hweI5m6hx1qUBTgstKHrDfJYXj9RQRmu3rMlqU7hxxOysd928Bnbp0iHs0XI/rnrqOqtvMuGiewMrV7HANLfKebHrQxds6ReRc2Eaw5sjYWOxRtKrD2/MDOmgjy/Ct+8iVglL51/WsKDBXDwj3x/U3I6N3+Rp4TahorKPYgiCF7cjlLgQ5fGx7NUJkA+dhKeN4Oa1ZqoM0KlFHfXhKT/hg1WXJrHZz6VAkck7NN9PKEBb0M6G6Cj X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(7916004)(4636009)(376002)(136003)(39860400002)(366004)(396003)(346002)(451199015)(8676002)(4326008)(6916009)(316002)(66946007)(66556008)(66476007)(44832011)(2906002)(5660300002)(8936002)(41300700001)(86362001)(83380400001)(6666004)(6506007)(6486002)(478600001)(38100700002)(1076003)(9686003)(186003)(26005)(6512007)(33716001)(41533002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?1WmIq2LABxuX1xzlMhxux2Eta/w5/i56iFOjGkeWxwyxeR4jj9Dx29SzPzn/?= =?us-ascii?Q?d2aPudtiFbG9X5JVq/lVFjlLPCfbT92exSVGwNdt1ZSav2JZh/KkW+V5zKdZ?= =?us-ascii?Q?QDmD5zlGBcsUS8jmiO16TIiEOYrKQkXtpPWiUbHmIYyRGIhaOVw8Z6AEmrDh?= =?us-ascii?Q?YsD2VB6JL7gBWPMTz955MW/sveOjuHdQ1EWWlirI9FdJXdf7QcXkUmucybgY?= =?us-ascii?Q?Be+PdH8tf//TmKnADTj5ZltfoiatsKaBszmYn6Fr+EHGKbkRdrPBHIFxocgh?= =?us-ascii?Q?rZ9jdrdKvCWxnxZj2WJg7mKh5M1k+IwIyqD0jF5RUNdeSYbjG8ZtC0kQJ/VT?= =?us-ascii?Q?4Lm74/G5BIL1kOGz60Mc3y3GJp6j4DWKhdc/MgdgizTkagr78y0GL/S/7kkE?= =?us-ascii?Q?4kY6G9fQMTDhJ3bs2tDBUQ6d23T3Uy9vjGgUCY4ESQK2cd/I+lrzO2lZjKH+?= =?us-ascii?Q?g8onOL8OQZsN57LYrZWUxtO+pUS/XwWJs+rwa0600zLzxdBS34suHRi6+B8D?= =?us-ascii?Q?U3Ox5Tf5DfTugwan0HnjF9thbQaCF2Gg7iC0e9driRQdlXIO2EyPebkXQvMq?= =?us-ascii?Q?q1f36cBK84sY8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-ascii?Q?3MGM0WuAsxJ6oZqzFlrRZL187dM9uXwP/5HrT1vD6kPqmb9uYsCX+ThSPWh4?= =?us-ascii?Q?bEmliXQhMENwzGXjZIE0bCPWi/io9BkLCTNlYf3ThPN+PORHtCU95wO2KZ6X?= =?us-ascii?Q?Sg=3D=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 341ada09-5cb0-4d2b-6262-08daf2364941 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2023 11:40:19.9242 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: zwWpXZsxwP7+wDCtGP9w3SGI1R+hBfqs54miLpXt2j9zO+k7B5R29Vg2miHFDB+B1uGq2kn4u1AAXEZxF/N4OQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8903 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 09, 2023 at 12:33:31PM +0100, Arnd Bergmann wrote: > On Mon, Jan 9, 2023, at 11:40, Vladimir Oltean wrote: > > Hi, > > > > I would like to get rid of the following sparse error in the enetc > > driver (for arm64), which uses ioread64(). > > > > ../drivers/net/ethernet/freescale/enetc/enetc_ethtool.c: note: in included file > > (through ../arch/arm64/include/asm/io.h, ../include/linux/io.h, > > ../include/linux/irq.h, ../include/asm-generic/hardirq.h, > > ../arch/arm64/include/asm/hardirq.h, ...): > > ../include/asm-generic/io.h:239:15: warning: cast to restricted __le64 > > > > The trouble is I don't understand why the casts to __le64 and use of > > __le64_to_cpu() are even needed, when everything seems to be native > > endianness. I've seen commit c1d55d50139b ("asm-generic/io.h: Fix sparse > > warnings on big-endian architectures"), but that doesn't claim to fix > > anything for little endian (and doesn't touch the 64 accessors, for some > > reason). > > > > Could you please help? > > From what I can tell, the fix for openrisc was described as > a big-endian warning fix, but the warning is actually the same > on both. The difference is that on little-endian kernels, > the __le64_to_cpu() conversion only changes the type but not > the value, while on big-endian machines, the value would > be wrong without the conversion: __raw_readl() is defined > to never byteswap the data, while readl() must byteswap > little-endian MMIO registers into big-endian CPU registers > when CONFIG_CPU_BIG_ENDIAN is set. > > Since Stafford only tested on 32-bit OpenRISC, he missed the > readq()/writeq() accessors that need the same warning fix. > > Arnd Hmm, ok, didn't know that difference between __raw_readq() and readq(). With this information, I guess I can submit a patch. Thanks!