From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D64BB2E8DEB for ; Fri, 24 Jul 2026 06:18:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=13.77.154.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784873897; cv=none; b=DOWzcmJcykHovOXTClq0UqGXsuK/6F+5BK4ibOAJ2fUysRCozgcTrbMZkQkAmZjy7hE2Cg2e8tw0KmDdJCOxxYEA+TkcQaqPM1eDN693G5ZiDzPqqT1NYwC7LMepl9+fyoHi8TNhX3Iv05exdfl2HSgSmmPOm/lFm5SjRy5l/lw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784873897; c=relaxed/simple; bh=grkjvEtGbgGgXOVGIyRbnI2eJ2tOquWbco/gbFpY58E=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=BwqXfvjFQYGp6a5vtFtInD8jgW+M7v0FOA8I9PsFEorFyo3/q+YxBJJAfYXY3xr4g7oP+rSIlK2Mq/sfpuFRtVVFlL9Q4gBVvNe2OMzh3gTxjQFpl0jrSIeJyFbgnjS6mnwERbFd2Rfg5xUe4fxxaB2VrsKDhoJcGf9k7rhlyAQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b=iuCwkr7N; arc=none smtp.client-ip=13.77.154.182 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.b="iuCwkr7N" Received: from [10.94.177.11] (unknown [4.194.122.170]) by linux.microsoft.com (Postfix) with ESMTPSA id 54EC820B7167; Thu, 23 Jul 2026 23:18:00 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 54EC820B7167 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1784873881; bh=pSUcECaT1FXRl1tOQMCsQPhZDrTWY4R3QGMSSL4r6OM=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=iuCwkr7Np4jQomXIo0k52C8vXtVhu+N7R9U9GgMeVwVgjpZoUa+/RGB2CA/xWtvna flbaaQssMzmLeRpsCzhVDFFlES4BBA5FzPTuSjJUaW5F3lEEywhjBVdDo8dpex8FHF mVuEgpDulQ4+i5mAi6lmYBGq/fVW/cOCi0nlChfg= Message-ID: <51e25452-a982-444e-b6f2-13e30c85984d@linux.microsoft.com> Date: Fri, 24 Jul 2026 11:48:12 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 3/4] firmware: xilinx: Clear firmware notifiers across kexec transitions To: Jay Buddhabhatti , michal.simek@amd.com, git@amd.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20260723124841.2567827-1-jay.buddhabhatti@amd.com> <20260723124841.2567827-4-jay.buddhabhatti@amd.com> Content-Language: en-US From: Prasanna Kumar T S M In-Reply-To: <20260723124841.2567827-4-jay.buddhabhatti@amd.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 23-07-2026 18:18, Jay Buddhabhatti wrote: > During a kexec restart, only the kernel is reloaded but notifier callbacks > in firmware persist, causing state mismatches between kernel and firmware. > > To address this, introduce PM_ALL_NOTIFIERS node ID to unregister all > notifier callbacks during kexec. On a graceful kexec restart, this occurs > in zynqmp_firmware_shutdown(). On a crash kernel restart, it happens in > zynqmp_firmware_probe() in the reloaded kernel. > > Unregistering all notifiers depends on firmware support for the > PM_ALL_NOTIFIERS node ID. On firmware that does not implement it (the > feature check reports a version below PM_API_VERSION_3) the step is > skipped and a warning such as "Firmware doesn't support unregister all > notifiers at once" is logged, e.g. on Versal NET firmware that predates > this API. > > Signed-off-by: Jay Buddhabhatti > --- > drivers/firmware/xilinx/zynqmp.c | 14 ++++++++++++++ > include/linux/firmware/xlnx-zynqmp.h | 3 +++ > 2 files changed, 17 insertions(+) > > diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c > index 64d2109eefd2..fc7212f554ee 100644 > --- a/drivers/firmware/xilinx/zynqmp.c > +++ b/drivers/firmware/xilinx/zynqmp.c > @@ -2110,6 +2110,20 @@ static int zynqmp_clear_pm_state(struct device *dev) > "Bulk device release is not supported by firmware: %d\n", ret); > ret = 0; > } > + > + /* Check if the firmware supports the PM_ALL_NOTIFIERS node ID */ > + ret = do_feature_check_call(PM_REGISTER_NOTIFIER); > + if (ret >= 0 && ((ret & FIRMWARE_VERSION_MASK) >= PM_API_VERSION_3)) { > + /* Attempt to unregister all notifier callbacks via firmware */ > + ret = zynqmp_pm_register_notifier(PM_ALL_NOTIFIERS, 0, 0, 0); > + if (ret) > + dev_err(dev, "Failed to unregister all notifiers: %d\n", ret); > + } else { > + dev_warn(dev, > + "Firmware doesn't support unregister all notifiers at once: %d\n", > + ret); > + ret = 0; > + } > } > > return ret; > diff --git a/include/linux/firmware/xlnx-zynqmp.h b/include/linux/firmware/xlnx-zynqmp.h > index ac39e5492961..69a2f74269f3 100644 > --- a/include/linux/firmware/xlnx-zynqmp.h > +++ b/include/linux/firmware/xlnx-zynqmp.h > @@ -149,6 +149,9 @@ > /* Node ID for all peripheral devices */ > #define PM_DEV_ALL_PERIPH 0x18224FFFU > > +/* Node ID for all notifier callbacks */ > +#define PM_ALL_NOTIFIERS 0xFFFFFFFFU > + > enum pm_module_id { > PM_MODULE_ID = 0x0, > XPM_MODULE_ID = 0x2, Looks good to me. Reviewed-by: Prasanna Kumar T S M