Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2949722rdb; Tue, 13 Feb 2024 02:08:14 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU1/5T2LExjEcVcq9K/5aiEzEuTq7kAuk4kI8hhe43+HdwawVa3TaP+tIhF3Z2UsrOH0/6v05k2i/FQOqnoYrMdc0a0qrL6GYmdMAQjmA== X-Google-Smtp-Source: AGHT+IGiKrhzPmiOQe+kMFAMLNyzE9q10yPfsPUgHvFdml9CDLJTylnyrOX3d5umaYbSoh3Vuwzg X-Received: by 2002:a05:620a:674:b0:785:c5a6:41ea with SMTP id a20-20020a05620a067400b00785c5a641eamr9051115qkh.68.1707818894634; Tue, 13 Feb 2024 02:08:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707818894; cv=pass; d=google.com; s=arc-20160816; b=kA6SZqewUvpTvr8ErPmEHUtIQq7mQpmJywdSzzGtcvcq2Hd+523gv1xUDWlG5Uw3S2 eaAn+TtqDyRRDnOVd4SGafDhlyodgI9mzeCpNUAd9a1cDEUu7zCmBOb+QWVm4vNaBnpo 83HSWjhwB0wqNFhm+lEbPVI5zfKCkAxBxx4w2llIU+PZfZs6j35j1GQgSbjpapDh2qHF ezKxC9Y68BzWBOBKjcu4KTg9j85AwX/ATnkHoV9UAixGEfhWezkTuPvufSEDbO2cWT2F /Pk8DnYh0sAh7LUbkVDKI+xGEZfjx5NsM4n1vP995AQQfscFKCwnUzR5oZK2c5p2jxjt bAEQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:date:references:in-reply-to:subject:cc:to:dkim-signature :dkim-signature:from; bh=Y1HrfL+SrlW2XWR5pU7cGgxYMFs+Qr2zZ76ZBVxutfE=; fh=7UIGpo0+bFTdXJste02blMZrYamRWVOYAhXJW+HAhfQ=; b=FJk9JNLuICJMTBytf1hZv1x1XGg+7xIfMzbWenZh9NpS2F5Y53WnZOCeT3t359n7qc bonNCcyOClw1Le4X2kGCMfdxQFSPtr+xICE8WGZJqw1lgYh9FVdqAYnwOeplyl8WkXFW gCToY80SnRnRIGqkX6i2VjgPXX6WGdqg7Mz20zC7rKeNhVmSXpyZPadgvTfJVCLC375m 1sMjcQt/Wr9qtRgPl8oGUW2/jZ24lxAmiVn1sTMBbv2yWfAwmtdGeVaL+lQy88VVljxa dZdF4IrIylCh+pecPC+ICYl3ceT8U8/eVOVBC3HSfy6XLU51Itd8wKb3IxQchMj9Wl9C MFYw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=SE49GUQb; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-63303-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63303-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de X-Forwarded-Encrypted: i=2; AJvYcCWQ7BsPuqsH5CK9qHVIGeJpI6MjYRa66YIQMSyWzztKh3xXM8dS9NVVGF3C6cYI5a5OjETnFouzWeBHTh9oN3IV+2sdVJkXLn9p5tcfcQ== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id f5-20020a05620a20c500b00785ae4ea23csi7828150qka.752.2024.02.13.02.08.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 02:08:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-63303-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=SE49GUQb; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-63303-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63303-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id D2F461C22C07 for ; Tue, 13 Feb 2024 10:05:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D24B323747; Tue, 13 Feb 2024 10:04:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="SE49GUQb"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="hwPVCOob" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7053722630; Tue, 13 Feb 2024 10:04:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707818697; cv=none; b=VpgUMJipLQwGZZAGw4ndt5vj1YWen2Bvz+FU7vGi9FeErChDR6iUXlstenSWlE00WngTaCgNr9OsWx9Ux5xAWGZsnQQNCE/XjGlprTJXMpi+48sOPgUjTEbAqQfCH3ed9wm6f+RkigQWBYPFQ+CsfcAx4rnWgYv+lvsZVcavj28= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707818697; c=relaxed/simple; bh=6TSHYiFO7t6qPOK5xs2M2DE46SDMBFbNXGbksGWwjH4=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=dgHEQnQJv/aFFTd0s77ljy0GfqqTQ7AqCwgfOCjMbgAq4P8IrmX3WUs59NDI2ZxZqfXn/IAhXpUB2pY9FKed9THvbIGOdBULMhNcW2QewEWUVMgK0G7YpHdxeHdl9dBA9SjNIwuuSnWHryCFYWCd9+X2/B7DwG76cqwRznWYERE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=SE49GUQb; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=hwPVCOob; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1707818693; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Y1HrfL+SrlW2XWR5pU7cGgxYMFs+Qr2zZ76ZBVxutfE=; b=SE49GUQbwTclIrg8Ek0Z3VpThQD1o9FAH8SAfIXoKnzTV3UsTWw9PR3oootZv4e+BrIiEw mdQccGiNG42+Pm2ePTR4i97kp8932eaGmbf9YEyCPmZhmlW6DTxYRik/XdRPpaf/1d9Rj+ iw237txMkf2vF9jD/1ZLzDd0rm8LrsgK/C2xIiSWgoOKHIUVHZ9nngnvzOVUFKnc6moxK7 BpEj8jkWpHHDobcUxfUsyG+G/u9okIlxlJR4RBySpQ43POtEj6N7+cSAuQiP7GiM5XpWMC zt2UBKcuYOqCl9/NGww8Fi+s6sVfQA4TLjGzQeVeq9V65GziT/r7Yaga1vZYqA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1707818693; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Y1HrfL+SrlW2XWR5pU7cGgxYMFs+Qr2zZ76ZBVxutfE=; b=hwPVCOobELnpGmo9aIjJ/oKtSoM7jE5zNUcYVknaR65ECFvfFEULvht2Ghlz1V5bazoRzP gBUt4M68cX7NwTDg== To: Yu Chien Peter Lin , acme@kernel.org, adrian.hunter@intel.com, ajones@ventanamicro.com, alexander.shishkin@linux.intel.com, andre.przywara@arm.com, anup@brainfault.org, aou@eecs.berkeley.edu, atishp@atishpatra.org, conor+dt@kernel.org, conor.dooley@microchip.com, conor@kernel.org, devicetree@vger.kernel.org, evan@rivosinc.com, geert+renesas@glider.be, guoren@kernel.org, heiko@sntech.de, irogers@google.com, jernej.skrabec@gmail.com, jolsa@kernel.org, jszhang@kernel.org, krzysztof.kozlowski+dt@linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-sunxi@lists.linux.dev, locus84@andestech.com, magnus.damm@gmail.com, mark.rutland@arm.com, mingo@redhat.com, n.shubin@yadro.com, namhyung@kernel.org, palmer@dabbelt.com, paul.walmsley@sifive.com, peterlin@andestech.com, peterz@infradead.org, prabhakar.mahadev-lad.rj@bp.renesas.com, rdunlap@infradead.org, robh+dt@kernel.org, samuel@sholland.org, sunilvl@ventanamicro.com, tim609@andestech.com, uwu@icenowy.me, wens@csie.org, will@kernel.org, inochiama@outlook.com, unicorn_wang@outlook.com, wefu@redhat.com Cc: Randolph , Atish Patra Subject: Re: [PATCH v8 02/10] irqchip/riscv-intc: Allow large non-standard interrupt number In-Reply-To: <20240129092553.2058043-3-peterlin@andestech.com> References: <20240129092553.2058043-1-peterlin@andestech.com> <20240129092553.2058043-3-peterlin@andestech.com> Date: Tue, 13 Feb 2024 11:04:53 +0100 Message-ID: <877cj8issa.ffs@tglx> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain On Mon, Jan 29 2024 at 17:25, Yu Chien Peter Lin wrote: > static asmlinkage void riscv_intc_irq(struct pt_regs *regs) > { > unsigned long cause = regs->cause & ~CAUSE_IRQ_FLAG; > > - if (unlikely(cause >= BITS_PER_LONG)) > - panic("unexpected interrupt cause"); > - > - generic_handle_domain_irq(intc_domain, cause); > + if (generic_handle_domain_irq(intc_domain, cause)) > + pr_warn_ratelimited("Failed to handle interrupt (cause: %ld)\n", > + cause); Either let the cause stick out or you need brackets. See: https://www.kernel.org/doc/html/latest/process/maintainer-tip.html#bracket-rules > } > > /* > @@ -93,6 +95,14 @@ static int riscv_intc_domain_alloc(struct irq_domain *domain, > if (ret) > return ret; > > + /* > + * Only allow hwirq for which we have corresponding standard or > + * custom interrupt enable register. > + */ > + if ((riscv_intc_nr_irqs <= hwirq && hwirq < riscv_intc_custom_base) || > + (riscv_intc_custom_base + riscv_intc_custom_nr_irqs) <= hwirq) > + return -EINVAL; Duh. This mix of ordering required to read this 3 times. What's wrong with writing this consistently: if ((hwirq >= riscv_intc_nr_irqs && hwirq < riscv_intc_custom_base) || (hwirq >= iscv_intc_custom_base + riscv_intc_custom_nr_irqs) return -EINVAL; Hmm? > - pr_info("%d local interrupts mapped\n", BITS_PER_LONG); > + pr_info("%d local interrupts mapped\n", riscv_intc_nr_irqs); > + if (riscv_intc_custom_nr_irqs) > + pr_info("%d custom local interrupts mapped\n", > + riscv_intc_custom_nr_irqs); See bracket rules. > return 0; > } > @@ -166,6 +178,10 @@ static int __init riscv_intc_init(struct device_node *node, > return 0; > } > > + riscv_intc_nr_irqs = BITS_PER_LONG; > + riscv_intc_custom_base = riscv_intc_nr_irqs; Why don't you initialize the static variables with constants right away? > + riscv_intc_custom_nr_irqs = 0; It's already 0, no? > return riscv_intc_init_common(of_node_to_fwnode(node)); > } Thanks, tglx