From patchwork Tue Dec 20 21:35:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13078183 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 270E0C4332F for ; Tue, 20 Dec 2022 21:37:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Message-Id:MIME-Version:Subject: Date:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=PCze6+oMACkqPfGRdjk28O18X3cLp6x/4YS+SowS2eE=; b=L1cBY/sfI0e7QM wdqW7VrRCdf4zNob14lu+sano7SGrOfdBwvbr0oXRmGwa4qtfTOSYD23oZ9vFtEjiOQGTMVmCMwzf HqIGL7jL2uiCt0tKMNd38VAS6Irx/A77EVD1AjTzyj3cjbQb9ABDBFCkN4/HoNHJqTGE5aNWYbUAh 31ISC5DGGOLN7xfOqcew5xuiI0LA++QC3k1MCKKnrRwgKWKl5gmJd8rbxfP5Do0D8mp5RRiJqolJK 6mUtlcgy+6fdUP3lrCKPO6kIJ4TqDwmApwNYzUXlhdI5X69MAMPMVRUgbJBkLOBO8Shs1luwvEkCr mOuaqDXE7dbh4qVio8zg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p7kHS-004RS5-Nc; Tue, 20 Dec 2022 21:36:10 +0000 Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1p7kHP-004RPD-9B for linux-arm-kernel@lists.infradead.org; Tue, 20 Dec 2022 21:36:09 +0000 Received: by mail-ed1-x531.google.com with SMTP id c17so19383298edj.13 for ; Tue, 20 Dec 2022 13:36:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:from:to:cc:subject:date:message-id:reply-to; bh=0lyUV6xhkVX1jxFg/jG5gRApY46OlNTkuYd457vayac=; b=gVqohdibGEdeei9fsTgHEy+rBBwRrMzzoJpK2ZVW3G/htQHdtR73FFjqXBBOVHjtZJ QlcZAxPDEeh7Gwvny0Gbp+BQrILe6FPlYbPklqq6B9zN590KtTZCOOXxsIJLHedbZlG5 gTQfOMeEnrIuREejUNygZ1QABsCVtWel9RHSc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=0lyUV6xhkVX1jxFg/jG5gRApY46OlNTkuYd457vayac=; b=BTFGu1RYJrhG2S6w88hgiNz6Er5xWzUi4I57KGH3xXFopD/WLZtcbCRpaRpuPXZxVX EkcZibjvxv/9ZZSPh3zZTUdjqWyl6e9fG5q/dVbCZIJy/DkP1qwpHfaRCZ9eKp2ndrIy i2xnxduYVP/amCW5UOdxDLnQ0JZN4iwaoTrYBUXV7eMyz7i3dAhso1mz2JWLirO81KWD npGVhM2f8VvYg+sW8ApI9iPr5SqZVOktCn/g9K9P4BdvyxVw8fFvz4S8TwNJ3m0PBoCF e8dx7P6yiDIzuvncaq93nrxKYL5pVpJJb/2KftLgJTNQgmCNJfTCUW4+oIrXKleIpx6u 9n2w== X-Gm-Message-State: ANoB5pmFe4y7X6a4A8ebBTU3LmPQJ/LQf1VpFrQ2PPjJ0N37eMcDmJvp Xtzj7ObG2qd7u8rqW4SmiOSYog== X-Google-Smtp-Source: AA0mqf7bNWoFW5s7NHYngkKWVC/m06khl90VikHTGVzQsD2M2A5s8J3bZ00PCQ+tgoyaSGhIlfjEfg== X-Received: by 2002:a05:6402:48:b0:470:411f:3609 with SMTP id f8-20020a056402004800b00470411f3609mr26747749edu.1.1671572165411; Tue, 20 Dec 2022 13:36:05 -0800 (PST) Received: from alco.roam.corp.google.com (80.71.134.83.ipv4.parknet.dk. [80.71.134.83]) by smtp.gmail.com with ESMTPSA id w26-20020aa7cb5a000000b0046c53c3b2dfsm6215407edt.38.2022.12.20.13.36.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Dec 2022 13:36:04 -0800 (PST) From: Ricardo Ribalda Date: Tue, 20 Dec 2022 22:35:59 +0100 Subject: [PATCH v2] soc: mediatek: mtk-svs: Enable the IRQ later MIME-Version: 1.0 Message-Id: <20221127-mtk-svs-v2-0-145b07663ea8@chromium.org> To: Matthias Brugger , Roger Lu Cc: linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Ricardo Ribalda , linux-kernel@vger.kernel.org X-Mailer: b4 0.11.0-dev-696ae X-Developer-Signature: v=1; a=openpgp-sha256; l=2191; i=ribalda@chromium.org; h=from:subject:message-id; bh=ZkyAdASklJW55ktI7Cr1DlzlpiQsAvq/12fzDjEbbmM=; b=owEBbQKS/ZANAwAKAdE30T7POsSIAcsmYgBjoirCWGDzP8RsUxqTlT7kRNFrvvvoqGTcR0Pq8Jvi Ifipfz+JAjMEAAEKAB0WIQREDzjr+/4oCDLSsx7RN9E+zzrEiAUCY6IqwgAKCRDRN9E+zzrEiN4AD/ 9xQxyU+XNUoy+PyFq1DU1yoU5ZQ6tk7Gopqcf8zrq2y5J7KvTQwWrRTc7uPWkORF8rAmY7zSkYN+qw H31Z0qvTHIqouB33gUly+eJkPak+idn9LPZYuz0mj1GPUaoXzO+nWIqV12X5wFgjjddhRMsBaz7FTI WV3I5DtNennC0jbea49wD7HNJ/jEnkwnQ/4lhmsYeRPuK4OxVPRVGSCeOnJ7muXDv/okL9bfhE+dVK tuOqvN8w6gw0toavDXcR4ac7RrVFb+57A/aAe+HdsT1rnAQNBkfElHnhNpjFZoxQIdAeUHk3O10qMP hXUQsI2cNi5+/l+TE/NmLEw4Iw4Uk6ltXCtBsmVsodXi5dS62gG39vhOiGVo74sC7ul2Y6n7ZDAGni ebPfnjZCvIPA9T+DtbKgnrC73tolrAOPPPssPdJSXNefpy0OCYtNoHFvNGnHkFwxyer0OQIWtdHKR0 6V9MrtfSoK9mhKlzJbplndsVUHL7ETIadXYWwKmLP2/ZPEL64eZAc/l8SF/X1Mh769BM0WiHRDfeXu er44ft/maUSuAGhzkw0WKr3pPtYgBYW1W8nsOGTAtn4T1oDSOxn6zlDn+LR1B0Ea5tGXPsH+1EKG5j +LoOSB2Qlbm9kWKsymSsifnYbjOhm6vmTR0iE5Ykz9L+2uqM87S4rB4vFCvA== X-Developer-Key: i=ribalda@chromium.org; a=openpgp; fpr=9EC3BB66E2FC129A6F90B39556A0D81F9F782DA9 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221220_133607_389268_2BB2F4A0 X-CRM114-Status: GOOD ( 13.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org If the system does not come from reset (like when is booted via kexec()), the peripheral might triger an IRQ before the data structures are initialised. Fixes: [ 0.227710] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000f08 [ 0.227913] Call trace: [ 0.227918] svs_isr+0x8c/0x538 Signed-off-by: Ricardo Ribalda Tested-by: Roger Lu --- To: Matthias Brugger To: Roger Lu Cc: linux-arm-kernel@lists.infradead.org Cc: linux-mediatek@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- Changes in v2: - Enable the irq before svs_start, to avoid MT8192 not starting. - Link to v1: https://lore.kernel.org/r/20221127-mtk-svs-v1-0-7a5819595838@chromium.org --- drivers/soc/mediatek/mtk-svs.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) --- base-commit: 4312098baf37ee17a8350725e6e0d0e8590252d4 change-id: 20221127-mtk-svs-add137fbf187 Best regards, diff --git a/drivers/soc/mediatek/mtk-svs.c b/drivers/soc/mediatek/mtk-svs.c index 0469c9dfeb04..75b2f534aa9d 100644 --- a/drivers/soc/mediatek/mtk-svs.c +++ b/drivers/soc/mediatek/mtk-svs.c @@ -2385,14 +2385,6 @@ static int svs_probe(struct platform_device *pdev) goto svs_probe_free_resource; } - ret = devm_request_threaded_irq(svsp->dev, svsp_irq, NULL, svs_isr, - IRQF_ONESHOT, svsp->name, svsp); - if (ret) { - dev_err(svsp->dev, "register irq(%d) failed: %d\n", - svsp_irq, ret); - goto svs_probe_free_resource; - } - svsp->main_clk = devm_clk_get(svsp->dev, "main"); if (IS_ERR(svsp->main_clk)) { dev_err(svsp->dev, "failed to get clock: %ld\n", @@ -2414,6 +2406,14 @@ static int svs_probe(struct platform_device *pdev) goto svs_probe_clk_disable; } + ret = devm_request_threaded_irq(svsp->dev, svsp_irq, NULL, svs_isr, + IRQF_ONESHOT, svsp->name, svsp); + if (ret) { + dev_err(svsp->dev, "register irq(%d) failed: %d\n", + svsp_irq, ret); + goto svs_probe_iounmap; + } + ret = svs_start(svsp); if (ret) { dev_err(svsp->dev, "svs start fail: %d\n", ret);