[PATCH 3/5] drivers: firmware: xilinx: Relocate NVM library APIs to new file
Jain, Harsh (AECG-SSW)
h.jain at amd.com
Tue Dec 1 01:46:53 PST 2026
On 11/27/2026 5:18 PM, Jay Buddhabhatti wrote:
> From: Ronak Jain <ronak.jain at amd.com>
>
> Move the NVM library APIs into a dedicated file and header to improve
> maintainability and reduce complexity in the firmware driver. Keep the
> existing behavior unchanged.
>
> Add a MAINTAINERS entry for the crypto and NVM firmware files. Include
> the new NVM files and the existing crypto files in that entry.
>
> Signed-off-by: Ronak Jain <ronak.jain at amd.com>
> Co-developed-by: Jay Buddhabhatti <jay.buddhabhatti at amd.com>
> Signed-off-by: Jay Buddhabhatti <jay.buddhabhatti at amd.com>
Acked-by: Harsh Jain <h.jain at amd.com>
> ---
> MAINTAINERS | 9 ++++++
> drivers/firmware/xilinx/Makefile | 2 +-
> drivers/firmware/xilinx/zynqmp-nvm.c | 35 ++++++++++++++++++++++++
> drivers/firmware/xilinx/zynqmp.c | 24 ----------------
> include/linux/firmware/xlnx-zynqmp-nvm.h | 28 +++++++++++++++++++
> include/linux/firmware/xlnx-zynqmp.h | 7 +----
> 6 files changed, 74 insertions(+), 31 deletions(-)
> create mode 100644 drivers/firmware/xilinx/zynqmp-nvm.c
> create mode 100644 include/linux/firmware/xlnx-zynqmp-nvm.h
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 8caad731367b..e010589c13e5 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -30660,6 +30660,15 @@ S: Maintained
> F: Documentation/devicetree/bindings/net/can/xilinx,can.yaml
> F: drivers/net/can/xilinx_can.c
>
> +XILINX CRYPTO AND NVM FIRMWARE DRIVER
> +M: Harsh Jain <h.jain at amd.com>
> +L: git at amd.com
> +S: Maintained
> +F: drivers/firmware/xilinx/zynqmp-crypto.c
> +F: drivers/firmware/xilinx/zynqmp-nvm.c
> +F: include/linux/firmware/xlnx-zynqmp-crypto.h
> +F: include/linux/firmware/xlnx-zynqmp-nvm.h
> +
> XILINX EVENT MANAGEMENT DRIVER
> M: Michal Simek <michal.simek at amd.com>
> S: Maintained
> diff --git a/drivers/firmware/xilinx/Makefile b/drivers/firmware/xilinx/Makefile
> index edfba4110a7c..d23d41c6a8ac 100644
> --- a/drivers/firmware/xilinx/Makefile
> +++ b/drivers/firmware/xilinx/Makefile
> @@ -2,5 +2,5 @@
> # Makefile for Xilinx firmwares
>
> obj-$(CONFIG_ZYNQMP_FIRMWARE) += zynqmp-crypto.o zynqmp-fpga.o \
> - zynqmp-pdi.o zynqmp-ufs.o zynqmp.o
> + zynqmp-nvm.o zynqmp-pdi.o zynqmp-ufs.o zynqmp.o
> obj-$(CONFIG_ZYNQMP_FIRMWARE_DEBUG) += zynqmp-debug.o
> diff --git a/drivers/firmware/xilinx/zynqmp-nvm.c b/drivers/firmware/xilinx/zynqmp-nvm.c
> new file mode 100644
> index 000000000000..15c646273aee
> --- /dev/null
> +++ b/drivers/firmware/xilinx/zynqmp-nvm.c
> @@ -0,0 +1,35 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Firmware layer for XilNVM APIs.
> + *
> + * Copyright (C) 2014 - 2022 Xilinx, Inc.
> + * Copyright (C) 2022 - 2026 Advanced Micro Devices, Inc.
> + */
> +
> +#include <linux/export.h>
> +#include <linux/firmware/xlnx-zynqmp.h>
> +#include <linux/kernel.h>
> +
> +/**
> + * zynqmp_pm_efuse_access - Provides access to efuse memory.
> + * @address: Address of the efuse params structure
> + * @out: Returned output value
> + *
> + * Return: Returns status, either success or error code.
> + */
> +int zynqmp_pm_efuse_access(const u64 address, u32 *out)
> +{
> + u32 ret_payload[PAYLOAD_ARG_CNT];
> + int ret;
> +
> + if (!out)
> + return -EINVAL;
> +
> + ret = zynqmp_pm_invoke_fn(PM_EFUSE_ACCESS, ret_payload, 2,
> + upper_32_bits(address),
> + lower_32_bits(address));
> + *out = ret_payload[1];
> +
> + return ret;
> +}
> +EXPORT_SYMBOL_GPL(zynqmp_pm_efuse_access);
> diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c
> index fe887d5e9354..619ead2069c5 100644
> --- a/drivers/firmware/xilinx/zynqmp.c
> +++ b/drivers/firmware/xilinx/zynqmp.c
> @@ -1597,30 +1597,6 @@ int zynqmp_pm_set_requirement(const u32 node, const u32 capabilities,
> }
> EXPORT_SYMBOL_GPL(zynqmp_pm_set_requirement);
>
> -/**
> - * zynqmp_pm_efuse_access - Provides access to efuse memory.
> - * @address: Address of the efuse params structure
> - * @out: Returned output value
> - *
> - * Return: Returns status, either success or error code.
> - */
> -int zynqmp_pm_efuse_access(const u64 address, u32 *out)
> -{
> - u32 ret_payload[PAYLOAD_ARG_CNT];
> - int ret;
> -
> - if (!out)
> - return -EINVAL;
> -
> - ret = zynqmp_pm_invoke_fn(PM_EFUSE_ACCESS, ret_payload, 2,
> - upper_32_bits(address),
> - lower_32_bits(address));
> - *out = ret_payload[1];
> -
> - return ret;
> -}
> -EXPORT_SYMBOL_GPL(zynqmp_pm_efuse_access);
> -
> /**
> * zynqmp_pm_register_notifier() - PM API for register a subsystem
> * to be notified about specific
> diff --git a/include/linux/firmware/xlnx-zynqmp-nvm.h b/include/linux/firmware/xlnx-zynqmp-nvm.h
> new file mode 100644
> index 000000000000..65dda350b66f
> --- /dev/null
> +++ b/include/linux/firmware/xlnx-zynqmp-nvm.h
> @@ -0,0 +1,28 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/*
> + * Firmware layer for XilNVM APIs.
> + *
> + * Copyright (C) 2014 - 2021 Xilinx, Inc.
> + * Copyright (C) 2022 - 2026 Advanced Micro Devices, Inc.
> + */
> +
> +#ifndef __FIRMWARE_ZYNQMP_NVM_H__
> +#define __FIRMWARE_ZYNQMP_NVM_H__
> +
> +#ifndef __FIRMWARE_ZYNQMP_H__
> +# error "Do not include this file directly, use <linux/firmware/xlnx-zynqmp.h>"
> +#endif
> +
> +#include <linux/errno.h>
> +#include <linux/types.h>
> +
> +#if IS_REACHABLE(CONFIG_ZYNQMP_FIRMWARE)
> +int zynqmp_pm_efuse_access(const u64 address, u32 *out);
> +#else
> +static inline int zynqmp_pm_efuse_access(const u64 address, u32 *out)
> +{
> + return -ENODEV;
> +}
> +#endif
> +
> +#endif /* __FIRMWARE_ZYNQMP_NVM_H__ */
> diff --git a/include/linux/firmware/xlnx-zynqmp.h b/include/linux/firmware/xlnx-zynqmp.h
> index 5038c9051dca..852e952fc8e5 100644
> --- a/include/linux/firmware/xlnx-zynqmp.h
> +++ b/include/linux/firmware/xlnx-zynqmp.h
> @@ -18,6 +18,7 @@
> #include <linux/err.h>
> #include <linux/firmware/xlnx-zynqmp-crypto.h>
> #include <linux/firmware/xlnx-zynqmp-fpga.h>
> +#include <linux/firmware/xlnx-zynqmp-nvm.h>
> #include <linux/firmware/xlnx-zynqmp-pdi.h>
> #include <linux/firmware/xlnx-zynqmp-ufs.h>
>
> @@ -594,7 +595,6 @@ int zynqmp_pm_release_node(const u32 node);
> int zynqmp_pm_set_requirement(const u32 node, const u32 capabilities,
> const u32 qos,
> const enum zynqmp_pm_request_ack ack);
> -int zynqmp_pm_efuse_access(const u64 address, u32 *out);
> int zynqmp_pm_write_ggs(u32 index, u32 value);
> int zynqmp_pm_read_ggs(u32 index, u32 *value);
> int zynqmp_pm_write_pggs(u32 index, u32 value);
> @@ -775,11 +775,6 @@ static inline int zynqmp_pm_set_requirement(const u32 node,
> return -ENODEV;
> }
>
> -static inline int zynqmp_pm_efuse_access(const u64 address, u32 *out)
> -{
> - return -ENODEV;
> -}
> -
> static inline int zynqmp_pm_write_ggs(u32 index, u32 value)
> {
> return -ENODEV;
More information about the linux-arm-kernel
mailing list