From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=13.77.154.182 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796031922; b=4Vt1qL8MczD552ekRYJiolWH5fWfcNFLBbk+C/Y3SkTYcRvdJbDU+OT1f7OsD95ThwR1 f5lG7KoGE29Q6DZ/lsUSG//5vy50SN9A/Y00Xu1sgS3ywdxldQllltKuRXFP/JjJ0ZwGl ax77SySM7YJj+7ghkc1EIhvAHHmnEnEX88FATIaPL6Qb5d1oWKIPruHl6FPgb34dSjxkv lcTG/s/KOiCMAJXmZ2ewzWtYbov/V/S28RgIRporlVauISJALK2RasTJPee4e5UivqozM 5L+Z+a2AYY5tXQradQKok2WbnMsZ0dGcJlALtjfiv+RneMF4snnWcJVxINnoqMIowbg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796031922; h=DMARC-Filter:Received:DKIM-Filter:DKIM-Signature:From:To:Subject: Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:X-Spam-Status:X-Spam-Checker-Version; bh=yZlWIy84WnhKCrFlojsbw+XLfMJ3KWzfThoOWzQ6BRQ=; b=WspwOO+hYGyFOCP4S+2JWR7Ws23eIJRffuDVflTDuRPCX6ogF0rm73qBaNVXLf46nZOx xZJeTVpguKWsk2JdJQ+gLcJQEISNK1saAG3warEPHu3ZQVFpEeDih0XCnZCS7ZwWW1slg /kwT6BAuzoWKeIWIlG1D9Rz158+sNBF0bqzH108dnSq2RKtB/6mZ7RmhdKNo24OIUaopY mcq1cukb6BPI6OpxKQ8keG7OYV6e6bBWM6/8wrsVCClq8WUisgehf+BTAWptk728OlutJ sEYKmCrxWJOUW2E5Vv6Ck04utRZYjJIM5kIbO2utiBSsh1bJIXnDZjtPgUng+TOKZzw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.microsoft.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass header.d=linux.microsoft.com header.i=@linux.microsoft.com header.a=rsa-sha256 header.s=default header.b=lL6qf86y; arc=none smtp.remote-ip=13.77.154.182 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DE67D606A320 for ; Mon, 30 Nov 2026 09:45:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org DE67D606A320 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.a=rsa-sha256 header.s=default header.b=lL6qf86y Received: from linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net (linux.microsoft.com [13.77.154.182]) by linux.microsoft.com (Postfix) with ESMTPSA id 2247D20B7168; Mon, 30 Nov 2026 01:45:14 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 2247D20B7168 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1796031914; bh=yZlWIy84WnhKCrFlojsbw+XLfMJ3KWzfThoOWzQ6BRQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=lL6qf86ytyyomZuLKd168z5pt6wbnyDg4Ck8YHY49ke6p09zAf2t1OtOeqwx4CniT s65gWRp2nBlwhMlvmZ8FqIIggNMOnBPgqhh5Hdxp606vJLGbAG46MK5iU3eDdgi+Og QCZhjTkQubgr8iYClqgyqDfA8dkZR/rhWOMI4pBY= From: Prasanna Kumar T S M To: ptsm@linux.microsoft.com, jassisinghbrar@gmail.com, michal.simek@amd.com, tanmay.shah@amd.com, saeed.nowshadi@amd.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, ssengar@linux.microsoft.com, tgopinath@linux.microsoft.com, srivatsa@csail.mit.edu, tejas.patel@xilinx.com, rajan.vaja@xilinx.com, abhyuday.godhasara@xilinx.com, gregkh@linuxfoundation.org Subject: [PATCH v2 1/2] mailbox: zynqmp-ipi: Fix CPU hotplug state cleanup Date: Mon, 30 Nov 2026 01:45:12 -0800 Message-ID: <20261130094513.2454356-2-ptsm@linux.microsoft.com> X-Mailer: git-send-email 2.43.7 In-Reply-To: <20261130094513.2454356-1-ptsm@linux.microsoft.com> References: <20261130094513.2454356-1-ptsm@linux.microsoft.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit On driver removal, the CPUHP_AP_ONLINE_DYN CPU hotplug state is removed instead of its actual state. This can leave the mailbox driver callbacks dangling. Use the actual CPU hotplug state during driver removal. Hotplug registration failures are also ignored, allowing probe to succeed without the callbacks needed to enable interrupts on CPUs brought online later. This is found by code inspection. Fixes: 6ffb1635341b ("mailbox: zynqmp: handle SGI for shared IPI") Cc: stable@vger.kernel.org Signed-off-by: Prasanna Kumar T S M --- drivers/mailbox/zynqmp-ipi-mailbox.c | 29 ++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/drivers/mailbox/zynqmp-ipi-mailbox.c b/drivers/mailbox/zynqmp-ipi-mailbox.c index 42d2583e44ca..843b5ecc905a 100644 --- a/drivers/mailbox/zynqmp-ipi-mailbox.c +++ b/drivers/mailbox/zynqmp-ipi-mailbox.c @@ -126,6 +126,7 @@ struct zynqmp_ipi_mbox { * @method: IPI SMC or HVC is going to be used * @local_id: local IPI agent ID * @virq_sgi: IRQ number mapped to SGI + * @hp_state: CPU hotplug state for SGI callbacks * @num_mboxes: number of mailboxes of this IPI agent * @ipi_mboxes: IPI mailboxes of this IPI agent */ @@ -136,6 +137,7 @@ struct zynqmp_ipi_pdata { unsigned int method; u32 local_id; int virq_sgi; + enum cpuhp_state hp_state; int num_mboxes; struct zynqmp_ipi_mbox ipi_mboxes[] __counted_by(num_mboxes); }; @@ -863,21 +865,32 @@ static int xlnx_mbox_init_sgi(struct platform_device *pdev, irq_set_status_flags(pdata->virq_sgi, IRQ_PER_CPU); /* Setup function for the CPU hot-plug cases */ - cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "mailbox/sgi:starting", - xlnx_mbox_cpuhp_start, xlnx_mbox_cpuhp_down); + pdata->hp_state = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, + "mailbox/sgi:starting", + xlnx_mbox_cpuhp_start, + xlnx_mbox_cpuhp_down); + if (pdata->hp_state < 0) { + irq_clear_status_flags(pdata->virq_sgi, IRQ_PER_CPU); + free_percpu_irq(pdata->virq_sgi, &per_cpu_pdata); + irq_dispose_mapping(pdata->virq_sgi); + pdata->virq_sgi = 0; + return pdata->hp_state; + } return ret; } static void xlnx_mbox_cleanup_sgi(struct zynqmp_ipi_pdata *pdata) { - cpuhp_remove_state(CPUHP_AP_ONLINE_DYN); - - on_each_cpu(xlnx_disable_percpu_irq, NULL, 1); + if (pdata->hp_state >= CPUHP_AP_ONLINE_DYN) + cpuhp_remove_state(pdata->hp_state); - irq_clear_status_flags(pdata->virq_sgi, IRQ_PER_CPU); - free_percpu_irq(pdata->virq_sgi, &per_cpu_pdata); - irq_dispose_mapping(pdata->virq_sgi); + if (pdata->virq_sgi) { + on_each_cpu(xlnx_disable_percpu_irq, NULL, 1); + irq_clear_status_flags(pdata->virq_sgi, IRQ_PER_CPU); + free_percpu_irq(pdata->virq_sgi, &per_cpu_pdata); + irq_dispose_mapping(pdata->virq_sgi); + } } /** -- 2.49.0