Message ID | 20230529135245.4085-1-jiaxun.yang@flygoat.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1542148vqr; Mon, 29 May 2023 07:09:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5S+9OpvzIhFQu/fnVqf5MUKXOvaQT3rG3B27nUKBMJo/t5n9rxMCgTM5+qUDCGXnTKdiaA X-Received: by 2002:a17:90a:9514:b0:24e:4b1c:74d2 with SMTP id t20-20020a17090a951400b0024e4b1c74d2mr11412983pjo.32.1685369357727; Mon, 29 May 2023 07:09:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685369357; cv=none; d=google.com; s=arc-20160816; b=w28PR5AzxHvblaLMzTsGe4kaX+SbMPaeM+kPlG3n5Gju5lKPB78Cs3mM9xL3AqOZS0 XrM4JzxzEWElj8/yWHg5HqpnwR2xwF+YIv03T5CEfwW6MMGrC83GcYqQkMJV1EQ/4lrS GrBZF5hypJkKs9kKjnu26T+tNNq3oYv+4DiHYfj4T+7uOLNhj3Rdq9If6jt0U1FwmqAZ lRyNMtOuIgRi+RSC4P9KvgTVOTwJFB7+87XobPjZKTfyzHN7ozrj4yOSg/YlyrNsS8LU vzmMvwgdEsQxFeTOUJM64gsz0h3Af+vemmbAhWjmBKoR/3ES5eGP7KDjeciUs/b/UB0w MjuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:feedback-id:dkim-signature :dkim-signature; bh=cWL+ydqAXLJ30NEjXy53IDGA3PgBjHHLDwDyHIEE/5I=; b=KQ8P9guHT9l1P9tVzslC73qxdLe36rg/W2YYleLjbOGh9aBc+UGlgF5bFybFsvRMms KWrpSHpLZXXKp7qxbAo8nMKHVSjr3EgCCUM+pkioBKUk94J9SLicyr44eh1EufdijM6/ xwwXour88exHFIT1AQbrfc4CLiFHtF1h1K4MmhAOpeRsW0bmVKNRYfn6Btp/ZFEeI2NM ktit8vdKh1eQ/i0MiWTV6jBwh24FtoAkelOHeX6s2o3C3t89+vFFKQ4gzOVAUMTOpHBd U/jgsxU3uG9A9iRtuy9w8fdpvXWBDT33u5edJ7yie+Lh7Np374BoX865DRv5+nNe29cZ CCEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm2 header.b=oIuNInrO; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=HE8oGDLZ; 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=flygoat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x4-20020a17090abc8400b0024981e98175si1576557pjr.75.2023.05.29.07.09.05; Mon, 29 May 2023 07:09:17 -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; dkim=pass header.i=@flygoat.com header.s=fm2 header.b=oIuNInrO; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=HE8oGDLZ; 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=flygoat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230175AbjE2NyR (ORCPT <rfc822;callmefire3@gmail.com> + 99 others); Mon, 29 May 2023 09:54:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229951AbjE2Nx2 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 29 May 2023 09:53:28 -0400 Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E33DE131; Mon, 29 May 2023 06:52:59 -0700 (PDT) Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id F3CD65C0126; Mon, 29 May 2023 09:52:54 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Mon, 29 May 2023 09:52:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flygoat.com; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:message-id:mime-version:reply-to:sender:subject :subject:to:to; s=fm2; t=1685368374; x=1685454774; bh=cWL+ydqAXL J30NEjXy53IDGA3PgBjHHLDwDyHIEE/5I=; b=oIuNInrOtpAOQzZLbD3v5AFSN9 wutegbZ/U5SfeEbORvQQhtNW6bPWpN8Q52nfnapxf8uYDv7RKKUzLudF5HwmQhRW mxAROGGCvczWGmeHdYUp5mian4SsLWtzsTUJFa3uhZcK+YGQg2niUGgw3AnXQjwn RXcFSKWzXUjiv/H4LEbrXDUPVAQKM6GF+AfDVv+6jD7KT9C1EbT2s9wNdUGL8L4j z+V1ui+cEDs8n1Lx9ncJjLQhoprh+Tg0FyyVfyhYMRKu85wawezOC0TlIzGPr479 uA7UR5mnm+esj0BRZNbVDiS+tPNTyMPn9Mz46FKNtnPtvYO25wbVj7dupRRg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:message-id:mime-version: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=1685368374; x=1685454774; bh=cWL+ydqAXLJ30 NEjXy53IDGA3PgBjHHLDwDyHIEE/5I=; b=HE8oGDLZwc2VA82joUBHhO3NCvfKV gY/KsLPzdO0DdYXB3N+6fRQVDIYXVJ5Jb+2b0ATKUJ6avPGZYq2fS9oFQZ+Kr8+G BtX8r2fH8Dbh6ARptyzO7OmRMy7uJ+kSAqYqxAH1OfLntJxVQIZS17lh1UD5PLlM RQnbKy683qe8E3DiEClzw/uvNrhcI6dzpsQcomrtccs9DPfkDcy66TOFffAlpQ0I uaJsYipIPlU/sTRkkZ2rulKSOu5E89C/4C3J3WzKGL+H1vb+q9y0IrEo0eGHIa3I 6LbGz6qJHYsk1iUl/z9VSF6Xf9Py7buzUFmz29oSS93WOoVfO1gppBkxA== X-ME-Sender: <xms:Nq50ZJGRe-CXv2pHQhkiJBqJWLrN3YZiqppu-LEWgLA4gGV8h0U0nw> <xme:Nq50ZOVcB9FjfHtDTNhbAC0T5A9K-kzxeYHjUfuIf3oGuVQnFTQWeneEqngt7zw-l WJ44Y7UDrFpG8nbHwc> X-ME-Received: <xmr:Nq50ZLKjFM6F_UHK9fcPsRjz8Nd3Wc4TzPMhsK7Nxd-bCUboPMETxD4aNb5X> X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeekhedgieelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffoggfgsedtkeertd ertddtnecuhfhrohhmpeflihgrgihunhcujggrnhhguceojhhirgiguhhnrdihrghnghes fhhlhihgohgrthdrtghomheqnecuggftrfgrthhtvghrnhephfetuddtudevieeljeejte ffheeujeduhefgffejudfhueelleduffefgfffveeknecuvehluhhsthgvrhfuihiivgep tdenucfrrghrrghmpehmrghilhhfrhhomhepjhhirgiguhhnrdihrghnghesfhhlhihgoh grthdrtghomh X-ME-Proxy: <xmx:Nq50ZPEK19IXHTefgzihs4Z-F0qg0GkRCZK-QlPp7qc4jmdrYW_71Q> <xmx:Nq50ZPXy00mzXGfID5k4ol6fmBVIwPJ5lJk8R4Euegd05O8orQh_mA> <xmx:Nq50ZKMsSczKDcgM-M-eBPQV6UwzAeO3xF9zPigkFOa2bvhYlI_oJw> <xmx:Nq50ZMiJbC16ZNqxwMXDDC_sEhLnGhmFy5IiV7KolwFKKEDHgedLmQ> Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 29 May 2023 09:52:53 -0400 (EDT) From: Jiaxun Yang <jiaxun.yang@flygoat.com> To: linux-mips@vger.kernel.org Cc: linux-kernel@vger.kernel.org, tsbogend@alpha.franken.de, Jiaxun Yang <jiaxun.yang@flygoat.com> Subject: [PATCH 1/2] MIPS: Allow MIPS32R2 kernel to run on P5600 and M5150 Date: Mon, 29 May 2023 14:52:44 +0100 Message-Id: <20230529135245.4085-1-jiaxun.yang@flygoat.com> X-Mailer: git-send-email 2.39.2 (Apple Git-143) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767237859715836004?= X-GMAIL-MSGID: =?utf-8?q?1767237859715836004?= |
Series |
[1/2] MIPS: Allow MIPS32R2 kernel to run on P5600 and M5150
|
|
Commit Message
Jiaxun Yang
May 29, 2023, 1:52 p.m. UTC
M5150 and P5600 are two MIPS32R5 kernels, however as MIPS32R5 is
backward compatible with MIPS32R2 there is no reason to forbid
M5150 and P5600 on MIPS32R2 kernel.
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
arch/mips/include/asm/cpu-type.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Comments
On Mon, 29 May 2023, Jiaxun Yang wrote: > M5150 and P5600 are two MIPS32R5 kernels, however as MIPS32R5 is > backward compatible with MIPS32R2 there is no reason to forbid > M5150 and P5600 on MIPS32R2 kernel. What problem are you trying to solve? The CONFIG_SYS_HAS_CPU_* settings denote overall platform's support for the given CPU and have nothing to do with what architecture level a given kernel has been configured for. You do need to get the settings right for your platform, just as you do in 2/2, but this 1/2 part looks wrong to me. NB CPU_4KEC is double-listed as R1 and R2 because early revisions of the 4KEc core were actually R1 before switching to R2, so this CPU can report either revision. I don't know why CPU_XBURST is also listed as both R1 and R2, the history looks convoluted with no explanation. Paul, is the CPU also dual-revision or is it just a bug and it is supposed to be listed under one ISA revision only, presumably R2? Maciej
Hi Maciej, Le mardi 30 mai 2023 à 09:03 +0100, Maciej W. Rozycki a écrit : > On Mon, 29 May 2023, Jiaxun Yang wrote: > > > M5150 and P5600 are two MIPS32R5 kernels, however as MIPS32R5 is > > backward compatible with MIPS32R2 there is no reason to forbid > > M5150 and P5600 on MIPS32R2 kernel. > > What problem are you trying to solve? The CONFIG_SYS_HAS_CPU_* > settings > denote overall platform's support for the given CPU and have nothing > to do > with what architecture level a given kernel has been configured for. > You > do need to get the settings right for your platform, just as you do > in > 2/2, but this 1/2 part looks wrong to me. > > NB CPU_4KEC is double-listed as R1 and R2 because early revisions of > the > 4KEc core were actually R1 before switching to R2, so this CPU can > report > either revision. > > I don't know why CPU_XBURST is also listed as both R1 and R2, the > history > looks convoluted with no explanation. Paul, is the CPU also dual- > revision > or is it just a bug and it is supposed to be listed under one ISA > revision > only, presumably R2? The XBurst CPU is R1 in older Ingenic SoCs (JZ4760B and older), and R2 in newer SoCs (JZ4770 and newer). Cheers, -Paul
Hi Paul, > > I don't know why CPU_XBURST is also listed as both R1 and R2, the > > history > > looks convoluted with no explanation. Paul, is the CPU also dual- > > revision > > or is it just a bug and it is supposed to be listed under one ISA > > revision > > only, presumably R2? > > The XBurst CPU is R1 in older Ingenic SoCs (JZ4760B and older), and R2 > in newer SoCs (JZ4770 and newer). Great, thanks for confirming. So the current arrangement is right and still we don't want to dual-list the P5600 or M5150. Maciej
> 2023年5月30日 09:03,Maciej W. Rozycki <macro@orcam.me.uk> 写道: > > On Mon, 29 May 2023, Jiaxun Yang wrote: > >> M5150 and P5600 are two MIPS32R5 kernels, however as MIPS32R5 is >> backward compatible with MIPS32R2 there is no reason to forbid >> M5150 and P5600 on MIPS32R2 kernel. > > What problem are you trying to solve? The CONFIG_SYS_HAS_CPU_* settings > denote overall platform's support for the given CPU and have nothing to do > with what architecture level a given kernel has been configured for. You > do need to get the settings right for your platform, just as you do in > 2/2, but this 1/2 part looks wrong to me. Well the universal target is to allow R2 generic kernel to run on R5 CPUs. As R5 is backward compatible we can just have one universal kernel binary. Allowing P5600 and M5150 to run on R2 kernel does not bring much overhead. In fact only several bytes are added to kernel binary. (Actually although M5150 is advertising as R5 it’s technically R2 because it does not implement some features mandatory for R5.) Thanks - Jiaxun > > NB CPU_4KEC is double-listed as R1 and R2 because early revisions of the > 4KEc core were actually R1 before switching to R2, so this CPU can report > either revision. > > I don't know why CPU_XBURST is also listed as both R1 and R2, the history > looks convoluted with no explanation. Paul, is the CPU also dual-revision > or is it just a bug and it is supposed to be listed under one ISA revision > only, presumably R2? > > Maciej
On Tue, 30 May 2023, Jiaxun Yang wrote: > >> M5150 and P5600 are two MIPS32R5 kernels, however as MIPS32R5 is > >> backward compatible with MIPS32R2 there is no reason to forbid > >> M5150 and P5600 on MIPS32R2 kernel. > > > > What problem are you trying to solve? The CONFIG_SYS_HAS_CPU_* settings > > denote overall platform's support for the given CPU and have nothing to do > > with what architecture level a given kernel has been configured for. You > > do need to get the settings right for your platform, just as you do in > > 2/2, but this 1/2 part looks wrong to me. > > Well the universal target is to allow R2 generic kernel to run on R5 CPUs. > As R5 is backward compatible we can just have one universal kernel binary. Sure, but this change is not needed for it. You just need to declare which ISA revisions your platform supports and leave `__get_cpu_type' alone. It has worked like that for a decade now. Back in the day I used to run R1 kernels on R2 hardware myself. And maybe MIPS IV on R1 even, as we had MIPS Malta CPU modules with both MIPS IV devices (QED RM5261/RM7061) and MIPS64r1 devices (MIPS 5Kc/20Kc/25Kf) and switching the kernel when swapping modules was a nuisance. The Malta config still supports these devices although some may not exist anymore. Maciej
> 2023年5月30日 12:07,Maciej W. Rozycki <macro@orcam.me.uk> 写道: > > On Tue, 30 May 2023, Jiaxun Yang wrote: > >>>> M5150 and P5600 are two MIPS32R5 kernels, however as MIPS32R5 is >>>> backward compatible with MIPS32R2 there is no reason to forbid >>>> M5150 and P5600 on MIPS32R2 kernel. >>> >>> What problem are you trying to solve? The CONFIG_SYS_HAS_CPU_* settings >>> denote overall platform's support for the given CPU and have nothing to do >>> with what architecture level a given kernel has been configured for. You >>> do need to get the settings right for your platform, just as you do in >>> 2/2, but this 1/2 part looks wrong to me. >> >> Well the universal target is to allow R2 generic kernel to run on R5 CPUs. >> As R5 is backward compatible we can just have one universal kernel binary. > > Sure, but this change is not needed for it. You just need to declare > which ISA revisions your platform supports and leave `__get_cpu_type' > alone. It has worked like that for a decade now. I’m afraid it won’t work as you expected. Actually I ran into a problem that `case CPU_P5600` in c-r4k.c is optimised out by compiler, because the codepath is marked as unreachable. Thanks - Jiaxun > > Back in the day I used to run R1 kernels on R2 hardware myself. And > maybe MIPS IV on R1 even, as we had MIPS Malta CPU modules with both MIPS > IV devices (QED RM5261/RM7061) and MIPS64r1 devices (MIPS 5Kc/20Kc/25Kf) > and switching the kernel when swapping modules was a nuisance. The Malta > config still supports these devices although some may not exist anymore. > > Maciej
On Tue, 30 May 2023, Jiaxun Yang wrote: > > Sure, but this change is not needed for it. You just need to declare > > which ISA revisions your platform supports and leave `__get_cpu_type' > > alone. It has worked like that for a decade now. > > I’m afraid it won’t work as you expected. > > Actually I ran into a problem that `case CPU_P5600` in c-r4k.c is optimised out > by compiler, because the codepath is marked as unreachable. Maybe there's a bug elsewhere then. Send me your .config and I'll try to reproduce it. Maciej
On Tue, May 30, 2023 at 01:16:32PM +0100, Maciej W. Rozycki wrote: > On Tue, 30 May 2023, Jiaxun Yang wrote: > > > > Sure, but this change is not needed for it. You just need to declare > > > which ISA revisions your platform supports and leave `__get_cpu_type' > > > alone. It has worked like that for a decade now. > > > > I’m afraid it won’t work as you expected. > > > > Actually I ran into a problem that `case CPU_P5600` in c-r4k.c is optimised out > > by compiler, because the codepath is marked as unreachable. > > Maybe there's a bug elsewhere then. Send me your .config and I'll try to > reproduce it. I may have misunderstood something, but it seems like there is no such problem on my P5600 system: [fancer@mobilestation] kernel $ grep -r P5600 -B2 -A2 arch/mips/mm/c-r4k.c case CPU_1004K: case CPU_INTERAPTIV: case CPU_P5600: case CPU_PROAPTIV: case CPU_M5150: -- case CPU_P6600: case CPU_M6250: pr_info("MIPS P5600 is here\n"); if (!(read_c0_config7() & MIPS_CONF7_IAR) && (c->icache.waysize > PAGE_SIZE)) Log: [ 0.000000] Linux version 6.4.0-rc1-bt1-00235-gf9efd6b74b12-dirty (fancer@mobilestation) (mipsel-baikal-linux-gcc (GCC) 7.3.0, GNU ld (GNU Binutils) 2.30.0.20180208) #1 275 SMP PREEMPT Tue May 30 15:30:48 MSK 2023 [ 0.000000] CPU0 revision is: 0001a830 (MIPS P5600) [ 0.000000] FPU revision is: 30f30320 [ 0.000000] MSA revision is: 00000320 ... [ 0.000000] VPE topology {1,1} total 2 [ 0.000000] MIPS P5600 is here ... -Serge(y) > > Maciej
On Tue, May 30, 2023 at 03:41:30PM +0300, Serge Semin wrote: > On Tue, May 30, 2023 at 01:16:32PM +0100, Maciej W. Rozycki wrote: > > On Tue, 30 May 2023, Jiaxun Yang wrote: > > > > > > Sure, but this change is not needed for it. You just need to declare > > > > which ISA revisions your platform supports and leave `__get_cpu_type' > > > > alone. It has worked like that for a decade now. > > > > > > I’m afraid it won’t work as you expected. > > > > > > Actually I ran into a problem that `case CPU_P5600` in c-r4k.c is optimised out > > > by compiler, because the codepath is marked as unreachable. > > > > Maybe there's a bug elsewhere then. Send me your .config and I'll try to > > reproduce it. > > I may have misunderstood something, but it seems like there is no such > problem on my P5600 system: > > [fancer@mobilestation] kernel $ grep -r P5600 -B2 -A2 arch/mips/mm/c-r4k.c > case CPU_1004K: > case CPU_INTERAPTIV: > case CPU_P5600: > case CPU_PROAPTIV: > case CPU_M5150: > -- > case CPU_P6600: > case CPU_M6250: > pr_info("MIPS P5600 is here\n"); > if (!(read_c0_config7() & MIPS_CONF7_IAR) && > (c->icache.waysize > PAGE_SIZE)) > > Log: > [ 0.000000] Linux version 6.4.0-rc1-bt1-00235-gf9efd6b74b12-dirty (fancer@mobilestation) (mipsel-baikal-linux-gcc (GCC) 7.3.0, GNU ld (GNU Binutils) 2.30.0.20180208) #1 > 275 SMP PREEMPT Tue May 30 15:30:48 MSK 2023 > [ 0.000000] CPU0 revision is: 0001a830 (MIPS P5600) > [ 0.000000] FPU revision is: 30f30320 > [ 0.000000] MSA revision is: 00000320 > ... > [ 0.000000] VPE topology {1,1} total 2 > [ 0.000000] MIPS P5600 is here > ... Here is the CPU-related kernel configs: root@msbt2:~# cat /proc/config.gz | gunzip | grep CPU_MIPS # CONFIG_CPU_MIPS32_R2 is not set # CONFIG_CPU_MIPS32_R5 is not set # CONFIG_CPU_MIPS32_3_5_FEATURES is not set CONFIG_CPU_MIPS32_R5_FEATURES=y CONFIG_CPU_MIPS32_R5_XPA=y CONFIG_SYS_HAS_CPU_MIPS32_R2=y CONFIG_SYS_HAS_CPU_MIPS32_R3_5=y CONFIG_SYS_HAS_CPU_MIPS32_R5=y CONFIG_CPU_MIPS32=y CONFIG_CPU_MIPSR5=y CONFIG_CPU_MIPSR2_IRQ_VI=y CONFIG_CPU_MIPSR2_IRQ_EI=y -Serge(y) > > -Serge(y) > > > > > Maciej
> 2023年5月30日 13:51,Serge Semin <fancer.lancer@gmail.com> 写道: > > On Tue, May 30, 2023 at 03:41:30PM +0300, Serge Semin wrote: >> On Tue, May 30, 2023 at 01:16:32PM +0100, Maciej W. Rozycki wrote: >>> On Tue, 30 May 2023, Jiaxun Yang wrote: >>> >>>>> Sure, but this change is not needed for it. You just need to declare >>>>> which ISA revisions your platform supports and leave `__get_cpu_type' >>>>> alone. It has worked like that for a decade now. >>>> >>>> I’m afraid it won’t work as you expected. >>>> >>>> Actually I ran into a problem that `case CPU_P5600` in c-r4k.c is optimised out >>>> by compiler, because the codepath is marked as unreachable. >>> >>> Maybe there's a bug elsewhere then. Send me your .config and I'll try to >>> reproduce it. >> >> I may have misunderstood something, but it seems like there is no such >> problem on my P5600 system: >> >> [fancer@mobilestation] kernel $ grep -r P5600 -B2 -A2 arch/mips/mm/c-r4k.c >> case CPU_1004K: >> case CPU_INTERAPTIV: >> case CPU_P5600: >> case CPU_PROAPTIV: >> case CPU_M5150: >> -- >> case CPU_P6600: >> case CPU_M6250: >> pr_info("MIPS P5600 is here\n"); >> if (!(read_c0_config7() & MIPS_CONF7_IAR) && >> (c->icache.waysize > PAGE_SIZE)) >> >> Log: >> [ 0.000000] Linux version 6.4.0-rc1-bt1-00235-gf9efd6b74b12-dirty (fancer@mobilestation) (mipsel-baikal-linux-gcc (GCC) 7.3.0, GNU ld (GNU Binutils) 2.30.0.20180208) #1 >> 275 SMP PREEMPT Tue May 30 15:30:48 MSK 2023 >> [ 0.000000] CPU0 revision is: 0001a830 (MIPS P5600) >> [ 0.000000] FPU revision is: 30f30320 >> [ 0.000000] MSA revision is: 00000320 >> ... >> [ 0.000000] VPE topology {1,1} total 2 >> [ 0.000000] MIPS P5600 is here >> ... > > Here is the CPU-related kernel configs: > root@msbt2:~# cat /proc/config.gz | gunzip | grep CPU_MIPS > # CONFIG_CPU_MIPS32_R2 is not set > # CONFIG_CPU_MIPS32_R5 is not set > # CONFIG_CPU_MIPS32_3_5_FEATURES is not set > CONFIG_CPU_MIPS32_R5_FEATURES=y > CONFIG_CPU_MIPS32_R5_XPA=y > CONFIG_SYS_HAS_CPU_MIPS32_R2=y > CONFIG_SYS_HAS_CPU_MIPS32_R3_5=y > CONFIG_SYS_HAS_CPU_MIPS32_R5=y > CONFIG_CPU_MIPS32=y > CONFIG_CPU_MIPSR5=y > CONFIG_CPU_MIPSR2_IRQ_VI=y > CONFIG_CPU_MIPSR2_IRQ_EI=y I was trying to run kernel compiled with CONFIG_CPU_MIPS32_R2 on P5600. Thanks - Jiaxun > > -Serge(y) > >> >> -Serge(y) >> >>> >>> Maciej
> 2023年5月30日 13:16,Maciej W. Rozycki <macro@orcam.me.uk> 写道: > > On Tue, 30 May 2023, Jiaxun Yang wrote: > >>> Sure, but this change is not needed for it. You just need to declare >>> which ISA revisions your platform supports and leave `__get_cpu_type' >>> alone. It has worked like that for a decade now. >> >> I’m afraid it won’t work as you expected. >> >> Actually I ran into a problem that `case CPU_P5600` in c-r4k.c is optimised out >> by compiler, because the codepath is marked as unreachable. > > Maybe there's a bug elsewhere then. Send me your .config and I'll try to > reproduce it. Ok I see the problem, after applying patch 2 the issue is gone. So actually only patch 2 is necessary. The unreachable mark here leads gcc to generate some confusing code and I misread it. Sorry for the noise. Thanks - Jiaxun > > Maciej
On Tue, 30 May 2023, Jiaxun Yang wrote: > > Maybe there's a bug elsewhere then. Send me your .config and I'll try to > > reproduce it. > > Ok I see the problem, after applying patch 2 the issue is gone. > So actually only patch 2 is necessary. I'm glad we're on the same page then. Maciej
On Tue, May 30, 2023 at 02:10:04PM +0100, Jiaxun Yang wrote: > > > > 2023年5月30日 13:16,Maciej W. Rozycki <macro@orcam.me.uk> 写道: > > > > On Tue, 30 May 2023, Jiaxun Yang wrote: > > > >>> Sure, but this change is not needed for it. You just need to declare > >>> which ISA revisions your platform supports and leave `__get_cpu_type' > >>> alone. It has worked like that for a decade now. > >> > >> I’m afraid it won’t work as you expected. > >> > >> Actually I ran into a problem that `case CPU_P5600` in c-r4k.c is optimised out > >> by compiler, because the codepath is marked as unreachable. > > > > Maybe there's a bug elsewhere then. Send me your .config and I'll try to > > reproduce it. > > Ok I see the problem, after applying patch 2 the issue is gone. > So actually only patch 2 is necessary. > > The unreachable mark here leads gcc to generate some confusing code > and I misread it. > > Sorry for the noise. Great! Indeed enabling the SYS_HAS_CPU_MIPS32_R5 config is enough to stop the CPU_P5600 being optimized out. Thanks for your work. Let me know if you need some tests on another instance of the P5600 hw. -Serge(y) > > Thanks > - Jiaxun > > > > > Maciej >
diff --git a/arch/mips/include/asm/cpu-type.h b/arch/mips/include/asm/cpu-type.h index a4a66bd93748..4032cd90ea30 100644 --- a/arch/mips/include/asm/cpu-type.h +++ b/arch/mips/include/asm/cpu-type.h @@ -54,7 +54,8 @@ static inline int __pure __get_cpu_type(const int cpu_type) case CPU_PROAPTIV: #endif -#ifdef CONFIG_SYS_HAS_CPU_MIPS32_R5 +#if defined(CONFIG_SYS_HAS_CPU_MIPS32_R2) || \ + defined(CONFIG_SYS_HAS_CPU_MIPS32_R5) case CPU_M5150: case CPU_P5600: #endif