From patchwork Thu May 21 13:32:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 11562979 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 CFDDC1391 for ; Thu, 21 May 2020 13:34:02 +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 A747A2078B for ; Thu, 21 May 2020 13:34:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="e0dxR2xc"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="UydVjDp9"; dkim=pass (1024-bit key) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="PG9q3al4" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A747A2078B 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=LathR0m9i7FyVOJ64hGhs0rTX4mE9hFs+yy0CExU/Ag=; b=e0dxR2xcS6eWZMU1UqSsn8WFN lFR49jhnj/GNnITfUTD8HNpjCVj001xVVHkw5T+WZ7DRXEMgXme9ESvAY0BSP/Kny1Dyjr5gka4/Z aQkaz0uqjFzVJVae5kEOclpFR/2Se6K1p89U00bo/7339IBfRAatChFjhTYBguQ0bTnnpYYrkoQoI /FLokgLpxha0R+dc5Q7YNN0L5LYWPCirqkaj1c8avo2brOMFEYjyWTnr/JN412oR5ygh9SqLRHGyT Ox91AQQK6t46Q2a7RwolZGGL9wszdQRLYXabCxOLk29+WnspQ60jj86sMCOQLWBjHPzBdcQCQ0Ez7 p6vhqzk6A==; 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 1jblKd-0004Wz-JD; Thu, 21 May 2020 13:33:55 +0000 Received: from esa1.hgst.iphmx.com ([68.232.141.245]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jblKU-0004Pe-CR for linux-riscv@lists.infradead.org; Thu, 21 May 2020 13:33:48 +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=1590068026; x=1621604026; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=wbeILlWjjXWAUcbVBnq8BPPuGr4gQ/R9cwOoO+MveXY=; b=UydVjDp9Uh//JAT2e7og2lykjCg3ySk0JS5clJp+x8CFO7T+7FsKf1xt p4eaTtNszOVlZ6L0BrQKTEnAfZSiaRTXF1xi+g7DDyMCK4Mj1upCis777 OtR37pydUO0UDwlMw9aHE6qb0B+Ddps8Tix/58AbhHuS7uTji54/hX60y 5ZdSwaHnGxsR5feBYVoLYM4PmNutEN3rZhMBdf4f7d8BAFjYqaoqdooEh +uinjGBGL2ALVkB1/4bv30Two//VWvVj1Tn/hA0iEG5UIpUF+rdUNhaLT oThy8Q14ULizwy6MWiNsI14r1hbOuh3ZiMFS9SC+kd9IO1wIEIpcQp6RU Q==; IronPort-SDR: pEgfAbqPDas1l+2zwQI+Don7ZGluA1EbPpb8OWx71Z3JlXPPOAABnLBZAS4wu+m7/JnF1YOAu6 Rp2qT43uC0iQXzYZLV9sSVqFRHe/H6DYRFzhg9MRx/J3mLvV5qNpSlJ0bphmeusnDUcVdj3PsL sARbAG/bOuv0PGFcpPnFey2CM39BdYOIcQQLoueBNvFER3PmMyhMuvuOkho/fVccDNWGND+/AA l6geSZ/HOVJCb+vnrlYaYt4c6SB0ure7VuNa6GDQ2Zpt1LCbZHDh9scFxN0lKWUAi8GWTwWsNO TpE= X-IronPort-AV: E=Sophos;i="5.73,417,1583164800"; d="scan'208";a="247222572" Received: from mail-dm6nam11lp2168.outbound.protection.outlook.com (HELO NAM11-DM6-obe.outbound.protection.outlook.com) ([104.47.57.168]) by ob1.hgst.iphmx.com with ESMTP; 21 May 2020 21:33:39 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D/AHXqsZs8uFeK13lANdmddv+yv9RBgpiZcIEauXRxJcj2o/F9BonTskhtHmHYT7wCyOZry/MiyKmFEqX1PV6RFXGG6zHkfBxZU4m53BBEpQhhI9Kj27EtPDJr/lzNYrk0LUttdIHTefiTVAmwc9Zod6jH5hu9iU8wrVFyiO3peeu0teR8ugnMBrCaYaVN1HYFK5QInZwUZUrxTay6yQ0I7UI3GEKeUQdqsugOFUvMMGRRBnJ2uFudlm2w91l1UqDHC5g0Y2IqOaVx0MfKCpMO4D/tEuobXZ08VnFQgQ8czcGr3IXvO5bBvLjxiHurxXp4tJvK2sJtMNdgxi+FbJdA== 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=LathR0m9i7FyVOJ64hGhs0rTX4mE9hFs+yy0CExU/Ag=; b=dxMUz25sBU+SB47E3YdO7JZon/zwUAXvIUWt/jqJ1SdPtwBCc69cipKkeTtg/C1yhG+hag+bJzuh1gAWrFJN1WxF4LKwQTJw4wGX3zegLP8gBjALLYrmbAnkWyHpF9lfBNaWXHO0HxPbKQxBWhtmjpaTXHePYBxyHcscCpl4PiLw7PonlqNiJ8NZQRWwwAGT3k1mGLNwZslKgEO+xWcAJ4Bzkv/NIWeqKq6FuLX0fKqIMG9YGOIxzEJaLZ1p9QshCgLm3+jUzZhTAwFHPPDs4dN71GJ4EbFV62QzQGS+rs2FLn+N/YLL3z0x3/di6xglAPzD61PYM7iKeDwhLofWdQ== 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=LathR0m9i7FyVOJ64hGhs0rTX4mE9hFs+yy0CExU/Ag=; b=PG9q3al4Qg7VNr3uZpP64VGgTBJOCA7B5EUgpwAQ+iMWep0qxPJDmQxEcca22tcjMLTolF2fqR6W7fXf5oE1lwwdp/2cQhbSRsT5C+92lNK6jV4wtKUDVvpVk5rGSnKLJidn8aBXFm93qXGFnF0wm5X/5l+whM3osU39bswp458= 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 DM6PR04MB5292.namprd04.prod.outlook.com (2603:10b6:5:107::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23; Thu, 21 May 2020 13:33:38 +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.3000.034; Thu, 21 May 2020 13:33:38 +0000 From: Anup Patel To: Palmer Dabbelt , Paul Walmsley , Albert Ou , Daniel Lezcano , Thomas Gleixner , Jason Cooper , Marc Zyngier Subject: [PATCH v5 1/6] RISC-V: self-contained IPI handling routine Date: Thu, 21 May 2020 19:02:56 +0530 Message-Id: <20200521133301.816665-2-anup.patel@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200521133301.816665-1-anup.patel@wdc.com> References: <20200521133301.816665-1-anup.patel@wdc.com> X-ClientProxiedBy: MA1PR0101CA0033.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:22::19) 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.30.72) by MA1PR0101CA0033.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:22::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Thu, 21 May 2020 13:33:32 +0000 X-Mailer: git-send-email 2.25.1 X-Originating-IP: [106.51.30.72] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: c7f47604-4e0d-460d-777b-08d7fd8b915f X-MS-TrafficTypeDiagnostic: DM6PR04MB5292: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: WDCIPOUTBOUND: EOP-TRUE X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-Forefront-PRVS: 041032FF37 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jsW5FcXDdsX9FTzBMXaeBH23VCBUQnBYwesa5OdVE1E69JZVwhiPgwvy1XzOEW0GMgufreHKEzZrB5hVqlmV5EIUDmi6+3kLjeqVM5eGLgn2Qw5Zxrb9OH6ZZZXE7SHYMLTJWDGM6VxEEGsrhPRnBzRvUjQ5UHAl4eXtUmhOKiHgftpaZtez9/EtDLevyshp1CD0cTgrq+J0umWWu1ew/expgMoRayltdevjXk05majtfqyPD3AW9N3oHQGrgk63ZEy63YVpAGOnrz5k6J7ReEvJSz7vOB0R2t8Uf91zwfmjPK5dIOUYVAwHpaRe8g8aft7TsOMttpzz2yMzj0VHjw== 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)(346002)(396003)(366004)(136003)(39860400002)(376002)(478600001)(7416002)(5660300002)(8936002)(86362001)(8676002)(4326008)(8886007)(55016002)(26005)(7696005)(186003)(1006002)(1076003)(6666004)(66946007)(2616005)(2906002)(66556008)(956004)(54906003)(66476007)(52116002)(36756003)(44832011)(16526019)(55236004)(316002)(110136005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: Rgtm8S1aKMhpySJ7TXCS99fLAQNU30CarsRpYJVab6tUwPyztgtuql3g4+b0sGJ5lfohNbGC6aBiPrevgr4fRLDZ3OPiTQZq2lp+UqmxP3UJkr2mhCJ5YdqD4Du3jAdzPWp3WuKufUn5O+9rpdkhESKCah0NRVjY8GpEswVtLeljdRh9Gtk0weXSCSlu6CudeLZNfeYXmYcyqao1FK42NkPkPd3WByDUoLQSeypgLeFQufsLTM7p835TLP2Y9s0M2+kuGzffphuHkUt19CJ4EOOjz+HSje6Kd9esj+tWx+bbBzzXdzV2a1MJCT6j1tDQICi2rlKRHg02ez2UrRzE+lnOPRELWgFT/68KH76zDsYjCxQ8czHrcyKnjUBNHhxGUnhnLcYRJHL4d4kJJn7L5GKATDedAzESEXLwzJT7flsEH2Q4KpPmqhbzM7i9nuESarnPP4nE7rOJ149GAAhIQKr7KpZSOMdQHv+XZK4ggX4= X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: c7f47604-4e0d-460d-777b-08d7fd8b915f X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 May 2020 13:33:38.3205 (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: eL0nlKTjf5QoqqZT6mnZa9JfnZhqs5qh4NUnnV5rxjND/pED9zg8Pd1U5S4yo1xE7culrGCnvgOqkTPgMzSiOg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR04MB5292 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200521_063346_526232_6C37639E X-CRM114-Status: GOOD ( 15.43 ) X-Spam-Score: -1.0 (-) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-1.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.141.245 listed in list.dnswl.org] 1.5 RCVD_IN_SORBS_WEB RBL: SORBS: sender is an abusable web server [106.51.30.72 listed in dnsbl.sorbs.net] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches 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 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 Thu May 21 13:32:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 11562981 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 0B923912 for ; Thu, 21 May 2020 13:34:06 +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 DCA852078B for ; Thu, 21 May 2020 13:34:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="NvRaSemC"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="f/HPTbVP"; dkim=pass (1024-bit key) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="oIs73KfW" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DCA852078B 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=uE2W9DLlKdGilXoKWil4+pDPIMKsBgbm4cT6I6B7Gbk=; b=NvRaSemC0kPINW3QFHAwfdTdM req6iJNlmwlKUsyywTJ9N2rWWnvyvMo7NlnCAmDww/k3zwg4WHuqdtE8f5IqV3dJQVOjDa4D1Euyc ioV1NKO/ag2VSZaatgXMSHAmEUpVGZrUeDADPhqglY2Ni2Aggnwsnlpbj6ZODcqbJRMRZOGbGMsXD Z1gPZvd/OFjijxIAKuhiWJzR9JUyuVFWtzihc53JFRxRxd2ZQRiztUingM9vb/7v0gEzcCry5Lfdd HLQy499/9yHlgS1/IJXcDKX/O0XUCU3D6gX6MHv8MM0Cgo3X+0Gtc8q87EGiAyKMrizSsBI6EfTl6 LmOX5FYPA==; 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 1jblKj-0004cC-DE; Thu, 21 May 2020 13:34:01 +0000 Received: from esa1.hgst.iphmx.com ([68.232.141.245]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jblKU-0004Qo-Gz for linux-riscv@lists.infradead.org; Thu, 21 May 2020 13:33:48 +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=1590068026; x=1621604026; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=S1b36p02cSwnUtlEy0TuBRB1sDC6K5s4EWPDv4UR5KQ=; b=f/HPTbVPs//c+WYRijI+dvxpOLlAY9Hgyhb/KPlMqjZfR+/P8Eak2pXZ SWDOudcVmxz1/xAYt3TyZ8swWhQBYIGTLEP6MVMOSVF8NbZT8FuW3iyrg PP7JuCa4smayf414ECjANtnaYcrqIBEe+Ex3ujOyBgHhvoV1A2tLCvqS3 pqle468mnPl5pmLmBlaplySs3hlroWbpY4PDifUiAcOZxtfEojU8SajxW 2Wgye5VsIFnyGLJbbk+PTY28O+8Ys6PaZZqgg0ZfD/T1BnQdXej2Foggg kz89eKURuzBaw+VDAmUVgb+Mrz9o1Wpx4UmCZ9dVX9SL2Ky8mnLKZdcar w==; IronPort-SDR: M86uoskcf8vKZwSN0GxsuXwKn5Xr1THXq+RmWDkLgv66oxg8sd5ExXjepaPYYks5HAtbSGHrRU Q1IwU7IZLx+nA6CCcivS2/TyBBXfQ1tKdHFZKt/wv0FkYPv+6a6COgi5RMh594SwcB6k/yVSmY 4AvNxnavFeAjcjyH/CkTprmttVBNM8mZ2b5eRafuQeES2Extg3P2lyCZnzZgsX9DJZqJ/yk5Tg 2+NJMI3uAo3K5UluVb+eWjABMwejAFbZwHNxY/XQ0xIYHmPMOd19H44n40HfH/NMUGal7Uv8PG H4s= X-IronPort-AV: E=Sophos;i="5.73,417,1583164800"; d="scan'208";a="247222585" Received: from mail-dm6nam11lp2170.outbound.protection.outlook.com (HELO NAM11-DM6-obe.outbound.protection.outlook.com) ([104.47.57.170]) by ob1.hgst.iphmx.com with ESMTP; 21 May 2020 21:33:45 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OPajDwVhyp6odVtDHbSxQYk5vW+3xxTikRFcaM0iXEZ3+iV7l2M+a01mHPmhsVbRW8uU2XHPNOTn2t5hQPcJEJRDnUFiDpS0df5jSdMU0VngT2++GwicFmuws/EmyvwLk9d123chogP5zxQRkWBBNfjKHlkk1MAkq62H8xJ5aa1ygotdfb3sNQp20PKpoqllT56OcypxilGhRUYuz6xhnLSnp9gYhzXkAYHfO3YiAp183WA2RmnXV5PwoOQBLDASSX28CE2ETgxsILq/ZS53kwOXrwq50x+qEW6Jl0dEfrm7vmjZCA5yt5/08OHTF2qXBLxwDe5oiOKovKyY65LiYg== 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=uE2W9DLlKdGilXoKWil4+pDPIMKsBgbm4cT6I6B7Gbk=; b=g+AWvkYEDy77bMztKfc2cdUKkzSmSgia3omF1hBQ+fYYj6Gg8iGrnx/BDR2niXW6smvzEkocEQ1GYT8JUEhHHJKaDqE2JsjSNaQb1JNKTxwnx3ag7njGlFwfAsC4YRjZhdI519eN8b2NWWwcJpaOql/qbXYq7y25620OWRfJV03EU8wzOX2NgPpMp6nH2l9OE0n4tBqbcJVE65LflmmAo33ZZoxmN1m0B7DzMB855gpVZGWqRxKVwfh2749IYYo+wnu7etF7AS10e/pxaShOXrSO7mrIY9GvzppLesncfqZh9Lty8ttk8tq6NG0u61sGEbab6QAfcX8HBgd2Qawgkg== 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=uE2W9DLlKdGilXoKWil4+pDPIMKsBgbm4cT6I6B7Gbk=; b=oIs73KfWFA8rLRTWHGjXgi33Zaw3I5yaE9wPV7DNjf/OG51XSaxz6Yc3qmX0nzjdGsc6QEliiS9HPAgRbrUgwPFmj6W7272LN5vCjgiu3nGomYrUyjqJP+Un0nWsfC1kpEI+PqnJf1xm/1sqmcWbFDDZEAZ3NyLhBbaaPwX+UPk= 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 DM6PR04MB5292.namprd04.prod.outlook.com (2603:10b6:5:107::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23; Thu, 21 May 2020 13:33:44 +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.3000.034; Thu, 21 May 2020 13:33:44 +0000 From: Anup Patel To: Palmer Dabbelt , Paul Walmsley , Albert Ou , Daniel Lezcano , Thomas Gleixner , Jason Cooper , Marc Zyngier Subject: [PATCH v5 2/6] RISC-V: Rename and move plic_find_hart_id() to arch directory Date: Thu, 21 May 2020 19:02:57 +0530 Message-Id: <20200521133301.816665-3-anup.patel@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200521133301.816665-1-anup.patel@wdc.com> References: <20200521133301.816665-1-anup.patel@wdc.com> X-ClientProxiedBy: MA1PR0101CA0033.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:22::19) 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.30.72) by MA1PR0101CA0033.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:22::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Thu, 21 May 2020 13:33:38 +0000 X-Mailer: git-send-email 2.25.1 X-Originating-IP: [106.51.30.72] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: c7d0748a-7ad9-4701-ee17-08d7fd8b9527 X-MS-TrafficTypeDiagnostic: DM6PR04MB5292: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: WDCIPOUTBOUND: EOP-TRUE X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-Forefront-PRVS: 041032FF37 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: p938/xmYXCk2FBuOkjT6oezuthJBHhk8EsAFYoEsKzDsfNU6dSiZG0I4sHQMruPFMXXoNyMtKcRQTdVp7HCYCRKijBDCB7EEm9hsRFqo7VHnW6VzMM5HxT11qmMg2EsRjpZFQY1s0Goj4XwSCCDmfj1GiOM5xBfrXRU/cS7nNfU+Fa1a/6zDRZmaqVC2wu548IK14tBzybPi3gpe4zQXb2YjjwGs7dxZFCtyl3YRfu5kU3UzPAfa5lazsByRqn1y6wxMu5kSvpDZRt8N51r7WQyLHIFzV1WbTsu9h9MHG2+ZQQjUBKWz+qfViVX2gT3M 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)(346002)(396003)(366004)(136003)(39860400002)(376002)(478600001)(7416002)(5660300002)(8936002)(86362001)(8676002)(4326008)(8886007)(55016002)(26005)(7696005)(186003)(1006002)(1076003)(6666004)(66946007)(2616005)(2906002)(66556008)(956004)(54906003)(66476007)(52116002)(36756003)(44832011)(16526019)(55236004)(316002)(110136005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: zOFjmYBqTs5lqOa01XZrBBLeNcnF2br4qofskPkuTBEmTK5NbVySfEhydJOwMDZ4E7FVnN2j71qqLWruk2rJ4GQrrdNUnWKpMij6ADAPbzZamcQqJePhCsDkLqq8KdKwi3EkoIjEW8CUiW8akwVLlJScGGd5bOCvYnhTIT3T79xlKOaiJ6R4n3umgabCxnhLugXE/T/kcUzxM3SFRWQp7NOr/iK+E5iAV86RBd8gHgT9PvVCqDieICNJgQFhb5l8hUVNkJf5owmoGKNLVqGwl6Kr3Vv6kexXttXwc5xn6MQcil/esmKd6ZCwT8EHl6dzsIruE4zB/mDO1w2B94P3lmppxn3cWWgVFX/VoNlOxqKAWOWsSDKPEh3J1B+LAxRkZNnrWJn/E4bmpXCWDjoNjxxNCtb0yv4Fa7pLthsxbbehbbUYNERsNaVDEilu9Pu9jcUCx8gjdF8pmSX2I1umHyRdoMUNIZ6w2MzOPt/sFpA= X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: c7d0748a-7ad9-4701-ee17-08d7fd8b9527 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 May 2020 13:33:44.5435 (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: D0lSxjUINoMsepxIQCI6kG/m75xm6DiAChJog4iS/agv5MmunDwWYV7H4AKr2H/VwtDn8CQxUlr8iF8jZC8lRg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR04MB5292 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200521_063347_241731_FD915C8B X-CRM114-Status: GOOD ( 15.34 ) X-Spam-Score: -1.0 (-) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-1.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.141.245 listed in list.dnswl.org] 1.5 RCVD_IN_SORBS_WEB RBL: SORBS: sender is an abusable web server [106.51.30.72 listed in dnsbl.sorbs.net] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches 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 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 Thu May 21 13:32:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 11562983 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 9C78B912 for ; Thu, 21 May 2020 13:34:11 +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 6F496207F9 for ; Thu, 21 May 2020 13:34:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="LVHiaxNZ"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="QwwXrnKc"; dkim=pass (1024-bit key) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="U5oIBv4g" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6F496207F9 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=Fg7MiPWB/elFn97Q1Ih6JCsjX7DkUKlEfYprlih65QI=; b=LVHiaxNZ0hMtcbt3A7YdXItKU tcgy7GRBnx2xGkV/wfASNCMrN+iHd08Wcf11mot1FPgCVQcVehUajbmvzoDCQnNZLDBYu3rNFB1kb wXGhMtOkro22NXRPjo6fBZz/Am6A0+6yrcjb6LjFmKYp6Nl2hM4xHTJRMOlPNRBL1baGr70lKk+J3 6r+vyqwl3Ysb67VBOb9KYeSVOg71KRBRiALjeytI3InamK+ewRnXCOIhW45pjvirKtH0xSbKgvQBz a5ou1CGhY7Ipew+10mEClR8idpmZtJ2lu2h0AbxFdaSi7IHzpVl3t8wcCHKKVIlTvqsF/MOlnzFoQ 3lwxunqGQ==; 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 1jblKo-0004hS-NZ; Thu, 21 May 2020 13:34:06 +0000 Received: from esa1.hgst.iphmx.com ([68.232.141.245]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jblKb-0004VT-5F for linux-riscv@lists.infradead.org; Thu, 21 May 2020 13:33:56 +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=1590068032; x=1621604032; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=MqO5f5RlO5STDnQTzsAPdAvfxA2KDBC/P819Iic+IOk=; b=QwwXrnKcTdMsyR2EntCdNfYhbWRMKHPQSyUoMSfVTOxHCrdCjZi3UUQt W8nrOHWL6dEvAjOwzVf9hJP7ubcYBeR/HhWoCbZuja2mi/uebhwc51i8j /0y2zErsfMv1ZGsFbzUIqU6TLr90220ggTb1SjM6U3O5Lrmr/C7hX24+i 7RfhYt28dIWJlKSOpPv4j0efIkdIr/7FuBcC0qQMriylicirKjq2uhEnR +Vm1tX8ieZVHmzgGWv8Yp5AzoKRWy0QwIZSka+4+m94E8a2Uegva/uWdU vdKM69e+pND6OIage39X+D6ssICB6d8l2QdnDiVPdvZYwDX2G/2S+ao/6 A==; IronPort-SDR: 3oB6iVgBIryEbrQzKdHZfRjeOUWPnY4jSzf6Etn59PYfi2UPFeWwcx59/deDX5zmjEyK3pxDz1 64IHVTIuzdi2VGleJYVFC/Mw0CpyreX25FsFsMJDSgphkaAFAItzlMErHoDsW4c1q8cqljdOWp P8tzWtCAZ9Wzrk01GFbA5WmMYbjr0KOo3aLZ8HuLManYveXcJjENOUwL/JmZynvJnddLtZC8aW 4AG2RTxHGLKQV/lS2lQiRjUk3KWMgFiZGabGZ5Kizq/Jv2k2SdfVyOc6HI82dcvGwoqgrpsfvH aUo= X-IronPort-AV: E=Sophos;i="5.73,417,1583164800"; d="scan'208";a="247222595" Received: from mail-dm6nam11lp2168.outbound.protection.outlook.com (HELO NAM11-DM6-obe.outbound.protection.outlook.com) ([104.47.57.168]) by ob1.hgst.iphmx.com with ESMTP; 21 May 2020 21:33:51 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FBaBMk2hQMG9FvuyOgkg0o/VEw1k2KNswxwGqrsPenkYLgx6lnoFkxtPiNBdgwFdXcY0xDAyN0Zu6YDJRGUOkbQQ5crF3RyGL8nBECl4WSHQA9Pk7+UWUhjqZN5v7/F9B78Sv2iI8U6yAizhqeYhNGzVCa9ZgP4zNcIAG2jCXIC8mbFwSS2sz4psFsCo8sTDQvZXeCAnbY/u5oDxgIGop+9a8hKyQZW+RWkmHfvqI5ebkc165g6C1ZvpxzMzGjjxZd2cLJjIvBkD01hkqkppLgYWdt7EButmdULYkKfQ4KA3NJoCUVkAdIeXD7etPO6cYPQ6HF4Uf7ULKNkNMcoO+g== 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=Fg7MiPWB/elFn97Q1Ih6JCsjX7DkUKlEfYprlih65QI=; b=BE6aSJ+iRkdaZo+qo1XITyVCjLCwOvgnM6Zn7XWpbzki6vhFQ6IW15W1q+xFVHT6F03hlY7wv6RVMCLNPEE1gcb16P9k4FMStQz9YU6v0rr+JeUzcc12IRIRw6uoPfvf+JL9L7WW2N5x7/BzoDpHvYF+54xY0u39P3MERI+GHkzTO70uQCGmfuyeQghPi6flae03gd3AT3ZA7fnHOSnSYuV+o5J+DmA5qgIYlP/SY0txfsn8AAcoxgr4jWgS5c8QQf5InDsk8sQPilVHn21UuUEBAv94AWmYNUNPyg5DIGScYIXtV/kHQ3owItk3puUpf/i8at/A04MI3qmJQuV1nA== 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=Fg7MiPWB/elFn97Q1Ih6JCsjX7DkUKlEfYprlih65QI=; b=U5oIBv4gHfSHRV0p8HH8aKtyjDoVLCwZ9ypXbqOBGiW6ITSgGjfTTB0AlhZkFAFQVoIF4M7hO4tPGdBU16njn0awdk8+lXrr2Jzg2PhIpq4wIXKreclm/O/NKNLdODJ6ifuY25LYl9Ta3cHWC2iPUfAEyZu1MzHTszypumvp6QA= 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 DM6PR04MB5292.namprd04.prod.outlook.com (2603:10b6:5:107::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23; Thu, 21 May 2020 13:33:50 +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.3000.034; Thu, 21 May 2020 13:33:50 +0000 From: Anup Patel To: Palmer Dabbelt , Paul Walmsley , Albert Ou , Daniel Lezcano , Thomas Gleixner , Jason Cooper , Marc Zyngier Subject: [PATCH v5 3/6] irqchip: RISC-V per-HART local interrupt controller driver Date: Thu, 21 May 2020 19:02:58 +0530 Message-Id: <20200521133301.816665-4-anup.patel@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200521133301.816665-1-anup.patel@wdc.com> References: <20200521133301.816665-1-anup.patel@wdc.com> X-ClientProxiedBy: MA1PR0101CA0033.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:22::19) 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.30.72) by MA1PR0101CA0033.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:22::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Thu, 21 May 2020 13:33:45 +0000 X-Mailer: git-send-email 2.25.1 X-Originating-IP: [106.51.30.72] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 917975c2-fbc1-40b8-3644-08d7fd8b98e2 X-MS-TrafficTypeDiagnostic: DM6PR04MB5292: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: WDCIPOUTBOUND: EOP-TRUE X-MS-Oob-TLC-OOBClassifiers: OLM:2089; X-Forefront-PRVS: 041032FF37 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oeWjlVKt064xqegtliLd5rC4C6tf7IvtvqSZ2Mxn4ZdE9ZY7FHH6aPmZ1jKCmwe/3d8q+cOn8sZcsU2rjH9qIoM3xlplK1XAKBw5CvOKpDvv8cKUM4ejcjBHiilNw8WFeH+z7FZbpwxDdYG4OFThqLzhZAZZ7bSYkGzhNk0j+1sSYX0UKidhvxEz+HlYccthQlcEpKknW08b4zHT43wpQjjmL3wgaeU5LJfqdJopaaSy5Q838z3M1X1/3HV3a/G9eKhNhsR8GX5Je9ejNOg1jOWnzLGksvvX2pWiJ94Yo4XRCH+tJl1V2+7YJGYojKuxmqKm0ka1QeNhjnv4+/baltdtPm8nSScL0BrDEsLV9I4lZuF8xDWshZBIlcb7/A4qidBCWdZ0SminKPgJemHuZg== 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)(346002)(396003)(366004)(136003)(39860400002)(376002)(478600001)(7416002)(5660300002)(8936002)(86362001)(8676002)(966005)(4326008)(8886007)(55016002)(26005)(7696005)(186003)(30864003)(1006002)(1076003)(6666004)(66946007)(2616005)(2906002)(66556008)(956004)(54906003)(66476007)(52116002)(36756003)(44832011)(16526019)(55236004)(316002)(110136005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: xdg3Pa9AN9Dh/q3daj9YUcIvB9pX/X3jNd2NOpA8QoQRclzj9S2hW/bDuHmpdPILP0uHYhJjmWiAzAt/L9bpCC1QzXZibhZmImKFT7RxqIi1FFnZ1y2tdDtX4Ue3Ewbd4BAaIOTMfYeAKX3r6UuLAzmTx7YMpJmkToak/Yd48qatLTkBlSwojRawiUkAF5MLwaXIni29cM6kvnGnfx1Vj9nH301l2Oi3P559xJeyugTjnQ8+QcPYM4t63sMOAfb0ZYQpOdS1VqqPlvUhy2g0W/V++pJS4omHqZQSeSoazj8wCetj3aMrjErVqeE5SW/I/W4bfQXsYyp7ujrKa1R6a4hRl0g4/JUd319b9NnHY1hW4WMf2xXk4uJ/uS5SpjbtuenwD4H0ERjQSKyoPD/8AV0psCDWY4OF0Izx4JYx3nz10Y1TPY219YJr5t8lvWcTKUB2vIhrBuxMLnmXe5km7FTPXQKCflGIkDGbhUrL7mU= X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 917975c2-fbc1-40b8-3644-08d7fd8b98e2 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 May 2020 13:33:50.5616 (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: /vpu1YwVM7ppPwV35wceBPwCs/hJ2xWV9BTubrcmVRU2s50Y9CxPNS5P/RCbprK/K3/H2+/7IIShDOCQSTtN/g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR04MB5292 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200521_063353_238747_FD3DEECD X-CRM114-Status: GOOD ( 23.86 ) X-Spam-Score: -1.0 (-) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-1.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.141.245 listed in list.dnswl.org] 1.5 RCVD_IN_SORBS_WEB RBL: SORBS: sender is an abusable web server [106.51.30.72 listed in dnsbl.sorbs.net] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches 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 manages software interrupts, timer interrupts, external interrupts (which are routed via the platform level interrupt controller) and other per-HART local interrupts. This patch adds a driver for the RISC-V local interrupt controller. It is a major re-write over perviously submitted version. (Refer, https://www.spinics.net/lists/devicetree/msg241230.html) Few advantages of this new driver over previous one are: 1. All local interrupts are registered as per-CPU interrupts 2. The RISC-V timer driver can register timer interrupt handler using kernel irq subsystem without relying on arch/riscv to explicitly call it's interrupt handler 3. The KVM RISC-V can use this driver to implement interrupt handler for per-HART guest external interrupt defined by the RISC-V H-Extension 4. In future, we can develop drivers for devices with per-HART interrupts without changing arch code or this driver (example, CLINT timer driver for RISC-V M-mode kernel) The RISC-V INTC driver is compliant with RISC-V Hart-Level Interrupt Controller DT bindings located at: Documentation/devicetree/bindings/interrupt-controller/riscv,cpu-intc.txt Signed-off-by: Palmer Dabbelt Signed-off-by: Anup Patel Acked-by: Palmer Dabbelt --- 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 | 158 +++++++++++++++++++++++++ drivers/irqchip/irq-sifive-plic.c | 38 +++++- include/linux/cpuhotplug.h | 1 + include/linux/irqchip/irq-riscv-intc.h | 20 ++++ 10 files changed, 229 insertions(+), 40 deletions(-) create mode 100644 drivers/irqchip/irq-riscv-intc.c create mode 100644 include/linux/irqchip/irq-riscv-intc.h 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..2f364e6a87f9 --- /dev/null +++ b/drivers/irqchip/irq-riscv-intc.c @@ -0,0 +1,158 @@ +// 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 +#include + +static struct device_node *intc_domain_node; +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, 1 << (long)d->hwirq); +} + +static void riscv_intc_irq_unmask(struct irq_data *d) +{ + csr_set(CSR_IE, 1 << (long)d->hwirq); +} + +static int riscv_intc_cpu_starting(unsigned int cpu) +{ + csr_write(CSR_IE, 1UL << RV_IRQ_SOFT); + csr_write(CSR_IP, 0); + return 0; +} + +static int riscv_intc_cpu_dying(unsigned int cpu) +{ + csr_clear(CSR_IE, 1UL << 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); + irq_set_status_flags(irq, IRQ_NOAUTOEN); + + return 0; +} + +static const struct irq_domain_ops riscv_intc_domain_ops = { + .map = riscv_intc_domain_map, + .xlate = irq_domain_xlate_onecell, +}; + +/* Get the OF device node used by INTC irq domain */ +struct device_node *riscv_of_intc_domain_node(void) +{ + return intc_domain_node; +} +EXPORT_SYMBOL_GPL(riscv_of_intc_domain_node); + +static int __init riscv_intc_init(struct device_node *node, + struct device_node *parent) +{ + int hartid; + + /* + * 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 INTC initialization for + * the INTC DT node belonging to boot CPU (or boot HART). + */ + hartid = riscv_of_parent_hartid(node); + if (hartid < 0) + return 0; + 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) + goto error_add_linear; + + /* + * We save the DT node used for creating irq domain and provide + * it to other drivers using iscv_of_intc_domain_node() function. + */ + intc_domain_node = of_node_get(node); + + set_handle_irq(&riscv_intc_irq); + + cpuhp_setup_state(CPUHP_AP_IRQ_RISCV_STARTING, + "irqchip/riscv/intc:starting", + riscv_intc_cpu_starting, + riscv_intc_cpu_dying); + + pr_info("%lu local interrupts mapped\n", (long)BITS_PER_LONG); + + return 0; + +error_add_linear: + pr_warn("unable to add IRQ domain\n"); + return -ENXIO; +} + +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..4f9b2877aa9d 100644 --- a/drivers/irqchip/irq-sifive-plic.c +++ b/drivers/irqchip/irq-sifive-plic.c @@ -9,6 +9,8 @@ #include #include #include +#include +#include #include #include #include @@ -60,6 +62,7 @@ #define PLIC_ENABLE_THRESHOLD 0 struct plic_priv { + int parent_irq; struct cpumask lmask; struct irq_domain *irqdomain; void __iomem *regs; @@ -219,15 +222,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 +242,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,7 +256,8 @@ static int plic_dying_cpu(unsigned int cpu) { struct plic_handler *handler = this_cpu_ptr(&plic_handlers); - csr_clear(CSR_IE, IE_EIE); + if (handler->priv->parent_irq) + disable_percpu_irq(handler->priv->parent_irq); plic_set_threshold(handler, PLIC_DISABLE_THRESHOLD); return 0; @@ -259,8 +266,10 @@ static int plic_dying_cpu(unsigned int cpu) static int plic_starting_cpu(unsigned int cpu) { struct plic_handler *handler = this_cpu_ptr(&plic_handlers); + int pirq = handler->priv->parent_irq; - csr_set(CSR_IE, IE_EIE); + if (pirq) + enable_percpu_irq(pirq, irq_get_trigger_type(pirq)); plic_set_threshold(handler, PLIC_ENABLE_THRESHOLD); return 0; @@ -273,6 +282,7 @@ static int __init plic_init(struct device_node *node, u32 nr_irqs; struct plic_priv *priv; struct plic_handler *handler; + struct of_phandle_args intc_args; priv = kzalloc(sizeof(*priv), GFP_KERNEL); if (!priv) @@ -354,6 +364,23 @@ static int __init plic_init(struct device_node *node, nr_handlers++; } + /* + * We can have multiple PLIC instances so setup chained handler + * for all PLIC instances. + */ + intc_args.np = riscv_of_intc_domain_node(); + intc_args.args_count = 1; + intc_args.args[0] = RV_IRQ_EXT; + priv->parent_irq = irq_create_of_mapping(&intc_args); + if (priv->parent_irq) + irq_set_chained_handler(priv->parent_irq, + plic_handle_irq); + else { + pr_err("%pOFP: intc mapping failed\n", node); + error = -ENODEV; + goto out_iounmap; + } + /* * We can have multiple PLIC instances so setup cpuhp state only * when context handler for current/boot CPU is present. @@ -368,7 +395,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, diff --git a/include/linux/irqchip/irq-riscv-intc.h b/include/linux/irqchip/irq-riscv-intc.h new file mode 100644 index 000000000000..b11d38353099 --- /dev/null +++ b/include/linux/irqchip/irq-riscv-intc.h @@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (C) 2020 Western Digital Corporation or its affiliates. + */ + +#ifndef __INCLUDE_LINUX_IRQCHIP_IRQ_RISCV_INTC_H +#define __INCLUDE_LINUX_IRQCHIP_IRQ_RISCV_INTC_H + +struct device_node; + +#ifdef CONFIG_RISCV_INTC +struct device_node *riscv_of_intc_domain_node(void); +#else +static inline struct device_node *riscv_of_intc_domain_node(void) +{ + return NULL; +} +#endif + +#endif From patchwork Thu May 21 13:32:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 11562985 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 A1470912 for ; Thu, 21 May 2020 13:34: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 21D012072C for ; Thu, 21 May 2020 13:34: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="XKcOARCz"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="fQK16ZuT"; dkim=pass (1024-bit key) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="gfYvXUUz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 21D012072C 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=kvfw+lovIXsLK+yOaHge7DSGT5zwQr/AVVrdpOm6juA=; b=XKcOARCzVlHfaQkNv0x8wN+eD an/cyZ2+7Lv2Tr3V5F23Z9SQw9jXD1piya/BtwEV8tOjtJNinVD4hlauGt8LuJj0gecsxt3QdOl/t hK7iePV9KNd6jYEiTMlWFyvP6i3mtrFloQwHpktuO0nXRhKwdo3L11cd24FdNc4WgC94ytuKtNveH LBew2pzAOskh0X9joTQN5AwzDCwzlIjB44tlqXN8y+I5eTauqobu2WzbrHE/xfsXKi9Z9BjSigCgY a6Wa9SBy5Aimse3+hJXhdiuE0QQoMeg5PmlM0Nu79EiC36xb2oKBbAJDWHWT4ENdzLPSt9Dmpow/E LpI8q1Riw==; 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 1jblKw-0004qZ-34; Thu, 21 May 2020 13:34:14 +0000 Received: from esa3.hgst.iphmx.com ([216.71.153.141]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jblKj-0004cF-QN for linux-riscv@lists.infradead.org; Thu, 21 May 2020 13:34:06 +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=1590068042; x=1621604042; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=BErtjAeBL1SviChJtnWylHqU8vLOpKiKu9mLkKVDrkQ=; b=fQK16ZuTc15oE8T2ZH9E/UWQ6u9knA0S2maVcm62rYlThOfnB/6jR+/v W4I38vgJM0YTmkOYu50RyyzoFEK25lLw7glMbkuaEyKS3aeg/V4d9LKwi rxHHUoafXSYLB3XVDTUuVUd6aO+L9cOgtGklSfrkOMa66IoKyYtL47gVs Hjp4gM/rJq8u1XX/QHTXND08EeOOSIFxoUfKGP23WSDRedC8Ab2D7FlEs 4mQalBz+W/bmLjLY5L/6oIA3iA8I0bkO878tIOXNCzS0L5BWcq+7DbciB oP3QHj8SryicbEFiUYeeEyFNNDu9yxyLhNIORYCW1Gft6JnI5YHOv/wX/ g==; IronPort-SDR: oLZfxghExl1v7omzqOwn7buluz7d2NPgONVRpl8Wg6h+04rYGmC30pXz0yZfiEnhFxXPXGo/3Z jD/V1fAwYbJuPsRifKZXgC3fDy+csnYh8ohMR8kFVd/S1/vdhLwnWFnxzPJ1MRCA5M1stk28Mk 26WuDYlHuxuAyhxDlRfCN/Qxa6xQ2ehnJ4mTt5QIb4Ub/AnTO343DQroRgMV18bFmbLVb6/xK7 DpFrIXBLvpTSJa4N0B946hL15cloHUfbRBNUkBpmvWieXXUolnn64buAzghb6Tam+WQ1tH9vJl H9k= X-IronPort-AV: E=Sophos;i="5.73,417,1583164800"; d="scan'208";a="142554119" Received: from mail-bn7nam10lp2109.outbound.protection.outlook.com (HELO NAM10-BN7-obe.outbound.protection.outlook.com) ([104.47.70.109]) by ob1.hgst.iphmx.com with ESMTP; 21 May 2020 21:33:58 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e5jfuPsRKFwnsG7kwfY4xbpImqDcIE7Ce4SAqxoQumJJ4A27qj8X4vtDWexbaSMu8S37sx7ry4s9tJuODrgBPLFDgJ5QMSyK5oviZ10h6c0HARDUZrV4blAnO4c4R69doJ4azgbothZSp6LIa/ekA2SJg7FO5oohEl0xcx3sg1b/BHFLoycYnIqtneHZdyZoiS5vcDVnUiREo/0RD8dcdcOVb7VOeZB/SWRsDlLgAPmZpjX5wHHEyvtl7sVWSqWOQULMV09mqGD3+YwLxax/Npx5kzQq5xD0gi1FuCcuHR/+3I5V5Sd0gVnm1KfvwB7VZfJytt94CGDXkG/19xgV4g== 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=kvfw+lovIXsLK+yOaHge7DSGT5zwQr/AVVrdpOm6juA=; b=MtWRH8U7MQig2WJS/UJjkar5U9F+hJSr49URwe3yB6cWEPolzXFzqfEozqKiuUopxUHvT/Xza08aJi7A6lXJuv/LNa1gNYy6MQdIjHFMnBU0UuIV0SadaixdQjBhQmalgBcWQXYqhKrWYk0zuvXyA3fCNovzIgeUlwoVuczeFsgj+3nxOR/MISfo50RluGYNGiFSDSn5Rw0ftcU9BpQwV8gS6brOTDab6rBqGRLRELqrQxR+a33xi9ShWwFRRGI5C35FIaJAB6b4GpyyzU/PE1UEXr/SK0iKckHtMSF1MCS/9h8JypCBn16EH5NdGwGYPhqO2g+hehzy/2AwCKJ9Ow== 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=kvfw+lovIXsLK+yOaHge7DSGT5zwQr/AVVrdpOm6juA=; b=gfYvXUUznhmjGxe6vKDhnEg4IhiMgVAGu162uSnpA3bCO3ZJIZZN1K2WF/VRynuSkGGnI7YgMpThkHDGggPRxqtMfqobfuYbvkRFTz6G07Ha+BUBOK9quDJEgaVsoi0/DSCRmns83VHaLIXVSx2cKz7ZFbjxkRZQAm6ezSTb3p8= 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 DM6PR04MB5292.namprd04.prod.outlook.com (2603:10b6:5:107::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23; Thu, 21 May 2020 13:33:56 +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.3000.034; Thu, 21 May 2020 13:33:56 +0000 From: Anup Patel To: Palmer Dabbelt , Paul Walmsley , Albert Ou , Daniel Lezcano , Thomas Gleixner , Jason Cooper , Marc Zyngier Subject: [PATCH v5 4/6] clocksource/drivers/timer-riscv: Use per-CPU timer interrupt Date: Thu, 21 May 2020 19:02:59 +0530 Message-Id: <20200521133301.816665-5-anup.patel@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200521133301.816665-1-anup.patel@wdc.com> References: <20200521133301.816665-1-anup.patel@wdc.com> X-ClientProxiedBy: MA1PR0101CA0033.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:22::19) 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.30.72) by MA1PR0101CA0033.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:22::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Thu, 21 May 2020 13:33:50 +0000 X-Mailer: git-send-email 2.25.1 X-Originating-IP: [106.51.30.72] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 6baada90-18dd-43a9-34e1-08d7fd8b9c9a X-MS-TrafficTypeDiagnostic: DM6PR04MB5292: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: WDCIPOUTBOUND: EOP-TRUE X-MS-Oob-TLC-OOBClassifiers: OLM:1728; X-Forefront-PRVS: 041032FF37 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: F1iEYl6Nnc2gfl/ax0RS/BMax3I9XG2/qgPNpP2PZW8v0Jd2Kl+ew2W63RIyBNGkJAnrAxH09DBA2Gh2W2mN8AUeALUJgIgGTqYGQER/ISAze9pHHP99NYDWYzx18DIzW8u0tBsggCuEVGtek8/j5zD/DWWsaGPDobSJKZb+LmcmuwTAWbdMTe1g7nE03UoaM3WleFt94jO01cnXDWyKv90wJJXMMjhU9l21IsXLPR8X3wH+mEqwzOi1Vfz27J8lzBYL3dXNxcfXxXFYGoNdtf9dI573xgDhQvLjvr87QsDFrj6J2zHkaGbDby5ohswJ 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)(346002)(396003)(366004)(136003)(39860400002)(376002)(478600001)(7416002)(5660300002)(8936002)(86362001)(8676002)(4326008)(8886007)(55016002)(26005)(7696005)(186003)(1006002)(1076003)(66946007)(2616005)(2906002)(66556008)(956004)(54906003)(66476007)(52116002)(36756003)(44832011)(16526019)(55236004)(316002)(110136005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: irgJM0k7GD9iO1H1np4Rt+r4G0skmo2YYrBNxwG4rQ6c1LuQsRL5ExjNsYADzOmO1l5yZgeT9IOP+5PCO12e6u/r0pyY6RFR+wgoWatfynxZ/JcTlXvMDqRCiGZwkwBKYgOpkMS3w8/NQf8pY8rS40CEzVxoMiLw+kCyZyafxsJW/DI5qjCG7fQTyYMS4xenJyRvRcultrJiHSoh+4iv6LJP46QiCr5EewBcoH6SwUGRiIs/gXYpG8hJc3XGR4y1knMIQVZ3i90iCHfDCDLEBjDUWLAL241rJNmcg8YdCa/b2d9xiekczGdpTzfeFHX8rW/iQkbvHflkXjC+4KXJdr2QJpNatPARP7yn5zs1mzMD3gR8WQ9iRr7AKJAnQ60zS0+S/5nMjWdx87fmWas1KM+2JRMsAjoM+CaiHSy5m1ZBzI4TpvjMW1iYikC0QWG4+w44araxyOowr2vODEFWgV1v5nttTP3NB55NJSVl1mc= X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6baada90-18dd-43a9-34e1-08d7fd8b9c9a X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 May 2020 13:33:56.7236 (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: dp8FDFKsa4fmxo/ulML/ybIUrYQqgysraOonIhFfsWkn+1nOJq/5SaqBqqIVc5NRDjyYKu40qUVMvfrxFTS4mA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR04MB5292 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200521_063401_903263_442D8E94 X-CRM114-Status: GOOD ( 15.06 ) X-Spam-Score: -1.0 (-) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-1.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [216.71.153.141 listed in list.dnswl.org] 1.5 RCVD_IN_SORBS_WEB RBL: SORBS: sender is an abusable web server [106.51.30.72 listed in dnsbl.sorbs.net] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches 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 --- arch/riscv/include/asm/irq.h | 2 -- drivers/clocksource/timer-riscv.c | 30 +++++++++++++++++++++++++++--- drivers/irqchip/irq-riscv-intc.c | 8 -------- 3 files changed, 27 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..5fb7c5ba5c91 100644 --- a/drivers/clocksource/timer-riscv.c +++ b/drivers/clocksource/timer-riscv.c @@ -14,6 +14,9 @@ #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,35 @@ 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 of_phandle_args oirq; hartid = riscv_of_processor_hartid(n); if (hartid < 0) { @@ -115,6 +124,13 @@ static int __init riscv_timer_init_dt(struct device_node *n) if (cpuid != smp_processor_id()) return 0; + oirq.np = riscv_of_intc_domain_node(); + oirq.args_count = 1; + oirq.args[0] = RV_IRQ_TIMER; + riscv_clock_event_irq = irq_create_of_mapping(&oirq); + if (!riscv_clock_event_irq) + 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 +142,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 2f364e6a87f9..d4fbc3543459 100644 --- a/drivers/irqchip/irq-riscv-intc.c +++ b/drivers/irqchip/irq-riscv-intc.c @@ -23,20 +23,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 Thu May 21 13:33:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 11562987 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 8DB761391 for ; Thu, 21 May 2020 13:34:25 +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 6A9DA2072C for ; Thu, 21 May 2020 13:34:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Qq8NXCqR"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="OHmDxkia"; dkim=pass (1024-bit key) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="iJUoEmRt" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6A9DA2072C 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=vIW8mLbhzuvo1cDfyIrESkO5w5m6aI+dl0GsvKBvwec=; b=Qq8NXCqRPXbuHg3ZKXQ5mKpuU nh9keYLghkW81dyh8mTMppqUZWyoR/RtRvwWNvNAMuDoxsB0rNAIMpFSiFAI4zXe7InSqQj4wqe1x xFqfMKzI65QM5209ge7ZFffzqqLf1Mzq0vwN0DUtb9ayfguyZVQKmxN2aFVT+OjQQNrdl8ZxFvnJ/ pM3fQZ3nFg8ttdS6Ddh9S/a55Z3QdQ+s7VkZIecpF3POoLaR5dwfcXI9MAvHWoKmY0O2uQuhkuWL/ SjRelsJ8z827lwM9gQHiJDjHbUygvuh6sardpowUi+wOJz8AG0GLAoDLZWJvhI38ROBMr64zku/MF NbI7uu/9g==; 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 1jblL0-0004v2-UI; Thu, 21 May 2020 13:34:18 +0000 Received: from esa1.hgst.iphmx.com ([68.232.141.245]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jblKn-0004gh-Sd for linux-riscv@lists.infradead.org; Thu, 21 May 2020 13:34:07 +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=1590068045; x=1621604045; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=pCUEHbF9CE+vua08f+UISvL50fjj/2PyTFk5LYpiBns=; b=OHmDxkiarRIlHCL+EjzvyJVvJkjxYwX972z2onV+7Od30nwzUmkE4Q5N 4Ssuy6pHnQByJeE1p4RBxiYnhZCD6ob0F2L+IPmsjoGbh1boJXtH8kilb ecB74CVUslk78DhrfYXja5s4E5yIRW7x9sCm8uDvdkNwUfb0W4sXrcusP W88uOwGruGipxWpYbv1v6UCP8pCg/BkrXkHlFyznjFXscLKm9tcJkuUU2 3BYy3ChgNrbYrm0ENp3E5KMrvqXyDFl24az34EFPcOgAaHyXkW5sTP7LH F2mQxL0+WAMeDM+2w8wSZKqmIGQTSckmuFI4pWGeFk1h+A7Zq4pXync5o g==; IronPort-SDR: /bb1K5GIS6rPazBchZCstOn/QvPwh5wIrvIBgXwPGaHh8guS6DST2qn5/NrAgEOpMQZDhhlt39 3ZUNgQ437SfzbJRkel+1Q0IDW1HDWhRXTgKCReE0BYINDN4xfyEEHcsWJjtD/Or64xQ4eacNCn MVZTd5iqTnfYOCmnV1ibsguuvp0eZwVxaZ06qM1skkRvAsMmOzQYA6wknWODQCLRvsAh4tJ3hO GeBrY64V9NB0odQ2lhDLL3gPtHfggE9ppeRhH3XeLV85rdw5I5umigx9a881+X/K6m6xNUBXVg CnY= X-IronPort-AV: E=Sophos;i="5.73,417,1583164800"; d="scan'208";a="247222612" Received: from mail-dm6nam11lp2170.outbound.protection.outlook.com (HELO NAM11-DM6-obe.outbound.protection.outlook.com) ([104.47.57.170]) by ob1.hgst.iphmx.com with ESMTP; 21 May 2020 21:34:04 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZF63A86Lfrz08AEXR3Wjeh1lEz40Sj41O3ewvfmDkw5hKVt8z9f1ucZAnTCPS3/NnoLONtnckvfOBORONY350T3QakACT8BY7v8AMSvwuUexH77P/7GPnTzNGJJqb1mNqiEmzv9lxfha8tUEsc+mTHtfL4qCxB4BH8DX5j3IaOxp5O/o9tODCjH6CiSzTJ98z+9qsL3n90FGHhuASUSgSa3sKU90PD2kzukERV35DBC3sZCcZx5g5Nc1i5inpgyeWnHk8m2Ciu1qQfHQ2XI+E/y86A15Zip6FG0FfKO3Kqhwv4vCahNTxusaj1hnrClNv8Fu6W8BmPPN39AsmuHbDA== 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=vIW8mLbhzuvo1cDfyIrESkO5w5m6aI+dl0GsvKBvwec=; b=h3cRgtT29f+AcuVWv68j80kbckAFSxV6h3aR5G6dhR4zf8ouyFxZg0HA4SMgAOUKm0aCmXX8Q0gR+8j0pWhhv3mPHihZxeMNVk6D7GsZqPfhqAr03z9TLDf9SFOsYO1AEyQKXCDoAZtjNSHQrfYnYFhgGYijdzHyngM8638jxz/bzlxK16YNtB9zN2JCM0ml27HvdY6ZACBtrlkAuQ6a/R72uYX/mLxbF8pny0KUWymN00y0dnJIV8zEuC6FSdZhT0xZ1foA5+U1yjkwWtIawy2q5jgkgWQ/Weyn5ihSC7YPJi/IR+FQ5TqHa3n14hAJFq3PX4WBVloo/ZjhNKpNGw== 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=vIW8mLbhzuvo1cDfyIrESkO5w5m6aI+dl0GsvKBvwec=; b=iJUoEmRtY8rXZiGDBoPcVEhS9uhUWxGXmuBtcXGQkvyvfXOsbLwKOnTWQD+DEbHA+NGV3aZ9qi26PIgKYmUz4FAgpWm+vXOV2fXOdOaL8rom0rg/t2BpX0arT5syEcqEqgJ1VRhI4ZDk9B+R6m5St5+tioaBeQCg+xX8246a72s= 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 DM6PR04MB5292.namprd04.prod.outlook.com (2603:10b6:5:107::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23; Thu, 21 May 2020 13:34:03 +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.3000.034; Thu, 21 May 2020 13:34:03 +0000 From: Anup Patel To: Palmer Dabbelt , Paul Walmsley , Albert Ou , Daniel Lezcano , Thomas Gleixner , Jason Cooper , Marc Zyngier Subject: [PATCH v5 5/6] RISC-V: Remove do_IRQ() function Date: Thu, 21 May 2020 19:03:00 +0530 Message-Id: <20200521133301.816665-6-anup.patel@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200521133301.816665-1-anup.patel@wdc.com> References: <20200521133301.816665-1-anup.patel@wdc.com> X-ClientProxiedBy: MA1PR0101CA0033.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:22::19) 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.30.72) by MA1PR0101CA0033.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:22::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Thu, 21 May 2020 13:33:57 +0000 X-Mailer: git-send-email 2.25.1 X-Originating-IP: [106.51.30.72] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: cb97dd48-9eec-4371-6bc8-08d7fd8ba053 X-MS-TrafficTypeDiagnostic: DM6PR04MB5292: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: WDCIPOUTBOUND: EOP-TRUE X-MS-Oob-TLC-OOBClassifiers: OLM:1186; X-Forefront-PRVS: 041032FF37 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4o8clqF8od8OtUc7LNE+5oJfgdJq/10B8M7UDYytXWrjaJGbKICIYOYn7obPeyyLyaNfaqgA6e6vLtf+5J7huRgEn1dJKRfTzS+n022WhZP3S+kAgIOU+GK647PNcUy+YSxDrs9ybn0W/yoWdokn7TTJvRmLRzHOdhdkk92eUfTyZaEOiX6WfDpFGOlwPItgmqcjmTnuw1xCzB9MhULwpWI2zhLgzxb8s8QMWENhMOXNFKVN/odQopCNtxRBVLiYUKPh0gMDO0Kp3mt46Dg6VWLwzXYRscZgvVxee5M3mNtin46Aihy2RtFpHRoYo+vd 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)(346002)(396003)(366004)(136003)(39860400002)(376002)(478600001)(7416002)(5660300002)(8936002)(86362001)(8676002)(4326008)(8886007)(55016002)(26005)(7696005)(186003)(1006002)(1076003)(6666004)(66946007)(2616005)(2906002)(66556008)(956004)(54906003)(66476007)(52116002)(36756003)(44832011)(16526019)(55236004)(316002)(110136005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: C5DBpHf/HbNyQuOca+FR9hjdyi0g9QpaNNJWOWXsTO5HRYzxun2NcQcDSW7gINI7OtFc2j2QM4P9fmgYX1I9UkycIBDvH4HC1BIuWHghMltdbfwyEFWMrE4T+jVOULd4JdrQZdU4vYVZXEEZp/C80tXg/fCq6ZO5S//vrd1hyug2CXgSCZIhaJ5SefAvDU0pTzS7TaeM7bre7PTUFVl4+fBDBjlVwc0SWc5muZB1cSwtTBp+lfQaTS4b/NZT/0IOlayWQcM60xzrrF11zAfTHKP0KJjSUUeKF/75KWIi4u0rXbwHRT+eEWdO3ndT/J1F/jwo6TBqylA1cc57RkCgYxhyirMFusSEMLG2I5rizvzFNw1/7VkqXShvC8wzjij7tzTThZeGmkc+9RTT9P6BLuGqumSHb84Cm4FBrahIRGR1qHYEIWRFPyUzRFb+8i7Bqu/K6XuJEJGBOkh09T3EOgPz9dr1QOVKPrMW35HZ9vA= X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: cb97dd48-9eec-4371-6bc8-08d7fd8ba053 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 May 2020 13:34:03.2275 (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: 34Of3SKXgtDmBs6B0d4CgruPRkb7ChI2/kOwNwP8xZs8NraewzgFydRgReRBlr93ik1r4u2h29Byqx08cXdMtg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR04MB5292 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200521_063405_976711_7F62A240 X-CRM114-Status: GOOD ( 11.60 ) X-Spam-Score: -1.0 (-) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-1.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.141.245 listed in list.dnswl.org] 1.5 RCVD_IN_SORBS_WEB RBL: SORBS: sender is an abusable web server [106.51.30.72 listed in dnsbl.sorbs.net] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches 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 Thu May 21 13:33:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 11562989 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 92569912 for ; Thu, 21 May 2020 13:34:28 +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 6F70C2072C for ; Thu, 21 May 2020 13:34:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="M23p8tXB"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="hC8Blm5H"; dkim=pass (1024-bit key) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="qMP9aTG7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6F70C2072C 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=BZEhRiYIYcIHJf5Y/gEWGyFEj2Hhz8fJlrML0+g2VNA=; b=M23p8tXBJj1fFyHgwPVlnPSV3 14UOShPemPAR2q1pGoA2rqcy0xQ53MFzO957ByiVmFfU09LS3xmBbebanYnA1EnWcsLbW+DFABAfT 2UTqJrLqQx0FF8IcPYHF5RqfPZPlF/b/ElEn5LcK+5DdPidNWH27x5FxGB5Bp+DUoFrxdyKlmvpa3 TdRQ8W2+/YO2KeOhYFRSPdHpNHzP9G46bMdri/9Pk4mJzQgpeAhYwBqr0isHY+oZR4FtHlQsrNmHQ uAv9GE54gszlsM46GNaxPfQ4il1Rszj0hjYMJP8H065KlC6qaDCUBrZMuAscpCLpvGFiuI8BHbzMr Iao5BxHFw==; 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 1jblL4-00050L-B2; Thu, 21 May 2020 13:34:22 +0000 Received: from esa3.hgst.iphmx.com ([216.71.153.141]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jblKu-0004oI-At for linux-riscv@lists.infradead.org; Thu, 21 May 2020 13:34: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=1590068053; x=1621604053; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=nJJH7qKpWaTWZpqnM6zCpFB04zk2b11haAfYaSUb2/c=; b=hC8Blm5HmbNquTHFWJ+ENnhyhikHCeN+toseEjHjeGG9a7yD2kyRL/vQ h0a4f6O8HMWrwzgPCtnh+nhyjpcXtubqOVrsIDJYjxVoK9tFeEZ72O+33 fsIRLUWllWs/JTmZzVZVyrhdb1BlwwPTmL/PuPr1QN85G7pfWp/aIWkAZ 019itl/CR0oa84/XsDrmENm2SjJ5dPzKWGORnNMohXn4NI/xqFKshM0NN nqIvthzS01ybBYOJgDDMCPIqa7ti45oUip8kZBPbJ5CM9RuFEgEF0lR98 ppKnJ97IXccewr8A03eTIKZStCyY03XhNZjLZ8Uh70OhaJkKIwVIUULrt A==; IronPort-SDR: CJWpRDpodX/S+CJ4GQ5UGznAZi+oFyPOipiDIFvc0bGI46yL0bLbppxSZq+OSUYr9xkESzQYsX YjT+tEUuSigeMP2Ry2YTAyDXCrsOLNlen3vQPKZbfAKsdL8/ivrYh/JUBuG1npITFlWhWBakDu 3B8KhMt/OyhYxtBYtVqMaS5PqcHH6BYgBB2oA011L8XGmaYWXN75QTxIqdgkAmPaKhKTZo1dcL lTpZ+z3yccP7e31QsR/GBdv1deLcqfv21FB7b48FgCQwh6M9aMaH3LJ0AduiS+2s9+cxKAAV/m Yy0= X-IronPort-AV: E=Sophos;i="5.73,417,1583164800"; d="scan'208";a="142554139" Received: from mail-bn7nam10lp2109.outbound.protection.outlook.com (HELO NAM10-BN7-obe.outbound.protection.outlook.com) ([104.47.70.109]) by ob1.hgst.iphmx.com with ESMTP; 21 May 2020 21:34:11 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QF1/D8Junh9RiIGKLG/E9+ogsDtEtFt4/Ew0YoF7iWwoL6GzKY08YRAe7FDir/SZf5qbM86ZLvjQtA9z5VodfKq6ZuMzV++1AEc66e4sahVrNalcmwHli4n6KV/vvV1mizUFpBl45eWAy+ud3phbaPl6Bm3ZvUNQUSGyKMwrMDHEABptgwoWU4w45OMw+416ostWo0UjAXwUz02BHvvCwdrAaypW+Q7xqVuOxto1J4qGr82VfDpUVAiU1aQ9CcDY8dJDAoNbHsdrYrqyLV+EdV0/fV3egt8JEmobnmj7lO29r/w8eyDLkM8K3783RE7DpBGWtKaa1WNbAPc+4Z3/Mw== 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=BZEhRiYIYcIHJf5Y/gEWGyFEj2Hhz8fJlrML0+g2VNA=; b=HLbeWsn2D6vDW6KFXeSKD9iN18UDmHerDuGzlw8Wx8FU+7RQfEz2KsoqkAXHEibtc6OWaxOGCLWCsTXKt2KW/2wEyZoPe3AsrHXzjrPEWrojW2L/o4hLlJHMWFjsVggVd/MhK5WfNNbbW4j124tEITGTL5Dh6JBB0GNaaZIkhx7I+OXTHl1wRSQyvZRSEYVhclF4MmbEH3TJlqyvUyJJC5LCDubR4k+n/qogAur4pllCIfJIC+gYvsS1bVKR7xbgi84mDOkXIhxsYjjJPEWWIAX3cJpwc02b6NGIJMWwOzJq93lrqs7rSpDnkxw3nsRwstiUUzrvkt7Mcq96fAQLiw== 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=BZEhRiYIYcIHJf5Y/gEWGyFEj2Hhz8fJlrML0+g2VNA=; b=qMP9aTG7VkmQ388UrawUBFQGrL8NzOIPPWJn/k5lyLbUl1OEtxho/h4aNO4irsvl3kmlRWkLEkr4GcXjafR/IFihsdEeSwiC6dsrtm2/37FgwAKRtpeVGyqOgav0bsLakpHqifXlY+eHa2l5sd7jkRs5yCEgvkn1nc3+4Bpvapo= 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 DM6PR04MB5292.namprd04.prod.outlook.com (2603:10b6:5:107::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23; Thu, 21 May 2020 13:34:10 +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.3000.034; Thu, 21 May 2020 13:34:10 +0000 From: Anup Patel To: Palmer Dabbelt , Paul Walmsley , Albert Ou , Daniel Lezcano , Thomas Gleixner , Jason Cooper , Marc Zyngier Subject: [PATCH v5 6/6] RISC-V: Force select RISCV_INTC for CONFIG_RISCV Date: Thu, 21 May 2020 19:03:01 +0530 Message-Id: <20200521133301.816665-7-anup.patel@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200521133301.816665-1-anup.patel@wdc.com> References: <20200521133301.816665-1-anup.patel@wdc.com> X-ClientProxiedBy: MA1PR0101CA0033.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:22::19) 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.30.72) by MA1PR0101CA0033.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:22::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Thu, 21 May 2020 13:34:03 +0000 X-Mailer: git-send-email 2.25.1 X-Originating-IP: [106.51.30.72] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 6b7e5965-f81c-4bc5-40c3-08d7fd8ba45a X-MS-TrafficTypeDiagnostic: DM6PR04MB5292: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: WDCIPOUTBOUND: EOP-TRUE X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-Forefront-PRVS: 041032FF37 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: S8WZDJLZmJhtTKTUAC19xDWg/gnBvfL71uG4pd8yjab0GXpmeNnM3SgX9VtXA4GBY7EjvhJ9zJgNpP7vXRZag8tt4XPR+wsH9ftFipgISPz7rKWECl5Vt7XVZdhM8cxDTIcG/1pl8kAWG9QDNd/VGNMqoN7hn4I/lhC3O93sTdBmj/sjOOtjsq4tNctJa03v724dVljA9OrF1JiJnycKOseoNpyKcnjgI4NKYC2zUONHkxQ8qbSBF/nlFZgmmGLiR7WJTd21Dpt04KDII7Jm0KqoWMTxT+LbWx7dkjvAJ9B2vThFFInUuhtIygb9hdz6 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)(346002)(396003)(366004)(136003)(39860400002)(376002)(478600001)(7416002)(5660300002)(8936002)(86362001)(8676002)(4326008)(8886007)(55016002)(26005)(7696005)(186003)(4744005)(1006002)(1076003)(66946007)(2616005)(2906002)(66556008)(956004)(54906003)(66476007)(52116002)(36756003)(44832011)(16526019)(55236004)(316002)(110136005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: sGwvgAS7gAjP62nv4FIF5IatnTA0rvUSOXCeDY4HT8a+FbLZJiDDcivGmN8HqEVsm67Fb1LP5Eu4ke1jRXUOoqKxJfp107nL51mAhj6rvXGsgqPERLCWKmQb3bMKT6GI3Z+6kDK9DJ2tpUQ4FPlEUji09vOXv1kWmffN9gE89zZ0SQ9b5iPYoYXaC/pleFDvf0dV+kK3tqXyFdnKrw8QKCLinOjJ9DZc+G/3spqpI4MRLQJ+/eAZ6KsrcN9FXrC/2BWN9Kuu6W4iqxUbh33nGS57Sbkl5zcvIe1jE/CPjxC6Q1nIvHMQXT0+GEkRzT0K6mSeOY9g2p4svoaIudfSJC78bwEgvjiftORG7MmxP0M0vcUY7z5vcO8Om/LB2lp1RdvZ1FcwmHysMSEdAu20eWeWY5aEZGBDmuk4PVC691/Rix6L3xwh312mTW2unbVOf8LZU61laOj+c2fIONMVQYKpZLTrH/DyoqqjkJNg2GA= X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6b7e5965-f81c-4bc5-40c3-08d7fd8ba45a X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 May 2020 13:34:10.0751 (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: v4fhoZJ0fMhOfhgMp5Ak8Xs73pz3WTG5r8CY2KccCY4Eowli6fkkSzd9j2MzznUNE9/JMTaAbUIC+1OajnXVcA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR04MB5292 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200521_063412_408845_FCCB343F X-CRM114-Status: GOOD ( 10.50 ) X-Spam-Score: -1.0 (-) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-1.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [216.71.153.141 listed in list.dnswl.org] 1.5 RCVD_IN_SORBS_WEB RBL: SORBS: sender is an abusable web server [106.51.30.72 listed in dnsbl.sorbs.net] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches 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