From patchwork Sun Jul 9 11:15:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 117493 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp4387222vqx; Sun, 9 Jul 2023 04:18:41 -0700 (PDT) X-Google-Smtp-Source: APBJJlFf1rXAGCjQiSz8E6H0Y+4ED/aVnbA1mSXOQrDyvuZnf0uRJcgVYcdZswBQpX97WKk3sWnh X-Received: by 2002:a05:6a20:1590:b0:122:20c:fbb2 with SMTP id h16-20020a056a20159000b00122020cfbb2mr9195815pzj.39.1688901521038; Sun, 09 Jul 2023 04:18:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688901521; cv=none; d=google.com; s=arc-20160816; b=jKkpyo8DnG8f3UrqK9GrKtdnaUDaF8V/TqMUoo5VZe5X6nipxvEH6FYkk5vo9vp93/ vY5hnTsMgtzno9+4xIcu1/Yqd/S9Evp7kRCJpP0mhL2kwFR380atAzv3gH0CHsFoCF4A /4Qgtyl/02VPrwtXojSGbwgwZnsST/ninrMfBcTNMAYvHU3RhUPAucJraC2+25z75kFH Xr2Z7lOmhKIm/RtShMfB3x7CIXRMnQXf1l9nYi6InyQfEAINf7B078q4is+D/Pdj2BzA IiTRofAKZTND0PA52VvhGZnGZAO9qIhnSgqpCyINdFD6WYPjusfmEloNVrhcVXVVygPC UNRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=9gUHmFDwAk5dqEvICKxvWOMwHFPSbkeNESFrB6s6nnk=; fh=+RDXwZGFWjrmjKFfPuBSXq7qY1HrTKOV8GqaiujIiCo=; b=nrnOELEE4nh24E7lW/7FL2WOzYmf7NNnVoTgfcZYfl98e3SkN5Wf2MSO8ss5Ew8987 r03Gd86AAzZFl217VBz4yiXkzwZBfYLu8CGD5ZvxoUEDREk6vtbNgYMZJZmUvxYZB3BE 4hPBqibKwgKM1Z37K2mfZ9rF5F32VtdffeUwua5JW/nMh3K9lO6eszA0JUTmVf62OaQg g9bzABVJzAk5XIG4sdZN0XJVBmpFiqMwYd9os3iS5B4To8q5J/qxD9f7CKOCrmx9lMwu PTwbZqgfxSZ7fI87E6Sr14461xvUUW5JRrUNJBSaHmunHpblsMtuIHkFJrkoy4/uKdNk umDQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k189-20020a6384c6000000b0055be457e535si7147592pgd.137.2023.07.09.04.18.28; Sun, 09 Jul 2023 04:18:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230418AbjGILP6 (ORCPT + 99 others); Sun, 9 Jul 2023 07:15:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229504AbjGILP5 (ORCPT ); Sun, 9 Jul 2023 07:15:57 -0400 Received: from xavier.telenet-ops.be (xavier.telenet-ops.be [IPv6:2a02:1800:120:4::f00:14]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72EF6137 for ; Sun, 9 Jul 2023 04:15:55 -0700 (PDT) Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed40:5bb:109a:ec27:6093]) by xavier.telenet-ops.be with bizsmtp id JzFr2A0081ycx4f01zFrvK; Sun, 09 Jul 2023 13:15:52 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1qISOH-000x9R-SV; Sun, 09 Jul 2023 13:15:51 +0200 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1qISON-003NUk-5d; Sun, 09 Jul 2023 13:15:51 +0200 From: Geert Uytterhoeven To: Guenter Roeck , Sergey Shtylyov , John Paul Adrian Glaubitz , Yoshinori Sato , Rich Felker Cc: linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH] [RFT] sh: mach-r2d: Handle virq offset in cascaded IRL demux Date: Sun, 9 Jul 2023 13:15:49 +0200 Message-Id: <2c99d5df41c40691f6c407b7b6a040d406bc81ac.1688901306.git.geert+renesas@glider.be> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770941601214871948?= X-GMAIL-MSGID: =?utf-8?q?1770941601214871948?= When booting rts7751r2dplus_defconfig on QEMU, the system hangs due to an interrupt storm on IRQ 20. IRQ 20 aka event 0x280 is a cascaded IRL interrupt, which maps to IRQ_VOYAGER, the interrupt used by the Silicon Motion SM501 multimedia companion chip. As rts7751r2d_irq_demux() does not take into account the new virq offset, the interrupt is no longer translated, leading to an unhandled interrupt. Fix this by taking into account the virq offset when translating cascaded IRL interrupts. Fixes: a8ac2961148e8c72 ("sh: Avoid using IRQ0 on SH3 and SH4") Reported-by: Guenter Roeck Closes: https://lore.kernel.org/r/fbfea3ad-d327-4ad5-ac9c-648c7ca3fe1f@roeck-us.net Signed-off-by: Geert Uytterhoeven Reviewed-by: John Paul Adrian Glaubitz Tested-by: John Paul Adrian Glaubitz Tested-by: Guenter Roeck --- Highlander and Dreamcast probably have the same issue. I'll send patches for these later... --- arch/sh/boards/mach-r2d/irq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/sh/boards/mach-r2d/irq.c b/arch/sh/boards/mach-r2d/irq.c index e34f81e9ae813b8d..c37b40398c5bc83e 100644 --- a/arch/sh/boards/mach-r2d/irq.c +++ b/arch/sh/boards/mach-r2d/irq.c @@ -117,10 +117,10 @@ static unsigned char irl2irq[R2D_NR_IRL]; int rts7751r2d_irq_demux(int irq) { - if (irq >= R2D_NR_IRL || irq < 0 || !irl2irq[irq]) + if (irq >= 16 + R2D_NR_IRL || irq < 16 || !irl2irq[irq - 16]) return irq; - return irl2irq[irq]; + return irl2irq[irq - 16]; } /*