Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp872355pxb; Thu, 21 Oct 2021 11:04:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyEOFQeYBhoUv/mXSigdOcGARnDUhaPiaHxQCOuhul3ntZwLaQ+0K+p2MKFTpLyWbXAgQHe X-Received: by 2002:a63:788d:: with SMTP id t135mr5560022pgc.126.1634839490006; Thu, 21 Oct 2021 11:04:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634839489; cv=none; d=google.com; s=arc-20160816; b=Z0ZSOvBz45X60g4BEJ0ioP7AKU9UWGGyy4pPKJLi44b404/6tsUYRXn4xBesu8uCx0 Cz+JmEaqP9R9R5exzo6LFO4DmHMsVcEakGbee8N0NsF7Pltr1AnlCciTJCrbEprjF63w PX1z9GPIzQ5YPFGmk+7G5CMHt4nt1m5VE3sKx7PwXq94vL5QiveEp0uJTJ+kMoM6MRla Ti+lNhCXT5I63o//GdfVyhfASwInjBKeHKnjY2IvMmqsjqJjffflstCKAx7jYcP7bnV8 RtMZ0ecZQqY2tSL7QOCgec2WsSKG0N1mdDx9/J79TafYsepk77ZFH5AZ1yRja29vYRmY BuXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=ZVSEfX5R6WZp/Jd8+ya9FvTGpGgtcFo8UrSCtjqz7yc=; b=Ozk+zPdJ27rjbv9E2Mu6CxZ1IYO4hgqk/r5WqFLNHXwPsFdw0OZkaXifbehbvMUm08 mchvQ4BBcfdkmHh4bNkyd5y7FF3LEI5WMWTOV+MDhxvsLD+nD9vgk8I9ve1Fu58ANl8/ 3YXgg3WZHvPAtHa64tCS/loCwT1KUxn7Ub6Uu4nwl3DJv+coa/iO04XiXu9qyj0WL/mQ 1q7bh+iJA8qpaNEiOofJfxHg30P2wcsQQf+f1wLFxImfCgmlai6WHO5XLP79Mdey4NMk Xj6KVs01Tk4dp6fhA2yyRxxA7IhITq+YTz45ETLnNDnyQFfJg1P0VVPltRbLcaYbnq/X zIgA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a17si7098044pfh.112.2021.10.21.11.04.37; Thu, 21 Oct 2021 11:04:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232514AbhJUSFZ (ORCPT + 99 others); Thu, 21 Oct 2021 14:05:25 -0400 Received: from foss.arm.com ([217.140.110.172]:45950 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232481AbhJUSFU (ORCPT ); Thu, 21 Oct 2021 14:05:20 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 11C74147A; Thu, 21 Oct 2021 11:03:04 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 34BDF3F70D; Thu, 21 Oct 2021 11:03:01 -0700 (PDT) From: Mark Rutland To: linux-kernel@vger.kernel.org Cc: aou@eecs.berkeley.edu, catalin.marinas@arm.com, deanbo422@gmail.com, green.hu@gmail.com, guoren@kernel.org, jonas@southpole.se, kernelfans@gmail.com, linux-arm-kernel@lists.infradead.org, linux@armlinux.org.uk, mark.rutland@arm.com, maz@kernel.org, nickhu@andestech.com, palmer@dabbelt.com, paulmck@kernel.org, paul.walmsley@sifive.com, peterz@infradead.org, shorne@gmail.com, stefan.kristiansson@saunalahti.fi, tglx@linutronix.de, torvalds@linux-foundation.org, tsbogend@alpha.franken.de, vgupta@kernel.org, will@kernel.org Subject: [PATCH 05/15] irq: add generic_handle_arch_irq() Date: Thu, 21 Oct 2021 19:02:26 +0100 Message-Id: <20211021180236.37428-6-mark.rutland@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20211021180236.37428-1-mark.rutland@arm.com> References: <20211021180236.37428-1-mark.rutland@arm.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Several architectures select GENERIC_IRQ_MULTI_HANDLER and branch to handle_arch_irq() without performing any entry accounting. Add a generic wrapper to handle the commoon irqentry work when invoking handle_arch_irq(). Where an architecture needs to perform some entry accounting itself, it will need to invoke handle_arch_irq() itself. In subsequent patches it will become the responsibilty of the entry code to set the irq regs when entering an IRQ (rather than deferring this to an irqchip handler), so generic_handle_arch_irq() is made to set the irq regs now. This can be redundant in some cases, but is never harmful as saving/restoring the old regs nests safely. Signed-off-by: Mark Rutland Cc: Marc Zyngier Cc: Thomas Gleixner --- kernel/irq/handle.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c index 221d80c31e94..27182003b879 100644 --- a/kernel/irq/handle.c +++ b/kernel/irq/handle.c @@ -14,6 +14,8 @@ #include #include +#include + #include #include "internals.h" @@ -226,4 +228,20 @@ int __init set_handle_irq(void (*handle_irq)(struct pt_regs *)) handle_arch_irq = handle_irq; return 0; } + +/** + * generic_handle_arch_irq - root irq handler for architectures which do no + * entry accounting themselves + * @regs: Register file coming from the low-level handling code + */ +asmlinkage void noinstr generic_handle_arch_irq(struct pt_regs *regs) +{ + struct pt_regs *old_regs; + + irq_enter(); + old_regs = set_irq_regs(regs); + handle_arch_irq(regs); + set_irq_regs(old_regs); + irq_exit(); +} #endif -- 2.11.0