From patchwork Fri Apr 12 14:39:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10898493 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 34FB014DB for ; Fri, 12 Apr 2019 14:40:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1247A28E6D for ; Fri, 12 Apr 2019 14:40:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F269228E72; Fri, 12 Apr 2019 14:40:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A877728E6E for ; Fri, 12 Apr 2019 14:40:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6zuASv/3HE/+/840W7lITryFTsdlQX03J4jk0uwkSas=; b=TWYDJ04HAS3wOI qiQ6P0wB3ez4MHMIQMWNocG4r6AvicBTyKT2pVjx8xeosf64BMbhCjFLyU3hsybkJ2c0cOk00Xl67 nVikoK14PobN1GhdgtL1dHrJmxLcL3idChdBmZNAgdj/l/JV1KJKY9/B80yRluWJI7LasPrfIg8zc FqN7aBRJFWlTimNtWaH/NnJHwm5OwAZWIJ47Z/YPeFb/4lxLo4yjHRi9BVDhpkImAT5rvs6p+1RJ7 BrEal6R0YTjIySzT/uoX5aanFcRAIxjFmuLPq2f83ujXyAnxes+KdXTTPfaiDnq1g4VJXvfAe0Naw D7AZP3Q9wgYuxU11jMew==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hExLm-00013k-2U; Fri, 12 Apr 2019 14:40:18 +0000 Received: from 089144214194.atnat0023.highway.a1.net ([89.144.214.194] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hExLi-0000bj-PQ; Fri, 12 Apr 2019 14:40:15 +0000 From: Christoph Hellwig To: Palmer Dabbelt Subject: [PATCH 01/12] riscv: use asm-generic/extable.h Date: Fri, 12 Apr 2019 16:39:37 +0200 Message-Id: <20190412143948.12478-2-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190412143948.12478-1-hch@lst.de> References: <20190412143948.12478-1-hch@lst.de> MIME-Version: 1.0 X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nick Kossifidis , Atish Patra , linux-riscv@lists.infradead.org Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Christoph Hellwig --- arch/riscv/include/asm/Kbuild | 1 + arch/riscv/include/asm/uaccess.h | 7 +------ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/arch/riscv/include/asm/Kbuild b/arch/riscv/include/asm/Kbuild index cccd12cf27d4..5a7a19d9aa7f 100644 --- a/arch/riscv/include/asm/Kbuild +++ b/arch/riscv/include/asm/Kbuild @@ -4,6 +4,7 @@ generic-y += compat.h generic-y += cputime.h generic-y += device.h generic-y += div64.h +generic-y += extable.h generic-y += dma.h generic-y += dma-contiguous.h generic-y += dma-mapping.h diff --git a/arch/riscv/include/asm/uaccess.h b/arch/riscv/include/asm/uaccess.h index fb53a8089e76..cc5b253d4c57 100644 --- a/arch/riscv/include/asm/uaccess.h +++ b/arch/riscv/include/asm/uaccess.h @@ -23,6 +23,7 @@ #include #include #include +#include #include #define __enable_user_access() \ @@ -98,12 +99,6 @@ static inline int __access_ok(unsigned long addr, unsigned long size) * on our cache or tlb entries. */ -struct exception_table_entry { - unsigned long insn, fixup; -}; - -extern int fixup_exception(struct pt_regs *state); - #if defined(__LITTLE_ENDIAN) #define __MSW 1 #define __LSW 0 From patchwork Fri Apr 12 14:39:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10898495 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D1F301515 for ; Fri, 12 Apr 2019 14:40:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AEE5028E74 for ; Fri, 12 Apr 2019 14:40:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A359228E78; Fri, 12 Apr 2019 14:40:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 50EB828E74 for ; Fri, 12 Apr 2019 14:40:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=l6rNcQQI5NVd6s4gElboq/LzSrsrbSPu3bVzfsEszIo=; b=ks0hxjrpXlVtdu CvlJpMGcbcWaDo8hWeyUInUxOMQ8qpkYL+f1egWJ9uIRtmUxNaAAJ7vT095Iu9sqNdfuejIQ7K5ua jtvtwwpWRCEi4auv+OtJHimLba5rr1zuAXEFB7AGNflUxBDr4igeUTboz0DCym7SF37NZO9hRj/LM pywZTyiPXC84JkFFR0VcUZUXPBEko06hJkuce48rCxLcKDFn8XplKF0aDcMuw9kX0/LAXu7Wa3N4b jsXlBHRjeX+C+xDyrs54DGkjfQd/Mn9eQ02RgfNHi6o0+6tLcKeUHpokaRql92hcVbvu0bTFdO30q heELg4plT+qvXIqHUSEQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hExLp-00017H-2Y; Fri, 12 Apr 2019 14:40:21 +0000 Received: from 089144214194.atnat0023.highway.a1.net ([89.144.214.194] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hExLl-0000ys-Rr; Fri, 12 Apr 2019 14:40:18 +0000 From: Christoph Hellwig To: Palmer Dabbelt Subject: [PATCH 02/12] riscv: turn mm_segment_t into a struct Date: Fri, 12 Apr 2019 16:39:38 +0200 Message-Id: <20190412143948.12478-3-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190412143948.12478-1-hch@lst.de> References: <20190412143948.12478-1-hch@lst.de> MIME-Version: 1.0 X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nick Kossifidis , Atish Patra , linux-riscv@lists.infradead.org Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This matches what other heavily used architectures do, and will allow us to easily use for the nommu case. Signed-off-by: Christoph Hellwig --- arch/riscv/include/asm/thread_info.h | 4 +++- arch/riscv/include/asm/uaccess.h | 12 +++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/arch/riscv/include/asm/thread_info.h b/arch/riscv/include/asm/thread_info.h index 1c9cc8389928..9c039870019b 100644 --- a/arch/riscv/include/asm/thread_info.h +++ b/arch/riscv/include/asm/thread_info.h @@ -28,7 +28,9 @@ #include #include -typedef unsigned long mm_segment_t; +typedef struct { + unsigned long seg; +} mm_segment_t; /* * low level task data that entry.S needs immediate access to diff --git a/arch/riscv/include/asm/uaccess.h b/arch/riscv/include/asm/uaccess.h index cc5b253d4c57..c51fc8bfbdde 100644 --- a/arch/riscv/include/asm/uaccess.h +++ b/arch/riscv/include/asm/uaccess.h @@ -39,8 +39,10 @@ * For historical reasons, these macros are grossly misnamed. */ -#define KERNEL_DS (~0UL) -#define USER_DS (TASK_SIZE) +#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) }) + +#define KERNEL_DS MAKE_MM_SEG(~0UL) +#define USER_DS MAKE_MM_SEG(TASK_SIZE) #define get_fs() (current_thread_info()->addr_limit) @@ -49,9 +51,9 @@ static inline void set_fs(mm_segment_t fs) current_thread_info()->addr_limit = fs; } -#define segment_eq(a, b) ((a) == (b)) +#define segment_eq(a, b) ((a).seg == (b).seg) -#define user_addr_max() (get_fs()) +#define user_addr_max() (get_fs().seg) /** @@ -83,7 +85,7 @@ static inline int __access_ok(unsigned long addr, unsigned long size) { const mm_segment_t fs = get_fs(); - return (size <= fs) && (addr <= (fs - size)); + return size <= fs.seg && addr <= fs.seg - size; } /* From patchwork Fri Apr 12 14:39:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10898497 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8CFE11515 for ; Fri, 12 Apr 2019 14:40:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 70E2F28E30 for ; Fri, 12 Apr 2019 14:40:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 651BB28E76; Fri, 12 Apr 2019 14:40:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1699228E66 for ; Fri, 12 Apr 2019 14:40:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=GvevUyOn+3GfEVzAI1mheJZXe84O9KiJov4bpYE3T14=; b=T7BpvBw4JDs0Q3 ZIMlMK47WTUKFSXjLx8JnJ61LqylW9lOrX5I67zJkAcxDGqJvOzHEM2Bu9qHd9Gcf6w9Y3Gq7/I4N 22xcuFvRzv48O206+utmu9k680uHRsLb1cBflj0a1wzCTdDr8YJv244GQPYJwyE4OV7a3XiMcle8T jKmK5fsoBjYZyPVrnjUXR8+GeA/r/10yFYySTTEsuAZShYCxF+mWN/rRc272b+NxL9RhXOsGZa3Av Z8QR1bQbyMxJVJtreZ1Bq7IINEGRmoU/WfMI65bI6AVYh00mnGcw6rf2SA6+FS5oVeMNZGkGvC5GO tVXvMQhHsYUcHXFvL5dw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hExLu-0001C0-2C; Fri, 12 Apr 2019 14:40:26 +0000 Received: from 089144214194.atnat0023.highway.a1.net ([89.144.214.194] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hExLo-00014u-Qm; Fri, 12 Apr 2019 14:40:21 +0000 From: Christoph Hellwig To: Palmer Dabbelt Subject: [PATCH 03/12] riscv: remove unreachable big endian code Date: Fri, 12 Apr 2019 16:39:39 +0200 Message-Id: <20190412143948.12478-4-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190412143948.12478-1-hch@lst.de> References: <20190412143948.12478-1-hch@lst.de> MIME-Version: 1.0 X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nick Kossifidis , Atish Patra , linux-riscv@lists.infradead.org Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP RISC-V is always little endian. Signed-off-by: Christoph Hellwig --- arch/riscv/include/asm/elf.h | 6 ------ arch/riscv/include/asm/uaccess.h | 9 +-------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/arch/riscv/include/asm/elf.h b/arch/riscv/include/asm/elf.h index 697fc23b0d5a..ce0cd7d77eb0 100644 --- a/arch/riscv/include/asm/elf.h +++ b/arch/riscv/include/asm/elf.h @@ -27,13 +27,7 @@ #define ELF_CLASS ELFCLASS32 #endif -#if defined(__LITTLE_ENDIAN) #define ELF_DATA ELFDATA2LSB -#elif defined(__BIG_ENDIAN) -#define ELF_DATA ELFDATA2MSB -#else -#error "Unknown endianness" -#endif /* * This is used to ensure we don't load something for the wrong architecture. diff --git a/arch/riscv/include/asm/uaccess.h b/arch/riscv/include/asm/uaccess.h index c51fc8bfbdde..b26f407be5c8 100644 --- a/arch/riscv/include/asm/uaccess.h +++ b/arch/riscv/include/asm/uaccess.h @@ -101,15 +101,8 @@ static inline int __access_ok(unsigned long addr, unsigned long size) * on our cache or tlb entries. */ -#if defined(__LITTLE_ENDIAN) -#define __MSW 1 #define __LSW 0 -#elif defined(__BIG_ENDIAN) -#define __MSW 0 -#define __LSW 1 -#else -#error "Unknown endianness" -#endif +#define __MSW 1 /* * The "__xxx" versions of the user access functions do not verify the address From patchwork Fri Apr 12 14:39:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10898499 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 941581515 for ; Fri, 12 Apr 2019 14:40:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7352728E76 for ; Fri, 12 Apr 2019 14:40:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 67C7328E7C; Fri, 12 Apr 2019 14:40:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0702D28E76 for ; Fri, 12 Apr 2019 14:40:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=yoihM3gHtLgwxRDiaHYwPa4qI+kvL9iNeHLveIbqcAw=; b=eSVJPnUp4N0JTf SiQlWLLmjUhMz0ydX5xbS3dAwIBzOc7Xm+bX4upezdR1BwWErL9Z6pQ2gQKW9H7Qs109bfBCtbVGj 1zXf34Oyy3m+aisVgvBgpfgOSK8Lcl9ENjpKNlf/cHywmjqefgsJj5B80uzhJ539YomGsH5fLzk51 WfEgm4Noo015tM/4sqVs4f86S6ihdQeJiLWYoB0W3c3f/vPSBMCj6EcTUm7V0q0OZgv/jxtU6DfUF +95zHJP2VJ4BEeeZktCXNlc73zmkcHoSQhck7doWncKerJcZjUJ0HFrFftjzha9iOg6tBILz2iiFm EBFiffEx98znuF6661jw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hExLv-0001Cx-2X; Fri, 12 Apr 2019 14:40:27 +0000 Received: from 089144214194.atnat0023.highway.a1.net ([89.144.214.194] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hExLr-00018d-PI; Fri, 12 Apr 2019 14:40:24 +0000 From: Christoph Hellwig To: Palmer Dabbelt Subject: [PATCH 04/12] riscv: remove CONFIG_RISCV_ISA_A Date: Fri, 12 Apr 2019 16:39:40 +0200 Message-Id: <20190412143948.12478-5-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190412143948.12478-1-hch@lst.de> References: <20190412143948.12478-1-hch@lst.de> MIME-Version: 1.0 X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nick Kossifidis , Atish Patra , linux-riscv@lists.infradead.org Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This option is always enabled, and not supporting the A extensions would create a complete ABI trainwreck, so there is no point in even slightly encouraging such an idea by keeping this unselectable code around. Signed-off-by: Christoph Hellwig --- arch/riscv/Kconfig | 6 +----- arch/riscv/Makefile | 5 ++--- arch/riscv/include/asm/futex.h | 13 ------------- 3 files changed, 3 insertions(+), 21 deletions(-) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index eb56c82d8aa1..a65b2a43f7ba 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -27,7 +27,7 @@ config RISCV select GENERIC_STRNCPY_FROM_USER select GENERIC_STRNLEN_USER select GENERIC_SMP_IDLE_THREAD - select GENERIC_ATOMIC64 if !64BIT || !RISCV_ISA_A + select GENERIC_ATOMIC64 if !64BIT select HAVE_ARCH_AUDITSYSCALL select HAVE_MEMBLOCK_NODE_MAP select HAVE_DMA_CONTIGUOUS @@ -35,7 +35,6 @@ config RISCV select HAVE_PERF_EVENTS select HAVE_SYSCALL_TRACEPOINTS select IRQ_DOMAIN - select RISCV_ISA_A if SMP select SPARSE_IRQ select SYSCTL_EXCEPTION_TRACE select HAVE_ARCH_TRACEHOOK @@ -197,9 +196,6 @@ config RISCV_ISA_C If you don't know what to do here, say Y. -config RISCV_ISA_A - def_bool y - menu "supported PMU type" depends on PERF_EVENTS diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile index c6342e638ef7..6b0741c9f348 100644 --- a/arch/riscv/Makefile +++ b/arch/riscv/Makefile @@ -39,9 +39,8 @@ endif KBUILD_CFLAGS += -Wall # ISA string setting -riscv-march-$(CONFIG_ARCH_RV32I) := rv32im -riscv-march-$(CONFIG_ARCH_RV64I) := rv64im -riscv-march-$(CONFIG_RISCV_ISA_A) := $(riscv-march-y)a +riscv-march-$(CONFIG_ARCH_RV32I) := rv32ima +riscv-march-$(CONFIG_ARCH_RV64I) := rv64ima riscv-march-$(CONFIG_FPU) := $(riscv-march-y)fd riscv-march-$(CONFIG_RISCV_ISA_C) := $(riscv-march-y)c KBUILD_CFLAGS += -march=$(subst fd,,$(riscv-march-y)) diff --git a/arch/riscv/include/asm/futex.h b/arch/riscv/include/asm/futex.h index 66641624d8a5..4ad6409c4647 100644 --- a/arch/riscv/include/asm/futex.h +++ b/arch/riscv/include/asm/futex.h @@ -7,18 +7,6 @@ #ifndef _ASM_FUTEX_H #define _ASM_FUTEX_H -#ifndef CONFIG_RISCV_ISA_A -/* - * Use the generic interrupt disabling versions if the A extension - * is not supported. - */ -#ifdef CONFIG_SMP -#error "Can't support generic futex calls without A extension on SMP" -#endif -#include - -#else /* CONFIG_RISCV_ISA_A */ - #include #include #include @@ -124,5 +112,4 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, return ret; } -#endif /* CONFIG_RISCV_ISA_A */ #endif /* _ASM_FUTEX_H */ From patchwork Fri Apr 12 14:39:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10898501 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3914E14DB for ; Fri, 12 Apr 2019 14:40:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 05E4E28E69 for ; Fri, 12 Apr 2019 14:40:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EE41028E81; Fri, 12 Apr 2019 14:40:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9A00228E6F for ; Fri, 12 Apr 2019 14:40:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=JelxpZ+qJx1X8sBlrUb3UyAntyHJMuzQpKZa3FIuVpw=; b=nkt8gJgZSWHUAv QFo14YMIUtbjkUoSIdWjSXKRIsdfI1tzlIrjkjgOdZ4FiqS9ej5mvmftFZtOsEObM81T3pqtfO00G sSlhNwwhTMdVPOKT8bedwQ5nqd/MckFZ2nPg/Q4ww45YKe9L53A1odBfI6PZWPBI/d3gF0iiGUVbD mECgEV4KKAwaAGKvsRo3e/U5xg79X7Sbq4+b8HM63ZKYVW1q1XkWEC69H2VRXWeN4xRAUwSf5cIks G9l/rirLwEsnmJUb42mtUFumMgiy06Y3EzlbMUH2hWUMrmV0rYaHl2/uEVypV5uCGDNHCbDWq9rdr toOPbKY1NM1x/mrexc8A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hExLy-0001Go-EY; Fri, 12 Apr 2019 14:40:30 +0000 Received: from 089144214194.atnat0023.highway.a1.net ([89.144.214.194] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hExLu-0001BQ-EL; Fri, 12 Apr 2019 14:40:26 +0000 From: Christoph Hellwig To: Palmer Dabbelt Subject: [PATCH 05/12] riscv: clear all pending interrupts when booting Date: Fri, 12 Apr 2019 16:39:41 +0200 Message-Id: <20190412143948.12478-6-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190412143948.12478-1-hch@lst.de> References: <20190412143948.12478-1-hch@lst.de> MIME-Version: 1.0 X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nick Kossifidis , Atish Patra , linux-riscv@lists.infradead.org Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Just in case an old interrupt is pending make sure we clear everything asserted before this kernel started. Based on similar M-mode code in opensbi. Signed-off-by: Christoph Hellwig Reviewed-by: Nick Kossifidis Reviewed-by: Atish Patra --- arch/riscv/kernel/head.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/riscv/kernel/head.S b/arch/riscv/kernel/head.S index fe884cd69abd..9e3840d84d3e 100644 --- a/arch/riscv/kernel/head.S +++ b/arch/riscv/kernel/head.S @@ -22,8 +22,9 @@ __INIT ENTRY(_start) - /* Mask all interrupts */ + /* Mask and clear all interrupts */ csrw sie, zero + csrw sip, zero /* Load the global pointer */ .option push From patchwork Fri Apr 12 14:39:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10898503 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CAA5014DB for ; Fri, 12 Apr 2019 14:40:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A70A428E73 for ; Fri, 12 Apr 2019 14:40:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9B28128E76; Fri, 12 Apr 2019 14:40:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 549D828E6F for ; Fri, 12 Apr 2019 14:40:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=1irBsFge92WLkONII81HhAc6QGgoSsMFK0aMnBnQeds=; b=Px773TIjz6qTVO iDxQ+tXl6slpK4u7ZCp0U9mfAbMWu2Jw81qtwWQpML7ahwwrmrY6/0YU4Cv0DmlNbM+uR0y6X6Yof 1Gn34JH8KhC7Yw0WASRUQDDxsypsM3Rm+5nec4TKoM6M7adVQbnOi0R6DgaNUzlSZafkxICZADWoz mM0LLbhKi/hzIpYuU5xQRD177OTG7dL+aRsIYSsD/78FuXeQTHe4BmLzv7N+ghENquLzqFZtrR2Q/ X4lzJR0eBi3QLsuGxJQubBAtLENEdh8nf78bm/CkdYcEfTrZCv3YVSh86OrtOzBlJ5v+GOCR2CbiV ZJ3VYDAklYngjquAAITg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hExM1-0001Jl-Ah; Fri, 12 Apr 2019 14:40:33 +0000 Received: from 089144214194.atnat0023.highway.a1.net ([89.144.214.194] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hExLx-0001DT-4B; Fri, 12 Apr 2019 14:40:29 +0000 From: Christoph Hellwig To: Palmer Dabbelt Subject: [PATCH 06/12] riscv: simplify the stack pointer setup in head.S Date: Fri, 12 Apr 2019 16:39:42 +0200 Message-Id: <20190412143948.12478-7-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190412143948.12478-1-hch@lst.de> References: <20190412143948.12478-1-hch@lst.de> MIME-Version: 1.0 X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nick Kossifidis , Atish Patra , linux-riscv@lists.infradead.org Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP We don't need THREAD_SIZE in asm-offsets.c as we can just calculate the value of init_thread_union + THREAD_SIZE using cpp, just like we do a few lines above. Signed-off-by: Christoph Hellwig Reviewed-by: Atish Patra --- arch/riscv/kernel/asm-offsets.c | 3 --- arch/riscv/kernel/head.S | 5 +---- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/arch/riscv/kernel/asm-offsets.c b/arch/riscv/kernel/asm-offsets.c index dac98348c6a3..578bb5efc085 100644 --- a/arch/riscv/kernel/asm-offsets.c +++ b/arch/riscv/kernel/asm-offsets.c @@ -312,9 +312,6 @@ void asm_offsets(void) - offsetof(struct task_struct, thread.fstate.f[0]) ); - /* The assembler needs access to THREAD_SIZE as well. */ - DEFINE(ASM_THREAD_SIZE, THREAD_SIZE); - /* * We allocate a pt_regs on the stack when entering the kernel. This * ensures the alignment is sane. diff --git a/arch/riscv/kernel/head.S b/arch/riscv/kernel/head.S index 9e3840d84d3e..62d2c9c85433 100644 --- a/arch/riscv/kernel/head.S +++ b/arch/riscv/kernel/head.S @@ -69,10 +69,7 @@ clear_bss_done: /* Restore C environment */ la tp, init_task sw zero, TASK_TI_CPU(tp) - - la sp, init_thread_union - li a0, ASM_THREAD_SIZE - add sp, sp, a0 + la sp, init_thread_union + THREAD_SIZE /* Start the kernel */ mv a0, s0 From patchwork Fri Apr 12 14:39:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10898505 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5A5191515 for ; Fri, 12 Apr 2019 14:40:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 34A2628E6F for ; Fri, 12 Apr 2019 14:40:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2976328E74; Fri, 12 Apr 2019 14:40:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D9FD828E72 for ; Fri, 12 Apr 2019 14:40:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=22ctWyvFQxIPizdVNbF/iog6++HAnUgWUsg/gmsxVUk=; b=rrK30vJyx2aGx+ r/d8OoLiubzzFZqveNblQraYCO3LIvyA3HHXlA7gsn8C/CkoedH1FSFyuYaTSGJHCPleKAh3p5D0q eBfLR4A7KoXAJ/fVgf14WTXCmlkxwTii5RQQ8h9aJMxC9mbVuXilbi8XcdpIinSOCksxsdjCEPHcS FczQazYu46pFsZxj0c50cDWVMH06Ao0uVsY20P4LKzT6HvI48SvDDBED+DAC78LfQj5Rc3Ph++GHb dt5XqZ2c0KyHce7Gesmv0nJfOGfk9DdSbnZc7GXLmusjI568ih+cExjCB4jYYboFZhN4Fh5PTGv4i rctJzDQk95Bl/gcdhzYw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hExM4-0001MY-5s; Fri, 12 Apr 2019 14:40:36 +0000 Received: from 089144214194.atnat0023.highway.a1.net ([89.144.214.194] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hExLz-0001Gl-W2; Fri, 12 Apr 2019 14:40:32 +0000 From: Christoph Hellwig To: Palmer Dabbelt Subject: [PATCH 07/12] riscv: cleanup the parse_dtb calling conventions Date: Fri, 12 Apr 2019 16:39:43 +0200 Message-Id: <20190412143948.12478-8-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190412143948.12478-1-hch@lst.de> References: <20190412143948.12478-1-hch@lst.de> MIME-Version: 1.0 X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nick Kossifidis , Atish Patra , linux-riscv@lists.infradead.org Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP No need to pass the hartid, and the dtb address passed is a physical address, so don't pretend it is a kernel pointer. Signed-off-by: Christoph Hellwig --- arch/riscv/kernel/head.S | 3 +-- arch/riscv/kernel/setup.c | 6 ++++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/riscv/kernel/head.S b/arch/riscv/kernel/head.S index 62d2c9c85433..478821d31bb3 100644 --- a/arch/riscv/kernel/head.S +++ b/arch/riscv/kernel/head.S @@ -72,8 +72,7 @@ clear_bss_done: la sp, init_thread_union + THREAD_SIZE /* Start the kernel */ - mv a0, s0 - mv a1, s1 + mv a0, s1 call parse_dtb tail start_kernel diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c index 540a331d1376..d93bcce004e3 100644 --- a/arch/riscv/kernel/setup.c +++ b/arch/riscv/kernel/setup.c @@ -52,9 +52,11 @@ struct screen_info screen_info = { atomic_t hart_lottery; unsigned long boot_cpu_hartid; -void __init parse_dtb(unsigned int hartid, void *dtb) +void __init parse_dtb(phys_addr_t dtb_phys) { - if (early_init_dt_scan(__va(dtb))) + void *dtb = __va(dtb_phys); + + if (early_init_dt_scan(dtb)) return; pr_err("No DTB passed to the kernel\n"); From patchwork Fri Apr 12 14:39:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10898507 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F05F417EF for ; Fri, 12 Apr 2019 14:40:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CB75828E6F for ; Fri, 12 Apr 2019 14:40:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BFE0728E72; Fri, 12 Apr 2019 14:40:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 656F928E30 for ; Fri, 12 Apr 2019 14:40:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=FfU+oWEOi9+ZbgjVSIoZHa61k03yAunpgm/f+NY+YQo=; b=lKs1Wc4NBfeveP kiasav1NoX31dSJXyliRNjeF3S1kEM05z96UMl4zyPlDD5JbKa3r6GcRvge5kGKv4aOIJZQa6a35c ctMmEYcmHatDSg98QzwNO/xLyBLy+qLfRKn18XGD8cbxEHXGVgtQo9VVVYskbxEB8XFQbGt79kl7C Mg+Lh1Eokn3f4GD9ttLaMYoRGMgeExAWHqeMhBuTuf4pImZjGrtukZs8kwOKFMmmC7vMFMUYeeUBQ opCQ7HBthL3Nr3zu7X3W5AxPCjlWF5vFp78wyLPu7EytTmKTtJOSGMjQud+JFcRIvB1G2wTe5hlcA 66LZ9qDuEidKoiyI0nJw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hExM5-0001NL-24; Fri, 12 Apr 2019 14:40:37 +0000 Received: from 089144214194.atnat0023.highway.a1.net ([89.144.214.194] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hExM2-0001JP-OM; Fri, 12 Apr 2019 14:40:35 +0000 From: Christoph Hellwig To: Palmer Dabbelt Subject: [PATCH 08/12] riscv: remove unreachable !CONFIG_FRAME_POINTER code Date: Fri, 12 Apr 2019 16:39:44 +0200 Message-Id: <20190412143948.12478-9-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190412143948.12478-1-hch@lst.de> References: <20190412143948.12478-1-hch@lst.de> MIME-Version: 1.0 X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nick Kossifidis , Atish Patra , linux-riscv@lists.infradead.org Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The RISC-V port selects CONFIG_ARCH_WANT_FRAME_POINTERS, which causes CONFIG_FRAME_POINTER to always be set. Remove the unreachable code for the !CONFIG_FRAME_POINTER case. Signed-off-by: Christoph Hellwig --- arch/riscv/include/asm/ftrace.h | 6 +----- arch/riscv/kernel/stacktrace.c | 37 --------------------------------- 2 files changed, 1 insertion(+), 42 deletions(-) diff --git a/arch/riscv/include/asm/ftrace.h b/arch/riscv/include/asm/ftrace.h index c6dcc5291f97..c52073a065e5 100644 --- a/arch/riscv/include/asm/ftrace.h +++ b/arch/riscv/include/asm/ftrace.h @@ -1,11 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0 */ /* Copyright (C) 2017 Andes Technology Corporation */ -/* - * The graph frame test is not possible if CONFIG_FRAME_POINTER is not enabled. - * Check arch/riscv/kernel/mcount.S for detail. - */ -#if defined(CONFIG_FUNCTION_GRAPH_TRACER) && defined(CONFIG_FRAME_POINTER) +#ifdef CONFIG_FUNCTION_GRAPH_TRACER #define HAVE_FUNCTION_GRAPH_FP_TEST #endif #define HAVE_FUNCTION_GRAPH_RET_ADDR_PTR diff --git a/arch/riscv/kernel/stacktrace.c b/arch/riscv/kernel/stacktrace.c index a4b1d94371a0..3cb439f8c7e6 100644 --- a/arch/riscv/kernel/stacktrace.c +++ b/arch/riscv/kernel/stacktrace.c @@ -20,8 +20,6 @@ #include #include -#ifdef CONFIG_FRAME_POINTER - struct stackframe { unsigned long fp; unsigned long ra; @@ -73,41 +71,6 @@ static void notrace walk_stackframe(struct task_struct *task, } } -#else /* !CONFIG_FRAME_POINTER */ - -static void notrace walk_stackframe(struct task_struct *task, - struct pt_regs *regs, bool (*fn)(unsigned long, void *), void *arg) -{ - unsigned long sp, pc; - unsigned long *ksp; - - if (regs) { - sp = GET_USP(regs); - pc = GET_IP(regs); - } else if (task == NULL || task == current) { - const register unsigned long current_sp __asm__ ("sp"); - sp = current_sp; - pc = (unsigned long)walk_stackframe; - } else { - /* task blocked in __switch_to */ - sp = task->thread.sp; - pc = task->thread.ra; - } - - if (unlikely(sp & 0x7)) - return; - - ksp = (unsigned long *)sp; - while (!kstack_end(ksp)) { - if (__kernel_text_address(pc) && unlikely(fn(pc, arg))) - break; - pc = (*ksp++) - 0x4; - } -} - -#endif /* CONFIG_FRAME_POINTER */ - - static bool print_trace_address(unsigned long pc, void *arg) { print_ip_sym(pc); From patchwork Fri Apr 12 14:39:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10898509 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A7DD814DB for ; Fri, 12 Apr 2019 14:40:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7E5C228E81 for ; Fri, 12 Apr 2019 14:40:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6EF8D28E7B; Fri, 12 Apr 2019 14:40:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 23DA328E74 for ; Fri, 12 Apr 2019 14:40:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=t1Heceuhfz+/H/7UQuOeBVZLiP2ExbawTcHBUehnr1E=; b=cb6TwoHEQXzsAi cOT6VhEiIB95RN9DomRJz6PzncF4CP0hIv879YgGsbDFidCBe+o7kOjD6UiOvbyNwFN8jpudwT0Xe XdQeaHD6pK9MC8WKyZHmp6jo2tZ/4ni4TYrhwURepDb9NqDdDO4AX/maMqg99l3DXFI8DfVMGZkUF IHyLB4ZPIM4UEsg/Z8KgLdZTIwZIEID6H25mI4zOFNWA8uPQZieEfrMQTZIlVaFxrQK/V2cU3bmFE mN5dp7CmdbDhiWcdKo8YWeB0E0JGPc0zyeNCZ+EX1hh0sN3Y5N/eVgE9+W8KTZDr/n6LOs4FKF4xF qXUiF242ulARpd/jh5FA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hExM8-0001Rp-Pv; Fri, 12 Apr 2019 14:40:40 +0000 Received: from 089144214194.atnat0023.highway.a1.net ([89.144.214.194] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hExM5-0001MN-NY; Fri, 12 Apr 2019 14:40:38 +0000 From: Christoph Hellwig To: Palmer Dabbelt Subject: [PATCH 09/12] riscv: remove unreachable !HAVE_FUNCTION_GRAPH_RET_ADDR_PTR code Date: Fri, 12 Apr 2019 16:39:45 +0200 Message-Id: <20190412143948.12478-10-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190412143948.12478-1-hch@lst.de> References: <20190412143948.12478-1-hch@lst.de> MIME-Version: 1.0 X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nick Kossifidis , Atish Patra , linux-riscv@lists.infradead.org Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP HAVE_FUNCTION_GRAPH_RET_ADDR_PTR is always defined for RISC-V. Signed-off-by: Christoph Hellwig --- arch/riscv/kernel/stacktrace.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/arch/riscv/kernel/stacktrace.c b/arch/riscv/kernel/stacktrace.c index 3cb439f8c7e6..da9f796ec4d2 100644 --- a/arch/riscv/kernel/stacktrace.c +++ b/arch/riscv/kernel/stacktrace.c @@ -62,12 +62,8 @@ static void notrace walk_stackframe(struct task_struct *task, frame = (struct stackframe *)fp - 1; sp = fp; fp = frame->fp; -#ifdef HAVE_FUNCTION_GRAPH_RET_ADDR_PTR pc = ftrace_graph_ret_addr(current, NULL, frame->ra, (unsigned long *)(fp - 8)); -#else - pc = frame->ra - 0x4; -#endif } } From patchwork Fri Apr 12 14:39:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10898511 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 913B714DB for ; Fri, 12 Apr 2019 14:40:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7325C28E73 for ; Fri, 12 Apr 2019 14:40:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 67A1F28E84; Fri, 12 Apr 2019 14:40:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0CF9C28E74 for ; Fri, 12 Apr 2019 14:40:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ZB/cskwuKaLQPMcaDYAVnRXGhekvbxkbwKJPmLc60Eo=; b=hc9+erGGrjaxXX PTGJbIGngY3hLu5Lxwt+vBeJ8xCE47bsmFz2oupR4S18X9YM/0o4GoFo2ZAwu//R1583OJOibJYFt rC14uydnfs7XMigUk+O2I7PZnEqUNgyiqT4PxMgNkB5rZRZK6eLX4pMVco7vS44CD8icpaGsO0HPj WUNcsxuXdVc+alDkrzYtHSUupYSZlDc+aMCGJoExNQ6LxdRCDEihGafBcpbRU4F7IeKEYjnEtmQpj MPo6uq1B2teXjq1VlR5dsN3GJ34JvYJOhtIOReyo1SxhAsixRGVTatEgwYUZDOjFVEp/dD5p4SYeG VPSrm2N/Wf0bLqgGJapA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hExMB-0001Ui-LT; Fri, 12 Apr 2019 14:40:43 +0000 Received: from 089144214194.atnat0023.highway.a1.net ([89.144.214.194] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hExM8-0001PY-FW; Fri, 12 Apr 2019 14:40:40 +0000 From: Christoph Hellwig To: Palmer Dabbelt Subject: [PATCH 10/12] riscv: remove duplicate macros from ptrace.h Date: Fri, 12 Apr 2019 16:39:46 +0200 Message-Id: <20190412143948.12478-11-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190412143948.12478-1-hch@lst.de> References: <20190412143948.12478-1-hch@lst.de> MIME-Version: 1.0 X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nick Kossifidis , Atish Patra , linux-riscv@lists.infradead.org Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP No need to have two names for the same thing. Signed-off-by: Christoph Hellwig --- arch/riscv/include/asm/ptrace.h | 21 ++++++--------------- arch/riscv/kernel/stacktrace.c | 6 +++--- arch/riscv/kernel/traps.c | 2 +- 3 files changed, 10 insertions(+), 19 deletions(-) diff --git a/arch/riscv/include/asm/ptrace.h b/arch/riscv/include/asm/ptrace.h index d35ec2f41381..9c867a4bac83 100644 --- a/arch/riscv/include/asm/ptrace.h +++ b/arch/riscv/include/asm/ptrace.h @@ -70,47 +70,38 @@ struct pt_regs { /* Helpers for working with the instruction pointer */ -#define GET_IP(regs) ((regs)->sepc) -#define SET_IP(regs, val) (GET_IP(regs) = (val)) - static inline unsigned long instruction_pointer(struct pt_regs *regs) { - return GET_IP(regs); + return regs->sepc; } static inline void instruction_pointer_set(struct pt_regs *regs, unsigned long val) { - SET_IP(regs, val); + regs->sepc = val; } #define profile_pc(regs) instruction_pointer(regs) /* Helpers for working with the user stack pointer */ -#define GET_USP(regs) ((regs)->sp) -#define SET_USP(regs, val) (GET_USP(regs) = (val)) - static inline unsigned long user_stack_pointer(struct pt_regs *regs) { - return GET_USP(regs); + return regs->sp; } static inline void user_stack_pointer_set(struct pt_regs *regs, unsigned long val) { - SET_USP(regs, val); + regs->sp = val; } /* Helpers for working with the frame pointer */ -#define GET_FP(regs) ((regs)->s0) -#define SET_FP(regs, val) (GET_FP(regs) = (val)) - static inline unsigned long frame_pointer(struct pt_regs *regs) { - return GET_FP(regs); + return regs->s0; } static inline void frame_pointer_set(struct pt_regs *regs, unsigned long val) { - SET_FP(regs, val); + regs->s0 = val; } static inline unsigned long regs_return_value(struct pt_regs *regs) diff --git a/arch/riscv/kernel/stacktrace.c b/arch/riscv/kernel/stacktrace.c index da9f796ec4d2..523735188abb 100644 --- a/arch/riscv/kernel/stacktrace.c +++ b/arch/riscv/kernel/stacktrace.c @@ -31,9 +31,9 @@ static void notrace walk_stackframe(struct task_struct *task, unsigned long fp, sp, pc; if (regs) { - fp = GET_FP(regs); - sp = GET_USP(regs); - pc = GET_IP(regs); + fp = frame_pointer(regs); + sp = user_stack_pointer(regs); + pc = instruction_pointer(regs); } else if (task == NULL || task == current) { const register unsigned long current_sp __asm__ ("sp"); fp = (unsigned long)__builtin_frame_address(0); diff --git a/arch/riscv/kernel/traps.c b/arch/riscv/kernel/traps.c index 0d5dac0eaddb..d9b2fd39c8bb 100644 --- a/arch/riscv/kernel/traps.c +++ b/arch/riscv/kernel/traps.c @@ -70,7 +70,7 @@ void do_trap(struct pt_regs *regs, int signo, int code, && printk_ratelimit()) { pr_info("%s[%d]: unhandled signal %d code 0x%x at 0x" REG_FMT, tsk->comm, task_pid_nr(tsk), signo, code, addr); - print_vma_addr(KERN_CONT " in ", GET_IP(regs)); + print_vma_addr(KERN_CONT " in ", instruction_pointer(regs)); pr_cont("\n"); show_regs(regs); } From patchwork Fri Apr 12 14:39:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10898513 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D536914DB for ; Fri, 12 Apr 2019 14:40:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B52BB28E73 for ; Fri, 12 Apr 2019 14:40:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A9C3A28E76; Fri, 12 Apr 2019 14:40:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6525528E76 for ; Fri, 12 Apr 2019 14:40:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=0RuWE3Ra6G0cmNpxmXM0ZqHbgweSwFlOH0PFha2POXQ=; b=d//csAIlRoD9UZ XQgzgDDdrspmPBEAfhb6T1ZBOobM+MYi/V4rAquZMubERTTCsKzyRosd/Hahb2PeDlyVipkEWg34d gpz6+rWnd8pdjYyFyGcuICsAuJsGyo3r90F1SvfpePZsK05MhL+aLQpYmhsOwVP30biu1TQogzVio BgsKpu6lafg02/OgXAtOkLL2PgkUEItDMYw5CGgxO9Oq4+i5P37YvctDpIqnM8E/OPGLGSQfJE9PE vLKdvvbUbmtrlCKcAIj9a8eSKl2aPJllZ/jxdO8hQn2UvH5nrOrIC85egYRioVTZe9w/ZkxOqzRMB KQdhHIy8Q5UnjvwM9Jhg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hExMF-0001Y2-Am; Fri, 12 Apr 2019 14:40:47 +0000 Received: from 089144214194.atnat0023.highway.a1.net ([89.144.214.194] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hExMB-0001Se-8B; Fri, 12 Apr 2019 14:40:43 +0000 From: Christoph Hellwig To: Palmer Dabbelt Subject: [PATCH 11/12] riscv: print the unexpected interrupt cause Date: Fri, 12 Apr 2019 16:39:47 +0200 Message-Id: <20190412143948.12478-12-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190412143948.12478-1-hch@lst.de> References: <20190412143948.12478-1-hch@lst.de> MIME-Version: 1.0 X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nick Kossifidis , Atish Patra , linux-riscv@lists.infradead.org Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This has been helpful when debugging my pending nommu port. Signed-off-by: Christoph Hellwig Reviewed-by: Nick Kossifidis --- arch/riscv/kernel/irq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/riscv/kernel/irq.c b/arch/riscv/kernel/irq.c index 48e6b7db83a1..c738132eecf8 100644 --- a/arch/riscv/kernel/irq.c +++ b/arch/riscv/kernel/irq.c @@ -54,7 +54,8 @@ asmlinkage void __irq_entry do_IRQ(struct pt_regs *regs) handle_arch_irq(regs); break; default: - panic("unexpected interrupt cause"); + pr_alert("unexpected interrupt cause 0x%lx", regs->scause); + BUG(); } irq_exit(); From patchwork Fri Apr 12 14:39:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10898515 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3523717EF for ; Fri, 12 Apr 2019 14:40:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 188A1271CB for ; Fri, 12 Apr 2019 14:40:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 171EF28E78; Fri, 12 Apr 2019 14:40:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C8FFB28E7D for ; Fri, 12 Apr 2019 14:40:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=8Iqq9Yf8on/kE3ErrRbZm3/YJ7AZf2SGE1J09BXl/Hw=; b=TzO6HTcvHAGj5e ZdG2N2UKQHCHKmuZ5N7LT3iMOFI7rc98Hx0nF+LFGKztDpPiP3/6PTFHw5WqlQpzDOWGsl/+WdqTl oob1B9KuGvI+bAh/zOzyLeZC7AwrzZR0sjHxpr9xFQ3XM4Q5TU/ldaz2/FbnyzWG67F9kGn4R2Db5 UPOWqdXPG1/9smcdyk6rN1kOTCc7hntHkXpgajm7D7pOPgcMoXMMvDLSMglUh7Ms3KRqY2yQ7XNT2 OGXQHTSSgAIJk1vkI8mxfaqGfMir8Rx+YqXUxy22VilW5Y97m1GTK/dxtF0SeXrg/9EPG1JVabMCy 4seh+KuFp3KO4iOk8OcQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hExMH-0001Zn-4b; Fri, 12 Apr 2019 14:40:49 +0000 Received: from 089144214194.atnat0023.highway.a1.net ([89.144.214.194] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hExME-0001Vn-Af; Fri, 12 Apr 2019 14:40:46 +0000 From: Christoph Hellwig To: Palmer Dabbelt Subject: [PATCH 12/12] riscv: call pm_power_off from machine_halt / machine_power_off Date: Fri, 12 Apr 2019 16:39:48 +0200 Message-Id: <20190412143948.12478-13-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190412143948.12478-1-hch@lst.de> References: <20190412143948.12478-1-hch@lst.de> MIME-Version: 1.0 X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nick Kossifidis , Atish Patra , linux-riscv@lists.infradead.org Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This way any override of pm_power_off also affects the halt path and we don't need additional infrastructure for it. Also remove the pm_power_off export - at least for now we don't have any modular drivers overriding it. Signed-off-by: Christoph Hellwig Reviewed-by: Atish Patra --- arch/riscv/kernel/reset.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/arch/riscv/kernel/reset.c b/arch/riscv/kernel/reset.c index 2a53d26ffdd6..ed637aee514b 100644 --- a/arch/riscv/kernel/reset.c +++ b/arch/riscv/kernel/reset.c @@ -12,11 +12,15 @@ */ #include -#include #include -void (*pm_power_off)(void) = machine_power_off; -EXPORT_SYMBOL(pm_power_off); +static void default_power_off(void) +{ + sbi_shutdown(); + while (1); +} + +void (*pm_power_off)(void) = default_power_off; void machine_restart(char *cmd) { @@ -26,11 +30,10 @@ void machine_restart(char *cmd) void machine_halt(void) { - machine_power_off(); + pm_power_off(); } void machine_power_off(void) { - sbi_shutdown(); - while (1); + pm_power_off(); }