From patchwork Thu Apr 11 11:56:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10895819 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 0879F922 for ; Thu, 11 Apr 2019 11:56:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DE32128B0F for ; Thu, 11 Apr 2019 11:56:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D29B028B26; Thu, 11 Apr 2019 11:56: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 8B3C528B0F for ; Thu, 11 Apr 2019 11:56:52 +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=aAc70arKgDRMDq r0mX+ij8UUXiNMGCOUK0+j8KeVYNkIcbC4O9KOwrIVlkEmTfX41CJ3zq0vlY+2rujtwa3nGK0CIuo dFGIk3PQZQgtAKNKGjC/s5hNWMT1B3REpO/kB1SxRRd/7SxMhXDIVotc5Zr7LHE7AfL8JHAHC2mV3 nzwFvS1GRFP2o7k4QFHb6wZga//PIeCyARXTF7lQ9BXF0uFgkCRmOfGlMBuHN0xR6lRgHZB4t7IpT 9aV6Oyjlx93cbMIqsDlv+JN+g5zCCb9IgojGH2tFHgU3JrAllXJRQKIzcoPejzwwLEV0NBTZXxKLt KOd17hDDZd8HoADPe7EA==; 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 1hEYK1-0000rV-TQ; Thu, 11 Apr 2019 11:56:49 +0000 Received: from clnet-p19-102.ikbnet.co.at ([83.175.77.102] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hEYK1-0000q5-2v; Thu, 11 Apr 2019 11:56:49 +0000 From: Christoph Hellwig To: Palmer Dabbelt Subject: [PATCH 1/9] riscv: use asm-generic/extable.h Date: Thu, 11 Apr 2019 13:56:15 +0200 Message-Id: <20190411115623.5749-2-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190411115623.5749-1-hch@lst.de> References: <20190411115623.5749-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: 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 Reviewed-by: Paul Walmsley --- 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 Thu Apr 11 11:56:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10895821 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 89FA2922 for ; Thu, 11 Apr 2019 11:56:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C7872893C for ; Thu, 11 Apr 2019 11:56:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6102428B20; Thu, 11 Apr 2019 11:56:56 +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 215532893C for ; Thu, 11 Apr 2019 11:56:56 +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=CoOzYkk/467w8gY4dCHBtPdeSmqGFc/HJZ8Ky6anvMA=; b=kH1JKeu7zXPOxS lwuW5me9jcbi9AuGDLwTtzId/6HJdUsvoM2z+fu3AdQ6gpY2EKwG+v+wEl0ld2H0t4+vPwGR5v7Du 66HWIpv3m50UfMsYgG5xNFVH8gvSB3rKvpZzlJ5ZIyX92SjyLscXuEIlQcLP+b7zIVYu2UsIFuyA4 2B2adZqrqIOIbgvV9z+7iT+c7XRshYp9cBW5wapfXiZ1Gh6ltCDlNswgq0O2utVBZNtunUQehc/7A 9s3EOQzSRsJawMMlvs2h2KcxV461DBKOQrGDPWUjvO/UsLiZSP44kXS3g42n/+hW9xVzgyj9KnupX orLlW8US3L+i5IZQVyTQ==; 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 1hEYK5-0000wb-Kp; Thu, 11 Apr 2019 11:56:53 +0000 Received: from clnet-p19-102.ikbnet.co.at ([83.175.77.102] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hEYK3-0000rf-LA; Thu, 11 Apr 2019 11:56:52 +0000 From: Christoph Hellwig To: Palmer Dabbelt Subject: [PATCH 2/9] riscv: remove dead big endian code Date: Thu, 11 Apr 2019 13:56:16 +0200 Message-Id: <20190411115623.5749-3-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190411115623.5749-1-hch@lst.de> References: <20190411115623.5749-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: 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/uaccess.h | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/arch/riscv/include/asm/uaccess.h b/arch/riscv/include/asm/uaccess.h index cc5b253d4c57..5c50ed6f8c93 100644 --- a/arch/riscv/include/asm/uaccess.h +++ b/arch/riscv/include/asm/uaccess.h @@ -99,15 +99,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 Thu Apr 11 11:56:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10895823 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 575D3922 for ; Thu, 11 Apr 2019 11:56:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B26A2893C for ; Thu, 11 Apr 2019 11:56:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2F74128B20; Thu, 11 Apr 2019 11:56:59 +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 CD1092893C for ; Thu, 11 Apr 2019 11:56:58 +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=1+8fYtGCxnusLSfkKIVXLyLpQ8gIn8YRmodqHxmXy+s=; b=bwrt9A7WsydLTa VGiwYFR/rqu1TRwlv9ipIgxcYUtAnYZpUY5cjtE2shxHlcNVTP1Ikva7+pzNiKJ2+79I9lOtxpigi AWRtcKNNTPiC2fT9lKX4OkeUtDUvpmqqLS+4CZop98T5gHMaTLZmQOODieAtTnhydEjhC8jxfk9nT s97renoCGrAm9BxhZ9UiUzD15JpwSJoiZoyqjYBs6n+vn8meQaJGiuq/0oJKfOMWktxVwUI9ti06Q PF2kb+oewUPXsky3/GuTF7uEy7NH9f2RFStOL6/zU8B8rmrrsggbO3cm2fWt2s+EwpYhJ6WCMutt9 7Lk8+Ze3kNOLJu+6ckZw==; 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 1hEYK8-0000yz-7F; Thu, 11 Apr 2019 11:56:56 +0000 Received: from clnet-p19-102.ikbnet.co.at ([83.175.77.102] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hEYK6-0000w7-DV; Thu, 11 Apr 2019 11:56:54 +0000 From: Christoph Hellwig To: Palmer Dabbelt Subject: [PATCH 3/9] riscv: remove CONFIG_RISCV_ISA_A Date: Thu, 11 Apr 2019 13:56:17 +0200 Message-Id: <20190411115623.5749-4-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190411115623.5749-1-hch@lst.de> References: <20190411115623.5749-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: 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 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 Thu Apr 11 11:56:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10895825 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 E4DC017E0 for ; Thu, 11 Apr 2019 11:57:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C1A8728B0F for ; Thu, 11 Apr 2019 11:57:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B39DE28B20; Thu, 11 Apr 2019 11:57:01 +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 6A4D92893C for ; Thu, 11 Apr 2019 11:57:01 +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=Nkaenu02ouhL4Xqm0zR+TMADOVpDFFzrOdYEf/sFmMA=; b=phBSiha7MBc3ym YbVPmyOuvu96fNvE0BqPIa6/O3WyvorQ7zN73oORbWml3Kuyn10HDsJYPABIMFJajV3Kox/vYkm6r 8uBaYDtne8Pz2UltrzTdklhCLmfL9RKy7UbNKj5OSP/2aoeKcWOm12hZhyUjXCay1oQW2zC/3cUWn bF9M/w0NTbo3juRouVvamUJJmutcmKhrlSa01SiyuBfQS7e/Wtpg+7KYtuRSj2QKq8KU3EW2wnNhM 1ccD4lPrJrVJyWiemI2AtKw1tszSgyRgKp69gNMceC4ws+iTwuiQ4lrUdK/yg7Eq8dg9KkEKf91N3 qF+FL+a4Mcr5FyN3Envg==; 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 1hEYKA-00011T-PM; Thu, 11 Apr 2019 11:56:58 +0000 Received: from clnet-p19-102.ikbnet.co.at ([83.175.77.102] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hEYK9-0000yW-2h; Thu, 11 Apr 2019 11:56:57 +0000 From: Christoph Hellwig To: Palmer Dabbelt Subject: [PATCH 4/9] riscv: turn mm_segment_t into a struct Date: Thu, 11 Apr 2019 13:56:18 +0200 Message-Id: <20190411115623.5749-5-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190411115623.5749-1-hch@lst.de> References: <20190411115623.5749-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: 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 5c50ed6f8c93..b26f407be5c8 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 Thu Apr 11 11:56:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10895827 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 A3E3717E0 for ; Thu, 11 Apr 2019 11:57:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8317D28B20 for ; Thu, 11 Apr 2019 11:57:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7740F28B3C; Thu, 11 Apr 2019 11:57:04 +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 2572D28B20 for ; Thu, 11 Apr 2019 11:57:04 +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=+yUjb3LzGeH8jghaA+faZYsegl6M/KtNwkuD+kFxvvg=; b=trHUOTAncXhU+o YLby8do749oPgW313IH2TT+bVbrNS6oXVYP/boqX1wiq7vBY9cGkFoA+WzYatcfs80LvP119F1J2j da7uZbG9gHjYrOYtuzXaT5B9Vxm+SL5BlEec8sIuXnPzxT1lQGtJkJ0BI+Al6ndWyQrTiGBWr/hzm o4CgNLyt8wqLdc6pXx2ByTxcVB5MD9wuUwdI1emulIogLnmbxhzcfhNQuKTOHoD6ZJnCGAUbUBdFk cTWdYIHMGMLDJqTcm0+jqPUyTC+HLC1n4X09xSapB//uiH12QV34Dz9+TQA15ZtDU75FkmvtTwH3D Disu5TR5MlfQFoFQGtVw==; 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 1hEYKD-000145-DX; Thu, 11 Apr 2019 11:57:01 +0000 Received: from clnet-p19-102.ikbnet.co.at ([83.175.77.102] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hEYKB-000115-L5; Thu, 11 Apr 2019 11:57:00 +0000 From: Christoph Hellwig To: Palmer Dabbelt Subject: [PATCH 5/9] riscv: simplify stack pointer setup in head.S Date: Thu, 11 Apr 2019 13:56:19 +0200 Message-Id: <20190411115623.5749-6-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190411115623.5749-1-hch@lst.de> References: <20190411115623.5749-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: 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 fe884cd69abd..9344d9ceda24 100644 --- a/arch/riscv/kernel/head.S +++ b/arch/riscv/kernel/head.S @@ -68,10 +68,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 Thu Apr 11 11:56:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10895829 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 49044922 for ; Thu, 11 Apr 2019 11:57:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2945F28B0F for ; Thu, 11 Apr 2019 11:57:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1CE0228B26; Thu, 11 Apr 2019 11:57:06 +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 D6BCE28B0F for ; Thu, 11 Apr 2019 11:57:05 +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=QFlPu2AdsGCv2a/K/DpV0IeZ1CuZrHp2OF+PT1A2EBQ=; b=Fs/VkvoOewt8bY PnCVhWwOJ8jNaAz6leGfkvuuGG4M5zbZBC8zNJE/0zBbIopmNlKS4xhgpj6T0BPasonqq+Tixq95J O/D6bmxAzdWjDw3Y79AM0qD/Y9elhHXbxShJBndEug/1A2upZX60STeg0OFM/vFUhbiCSRtpL98Z/ O19Fvt1UQerE+BR4aem9T54xTrLpStHyV3BLyJlM3wczkkQC4jg63DUlHlwLL9b5NB1GV9BBIuE7T bTLYt4p2px4o4f7O7zvL0UHcfbfkLDEh1G7w4troXuVVxIB2vBFaTfNu1soF4TRSgEUcFmtZ8MrbW xZ63lwwQi6z8kJ8GZc7A==; 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 1hEYKF-000165-4L; Thu, 11 Apr 2019 11:57:03 +0000 Received: from clnet-p19-102.ikbnet.co.at ([83.175.77.102] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hEYKE-00013j-2w; Thu, 11 Apr 2019 11:57:02 +0000 From: Christoph Hellwig To: Palmer Dabbelt Subject: [PATCH 6/9] riscv: also clear all pending interrupts when booting Date: Thu, 11 Apr 2019 13:56:20 +0200 Message-Id: <20190411115623.5749-7-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190411115623.5749-1-hch@lst.de> References: <20190411115623.5749-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: 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 9344d9ceda24..62d2c9c85433 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 Thu Apr 11 11:56:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10895831 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 CB86C922 for ; Thu, 11 Apr 2019 11:57:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A74692893C for ; Thu, 11 Apr 2019 11:57:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9695828B20; Thu, 11 Apr 2019 11:57:09 +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 32EA12893C for ; Thu, 11 Apr 2019 11:57:09 +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=mSEHPg570dmK57ax4NbxyDF3sBuT/M1BzOrDZuCEfpk=; b=r6lqmOY4UNUjh4 T05NOKkTnHQIvcL8GwJ0q/XkU9Y6zXjpwzVYp00A1s7c3EvYFNUZ+QgVosrxT6VFJ0fsgkE9KPKQi NNIyVW+/2yx6CEalC3BNA6x2INr9kP/oKjeMLAFgsIZBpmWWKLQxBiC6XWmqE0LuGabQ21LP2yIUR nM5MmauBH7HGUMKE0cThSidIZoqzf1FpEZiiBa83gCdnw3w7pxN2RsfJBlApeC/FNo5dxM8YSCkJa h+nUTQtNxgD7BnLf60pCwfglsAp/SkbLkhY8PKRXCGY+EKcc78RDXBboZHm+JrydEtRHK2+cKsrHF 8ryfUM7ZAfAAHJOXSniA==; 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 1hEYKJ-00019p-4x; Thu, 11 Apr 2019 11:57:07 +0000 Received: from clnet-p19-102.ikbnet.co.at ([83.175.77.102] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hEYKG-000164-E7; Thu, 11 Apr 2019 11:57:04 +0000 From: Christoph Hellwig To: Palmer Dabbelt Subject: [PATCH 7/9] riscv: remove duplicate macros from ptrace.h Date: Thu, 11 Apr 2019 13:56:21 +0200 Message-Id: <20190411115623.5749-8-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190411115623.5749-1-hch@lst.de> References: <20190411115623.5749-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: 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 Reviewed-by: Nick Kossifidis Reviewed-by: Paul Walmsley --- arch/riscv/include/asm/ptrace.h | 21 ++++++--------------- arch/riscv/kernel/stacktrace.c | 8 ++++---- arch/riscv/kernel/traps.c | 2 +- 3 files changed, 11 insertions(+), 20 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 a4b1d94371a0..25fe0ff81f9e 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); @@ -83,7 +83,7 @@ static void notrace walk_stackframe(struct task_struct *task, if (regs) { sp = GET_USP(regs); - pc = GET_IP(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 24a9333dda2c..86731a2fa218 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 Thu Apr 11 11:56:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10895833 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 122031805 for ; Thu, 11 Apr 2019 11:57:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E738D2893C for ; Thu, 11 Apr 2019 11:57:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D9FEB28B20; Thu, 11 Apr 2019 11:57:12 +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 97EC42893C for ; Thu, 11 Apr 2019 11:57:12 +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=hPxqDbpYXY5cKJ9iZDuG1Y3Bge0nZQ1CxVtuyZfRnug=; b=EhqUF8xYbN7hbk R58ytaDBLEbSSi6tlvan8GhWccF3CWZgZAjSQzs0nVvYNdsh1CFaI/bOunqYq+TTYpf8oBYOoWo2m ex1FbLxgHy95olqJkK8UvKlHrJjC8Bbld4tQLRrV6WMz2VqsDMf5X/1GwvuqW9Z2Q3RbLj2qVxbh5 KcqR+0zSAj07w7jKAOZVWP0oz6fRzIIfUjOdfMYNZyPevoSkTRCY4mpH0/GGJKb+j4PCn7GfAC2q+ 7/JgISVyXNAU5i7WnwdUMHN+0UZ5+oq/Ir8vB0mZ6ZctqRXQ4euUcszgdD2QuIWi1XrWyujF5ldyU py3xVmmCCe6pD07Zkdmg==; 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 1hEYKL-0001CP-PP; Thu, 11 Apr 2019 11:57:09 +0000 Received: from clnet-p19-102.ikbnet.co.at ([83.175.77.102] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hEYKI-000190-LG; Thu, 11 Apr 2019 11:57:07 +0000 From: Christoph Hellwig To: Palmer Dabbelt Subject: [PATCH 8/9] riscv: print the unexpected interrupt cause Date: Thu, 11 Apr 2019 13:56:22 +0200 Message-Id: <20190411115623.5749-9-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190411115623.5749-1-hch@lst.de> References: <20190411115623.5749-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: 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: Paul Walmsley --- 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..b10af8ccd656 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->xcause); + BUG(); } irq_exit(); From patchwork Thu Apr 11 11:56:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10895835 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 B0F9017E0 for ; Thu, 11 Apr 2019 11:57:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 914F32893C for ; Thu, 11 Apr 2019 11:57:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 84FB928B20; Thu, 11 Apr 2019 11:57: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 2ECCE2893C for ; Thu, 11 Apr 2019 11:57: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=+f9Fp+KPcA2b+zZ385MlKrwAaK9N8IxLBg1XBPiB548=; b=jfA7IdzkYFUTrk Diy7Tk51BasRccyvfDu0TT6wLoczwu54TeI0IQOiLqg4TZbpGrDu59q1f+fe/GzPtcNlE5c/GWf+3 n9dLwMSjxyQ+vJk58xjds/RD0tRxxZl8XDxPTQUjBdjScQBbOPFzJnqSzi8o9r3R8DlCta4/jBwyq l2qmYSXrngm2D9OH8trHoFM4U5FltSPE8Tq2qGrtrQUSJA+BywEpQ7mQKGznOn04rfDesWp3E6IvW 1ElE2yI5SqIxked1L4aqVDuGoLuaE8DutEMeS/qUbuQRgnIa2kkBXv9wi5bG34cZzu9ghemOREvjk 53N55gRkIf3fjm6ThwfQ==; 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 1hEYKN-0001EO-NX; Thu, 11 Apr 2019 11:57:11 +0000 Received: from clnet-p19-102.ikbnet.co.at ([83.175.77.102] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hEYKL-0001Ad-8b; Thu, 11 Apr 2019 11:57:09 +0000 From: Christoph Hellwig To: Palmer Dabbelt Subject: [PATCH 9/9] riscv: call pm_power_off from machine_halt / machine_power_off Date: Thu, 11 Apr 2019 13:56:23 +0200 Message-Id: <20190411115623.5749-10-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190411115623.5749-1-hch@lst.de> References: <20190411115623.5749-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: 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(); }