From patchwork Mon Apr 15 09:14:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10900361 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 E47BE17E1 for ; Mon, 15 Apr 2019 09:15:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C707428520 for ; Mon, 15 Apr 2019 09:15:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BA7C1285FD; Mon, 15 Apr 2019 09:15:15 +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 7293828520 for ; Mon, 15 Apr 2019 09:15:15 +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=Eiud3F4rO9aXpG qzfMQgQqgizXTzXf8t6wCBxVGFQTtudliEuZ1u9NTa5mLaX0MI/MsY8eGsMvrku+7FYtHRT+TOzoF tCqX8jMdKlrw/yiCIIUKkg8tnqE6n27HNjXPjkPu7AyxVJZl8C/j1gLv+gfUB/44ksWh0PeJnTWGu I7ATi2WHoEWDGKFBUK6rShZN+iJEDB3lE3Ds2RCQTwLZjmAIqvQKEeyt1gxZ6Vge9JuVkZMZ2RGsk ua6rTwarISRoO11tNjcYvF0B7tPax9d1loFqjnw4lbyAePpVI5itftJ52O/u9lp1Qw9kYWm7GjI8m 7F2ML+4ZxBx69dRcf9FA==; 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 1hFxho-0006ME-MG; Mon, 15 Apr 2019 09:15:12 +0000 Received: from 213-225-15-255.nat.highway.a1.net ([213.225.15.255] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hFxhm-0006K7-Nu; Mon, 15 Apr 2019 09:15:11 +0000 From: Christoph Hellwig To: Palmer Dabbelt Subject: [PATCH 01/11] riscv: use asm-generic/extable.h Date: Mon, 15 Apr 2019 11:14:32 +0200 Message-Id: <20190415091442.19945-2-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190415091442.19945-1-hch@lst.de> References: <20190415091442.19945-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 Mon Apr 15 09:14:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10900363 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 0EC7617E1 for ; Mon, 15 Apr 2019 09:15:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E60C728520 for ; Mon, 15 Apr 2019 09:15:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D9E8A285FD; Mon, 15 Apr 2019 09:15:17 +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 8D3A528520 for ; Mon, 15 Apr 2019 09:15:17 +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=t53hSRTK3HAwPP vSLXVglemJQ6Q8M85quwJPm2C8MB33mO4IN7EQLQMqoJ3FHMj+uLB3J/zSw8MGlqyIYTk5HGGf5ll 7JsN2MKEptYCGTWv4FhggY1E2LVf2ewa/GmVfLy8FYK7pJSX3qKCFak5n4J5G4DOctD4cRKPVl+Xq 0bFMuA2UBjK+S8QwP6ldJJ8O4XQIZVh1aCWh2Gdg8lG3dEkykE902sxKw1u3VuPo8+RHXoNUh0NCj FQqe7foU14Dg3iVgtRetRDk9XAynW91s7VzaQ66Ui9O1lsOa2rkXzZxZS9ZpnCOmCGayR8vss+zGe nbCWpzYOfOoV0mDFr1kg==; 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 1hFxhr-0006On-9x; Mon, 15 Apr 2019 09:15:15 +0000 Received: from 213-225-15-255.nat.highway.a1.net ([213.225.15.255] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hFxhp-0006Ll-En; Mon, 15 Apr 2019 09:15:13 +0000 From: Christoph Hellwig To: Palmer Dabbelt Subject: [PATCH 02/11] riscv: turn mm_segment_t into a struct Date: Mon, 15 Apr 2019 11:14:33 +0200 Message-Id: <20190415091442.19945-3-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190415091442.19945-1-hch@lst.de> References: <20190415091442.19945-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 Mon Apr 15 09:14:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10900365 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 37AC014DB for ; Mon, 15 Apr 2019 09:15:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 18C7F285B7 for ; Mon, 15 Apr 2019 09:15:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0CC1228619; Mon, 15 Apr 2019 09:15: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 B3F04285B7 for ; Mon, 15 Apr 2019 09:15:21 +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=WlJgniLaMP/kpM 9RW7dx2b0c/NTrxMiLP7yhw0uOxyH0timd+TFWMV90n71JVJlRDIyeeXDmf5Ng/W+T230acugHbJR cLilnnJW8kz8yoI9qRbs4+Jfy7ULoSBK9v9JYtXVzrPrzRq3zahi9iyyM5XsdoS1dxdYc2GCSDf89 PGYsmIoT4XDFaZf46O2z7ojl5bnSE1RFX0oRJFBj+J4h/xV/fWkjHKSiBIBYKuHfiYRAOZwu4ZfVO wF9bO8h4xel982131d6dDYxnO9hNlk8ViuH+0TkGimo6+WxqF2BMrIpRvSMnwKFCbqzLIk6JvgxgK 1B2ZmGdI4UcD8ESEEtIw==; 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 1hFxhu-0006Rl-UB; Mon, 15 Apr 2019 09:15:18 +0000 Received: from 213-225-15-255.nat.highway.a1.net ([213.225.15.255] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hFxhs-0006OM-54; Mon, 15 Apr 2019 09:15:16 +0000 From: Christoph Hellwig To: Palmer Dabbelt Subject: [PATCH 03/11] riscv: remove unreachable big endian code Date: Mon, 15 Apr 2019 11:14:34 +0200 Message-Id: <20190415091442.19945-4-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190415091442.19945-1-hch@lst.de> References: <20190415091442.19945-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 Mon Apr 15 09:14:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10900367 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 2DC6717E1 for ; Mon, 15 Apr 2019 09:15:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 10105285B7 for ; Mon, 15 Apr 2019 09:15:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 047AD28619; Mon, 15 Apr 2019 09:15:23 +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 A1DB6285B7 for ; Mon, 15 Apr 2019 09:15: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=yoihM3gHtLgwxRDiaHYwPa4qI+kvL9iNeHLveIbqcAw=; b=Db1kGMUFzkpeMd pSQ8dGALhiPGN8U2A76vQyaKXoJJL3q0ulXNcNHrVMdkHjKQZ2+2ooBZM5riVvqkRTCinu/zak90G Qh+aIAcEAs/sMsm40CNIi+0dm5iWTEyLMWJASj3Edb1ADJs9JWyDKHvQFH56MWIpb0hb1dbXnf7Uw oltppB10Q6Tn5G8DTXJG4HuH/+6C4D5TyN1ao4ae8CPahEZZr4zmv1aAm5b3xWtBO9Y4CaW4ONmsl u1YVC1fLgcJLoBSx69goTZb/CZwC6sZI+MZYMWhbdc2ryAW76g1B9QnqhGcVchAr0mmn9Uak1m1g6 8dNmvg6NChhps8NOqoag==; 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 1hFxhw-0006Td-HA; Mon, 15 Apr 2019 09:15:20 +0000 Received: from 213-225-15-255.nat.highway.a1.net ([213.225.15.255] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hFxhv-0006R2-1B; Mon, 15 Apr 2019 09:15:19 +0000 From: Christoph Hellwig To: Palmer Dabbelt Subject: [PATCH 04/11] riscv: remove CONFIG_RISCV_ISA_A Date: Mon, 15 Apr 2019 11:14:35 +0200 Message-Id: <20190415091442.19945-5-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190415091442.19945-1-hch@lst.de> References: <20190415091442.19945-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 Mon Apr 15 09:14:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10900369 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 7B19617E1 for ; Mon, 15 Apr 2019 09:15:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5EAB428520 for ; Mon, 15 Apr 2019 09:15:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 52DA0285FD; Mon, 15 Apr 2019 09:15:26 +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 EE95C28520 for ; Mon, 15 Apr 2019 09:15:25 +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=Gex4Uecj6twl2L aiGUBmGxbfmp5XSFwxRWThs6pREMxy0bZnol3u4R84BQbJ7YjPYxviRgeh/v/oe+yr+cUnLVibr4x IL8bN8TXHk3gERoZkJ3Jmx9JI8W8ckeBteDqgcfbn4DxMmJbuEHLrWgn2tE4dOnvXUMVKLq6pXpP2 Uc004v4gNEaGepVSjKaE+gkcuX5Dgc2qTwnNuVJCuIV7Ri2UdgeinPvbwSey/AXlWW1+f5ftBbKVP 64bAN9425kPwpFVtnLTqWK/Uyva0hj+jh/81JZOzC8I423H6HtiONA6+fkUk91Q/jDeuJvFKfwFP7 NjTsath5TMEeF/nze46w==; 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 1hFxhz-0006Wm-6a; Mon, 15 Apr 2019 09:15:23 +0000 Received: from 213-225-15-255.nat.highway.a1.net ([213.225.15.255] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hFxhx-0006TM-Pq; Mon, 15 Apr 2019 09:15:22 +0000 From: Christoph Hellwig To: Palmer Dabbelt Subject: [PATCH 05/11] riscv: clear all pending interrupts when booting Date: Mon, 15 Apr 2019 11:14:36 +0200 Message-Id: <20190415091442.19945-6-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190415091442.19945-1-hch@lst.de> References: <20190415091442.19945-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 Mon Apr 15 09:14: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: 10900371 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 CD1C414DB for ; Mon, 15 Apr 2019 09:15:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AF86928520 for ; Mon, 15 Apr 2019 09:15:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A3D6B285FD; Mon, 15 Apr 2019 09:15:29 +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 5A4BB28520 for ; Mon, 15 Apr 2019 09:15:29 +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=eWOLy2hpLqYp06 tbAHi1DYImtTSdcrglF7AqIPQOy5au7uzxw79s5QLNwDH4JIa2xCD/owBds1r0w/q+nwyd6VID6tW hZz5YODPioIs9kZO875E0PGM/RXaMH/264qVbfdcXTshMLAcqOECr3ofBcqKdiFZqks0Ui2qBQZQZ PrpoJEUBJOOu7Ac1dNM4E86LetTlqBBIcAXNXbpRId2A06LUx6P1acoGNlo19QKFdky38RbSUeNYQ fvMW2jbEcIsm3iLAlxhxLYoJqJhM6skvMvlX7i1sKp5VGzCQkbMhDQFfLyIdRaakgxxGAQDEZeXKN m9M/fWhjJKy5vfcZwrDw==; 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 1hFxi2-0006Zo-Oh; Mon, 15 Apr 2019 09:15:26 +0000 Received: from 213-225-15-255.nat.highway.a1.net ([213.225.15.255] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hFxi0-0006WZ-Ol; Mon, 15 Apr 2019 09:15:25 +0000 From: Christoph Hellwig To: Palmer Dabbelt Subject: [PATCH 06/11] riscv: simplify the stack pointer setup in head.S Date: Mon, 15 Apr 2019 11:14:37 +0200 Message-Id: <20190415091442.19945-7-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190415091442.19945-1-hch@lst.de> References: <20190415091442.19945-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 Mon Apr 15 09:14: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: 10900373 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 8AB1317E1 for ; Mon, 15 Apr 2019 09:15:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6E5FA28520 for ; Mon, 15 Apr 2019 09:15:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6194C285FD; Mon, 15 Apr 2019 09:15:31 +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 17BF928520 for ; Mon, 15 Apr 2019 09:15:31 +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=E9S/naKh+cefy1 Ov9rqvAJQZlDHX2vb6l53PEggWZLK9Rpd3y/BgSpjl0eKfiEmuWzhLmtVh2AynIFduhOzwLXiBgQY Qy5S90DsKRCL6+1IltMRyiIBm9VGs4+E4og45EtW/8al9zCr2QRxrbRgg2iRF8ezrOrUQc+WIqpIj miAUqb06aMsL5DJseqBcFsD6mxY9+t22hCW/5qi8rOIbeiGyo+Ug7gnqiZrl38SotKthLbszEgmuO H7fmoS4FeBoyGU2x3Lfg//rDxl3kLLwRxfCvPwOrjy9RnfDiLszy8mLFeArPgeO+SJsE+La4xpP3A IfLSXNUyZL6wx8QuJB0w==; 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 1hFxi5-0006cT-DL; Mon, 15 Apr 2019 09:15:29 +0000 Received: from 213-225-15-255.nat.highway.a1.net ([213.225.15.255] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hFxi3-0006ZQ-KD; Mon, 15 Apr 2019 09:15:28 +0000 From: Christoph Hellwig To: Palmer Dabbelt Subject: [PATCH 07/11] riscv: cleanup the parse_dtb calling conventions Date: Mon, 15 Apr 2019 11:14:38 +0200 Message-Id: <20190415091442.19945-8-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190415091442.19945-1-hch@lst.de> References: <20190415091442.19945-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 Mon Apr 15 09:14: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: 10900375 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 93EAE17E1 for ; Mon, 15 Apr 2019 09:15:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 772DF28520 for ; Mon, 15 Apr 2019 09:15:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6B31F285FD; Mon, 15 Apr 2019 09:15:34 +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 2B8FA28520 for ; Mon, 15 Apr 2019 09:15:34 +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=aXS25nLJFKjmWp4NgrojaxXtZc1A81riGbMaYBaTht0=; b=T2Lhr/x+2cZWKp Rc+g0PC95MOjoK2y4Vwq9NYU5gq2lErVmsDOTTV9jweEyCLgD7PnahUynHjYlzdu7RbxdISmf+BDY T1IJQ3a1mQuPk0BF63u1BhONCVbhFbdH6rh8qkvR6OmGmnEuoy/ECXFKFhHF+gmicIIi9IpJlvLlJ Pvmb4IbvNJbe9nTr6Dnu0jnCOdghQ0HEPtqDKUJq1EfCXMm2al6064ieI/ari+hMGKUy97mMKp4LY wO2B7iMny3Vz0U0+nHOMObxV8Qf4b7Ilu4jgNqi08RpoRBF9Q69cfiIft7ixKMn918gifT23ZZz3A cf/IaGyc/QkGYR3hWguQ==; 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 1hFxi8-0006fP-3P; Mon, 15 Apr 2019 09:15:32 +0000 Received: from 213-225-15-255.nat.highway.a1.net ([213.225.15.255] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hFxi6-0006c6-DO; Mon, 15 Apr 2019 09:15:30 +0000 From: Christoph Hellwig To: Palmer Dabbelt Subject: [PATCH 08/11] riscv: remove unreachable !HAVE_FUNCTION_GRAPH_RET_ADDR_PTR code Date: Mon, 15 Apr 2019 11:14:39 +0200 Message-Id: <20190415091442.19945-9-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190415091442.19945-1-hch@lst.de> References: <20190415091442.19945-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 a4b1d94371a0..855036c440c1 100644 --- a/arch/riscv/kernel/stacktrace.c +++ b/arch/riscv/kernel/stacktrace.c @@ -64,12 +64,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 Mon Apr 15 09:14: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: 10900377 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 1509414DB for ; Mon, 15 Apr 2019 09:15:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ED54928520 for ; Mon, 15 Apr 2019 09:15:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E1997285FD; Mon, 15 Apr 2019 09:15:36 +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 8561628520 for ; Mon, 15 Apr 2019 09:15:36 +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=nsGiJd0fUNF82aH48vQBSSh/l8FoXNN9eFiAi1pex4Q=; b=Vf9nvUBRGnXOkg QZV+evVaJrFwm3Tnmf5otqqHyr2XxBSkAb+/QmfpPMehOjzuCZR/361KkEqhCx/cc7vs7A/M9BGKe rVM+Dh1Z16Gji8XTCojLQNjrL8s8rj8IrQ41M8SrwAEUr5uGUGZ5Sm8pRE1Iac1P3ZrMHnIfJhixa xE0yrxyaYr8DECz4EuM4pBzh1JsxgzW5wtBC5iNC9j3GkA5ngkK/wtUCXv4CUJkbR3fY299sv98iU RRnGDeuT8EFaBEEzD0sZ50IoR5ua2n9oQs0JoV+w5AT3sARgs/j3YDimhp11ojkkmyMpQWdv5OlPo /kaHgZdLdWslRMYNeMBA==; 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 1hFxiA-0006iU-Nr; Mon, 15 Apr 2019 09:15:34 +0000 Received: from 213-225-15-255.nat.highway.a1.net ([213.225.15.255] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hFxi8-0006ep-Tu; Mon, 15 Apr 2019 09:15:33 +0000 From: Christoph Hellwig To: Palmer Dabbelt Subject: [PATCH 09/11] riscv: remove duplicate macros from ptrace.h Date: Mon, 15 Apr 2019 11:14:40 +0200 Message-Id: <20190415091442.19945-10-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190415091442.19945-1-hch@lst.de> References: <20190415091442.19945-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 | 10 +++++----- arch/riscv/kernel/traps.c | 2 +- 3 files changed, 12 insertions(+), 21 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 855036c440c1..a4386a0c8f67 100644 --- a/arch/riscv/kernel/stacktrace.c +++ b/arch/riscv/kernel/stacktrace.c @@ -33,9 +33,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); @@ -78,8 +78,8 @@ static void notrace walk_stackframe(struct task_struct *task, unsigned long *ksp; if (regs) { - sp = GET_USP(regs); - pc = GET_IP(regs); + sp = user_stack_pointer(regs); + pc = instruction_pointer(regs); } else if (task == NULL || task == current) { const register unsigned long current_sp __asm__ ("sp"); sp = current_sp; 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 Mon Apr 15 09:14: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: 10900379 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 B1E4014DB for ; Mon, 15 Apr 2019 09:15:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 96B7B28520 for ; Mon, 15 Apr 2019 09:15:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8ACC1285FD; Mon, 15 Apr 2019 09:15: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 7515E28520 for ; Mon, 15 Apr 2019 09:15:39 +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=8wB8+7Rstq/ekPLajriOmBIH+M8wHqff9ZXB8EGUN78=; b=mLB0nTkTGGGSMV Z7KlK9O/Nf4G+ikq5pW+pAXJ6SB8o5Ug5C3+cJW5Ei26ptyZzADit8hiajXHV1IQhf3eODowT0P+K yJ2BVLi5HYjzCN/V3D3kIsMuh23aw0TlMZMDdmULi8ZQ7z5dFewWgLgCDldhqK9oO9XV82qEaxc/q z3TONGUwcAjyeiS6iHY6RHj6f6ls1AawqtCHyGRmCzR8mg1OfuZDyIwlDryB4qLq3dudDkAHBMA6i Giewq7cX4NbxlbJggkIavkRgjNRVBFtoNj5IgrzCXE2j0IMwSkW91ZuuCXJay4XoDinLsMT6oGQjl s3pCEWdZx53O0IspvQHg==; 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 1hFxiD-0006lb-FU; Mon, 15 Apr 2019 09:15:37 +0000 Received: from 213-225-15-255.nat.highway.a1.net ([213.225.15.255] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hFxiB-0006hi-EQ; Mon, 15 Apr 2019 09:15:35 +0000 From: Christoph Hellwig To: Palmer Dabbelt Subject: [PATCH 10/11] riscv: print the unexpected interrupt cause Date: Mon, 15 Apr 2019 11:14:41 +0200 Message-Id: <20190415091442.19945-11-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190415091442.19945-1-hch@lst.de> References: <20190415091442.19945-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 Mon Apr 15 09:14: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: 10900381 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 2B42C17E1 for ; Mon, 15 Apr 2019 09:15:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F25828520 for ; Mon, 15 Apr 2019 09:15:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0373D285FD; Mon, 15 Apr 2019 09:15: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 A75C828520 for ; Mon, 15 Apr 2019 09:15:43 +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=aWPYCz8FbctY/U SdhGa+FidYHf/9Yq23nYC1eN519ZhWVRwpIplF/SQGAA69aUaGUsaDJ5O/e9Kfqg5Yq2nR9If7xM5 IqhRkJetBMLGweat7Vas3F2Xf3EFQTr/Bjy+ZuliqLlfxJOd/UY+HOSleaGUSQN5xGrVxI7fA/kuK F6zgEOFZ7wCwmxpke0uKQ+2FP40hwIzHFJts2mPJtMglZEj/9NNKjH+QMz4A9x8PhEP5hda6nvH3r ttteAldQQDTbgL6u0D7NJMe9DvMvEmcxeiKTbmxoDA5dYD615dmoGZZgRRjtFMGJEzxZT3csrU+Ec fwyA2yvCbcLKawylJvHw==; 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 1hFxiH-0006oj-Jl; Mon, 15 Apr 2019 09:15:41 +0000 Received: from 213-225-15-255.nat.highway.a1.net ([213.225.15.255] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hFxiD-0006kq-Ue; Mon, 15 Apr 2019 09:15:38 +0000 From: Christoph Hellwig To: Palmer Dabbelt Subject: [PATCH 11/11] riscv: call pm_power_off from machine_halt / machine_power_off Date: Mon, 15 Apr 2019 11:14:42 +0200 Message-Id: <20190415091442.19945-12-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190415091442.19945-1-hch@lst.de> References: <20190415091442.19945-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(); }