From nobody Tue May 23 13:23:20 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4QQZkx2CDbz4CT4k; Tue, 23 May 2023 13:23:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QQZkw4dJSz3srd; Tue, 23 May 2023 13:23:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1684848200; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=C3NCsozXM+YfGiatwa2gc9UGBobTSNnpR0c51drUUPM=; b=ebJa1KmEJIs+i6VF983mhYVm6Vh28WvAr8kKIoUspey7BX15WNNuKQF+85Z/couVJeWqqV DuOOdN5jtv0S3uCdUtbWoPWVkAdg9Wy3qf8qDG6GxOvA9993NpsirxTcKjMcb4M1rGLJas oaObDoMQreAlHgNaf+pQXoQDreMV/hhsMqcG5isLIzDaoO2sgsJYGuGmruLb/nZ4i+YNiG +ARnKks2ttPWtNLiADOy9XS/8OYvbrx5BAyNw+9hnLnyiD43ffGPVlG+6bam4stl0+cyhB FcHfFRQLJXvQ+UHoH54hQfj1VnWnK4FnTi7uE3E2hmgVPPyWYYeUXCuHhI6l0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1684848200; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=C3NCsozXM+YfGiatwa2gc9UGBobTSNnpR0c51drUUPM=; b=YhHx7L2ow4yXzK0fd7wuhHjD5tVuuwz/v+tR+Ix37MyFCALQ3aJ+YBuP3y+rwewz0iRz3y mLggclMDYsz8mcb8SY1Kq6g1UOiU0bCOlU3EDtJf7Ab6Ze4FC7qfCPdLKe4YOhQwOw2aXC 9lA828mMJCbUdFnVBzUGIoaFx/7M40zUWaHzDXIlzHkHPGanINRZDHJzvW1uv+OsqQ3e4C ea/UlMkE3hsU4h8LgTK+sVB3d0chPZnoA4GxzV903mQQ/Fucq10haNDbQ16yLqzm5ua0MQ 87P8+U5xWxYsHjSwPmf9J2Y9OYLk0Lmbm0z4ByvjKzv19HGST9WahzMcNM2gfA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1684848200; a=rsa-sha256; cv=none; b=YoD9deKGCG5gbQLfh0GSR/iv42QG84iB3gYp/yS38Oc4tTN0/wtLFKGYlu3s+aslXd7Ijt 4wW57MUvpBBcBwYzOOjioT4bhfnjRvoJDolG6UrVkG9+DZXJAMs5/eJE5//kB5ej8mayJY ALWLxb3Pr+1P7/vdNsetS5Qo5GPfPRg2htrIG02JBjNUl0m0yq0u8EukXiu8eV5gxGFuqI KL4xXXmhOSFB5B202kLQtUpdYS6m1cjlxeIKQ/h/DeW/JKd/5JMx+P3/O0l5olNB4Pa1jK hKLAZQMvvexZ/AbjOxH+sWTjOu0tWchxfIbqlJzjUDdQ+mXffLYEBQFBqb2LoQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4QQZkw3KJHz11ly; Tue, 23 May 2023 13:23:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 34NDNKAL016501; Tue, 23 May 2023 13:23:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 34NDNKGi016500; Tue, 23 May 2023 13:23:20 GMT (envelope-from git) Date: Tue, 23 May 2023 13:23:20 GMT Message-Id: <202305231323.34NDNKGi016500@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: b0d45b023e8c - main - riscv: Call identify_cpu() earlier for CPU 0 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b0d45b023e8c9af50312c7b56c4be9c39657afcb Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=b0d45b023e8c9af50312c7b56c4be9c39657afcb commit b0d45b023e8c9af50312c7b56c4be9c39657afcb Author: Mitchell Horne AuthorDate: 2023-05-22 23:50:09 +0000 Commit: Mitchell Horne CommitDate: 2023-05-23 13:00:25 +0000 riscv: Call identify_cpu() earlier for CPU 0 It is advantageous to have knowledge of ISA features as early as possible. For example, the presence of newer virtual memory extensions may be useful to pmap_bootstrap(). To achieve this, split out the printf() parts of identify_cpu() into a separate function, printcpuinfo(). This latter function will be called later in boot after the console has been initialized. Reviewed by: markj MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39810 --- sys/riscv/include/cpu.h | 1 + sys/riscv/riscv/identcpu.c | 10 ++++++++-- sys/riscv/riscv/machdep.c | 7 ++++++- sys/riscv/riscv/mp_machdep.c | 1 + 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/sys/riscv/include/cpu.h b/sys/riscv/include/cpu.h index b33e34d350fb..64e93e984a9b 100644 --- a/sys/riscv/include/cpu.h +++ b/sys/riscv/include/cpu.h @@ -90,6 +90,7 @@ void cpu_halt(void) __dead2; void cpu_reset(void) __dead2; void fork_trampoline(void); void identify_cpu(void); +void printcpuinfo(void); static __inline uint64_t get_cyclecount(void) diff --git a/sys/riscv/riscv/identcpu.c b/sys/riscv/riscv/identcpu.c index 9b2330ee7051..c6e93d02cd36 100644 --- a/sys/riscv/riscv/identcpu.c +++ b/sys/riscv/riscv/identcpu.c @@ -365,6 +365,14 @@ identify_cpu_ids(struct cpu_desc *desc) void identify_cpu(void) +{ + struct cpu_desc *desc = &cpu_desc[PCPU_GET(cpuid)]; + + identify_cpu_ids(desc); +} + +void +printcpuinfo(void) { struct cpu_desc *desc; u_int cpu, hart; @@ -373,8 +381,6 @@ identify_cpu(void) hart = PCPU_GET(hart); desc = &cpu_desc[cpu]; - identify_cpu_ids(desc); - /* Print details for boot CPU or if we want verbose output */ if (cpu == 0 || bootverbose) { /* Summary line. */ diff --git a/sys/riscv/riscv/machdep.c b/sys/riscv/riscv/machdep.c index 6b8dcb647162..805cbe2d887b 100644 --- a/sys/riscv/riscv/machdep.c +++ b/sys/riscv/riscv/machdep.c @@ -128,7 +128,7 @@ cpu_startup(void *dummy) { sbi_print_version(); - identify_cpu(); + printcpuinfo(); printf("real memory = %ju (%ju MB)\n", ptoa((uintmax_t)realmem), ptoa((uintmax_t)realmem) / (1024 * 1024)); @@ -536,6 +536,11 @@ initriscv(struct riscv_bootparams *rvbp) physmem_hardware_regions(mem_regions, mem_regions_sz); #endif + /* + * Identify CPU/ISA features. + */ + identify_cpu(); + /* Do basic tuning, hz etc */ init_param1(); diff --git a/sys/riscv/riscv/mp_machdep.c b/sys/riscv/riscv/mp_machdep.c index 799f07036c00..291e94df1f21 100644 --- a/sys/riscv/riscv/mp_machdep.c +++ b/sys/riscv/riscv/mp_machdep.c @@ -255,6 +255,7 @@ init_secondary(uint64_t hart) * runtime chip identification. */ identify_cpu(); + printcpuinfo(); /* Enable software interrupts */ riscv_unmask_ipi();