Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2032575pxa; Sun, 16 Aug 2020 21:05:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzXhRuLBb5vEdxXYOLyD+IFTB4sBc8h9eHs/+Dp3aU4y2vpLsbX0YaLFWQvFXm14p/Q8iTU X-Received: by 2002:a05:6402:17c2:: with SMTP id s2mr12823086edy.188.1597637133444; Sun, 16 Aug 2020 21:05:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597637133; cv=none; d=google.com; s=arc-20160816; b=QPID34Iz5owXkOTsPBsveHnlDPPLeBKsWBwoPbmkJ2kvFRedoRP8icwvjCLk8vsW7U DR2pDV4UlKTQUdPp/9KyMcNIHW9bQ19dCHpK/itBpoXh4b8ojwJmT7enddcZgzenkqsx 7dsBbiW7MaQknAmeCljrYmj+bLeHmtVh5qi/BwPmhdmO9fdRBCZN7ZItS8UX9g0LW5ig UqwWZs2TyYOzjK1RUTWhW8NV57Bm1UA1QC2hrkYJdP2nRq7eWo3xX2ctuzVC4dQBLnnw a7g+5zQDo4t+WGKdLpEx2jWDNVM3r7xi9Ioo2rFF5oZswGEll176rA7WxhEIIx7/hIpO SfyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NaUjNHLVGIJBrwCVlzJq6ywUqypWgIYJn7ZvKX/+dNE=; b=ioH+TMOXK/XTqkMS3j3MBhflxlC9PrD5lhk0KSX3Wlr2KVALY/4E91T5tuaWNdRWH3 vl17pXx7S6D2gEE1/gTZRp8MpeAXuxVh01F0sy0DcFxmSejRHWaWMn17rEQ9tfnL+/4X wghptXc2wwPR78d3x+PaAoIY0A2/HqaJ/1uOJu3witqLLR0G8TtLHnphCx+7jWmje0LN okYqpRQ9GREAifTZXJghP5Fj0Qv/Cs7cekYMQ92F7a85vCRomHsp9IrkaeEczuV8nspI 0oUW7T2CdPltDYeCYYK92SgXjR8IG8S574R6jh76lH/WDvSl0dWzT8anSMwynTJj08fB kQHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@flygoat.com header.s=vultr header.b="MfoazQ/P"; 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=flygoat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ss19si10316315ejb.252.2020.08.16.21.05.10; Sun, 16 Aug 2020 21:05:33 -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; dkim=fail header.i=@flygoat.com header.s=vultr header.b="MfoazQ/P"; 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=flygoat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727828AbgHQDtY (ORCPT + 99 others); Sun, 16 Aug 2020 23:49:24 -0400 Received: from vultr.net.flygoat.com ([149.28.68.211]:43744 "EHLO vultr.net.flygoat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727826AbgHQDtV (ORCPT ); Sun, 16 Aug 2020 23:49:21 -0400 Received: from localhost.localdomain (unknown [IPv6:2001:da8:20f:4430:250:56ff:fe9a:7470]) by vultr.net.flygoat.com (Postfix) with ESMTPSA id C704E1FF2E; Mon, 17 Aug 2020 03:49:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=flygoat.com; s=vultr; t=1597636158; bh=tkpc/JTygn6o+xCIvRDfTn+uT6G2NyWz4hNvpeTgZbU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MfoazQ/PgCh5GA96W/lf7BkTN1v5bd84tXxLgIDPZgMuONl2mddmPNlnANRxUOzrT OBJLeZgqcHNpCbVSVcu5rojv87oL9nSB14ZwwdYDaCSK1qRX5sj7zXHWJ4agS/uCP8 CgaKmzZQm5Yaa6yjR4K4ypZG5CtTJ/FyrI5hyaao1swL1Il4LeDMysgprbnJMRcnUJ J9LEQm4qPNSyl4qroyAUa7yhJKKSPBRp2hH+eWYyjpCWai8oU0CEyFoGS25Zuv6mVb JP21CW1cN4lMqB61AXAcWOe08rxIccIOu08WPeXyeLLKHyYJMC1WYEs1OGFIjxo23u M0qE42HcTiI2A== From: Jiaxun Yang To: linux-mips@vger.kernel.org Cc: Jiaxun Yang , Thomas Bogendoerfer , Huacai Chen , Aleksandar Markovic , Serge Semin , Paul Burton , WANG Xuerui , Alexey Malahov , =?UTF-8?q?=E5=91=A8=E7=90=B0=E6=9D=B0=20=28Zhou=20Yanjie=29?= , Liangliang Huang , afzal mohammed , "Peter Zijlstra (Intel)" , Peter Xu , Sergey Korolev , Marc Zyngier , Anup Patel , Herbert Xu , Steven Price , Atish Patra , Ming Lei , Daniel Jordan , Mike Leach , Ulf Hansson , linux-kernel@vger.kernel.org, kvm@vger.kernel.org Subject: [PATCH 5/7] MIPS: cevt-r4k: Don't handle IRQ if clockevent is not enabled Date: Mon, 17 Aug 2020 11:46:44 +0800 Message-Id: <20200817034701.3515721-6-jiaxun.yang@flygoat.com> X-Mailer: git-send-email 2.28.0.rc1 In-Reply-To: <20200817034701.3515721-1-jiaxun.yang@flygoat.com> References: <20200817034701.3515721-1-jiaxun.yang@flygoat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some platforms may have shared Cause.TI, bailing out in IRQ handler when clock event is not enabled can give another clock device a chance. Signed-off-by: Jiaxun Yang --- arch/mips/kernel/cevt-r4k.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/mips/kernel/cevt-r4k.c b/arch/mips/kernel/cevt-r4k.c index f0c52d751d0a..d396b1011fee 100644 --- a/arch/mips/kernel/cevt-r4k.c +++ b/arch/mips/kernel/cevt-r4k.c @@ -142,6 +142,15 @@ irqreturn_t c0_compare_interrupt(int irq, void *dev_id) if (handle_perf_irq(r2)) return IRQ_HANDLED; + cd = &per_cpu(mips_clockevent_device, cpu); + /* + * If the clockevent have not enabled, then no need to check the rest. + * Some platforms may have shared Cause.TI, bailing out here can + * give another clock device a chance. + */ + if (clockevent_state_detached(cd) || clockevent_state_shutdown(cd)) + return IRQ_NONE; + /* * The same applies to performance counter interrupts. But with the * above we now know that the reason we got here must be a timer @@ -150,7 +159,6 @@ irqreturn_t c0_compare_interrupt(int irq, void *dev_id) if (!r2 || (read_c0_cause() & CAUSEF_TI)) { /* Clear Count/Compare Interrupt */ write_c0_compare(read_c0_compare()); - cd = &per_cpu(mips_clockevent_device, cpu); cd->event_handler(cd); return IRQ_HANDLED; -- 2.28.0.rc1