From patchwork Mon Jun 1 09:15:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 11581761 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6ADAD92A for ; Mon, 1 Jun 2020 09:16:19 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 45C5220734 for ; Mon, 1 Jun 2020 09:16:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="LAsCJ+NP"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="Y7OvQyHb"; dkim=pass (1024-bit key) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="ySbe3Yeu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 45C5220734 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version: Content-Type:Content-Transfer-Encoding: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=F3+d5bWmeqvTvhrryR30c9HWFWaDlvIbgYTQqFLfo8Q=; b=LAsCJ+NPlkkrJgbQeJJkY71bi UtBDbDkxlLFk8KppCqqAo51+vYjB3hd1ZTWMWXuuucyDrSRVyNRsPOhpklQuhh7J+yhx0tmcTRhoJ VALq+JK5M9IZj3cTVmMQi2pkboMdlny7kP8GmyXUXqERv+tFBiSY8PbOLqslfX+jYmYfNDAKFykgI Lh9KYBCNjWF55YsbhwaQa+yF1mQy37KBjz/hD+JzK9kNArkC99By4XVcdBd4PMk0GlZxQHlqcpRqp HgLORIRVaHefK0VGswml0ayPWB+u79d2bCMjBF4/23d/0K9ojbFr/qz6Pjr7KXDEhZFypCQLSQUZD /qkZRCbFw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jfgYJ-00087h-TD; Mon, 01 Jun 2020 09:16:15 +0000 Received: from esa2.hgst.iphmx.com ([68.232.143.124]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jfgYG-00084Y-SD for linux-riscv@lists.infradead.org; Mon, 01 Jun 2020 09:16:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1591002991; x=1622538991; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=oXBz3QIOjsPX0jC03lUnIYjb1i91Mp9oQG+63oZwEUA=; b=Y7OvQyHbPybnsgXIAZD1Eds0D+YfRO/C55XteU+bZd1aJ0z1CQFThqTD JbiZPNpojdlMz6gYTottrvk0sgtSfJrlofhBxJu5oYBbOiMn0gWXb+oup V9Zr+YqK6wteTWstI0cu0B4kioMEAU3dzTNA/oPRxPYyjIX8derpwCAwm IRtsf8hvFHhfxmYtC56zDGmYaI8aaMT5fjLDjkbmC9DNQdlPW1qNU2doC 8Psrl2WQwUPch4lxz2zppb0w7/6lY4bsUnUqropKNY/nmik2nLi9qECZv pAJGirn//aSA8kHGV3fuxmQZAIUElYGNbbgMQsurSzotRrDg8VvsjDlau A==; IronPort-SDR: DSBXDChL9ZQ/C+Xjk6psca9uYr3RC/JCpjdEY7Z0NJw/NwM4Vdy3H0ULiayo04SgO1VJFQUoj2 oiDZE+XHn5c7VFYxH0QCCupb4nGETclje5+8eYL1NP0Jibo1CMLGN60Ey8le3aXpMY3If4au6R MuaF9oWraEwJKKmnfMFuyOx+yV/69CuQosEKqm6YzRojU7eQmrXJs2lIz5IAu/tOv/7a3sPBLv 3rlnfav8MylV0CB+vQdAU5QJJWCxr1tYl6WPzAi28+BlTiyIY3O2CZhLpCy6TTfs55L2fB0Q2z wBk= X-IronPort-AV: E=Sophos;i="5.73,460,1583164800"; d="scan'208";a="241785959" Received: from mail-sn1nam04lp2054.outbound.protection.outlook.com (HELO NAM04-SN1-obe.outbound.protection.outlook.com) ([104.47.44.54]) by ob1.hgst.iphmx.com with ESMTP; 01 Jun 2020 17:16:30 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZLhRk8zSWS7N5olzPFXa0o5MDbt/TpflBs6lxLvwfOwHyy6qZoWNfxM+SJ+aRjVaRZFWuqY6q/Ig+ocYl1lw9NH/uPX0wLo85gd7uqZtXroExxpiCwyksZTe88CXh6nye9Z6KTsIfqpnrr020Nfmqx0TcChHaGFxJcM2k4RyeKOcLmzn5cUzJq1cIaUKLeuXAwPo3FS7B7n8raFzzJ1nHSdZGtotjTlH7bptY0l5NWM6JIiqQHaL16XwgzuQu+BV8Jn+Zq1ZecykRCJWjDMIL+7HQSvESUV5eZeue2S3Q+OXXORnqWrA7jTmFd/EDA5fpwz0+sG8t1XO3YPvXO8faQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=F3+d5bWmeqvTvhrryR30c9HWFWaDlvIbgYTQqFLfo8Q=; b=i5Jt9ktQSnLufYvEdcqYbWcVseTH7WYeJebrTCKVkg1/sH1SwhIM4Fd1l5Si2nshm2M0ZXzlJD6hsgZyWi83m03CCk/W+QC5THiRExgdocro5NShbU/4DR4PYh0OuQnMrjFzKHqk+bCsqCOoTdpjzhiGOXxVKsAmOjAIE7YjQVGr2Ed403QX3zUyJ7O/i46Mc7ferFchXPkIO0qUx4dxl8MlHrifWjv7ISgQ9Bom2rf2Mois36ICOA3PK/R1Virzf99uHYtEHPCWJT0S6MP7/M/UJELDHUzzxoJHeLsNOgHaURY4UEtaZU9JHCGI/HcFQxaYHZEKnRyZ8oWB0ntDNg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wdc.com; dmarc=pass action=none header.from=wdc.com; dkim=pass header.d=wdc.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector2-sharedspace-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=F3+d5bWmeqvTvhrryR30c9HWFWaDlvIbgYTQqFLfo8Q=; b=ySbe3YeuzgGksCOB+8pbRsag8aW2UpyyV/kMORQK1MTPzcE1/42cv8dnc6669m6W70R0lblUMiyAdX+m15hhcQr/ZCHVjZ2dO83OitcHv6etydkHGMrH/d+IIouAyp7/G3jodUcAxPddBF0PL+sBmm9Z3feQXRD4tiNrf86sFN0= Authentication-Results: dabbelt.com; dkim=none (message not signed) header.d=none;dabbelt.com; dmarc=none action=none header.from=wdc.com; Received: from DM6PR04MB6201.namprd04.prod.outlook.com (2603:10b6:5:127::32) by DM6PR04MB6955.namprd04.prod.outlook.com (2603:10b6:5:240::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3045.19; Mon, 1 Jun 2020 09:16:11 +0000 Received: from DM6PR04MB6201.namprd04.prod.outlook.com ([fe80::f8b3:c124:482b:52e0]) by DM6PR04MB6201.namprd04.prod.outlook.com ([fe80::f8b3:c124:482b:52e0%5]) with mapi id 15.20.3045.022; Mon, 1 Jun 2020 09:16:11 +0000 From: Anup Patel To: Palmer Dabbelt , Paul Walmsley , Albert Ou , Daniel Lezcano , Thomas Gleixner , Jason Cooper , Marc Zyngier Subject: [PATCH v7 1/6] RISC-V: self-contained IPI handling routine Date: Mon, 1 Jun 2020 14:45:38 +0530 Message-Id: <20200601091543.943678-2-anup.patel@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200601091543.943678-1-anup.patel@wdc.com> References: <20200601091543.943678-1-anup.patel@wdc.com> X-ClientProxiedBy: MA1PR0101CA0016.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:21::26) To DM6PR04MB6201.namprd04.prod.outlook.com (2603:10b6:5:127::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from wdc.com (106.51.23.166) by MA1PR0101CA0016.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:21::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3045.19 via Frontend Transport; Mon, 1 Jun 2020 09:16:07 +0000 X-Mailer: git-send-email 2.25.1 X-Originating-IP: [106.51.23.166] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 14488274-f81b-4d57-c91a-08d8060c6d03 X-MS-TrafficTypeDiagnostic: DM6PR04MB6955: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: WDCIPOUTBOUND: EOP-TRUE X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-Forefront-PRVS: 0421BF7135 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9dv1/REEc7bgUc9NJ9+BczLLKasHjtP8OjQcLrtWVOe5fiySVNZyCEuWMPfVKh9mZFP2lShmdJjI5NOXU3fcZwuZN1Pk0hhBcpTrBmcYMFXYnTPVvy8o9v20ne8z+Dy3IAuqZC5Edwj3Iz6gveRx1HTDmELqY3Pkz5EXyhxfdOqPveNSB0Cx0GpC78xDVGCkjz9JkXXIxGaZEzzaWyVHEasohxEPRtOMni3Y/GNHwEzyhQ8vrrkNMIuoC6kpUGtP2juOg9MCRaYz766OY61RUWPfGJJa//iNj7XQAGGf3gEEhT1Qf/lHl3LcftJ8UAiW2SWuYrDAZbegxENAls2H9g== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR04MB6201.namprd04.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(366004)(39860400002)(136003)(396003)(346002)(376002)(2906002)(8676002)(5660300002)(956004)(2616005)(44832011)(7416002)(1076003)(55236004)(16526019)(55016002)(86362001)(186003)(66476007)(66556008)(66946007)(8936002)(26005)(6666004)(7696005)(4326008)(83380400001)(110136005)(1006002)(316002)(8886007)(478600001)(36756003)(52116002)(54906003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: NkADkk40h0p+W9PVJR1Fw1E1WpmcI6RguxnX28l75kEZYxng/SL5b/AU0ZSVif9YTHNlhmoMhv8kADSKTw8R6GDWdKYD5ZlGSuKHhJJADM49U1sym8Dl1Bup7kTXjhNRlgtdW2jpy8+oZupCLb+jJGIIP5Gl6d9ivcdaNqd+BY953sgVbXSDlSHp5cCrWThM1MWrbbypWIAkH2uwCyxZ46HoRbshfYZdU95tYwj0ywj+4sSDa6aAlbvBz8f95LReHzqEK0OXuSwGs9kNA6KZLdImrhCLSfge6nfS7ebgtn8t8tymX0Y/PuUnT20vyxSu8c+jaxgXzU5rWoggD5CxSMXiHjc/3N60SKP+aXKbzmpiwn9euaOk+da1yYzZkqMXTOQcSpiAvyAjaj6inRVyKuYIL9wTimiq9MnrHfvcMzRBItriEoThhGYMYMLOg2Ij5Vs2Itj+qElIoaGsc2bS19mLkDoUBCQLsF+5Lxu8AIw= X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 14488274-f81b-4d57-c91a-08d8060c6d03 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2020 09:16:11.2683 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: iuiJJISWQzfWDW8LBonAi0bYZFj8jPyGHmMs6Q5mDIXleqrTsfZTAJ4D5VbOdiA+KzMiKY+r9bNh2468hzZXEA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR04MB6955 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200601_021612_977882_7A83EE5E X-CRM114-Status: GOOD ( 14.49 ) X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.143.124 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 MSGID_FROM_MTA_HEADER Message-Id was added by a relay X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Palmer Dabbelt , Anup Patel , Anup Patel , linux-kernel@vger.kernel.org, Atish Patra , Alistair Francis , linux-riscv@lists.infradead.org Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org Currently, the IPI handling routine riscv_software_interrupt() does not take any argument and also does not perform irq_enter()/irq_exit(). This patch makes IPI handling routine more self-contained by: 1. Passing "pt_regs *" argument 2. Explicitly doing irq_enter()/irq_exit() 3. Explicitly save/restore "pt_regs *" using set_irq_regs() With above changes, IPI handling routine does not depend on caller function to perform irq_enter()/irq_exit() and save/restore of "pt_regs *" hence its more self-contained. This also enables us to call IPI handling routine from IRQCHIP drivers. Signed-off-by: Anup Patel Reviewed-by: Atish Patra Reviewed-by: Palmer Dabbelt Acked-by: Palmer Dabbelt --- arch/riscv/include/asm/irq.h | 1 - arch/riscv/include/asm/smp.h | 3 +++ arch/riscv/kernel/irq.c | 16 ++++++++++------ arch/riscv/kernel/smp.c | 11 +++++++++-- 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/arch/riscv/include/asm/irq.h b/arch/riscv/include/asm/irq.h index 6e1b0e0325eb..0183e15ace66 100644 --- a/arch/riscv/include/asm/irq.h +++ b/arch/riscv/include/asm/irq.h @@ -13,7 +13,6 @@ #define NR_IRQS 0 void riscv_timer_interrupt(void); -void riscv_software_interrupt(void); #include diff --git a/arch/riscv/include/asm/smp.h b/arch/riscv/include/asm/smp.h index f4c7cfda6b7f..40bb1c15a731 100644 --- a/arch/riscv/include/asm/smp.h +++ b/arch/riscv/include/asm/smp.h @@ -28,6 +28,9 @@ void show_ipi_stats(struct seq_file *p, int prec); /* SMP initialization hook for setup_arch */ void __init setup_smp(void); +/* Called from C code, this handles an IPI. */ +void handle_IPI(struct pt_regs *regs); + /* Hook for the generic smp_call_function_many() routine. */ void arch_send_call_function_ipi_mask(struct cpumask *mask); diff --git a/arch/riscv/kernel/irq.c b/arch/riscv/kernel/irq.c index 345c4f2eba13..bb0bfcd537e7 100644 --- a/arch/riscv/kernel/irq.c +++ b/arch/riscv/kernel/irq.c @@ -19,12 +19,15 @@ int arch_show_interrupts(struct seq_file *p, int prec) asmlinkage __visible void __irq_entry do_IRQ(struct pt_regs *regs) { - struct pt_regs *old_regs = set_irq_regs(regs); + struct pt_regs *old_regs; - irq_enter(); switch (regs->cause & ~CAUSE_IRQ_FLAG) { case RV_IRQ_TIMER: + old_regs = set_irq_regs(regs); + irq_enter(); riscv_timer_interrupt(); + irq_exit(); + set_irq_regs(old_regs); break; #ifdef CONFIG_SMP case RV_IRQ_SOFT: @@ -32,19 +35,20 @@ asmlinkage __visible void __irq_entry do_IRQ(struct pt_regs *regs) * We only use software interrupts to pass IPIs, so if a non-SMP * system gets one, then we don't know what to do. */ - riscv_software_interrupt(); + handle_IPI(regs); break; #endif case RV_IRQ_EXT: + old_regs = set_irq_regs(regs); + irq_enter(); handle_arch_irq(regs); + irq_exit(); + set_irq_regs(old_regs); break; default: pr_alert("unexpected interrupt cause 0x%lx", regs->cause); BUG(); } - irq_exit(); - - set_irq_regs(old_regs); } void __init init_IRQ(void) diff --git a/arch/riscv/kernel/smp.c b/arch/riscv/kernel/smp.c index a65a8fa0c22d..b1d4f452f843 100644 --- a/arch/riscv/kernel/smp.c +++ b/arch/riscv/kernel/smp.c @@ -123,11 +123,14 @@ static inline void clear_ipi(void) clint_clear_ipi(cpuid_to_hartid_map(smp_processor_id())); } -void riscv_software_interrupt(void) +void handle_IPI(struct pt_regs *regs) { + struct pt_regs *old_regs = set_irq_regs(regs); unsigned long *pending_ipis = &ipi_data[smp_processor_id()].bits; unsigned long *stats = ipi_data[smp_processor_id()].stats; + irq_enter(); + clear_ipi(); while (true) { @@ -138,7 +141,7 @@ void riscv_software_interrupt(void) ops = xchg(pending_ipis, 0); if (ops == 0) - return; + goto done; if (ops & (1 << IPI_RESCHEDULE)) { stats[IPI_RESCHEDULE]++; @@ -160,6 +163,10 @@ void riscv_software_interrupt(void) /* Order data access and bit testing. */ mb(); } + +done: + irq_exit(); + set_irq_regs(old_regs); } static const char * const ipi_names[] = { From patchwork Mon Jun 1 09:15:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 11581763 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2663F739 for ; Mon, 1 Jun 2020 09:16:24 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E9B7E20734 for ; Mon, 1 Jun 2020 09:16:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="hLqSHx4J"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="P3hgesBJ"; dkim=pass (1024-bit key) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="OOXTdk0L" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E9B7E20734 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version: Content-Type:Content-Transfer-Encoding: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=nA5tYfhSbPBVGtiPY+QOhMkAN0w2Rz//SnplTpbzNy8=; b=hLqSHx4JqFreNoYoNFJVAGDxI ZEiZj6rbC3236ZHBO+5NTAqmCOdBoqXlg2RHKT4foH3s+eWn/LVLqGYTic3zxY8oLZfMGdhRX5oIy 9/+QG8cs9jjf9E8z1UD8teiER8VgrO8M6i9jrGDD8hCer3ypo8ECJf31zGSeg35VC26ZipssazqWf VlULHUAuwY+EUVYobIuVjtVRmpv+T36fiW+22gj1xdBWA3UwHqb6wPAURDSvwzsOpG/84MGQRPAHw VBTxZHVMfT+NmacWyg0QjNuB0Ib4N4y18+dENxerNbB0oNTyczdU9T6dfzh71XQ1wR+1VZu9eIHvR IzQ4iG1Dw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jfgYP-0008DV-6u; Mon, 01 Jun 2020 09:16:21 +0000 Received: from esa2.hgst.iphmx.com ([68.232.143.124]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jfgYM-0008AD-W4 for linux-riscv@lists.infradead.org; Mon, 01 Jun 2020 09:16:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1591003001; x=1622539001; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=SuGZr4GxtABjysO9g3tQV3Q6+ZZhHD1SDX0BveqqkFY=; b=P3hgesBJMIl1aAtlZY/1AiqW9WO5ChIUASGrARTX1do0dqYaIZu4FnuJ 2rpLCIN5GVR+mxTkiSEpfy6pNzT1FNRCl0Mp5NWVl+avPyR0iXXzJu2iU TTbgyuvTiJwu43JszZIlkhjA+hwwuHeZgcgzgSAVTe0PENdvYNzClQDjL /9YPQDjW+Zdin9wVoeeS51212lAaH1YkVAObx319lL0LDjsZKdIQlqSr7 c3cZbK1itSkQqT5xQ6+clT66VBCMxcTBBcQ+31CNgY1ISExnueWePkWVY V8AAZsj9j37WkB6Qc88squmSEWcGHgz17qaRCUfhLflTk6WxTmNlL5tsH A==; IronPort-SDR: oUxd6oFysRkj5S4z73+Li5uNgNJGC3gkcyptlIHxFT8d0In5Fz63qRCeNn7PYobiJMSLf2vb92 WsmE3Txw/iK0idr1yli+aNbO6XnIPVhhOQo/nL3hFfV590zJFJAuDv8iVj9zNC51jnl9Mhj5O2 5AzGXa1QWZ1nGUeNuaC1aPiYh96qD6cEAHk5hTblYcKhSwcuu22riomjYPSSVlTAVn5PMT9QOY +Q7FX0PSe/H9Qz/voWBNRjqp1PTsnq16KVS5WqsBFJ1l7WMG5Id5kEZ4pwty/oU2qLOVIDywvD PUs= X-IronPort-AV: E=Sophos;i="5.73,460,1583164800"; d="scan'208";a="241785965" Received: from mail-sn1nam04lp2050.outbound.protection.outlook.com (HELO NAM04-SN1-obe.outbound.protection.outlook.com) ([104.47.44.50]) by ob1.hgst.iphmx.com with ESMTP; 01 Jun 2020 17:16:37 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IiuUYoVNvfJeUdBZlvDaA1xQrPQZqk3M38c2tr8MUKp2hBslhxf2sRFvozUloWehf/Y4tpc3UUd0odoj2RzbmsWWK2E3/Msqy/W8TrQaeyPQOWHwV/0Qv4KTgpZ+nqnl92LXA+M02ZD70TNDU2nGrHL+BWgS0OLWd4o5LClScoP/MfoV3jncctMsde8RqXAZ78Q3IPEMQPG2RHWlqbTOeRt65BOyBkEk1kwHJq1M07uvQ69JDI5zbh39dhODQGS9uIrEoG/y2tbukJmDjk2Cv1elmQn+D/497Dt2HxfqEsMuq4Zfcg0R5+/+cMZzxFKc1dn3kCG26TC0qNl53GslUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nA5tYfhSbPBVGtiPY+QOhMkAN0w2Rz//SnplTpbzNy8=; b=azHbuxbO1UNl1SANQjh0AfcshkQFc+qS8t+qohg2gM4qDldK8viQAPQaBE2CygDdrlccgc2Xgujq67U0u+Knyk7Ws55oJ7yfHGv4ggh/nIoxZZ6aryZvjbFvnX+gwi8jQi+jjEbfxEBfhw8YaYZlToL48jhzE7HEjYHNhNKnfi9j47FkhGTuSqFQ8z+xzcvS77BEL5Edq/UjWbzoGH12lsG/OTIvtxMwzQdmw/u1w9+HMEX8mEvSddgsBsTIRhD3aqgwrCgHGFtkwa2F5OIr4/+aLWD4jAsNl//tLWQp87HFE6hxXIwnUiWxW3ewzCWu6HhwIWPBwK+dRoI95F512g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wdc.com; dmarc=pass action=none header.from=wdc.com; dkim=pass header.d=wdc.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector2-sharedspace-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nA5tYfhSbPBVGtiPY+QOhMkAN0w2Rz//SnplTpbzNy8=; b=OOXTdk0LiyyYRkfmVf4rzHfh6BvYsDPx82r0soSZ90Gtg9mnLx0I//7mjnHCiSM/CmZPN2r0pf1AzhK6LZrDNeK5ziPyPXO0akJZBgm7UkmUaIlIs9jnQowYM+QkU0LpLVVU3gMpQgjoISAQsDVU0oB18ZPXc3gCfSHd2MvBN5Y= Authentication-Results: dabbelt.com; dkim=none (message not signed) header.d=none;dabbelt.com; dmarc=none action=none header.from=wdc.com; Received: from DM6PR04MB6201.namprd04.prod.outlook.com (2603:10b6:5:127::32) by DM6PR04MB6955.namprd04.prod.outlook.com (2603:10b6:5:240::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3045.19; Mon, 1 Jun 2020 09:16:16 +0000 Received: from DM6PR04MB6201.namprd04.prod.outlook.com ([fe80::f8b3:c124:482b:52e0]) by DM6PR04MB6201.namprd04.prod.outlook.com ([fe80::f8b3:c124:482b:52e0%5]) with mapi id 15.20.3045.022; Mon, 1 Jun 2020 09:16:16 +0000 From: Anup Patel To: Palmer Dabbelt , Paul Walmsley , Albert Ou , Daniel Lezcano , Thomas Gleixner , Jason Cooper , Marc Zyngier Subject: [PATCH v7 2/6] RISC-V: Rename and move plic_find_hart_id() to arch directory Date: Mon, 1 Jun 2020 14:45:39 +0530 Message-Id: <20200601091543.943678-3-anup.patel@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200601091543.943678-1-anup.patel@wdc.com> References: <20200601091543.943678-1-anup.patel@wdc.com> X-ClientProxiedBy: MA1PR0101CA0016.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:21::26) To DM6PR04MB6201.namprd04.prod.outlook.com (2603:10b6:5:127::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from wdc.com (106.51.23.166) by MA1PR0101CA0016.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:21::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3045.19 via Frontend Transport; Mon, 1 Jun 2020 09:16:11 +0000 X-Mailer: git-send-email 2.25.1 X-Originating-IP: [106.51.23.166] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 6b65d666-3bc2-4466-ac1d-08d8060c6faa X-MS-TrafficTypeDiagnostic: DM6PR04MB6955: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: WDCIPOUTBOUND: EOP-TRUE X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-Forefront-PRVS: 0421BF7135 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KLnKL1emSXAFWlMpm5qOlDs4hC+Oig0wTxfnvzyOJ8jd1afRlpjq2VyPGaYzvUVH5yY5yzs0W+npw5r1wn+03O8YAYQM+RmGcbsVMSNpcV0LiSsvENH3L4ML3MdDVBJLMarDHCVI8QBiAoT5sTekx/CsbH6Ih9S3j1kDADyknejGhi8zSjDnS/Xr7YnnHn1dxRZ1AwTPKufUKm+UYBeOYm1+jxn63nCT3eK0lTv5LDn/NOTZ4F2xompiGt6/PNHMqpa2XdzsgCg+nI5TgvSqtxf4x0d+GrnS/8bDFbZq+4GbQKGnJnW3/yrgrfUp+wGi X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR04MB6201.namprd04.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(366004)(39860400002)(136003)(396003)(346002)(376002)(2906002)(8676002)(5660300002)(956004)(2616005)(44832011)(7416002)(1076003)(55236004)(16526019)(55016002)(86362001)(186003)(66476007)(66556008)(66946007)(8936002)(26005)(6666004)(7696005)(4326008)(83380400001)(110136005)(1006002)(316002)(8886007)(478600001)(36756003)(52116002)(54906003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: a1Vekgx97efoOT2cnhO45Os5W5GbTzcRGzdN2sVyMDba1N/7XquEfGfiUcRA8WM4RRyFhROxteQ3fRw4gFspr0nuwtd45NfCt8PEQhOk/xVjw/ZZJR8cUjMP4fkiwn+CMs+F5xVEwOv3+CGPB2Z5rDGFCng4ANu3GLKkCb8G3UFU7HicSoFm3cIVswUEukhqapOso6bkFPJj4OaNYy8hByYGFo2/r2vWErURbn1MvwwUBBPK0IioOxsEkz+f3dgizbyXL7rth3+fB++EIbcLQPYbuvqEYVh8HJzMIHkBIwJy1ZD0iBFd5g1EzATNG3WguYIFtV+xLl3PmizKmWFmJJUwhx2APP292tYOTPzc5bVQE5aGKkGv6Muoc5xBYbexo2WuVitdbDAXgfBMYgqvl3wCru5cGhe16t94x8XzWGGxnGOxWgNfLIjsu11siDyhxBbdcIpvRvGyhYjAFfWCqIa9iyfvz7PIjtlkMoolA7o= X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6b65d666-3bc2-4466-ac1d-08d8060c6faa X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2020 09:16:15.9543 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: gr4YXpfrVkSqkVFbIoKEAjQ6/RDy3ynMnTbGXpvQsPOF0btxrcgQXtVAxiLpfxyLmLt46CIqKTJ2dV2T3usLoQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR04MB6955 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200601_021619_172227_D75CFAEE X-CRM114-Status: GOOD ( 14.63 ) X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.143.124 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 MSGID_FROM_MTA_HEADER Message-Id was added by a relay X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Palmer Dabbelt , Anup Patel , Anup Patel , linux-kernel@vger.kernel.org, Atish Patra , Alistair Francis , linux-riscv@lists.infradead.org Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org The plic_find_hart_id() can be useful to other interrupt controller drivers (such as RISC-V local interrupt driver) so we rename this function to riscv_of_parent_hartid() and place it in arch directory along with riscv_of_processor_hartid(). Signed-off-by: Anup Patel Reviewed-by: Atish Patra Reviewed-by: Palmer Dabbelt Acked-by: Palmer Dabbelt --- arch/riscv/include/asm/processor.h | 1 + arch/riscv/kernel/cpu.c | 16 ++++++++++++++++ drivers/irqchip/irq-sifive-plic.c | 16 +--------------- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/arch/riscv/include/asm/processor.h b/arch/riscv/include/asm/processor.h index 3ddb798264f1..b1efd840003c 100644 --- a/arch/riscv/include/asm/processor.h +++ b/arch/riscv/include/asm/processor.h @@ -75,6 +75,7 @@ static inline void wait_for_interrupt(void) struct device_node; int riscv_of_processor_hartid(struct device_node *node); +int riscv_of_parent_hartid(struct device_node *node); extern void riscv_fill_hwcap(void); diff --git a/arch/riscv/kernel/cpu.c b/arch/riscv/kernel/cpu.c index 40a3c442ac5f..6d59e6906fdd 100644 --- a/arch/riscv/kernel/cpu.c +++ b/arch/riscv/kernel/cpu.c @@ -44,6 +44,22 @@ int riscv_of_processor_hartid(struct device_node *node) return hart; } +/* + * Find hart ID of the CPU DT node under which given DT node falls. + * + * To achieve this, we walk up the DT tree until we find an active + * RISC-V core (HART) node and extract the cpuid from it. + */ +int riscv_of_parent_hartid(struct device_node *node) +{ + for (; node; node = node->parent) { + if (of_device_is_compatible(node, "riscv")) + return riscv_of_processor_hartid(node); + } + + return -1; +} + #ifdef CONFIG_PROC_FS static void print_isa(struct seq_file *f, const char *isa) diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c index d9c53f85a68e..16d31d114c30 100644 --- a/drivers/irqchip/irq-sifive-plic.c +++ b/drivers/irqchip/irq-sifive-plic.c @@ -240,20 +240,6 @@ static void plic_handle_irq(struct pt_regs *regs) csr_set(CSR_IE, IE_EIE); } -/* - * Walk up the DT tree until we find an active RISC-V core (HART) node and - * extract the cpuid from it. - */ -static int plic_find_hart_id(struct device_node *node) -{ - for (; node; node = node->parent) { - if (of_device_is_compatible(node, "riscv")) - return riscv_of_processor_hartid(node); - } - - return -1; -} - static void plic_set_threshold(struct plic_handler *handler, u32 threshold) { /* priority must be > threshold to trigger an interrupt */ @@ -330,7 +316,7 @@ static int __init plic_init(struct device_node *node, if (parent.args[0] != RV_IRQ_EXT) continue; - hartid = plic_find_hart_id(parent.np); + hartid = riscv_of_parent_hartid(parent.np); if (hartid < 0) { pr_warn("failed to parse hart ID for context %d.\n", i); continue; From patchwork Mon Jun 1 09:15:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 11581765 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8919392A for ; Mon, 1 Jun 2020 09:16:31 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 632F42076B for ; Mon, 1 Jun 2020 09:16:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ibPDmXdi"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="atoXp1pA"; dkim=pass (1024-bit key) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="sN57EK3D" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 632F42076B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version: Content-Type:Content-Transfer-Encoding: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=VQQrfVMP4fdLktHrOljRuHKzGbwXjWS6egfp6+GDU0Q=; b=ibPDmXdiLNFc3r9AQLiRLsvxR kcaTMSzuojESWJ1jtFRmEyQUW82TvF4CzOe0XTYgUhNH0D8ORzoTM4HoXTt2rLgr23iEvgf7h4tCv DBxGLAluqRA0hpSWpd6HkHANozWlwhkoOPk20yMKGLLpApj+XDvrpE4fhKOooU+L58bYz1IGr6K7K 88Mfonozlbr4iCCy5znazZpqUf/wQPKVUgyzKW2Uih4F2qYJtAgRc9E+L/payqA6k7oqIl6pxZV5H W2wV+HCY4y//Ag3QYESxCqftVvP3c0VLRMRmGRieMu2Vp+N5q9aHRTgqI9ezlMl8L5gdNAd+qgdK+ CSq/hO1vQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jfgYV-0008K3-1p; Mon, 01 Jun 2020 09:16:27 +0000 Received: from esa2.hgst.iphmx.com ([68.232.143.124]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jfgYQ-0008AD-AG for linux-riscv@lists.infradead.org; Mon, 01 Jun 2020 09:16:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1591003006; x=1622539006; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=hxs9PmwiPAKueF0h25n/ebeWpVuA9ACd7yyjIXZKgoE=; b=atoXp1pAwAGaxGf9KbNI1pGwWH021JAVg1xwrtuJBbN4HB+ep5kHXEjQ 29z1sX51v/Yafdrqpi48stjtxliEQhnZNtDAI2cUt4Q/QqQk11PyXsg5n DGb4g1PAc3KaX6HQ1x4gGuEzhwU7WvPArRYmRP5p1pd6MIUDCG5O7fS4Z ZzDuPI89DnR96PBNGQ8CT3OgV0MQf4HaMhp3mf4H2oZc2Fj04WCRVEnIo fAJ46PZEgwRs8RtC6Q0fysQgNJtBlAPlcpnYxBDj0N4dLtCjigxZqk40D R4sX5H933A6qi2Ymm4zYRX9H+VD48q5DYkBjtfV5b5PBbpPN3YSA99yRC A==; IronPort-SDR: xgnvj/EZ9XOmUi4p0DVEHeD3Dsu2EEGGUXAXaDlvCsXgNDy9QakRYtk1jc5Jkbrs+nVkAsbJrI bynayQLfWyDCHCqp0FdNg3Yx9Nlus95q3MPylN9YjdeaofnfUUxLC/7YQP8XkRnL0Le5x8NKvR AsLVENBGvR7EN7Ljy4T3bTc9riQHoxcVD42QAk1pzii3hbgfmNSiOb/MXOt9EypKLBxIGGzhtc h0KkuWaLrPmfw5oVIn0MyDnPiYwSUkuA4YXfpSIz9phOjJuwHZ7RFA2+02akMuDCTufwsvnIPP uUs= X-IronPort-AV: E=Sophos;i="5.73,460,1583164800"; d="scan'208";a="241785975" Received: from mail-sn1nam04lp2051.outbound.protection.outlook.com (HELO NAM04-SN1-obe.outbound.protection.outlook.com) ([104.47.44.51]) by ob1.hgst.iphmx.com with ESMTP; 01 Jun 2020 17:16:44 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JQS5D9lXeLocdSD7SWVqL1cPOMFN7giUuWhkykwOmc+nO7u6VFdtFO5JSHWQkzcGSyJWRtkFFZ3KqDEa5mpVjY64jOeJlFMOnVf9L/lzaddqN/GjsKOIsAukNBMPNtOMGBmqu100MNzQgi0pyZ39+wPAGi/KPlCM2aJYynbb+XaSfWIpUpG3Re3Rb3/e7osTkWk9ZT+ShbSbUGEDsximluGVD8jKnSS1dF1eHe+uu8+wU3q2oXAYTsCioT7Ugjl5FW8jTHR3/4Nf2QjJQEgG3k/VVDSyaJs9JhDvu16SaFRgpsKgZJQtYySVnmpyqpIwMDC2/Lap176RbYgn722laQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VQQrfVMP4fdLktHrOljRuHKzGbwXjWS6egfp6+GDU0Q=; b=eMcawFQu4tdR5YHgp7r/rjf47ohaXPd8zuWIeTHHS6MB66OTIOAdn5va8yympH0hQeol3X48A98PzDTGErSUMPb5IH2rIWHlLds4HhXRbqV0wn93oKPcv1/prZik0cugoHemh3P42Wyv7fd+p6HAfq1sbL4uf5IliMg4JdEsQb9rNVdLoEqsSlyKz3I0JrZ2lGWK2cy4HWzjQS81qeW/Rfu5HLSgBiec5s8Lp4WZqwgZHGxY/gmi13tiP/UiFNfgZ3l+rg00Ob6Nl0RLlpl1mhc2vk/lAcw6lrif9OaIuH7Vk7k6vmh8byf76XIoE5z48L9TIjoaI9UpL6pydyn3sg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wdc.com; dmarc=pass action=none header.from=wdc.com; dkim=pass header.d=wdc.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector2-sharedspace-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VQQrfVMP4fdLktHrOljRuHKzGbwXjWS6egfp6+GDU0Q=; b=sN57EK3DrNdeAiX99ux3W+tm/a+IoaGUK9NhLsbxKwAsAihBX2sZEKf//lyd3bMpHTBKOOL1DOp+WWe7ohF/We0v+XnPSqDtJpd6S8OcmystSJZ3ebMosbfKw7aoSCt/IOBePcYjHzf0DwaRSiaE5DBRM/gZdl6LIv4YGt7Z5+A= Authentication-Results: dabbelt.com; dkim=none (message not signed) header.d=none;dabbelt.com; dmarc=none action=none header.from=wdc.com; Received: from DM6PR04MB6201.namprd04.prod.outlook.com (2603:10b6:5:127::32) by DM6PR04MB6955.namprd04.prod.outlook.com (2603:10b6:5:240::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3045.19; Mon, 1 Jun 2020 09:16:20 +0000 Received: from DM6PR04MB6201.namprd04.prod.outlook.com ([fe80::f8b3:c124:482b:52e0]) by DM6PR04MB6201.namprd04.prod.outlook.com ([fe80::f8b3:c124:482b:52e0%5]) with mapi id 15.20.3045.022; Mon, 1 Jun 2020 09:16:20 +0000 From: Anup Patel To: Palmer Dabbelt , Paul Walmsley , Albert Ou , Daniel Lezcano , Thomas Gleixner , Jason Cooper , Marc Zyngier Subject: [PATCH v7 3/6] irqchip: RISC-V per-HART local interrupt controller driver Date: Mon, 1 Jun 2020 14:45:40 +0530 Message-Id: <20200601091543.943678-4-anup.patel@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200601091543.943678-1-anup.patel@wdc.com> References: <20200601091543.943678-1-anup.patel@wdc.com> X-ClientProxiedBy: MA1PR0101CA0016.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:21::26) To DM6PR04MB6201.namprd04.prod.outlook.com (2603:10b6:5:127::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from wdc.com (106.51.23.166) by MA1PR0101CA0016.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:21::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3045.19 via Frontend Transport; Mon, 1 Jun 2020 09:16:16 +0000 X-Mailer: git-send-email 2.25.1 X-Originating-IP: [106.51.23.166] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: f190e6b2-ea39-481e-d1c6-08d8060c7270 X-MS-TrafficTypeDiagnostic: DM6PR04MB6955: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: WDCIPOUTBOUND: EOP-TRUE X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-Forefront-PRVS: 0421BF7135 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pbuemNA+BJG1uBUIkEs3Y5+RVnJkqwt/+4kv7GyEHFjHvgsnlAV+HlURsOR7IuAuF41wp8c0gmZx2D6Gar89OnXPN5K6sELiEeNeBHB+JSkkM1ylvdclUqcwdxR+xGvzjN3PPEbNxatV63orkmKKBcfB2VvvC6vUMB0gxuT+MBwDcrGCthdt90qTE2m2b3ykQuBsGLQfeOvbYtGUy1GPpo0FBakqLQU6sp2deNrqgXeWviKcLZSv2X5bAsNFDDa9gBJcyzV6G7JHYRniMqYPOmAa3A9d+yGJmil+SfVFxkPAyJ/itRbnw50CF3va6NslZ77+d/BCZyTS27G42aKUVg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR04MB6201.namprd04.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(366004)(39860400002)(136003)(396003)(346002)(376002)(30864003)(2906002)(8676002)(5660300002)(956004)(2616005)(44832011)(7416002)(1076003)(55236004)(16526019)(55016002)(86362001)(186003)(66476007)(66556008)(66946007)(8936002)(26005)(6666004)(7696005)(4326008)(83380400001)(110136005)(1006002)(316002)(8886007)(478600001)(36756003)(52116002)(54906003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: a6efj+q6JEL8nqwW0azxUxpOApKBN6jTsKg7bP9Ulr0HMWEzJREO7G92ppRVMtPcUHIYIAJBiQucjag1vyNtp1argOO8FGb+Ev+1XozjskRq/VRloZp0vhPbk8ewdthxGWqMeeiMog+jfLDvW88EwdfShBmEcFSNgfib7J7tZrsBfIoKOfNM8ksxDcypQ0D6NHD7nq3v//UXNNUj2o86qq0Nt8QHfencqGKRKCIbcDF1uI4SCoJQos3Iz2+oTz257qaGN6cFt3wC7mclv5v75WqelMc8Bliw0LenLF7572+XItiqD1C3Ya0Xm9Vab7nhykgsQpwKfBWg9ZEESjP1Wigvk0yIvyueyUOU39PzYlKdgmfJ+pkhvVTNSm7c7IVZLTDx5rLNRjQWI0kUmn984TSMB+tgJCH+rbM6c3K9qcFjINlIuZiWOyepOIY8E/2Vz6UCIQZTFDRxFwH+rDoXUeYoP9uLtu4obN3gmqppCIY= X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: f190e6b2-ea39-481e-d1c6-08d8060c7270 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2020 09:16:20.5063 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: VfElodK2F/Cm2dql1dA8mN7wWmJrhKC/NEy+rlvZrD53RRPVC6OKCzebvDr5/wtBNLIQ4dE89ZAl4cjmh2CNfg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR04MB6955 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200601_021622_733847_158D2C10 X-CRM114-Status: GOOD ( 22.48 ) X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.143.124 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 MSGID_FROM_MTA_HEADER Message-Id was added by a relay X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Palmer Dabbelt , Anup Patel , Anup Patel , linux-kernel@vger.kernel.org, Atish Patra , Alistair Francis , linux-riscv@lists.infradead.org Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org The RISC-V per-HART local interrupt controller manages software interrupts, timer interrupts, external interrupts (which are routed via the platform level interrupt controller) and other per-HART local interrupts. We add a driver for the RISC-V local interrupt controller, which eventually replaces the RISC-V architecture code, allowing for a better split between arch code and drivers. The driver is compliant with RISC-V Hart-Level Interrupt Controller DT bindings located at: Documentation/devicetree/bindings/interrupt-controller/riscv,cpu-intc.txt Co-developed-by: Palmer Dabbelt Signed-off-by: Palmer Dabbelt Signed-off-by: Anup Patel Acked-by: Palmer Dabbelt Reviewed-by: Marc Zyngier Reviewed-by: Atish Patra --- arch/riscv/Kconfig | 1 + arch/riscv/include/asm/irq.h | 2 - arch/riscv/kernel/irq.c | 33 +------ arch/riscv/kernel/traps.c | 2 - drivers/irqchip/Kconfig | 13 +++ drivers/irqchip/Makefile | 1 + drivers/irqchip/irq-riscv-intc.c | 146 ++++++++++++++++++++++++++++++ drivers/irqchip/irq-sifive-plic.c | 30 ++++-- include/linux/cpuhotplug.h | 1 + 9 files changed, 188 insertions(+), 41 deletions(-) create mode 100644 drivers/irqchip/irq-riscv-intc.c diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 90a008e28f7e..822cb0e1a380 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -40,6 +40,7 @@ config RISCV select HAVE_PERF_REGS select HAVE_PERF_USER_STACK_DUMP select HAVE_SYSCALL_TRACEPOINTS + select HANDLE_DOMAIN_IRQ select IRQ_DOMAIN select SPARSE_IRQ select SYSCTL_EXCEPTION_TRACE diff --git a/arch/riscv/include/asm/irq.h b/arch/riscv/include/asm/irq.h index 0183e15ace66..a9e5f07a7e9c 100644 --- a/arch/riscv/include/asm/irq.h +++ b/arch/riscv/include/asm/irq.h @@ -10,8 +10,6 @@ #include #include -#define NR_IRQS 0 - void riscv_timer_interrupt(void); #include diff --git a/arch/riscv/kernel/irq.c b/arch/riscv/kernel/irq.c index bb0bfcd537e7..eb8777642ce6 100644 --- a/arch/riscv/kernel/irq.c +++ b/arch/riscv/kernel/irq.c @@ -7,7 +7,6 @@ #include #include -#include #include #include @@ -19,39 +18,13 @@ int arch_show_interrupts(struct seq_file *p, int prec) asmlinkage __visible void __irq_entry do_IRQ(struct pt_regs *regs) { - struct pt_regs *old_regs; - - switch (regs->cause & ~CAUSE_IRQ_FLAG) { - case RV_IRQ_TIMER: - old_regs = set_irq_regs(regs); - irq_enter(); - riscv_timer_interrupt(); - irq_exit(); - set_irq_regs(old_regs); - break; -#ifdef CONFIG_SMP - case RV_IRQ_SOFT: - /* - * We only use software interrupts to pass IPIs, so if a non-SMP - * system gets one, then we don't know what to do. - */ - handle_IPI(regs); - break; -#endif - case RV_IRQ_EXT: - old_regs = set_irq_regs(regs); - irq_enter(); + if (handle_arch_irq) handle_arch_irq(regs); - irq_exit(); - set_irq_regs(old_regs); - break; - default: - pr_alert("unexpected interrupt cause 0x%lx", regs->cause); - BUG(); - } } void __init init_IRQ(void) { irqchip_init(); + if (!handle_arch_irq) + panic("No interrupt controller found."); } diff --git a/arch/riscv/kernel/traps.c b/arch/riscv/kernel/traps.c index 7f58fa53033f..f48c76aadbf3 100644 --- a/arch/riscv/kernel/traps.c +++ b/arch/riscv/kernel/traps.c @@ -178,6 +178,4 @@ void trap_init(void) csr_write(CSR_SCRATCH, 0); /* Set the exception vector address */ csr_write(CSR_TVEC, &handle_exception); - /* Enable interrupts */ - csr_write(CSR_IE, IE_SIE); } diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig index a85aada04a64..95d6137a8117 100644 --- a/drivers/irqchip/Kconfig +++ b/drivers/irqchip/Kconfig @@ -493,6 +493,19 @@ config TI_SCI_INTA_IRQCHIP If you wish to use interrupt aggregator irq resources managed by the TI System Controller, say Y here. Otherwise, say N. +config RISCV_INTC + bool "RISC-V Local Interrupt Controller" + depends on RISCV + default y + help + This enables support for the per-HART local interrupt controller + found in standard RISC-V systems. The per-HART local interrupt + controller handles timer interrupts, software interrupts, and + hardware interrupts. Without a per-HART local interrupt controller, + a RISC-V system will be unable to handle any interrupts. + + If you don't know what to do here, say Y. + config SIFIVE_PLIC bool "SiFive Platform-Level Interrupt Controller" depends on RISCV diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile index 37bbe39bf909..b8319f045472 100644 --- a/drivers/irqchip/Makefile +++ b/drivers/irqchip/Makefile @@ -98,6 +98,7 @@ obj-$(CONFIG_NDS32) += irq-ativic32.o obj-$(CONFIG_QCOM_PDC) += qcom-pdc.o obj-$(CONFIG_CSKY_MPINTC) += irq-csky-mpintc.o obj-$(CONFIG_CSKY_APB_INTC) += irq-csky-apb-intc.o +obj-$(CONFIG_RISCV_INTC) += irq-riscv-intc.o obj-$(CONFIG_SIFIVE_PLIC) += irq-sifive-plic.o obj-$(CONFIG_IMX_IRQSTEER) += irq-imx-irqsteer.o obj-$(CONFIG_IMX_INTMUX) += irq-imx-intmux.o diff --git a/drivers/irqchip/irq-riscv-intc.c b/drivers/irqchip/irq-riscv-intc.c new file mode 100644 index 000000000000..a80fb1731c50 --- /dev/null +++ b/drivers/irqchip/irq-riscv-intc.c @@ -0,0 +1,146 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2012 Regents of the University of California + * Copyright (C) 2017-2018 SiFive + * Copyright (C) 2020 Western Digital Corporation or its affiliates. + */ + +#define pr_fmt(fmt) "riscv-intc: " fmt +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static struct irq_domain *intc_domain; + +static asmlinkage void riscv_intc_irq(struct pt_regs *regs) +{ + struct pt_regs *old_regs; + unsigned long cause = regs->cause & ~CAUSE_IRQ_FLAG; + + if (unlikely(cause >= BITS_PER_LONG)) + panic("unexpected interrupt cause"); + + switch (cause) { + case RV_IRQ_TIMER: + old_regs = set_irq_regs(regs); + irq_enter(); + riscv_timer_interrupt(); + irq_exit(); + set_irq_regs(old_regs); + break; +#ifdef CONFIG_SMP + case RV_IRQ_SOFT: + /* + * We only use software interrupts to pass IPIs, so if a + * non-SMP system gets one, then we don't know what to do. + */ + handle_IPI(regs); + break; +#endif + default: + handle_domain_irq(intc_domain, cause, regs); + break; + } +} + +/* + * On RISC-V systems local interrupts are masked or unmasked by writing + * the SIE (Supervisor Interrupt Enable) CSR. As CSRs can only be written + * on the local hart, these functions can only be called on the hart that + * corresponds to the IRQ chip. + */ + +static void riscv_intc_irq_mask(struct irq_data *d) +{ + csr_clear(CSR_IE, BIT(d->hwirq)); +} + +static void riscv_intc_irq_unmask(struct irq_data *d) +{ + csr_set(CSR_IE, BIT(d->hwirq)); +} + +static int riscv_intc_cpu_starting(unsigned int cpu) +{ + csr_set(CSR_IE, BIT(RV_IRQ_SOFT)); + return 0; +} + +static int riscv_intc_cpu_dying(unsigned int cpu) +{ + csr_clear(CSR_IE, BIT(RV_IRQ_SOFT)); + return 0; +} + +static struct irq_chip riscv_intc_chip = { + .name = "RISC-V INTC", + .irq_mask = riscv_intc_irq_mask, + .irq_unmask = riscv_intc_irq_unmask, +}; + +static int riscv_intc_domain_map(struct irq_domain *d, unsigned int irq, + irq_hw_number_t hwirq) +{ + irq_set_percpu_devid(irq); + irq_domain_set_info(d, irq, hwirq, &riscv_intc_chip, d->host_data, + handle_percpu_devid_irq, NULL, NULL); + + return 0; +} + +static const struct irq_domain_ops riscv_intc_domain_ops = { + .map = riscv_intc_domain_map, + .xlate = irq_domain_xlate_onecell, +}; + +static int __init riscv_intc_init(struct device_node *node, + struct device_node *parent) +{ + int rc, hartid; + + hartid = riscv_of_parent_hartid(node); + if (hartid < 0) { + pr_warn("unable to fine hart id for %pOF\n", node); + return 0; + } + + /* + * The DT will have one INTC DT node under each CPU (or HART) + * DT node so riscv_intc_init() function will be called once + * for each INTC DT node. We only need to do INTC initialization + * for the INTC DT node belonging to boot CPU (or boot HART). + */ + if (riscv_hartid_to_cpuid(hartid) != smp_processor_id()) + return 0; + + intc_domain = irq_domain_add_linear(node, BITS_PER_LONG, + &riscv_intc_domain_ops, NULL); + if (!intc_domain) { + pr_err("unable to add IRQ domain\n"); + return -ENXIO; + } + + rc = set_handle_irq(&riscv_intc_irq); + if (rc) { + pr_err("failed to set irq handler\n"); + return rc; + } + + cpuhp_setup_state(CPUHP_AP_IRQ_RISCV_STARTING, + "irqchip/riscv/intc:starting", + riscv_intc_cpu_starting, + riscv_intc_cpu_dying); + + pr_info("%d local interrupts mapped\n", BITS_PER_LONG); + + return 0; +} + +IRQCHIP_DECLARE(riscv, "riscv,cpu-intc", riscv_intc_init); diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c index 16d31d114c30..14a54e444e6a 100644 --- a/drivers/irqchip/irq-sifive-plic.c +++ b/drivers/irqchip/irq-sifive-plic.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -76,6 +77,7 @@ struct plic_handler { void __iomem *enable_base; struct plic_priv *priv; }; +static int plic_parent_irq; static bool plic_cpuhp_setup_done; static DEFINE_PER_CPU(struct plic_handler, plic_handlers); @@ -219,15 +221,17 @@ static const struct irq_domain_ops plic_irqdomain_ops = { * that source ID back to the same claim register. This automatically enables * and disables the interrupt, so there's nothing else to do. */ -static void plic_handle_irq(struct pt_regs *regs) +static void plic_handle_irq(struct irq_desc *desc) { struct plic_handler *handler = this_cpu_ptr(&plic_handlers); + struct irq_chip *chip = irq_desc_get_chip(desc); void __iomem *claim = handler->hart_base + CONTEXT_CLAIM; irq_hw_number_t hwirq; WARN_ON_ONCE(!handler->present); - csr_clear(CSR_IE, IE_EIE); + chained_irq_enter(chip, desc); + while ((hwirq = readl(claim))) { int irq = irq_find_mapping(handler->priv->irqdomain, hwirq); @@ -237,7 +241,8 @@ static void plic_handle_irq(struct pt_regs *regs) else generic_handle_irq(irq); } - csr_set(CSR_IE, IE_EIE); + + chained_irq_exit(chip, desc); } static void plic_set_threshold(struct plic_handler *handler, u32 threshold) @@ -250,8 +255,8 @@ static int plic_dying_cpu(unsigned int cpu) { struct plic_handler *handler = this_cpu_ptr(&plic_handlers); - csr_clear(CSR_IE, IE_EIE); - plic_set_threshold(handler, PLIC_DISABLE_THRESHOLD); + if (plic_parent_irq) + disable_percpu_irq(plic_parent_irq); return 0; } @@ -260,7 +265,11 @@ static int plic_starting_cpu(unsigned int cpu) { struct plic_handler *handler = this_cpu_ptr(&plic_handlers); - csr_set(CSR_IE, IE_EIE); + if (plic_parent_irq) + enable_percpu_irq(plic_parent_irq, + irq_get_trigger_type(plic_parent_irq)); + else + pr_warn("cpu%d: parent irq not available\n", cpu); plic_set_threshold(handler, PLIC_ENABLE_THRESHOLD); return 0; @@ -328,6 +337,14 @@ static int __init plic_init(struct device_node *node, continue; } + /* Find parent domain and register chained handler */ + if (!plic_parent_irq && irq_find_host(parent.np)) { + plic_parent_irq = irq_of_parse_and_map(node, i); + if (plic_parent_irq) + irq_set_chained_handler(plic_parent_irq, + plic_handle_irq); + } + /* * When running in M-mode we need to ignore the S-mode handler. * Here we assume it always comes later, but that might be a @@ -368,7 +385,6 @@ static int __init plic_init(struct device_node *node, pr_info("%pOFP: mapped %d interrupts with %d handlers for" " %d contexts.\n", node, nr_irqs, nr_handlers, nr_contexts); - set_handle_irq(plic_handle_irq); return 0; out_iounmap: diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h index 77d70b633531..57b1f8f777d9 100644 --- a/include/linux/cpuhotplug.h +++ b/include/linux/cpuhotplug.h @@ -102,6 +102,7 @@ enum cpuhp_state { CPUHP_AP_IRQ_ARMADA_XP_STARTING, CPUHP_AP_IRQ_BCM2836_STARTING, CPUHP_AP_IRQ_MIPS_GIC_STARTING, + CPUHP_AP_IRQ_RISCV_STARTING, CPUHP_AP_IRQ_SIFIVE_PLIC_STARTING, CPUHP_AP_ARM_MVEBU_COHERENCY, CPUHP_AP_MICROCODE_LOADER, From patchwork Mon Jun 1 09:15:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 11581767 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DB013157C for ; Mon, 1 Jun 2020 09:16:31 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B601F207ED for ; Mon, 1 Jun 2020 09:16:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="QGZQOtwU"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="jJznTPlm"; dkim=pass (1024-bit key) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="gLW4Ku12" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B601F207ED Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version: Content-Type:Content-Transfer-Encoding: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=hKZhQmZDOG+euq54bpMuvjQosucj9aRHq1lg7qbdL5M=; b=QGZQOtwUnFBgefwGXwgmlZVPR ACsDJ8TpcGZlvobq7sT6pICcjmdQzC/y349gjAdGBNQPd0Y89QDpryoXbuFOTCbTHPwzQyTB42mLr uRQngzJV+udVAwPe8qjleMPx2x2i4tRR6QAhJq328ZhwgYj34AGdecQxtV3JZ+Wt0HX1q8fpVtKBw /wh+2YetmoDOQArYK1I2wTeBt0MC5xLgc1Glb9c3VmBOjyViQk1wzXtoLyhCflJD/JfH2gbwM2MIH Heo0D31h042eIG6B51BbrQ49+X2jmihn96CcuIsxPpulXAVgmSRjRYPOId4MO7TYx4kks+b3JPpmN +3pWc+j4g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jfgYX-0008Mz-8S; Mon, 01 Jun 2020 09:16:29 +0000 Received: from esa2.hgst.iphmx.com ([68.232.143.124]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jfgYU-0008AD-H3 for linux-riscv@lists.infradead.org; Mon, 01 Jun 2020 09:16:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1591002988; x=1622538988; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=f8ShWrK73cRAw2tUF1g4B9F/kAWIHMoMc87kL6nMuRI=; b=jJznTPlmw62YPpPjTiQxkqf1aSiSWgDheGrRrRfO+kbq1AoLIRxYBLSq Ak0XAFBNwCfaeh8sYpYVpvf8mREwM6pmimLR0zsrH8AAt2FkDu9iVrBWy jPCCawHF+Acw0KgwMbqtiqqhxj0L9mE3a2xJuZRuuUl8pl9q3kHi7Jrym 74lcCxf9YidFOAfzB2rA44hYrQsaN21bpX7NRKn5pGiNyn+gry/Qsy4B9 Ndk4uRXhOXJ0eofvzu4mYkV/DRWijAssfmgXDdn9kcGijojsLkofZV8qI 9Lwoy+SxwMgreSBjZD7Q23+/q51Yfd1r9qJ4nTrRy6xL435Rp1VXSlJHA w==; IronPort-SDR: wUxyZ+w8S5FPDyIh/U/1yyhAHIlhsloN28pZDJ1g8JbFa+PhhIep0Z8GtrYIXyXOitSJ+RwzyN pTTv/ucxS/4ozf5g7jxCijqmn1CT36SZ4HDBMyipOJzxvwuNDWnc5PVDQjjSLa6PiwtIibes+b c1aVqykrRh3NOFHtucVnvTfR+aGEql6vVGv7LiMKJwgPoOjshJ8V0O3DzoOLNk2DkT0YyMkqVD ghymooKeUwCEGT1Ad40q7YLI6KKp+Rx5ddi+UawZzo8T5sGXoaFbV9PNxrmUay5Enmg9nGuMtQ 3TQ= X-IronPort-AV: E=Sophos;i="5.73,460,1583164800"; d="scan'208";a="241785979" Received: from mail-sn1nam04lp2056.outbound.protection.outlook.com (HELO NAM04-SN1-obe.outbound.protection.outlook.com) ([104.47.44.56]) by ob1.hgst.iphmx.com with ESMTP; 01 Jun 2020 17:16:27 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=beERQ6zIrORBEE35GoaSPjs/eoPhmjGm3Zmw0CkE9/x9jiOeUdBZN5LWKhbh07JZ6mMGMjJlg1j94A8GbMuDCBQmQRwx8g0UbYbtR3USZRmW/kc1S/NORAhhPdHNiwpAXEacLfDxjCMoq1UzBLlyga22Lhk/YloBhBteDelM7qD5WZIgkkIlRE7lWpD6x1f6T7aCVIc4FcE6MVC2EwnQBXWzVbYeq5H9DSiNyI5+W0K26fIphyKWIK3wcJ1nlK4w+MymvcxIQcIDct4Z0j17oW29FeJtcsz6rpVXA0eFVR1JGNhjCDD5NZ37LqqAB3vpIfVbai0J05RxbuK5aVKIOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hKZhQmZDOG+euq54bpMuvjQosucj9aRHq1lg7qbdL5M=; b=fjIUw7rZVeWhqgLZgMIfan+UKHkJnTc3C+nDKPsEyyab7oHxU/ObUre1IDaAGet0PfoBLiZGL1D/Sb4f4T1BKi4cpkfpjSQ1Gd5YzLdy+RAdWSjRjUQTta+hJinsDxzSAovZN6wABCJ4QDmsLCCs5x1ZKcvInTKlKIndyaHWKVFDeQ1OVdJNciCheN+UhG+EnBLMYs2ujEWE99uKs2+gybNsVYcurhqOYFA44uw+6bHEHTPKLwsbHpKKG2cUwXJRjFARdmBLrk7szDH/IyHJjnNETxglpHyAX1Dhtr2BXveuxOUjR7szJkcmTQM0N1SkFTDm12GRHUCjaw2xwNSqOw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wdc.com; dmarc=pass action=none header.from=wdc.com; dkim=pass header.d=wdc.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector2-sharedspace-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hKZhQmZDOG+euq54bpMuvjQosucj9aRHq1lg7qbdL5M=; b=gLW4Ku12wa2vs9PnQq6O0T8QF8B9JxWXsc8Ckd/DWRGNqKweXBrmtWsAdZIW9lCJQGejh0lGTxotjq/jqOIrLau+0OXDOSoCDDIeAwxd1u8umBMOMvJtNu+Q7Dp3ztw6iehQpDGf4xuV4P4t8DL4WBz3F7kcAdSHTR10xexwD7Q= Authentication-Results: dabbelt.com; dkim=none (message not signed) header.d=none;dabbelt.com; dmarc=none action=none header.from=wdc.com; Received: from DM6PR04MB6201.namprd04.prod.outlook.com (2603:10b6:5:127::32) by DM6PR04MB6955.namprd04.prod.outlook.com (2603:10b6:5:240::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3045.19; Mon, 1 Jun 2020 09:16:25 +0000 Received: from DM6PR04MB6201.namprd04.prod.outlook.com ([fe80::f8b3:c124:482b:52e0]) by DM6PR04MB6201.namprd04.prod.outlook.com ([fe80::f8b3:c124:482b:52e0%5]) with mapi id 15.20.3045.022; Mon, 1 Jun 2020 09:16:25 +0000 From: Anup Patel To: Palmer Dabbelt , Paul Walmsley , Albert Ou , Daniel Lezcano , Thomas Gleixner , Jason Cooper , Marc Zyngier Subject: [PATCH v7 4/6] clocksource/drivers/timer-riscv: Use per-CPU timer interrupt Date: Mon, 1 Jun 2020 14:45:41 +0530 Message-Id: <20200601091543.943678-5-anup.patel@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200601091543.943678-1-anup.patel@wdc.com> References: <20200601091543.943678-1-anup.patel@wdc.com> X-ClientProxiedBy: MA1PR0101CA0016.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:21::26) To DM6PR04MB6201.namprd04.prod.outlook.com (2603:10b6:5:127::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from wdc.com (106.51.23.166) by MA1PR0101CA0016.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:21::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3045.19 via Frontend Transport; Mon, 1 Jun 2020 09:16:20 +0000 X-Mailer: git-send-email 2.25.1 X-Originating-IP: [106.51.23.166] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 3358d040-bb47-4873-ccea-08d8060c74fb X-MS-TrafficTypeDiagnostic: DM6PR04MB6955: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: WDCIPOUTBOUND: EOP-TRUE X-MS-Oob-TLC-OOBClassifiers: OLM:2887; X-Forefront-PRVS: 0421BF7135 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Z/LxYNRl0S+fr3f6iWMM6PxPuDEr/CjJukVu4lPsvL0n+bqqQAOeFsWPbYzr2oIYWVC80C4bQzqSh8fA7cEI8QyICPPzlhp2+sOYih66nd5/qvR4CL2VFlKJUAphr/O4DTs7wZ3X9he2L3w4fQzskQWrncFDPxYCDbGZHAkjaD1Bkp0CnAf5dkQzxE0r6oMNG97I2UqkOQ/JUb8i0HBP2hMrdc5Ar+HwFFn/LrjqRvZOOzy6pJLdup6FScnI3U60DqxQXHGJ+OwFF55rFztD/xVDaMfiWqoXb+vzNHst9tQq07gBqFw516rHW2MH5yPDMUgQGm0i5TSa1DPTY9gjVQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR04MB6201.namprd04.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(366004)(39860400002)(136003)(396003)(346002)(376002)(2906002)(8676002)(5660300002)(956004)(2616005)(44832011)(7416002)(1076003)(55236004)(16526019)(55016002)(86362001)(186003)(66476007)(66556008)(66946007)(8936002)(26005)(6666004)(7696005)(4326008)(83380400001)(110136005)(1006002)(316002)(8886007)(478600001)(36756003)(52116002)(54906003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: RKHAzxoLbvFrl1bNYHVFAXCePPdnLV2qcxxQbITLHiNdZEJzHsM8deBG8X9KgtdjC+6jmwCfd0ZQAINRnOWgQd1X4VBk1OMs657t6aDQjMQmbEZ+bN+w8zpsugtxOXAUk7vf6hWhQ5hYorvb/7k9eYrYhqQwpf3oIpjsc+vaXarrA8ZxU4HU/wOQVBFNo/crb+i8DNbhCrmsxZpEJXv4op5xovNlb4CapPDxCsVcq+xXjVdzB2F3F5q/PgfAL2iZOoWMMS/bgU4gqCiPvjtqqhCIWKsoU8+CByd1U0Yj6BuRTbfITVFPtUkilKXEAgRpHGrAYT9HWVKAgbv/qb24ylJQayWRBIBg1OoPAV0CSRbxSu+OgJY5oCa2yNGqVIuAanvJnaVWho+8ppwDPn3JJ5twNAR30Ust4T8Vs58BQUCg5j2vLuBrNiu9aXJWTb9jNno1rcObdLBcyKoLQ9d7GfNwNLpD2Nn2VMWn/kB7+VY= X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3358d040-bb47-4873-ccea-08d8060c74fb X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2020 09:16:24.9385 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 4POU8a6EoqnoCAMgtpyHFRc/JLC4CZMo6nNkD9Z7+OHNjlW0W3T6kYFC6JKw9/Hi/ygIiuRDjPyu1pveQz3CvQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR04MB6955 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200601_021626_695866_41F89388 X-CRM114-Status: GOOD ( 14.52 ) X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.143.124 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 MSGID_FROM_MTA_HEADER Message-Id was added by a relay X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , Anup Patel , linux-kernel@vger.kernel.org, Atish Patra , Alistair Francis , linux-riscv@lists.infradead.org Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org Instead of directly calling RISC-V timer interrupt handler from RISC-V local interrupt conntroller driver, this patch implements RISC-V timer interrupt as a per-CPU interrupt using per-CPU APIs of Linux IRQ subsystem. Signed-off-by: Anup Patel Reviewed-by: Atish Patra Reviewed-by: Marc Zyngier --- arch/riscv/include/asm/irq.h | 2 -- drivers/clocksource/timer-riscv.c | 43 ++++++++++++++++++++++++++++--- drivers/irqchip/irq-riscv-intc.c | 8 ------ 3 files changed, 40 insertions(+), 13 deletions(-) diff --git a/arch/riscv/include/asm/irq.h b/arch/riscv/include/asm/irq.h index a9e5f07a7e9c..9807ad164015 100644 --- a/arch/riscv/include/asm/irq.h +++ b/arch/riscv/include/asm/irq.h @@ -10,8 +10,6 @@ #include #include -void riscv_timer_interrupt(void); - #include #endif /* _ASM_RISCV_IRQ_H */ diff --git a/drivers/clocksource/timer-riscv.c b/drivers/clocksource/timer-riscv.c index c4f15c4068c0..9de1dabfb126 100644 --- a/drivers/clocksource/timer-riscv.c +++ b/drivers/clocksource/timer-riscv.c @@ -12,8 +12,11 @@ #include #include #include +#include #include #include +#include +#include #include #include @@ -39,6 +42,7 @@ static int riscv_clock_next_event(unsigned long delta, return 0; } +static unsigned int riscv_clock_event_irq; static DEFINE_PER_CPU(struct clock_event_device, riscv_clock_event) = { .name = "riscv_timer_clockevent", .features = CLOCK_EVT_FEAT_ONESHOT, @@ -74,30 +78,36 @@ static int riscv_timer_starting_cpu(unsigned int cpu) struct clock_event_device *ce = per_cpu_ptr(&riscv_clock_event, cpu); ce->cpumask = cpumask_of(cpu); + ce->irq = riscv_clock_event_irq; clockevents_config_and_register(ce, riscv_timebase, 100, 0x7fffffff); - csr_set(CSR_IE, IE_TIE); + enable_percpu_irq(riscv_clock_event_irq, + irq_get_trigger_type(riscv_clock_event_irq)); return 0; } static int riscv_timer_dying_cpu(unsigned int cpu) { - csr_clear(CSR_IE, IE_TIE); + disable_percpu_irq(riscv_clock_event_irq); return 0; } /* called directly from the low-level interrupt handler */ -void riscv_timer_interrupt(void) +static irqreturn_t riscv_timer_interrupt(int irq, void *dev_id) { struct clock_event_device *evdev = this_cpu_ptr(&riscv_clock_event); csr_clear(CSR_IE, IE_TIE); evdev->event_handler(evdev); + + return IRQ_HANDLED; } static int __init riscv_timer_init_dt(struct device_node *n) { int cpuid, hartid, error; + struct device_node *child; + struct irq_domain *domain; hartid = riscv_of_processor_hartid(n); if (hartid < 0) { @@ -115,6 +125,25 @@ static int __init riscv_timer_init_dt(struct device_node *n) if (cpuid != smp_processor_id()) return 0; + domain = NULL; + child = of_get_compatible_child(n, "riscv,cpu-intc"); + if (!child) { + pr_err("Failed to find INTC node [%pOF]\n", n); + return -ENODEV; + } + domain = irq_find_host(child); + of_node_put(child); + if (!domain) { + pr_err("Failed to find IRQ domain for node [%pOF]\n", n); + return -ENODEV; + } + + riscv_clock_event_irq = irq_create_mapping(domain, RV_IRQ_TIMER); + if (!riscv_clock_event_irq) { + pr_err("Failed to map timer interrupt for node [%pOF]\n", n); + return -ENODEV; + } + pr_info("%s: Registering clocksource cpuid [%d] hartid [%d]\n", __func__, cpuid, hartid); error = clocksource_register_hz(&riscv_clocksource, riscv_timebase); @@ -126,6 +155,14 @@ static int __init riscv_timer_init_dt(struct device_node *n) sched_clock_register(riscv_sched_clock, 64, riscv_timebase); + error = request_percpu_irq(riscv_clock_event_irq, + riscv_timer_interrupt, + "riscv-timer", &riscv_clock_event); + if (error) { + pr_err("registering percpu irq failed [%d]\n", error); + return error; + } + error = cpuhp_setup_state(CPUHP_AP_RISCV_TIMER_STARTING, "clockevents/riscv/timer:starting", riscv_timer_starting_cpu, riscv_timer_dying_cpu); diff --git a/drivers/irqchip/irq-riscv-intc.c b/drivers/irqchip/irq-riscv-intc.c index a80fb1731c50..a6f97fa6ff69 100644 --- a/drivers/irqchip/irq-riscv-intc.c +++ b/drivers/irqchip/irq-riscv-intc.c @@ -21,20 +21,12 @@ static struct irq_domain *intc_domain; static asmlinkage void riscv_intc_irq(struct pt_regs *regs) { - struct pt_regs *old_regs; unsigned long cause = regs->cause & ~CAUSE_IRQ_FLAG; if (unlikely(cause >= BITS_PER_LONG)) panic("unexpected interrupt cause"); switch (cause) { - case RV_IRQ_TIMER: - old_regs = set_irq_regs(regs); - irq_enter(); - riscv_timer_interrupt(); - irq_exit(); - set_irq_regs(old_regs); - break; #ifdef CONFIG_SMP case RV_IRQ_SOFT: /* From patchwork Mon Jun 1 09:15:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 11581769 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9421D739 for ; Mon, 1 Jun 2020 09:16:38 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 715B0206E2 for ; Mon, 1 Jun 2020 09:16:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="V7hp4e5O"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="YlLu0i4q"; dkim=pass (1024-bit key) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="A9hQ19uA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 715B0206E2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version: Content-Type:Content-Transfer-Encoding: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=CixexRslsnX7njnxUInvY2rSBt2XnpZ6ZYj5CQnYBQ0=; b=V7hp4e5Og4U4C/FUjXIMOCmUR XBISlOfKF6PCHcjYXWXX7cK5h8MCg2NbvP1aKzUrPUAS2LYs5KN+JjWckpvnuViHoE2amgUSCubTu GbA1jNQECTyahbZtNmKsV+0YB8CjY+knE5o0+1WtHID9aiZ3bKcWjaJaFGIa78UtTDRor4+dy/vIt p4ffyEPjL6Nyhq/Kt4mZQBSGRs7PIr8y1uF22FuW1v8xsHO8zOK+Ki8N/WzC1KtzgPy58P+XGIwvc 0NZxm9J1hOxamMKwhVg2riTQeASjOUNFlPun3i1oayDAn6mdyRkd12Io4ufK6ph6adeoI7guBeI/Q 8ufjKQM2A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jfgYc-0008SY-5G; Mon, 01 Jun 2020 09:16:34 +0000 Received: from esa5.hgst.iphmx.com ([216.71.153.144]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jfgYZ-0008Pq-Ma for linux-riscv@lists.infradead.org; Mon, 01 Jun 2020 09:16:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1591002992; x=1622538992; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=8rztky3nwF73R86YAi/Y0bnsDBzVkhLIjei/AYBNtCc=; b=YlLu0i4qulTvZ5G0VXJaJf3UiNpwAq1f7W1yrlI02GrN0OnItCLFLlNf 0+aRA7UnIFkbc4xzAqURgdS5x9DDl7JsLsvuJyly015KedyydtAecsuGV kHnSL2aitEIpSJk3V0w/DfH5GWpWB67DveOjTbswSSk4CNwixpfoJrTDl Z0udS7a8/DtbpHB7DXZ2QScs7S09iokZEM6aURCZw2+rIZdqEUNTdevqg /pgC3xhHomvk0Fd/y9hhIafSFOVSRf9Mzbxh+czCEnKZnw1jUkoAY1ijn 1ZLhz/D7Kv6gLAt8Ya1tqXufuezR6hSiC3iKABRind+EyJWXCQZUZQHH3 A==; IronPort-SDR: BRSSYB8Egej3DJ2pOEkS8nlvtj/OSG0m9KeTXY5AVVRF7fCq5rBtGk8qjvguX4EsRD2XqEkM37 /vsuV4f6xbbsKciES/wzsTF7p2GydPnbgUq+YxTyiXXume0t2n/AGs0zxcFuBs6OdV0PJUDozs Yh3g+I3+WE12qtiawHhfjZtke7GXtDtS1lElQIyiFyOH8CcQlTJcHQ5+6a+5sAZMMrn/ha7IRi U7ZFZfTmjT1fADYlure7jT79fkI0S8iM6XFtp3GmeFwRfm38gIWBOjcLN8VnmnrIjja52srRO1 cd4= X-IronPort-AV: E=Sophos;i="5.73,460,1583164800"; d="scan'208";a="139258652" Received: from mail-sn1nam04lp2057.outbound.protection.outlook.com (HELO NAM04-SN1-obe.outbound.protection.outlook.com) ([104.47.44.57]) by ob1.hgst.iphmx.com with ESMTP; 01 Jun 2020 17:16:31 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EFU9gmTkEPudFy/oCtMRWpbnC+cVU7SxjXS1Q2p/6R55z7KfWTKXTc/bBQYvobVKb3lSnhtzJeBycgMXuYDaZXWQtgNF+/zh3wTmCa7gejL/MKxHY7/Cks502II8eTaaPxHC/F1Blg6lznlvPdjKBCvDKdkOlvOcp2sGeyXkqY7dYx4jx6BnOFV3Dy7+duI3ou+G+qsy81XCkeJ2hk/3Pa3eK7XhLNa9L04vNoOWWmre9bl5ppcTG7oOrgezDeXMgArk22tRjL6St+yRMR3xTquyTI4VvKJzvJESCpHyijwryxhadPkn8C1YIg4+odlEMpg3YKU/w/QddzXCg5BrKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CixexRslsnX7njnxUInvY2rSBt2XnpZ6ZYj5CQnYBQ0=; b=bEPPHKM07IrrODkadbsEz/McONvhSGC2vpnj/mNKym4qW7N+cRwCjdxW2goppbuuTerZlDKIbaOzeqJagdLMIvixdizMlv4pqGctCF7eMynKUx3tqHtnPYltlgFHnxeJTUtGS79gJ4FpmzwCwXxLk9oh6LzEiEKYu6IthMRmlUfq5Vkr98PrILdGZfmejXjUB61CuC710qfz9lrfcltw81mdm6P7NtaWms5Lc5f2HqOrK4GnBQmhYaEGPPWgCxq3I0/nsvodN1A1bZjPHqJeRu5ivpzbwwGdQT2/KZtoozKZhrSkKkHqhqjxYb4c+7Iqay3C946vG6pTHitcgG0xMg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wdc.com; dmarc=pass action=none header.from=wdc.com; dkim=pass header.d=wdc.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector2-sharedspace-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CixexRslsnX7njnxUInvY2rSBt2XnpZ6ZYj5CQnYBQ0=; b=A9hQ19uAwOStYYQGCReLeRaG/cnGC9qJkXVu8FlS60MYY0m/5jVxzpmxHR+tHL71AsT5Jj/VOmS6HiiHjFFFK8K77guYOAOvyyHJErdcaOV1/sfC5pRWciwhzrPL2j6SsmfD36dfyLWUWj9hOKXZyF1DFV3b3Ww5Dg3OgA4iRdM= Authentication-Results: dabbelt.com; dkim=none (message not signed) header.d=none;dabbelt.com; dmarc=none action=none header.from=wdc.com; Received: from DM6PR04MB6201.namprd04.prod.outlook.com (2603:10b6:5:127::32) by DM6PR04MB6955.namprd04.prod.outlook.com (2603:10b6:5:240::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3045.19; Mon, 1 Jun 2020 09:16:29 +0000 Received: from DM6PR04MB6201.namprd04.prod.outlook.com ([fe80::f8b3:c124:482b:52e0]) by DM6PR04MB6201.namprd04.prod.outlook.com ([fe80::f8b3:c124:482b:52e0%5]) with mapi id 15.20.3045.022; Mon, 1 Jun 2020 09:16:29 +0000 From: Anup Patel To: Palmer Dabbelt , Paul Walmsley , Albert Ou , Daniel Lezcano , Thomas Gleixner , Jason Cooper , Marc Zyngier Subject: [PATCH v7 5/6] RISC-V: Remove do_IRQ() function Date: Mon, 1 Jun 2020 14:45:42 +0530 Message-Id: <20200601091543.943678-6-anup.patel@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200601091543.943678-1-anup.patel@wdc.com> References: <20200601091543.943678-1-anup.patel@wdc.com> X-ClientProxiedBy: MA1PR0101CA0016.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:21::26) To DM6PR04MB6201.namprd04.prod.outlook.com (2603:10b6:5:127::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from wdc.com (106.51.23.166) by MA1PR0101CA0016.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:21::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3045.19 via Frontend Transport; Mon, 1 Jun 2020 09:16:25 +0000 X-Mailer: git-send-email 2.25.1 X-Originating-IP: [106.51.23.166] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 24b24ea0-e1a5-428d-566d-08d8060c77c1 X-MS-TrafficTypeDiagnostic: DM6PR04MB6955: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: WDCIPOUTBOUND: EOP-TRUE X-MS-Oob-TLC-OOBClassifiers: OLM:1186; X-Forefront-PRVS: 0421BF7135 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: W3wkC4t0O0gafdugRvwp1exMDbrgeGEmnxOI/cVy17UByvAmjyIsNAO01oi3AijhFzrEbQ6oGM3oUCims2UKouzzNGYHGsMvR6tWtF61Hn4OJnwSRwdgd010BKgjPrUXdM0FV7tBWPvfHOioGcHwW1xbqL8J0ci2hVRgFVkHL+Ee/m27a1E3WdZHoeNNJrLfM6xLPgO+ElcrCIGk50rZJ8vvNFYLsep5ruLd2h5tZgMZkEtotFiqk7cOIxrh+FYjAGypcOx1IEwtsSUf16YLUwQbBPqCzg/M7forZtV/yuR9LidokUEXYUVUgr6KGdce X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR04MB6201.namprd04.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(366004)(39860400002)(136003)(396003)(346002)(376002)(2906002)(8676002)(5660300002)(956004)(2616005)(44832011)(7416002)(1076003)(55236004)(16526019)(55016002)(86362001)(186003)(66476007)(66556008)(66946007)(8936002)(26005)(6666004)(7696005)(4326008)(83380400001)(110136005)(1006002)(316002)(8886007)(478600001)(36756003)(52116002)(54906003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: fs4z4/K36O2+Fd2mx6DtZkrOarVyJfgghai5JdwZtzhMT6PnR6m0ylpc4e/JPfcU8Xae2rf15z+K2s/wjussH/+0G613Eady3btfrYkHd0npPWgnGyZVnr+lsf0Wex6y1R5QukJ9yeWoNy58NthnHYC/Grv/CDYY3TPpjkcKwje/otbKmsfYli58CpvQ/PUay/N5YlKozU0zzvxpi+1XxBWyfmFp0M0ol9fLlyRBj6XAWEOYWjTOdqWngeuEz6zCmS2G8Sut2YW0KF/Xn8SaS8w+B7Weh7LejcYE5rw+zxtBkNGM/kCGN/p/VlZWlJwBduykpYqbz81vw2RIxHwKfjzYV6EvmWSnmCo+kCMngn2Asr6zImK/j4F0owjbLj6gZK5ihV1ITt/zAdTrCJlYbFizowP08R9c2WLPRCCkIuBKXvw5PyGliEURfMKl3aS9o71K98ICLpJ1z2quSs89ULe2p6A3ZpagWqbXAtZMfHQ= X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 24b24ea0-e1a5-428d-566d-08d8060c77c1 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2020 09:16:29.5296 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 0JzqpZK5VznrWI58jKMCrNouZsGapyqPK75IwXuz9HgAxuGtO0udMBSoulM7AJKaipMzbtYnYneugPW1eKYqqg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR04MB6955 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200601_021631_750539_B3DB5A8A X-CRM114-Status: GOOD ( 10.77 ) X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [216.71.153.144 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 MSGID_FROM_MTA_HEADER Message-Id was added by a relay X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , Anup Patel , linux-kernel@vger.kernel.org, Atish Patra , Alistair Francis , linux-riscv@lists.infradead.org Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org The only thing do_IRQ() does is call handle_arch_irq function pointer. We can very well call handle_arch_irq function pointer directly from assembly and remove do_IRQ() function hence this patch. Signed-off-by: Anup Patel Reviewed-by: Atish Patra --- arch/riscv/kernel/entry.S | 4 +++- arch/riscv/kernel/irq.c | 6 ------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/arch/riscv/kernel/entry.S b/arch/riscv/kernel/entry.S index 56d071b2c0a1..cae7e6d4c7ef 100644 --- a/arch/riscv/kernel/entry.S +++ b/arch/riscv/kernel/entry.S @@ -106,7 +106,9 @@ _save_context: /* Handle interrupts */ move a0, sp /* pt_regs */ - tail do_IRQ + la a1, handle_arch_irq + REG_L a1, (a1) + jr a1 1: /* * Exceptions run with interrupts enabled or disabled depending on the diff --git a/arch/riscv/kernel/irq.c b/arch/riscv/kernel/irq.c index eb8777642ce6..7207fa08d78f 100644 --- a/arch/riscv/kernel/irq.c +++ b/arch/riscv/kernel/irq.c @@ -16,12 +16,6 @@ int arch_show_interrupts(struct seq_file *p, int prec) return 0; } -asmlinkage __visible void __irq_entry do_IRQ(struct pt_regs *regs) -{ - if (handle_arch_irq) - handle_arch_irq(regs); -} - void __init init_IRQ(void) { irqchip_init(); From patchwork Mon Jun 1 09:15:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 11581771 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B333592A for ; Mon, 1 Jun 2020 09:16:42 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 90B7C206E2 for ; Mon, 1 Jun 2020 09:16:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="szN/dah5"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="NWWTXPxx"; dkim=pass (1024-bit key) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="FrgSpl8S" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 90B7C206E2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version: Content-Type:Content-Transfer-Encoding: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=YlnEz0/qfGdSSIBe4X+trDq3j196LxWuDxb5JfIl4Wk=; b=szN/dah5fIoLO6u1ielU5fP2J mL93o187KeXLL1NcD5fav1eM26Lk2yqGezpHTeNtbEeYEKf2uZAUHXJp30hcTOMvW0R8sZQFhC6vc QPWCytMz0l5iNQWHH5wJeUo7eNXGZ1Sr4VMQmKTIeLzifC0p2pN0N9Ubc/Az0a9+4V8p/kxD/gNX+ EIltkyM7aB+detSU0ZJAirhJTABvHFYVLz/04ewuQ979e0nUcxWvLpC0McAUw2hKQqLBpCZ0k48pj gIoPWiou7/RSBgwhTiAgYi2AJExxgCYxh6huq7KKJTDmUiosJcoP6Kq6ZWE+sLnkOPLO7u4TnCIqs vWcZIqv+w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jfgYh-00007P-PX; Mon, 01 Jun 2020 09:16:39 +0000 Received: from esa5.hgst.iphmx.com ([216.71.153.144]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jfgYd-0008Pq-Mc for linux-riscv@lists.infradead.org; Mon, 01 Jun 2020 09:16:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1591002996; x=1622538996; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=rwodEWhO07nN9+WYg7XaEo9/JfXjRNV+hU6q5mSAkec=; b=NWWTXPxxVowM5WSHeoK6K7Sl2VkcKvRuXDKhjCJxxQddUd5K6+ao1nXn piXc6MK8xJFNvuV0AmexFOIQ86oG8pyn+kn0uNJvICmqKIn1RtDd87STS oQM2ykY7GY2bxk1vUJiXNznCqwMy86+qY1zLzf5NyVuGw7zhreGSX7PXB KkEh7hWn0duzTExMe3V9nN9PH9jYMFvm/Zhgm8ksztffGLRFelGrOEA3w YZludLRHJXguXy+ffCYBM14fixzibn/I0wgVS6gySyDB5mnuj9UL88qFb 33MbsEarYLHetQvKRXUVhIvmLiH4yW9RWI2R/AuLcLIHVofmJ7WpibAXr w==; IronPort-SDR: 81/HHQet/c1POuQh0iNWMGpjOdLAfdxqqjbueF3+PPqdwg3viNj5Plz0mbmzCd6OEXkpNom3Yg Q6KADR+Xp8BcYaQV4wQo1tYZBn3OMHPej9tRMI2x42JzghVX/6crBA/ilr2JUXAccLqMeD3Mb1 uH3E/3LCCWLbgxI4vIYM/8DNaYFz596UhprvEeMV7OviFUzy9yDIAD8YpeFsf/vG2dh32FJOYf ZExLv8VY8AgTkznVI5O783fK7HyFWoAYw4ZzgKr1XuSIPhLM6kcarcEryHBK80PpO1rXjzF3dR 1NY= X-IronPort-AV: E=Sophos;i="5.73,460,1583164800"; d="scan'208";a="139258663" Received: from mail-sn1nam04lp2053.outbound.protection.outlook.com (HELO NAM04-SN1-obe.outbound.protection.outlook.com) ([104.47.44.53]) by ob1.hgst.iphmx.com with ESMTP; 01 Jun 2020 17:16:35 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ggQ+NvjRrT//jAYSH7HUSpluIuztJCjNKkycGsxMdOMcvT1k2uSADmNnGO3fFIjU7AJQjl9dM5ghoi7cH/C4RcM+DShgL3tephKL8Nonn2r38iar+c02ILruacyjBeqSjNB8rt3qxui1bo4/3cXfvLUBRqukPkmaRpr0GEIihdv28/H3KdPvOilsrqPz20gefn/D2FQtjvXO7WXo6sKkXNfIkxnriMAWM/QFeu3348fQCh6OQNpGczF1eAkM0RJA59ZAxNAA26+SoIvopaPPrh71mMnrAGouSCXhmJ7QxB+c48tLfPPn1CQBTfPbFgoGubZ0UJ4Sa/Tq3oFyAi1Yeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YlnEz0/qfGdSSIBe4X+trDq3j196LxWuDxb5JfIl4Wk=; b=aydGh1Qr4cdAvX7iDDBLpYyWTES5+joe/KjVA6q1We5cqx7B5LyhmRhUqOsc9RAggqoO769PN3UGKId0OISwfME9h7b0lm3ZXMlerwtCRJSfbAlLSrPQeSt81KgTP8cW2sgz1bRFGuu40dXOsClG/EfwWRkxZn8j3V3SpS0ziqzvZWz7uT7q0qqeE0S6F/epz78NY1QjqbC/1ETJwMSggVNRVkqAFph3PjELBOOzeKMqxo8nnPIGZCVota28tIxHpeIvjY7pRM2IPDzxfGr+Pd3mXX+7/LdZlNMmvTi7WDlP7Zsi8OWxRqkk+FQVqKSlZpGfyc+a9Ne9pF40+SseDA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wdc.com; dmarc=pass action=none header.from=wdc.com; dkim=pass header.d=wdc.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector2-sharedspace-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YlnEz0/qfGdSSIBe4X+trDq3j196LxWuDxb5JfIl4Wk=; b=FrgSpl8SB7QXPS3t2YHdwgCQposil/nh6KyIbV+99IxCPPRxjj7UhvWmfvxnAhlk9QnQi4cykCAHSmamhEgXc9K90qSqdG5SOvvv6LIYK1pj5pbfvCV63+rdRb2CtX1kejHZYFTy5YKOpLxIbcEJYwhobiFHf5kpSe+IhEWOSq8= Authentication-Results: dabbelt.com; dkim=none (message not signed) header.d=none;dabbelt.com; dmarc=none action=none header.from=wdc.com; Received: from DM6PR04MB6201.namprd04.prod.outlook.com (2603:10b6:5:127::32) by DM6PR04MB6955.namprd04.prod.outlook.com (2603:10b6:5:240::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3045.19; Mon, 1 Jun 2020 09:16:34 +0000 Received: from DM6PR04MB6201.namprd04.prod.outlook.com ([fe80::f8b3:c124:482b:52e0]) by DM6PR04MB6201.namprd04.prod.outlook.com ([fe80::f8b3:c124:482b:52e0%5]) with mapi id 15.20.3045.022; Mon, 1 Jun 2020 09:16:34 +0000 From: Anup Patel To: Palmer Dabbelt , Paul Walmsley , Albert Ou , Daniel Lezcano , Thomas Gleixner , Jason Cooper , Marc Zyngier Subject: [PATCH v7 6/6] RISC-V: Force select RISCV_INTC for CONFIG_RISCV Date: Mon, 1 Jun 2020 14:45:43 +0530 Message-Id: <20200601091543.943678-7-anup.patel@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200601091543.943678-1-anup.patel@wdc.com> References: <20200601091543.943678-1-anup.patel@wdc.com> X-ClientProxiedBy: MA1PR0101CA0016.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:21::26) To DM6PR04MB6201.namprd04.prod.outlook.com (2603:10b6:5:127::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from wdc.com (106.51.23.166) by MA1PR0101CA0016.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:21::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3045.19 via Frontend Transport; Mon, 1 Jun 2020 09:16:29 +0000 X-Mailer: git-send-email 2.25.1 X-Originating-IP: [106.51.23.166] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: ab77ed26-49d6-4e1c-3131-08d8060c7a63 X-MS-TrafficTypeDiagnostic: DM6PR04MB6955: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: WDCIPOUTBOUND: EOP-TRUE X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-Forefront-PRVS: 0421BF7135 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eUQJ+syZX8y2ppbDm7wBc1+nYLVj3FJb7Fgq0w4eZnYie4OdQ1TN9Vq0YwILGKVUN/IDsew+zLea6MVejQiF12P0V75G4jjJm5TzjpzwvASDMurE3a8KHPqiOejo5jocprN1iuMxqKKMkj9FBuH+ssGdCA+/hfqy515WjR0jT/XgsfKHawikkBB08ISOIJ5NBe6USmulvlVQ5NX+KHRAciZ/w0qSNFtx9LxqRITk+ivphYtOpZNAyJjmMXFFob+/CnL498V9U4BT9fTSdBge/0UyAI5HKLk3+E8vKvod9uENgNJ8bajFt8TLbFzl5U9g X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR04MB6201.namprd04.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(366004)(39860400002)(136003)(396003)(346002)(376002)(4744005)(2906002)(8676002)(5660300002)(956004)(2616005)(44832011)(7416002)(1076003)(55236004)(16526019)(55016002)(86362001)(186003)(66476007)(66556008)(66946007)(8936002)(26005)(6666004)(7696005)(4326008)(110136005)(1006002)(316002)(8886007)(478600001)(36756003)(52116002)(54906003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: rHtpfbmgG4xPLpeB1K90zby1flta0bVua//NqcOZvLIvhS1vnpasGvxxafQFFqsLRvSY6dwd0w7HMbu35lUjV+DxaidYNqiWDd7K1XH9snhj85AZnYsJWrk+0Hc3Faoi+LRe2TpwxDur86kAGumwbzuQDA5j8XYWiEdMweDvDjb5RsdH5bFRmhlXAFGRV3WGJGn0nL8JErfsn3GFHXDrYymFvaPXznKU9gSQ2mlJg5LwNfl6TeSMF2CmOHfLbQqXHryDDrkWge2kDc36aqufJ1Oa0l9+F+H2dd7QGm4H6Vps62k8BIeVOc/xAgASTQdEdigYHe4omgCeqNZai8mKjH3656YIs4zyyBQazGa+UzzuxyJgaF+IMqInK9sgaJfENDs06sLnmyuPm8cUEP0lRTHl3QVNRgcua56WxY9mY5QNOE7KZbMqwswotUf1cVaIU2wzIileNqu/KJLxssUsQvKdZYVLzBIYVLR9KpDXE7w= X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: ab77ed26-49d6-4e1c-3131-08d8060c7a63 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2020 09:16:33.9957 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 4V4rtjLNj75EeIWP8v2g6dS+NXZunLuM4fSx9gsf1qdUvWsGv9+6jYoPc4cQXuFls9StS6jk8giERFl1pzYdsQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR04MB6955 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200601_021635_773362_FDC825F4 X-CRM114-Status: UNSURE ( 9.71 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [216.71.153.144 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 MSGID_FROM_MTA_HEADER Message-Id was added by a relay X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , Anup Patel , linux-kernel@vger.kernel.org, Atish Patra , Alistair Francis , linux-riscv@lists.infradead.org Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org The RISC-V per-HART local interrupt controller driver is mandatory for all RISC-V system (with/without MMU) hence we force select it for CONFIG_RISCV (just like RISCV_TIMER). Signed-off-by: Anup Patel Reviewed-by: Atish Patra --- arch/riscv/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 822cb0e1a380..2cf0c83c1a47 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -51,6 +51,7 @@ config RISCV select THREAD_INFO_IN_TASK select PCI_DOMAINS_GENERIC if PCI select PCI_MSI if PCI + select RISCV_INTC select RISCV_TIMER select GENERIC_IRQ_MULTI_HANDLER select GENERIC_ARCH_TOPOLOGY if SMP