From nobody Thu May 7 23:11:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0BEFAC433EF for ; Tue, 17 May 2022 00:55:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236883AbiEQAze (ORCPT ); Mon, 16 May 2022 20:55:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236482AbiEQAza (ORCPT ); Mon, 16 May 2022 20:55:30 -0400 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83BAF344F3 for ; Mon, 16 May 2022 17:55:29 -0700 (PDT) Received: by mail-pj1-x1035.google.com with SMTP id w17-20020a17090a529100b001db302efed6so892934pjh.4 for ; Mon, 16 May 2022 17:55:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=H2M3w87N8EOgC0/E1kAJwjCB00j3VlGn1SiaTA0GCI4=; b=oBdS6oGKMONo6W7KiHyC44QKcc6QdwUE0uChA6qKnet4V/Bq5PQUYToWMMltiIqZn8 D9HOEyqT1XBgJ9tUkWvKLZm4SX2kqk/hbHnlN2kPPDZl5K5OhQPRKGpNoPJoHMs/QKEZ zBwnjtGSpv3PebkKGv2D9mBORqNd2lBc1ZR3LeYtKES6PbSzRef0uOOOThSX4Z5QdagE mW0iMqK+L0ABtC1NS5Ni/EV+N3vPaUam8aprpyqFTTyBsG21fHhzN/jJWJyw1aRGjute SY3zAtmi8iiI9eKWKo9gyeEZxslBu/nRu2GxcEQDY38QEpleGsFUm8EO2DwjXAd2BvyH L/cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=H2M3w87N8EOgC0/E1kAJwjCB00j3VlGn1SiaTA0GCI4=; b=gB+t5bo9jZMVCutp4UItWZiPN8+QyIiVcvcycwAJf27lvtEWJTtkxKoCrEdNbepXrh Pz4k+twaQLoYTZMdNuVO7Za0mKNxraUwXHHSQXDiZ5UjgZ/ZexmgxwlybmW7HVP/Y6Xw jHopwK/kvx0jdMAFTtZF0aESBknK/N04LJFGv21FOw+bFOfBhakEhS0+jt1OjcBDFQcV nrmtFbGkSQBwfTP4lUoSgduFyJ2XqNlUbWKmi7bXQiemvHCxy6yEltaEdfJVr7mDRtO4 0r1YsdMyV8RV6FXa5jRH91RXcDFuglfOMovFhT1R43wQFGDaizjR4fLaPuhuRQpzsbVA Mtwg== X-Gm-Message-State: AOAM531Xx0NM2wcZmbCy3PJxDbrY5Bkr1Qsu5J+KdEBc4P1Ad0iQG9ZK sEx6mLyEox+bAZ2jVsgimCHcgoNUFMc= X-Google-Smtp-Source: ABdhPJzricSwjwhsyYUriiO42PXB0BfxYRb3I3qa8uLhZwnsRNsV5LadGCU21WU8vjpqDMrKzBvETw== X-Received: by 2002:a17:90b:3649:b0:1db:a201:5373 with SMTP id nh9-20020a17090b364900b001dba2015373mr22178032pjb.175.1652748928539; Mon, 16 May 2022 17:55:28 -0700 (PDT) Received: from localhost ([2409:10:24a0:4700:e8ad:216a:2a9d:6d0c]) by smtp.gmail.com with ESMTPSA id x9-20020a628609000000b0050dc7628193sm7353806pfd.109.2022.05.16.17.55.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 May 2022 17:55:27 -0700 (PDT) From: Stafford Horne To: LKML Cc: Openrisc , Stafford Horne , Jonas Bonn , Stefan Kristiansson Subject: [PATCH v2 01/13] openrisc: Add gcc machine instruction flag configuration Date: Tue, 17 May 2022 09:54:58 +0900 Message-Id: <20220517005510.3500105-2-shorne@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220517005510.3500105-1-shorne@gmail.com> References: <20220517005510.3500105-1-shorne@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" OpenRISC GCC supports flags to enable the backend to output instructions if they are supported by a target processor. This patch adds configuration flags to enable configuring these flags to tune the kernel for a particular CPU configuration. In the future we could also enable all of these flags by default and provide instruction emulation in the kernel to make these choices easier for users but this is what we provide for now. Signed-off-by: Stafford Horne --- arch/openrisc/Kconfig | 53 ++++++++++++++++++++++++++++++++++++++++++ arch/openrisc/Makefile | 17 ++++++++++++++ 2 files changed, 70 insertions(+) diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig index 0d68adf6e02b..ea7eac20911a 100644 --- a/arch/openrisc/Kconfig +++ b/arch/openrisc/Kconfig @@ -114,6 +114,59 @@ config OPENRISC_HAVE_INST_DIV default y help Select this if your implementation has a hardware divide instruction + +config OPENRISC_HAVE_INST_CMOV + bool "Have instruction l.cmov for conditional move" + default y + help + This config enables gcc to generate l.cmov instructions when compiling + the kernel which in general will improve performance and reduce the + binary size. + + Select this if your implementation has support for the Class II + l.cmov conistional move instruction. + + Say N if you are unsure. + +config OPENRISC_HAVE_INST_ROR + bool "Have instruction l.ror for rotate right" + default y + help + This config enables gcc to generate l.ror instructions when compiling + the kernel which in general will improve performance and reduce the + binary size. + + Select this if your implementation has support for the Class II + l.ror rotate right instruction. + + Say N if you are unsure. + +config OPENRISC_HAVE_INST_RORI + bool "Have instruction l.rori for rotate right with immediate" + default y + help + This config enables gcc to generate l.rori instructions when compiling + the kernel which in general will improve performance and reduce the + binary size. + + Select this if your implementation has support for the Class II + l.rori rotate right with immediate instruction. + + Say N if you are unsure. + +config OPENRISC_HAVE_INST_SEXT + bool "Have instructions l.ext* for sign extension" + default y + help + This config enables gcc to generate l.ext* instructions when compiling + the kernel which in general will improve performance and reduce the + binary size. + + Select this if your implementation has support for the Class II + l.exths, l.extbs, l.exthz and l.extbz size extend instructions. + + Say N if you are unsure. + endmenu =20 config NR_CPUS diff --git a/arch/openrisc/Makefile b/arch/openrisc/Makefile index 760b734fb822..b446510173cd 100644 --- a/arch/openrisc/Makefile +++ b/arch/openrisc/Makefile @@ -21,6 +21,7 @@ OBJCOPYFLAGS :=3D -O binary -R .note -R .comment -S LIBGCC :=3D $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) =20 KBUILD_CFLAGS +=3D -pipe -ffixed-r10 -D__linux__ +KBUILD_CFLAGS +=3D -msfimm -mshftimm =20 all: vmlinux.bin =20 @@ -38,6 +39,22 @@ else KBUILD_CFLAGS +=3D $(call cc-option,-msoft-div) endif =20 +ifeq ($(CONFIG_OPENRISC_HAVE_INST_CMOV),y) + KBUILD_CFLAGS +=3D $(call cc-option,-mcmov) +endif + +ifeq ($(CONFIG_OPENRISC_HAVE_INST_ROR),y) + KBUILD_CFLAGS +=3D $(call cc-option,-mror) +endif + +ifeq ($(CONFIG_OPENRISC_HAVE_INST_RORI),y) + KBUILD_CFLAGS +=3D $(call cc-option,-mrori) +endif + +ifeq ($(CONFIG_OPENRISC_HAVE_INST_SEXT),y) + KBUILD_CFLAGS +=3D $(call cc-option,-msext) +endif + head-y :=3D arch/openrisc/kernel/head.o =20 libs-y +=3D $(LIBGCC) --=20 2.31.1 From nobody Thu May 7 23:11:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C886C433EF for ; Tue, 17 May 2022 00:55:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237915AbiEQAzn (ORCPT ); Mon, 16 May 2022 20:55:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237059AbiEQAze (ORCPT ); Mon, 16 May 2022 20:55:34 -0400 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 349AB36698 for ; Mon, 16 May 2022 17:55:33 -0700 (PDT) Received: by mail-pf1-x42d.google.com with SMTP id p12so15590428pfn.0 for ; Mon, 16 May 2022 17:55:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4B9whTuaSBuS6zdttFS+MBLPRM6d/yXNWGITeKtP+Lk=; b=O5ESu0QnCpH20R9CRje/OfUaATtqia0qeQN5Ac7g2hRBzMtxoiW6Y50QgXYFFPT1JQ 2C7Qeuu44qzTTmVIHLScuBH0ktoCt97eq0BmboP2b6CDvbFIquA45YZwFDOkBiGJm1rv KJM7R1eqxYjJz70QO2fmz8+q3CDRKOH21iugnxi6G718f1ZdiuWvJUZTC+fM3Dz4Rkmj ZNLlDUnm18L1osOGkOkc1Mn+uisrPhO5o5Bld04qB3bx+yFBRZd5Upukarb4VqOtkdtb JN+cIeuEGgCoP7k57XYWD/il8wkvkEijeClmYr3E3qeafpVI0B79I/npzTzHHcyuGRFg 1GRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4B9whTuaSBuS6zdttFS+MBLPRM6d/yXNWGITeKtP+Lk=; b=AVTuKy3caITP20c2wWfNnWTLmYQGTazztTnYaxeiy/Tt8pq4rGqAdxyrHvVqi+CZ2P 2e/BNExEuiPsq75K0BQYB+uORt17NUs1mc6GfNb0jpsFP51F62bu5PJhKhnOlShiRLar peMRSNp00EQdOO55mQRXmio6e9N90U4clyeGuHcmWIMAQgF4MRglBSj6aodjeQ5U0t8V pANn4MDQmtcACzHI/bgRcBlvVRuQut7areYezxhDRzZ9lMkBYLNAyGcpxM1wlvOts1du 8d1+cpvzTB/H5QXCuEQaAxrnJFw4jvWx5gRqwa0Se18JVyk0MSK8Dmcl/Hygv5/ETU8Q kKaA== X-Gm-Message-State: AOAM532AKZQblvjyQCObxJA2KAEyE8b6yeoAFgKiPj+Qml1QO22fErto wQRzoE+vu+uLwz0MbupZHLEQZ4dLbvA= X-Google-Smtp-Source: ABdhPJz3B5rOUpekhP9RiiPysC+YiE+tZGPYkHfGaRIR9MRb5dNhKVLPbFQKs1MVje4YehDvDgpBnA== X-Received: by 2002:a05:6a00:1683:b0:4f7:e497:6a55 with SMTP id k3-20020a056a00168300b004f7e4976a55mr19773111pfc.21.1652748932153; Mon, 16 May 2022 17:55:32 -0700 (PDT) Received: from localhost ([2409:10:24a0:4700:e8ad:216a:2a9d:6d0c]) by smtp.gmail.com with ESMTPSA id k3-20020a17090a7f0300b001d77f392280sm293701pjl.30.2022.05.16.17.55.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 May 2022 17:55:31 -0700 (PDT) From: Stafford Horne To: LKML Cc: Openrisc , Stafford Horne , Jonas Bonn , Stefan Kristiansson , Randy Dunlap Subject: [PATCH v2 02/13] openrisc: Cleanup emergency print handling Date: Tue, 17 May 2022 09:54:59 +0900 Message-Id: <20220517005510.3500105-3-shorne@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220517005510.3500105-1-shorne@gmail.com> References: <20220517005510.3500105-1-shorne@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The emergency print support only works for 8250 compatible serial ports. Now that OpenRISC platforms may be configured with different serial port hardware we don't want emergency print to try to print to non-existent hardware which will cause lockups. This patch contains several fixes to get emergency print working again: - Update symbol loading to not assume the location of symbols - Split the putc print operation out to its own function to allow for different future implementations. - Update _emergency_print_nr and _emergency_print to use the putc function. - Guard serial 8250 specific sequences by CONFIG_SERIAL_8250 - Update string line feed from lf,cr to cr,lf. Signed-off-by: Stafford Horne --- Changes since v1: - Fix ifdefs pointed out by Samuel arch/openrisc/kernel/head.S | 148 +++++++++++++++++++++--------------- 1 file changed, 85 insertions(+), 63 deletions(-) diff --git a/arch/openrisc/kernel/head.S b/arch/openrisc/kernel/head.S index 15f1b38dfe03..7bfa6e4b60c5 100644 --- a/arch/openrisc/kernel/head.S +++ b/arch/openrisc/kernel/head.S @@ -297,19 +297,23 @@ /* temporary store r3, r9 into r1, r10 */ ;\ l.addi r1,r3,0x0 ;\ l.addi r10,r9,0x0 ;\ - /* the string referenced by r3 must be low enough */ ;\ + LOAD_SYMBOL_2_GPR(r9,_string_unhandled_exception) ;\ + tophys (r3,r9) ;\ l.jal _emergency_print ;\ - l.ori r3,r0,lo(_string_unhandled_exception) ;\ + l.nop ;\ l.mfspr r3,r0,SPR_NPC ;\ l.jal _emergency_print_nr ;\ - l.andi r3,r3,0x1f00 ;\ - /* the string referenced by r3 must be low enough */ ;\ + l.andi r3,r3,0x1f00 ;\ + LOAD_SYMBOL_2_GPR(r9,_string_epc_prefix) ;\ + tophys (r3,r9) ;\ l.jal _emergency_print ;\ - l.ori r3,r0,lo(_string_epc_prefix) ;\ + l.nop ;\ l.jal _emergency_print_nr ;\ - l.mfspr r3,r0,SPR_EPCR_BASE ;\ + l.mfspr r3,r0,SPR_EPCR_BASE ;\ + LOAD_SYMBOL_2_GPR(r9,_string_nl) ;\ + tophys (r3,r9) ;\ l.jal _emergency_print ;\ - l.ori r3,r0,lo(_string_nl) ;\ + l.nop ;\ /* end of printing */ ;\ l.addi r3,r1,0x0 ;\ l.addi r9,r10,0x0 ;\ @@ -1530,65 +1534,99 @@ trampoline_out: l.jr r9 l.nop =20 - /* - * DSCR: prints a string referenced by r3. + * DESC: Prints ASCII character stored in r7 * - * PRMS: r3 - address of the first character of null - * terminated string to be printed + * PRMS: r7 - a 32-bit value with an ASCII character in the first byte + * position. * - * PREQ: UART at UART_BASE_ADD has to be initialized + * PREQ: The UART at UART_BASE_ADD has to be initialized * - * POST: caller should be aware that r3, r9 are changed + * POST: internally used but restores: + * r4 - to store UART_BASE_ADD + * r5 - for loading OFF_TXFULL / THRE,TEMT + * r6 - for storing bitmask (SERIAL_8250) */ -ENTRY(_emergency_print) +ENTRY(_emergency_putc) EMERGENCY_PRINT_STORE_GPR4 EMERGENCY_PRINT_STORE_GPR5 EMERGENCY_PRINT_STORE_GPR6 - EMERGENCY_PRINT_STORE_GPR7 -2: - l.lbz r7,0(r3) - l.sfeq r7,r0 - l.bf 9f - l.nop =20 -// putc: l.movhi r4,hi(UART_BASE_ADD) + l.ori r4,r4,lo(UART_BASE_ADD) =20 +#if defined(CONFIG_SERIAL_8250) + /* Check UART LSR THRE (hold) bit */ l.addi r6,r0,0x20 1: l.lbz r5,5(r4) l.andi r5,r5,0x20 l.sfeq r5,r6 l.bnf 1b - l.nop + l.nop =20 + /* Write character */ l.sb 0(r4),r7 =20 + /* Check UART LSR THRE|TEMT (hold, empty) bits */ l.addi r6,r0,0x60 1: l.lbz r5,5(r4) l.andi r5,r5,0x60 l.sfeq r5,r6 l.bnf 1b - l.nop + l.nop +#endif + EMERGENCY_PRINT_LOAD_GPR6 + EMERGENCY_PRINT_LOAD_GPR5 + EMERGENCY_PRINT_LOAD_GPR4 + l.jr r9 + l.nop + +/* + * DSCR: prints a string referenced by r3. + * + * PRMS: r3 - address of the first character of null + * terminated string to be printed + * + * PREQ: UART at UART_BASE_ADD has to be initialized + * + * POST: caller should be aware that r3, r9 are changed + */ +ENTRY(_emergency_print) + EMERGENCY_PRINT_STORE_GPR7 + EMERGENCY_PRINT_STORE_GPR9 + + /* Load character to r7, check for null terminator */ +2: l.lbz r7,0(r3) + l.sfeqi r7,0x0 + l.bf 9f + l.nop + + l.jal _emergency_putc + l.nop =20 /* next character */ l.j 2b - l.addi r3,r3,0x1 + l.addi r3,r3,0x1 =20 9: + EMERGENCY_PRINT_LOAD_GPR9 EMERGENCY_PRINT_LOAD_GPR7 - EMERGENCY_PRINT_LOAD_GPR6 - EMERGENCY_PRINT_LOAD_GPR5 - EMERGENCY_PRINT_LOAD_GPR4 l.jr r9 - l.nop + l.nop =20 +/* + * DSCR: prints a number in r3 in hex. + * + * PRMS: r3 - a 32-bit unsigned integer + * + * PREQ: UART at UART_BASE_ADD has to be initialized + * + * POST: caller should be aware that r3, r9 are changed + */ ENTRY(_emergency_print_nr) - EMERGENCY_PRINT_STORE_GPR4 - EMERGENCY_PRINT_STORE_GPR5 - EMERGENCY_PRINT_STORE_GPR6 EMERGENCY_PRINT_STORE_GPR7 EMERGENCY_PRINT_STORE_GPR8 + EMERGENCY_PRINT_STORE_GPR9 =20 l.addi r8,r0,32 // shift register =20 @@ -1600,58 +1638,39 @@ ENTRY(_emergency_print_nr) /* don't skip the last zero if number =3D=3D 0x0 */ l.sfeqi r8,0x4 l.bf 2f - l.nop + l.nop =20 l.sfeq r7,r0 l.bf 1b - l.nop + l.nop =20 2: l.srl r7,r3,r8 =20 l.andi r7,r7,0xf l.sflts r8,r0 - l.bf 9f + l.bf 9f =20 + /* Numbers greater than 9 translate to a-f */ l.sfgtui r7,0x9 l.bnf 8f - l.nop + l.nop l.addi r7,r7,0x27 =20 -8: - l.addi r7,r7,0x30 -// putc: - l.movhi r4,hi(UART_BASE_ADD) - - l.addi r6,r0,0x20 -1: l.lbz r5,5(r4) - l.andi r5,r5,0x20 - l.sfeq r5,r6 - l.bnf 1b - l.nop - - l.sb 0(r4),r7 - - l.addi r6,r0,0x60 -1: l.lbz r5,5(r4) - l.andi r5,r5,0x60 - l.sfeq r5,r6 - l.bnf 1b - l.nop + /* Convert to ascii and output character */ +8: l.jal _emergency_putc + l.addi r7,r7,0x30 =20 /* next character */ l.j 2b l.addi r8,r8,-0x4 =20 9: + EMERGENCY_PRINT_LOAD_GPR9 EMERGENCY_PRINT_LOAD_GPR8 EMERGENCY_PRINT_LOAD_GPR7 - EMERGENCY_PRINT_LOAD_GPR6 - EMERGENCY_PRINT_LOAD_GPR5 - EMERGENCY_PRINT_LOAD_GPR4 l.jr r9 - l.nop - + l.nop =20 /* * This should be used for debugging only. @@ -1676,7 +1695,9 @@ ENTRY(_emergency_print_nr) =20 ENTRY(_early_uart_init) l.movhi r3,hi(UART_BASE_ADD) + l.ori r3,r3,lo(UART_BASE_ADD) =20 +#if defined(CONFIG_SERIAL_8250) l.addi r4,r0,0x7 l.sb 0x2(r3),r4 =20 @@ -1694,9 +1715,10 @@ ENTRY(_early_uart_init) l.addi r4,r0,((UART_DIVISOR) & 0x000000ff) l.sb UART_DLL(r3),r4 l.sb 0x3(r3),r5 +#endif =20 l.jr r9 - l.nop + l.nop =20 .align 0x1000 .global _secondary_evbar @@ -1711,13 +1733,13 @@ _secondary_evbar: =20 .section .rodata _string_unhandled_exception: - .string "\n\rRunarunaround: Unhandled exception 0x\0" + .string "\r\nRunarunaround: Unhandled exception 0x\0" =20 _string_epc_prefix: .string ": EPC=3D0x\0" =20 _string_nl: - .string "\n\r\0" + .string "\r\n\0" =20 =20 /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D[ page aligned structure= s ]=3D=3D=3D */ --=20 2.31.1 From nobody Thu May 7 23:11:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 861BFC433F5 for ; Tue, 17 May 2022 00:55:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239532AbiEQAzv (ORCPT ); Mon, 16 May 2022 20:55:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237820AbiEQAzj (ORCPT ); Mon, 16 May 2022 20:55:39 -0400 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9497F369D4 for ; Mon, 16 May 2022 17:55:36 -0700 (PDT) Received: by mail-pj1-x1030.google.com with SMTP id t11-20020a17090a6a0b00b001df6f318a8bso958517pjj.4 for ; Mon, 16 May 2022 17:55:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8oLADI5NiHsnQbc73WheH/PuvP/+QEln3IGTPYBBAzo=; b=V/+CTtdeJnUKuXDCGH6M/X0W1zvVeJof1JXCsrKIids9z9JZ0SgI935DIS00Y83oA+ R3yny+ba7IvenXfqyNazXP5CC4Jd8WKgUa8iZmwPzNRN+I7bhT1OiMtWPRzaTgrogyrW LZvO688C9uYRdqu63tP1pscsxGUShlhNU3C811xEUwV44ydjjkkMRCkvxiytyIW2+hfP FRRj4HDrp0m2dS5skBKX+IeF9lcN/BYkhAmj5btvClQbZggmvmGlMLk3MDgO8ZBkNTvw 2zGQxX5kecmDtmagEN+oXedLmt6Tl44L4R3xjwtSo9Dx7P6JDQoR58jKmbRVncpXZJMK ojSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8oLADI5NiHsnQbc73WheH/PuvP/+QEln3IGTPYBBAzo=; b=o2dL5Ii1FnoAjM5igiKaAeDYXItVD7TBCozlD2SCfMKgmIuefE4PXqS9SmSARhr1R0 djbEPbaMHPOyw0iTNUcW/ik61uE8crIpgC+1XHTf+IqW72ryA7tID/aWzeWl4E15JKHy qn+YvYC+GROqZj+zlf3l/Rfl7tjEPxMBI2oBqkGCGWW1ENW/LoxDucboPk4dilev3pKm tS/zjFquVWE5hJwvRJ3cpmZ85l1Mxdn0N758lSEYJeitp4/Zs/Sb47km5k+Y1ve2MU7v SvoKRm1lTrknr0fIi+O50HniL1jDXDNpJEf80WzGEwaDnVBcv/YGjJT1hLAAnAQ8XxL+ pqIg== X-Gm-Message-State: AOAM533pkE7joiiaNY6X7wte5y2RMmTEmGDHwmRvgp1fq67M+IChkri8 cz6WNo/sdA4UBz/LpsKkzoEhcJHoRp8= X-Google-Smtp-Source: ABdhPJyJvaNZcoAIqSz7o+nJGt4QTm8WYq1w1faSsAKwdTtUDvyeYa69U7QGc3rKO0+DKrxPtmlDSQ== X-Received: by 2002:a17:903:2481:b0:15f:249c:2006 with SMTP id p1-20020a170903248100b0015f249c2006mr20168453plw.31.1652748935585; Mon, 16 May 2022 17:55:35 -0700 (PDT) Received: from localhost ([2409:10:24a0:4700:e8ad:216a:2a9d:6d0c]) by smtp.gmail.com with ESMTPSA id w8-20020a170902e88800b0015e8d4eb28fsm7633165plg.217.2022.05.16.17.55.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 May 2022 17:55:34 -0700 (PDT) From: Stafford Horne To: LKML Cc: Openrisc , Stafford Horne , Jonas Bonn , Stefan Kristiansson , Randy Dunlap Subject: [PATCH v2 03/13] openrisc: Add support for liteuart emergency printing Date: Tue, 17 May 2022 09:55:00 +0900 Message-Id: <20220517005510.3500105-4-shorne@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220517005510.3500105-1-shorne@gmail.com> References: <20220517005510.3500105-1-shorne@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" This patch adds support for sending emergency print output, such as unhandled exception details, to a liteuart serial device. This is the default device available on litex platforms. If a developer want to use this they should update UART_BASE_ADD to the address of liteuart. Signed-off-by: Stafford Horne --- Changes since v1: - Update for patch 2/12 ifdef changes arch/openrisc/kernel/head.S | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/arch/openrisc/kernel/head.S b/arch/openrisc/kernel/head.S index 7bfa6e4b60c5..21db50563f97 100644 --- a/arch/openrisc/kernel/head.S +++ b/arch/openrisc/kernel/head.S @@ -1555,7 +1555,18 @@ ENTRY(_emergency_putc) l.movhi r4,hi(UART_BASE_ADD) l.ori r4,r4,lo(UART_BASE_ADD) =20 -#if defined(CONFIG_SERIAL_8250) +#if defined(CONFIG_SERIAL_LITEUART) + /* Check OFF_TXFULL status */ +1: l.lwz r5,4(r4) + l.andi r5,r5,0xff + l.sfnei r5,0 + l.bf 1b + l.nop + + /* Write character */ + l.andi r7,r7,0xff + l.sw 0(r4),r7 +#elif defined(CONFIG_SERIAL_8250) /* Check UART LSR THRE (hold) bit */ l.addi r6,r0,0x20 1: l.lbz r5,5(r4) --=20 2.31.1 From nobody Thu May 7 23:11:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 923B5C433F5 for ; Tue, 17 May 2022 00:55:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239898AbiEQAz5 (ORCPT ); Mon, 16 May 2022 20:55:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239454AbiEQAzl (ORCPT ); Mon, 16 May 2022 20:55:41 -0400 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D39ECE7 for ; Mon, 16 May 2022 17:55:39 -0700 (PDT) Received: by mail-pf1-x436.google.com with SMTP id bo5so15533542pfb.4 for ; Mon, 16 May 2022 17:55:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=URPrkUOTksZy0vkIOlXm6I32VTQjSzL208bMcPxmSHk=; b=UupvaoPH523tK0FTB32h9+ccvRKp5igs/DWMORUUtCOWOso6fYzWmPV+1a1zyTdqcf du5DS5q7UYYny+lco4UHxNUe3g5wjcaAjf+2mpilM4MX2LQrmQVChFFq4njBYqqd7aWN PS875JvWku0ngw3WBdywFS5kRHOrXvF3wvwqRT+BlF0HTPedbYu8zAMqPXquJCdDm5iN Fs1QKOhsrYQAYijAjK9eyaxDeQuad7fkz/TccnfzfSVMZibZpptOdBr7/FR1bvRTJmth 1D3SPUI66RyKUk23pqzp5FBv5lPmiPsEp9cc1SSCLxuVHYc/NBd/LnoUj6QU33lsSkoi e1RQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=URPrkUOTksZy0vkIOlXm6I32VTQjSzL208bMcPxmSHk=; b=3gJzYKjjPHLlmc8vdezFmPZIune15Y5gkR2J3kCdd3iX1NgnqCyxqaE+R/gLAualM1 eMhQebfPbGPAO1Nyoxb1m/lg2/EUkytmRj6xe/VYwjKkGxu5Qrn4hl1Cl5UuQxZuqRAX ce1lDjGnyI2c8sXHL4r/ZrimYgyWGSqIKxY2o9xcGGHhl02waHrkIqM29I+NljrL5E2r d2PaafSi0K+xSt/7xxSC9su1WBk7s8DPnJMEHRtrkbvI2mijdQLYLo7S1bnA+Ob5RbJd 3CTca+0mKXS0Xlq6R7wKEvp305R1YKsDtFlDI3rCBSr3+MzaU24l03gjni1WelkhrIji 63EQ== X-Gm-Message-State: AOAM5310wqAjsWz3lj55IL3MCNyCX4eeFVsNSCTxjoGw/ITFAGL1ahMs dpuRWCLfjXHB9DaiblK9h5ZL+Ppnb0D1PQ== X-Google-Smtp-Source: ABdhPJyZJpbgtHCnP93HtiV36JN+8M71Eq1x/qZGWWPpnNp/RLPeQVQ7W2jRJDrqPdRD3V8yp3zEzQ== X-Received: by 2002:a65:6297:0:b0:3db:4820:2867 with SMTP id f23-20020a656297000000b003db48202867mr16938361pgv.503.1652748938816; Mon, 16 May 2022 17:55:38 -0700 (PDT) Received: from localhost ([2409:10:24a0:4700:e8ad:216a:2a9d:6d0c]) by smtp.gmail.com with ESMTPSA id cs20-20020a17090af51400b001df5dea7d4bsm282211pjb.43.2022.05.16.17.55.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 May 2022 17:55:38 -0700 (PDT) From: Stafford Horne To: LKML Cc: Openrisc , Stafford Horne , Andrey Bacherov , Jonas Bonn , Stefan Kristiansson , Randy Dunlap , Petr Mladek , Andy Shevchenko , Chris Down , Mark Rutland Subject: [PATCH v2 04/13] openrisc: Add syscall details to emergency syscall debugging Date: Tue, 17 May 2022 09:55:01 +0900 Message-Id: <20220517005510.3500105-5-shorne@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220517005510.3500105-1-shorne@gmail.com> References: <20220517005510.3500105-1-shorne@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" When bringing linux on the or1k Marocchino we ran into issues starting init. This patch adds the syscall number and return address to assist tracing syscalls even before strace is able to be used. By default this is all disabled but a developer could adjust the ifdef to enable debugging. Cc: Andrey Bacherov Signed-off-by: Stafford Horne --- arch/openrisc/kernel/entry.S | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/arch/openrisc/kernel/entry.S b/arch/openrisc/kernel/entry.S index 3ca1b1f490b9..54a87bba35ca 100644 --- a/arch/openrisc/kernel/entry.S +++ b/arch/openrisc/kernel/entry.S @@ -601,7 +601,7 @@ UNHANDLED_EXCEPTION(_vector_0xb00,0xb00) */ =20 _string_syscall_return: - .string "syscall return %ld \n\r\0" + .string "syscall r9:0x%08x -> syscall(%ld) return %ld\0" .align 4 =20 ENTRY(_sys_call_handler) @@ -679,15 +679,25 @@ _syscall_return: _syscall_debug: l.movhi r3,hi(_string_syscall_return) l.ori r3,r3,lo(_string_syscall_return) - l.ori r27,r0,1 + l.ori r27,r0,2 l.sw -4(r1),r27 l.sw -8(r1),r11 - l.addi r1,r1,-8 + l.lwz r29,PT_ORIG_GPR11(r1) + l.sw -12(r1),r29 + l.lwz r29,PT_GPR9(r1) + l.sw -16(r1),r29 l.movhi r27,hi(_printk) l.ori r27,r27,lo(_printk) l.jalr r27 - l.nop - l.addi r1,r1,8 + l.addi r1,r1,-16 + l.addi r1,r1,16 +#endif +#if 0 +_syscall_show_regs: + l.movhi r27,hi(show_registers) + l.ori r27,r27,lo(show_registers) + l.jalr r27 + l.or r3,r1,r1 #endif =20 _syscall_check_trace_leave: --=20 2.31.1 From nobody Thu May 7 23:11:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 68F3AC433EF for ; Tue, 17 May 2022 00:57:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240260AbiEQA4B (ORCPT ); Mon, 16 May 2022 20:56:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238125AbiEQAzx (ORCPT ); Mon, 16 May 2022 20:55:53 -0400 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3C81631D for ; Mon, 16 May 2022 17:55:43 -0700 (PDT) Received: by mail-pl1-x631.google.com with SMTP id m12so16009264plb.4 for ; Mon, 16 May 2022 17:55:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6s5Kt+Fz8ODBsnaEn4hTWh6elxNZ/IIbeZw2XTvUCZg=; b=l9BCm+sZ/jPB00HhEvjDgNEBEZubgYsHBxfKzYQWLsXeMk7sC7EtDNnhmZul6RoA0n SOQYpqJmzwwC6ayzYVCcwcX6YYAi/DxWNaxKiV0TTUUIZ3D82gME2gJjJmZGl6xyHl+X i/IZkzXiPpVoYOSIkoOXPPW8daAFzitvLKTrSPCuyZfPrvXRGNJTTTiUYmoV3dkTAFg3 0Bset5Z9Y6xm6ZENrofdTr3hbh/LZ/lsw020yAaYZ2h+2cLCqmWhUg/6x9kYD+P4VV/e GYkKWLJlYgXsLom70JZTc0HvzyOh8IqkKVqiEHBbrPNVcvxxoZRI7yDs4QUT1F+ZFbSV DALA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6s5Kt+Fz8ODBsnaEn4hTWh6elxNZ/IIbeZw2XTvUCZg=; b=dvfCg5xQ7ZQ19i29E1/q+uygEM28mIejQ2Zc/h6qqa1f8nngnSiniHxcH0tZYFWDFj 6LMGElAKSvE2vXKpk0sFPsMSgi+kOhlwTFo6SXwXgl1swK2vceBIq/zRg+QUDt9CwtFa 6nedq8tdFyPpNsfiu9NLVI79ihZp/RGlY0yUKI2+eERVkWdEwAIv1wAUIQJwnvrnCjMf Rq3J9z3xDiCnnKCnkwbsexV1yJV4wlmuW8pP9ut4APtfpzHJ1S3P8MFOOlZqjCXrGgTu 6QMvoGT6J6JJar3x7aWnsI812a3JqE/ZQ9eN5Yhxa7hnXCH/OruodhqXclNKstypxuDo NczQ== X-Gm-Message-State: AOAM530MogQnLJh9yNrxD0XBs49OwP3EfaDplozKaIym/dgOL6QjyD+R F9OVCsLxChcJQHUhSXIF48mxdr/VvoNK+w== X-Google-Smtp-Source: ABdhPJxvFFdRTk3lKAN1oUhl5cV3phAoVEYDgCYWnKR565VZbl7z6Gtn4FzBT+iaLvJuWKdNzFTXRQ== X-Received: by 2002:a17:903:246:b0:153:84fe:a9b0 with SMTP id j6-20020a170903024600b0015384fea9b0mr19934908plh.163.1652748942250; Mon, 16 May 2022 17:55:42 -0700 (PDT) Received: from localhost ([2409:10:24a0:4700:e8ad:216a:2a9d:6d0c]) by smtp.gmail.com with ESMTPSA id k189-20020a6384c6000000b003c574b4a95dsm7374535pgd.53.2022.05.16.17.55.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 May 2022 17:55:41 -0700 (PDT) From: Stafford Horne To: LKML Cc: Openrisc , Stafford Horne , Jonas Bonn , Stefan Kristiansson , "Eric W. Biederman" , "Russell King (Oracle)" , Andrew Morton , Kefeng Wang Subject: [PATCH v2 05/13] openrisc: Pretty print show_registers memory dumps Date: Tue, 17 May 2022 09:55:02 +0900 Message-Id: <20220517005510.3500105-6-shorne@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220517005510.3500105-1-shorne@gmail.com> References: <20220517005510.3500105-1-shorne@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Currently show registers, print memory dumps character by character and there is no address information, so its a bit difficult to use. For example before a stack dump looks as follows. [ 13.650000] Stack: [ 13.650000] Call trace [ 13.690000] [<(ptrval)>] ? put_timespec64+0x44/0x60 [ 13.690000] [<(ptrval)>] ? _data_page_fault_handler+0x104/0x10c [ 13.700000] [ 13.700000] Code: [ 13.700000] 13 [ 13.700000] ff [ 13.700000] ff [ 13.700000] f9 [ 13.710000] 84 [ 13.710000] 82 [ 13.710000] ff [ 13.710000] bc [ 13.710000] 07 [ 13.710000] fd [ 13.720000] 4e [ 13.720000] 67 [ 13.720000] 84 [ 13.720000] 62 [ 13.720000] ff ... This change updates this to print the address and data a word at time. [ 0.830000] Stack: [ 0.830000] Call trace: [ 0.830000] [<(ptrval)>] load_elf_binary+0x744/0xf5c [ 0.830000] [<(ptrval)>] ? __kernel_read+0x144/0x184 [ 0.830000] [<(ptrval)>] bprm_execve+0x27c/0x3e4 [ 0.830000] [<(ptrval)>] kernel_execve+0x16c/0x1a0 [ 0.830000] [<(ptrval)>] run_init_process+0xa0/0xec [ 0.830000] [<(ptrval)>] ? kernel_init+0x0/0x14c [ 0.830000] [<(ptrval)>] kernel_init+0x7c/0x14c [ 0.830000] [<(ptrval)>] ? calculate_sigpending+0x30/0x40 [ 0.830000] [<(ptrval)>] ret_from_fork+0x1c/0x84 [ 0.830000] [ 0.830000] c1033dbc: c1033dec [ 0.830000] c1033dc0: c015258c [ 0.830000] c1033dc4: c129da00 [ 0.830000] c1033dc8: 00000002 [ 0.830000] c1033dcc: 00000000 [ 0.830000] c1033dd0: c129da00 [ 0.830000] c1033dd4: 00000000 [ 0.830000] c1033dd8: 00000000 [ 0.830000] (c1033ddc:) 00001e04 [ 0.830000] c1033de0: 001501fc [ 0.830000] c1033de4: c1033e68 [ 0.830000] c1033de8: c0152e60 [ 0.830000] c1033dec: c129da5c [ 0.830000] c1033df0: c0674a20 [ 0.830000] c1033df4: c1033e50 [ 0.830000] c1033df8: c00e3d6c [ 0.830000] c1033dfc: c129da5c [ 0.830000] c1033e00: 00000003 [ 0.830000] c1033e04: 00150000 [ 0.830000] c1033e08: 00002034 [ 0.830000] c1033e0c: 001501fc [ 0.830000] c1033e10: 00000000 [ 0.830000] c1033e14: 00150000 [ 0.830000] c1033e18: 0014ebbc [ 0.830000] c1033e1c: 00002000 [ 0.830000] c1033e20: 00000003 [ 0.830000] c1033e24: c12a07e0 [ 0.830000] c1033e28: 00000000 [ 0.830000] c1033e2c: 00000000 [ 0.830000] c1033e30: 00000000 [ 0.830000] c1033e34: 40040000 [ 0.830000] c1033e38: 00000000 [ 0.830000] [ 0.830000] Code: [ 0.830000] c00047a4: 9c21fff8 [ 0.830000] c00047a8: d4012000 [ 0.830000] c00047ac: d4011804 [ 0.830000] c00047b0: e4040000 [ 0.830000] c00047b4: 10000005 [ 0.830000] c00047b8: 9c84ffff [ 0.830000] (c00047bc:) d8030000 [ 0.830000] c00047c0: 03fffffc [ 0.830000] c00047c4: 9c630001 [ 0.830000] c00047c8: 9d640001 [ 0.830000] c00047cc: 84810000 [ 0.830000] c00047d0: 84610004 Now we are also printing a bit of the stack as well as the code. The stack is output to help with debugging. There may be concern about exposing sensitive information on the stack, but we are already dumping all register content which would have similar sensitive information. So I am going ahead as this proves useful in investigation. Signed-off-by: Stafford Horne --- arch/openrisc/kernel/traps.c | 46 ++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 13 deletions(-) diff --git a/arch/openrisc/kernel/traps.c b/arch/openrisc/kernel/traps.c index 0446a3c34372..f2478bba77b9 100644 --- a/arch/openrisc/kernel/traps.c +++ b/arch/openrisc/kernel/traps.c @@ -46,6 +46,14 @@ void print_trace(void *data, unsigned long addr, int rel= iable) (void *) addr); } =20 +static void print_data(unsigned long base_addr, unsigned long word, int i) +{ + if (i =3D=3D 0) + printk("(%08lx:)\t%08lx", base_addr + (i * 4), word); + else + printk(" %08lx:\t%08lx", base_addr + (i * 4), word); +} + /* displays a short stack trace */ void show_stack(struct task_struct *task, unsigned long *esp, const char *= loglvl) { @@ -99,22 +107,36 @@ void show_registers(struct pt_regs *regs) printk("\nStack: "); show_stack(NULL, (unsigned long *)esp, KERN_EMERG); =20 + if (esp < PAGE_OFFSET) + goto bad_stack; + + printk("\n"); + for (i =3D -8; i < 24; i +=3D 1) { + unsigned long word; + + if (__get_user(word, &((unsigned long *)esp)[i])) { +bad_stack: + printk(" Bad Stack value."); + break; + } + + print_data(esp, word, i); + } + printk("\nCode: "); if (regs->pc < PAGE_OFFSET) goto bad; =20 - for (i =3D -24; i < 24; i++) { - unsigned char c; - if (__get_user(c, &((unsigned char *)regs->pc)[i])) { + for (i =3D -6; i < 6; i +=3D 1) { + unsigned long word; + + if (__get_user(word, &((unsigned long *)regs->pc)[i])) { bad: printk(" Bad PC value."); break; } =20 - if (i =3D=3D 0) - printk("(%02x) ", c); - else - printk("%02x ", c); + print_data(regs->pc, word, i); } } printk("\n"); @@ -185,13 +207,11 @@ void nommu_dump_state(struct pt_regs *regs, printk("\nCode: "); =20 for (i =3D -24; i < 24; i++) { - unsigned char c; - c =3D ((unsigned char *)(__pa(regs->pc)))[i]; + unsigned long word; + + word =3D ((unsigned long *)(__pa(regs->pc)))[i]; =20 - if (i =3D=3D 0) - printk("(%02x) ", c); - else - printk("%02x ", c); + print_data(regs->pc, word, i); } printk("\n"); } --=20 2.31.1 From nobody Thu May 7 23:11:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89C24C433FE for ; Tue, 17 May 2022 00:58:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232191AbiEQA6K (ORCPT ); Mon, 16 May 2022 20:58:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239719AbiEQAzx (ORCPT ); Mon, 16 May 2022 20:55:53 -0400 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62042DEA3; Mon, 16 May 2022 17:55:46 -0700 (PDT) Received: by mail-pj1-x1030.google.com with SMTP id t11-20020a17090a6a0b00b001df6f318a8bso958517pjj.4; Mon, 16 May 2022 17:55:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=oszu+rft9ZMt8hn3XlfQBiWXh4vkWerpEVjVpNGVwQE=; b=GmR3175J1QJA++Kl/bkM18GAR0pdIOR/nKTuYJ02O2yIkNWXEOJPq5w2+cfh2DL/TI +jpF745GD82YqiM0gAdhkEKWSc1XbAzth44QQ+UornMYJ4amJjWzRY33tQN2cmVR4ZWe aUt8vVXkkVq0g7off74SJU92u11TirCMvQligM3DUzTK7LwzvsjXzY8jNQyQTQVHUY6G Wl/ZlIgB8DVF8oJQKkNjJGtI74NFgq2+9SOhSvo8bQx38xZOaKs6snbLQD2nvg3DT4wT j7yJRDZp4nZL3LnHSNNdGMqGRVp+SBRs8NMW1exWDQAv5MMUkn6s4sPJL4eNLfA873eH Wwzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=oszu+rft9ZMt8hn3XlfQBiWXh4vkWerpEVjVpNGVwQE=; b=veYIC+h+A4zg0b7UWqwWJlDCvLPIpRUv/1yxy+CU1IYSF6NNZ8psnOmMAveYLobQna 5WV24ZS0mQzhki7NoxQ/CSCZUNa2HfiPkLNtnwaGg9a2xfCBPJDmgxTEPJItSaxvEkWW K71kzgFbEyGKo14lwtb8sts5GoBhkIRc0NZ3VVy/FHFBLAoz0JkpQ8B5MMvMYq/gGH/a uyX11BztmYu/rl67yBhXt3wOsrRO8/VXqo+vDaFiZhQpDhE93VfX9hBmu5lInyKzX5mG o8R9OOJfSY8az1n+iWoFxzUJW1r6KZATradB2fy0TcCK/2TxxjI9vzgXHvSZCjGF1VSK 7VJQ== X-Gm-Message-State: AOAM532+XcaJnOvigQUJUa3x3O8MimYT/47q0OUDwva7KQPenxFg8CwX rewvzBJenoF+SUXxSBhkAMzaV8OeOgEElw== X-Google-Smtp-Source: ABdhPJx6yIrIZNvt4OMM4DykP/blCEK67dJ+2zkDI1WzYEMFAxHoTyKI6A15UXJyEq9tmctm+aFOgQ== X-Received: by 2002:a17:902:ce11:b0:15f:4acc:f1fb with SMTP id k17-20020a170902ce1100b0015f4accf1fbmr19520857plg.76.1652748945576; Mon, 16 May 2022 17:55:45 -0700 (PDT) Received: from localhost ([2409:10:24a0:4700:e8ad:216a:2a9d:6d0c]) by smtp.gmail.com with ESMTPSA id p26-20020a62b81a000000b0050dc7628177sm7474333pfe.81.2022.05.16.17.55.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 May 2022 17:55:44 -0700 (PDT) From: Stafford Horne To: LKML Cc: Openrisc , Stafford Horne , Jonas Bonn , Stefan Kristiansson , Karol Gugala , Mateusz Holenko , Gabriel Somlo , Joel Stanley , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , netdev@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH v2 06/13] openrisc: Update litex defconfig to support glibc userland Date: Tue, 17 May 2022 09:55:03 +0900 Message-Id: <20220517005510.3500105-7-shorne@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220517005510.3500105-1-shorne@gmail.com> References: <20220517005510.3500105-1-shorne@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" I have been using a litex SoC for glibc verification. Update the default litex config to support required userspace API's needed for the full glibc testsuite to pass. This includes enabling the litex mmc driver and filesystems used in a typical litex environment. Signed-off-by: Stafford Horne --- arch/openrisc/configs/or1klitex_defconfig | 33 +++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/arch/openrisc/configs/or1klitex_defconfig b/arch/openrisc/conf= igs/or1klitex_defconfig index d695879a4d26..4c0138340bd9 100644 --- a/arch/openrisc/configs/or1klitex_defconfig +++ b/arch/openrisc/configs/or1klitex_defconfig @@ -1,22 +1,55 @@ +CONFIG_SYSVIPC=3Dy +CONFIG_POSIX_MQUEUE=3Dy +CONFIG_CGROUPS=3Dy +CONFIG_NAMESPACES=3Dy +CONFIG_USER_NS=3Dy CONFIG_BLK_DEV_INITRD=3Dy CONFIG_CC_OPTIMIZE_FOR_SIZE=3Dy +CONFIG_SGETMASK_SYSCALL=3Dy CONFIG_EMBEDDED=3Dy CONFIG_OPENRISC_BUILTIN_DTB=3D"or1klitex" +# CONFIG_OPENRISC_HAVE_INST_RORI is not set CONFIG_HZ_100=3Dy +CONFIG_OPENRISC_HAVE_SHADOW_GPRS=3Dy CONFIG_NET=3Dy CONFIG_PACKET=3Dy +CONFIG_PACKET_DIAG=3Dy CONFIG_UNIX=3Dy +CONFIG_UNIX_DIAG=3Dy CONFIG_INET=3Dy +CONFIG_IP_MULTICAST=3Dy +CONFIG_IP_ADVANCED_ROUTER=3Dy +CONFIG_INET_UDP_DIAG=3Dy +CONFIG_INET_RAW_DIAG=3Dy +# CONFIG_WIRELESS is not set +# CONFIG_ETHTOOL_NETLINK is not set CONFIG_DEVTMPFS=3Dy CONFIG_DEVTMPFS_MOUNT=3Dy CONFIG_OF_OVERLAY=3Dy CONFIG_NETDEVICES=3Dy CONFIG_LITEX_LITEETH=3Dy +# CONFIG_WLAN is not set CONFIG_SERIAL_LITEUART=3Dy CONFIG_SERIAL_LITEUART_CONSOLE=3Dy CONFIG_TTY_PRINTK=3Dy +# CONFIG_GPIO_CDEV is not set +CONFIG_MMC=3Dy +CONFIG_MMC_LITEX=3Dy +# CONFIG_VHOST_MENU is not set +# CONFIG_IOMMU_SUPPORT is not set CONFIG_LITEX_SOC_CONTROLLER=3Dy +CONFIG_EXT2_FS=3Dy +CONFIG_EXT3_FS=3Dy +CONFIG_MSDOS_FS=3Dy +CONFIG_VFAT_FS=3Dy +CONFIG_EXFAT_FS=3Dy CONFIG_TMPFS=3Dy +CONFIG_NFS_FS=3Dy +CONFIG_NFS_V3_ACL=3Dy +CONFIG_NFS_V4=3Dy +CONFIG_NLS_CODEPAGE_437=3Dy +CONFIG_NLS_ISO8859_1=3Dy +CONFIG_LSM=3D"lockdown,yama,loadpin,safesetid,integrity,bpf" CONFIG_PRINTK_TIME=3Dy CONFIG_PANIC_ON_OOPS=3Dy CONFIG_SOFTLOCKUP_DETECTOR=3Dy --=20 2.31.1 From nobody Thu May 7 23:11:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF574C433EF for ; Tue, 17 May 2022 00:58:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237204AbiEQA6B (ORCPT ); Mon, 16 May 2022 20:58:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237143AbiEQAzy (ORCPT ); Mon, 16 May 2022 20:55:54 -0400 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E1D91408B for ; Mon, 16 May 2022 17:55:50 -0700 (PDT) Received: by mail-pj1-x1032.google.com with SMTP id x23-20020a17090a789700b001df763d4ed0so1059549pjk.0 for ; Mon, 16 May 2022 17:55:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ikZ+PR/EklJmOrxEmrNGimc9Z26aJRLTxGu7euJ5K94=; b=lolJi/grF0XlxD0r+TbFled81nc41kCjirhMSf0FXwqJhgcA8wkMXF7orqRsYZ4O8K HGYSFBCi8BY43TfxB2xjssMePXmxTLaSehRbu64Z9Osgx/XCY0VqetZzjwV5MiOlVfOY JgOqIIahzEqUFFqnxRATc+KX0bd4/2F0mGu1iu9jOpImzUOhHcTquEk2rrPwb/uDFN5C V3w+3hYVC4/yqYcG/G/AI0HThbrMZlky4kg0uIDDYfun/gSr1lY/xw3U/sjDm7M7O1JH 29ctNIXRq6FYVn3IxBOqGVS6RlE2PPiP6VuUVXvvcnOf1y0Nr07UYEGMKjQ0qVhFwaNc +2mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ikZ+PR/EklJmOrxEmrNGimc9Z26aJRLTxGu7euJ5K94=; b=Ilcl90R8VGYY+glp5hNQOg51oypoCcjn18u918UHzRB3UJgUWuqTB2Rgxc498vBUsq gdnuEyWC+PKmu7Kb2BJ7F5Gg5q9p0qze0KU7aNFMkITKGw/nHpUBVvUu1CNsHPkI9Igw ahASjYQlqn4Jfvakzoh1b2xYMMjLzBdAVpO5h6qeADYcajIFO1A3X799ikjeSq0Gjtsz fvugEHBFXRJw9NP/8v7KghmZsoHA2v7M426UJLPMxxDwRgFkNhBF+/bRjpFD9Gho7jpE n+bKvxHIgAAWJJLQFwSXYXWc+J75mgZY1mQjGzOPr4xgqmAYUX07Xxc7/73Qo5yTZCC8 HA8Q== X-Gm-Message-State: AOAM530dGtQtE89XA24MAmYSAPyds97Xm6KIl5haRgHVlrUbpwCN/F1C HX/BsLnkkqZVRFh8kkp8crMOY8z7J/zdfg== X-Google-Smtp-Source: ABdhPJzHJQEjBCfKJWcGHDyr9TTDGKtZomcGfjSzIvd4OX6WWrNI7QdR0unRWlq3+NmORDe+a0HdLg== X-Received: by 2002:a17:902:d191:b0:161:5c4f:ce9e with SMTP id m17-20020a170902d19100b001615c4fce9emr11941745plb.159.1652748948956; Mon, 16 May 2022 17:55:48 -0700 (PDT) Received: from localhost ([2409:10:24a0:4700:e8ad:216a:2a9d:6d0c]) by smtp.gmail.com with ESMTPSA id 13-20020a630e4d000000b003c14af50626sm7084057pgo.62.2022.05.16.17.55.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 May 2022 17:55:48 -0700 (PDT) From: Stafford Horne To: LKML Cc: Openrisc , Stafford Horne , Jonas Bonn , Stefan Kristiansson , "Eric W. Biederman" , Andrew Morton , "Russell King (Oracle)" , Michael Ellerman , Kefeng Wang Subject: [PATCH v2 07/13] openrisc/traps: Declare file scope symbols as static Date: Tue, 17 May 2022 09:55:04 +0900 Message-Id: <20220517005510.3500105-8-shorne@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220517005510.3500105-1-shorne@gmail.com> References: <20220517005510.3500105-1-shorne@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Sparse was reporting the following warnings: arch/openrisc/kernel/traps.c:37:5: warning: symbol 'kstack_depth_to_pri= nt' was not declared. Should it be static? arch/openrisc/kernel/traps.c:39:22: warning: symbol 'lwa_addr' was not = declared. Should it be static? arch/openrisc/kernel/traps.c:41:6: warning: symbol 'print_trace' was no= t declared. Should it be static? The function print_trace and local variables kstack_depth_to_print and lwa_addr are not used outside of this file. This patch marks them as static. Signed-off-by: Stafford Horne --- arch/openrisc/kernel/traps.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/openrisc/kernel/traps.c b/arch/openrisc/kernel/traps.c index f2478bba77b9..9e0937eb31ca 100644 --- a/arch/openrisc/kernel/traps.c +++ b/arch/openrisc/kernel/traps.c @@ -34,11 +34,11 @@ #include #include =20 -int kstack_depth_to_print =3D 0x180; +static int kstack_depth_to_print =3D 0x180; int lwa_flag; -unsigned long __user *lwa_addr; +static unsigned long __user *lwa_addr; =20 -void print_trace(void *data, unsigned long addr, int reliable) +static void print_trace(void *data, unsigned long addr, int reliable) { const char *loglvl =3D data; =20 --=20 2.31.1 From nobody Thu May 7 23:11:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F551C433F5 for ; Tue, 17 May 2022 00:56:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238984AbiEQA4a (ORCPT ); Mon, 16 May 2022 20:56:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238390AbiEQAzz (ORCPT ); Mon, 16 May 2022 20:55:55 -0400 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2080B1FCCE for ; Mon, 16 May 2022 17:55:53 -0700 (PDT) Received: by mail-pj1-x102b.google.com with SMTP id ev18so5357878pjb.4 for ; Mon, 16 May 2022 17:55:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/YxdBnzui3ni5Jh3oFs5foUUYY4daAUO1PEkpPdCqlo=; b=WHGy/FigKtpjnR0C/zvZzZKw82dDIx9z+0NO4/b1iqKaQ/L6icwl70tjS+vHAAlnKj TVt4JbXCTMQUOyaPvfYy4bIrT86YM0bKZT+chnoq6SJX7+2OhqLV/YUXuXJVuvVDxzJA h14DGve6uUkDhDNUXn8tD7mOT4nCvcP4EKHCdrp8yyhFQGYRTS/sKYQtN66O4GzzyQHx kGFltFCl5MTjCJjEd2YCa8rZTffpg9XoX2bdzfCXAM+MysAZH+jgmnUzJVPXyGxeC25K PN11R+jIzWdIZLs64/9MshIAogvSw8aVUiH0E0quNX/Eqewn5/qXV+4+0QqgJwc9bPwe YdRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/YxdBnzui3ni5Jh3oFs5foUUYY4daAUO1PEkpPdCqlo=; b=7W2Fq0qk1wTFzColS1ad0QDNZP4fWamjCKjRFc6xCw72B5gGg3WZGoZES/lgzCEj9D 1lpj+cWLjj1iI5gawN1BEfbplqwwp6RLydKJvoNpXdNULHS9H8FhwFKFiEs6da88RBFa Q0idsKxSpow00/1hgwdo2iF6cBre/eydn2bRKCh6B3l5hHL4vDQNSpqtds0K4qEqrfU6 ruQvr19ApiesKv+dryCbzfGl7fPvpEo2itCfAzERavFY/3mXcaNyIIxwSGHHSdRpHECX j3ELdFjU2vOF/kkZDhfZRhvtwa+MRxXYJUpL/0iME9NywdJaDAgCJlAqx+cuED/TCXyd RkDA== X-Gm-Message-State: AOAM530EqNZYjeXgyWD1Robe9swc1nPm6RGuoQRp+Cgo5ATslI1izNBf v97+QugRhfxIdIzGTT/la4O8o4Qchxc7nA== X-Google-Smtp-Source: ABdhPJy5VHtPWLlYSrYw1gcfTPLMW48qsnQGgyFXX1YLRyLH78izI4koIEmJWPPcAq4bBJMclmC/6w== X-Received: by 2002:a17:902:cec9:b0:15e:cbf4:c246 with SMTP id d9-20020a170902cec900b0015ecbf4c246mr19899475plg.1.1652748952205; Mon, 16 May 2022 17:55:52 -0700 (PDT) Received: from localhost ([2409:10:24a0:4700:e8ad:216a:2a9d:6d0c]) by smtp.gmail.com with ESMTPSA id n16-20020a6563d0000000b003c14af50607sm7243875pgv.31.2022.05.16.17.55.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 May 2022 17:55:51 -0700 (PDT) From: Stafford Horne To: LKML Cc: Openrisc , Stafford Horne , Jonas Bonn , Stefan Kristiansson , "Eric W. Biederman" , "Russell King (Oracle)" , Andrew Morton , Michael Ellerman , Kefeng Wang Subject: [PATCH v2 08/13] openrisc/traps: Remove die_if_kernel function Date: Tue, 17 May 2022 09:55:05 +0900 Message-Id: <20220517005510.3500105-9-shorne@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220517005510.3500105-1-shorne@gmail.com> References: <20220517005510.3500105-1-shorne@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" This was noticed when I saw this warning: arch/openrisc/kernel/traps.c:234:6: warning: no previous prototype for = 'die_if_kernel' [-Wmissing-prototypes] 234 | void die_if_kernel(const char *str, struct pt_regs *regs, long = err) | ^~~~~~~~~~~~~ The die_if_kernel function is not used in the OpenRISC port so remove it. Signed-off-by: Stafford Horne --- arch/openrisc/kernel/traps.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/arch/openrisc/kernel/traps.c b/arch/openrisc/kernel/traps.c index 9e0937eb31ca..99cd2e6f8873 100644 --- a/arch/openrisc/kernel/traps.c +++ b/arch/openrisc/kernel/traps.c @@ -235,15 +235,6 @@ void __noreturn die(const char *str, struct pt_regs *r= egs, long err) make_task_dead(SIGSEGV); } =20 -/* This is normally the 'Oops' routine */ -void die_if_kernel(const char *str, struct pt_regs *regs, long err) -{ - if (user_mode(regs)) - return; - - die(str, regs, err); -} - void unhandled_exception(struct pt_regs *regs, int ea, int vector) { printk("Unable to handle exception at EA =3D0x%x, vector 0x%x", --=20 2.31.1 From nobody Thu May 7 23:11:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7456C433F5 for ; Tue, 17 May 2022 00:56:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241355AbiEQA4d (ORCPT ); Mon, 16 May 2022 20:56:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240239AbiEQAz5 (ORCPT ); Mon, 16 May 2022 20:55:57 -0400 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E6DC1FCF3 for ; Mon, 16 May 2022 17:55:56 -0700 (PDT) Received: by mail-pf1-x42f.google.com with SMTP id d25so15515140pfo.10 for ; Mon, 16 May 2022 17:55:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=g7Q4DIyBFdkOfQfLesIacT6b2x85qOReA4ewSFpfUcU=; b=AnNSio8MU8aUblNXEC6S4jK102eG0to3VFxQn44aaTWb7YYxMIy3IC2pxI6oGsCEv/ prVQiRYxTAXz5CWqYRWwLD1UyzwbeLyMA7k41CMiUytHJxV1vWIcIU9OXoisq+xIYtEz ZZ40h5vhDJDee6DUxobLBTpJ40faCf6VkijDsL7m6n4jJrLw/fqrbkX1FWCAYg6/3nql /9s/Ev0caf5hUMN6GxE272facYSz/9WECpBRJQgDWCZWuiSgOXhs2hCTUmZmWf76Wmo/ /VLXww8BL3cFQ/LZ+g5aKO8dSFs1vz7zpjLPeEpD2DOXHfcCfKIkv9LM42wt0mNc99/7 BYoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=g7Q4DIyBFdkOfQfLesIacT6b2x85qOReA4ewSFpfUcU=; b=tKUlD5HyDS8yb/RBF5fUF+z2D/kWRsnop1PZUQvK3TET3YcaiN3kshoQgUQMb16uIB df4xXqYrkmNIBxfZ8mGt3RA1xtRyHiogsD2FzA3Y5fmhFz8UCjQPNFXwGD2vCb3v/TqT NdQ3upn3JeOEakuoMRyuxewE20V14kYIkQ1bjFjG706+4K/J05oq9F3/J3YzYjddTXZh lssXywLjRM9x25Kz3HZAuuT8o6lWhzWqZDwqj96qQKHaaPW+BrTvy9SEHt3aYxtCXRao ImlrtHQHgAdtfHOA+upjXpzTWQ0ID6p+c1Z1zrgyobjoTcpzC+jGkxbMUVokumqU9tFT ZMdQ== X-Gm-Message-State: AOAM530j291NXdk65tvc6UjMwzw2ZK7jJtX3AkzZJgNFdmawgnwT7c/c ahoXO8JOqISTIl0rnN+LECO4psKO8dmn9A== X-Google-Smtp-Source: ABdhPJwXcbp6DdwNTKzzohdiQOrQn3fCObLXri0C6XjchRPG/DsjUK2H3PNGpGQM9dNxEwAkvo+dkw== X-Received: by 2002:a63:2321:0:b0:3da:f4b9:90e with SMTP id j33-20020a632321000000b003daf4b9090emr17804892pgj.31.1652748955611; Mon, 16 May 2022 17:55:55 -0700 (PDT) Received: from localhost ([2409:10:24a0:4700:e8ad:216a:2a9d:6d0c]) by smtp.gmail.com with ESMTPSA id gd8-20020a17090b0fc800b001d9780b7779sm293643pjb.15.2022.05.16.17.55.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 May 2022 17:55:54 -0700 (PDT) From: Stafford Horne To: LKML Cc: Openrisc , Stafford Horne , Jonas Bonn , Stefan Kristiansson , "Eric W. Biederman" , Michael Ellerman , "Russell King (Oracle)" , Kefeng Wang Subject: [PATCH v2 09/13] openrisc/traps: Declare unhandled_exception for asmlinkage Date: Tue, 17 May 2022 09:55:06 +0900 Message-Id: <20220517005510.3500105-10-shorne@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220517005510.3500105-1-shorne@gmail.com> References: <20220517005510.3500105-1-shorne@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Noticed this when workin on warnings. As unhandled_exception is used in entry.S we should attribute it with asmlinkage. Signed-off-by: Stafford Horne --- arch/openrisc/kernel/traps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/openrisc/kernel/traps.c b/arch/openrisc/kernel/traps.c index 99cd2e6f8873..fd9a0f2b66c4 100644 --- a/arch/openrisc/kernel/traps.c +++ b/arch/openrisc/kernel/traps.c @@ -235,7 +235,7 @@ void __noreturn die(const char *str, struct pt_regs *re= gs, long err) make_task_dead(SIGSEGV); } =20 -void unhandled_exception(struct pt_regs *regs, int ea, int vector) +asmlinkage void unhandled_exception(struct pt_regs *regs, int ea, int vect= or) { printk("Unable to handle exception at EA =3D0x%x, vector 0x%x", ea, vector); --=20 2.31.1 From nobody Thu May 7 23:11:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3152FC433EF for ; Tue, 17 May 2022 00:58:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239487AbiEQA6F (ORCPT ); Mon, 16 May 2022 20:58:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239837AbiEQA4A (ORCPT ); Mon, 16 May 2022 20:56:00 -0400 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C86CE201A6 for ; Mon, 16 May 2022 17:55:59 -0700 (PDT) Received: by mail-pl1-x62e.google.com with SMTP id q4so15980683plr.11 for ; Mon, 16 May 2022 17:55:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JuZm0iyeNXKvBw7CRNXXxjER+lmIsZfs9nGcE1KNIMA=; b=H5MdmlFKJmCnyxJIjM/qpwTxPaW0iw9pGgyPhqb86vIvFdIh9MsqnbGRdbo3jl3DD1 NZN0aiW77lj3kr3NKdkj4BPOdHAU/UPyX/6yZIrzwOxS54MnqkBsCqlB9WP06jWpjRKH m72bcJwu6Ybfqm+nkmSy/X7omkA497/BL3qqkBDNks8sOGs5dx4iXkYFEcNLrjByTLJo QLuP6rY2ypxJZSFaiaqB4i7xxnDSVXrNwXFBd++H697yAHCrtvVNnax0Mo0KofZm06co 4k7PzeBN94R4jk21clzsMW07xHsrjYvmkSSiFrwl5uSuGe6TzUsJPulniHg1JJ9LPoQ3 YyYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JuZm0iyeNXKvBw7CRNXXxjER+lmIsZfs9nGcE1KNIMA=; b=7CFPH51ru3SdQdKFeyZBlTmzyLMy6TOhQsOGVqQ89LF16hUhLfSouJXOQDIx17Nj+9 4CCSvqALDUkCQp9siSQmQfgzLkz3yQotAI8/oY6Imk4ZyeUg3W4+8/IayDEHqh7HLbiL QomuBUl77zXX/f/GVmWI8uVJcH4aOrh36RffJCJ3fZ/471Tl/hQCImk5JkTmr7GXrZN9 m+KImIvoEaAcRJmf72ppDFNryrfuRlKy0CFg+/2UmThriGTDfJiACLCiyg0l88XHPBk3 Bg/iJfQ0KQjq7hAUbShIG6G/A1tR4M35D7V4V+QOU6ePrAjGohbmYeh7AtbhafPiVGBM 59cQ== X-Gm-Message-State: AOAM531aOkxl6p1Vgh4cokb0ZnRWFIZaVo+H2LDPGayQ6oOm5nklpnHx 5RyJs5tW5z23OsPA6Rs1zEeaZeQGoRoZlQ== X-Google-Smtp-Source: ABdhPJyuJHialPFzmk9jCitdBmrkLR09Y4G9IMW9rKIhLzuMTvlJo4x/V3N31o577AIjRUWU+WBkgg== X-Received: by 2002:a17:902:db07:b0:15e:b669:42a2 with SMTP id m7-20020a170902db0700b0015eb66942a2mr19595241plx.80.1652748958849; Mon, 16 May 2022 17:55:58 -0700 (PDT) Received: from localhost ([2409:10:24a0:4700:e8ad:216a:2a9d:6d0c]) by smtp.gmail.com with ESMTPSA id r2-20020a170903020200b0015e8d4eb29asm7582806plh.228.2022.05.16.17.55.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 May 2022 17:55:58 -0700 (PDT) From: Stafford Horne To: LKML Cc: Openrisc , Stafford Horne , Jonas Bonn , Stefan Kristiansson , Geert Uytterhoeven , Randy Dunlap Subject: [PATCH v2 10/13] openrisc/time: Fix symbol scope warnings Date: Tue, 17 May 2022 09:55:07 +0900 Message-Id: <20220517005510.3500105-11-shorne@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220517005510.3500105-1-shorne@gmail.com> References: <20220517005510.3500105-1-shorne@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Spare reported the following warnings: arch/openrisc/kernel/time.c:64:1: warning: symbol 'clockevent_openrisc_= timer' was not declared. Should it be static? arch/openrisc/kernel/time.c:66:6: warning: symbol 'openrisc_clockevent_= init' was not declared. Should it be static? This patch fixes by: - Add static declaration to clockevent_openrisc_timer as it's used only in this file. - Add include for asm/time.h for openrisc_clockevent_init declaration. Signed-off-by: Stafford Horne --- arch/openrisc/kernel/time.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/openrisc/kernel/time.c b/arch/openrisc/kernel/time.c index 6d18989d63d0..8e26c1af5441 100644 --- a/arch/openrisc/kernel/time.c +++ b/arch/openrisc/kernel/time.c @@ -23,6 +23,7 @@ #include =20 #include +#include =20 /* Test the timer ticks to count, used in sync routine */ inline void openrisc_timer_set(unsigned long count) @@ -61,7 +62,7 @@ static int openrisc_timer_set_next_event(unsigned long de= lta, * timers) we cannot enable the PERIODIC feature. The tick timer can run = using * one-shot events, so no problem. */ -DEFINE_PER_CPU(struct clock_event_device, clockevent_openrisc_timer); +static DEFINE_PER_CPU(struct clock_event_device, clockevent_openrisc_timer= ); =20 void openrisc_clockevent_init(void) { --=20 2.31.1 From nobody Thu May 7 23:11:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9DE8CC433F5 for ; Tue, 17 May 2022 00:56:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243400AbiEQA4k (ORCPT ); Mon, 16 May 2022 20:56:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241833AbiEQA4F (ORCPT ); Mon, 16 May 2022 20:56:05 -0400 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 640C11FCFD for ; Mon, 16 May 2022 17:56:03 -0700 (PDT) Received: by mail-pj1-x1029.google.com with SMTP id gg20so5946577pjb.1 for ; Mon, 16 May 2022 17:56:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GLuZhVjtGK5TbXwgi8Odrp2p8Tu7QkWjhdCCk7ovaas=; b=OsySeMMZGq6yomS1KDnoTl6b0LIngdBZ3Omh+Vc/fSzyz+imuzyNrjQmUZczLIhegX +NV8Gfo9Tput/QUY1MVOp/wmL3M55pSmBtD57O8/1JpQp8rGPdCzSmzBC8eK5opvxFJm YnVEuPcnGO9XlQLIge0UeJilt0t25njUQsNYGrybJ/XImbGbZ4O1Yq460hiZQpdk1gs7 Dg1LZ6ZjFxW3MBu/o51RGLacoJcuoZvqs22cA2+nNAoFmpwfLm1tPRiYd/P2qSL4DGm5 MwiIpVEpFohND8ZtgZzd0aJ9oq+EKG7OfDkUAcNtTOnbR3Rpu01HowmUYrrc7HGmdsWs Q57A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GLuZhVjtGK5TbXwgi8Odrp2p8Tu7QkWjhdCCk7ovaas=; b=es1BHpeLLA3ULBfWoupq00+6ptaJyShtZOhUU6UEQ4MLp05XNhDQiXCBz/nKZ87ndB QowNXpQj02rlQOipN6gQth2iKV+JUEIEHlcjiH/ufNpjmjOqpPNvQmcGZiDlj4saI5Nl wsvIK7xMBMSk4OxqK0kAjEx6kekrvPMOHEhmqBeuWz3uCQPilpo1wSQCr16e8HYswBsF quLzHHuXoNeGeYszcDuqJmAMFcANkQm3jkzveuQNKMZwgvmLM0+a9oWNCUJ5RdUmwsp8 daQXpHvXnkA5hRhPNvPIcNz6mZhEXqSQpjPV4t33TJ+4em+7G3zc8s+k6cs8tirTtt/x AxUw== X-Gm-Message-State: AOAM532BUq9WP4eX99m4jEKwcqdEmhq4OqJZZisT+AFap5bwg1U6xoUX TlD6617u9UpVzcr6RdRlzrIepLuYmcr7MA== X-Google-Smtp-Source: ABdhPJyRflxVHHKzD7PI9Xa4kr/OcWekhtakidWl3XVIQlsItD1qwG0ktFMPtDJCote4gDFgvalZqQ== X-Received: by 2002:a17:902:7892:b0:161:61de:eaeb with SMTP id q18-20020a170902789200b0016161deeaebmr10850706pll.132.1652748962201; Mon, 16 May 2022 17:56:02 -0700 (PDT) Received: from localhost ([2409:10:24a0:4700:e8ad:216a:2a9d:6d0c]) by smtp.gmail.com with ESMTPSA id t19-20020a62d153000000b0050dc762815dsm7425197pfl.55.2022.05.16.17.56.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 May 2022 17:56:01 -0700 (PDT) From: Stafford Horne To: LKML Cc: Openrisc , Stafford Horne , Jonas Bonn , Stefan Kristiansson Subject: [PATCH v2 11/13] openrisc/delay: Add include to fix symbol not declared warning Date: Tue, 17 May 2022 09:55:08 +0900 Message-Id: <20220517005510.3500105-12-shorne@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220517005510.3500105-1-shorne@gmail.com> References: <20220517005510.3500105-1-shorne@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Add asm/timex.h include for read_current_timer prototype. Sparse reporting the following warning: arch/openrisc/lib/delay.c:23:5: warning: symbol 'read_current_timer' wa= s not declared. Should it be static? Signed-off-by: Stafford Horne --- arch/openrisc/lib/delay.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/openrisc/lib/delay.c b/arch/openrisc/lib/delay.c index 036ae57180ef..5e89e4131304 100644 --- a/arch/openrisc/lib/delay.c +++ b/arch/openrisc/lib/delay.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include --=20 2.31.1 From nobody Thu May 7 23:11:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87E91C433FE for ; Tue, 17 May 2022 00:58:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240574AbiEQA6O (ORCPT ); Mon, 16 May 2022 20:58:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242491AbiEQA4I (ORCPT ); Mon, 16 May 2022 20:56:08 -0400 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6DE7721246 for ; Mon, 16 May 2022 17:56:06 -0700 (PDT) Received: by mail-pj1-x102a.google.com with SMTP id f10so4082657pjs.3 for ; Mon, 16 May 2022 17:56:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=E6nKYG584PAtoQ8/jvqpBx36KvgGo8qJoQWKQdOpBKU=; b=IIIyXSQJWf8UayE82aTml286GpqPORX9ViI9e/yl8XghTxo/ZP4IGnG0yfs5lmsqZh XAq01FX14zp3kWmuGrRB787zVcW0Xl2iiLvehDKRPIh6vH6lLApEoZfReOfW4GdGGCip i3n+iOtizlgQl+dYG9gSswt+9j5ErccPVhmYyo7iCJC+0rlm2A3kFK/yB6V152fE1p/M OiHfebI9mZGTN86UDz2R0krR4FF6bejrChRfTiWyCP05MNGmysQlsbAm5s/ghHmea3wm eNqeweDIspoMcW9uaocky1EbdAzCujoUwYTRr0daPN1pfrfvathmDgiX0W85H+XFHVfk v/ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=E6nKYG584PAtoQ8/jvqpBx36KvgGo8qJoQWKQdOpBKU=; b=R16TsTSxYlweG2EX+Ub6CRIsmqkCN2SV/lupKlaT2c97Efo8NFjDsvghut3cLVSU9T BlJMlWhL1CjkRskBJnM4z54RQhXWviiISNocyw0aXG9ADVx7dqEcu5V0ud13ST40uvRB eWeO6wc03Joo2ef190OV2KXfkVjrKNukaF/RQaO2qx78Qij3vvFGvB2Nar7/YeWWm4EZ 5hzUDUryOZOPyE5tLXC/JbNh5T7SajO4wD9cR2E6CPoeOpUgXMMIEnd+L+KFx+WqNuNz bAoz9plVQZxAh9fJ3Sg/l5GanhMQ50jdeUrEgeHdjRUYtv91GDcCcja6QVcSK+DKB2il AcIA== X-Gm-Message-State: AOAM5301iTc+prN5PZQ/XNqDeXMY90RjLkZR9DDXPySAu5ukxttA350h eERGdvyKRXJ1kjcjiy+6HL3sTdNAbGExKQ== X-Google-Smtp-Source: ABdhPJzCzap+mCp/6EYXmoaBxWvMCbfqW76N0OCIz6ZiKWNdjx7NhOv3OkFJ2by8dxR+EwgzUmRbjw== X-Received: by 2002:a17:902:a516:b0:15f:309f:7805 with SMTP id s22-20020a170902a51600b0015f309f7805mr20022119plq.114.1652748965506; Mon, 16 May 2022 17:56:05 -0700 (PDT) Received: from localhost ([2409:10:24a0:4700:e8ad:216a:2a9d:6d0c]) by smtp.gmail.com with ESMTPSA id k1-20020a17090ad08100b001df501391efsm273548pju.53.2022.05.16.17.56.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 May 2022 17:56:04 -0700 (PDT) From: Stafford Horne To: LKML Cc: Openrisc , Stafford Horne , Jonas Bonn , Stefan Kristiansson , "Eric W. Biederman" , Andrew Morton , Randy Dunlap , Qi Zheng Subject: [PATCH v2 12/13] openrisc/fault: Fix symbol scope warnings Date: Tue, 17 May 2022 09:55:09 +0900 Message-Id: <20220517005510.3500105-13-shorne@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220517005510.3500105-1-shorne@gmail.com> References: <20220517005510.3500105-1-shorne@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Sparse reported the following warning: arch/openrisc/mm/fault.c:27:15: warning: symbol 'pte_misses' was not de= clared. Should it be static? arch/openrisc/mm/fault.c:28:15: warning: symbol 'pte_errors' was not de= clared. Should it be static? arch/openrisc/mm/fault.c:33:16: warning: symbol 'current_pgd' was not d= eclared. Should it be static? This patch fixes these by: - Remove unused pte_misses and pte_errors counters which are no longer used. - Add asm/mmu_context.h include to provide the current_pgd declaration. Signed-off-by: Stafford Horne --- arch/openrisc/mm/fault.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/arch/openrisc/mm/fault.c b/arch/openrisc/mm/fault.c index 80bb66ad42f6..516cba14dec9 100644 --- a/arch/openrisc/mm/fault.c +++ b/arch/openrisc/mm/fault.c @@ -18,15 +18,13 @@ #include =20 #include +#include #include #include =20 #define NUM_TLB_ENTRIES 64 #define TLB_OFFSET(add) (((add) >> PAGE_SHIFT) & (NUM_TLB_ENTRIES-1)) =20 -unsigned long pte_misses; /* updated by do_page_fault() */ -unsigned long pte_errors; /* updated by do_page_fault() */ - /* __PHX__ :: - check the vmalloc_fault in do_page_fault() * - also look into include/asm/mmu_context.h */ --=20 2.31.1 From nobody Thu May 7 23:11:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 662FCC433F5 for ; Tue, 17 May 2022 00:56:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242764AbiEQA4s (ORCPT ); Mon, 16 May 2022 20:56:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243107AbiEQA4N (ORCPT ); Mon, 16 May 2022 20:56:13 -0400 Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3FD521834 for ; Mon, 16 May 2022 17:56:09 -0700 (PDT) Received: by mail-pg1-x52e.google.com with SMTP id h186so12972193pgc.3 for ; Mon, 16 May 2022 17:56:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YyxbfrF93QriCFR9e9/Ieq2jTtQBkK6LoG1jr7zyJxk=; b=oCAMl1DsQ3OB64WTGBzI6nY/tqFRzPvF50jEnkNYVq85ORdMBGfWYreKS5Th/RLfdF OH3OoRASSBEmOtBkGh2q/+xrz7Va/cq9uFCA12vne/Nj4eptouLiTNYPt4dxxiG+eZry e+uFALuiN8eQAmSZVy+L22wMIn3vP2quo87T3x3vJ3xZ7uy0RoyXsB51t0mkyGshPmWI QMKfF9mWSf7o2kmAtzyB30dJL+dNkOuFg8+QcGubMpCViLxzZrfz05Dxc6UWLsdO4ppK TkEtLCBaa6X5EXDFistYnYs2lx4xX/H/PinuowyMWEsSODnzH+DfM+N4jiIQriHI2e+Q qMDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YyxbfrF93QriCFR9e9/Ieq2jTtQBkK6LoG1jr7zyJxk=; b=7AHm3/F5z3xwRHHM5usb2hoEp6epRvoWoUgybZIMXj69F303mOwCnixzul0FKv/B6y NTTJ1r6DKP3IbHCJZRotNhHt/5I1vYFpT1+K4sFHa8RCjgl6AS0J9RuEHp7CIsNcbOad Ogws9tvJXGT3bp2qAAFkZTtx+7iIpc2AauTgw3aN5KdllT6OMDROZSOxH5OqIzF/ThS9 y9a3PhMFFm+G+OvYhgxYN/N7yo4IDj02gEVrOx1K9zofFWpbmb+y74x1edKjDB3joG58 a93pQPH0lF+bp5opRopJX3XeFTLWEiYvZJfnbzn1rHhzzU4J8WYK8yagfRHNZdvYUcxd J/pg== X-Gm-Message-State: AOAM533Pviyh/nIr6N9P5wmrygB3M1qZpbUwf/7EIVeIjHqvpBh5n8lt WMSNZ+mxX/XGs4uoQrCp3REKB4ldcu8= X-Google-Smtp-Source: ABdhPJzWupGGZ1FqSFLiIMHuDJPPH9C1E94cICFIkU9GYZO5qupsuiir0HalN6xqjCJRIW5P713vHw== X-Received: by 2002:a05:6a00:ac1:b0:4f1:29e4:b3a1 with SMTP id c1-20020a056a000ac100b004f129e4b3a1mr20055546pfl.63.1652748968794; Mon, 16 May 2022 17:56:08 -0700 (PDT) Received: from localhost ([2409:10:24a0:4700:e8ad:216a:2a9d:6d0c]) by smtp.gmail.com with ESMTPSA id x21-20020a1709027c1500b0015e8d4eb29csm7586085pll.230.2022.05.16.17.56.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 May 2022 17:56:08 -0700 (PDT) From: Stafford Horne To: LKML Cc: Openrisc , Stafford Horne , Jonas Bonn , Stefan Kristiansson , Randy Dunlap Subject: [PATCH v2 13/13] openrisc: Remove unused IMMU tlb workardound Date: Tue, 17 May 2022 09:55:10 +0900 Message-Id: <20220517005510.3500105-14-shorne@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220517005510.3500105-1-shorne@gmail.com> References: <20220517005510.3500105-1-shorne@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" This looks to be some historical code that was used to convert TLB misses on branches from l.bf, l.jal, l.j etc all to a trampoline using l.jr (jump register). I don't see this being used and I don't know the history of it so remove it. Signed-off-by: Stafford Horne --- arch/openrisc/kernel/head.S | 209 ------------------------------------ 1 file changed, 209 deletions(-) diff --git a/arch/openrisc/kernel/head.S b/arch/openrisc/kernel/head.S index 21db50563f97..9b59d0ca665c 100644 --- a/arch/openrisc/kernel/head.S +++ b/arch/openrisc/kernel/head.S @@ -1325,215 +1325,6 @@ i_pte_not_present: =20 /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D[ debugging aids ]=3D=3D=3D */ =20 - .align 64 -_immu_trampoline: - .space 64 -_immu_trampoline_top: - -#define TRAMP_SLOT_0 (0x0) -#define TRAMP_SLOT_1 (0x4) -#define TRAMP_SLOT_2 (0x8) -#define TRAMP_SLOT_3 (0xc) -#define TRAMP_SLOT_4 (0x10) -#define TRAMP_SLOT_5 (0x14) -#define TRAMP_FRAME_SIZE (0x18) - -ENTRY(_immu_trampoline_workaround) - // r2 EEA - // r6 is physical EEA - tophys(r6,r2) - - LOAD_SYMBOL_2_GPR(r5,_immu_trampoline) - tophys (r3,r5) // r3 is trampoline (physical) - - LOAD_SYMBOL_2_GPR(r4,0x15000000) - l.sw TRAMP_SLOT_0(r3),r4 - l.sw TRAMP_SLOT_1(r3),r4 - l.sw TRAMP_SLOT_4(r3),r4 - l.sw TRAMP_SLOT_5(r3),r4 - - // EPC =3D EEA - 0x4 - l.lwz r4,0x0(r6) // load op @ EEA + 0x0 (fc address) - l.sw TRAMP_SLOT_3(r3),r4 // store it to _immu_trampoline_data - l.lwz r4,-0x4(r6) // load op @ EEA - 0x4 (f8 address) - l.sw TRAMP_SLOT_2(r3),r4 // store it to _immu_trampoline_data - - l.srli r5,r4,26 // check opcode for write access - l.sfeqi r5,0 // l.j - l.bf 0f - l.sfeqi r5,0x11 // l.jr - l.bf 1f - l.sfeqi r5,1 // l.jal - l.bf 2f - l.sfeqi r5,0x12 // l.jalr - l.bf 3f - l.sfeqi r5,3 // l.bnf - l.bf 4f - l.sfeqi r5,4 // l.bf - l.bf 5f -99: - l.nop - l.j 99b // should never happen - l.nop 1 - - // r2 is EEA - // r3 is trampoline address (physical) - // r4 is instruction - // r6 is physical(EEA) - // - // r5 - -2: // l.jal - - /* 19 20 aa aa l.movhi r9,0xaaaa - * a9 29 bb bb l.ori r9,0xbbbb - * - * where 0xaaaabbbb is EEA + 0x4 shifted right 2 - */ - - l.addi r6,r2,0x4 // this is 0xaaaabbbb - - // l.movhi r9,0xaaaa - l.ori r5,r0,0x1920 // 0x1920 =3D=3D l.movhi r9 - l.sh (TRAMP_SLOT_0+0x0)(r3),r5 - l.srli r5,r6,16 - l.sh (TRAMP_SLOT_0+0x2)(r3),r5 - - // l.ori r9,0xbbbb - l.ori r5,r0,0xa929 // 0xa929 =3D=3D l.ori r9 - l.sh (TRAMP_SLOT_1+0x0)(r3),r5 - l.andi r5,r6,0xffff - l.sh (TRAMP_SLOT_1+0x2)(r3),r5 - - /* falthrough, need to set up new jump offset */ - - -0: // l.j - l.slli r6,r4,6 // original offset shifted left 6 - 2 -// l.srli r6,r6,6 // original offset shifted right 2 - - l.slli r4,r2,4 // old jump position: EEA shifted left 4 -// l.srli r4,r4,6 // old jump position: shifted right 2 - - l.addi r5,r3,0xc // new jump position (physical) - l.slli r5,r5,4 // new jump position: shifted left 4 - - // calculate new jump offset - // new_off =3D old_off + (old_jump - new_jump) - - l.sub r5,r4,r5 // old_jump - new_jump - l.add r5,r6,r5 // orig_off + (old_jump - new_jump) - l.srli r5,r5,6 // new offset shifted right 2 - - // r5 is new jump offset - // l.j has opcode 0x0... - l.sw TRAMP_SLOT_2(r3),r5 // write it back - - l.j trampoline_out - l.nop - -/* ----------------------------- */ - -3: // l.jalr - - /* 19 20 aa aa l.movhi r9,0xaaaa - * a9 29 bb bb l.ori r9,0xbbbb - * - * where 0xaaaabbbb is EEA + 0x4 shifted right 2 - */ - - l.addi r6,r2,0x4 // this is 0xaaaabbbb - - // l.movhi r9,0xaaaa - l.ori r5,r0,0x1920 // 0x1920 =3D=3D l.movhi r9 - l.sh (TRAMP_SLOT_0+0x0)(r3),r5 - l.srli r5,r6,16 - l.sh (TRAMP_SLOT_0+0x2)(r3),r5 - - // l.ori r9,0xbbbb - l.ori r5,r0,0xa929 // 0xa929 =3D=3D l.ori r9 - l.sh (TRAMP_SLOT_1+0x0)(r3),r5 - l.andi r5,r6,0xffff - l.sh (TRAMP_SLOT_1+0x2)(r3),r5 - - l.lhz r5,(TRAMP_SLOT_2+0x0)(r3) // load hi part of jump instruction - l.andi r5,r5,0x3ff // clear out opcode part - l.ori r5,r5,0x4400 // opcode changed from l.jalr -> l.jr - l.sh (TRAMP_SLOT_2+0x0)(r3),r5 // write it back - - /* falthrough */ - -1: // l.jr - l.j trampoline_out - l.nop - -/* ----------------------------- */ - -4: // l.bnf -5: // l.bf - l.slli r6,r4,6 // original offset shifted left 6 - 2 -// l.srli r6,r6,6 // original offset shifted right 2 - - l.slli r4,r2,4 // old jump position: EEA shifted left 4 -// l.srli r4,r4,6 // old jump position: shifted right 2 - - l.addi r5,r3,0xc // new jump position (physical) - l.slli r5,r5,4 // new jump position: shifted left 4 - - // calculate new jump offset - // new_off =3D old_off + (old_jump - new_jump) - - l.add r6,r6,r4 // (orig_off + old_jump) - l.sub r6,r6,r5 // (orig_off + old_jump) - new_jump - l.srli r6,r6,6 // new offset shifted right 2 - - // r6 is new jump offset - l.lwz r4,(TRAMP_SLOT_2+0x0)(r3) // load jump instruction - l.srli r4,r4,16 - l.andi r4,r4,0xfc00 // get opcode part - l.slli r4,r4,16 - l.or r6,r4,r6 // l.b(n)f new offset - l.sw TRAMP_SLOT_2(r3),r6 // write it back - - /* we need to add l.j to EEA + 0x8 */ - tophys (r4,r2) // may not be needed (due to shifts down_ - l.addi r4,r4,(0x8 - 0x8) // jump target =3D r2 + 0x8 (compensate for 0x8) - // jump position =3D r5 + 0x8 (0x8 compensated) - l.sub r4,r4,r5 // jump offset =3D target - new_position + 0x8 - - l.slli r4,r4,4 // the amount of info in imediate of jump - l.srli r4,r4,6 // jump instruction with offset - l.sw TRAMP_SLOT_4(r3),r4 // write it to 4th slot - - /* fallthrough */ - -trampoline_out: - // set up new EPC to point to our trampoline code - LOAD_SYMBOL_2_GPR(r5,_immu_trampoline) - l.mtspr r0,r5,SPR_EPCR_BASE - - // immu_trampoline is (4x) CACHE_LINE aligned - // and only 6 instructions long, - // so we need to invalidate only 2 lines - - /* Establish cache block size - If BS=3D0, 16; - If BS=3D1, 32; - r14 contain block size - */ - l.mfspr r21,r0,SPR_ICCFGR - l.andi r21,r21,SPR_ICCFGR_CBS - l.srli r21,r21,7 - l.ori r23,r0,16 - l.sll r14,r23,r21 - - l.mtspr r0,r5,SPR_ICBIR - l.add r5,r5,r14 - l.mtspr r0,r5,SPR_ICBIR - - l.jr r9 - l.nop - /* * DESC: Prints ASCII character stored in r7 * --=20 2.31.1