Received: by 10.213.65.68 with SMTP id h4csp1512146imn; Mon, 19 Mar 2018 06:17:54 -0700 (PDT) X-Google-Smtp-Source: AG47ELu2Bh7lpT/7kMOqaXTa0i9jCZgnU2OynjkBDP7NBbZGgGVSo3VQXXajS/PVUo2yUAGgB3R3 X-Received: by 10.99.96.130 with SMTP id u124mr9222712pgb.252.1521465473875; Mon, 19 Mar 2018 06:17:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521465473; cv=none; d=google.com; s=arc-20160816; b=eE0u1Af+ZvoNgh7J24EiH8BYVmEqLJiInSGnfNLo1i4SmAISPIQpVHPkvScBiho6ei n2twZ9j+5nzY8W+pNpqPKXQv050QG2wkzPqWP8dYRmpXXt69SCzD2kHl2gkSsrzLD0tq pQoA5gugCDpE6BDYlrgjwTSYYY1PMmD2fl4esaHXkRVFrba3Z6wriIZXFwTHqQIo88FP cZwGQs3qfPMwYV2Ug/Yt6HGMyzfHFRoe3wmgKSpKGZrOr8Jx/d3188zBUFdyCjGxcSA4 uFgVafUAMalggglAqhzTpED5kmh361nyHqo03bzeCLFBo8Le7mw3KPytmkOJiuCCCn6h 980g== 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=zPtkeFFEs2NtKX3UVv6uNt0J1vbQgqdy2kunt2O7uXA=; b=QYmpu0BOxnEKqjYLx6cEWlMJsxBtTAXKJVfXlXSL3TlzeDKTsA+iMerq8EIBdT70LW BmWsu+Maq+qWFv2HDk1/j/c1MjBO77FGl0dPD6ThA4wfOyaVXtZiJouAHYr+O8RdqguT 3ff6IId3lPB/BjmvlmrR0a4H94qnFz1W60KX+nBl8lRmPj8J8BNBVcurFGcAjRSFphDZ 2Yo5da/tNsXhnTotziJ5iO4VGsw4T1v/A3hvbeAMMuLPg7o2ORkvmCQDWQ8vZAAvAkwF Yby/EcD3UhCrA/ml7s5biE5hMAVONnLsXJXQlHfMDLIVDtrsTTohI+x0kkfa1IrXG1z3 1KlA== 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 z8-v6si12084631plh.379.2018.03.19.06.17.39; Mon, 19 Mar 2018 06:17:53 -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 S933063AbeCSNQo (ORCPT + 99 others); Mon, 19 Mar 2018 09:16:44 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:60182 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932889AbeCSNQm (ORCPT ); Mon, 19 Mar 2018 09:16:42 -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 1exueU-0008OB-Aw; Mon, 19 Mar 2018 14:16:38 +0100 Date: Mon, 19 Mar 2018 14:16:37 +0100 (CET) From: Thomas Gleixner To: Guo Ren cc: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, daniel.lezcano@linaro.org, jason@lakedaemon.net, arnd@arndb.de, c-sky_gcc_upstream@c-sky.com, gnu-csky@mentor.com, thomas.petazzoni@bootlin.com, wbx@uclibc-ng.org Subject: Re: [PATCH 06/19] csky: IRQ handling In-Reply-To: <28baa2d92e5c3145afdff68ca784075afbb64d88.1521399976.git.ren_guo@c-sky.com> Message-ID: References: <28baa2d92e5c3145afdff68ca784075afbb64d88.1521399976.git.ren_guo@c-sky.com> 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 Mon, 19 Mar 2018, Guo Ren wrote: > Signed-off-by: Guo Ren > --- > arch/csky/include/asm/irq.h | 12 +++++++++ > arch/csky/include/asm/irqflags.h | 55 ++++++++++++++++++++++++++++++++++++++++ > arch/csky/kernel/irq.c | 41 ++++++++++++++++++++++++++++++ > 3 files changed, 108 insertions(+) > create mode 100644 arch/csky/include/asm/irq.h > create mode 100644 arch/csky/include/asm/irqflags.h > create mode 100644 arch/csky/kernel/irq.c > > diff --git a/arch/csky/include/asm/irq.h b/arch/csky/include/asm/irq.h > new file mode 100644 > index 0000000..f68e868 > --- /dev/null > +++ b/arch/csky/include/asm/irq.h > @@ -0,0 +1,12 @@ > +// SPDX-License-Identifier: GPL-2.0 > +// Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd. > +#ifndef __ASM_CSKY_IRQ_H > +#define __ASM_CSKY_IRQ_H > + > +#define NR_IRQS CONFIG_CSKY_NR_IRQS > + > +#include > + > +extern unsigned int (*csky_get_auto_irqno) (void); > + > +#endif /* __ASM_CSKY_IRQ_H */ > diff --git a/arch/csky/include/asm/irqflags.h b/arch/csky/include/asm/irqflags.h > +static inline unsigned long arch_local_irq_save(void) > +{ > + unsigned long flags; Newline between declaration and code please. > + asm volatile( > + "mfcr %0, psr \n" > + "psrclr ie \n" > + :"=r"(flags)); > +++ b/arch/csky/kernel/irq.c > @@ -0,0 +1,41 @@ > +// SPDX-License-Identifier: GPL-2.0 > +// Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd. > +#include > +#include > +#include > +#include > + > +unsigned int (*csky_get_auto_irqno) (void) = NULL; > + > +void csky_do_IRQ(int irq, struct pt_regs *regs) static? If not, then it needs a declaration in a header somewhere. > +{ > + struct pt_regs *old_regs = set_irq_regs(regs); > + > + irq_enter(); > + generic_handle_irq(irq); > + irq_exit(); > + > + set_irq_regs(old_regs); > +} > + > +asmlinkage void csky_do_auto_IRQ(struct pt_regs *regs) > +{ > + unsigned long irq, psr; > + > + asm volatile("mfcr %0, psr":"=r"(psr)); > + > + irq = (psr >> 16) & 0xff; > + > + if (irq == 10) > + irq = csky_get_auto_irqno(); > + else > + irq -= 32; Please add a comment explaining this magic here. Magic numbers w/o explanation are bad.