Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1891384imm; Thu, 2 Aug 2018 02:50:20 -0700 (PDT) X-Google-Smtp-Source: AAOMgpccYXXd7OY4oqUXv91sM/MbvXeaw6yTD+FZ8ODWDDsQKBxZeQB9RWpQRBu0T6My956/MWJH X-Received: by 2002:a63:c50c:: with SMTP id f12-v6mr2029316pgd.88.1533203420303; Thu, 02 Aug 2018 02:50:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533203420; cv=none; d=google.com; s=arc-20160816; b=e2S0QtFwzpzquPZyHafOsriqAiu+ywfkhTG/wrcPvo8HSdFlcwX22+BXBnO/rjIZrx qnDWlLBWnLjCAkd/y39Zfo5aOFs7oK9YMFog1zdZ9y/kZ4HGZ0hHzzGgWd8JoE5pFT74 A2TgIUhc+oVGRUILIA24zox4yZ/yyW/YvBMjpI2m3PAHDkCIa+rdlP9eHwJ17jov9Vtp MWHDGX+B9OwAOrUMdsx3tvG9hV2bjrjlc7W2cNbhFdtkukIlOdMdvD7Xjv5EX9l1L4C2 cN+dCTIESWtwrICQKXEgr46f8+qQVMhgcnGNUo4sXA3frWkbec2yIonCA9JtcOQQdEZ8 wTXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=kQfAvpqf7tPrG5hOC1rO0bdfLh4nu1sC5pST3yINAso=; b=MkT0PIK8nBRU61PbeP3dxmWHAu6IJLah52c7d32jKKLAzaCn/GCWlumlIWZZ2mZaiv z7NEtTX6hweuJnnYzbsGE3lYODF9ebs47+/1YDg8PjZbpKa0jZlph7het6fjFhn8Y5HR yWlq8arTsfWIXFPiTP5dqW5RUMEOx5ZT8D1nZrvr7DZKroE8qMIziHaeoNsIDrf1vQGZ ob1m2ZhuEKWqF1qMjriMaIKDOtY5xhMIOlrMzjqSCW1GEeYJO6HGHpBndl9RcPuiF1XT mXC2q0kL/WaRqtHDpFVNwOXd3QOKywketIBvRGsJtjaB6hjBaEnC2HYDTLW8cz5CxYR+ Ki0g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j4-v6si1123437pll.101.2018.08.02.02.50.05; Thu, 02 Aug 2018 02:50:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731895AbeHBLjY (ORCPT + 99 others); Thu, 2 Aug 2018 07:39:24 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:36240 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726313AbeHBLjY (ORCPT ); Thu, 2 Aug 2018 07:39:24 -0400 Received: from hsi-kbw-5-158-153-52.hsi19.kabel-badenwuerttemberg.de ([5.158.153.52] helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1flAE3-0002t1-EJ; Thu, 02 Aug 2018 11:48:55 +0200 Date: Thu, 2 Aug 2018 11:48:55 +0200 (CEST) From: Thomas Gleixner To: Christoph Hellwig cc: palmer@sifive.com, jason@lakedaemon.net, marc.zyngier@arm.com, robh+dt@kernel.org, mark.rutland@arm.com, anup@brainfault.org, atish.patra@wdc.com, devicetree@vger.kernel.org, aou@eecs.berkeley.edu, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, shorne@gmail.com Subject: Re: [PATCH 5/9] RISC-V: implement low-level interrupt handling In-Reply-To: <20180726143723.16585-6-hch@lst.de> Message-ID: References: <20180726143723.16585-1-hch@lst.de> <20180726143723.16585-6-hch@lst.de> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 26 Jul 2018, Christoph Hellwig wrote: > Add support for a routine that dispatches exceptions with the interrupt > flags set to either the IPI or irqdomain code (and the clock source in the > future). > > Loosely based on the irq-riscv-int.c irqchip driver from the RISC-V tree. > > Signed-off-by: Christoph Hellwig > --- > arch/riscv/kernel/entry.S | 4 +-- > arch/riscv/kernel/irq.c | 52 ++++++++++++++++++++++++++++++++------- > 2 files changed, 45 insertions(+), 11 deletions(-) > > diff --git a/arch/riscv/kernel/entry.S b/arch/riscv/kernel/entry.S > index 9aaf6c986771..fa2c08e3c05e 100644 > --- a/arch/riscv/kernel/entry.S > +++ b/arch/riscv/kernel/entry.S > @@ -168,8 +168,8 @@ ENTRY(handle_exception) > > /* Handle interrupts */ > move a0, sp /* pt_regs */ > - REG_L a1, handle_arch_irq > - jr a1 > + move a1, s4 /* scause */ > + tail do_IRQ What's the reason for doing the whole exception dance in ASM ? > 1: > /* Exceptions run with interrupts enabled */ > csrs sstatus, SR_SIE > +asmlinkage void __irq_entry do_IRQ(struct pt_regs *regs, unsigned long cause) > +{ > + struct pt_regs *old_regs = set_irq_regs(regs); > + > + irq_enter(); > + switch (cause & ~INTERRUPT_CAUSE_FLAG) { > +#ifdef CONFIG_SMP > + case INTERRUPT_CAUSE_SOFTWARE: > + /* > + * 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(); > + break; > +#endif > + case INTERRUPT_CAUSE_EXTERNAL: > + handle_arch_irq(regs); > + break; > + default: > + panic("unexpected interrupt cause"); > + } > + irq_exit(); Looks about right. Thanks, tglx