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=-12.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable 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 D5517C4361B for ; Tue, 8 Dec 2020 14:56:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9126623A7A for ; Tue, 8 Dec 2020 14:56:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729827AbgLHO4i (ORCPT ); Tue, 8 Dec 2020 09:56:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729386AbgLHO4i (ORCPT ); Tue, 8 Dec 2020 09:56:38 -0500 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0AE6C0613D6 for ; Tue, 8 Dec 2020 06:55:57 -0800 (PST) Received: by mail-wr1-x444.google.com with SMTP id r3so16535113wrt.2 for ; Tue, 08 Dec 2020 06:55:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=essensium.com; s=google; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=RpoOB4SsMWdHs6nxGfrQI11gBbJ7r+aNGucdh2ApF9E=; b=iG2Akie/C8iOA4AoP/BrYYn4RnEecoss9rAmtZKg+2j1nUi+jmWt9AMtU+zLS2Pw6Q 6lD/UNGQoMes+YoCU7n0x3xO1iNyNNVFx/Si1vvI21PGN3Z+RAfjlmMCPhMvZ965yHZa bvp7O+XrfU3YKZT1B9OnsyyazaziLMlY8n/y+zZXGY36fsRpvIYfDZpl6lLnQRwab00i +EDnh3CMPiWHgsKpvko1N7zsbtmMaWeIVWoE65jcSz2H7y6tO8tf0xlXXziismeLysY3 p7+drHRkv6RnWtIrzZe9mRazkX7XE1Ot0sjZ6T77MvvQv4k0ChNx5EDTw3C+mN2Yd1Wu dR7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=RpoOB4SsMWdHs6nxGfrQI11gBbJ7r+aNGucdh2ApF9E=; b=Pg5TdNTmDYi+bTY0DK5BR6QJFRdsm2kYjWc42x93FQbFMkwmyVWriubJBhEalss0J3 +De20tJ6N7ISWKE96zlI8eN/pohN9iL/JUvmLdb3bb/xtq9TrFMn1Irw4WlaCxUpPJl1 JMM82jq7ZPcCTVd8fixk3CUskkxA7DPtvPTBrBnltCEn670hC1ICJ821NKg9T5SpUoFH 5bS/nF/3Pmt6YMoitEyfeliOqRoCDb9MwIWSJPVCNd06FlPnkHa2Et7FPmgfxELw8+KJ 2BfSHsuO1OHKjOo/AfEaWH92GrMXC6Pcf8/8XCrfpww/cRwdXKlDTwp4JTz7H7Epe5J8 Wz7Q== X-Gm-Message-State: AOAM533Tegx27p0IBCdP6giswWBHcob/gX+0Za6R7S160RefFVKHffEg SrWygw6U4NPUqvp3DNf8OinrrMvoEtnMsQ== X-Google-Smtp-Source: ABdhPJymceEIiI/XPBYiJyKoLr/Mvlj37/77whhfEuNNagY6lrn2k5V2RspZGLa3ZzDA+UYl6cWfIw== X-Received: by 2002:a5d:554e:: with SMTP id g14mr8416974wrw.264.1607439356429; Tue, 08 Dec 2020 06:55:56 -0800 (PST) Received: from [10.8.0.46] (ip-188-118-3-185.reverse.destiny.be. [188.118.3.185]) by smtp.gmail.com with ESMTPSA id h20sm8365273wrb.21.2020.12.08.06.55.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 08 Dec 2020 06:55:55 -0800 (PST) Subject: Re: [PATCH net 1/4] net: freescale/fman: Split the main resource region reservation To: Madalin Bucur , "David S. Miller" , Jakub Kicinski , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" References: <20201203135039.31474-1-patrick.havelange@essensium.com> <20201203135039.31474-2-patrick.havelange@essensium.com> From: Patrick Havelange Message-ID: Date: Tue, 8 Dec 2020 15:55:54 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-12-03 16:47, Madalin Bucur wrote: >> -----Original Message----- >> From: Patrick Havelange >> Sent: 03 December 2020 15:51 >> To: Madalin Bucur ; David S. Miller >> ; Jakub Kicinski ; >> netdev@vger.kernel.org; linux-kernel@vger.kernel.org >> Cc: Patrick Havelange >> Subject: [PATCH net 1/4] net: freescale/fman: Split the main resource >> region reservation >> >> The main fman driver is only using some parts of the fman memory >> region. >> Split the reservation of the main region in 2, so that the other >> regions that will be used by fman-port and fman-mac drivers can >> be reserved properly and not be in conflict with the main fman >> reservation. >> >> Signed-off-by: Patrick Havelange > > I think the problem you are trying to work on here is that the device > tree entry that describes the FMan IP allots to the parent FMan device the > whole memory-mapped registers area, as described in the device datasheet. > The smaller FMan building blocks (ports, MDIO controllers, etc.) are > each using a nested subset of this memory-mapped registers area. > While this hierarchical depiction of the hardware has not posed a problem > to date, it is possible to cause issues if both the FMan driver and any > of the sub-blocks drivers are trying to exclusively reserve the registers > area. I'm assuming this is the problem you are trying to address here, > besides the stack corruption issue. Yes exactly. I did not add this behaviour (having a main region and subdrivers using subregions), I'm just trying to correct what is already there. For example: this is some content of /proc/iomem for one board I'm working with, with the current existing code: ffe400000-ffe4fdfff : fman ffe4e0000-ffe4e0fff : mac ffe4e2000-ffe4e2fff : mac ffe4e4000-ffe4e4fff : mac ffe4e6000-ffe4e6fff : mac ffe4e8000-ffe4e8fff : mac and now with my patches: ffe400000-ffe4fdfff : /soc@ffe000000/fman@400000 ffe400000-ffe480fff : fman ffe488000-ffe488fff : fman-port ffe489000-ffe489fff : fman-port ffe48a000-ffe48afff : fman-port ffe48b000-ffe48bfff : fman-port ffe48c000-ffe48cfff : fman-port ffe4a8000-ffe4a8fff : fman-port ffe4a9000-ffe4a9fff : fman-port ffe4aa000-ffe4aafff : fman-port ffe4ab000-ffe4abfff : fman-port ffe4ac000-ffe4acfff : fman-port ffe4c0000-ffe4dffff : fman ffe4e0000-ffe4e0fff : mac ffe4e2000-ffe4e2fff : mac ffe4e4000-ffe4e4fff : mac ffe4e6000-ffe4e6fff : mac ffe4e8000-ffe4e8fff : mac > While for the latter I think we can > put together a quick fix, for the former I'd like to take a bit of time > to select the best fix, if one is really needed. So, please, let's split > the two problems and first address the incorrect stack memory use. I have no idea how you can fix it without a (more correct this time) dummy region passed as parameter (and you don't want to use the first patch). But then it will be useless to do the call anyway, as it won't do any proper verification at all, so it could also be removed entirely, which begs the question, why do it at all in the first place (the devm_request_mem_region). I'm not an expert in that part of the code so feel free to correct me if I missed something. BR, Patrick H.