Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3395406rdh; Mon, 27 Nov 2023 13:09:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IG/wvSe3cvoGYI8n0/NG4h4KUGoLcAfbOz9VHSEBHKvLL9sP7msols4loIb3RKUAJETnsJJ X-Received: by 2002:a05:6a00:1ca6:b0:6cb:a60c:2143 with SMTP id y38-20020a056a001ca600b006cba60c2143mr12406222pfw.9.1701119349002; Mon, 27 Nov 2023 13:09:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701119348; cv=none; d=google.com; s=arc-20160816; b=zWAvQdXB13pnmZJEYITm6B5EalMaROX7vOUQrrkcjfaENcJTYWLp0htKb/Kz7Oq0vP byRDkU8kyPoO/2xQZFY9fbpZkt0Hgk5uTT4DNdMOkOD4SVUVzx/PThLw7kc10Nn8NcQl FhukS6I8EiMWab1WDvTfsB2U+mQ1fsGjmwwFSjpqrbhgcR2RcL6B1yu9Ouwhw/JvuENz gTMrGbUZliU61bm0Fa01BHYxqSE18SJDa4boTGyCU2VjjZNvR+kzENHi+isU304EH12d oEi0AYhe3DJHALCKng+xEUTsBp4eqELEYBq0LIQoQtskNuMUywHy6GlYMJHk41O+6oSI dMOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:subject:cc:to:from :date:references:in-reply-to:message-id:mime-version:user-agent :feedback-id:dkim-signature:dkim-signature; bh=O7eAZBa/VWWZ/OXR3VR79aB+uaJ9c4U23L/jIs+R/4I=; fh=GtiosRRM9gcEygW4tc5kZXYOacBr92YhFajaYxKj+zk=; b=uLY4dguxkJLM/pr6GzZ5f86mklfyk4fhlgcqkutO37z8MCLIBKHiPqGgwJYWNXZqsg J8EUNO4hGObLTu+5kFkr65XptBe+ZBAxcmkl/GvSP2GUKlDgCOGkAmpO8Rvrop1h9zsA rRWknQ/L01m3HW77yGYdA140HNmgLIFRIuWonPST+o43E/V8uMmIqNObGZ75MWndarqs mdjCUfAYexm/7gUWLuoxWiHVTthrzl47YbFAyoTKiSaQXoxGjCPNfkoN069ZT76VlqIL NXsSG0ndlcP4cvtZICGm5/Oc+eR/fflSS+Wg6CKW+P/ULcynfjNY2eUKN0HtGwJLzECE qs3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm2 header.b=OqM1Ivhy; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=oMtl2vfZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id b4-20020a056a000cc400b006be30cdc3d8si10408118pfv.163.2023.11.27.13.09.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 13:09:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm2 header.b=OqM1Ivhy; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=oMtl2vfZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id B84D4809356C; Mon, 27 Nov 2023 13:09:04 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231950AbjK0VIt (ORCPT + 99 others); Mon, 27 Nov 2023 16:08:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229527AbjK0VIs (ORCPT ); Mon, 27 Nov 2023 16:08:48 -0500 Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0677219D; Mon, 27 Nov 2023 13:08:55 -0800 (PST) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 6F5F35C004E; Mon, 27 Nov 2023 16:08:54 -0500 (EST) Received: from imap44 ([10.202.2.94]) by compute3.internal (MEProxy); Mon, 27 Nov 2023 16:08:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flygoat.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm2; t= 1701119334; x=1701205734; bh=O7eAZBa/VWWZ/OXR3VR79aB+uaJ9c4U23L/ jIs+R/4I=; b=OqM1IvhywGfmb7/kGPg8aPxMlu17gR4i5CH9/cqoelecohlYpCR /c1Og9aPbItY0RcGuLHayz3h1Mmo51jLTPjledQBGtv7CLQBdtOywUqY3ebesdjh w/KgFo9dTiMaWYN65I0ofo05JauvgXGn59f0x6BjzkONfKGyBzpoP6Owy4rButba YVA2NRJuSEI+ePvSTkdk4V3idMP6d5l57axFknSG3n+MRxRmc87fsZGMrocrGevy /MeOyX413+ioZH7CnQns3dUBQU3yBOoOltb1i1Bs48iNWsKwZ5C/U8Hijrfe7CMb C4yY9q8rs0vcpj0rd2e2wARn3LeaEBpgmgA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1701119334; x=1701205734; bh=O7eAZBa/VWWZ/OXR3VR79aB+uaJ9c4U23L/ jIs+R/4I=; b=oMtl2vfZKze5RZUv5gkgqJtSL34cqE0nGLzcTGh1dlkFMyNcSYs Bps/C/1fM/uMFwg+7atKxp9YinmkIQnzIQ5L29wxAxcacsEwETBDMiC+7amaMbXT PceJaJx609MSuf4COEB7azsvh2zagVy0aAxxbTd5fEDm+SsxdCnuiukTrLAIc5Hn jnQBi7Pnnqoc6nOi1St+ZKNFQ5wg0gZ3nvuguKV/5wG25Vy5TtwQEmhCCO3Zz+Pl J/0YHmxFPThmKOyyza8A75mNqp2TMRHiaRXfmdOKg6SydW+V9YjkKHvYmaEsR516 lZMKyhcGMuVTBXXq6C7CIE+DsQiVzHXmL7w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudeiuddgudegjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvvefutgfgsehtqhertderreejnecuhfhrohhmpedf lfhirgiguhhnucgjrghnghdfuceojhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtg homheqnecuggftrfgrthhtvghrnhepudefgeeftedugeehffdtheefgfevffelfefghefh jeeugeevtefhudduvdeihefgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomhepjhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 14CA836A0075; Mon, 27 Nov 2023 16:08:53 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-1234-gac66594aae-fm-20231122.001-gac66594a MIME-Version: 1.0 Message-Id: In-Reply-To: References: <20231122182419.30633-2-fancer.lancer@gmail.com> <8ca730b9-fa8c-46ea-bdc5-158da0f29c3a@app.fastmail.com> <245d3985-9085-4be0-8c74-d95d06334584@app.fastmail.com> <3iksuovvsln3cw3xpmjd7f7xixfvwaneu4ok56fnookvyolpco@wrxxew3thgnq> Date: Mon, 27 Nov 2023 21:08:11 +0000 From: "Jiaxun Yang" To: "Serge Semin" Cc: "Thomas Bogendoerfer" , "Arnd Bergmann" , "Andrew Morton" , "Mike Rapoport" , "Matthew Wilcox" , "Tiezhu Yang" , "Huacai Chen" , "Yinglu Yang" , "Alexey Malahov" , "Aleksandar Rikalo" , "Aleksandar Rikalo" , "Dragan Mladjenovic" , "Chao-ying Fu" , "Marc Zyngier" , "linux-mips@vger.kernel.org" , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/7] mips: dmi: Fix early remap on MIPS32 Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 27 Nov 2023 13:09:05 -0800 (PST) =E5=9C=A82023=E5=B9=B411=E6=9C=8827=E6=97=A5=E5=8D=81=E4=B8=80=E6=9C=88 = =E4=B8=8B=E5=8D=884:23=EF=BC=8CSerge Semin=E5=86=99=E9=81=93=EF=BC=9A [...] >> I just made a quick grep in tree, and it seems like we don't have much >> user of ioremap_cache (as well as ioremap_uc/wc) here so I think it is >> a safe assumption. > > I wouldn't say there aren't much users. ioremap_wc() and it's > devm-version is widely utilized in the GPU and network and some other > subsystems. ioremap_cache() isn't widespread indeed. In anyway even a > single user must be supported in safely calling the method if it's > provided by the arch-code, otherwise the method could be considered as > just a bogus stub to have the kernel successfully built. I bet you'll > agree with that. But that's not the point in this case, > > A bit later you also noted: > > On Fri, Nov 24, 2023 at 10:34:49PM +0000, Jiaxun Yang wrote: >> A nip, _page_cachable_default is set in cpu_cache_init() as well. We'd >> better move it to cpu-probe.c, or give it a reasonable default value. > > Right. Thanks. To be honest I haven't noticed that before your > message. _page_cachable_default is indeed initialized in the > cpu_cache_init() method, several steps after it would be used in the > framework of dmi_remap_early(). On the other hand ioremap_cache() is > defined as ioremap_prot() with the _page_cachable_default variable > passed. So my code will still correctly work unless > _page_cachable_default is pre-initialized with something other than > zero. On the other hand we can't easily change its default value > because it will affect and likely break the r3k (CPU_R3000) and Octeon > based platforms, because it's utilized to initialize the > protection-map table. Of course we can fix the r3k_cache_init() and > octeon_cache_init() methods too so they would get the > _page_cachable_default variable back to zero, but it will also make > things around it more complicated. > > Also note, moving the _page_cachable_default initialization to the > earlier stages like cpu_probe() won't work better because the field > value may get change for instance in the framework of the smp_setup() > function (see cps_smp_setup()). > > So after all the considerations above this solution now looks even > clumsier than before.( Any idea how to make it better? I think the best solution maybe just use CKSEG0 to setup map here. Btw I was thinking about 64 bit here, I thought for 64bit we would just embedded prot into XKPHYS, however I quickly figure out ioremap_cache was never implemented properly on 64-bit system, so does ioremap_wc. > u64 base =3D (flags =3D=3D _CACHE_UNCACHED ? IO_BASE : UNCAC_BASE); Which is always uncached mapping. >>=20 [...] > > Note the memory might be clobbered even before dmi_setup() for > instance by means of the early_memtest() method. In anyway it would be > better if the system booloader would have already reserved the DMI > memory (in DTB) or it would have been done by the platform-specific > plat_mem_setup() method. Unfortunately, too many machines are shipped with those badly designed firmware. We rely on dmi_setup code to scan and preserve dmi table from random location in memory. > >> The second is we may have some early quirks depends on DMI >> information. > > Which quirks do you mean to be dependent in between the current > dmi_setup() call place and the cpu_cache_init() method invocation? I think we don't have any for now. --=20 - Jiaxun