Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp4649769rwi; Mon, 17 Oct 2022 08:55:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7ie+ZC6RX5VdKBzIjN3H+2b0rlfonNbP6fJY6hlDHKBjyveP/iEpjrAVz5LNhuGOlrnr42 X-Received: by 2002:aa7:db07:0:b0:458:f6e5:ab71 with SMTP id t7-20020aa7db07000000b00458f6e5ab71mr11123274eds.330.1666022126866; Mon, 17 Oct 2022 08:55:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666022126; cv=none; d=google.com; s=arc-20160816; b=Gtxa55bn6saLZpycQV+XDCd1PRifCa/nsMd9OWj6YO9I+gIbk4KnjdIpEWLv8vXDqW f2SJ9JQ5AHRqhCOfOffZqZjdzOzfC49M9ksbaEI2HwOdpHhJdIHcUmOP4wV2t/Tsak41 1HdCW6kCPvELsSUaY0ioLLrfZMm3iHKUOghKebaXB0h3DxIfMG/uz8O90qQmTSBr2oCI 7h+Fz3f85EcXxeBvhamS2zChEFp8oxnQaXLfXqtVX1x0t8chasMyif4JM8/CZGu13uuu HcbxjXuChzs/qzowys4x3UlsgvbHyLxUvXzzupJO/XIgDzcfVvYZT619K3s66FVvGYCy YHUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=sOV8A8y2OEDCqeDMSFkwrO9Qw07N2EwVNNkiwYHAOws=; b=vYayQqQTXbqSXnRzr1fRlmrGBvKG4vof3Owjef/xadaim3wpu9AZbx352OzEs+kwAi hk51S48w0wU3t0M2BNuk1/nQnZ55f1gKuWwf6JNmbQ0J48jDrdIGCsYV2dbiXAhDGz5k 8l5ZAi+UD1pqbLsd4LhHvye/7ja47LeEli47tJ2QMUVrM1NUczeDpECZU+jamB7mESIE aPYn4HWn0jUVAvu2CZ/BZGhg8WBEmK2wx6mDGy5ti/dcu6KDLm3F8luyLIhsZWwuCYqI he6B4ihgC+heD+qMqcU5sNvBY/gJNoK01BNnXpo3tUJYjVbL8CeB/XPhs5eYkpAaftVr 3Gmw== ARC-Authentication-Results: i=1; mx.google.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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a26-20020a17090682da00b0078d9d67841fsi7844254ejy.400.2022.10.17.08.55.00; Mon, 17 Oct 2022 08:55:26 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231259AbiJQPPe (ORCPT + 99 others); Mon, 17 Oct 2022 11:15:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231350AbiJQPP2 (ORCPT ); Mon, 17 Oct 2022 11:15:28 -0400 Received: from mail-qt1-f174.google.com (mail-qt1-f174.google.com [209.85.160.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3C8920F53; Mon, 17 Oct 2022 08:15:23 -0700 (PDT) Received: by mail-qt1-f174.google.com with SMTP id w3so7861218qtv.9; Mon, 17 Oct 2022 08:15:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=sOV8A8y2OEDCqeDMSFkwrO9Qw07N2EwVNNkiwYHAOws=; b=Wf6qHQIgc/9+LqENrlT6LpwlJV036Yx5V3qlBkt1qrdVBHcP1MMVW2O6StajdlMZQW A50mwMSWOSx1NQYXC+NMV9eQkTd7tUdDRdqHy6V+q5XS5J+jZDfz4O0ydHAKYjn6WYsw YeJrFhvDTxs2HYFW+mewod8wLqXGqFDe/iBpfB7IGVZdziXlGDiqeSmD+2Vdjb7QHp27 Vw/tchHhWbYaBPmMHMdeyThyA5qGeyiwALiYTH6TqM/aEDLLPNlMM2rs8fmWm6nGxsIB o5PpCZVH9QpQmr791tfIUxAWxamZbzHCD0S8JjshzPY+jIJRQAqWU3/vB0cGVV6yuILv bZWw== X-Gm-Message-State: ACrzQf0F0utvt1yfj94rzT5DgHRn1SBF6hrMcXbolVQSz1SQNpYIgBZJ br+R68XeQtmy2GVvGeNeetCaA6w1ggJpGg== X-Received: by 2002:a05:622a:14c7:b0:39c:ec5e:f05b with SMTP id u7-20020a05622a14c700b0039cec5ef05bmr2964960qtx.166.1666019722186; Mon, 17 Oct 2022 08:15:22 -0700 (PDT) Received: from mail-yb1-f173.google.com (mail-yb1-f173.google.com. [209.85.219.173]) by smtp.gmail.com with ESMTPSA id u3-20020a05620a454300b006a6ebde4799sm12746qkp.90.2022.10.17.08.15.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 17 Oct 2022 08:15:21 -0700 (PDT) Received: by mail-yb1-f173.google.com with SMTP id f205so2487918yba.2; Mon, 17 Oct 2022 08:15:21 -0700 (PDT) X-Received: by 2002:a25:4fc2:0:b0:6be:afb4:d392 with SMTP id d185-20020a254fc2000000b006beafb4d392mr8994270ybb.604.1666019721188; Mon, 17 Oct 2022 08:15:21 -0700 (PDT) MIME-Version: 1.0 References: <20220902215737.981341-1-sean.anderson@seco.com> <20220902215737.981341-6-sean.anderson@seco.com> In-Reply-To: <20220902215737.981341-6-sean.anderson@seco.com> From: Geert Uytterhoeven Date: Mon, 17 Oct 2022 17:15:09 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH net-next v5 05/14] net: fman: Map the base address once To: Sean Anderson Cc: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, Camelia Groza , Madalin Bucur , open list , linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS autolearn=no 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 Hi Sean, On Sat, Sep 3, 2022 at 12:00 AM Sean Anderson wrote: > We don't need to remap the base address from the resource twice (once in > mac_probe() and again in set_fman_mac_params()). We still need the > resource to get the end address, but we can use a single function call > to get both at once. > > While we're at it, use platform_get_mem_or_io and devm_request_resource > to map the resource. I think this is the more "correct" way to do things > here, since we use the pdev resource, instead of creating a new one. > It's still a bit tricky, since we need to ensure that the resource is a > child of the fman region when it gets requested. > > Signed-off-by: Sean Anderson > Acked-by: Camelia Groza Thanks for your patch, which is now commit 262f2b782e255b79 ("net: fman: Map the base address once") in v6.1-rc1. > --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_sysfs.c > +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_sysfs.c > @@ -18,7 +18,7 @@ static ssize_t dpaa_eth_show_addr(struct device *dev, > > if (mac_dev) > return sprintf(buf, "%llx", > - (unsigned long long)mac_dev->res->start); > + (unsigned long long)mac_dev->vaddr); On 32-bit: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] Obviously you should cast to "uintptr_t" or "unsigned long" instead, and change the "%llx" to "%p" or "%lx"... However, taking a closer look: 1. The old code exposed a physical address to user space, the new code exposes the mapped virtual address. Is that change intentional? 2. Virtual addresses are useless in user space. Moreover, addresses printed by "%p" are obfuscated, as this is considered a security issue. Likewise for working around this by casting to an integer. What's the real purpose of dpaa_eth_show_addr()? Perhaps it should be removed? > else > return sprintf(buf, "none"); > } Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds