arm64: soc: ZynqMP SoC changes for v5.13

- Fix firmware removal path
 - Cleanup eemi doc and *ops()
 -----BEGIN PGP SIGNATURE-----
 
 iF0EABECAB0WIQQbPNTMvXmYlBPRwx7KSWXLKUoMIQUCYHQEggAKCRDKSWXLKUoM
 ITwQAJ44uO/2MCmszJkt65jHcc+ZoYPYQgCeNLt+fy6rcgnT2ZGM2ExewkSEDdM=
 =E5pS
 -----END PGP SIGNATURE-----

Merge tag 'zynqmp-soc-for-v5.13' of https://github.com/Xilinx/linux-xlnx into arm/drivers

arm64: soc: ZynqMP SoC changes for v5.13

- Fix firmware removal path
- Cleanup eemi doc and *ops()

* tag 'zynqmp-soc-for-v5.13' of https://github.com/Xilinx/linux-xlnx:
  firmware: xilinx: Remove zynqmp_pm_get_eemi_ops() in IS_REACHABLE(CONFIG_ZYNQMP_FIRMWARE)
  firmware: xilinx: Fix dereferencing freed memory

Link: https://lore.kernel.org/r/a44f8e9f-cea7-57ef-c3bc-10f5f5e064fc@monstr.eu
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
Arnd Bergmann 2021-04-13 10:59:45 +02:00
commit 5418db1f6e
3 changed files with 5 additions and 36 deletions

View File

@ -16,35 +16,8 @@ components running across different processing clusters on a chip or
device to communicate with a power management controller (PMC) on a device to communicate with a power management controller (PMC) on a
device to issue or respond to power management requests. device to issue or respond to power management requests.
EEMI ops is a structure containing all eemi APIs supported by Zynq MPSoC. Any driver who wants to communicate with PMC using EEMI APIs use the
The zynqmp-firmware driver maintain all EEMI APIs in zynqmp_eemi_ops functions provided for each function.
structure. Any driver who want to communicate with PMC using EEMI APIs
can call zynqmp_pm_get_eemi_ops().
Example of EEMI ops::
/* zynqmp-firmware driver maintain all EEMI APIs */
struct zynqmp_eemi_ops {
int (*get_api_version)(u32 *version);
int (*query_data)(struct zynqmp_pm_query_data qdata, u32 *out);
};
static const struct zynqmp_eemi_ops eemi_ops = {
.get_api_version = zynqmp_pm_get_api_version,
.query_data = zynqmp_pm_query_data,
};
Example of EEMI ops usage::
static const struct zynqmp_eemi_ops *eemi_ops;
u32 ret_payload[PAYLOAD_ARG_CNT];
int ret;
eemi_ops = zynqmp_pm_get_eemi_ops();
if (IS_ERR(eemi_ops))
return PTR_ERR(eemi_ops);
ret = eemi_ops->query_data(qdata, ret_payload);
IOCTL IOCTL
------ ------

View File

@ -2,7 +2,7 @@
/* /*
* Xilinx Zynq MPSoC Firmware layer * Xilinx Zynq MPSoC Firmware layer
* *
* Copyright (C) 2014-2020 Xilinx, Inc. * Copyright (C) 2014-2021 Xilinx, Inc.
* *
* Michal Simek <michal.simek@xilinx.com> * Michal Simek <michal.simek@xilinx.com>
* Davorin Mista <davorin.mista@aggios.com> * Davorin Mista <davorin.mista@aggios.com>
@ -1280,12 +1280,13 @@ static int zynqmp_firmware_probe(struct platform_device *pdev)
static int zynqmp_firmware_remove(struct platform_device *pdev) static int zynqmp_firmware_remove(struct platform_device *pdev)
{ {
struct pm_api_feature_data *feature_data; struct pm_api_feature_data *feature_data;
struct hlist_node *tmp;
int i; int i;
mfd_remove_devices(&pdev->dev); mfd_remove_devices(&pdev->dev);
zynqmp_pm_api_debugfs_exit(); zynqmp_pm_api_debugfs_exit();
hash_for_each(pm_api_features_map, i, feature_data, hentry) { hash_for_each_safe(pm_api_features_map, i, tmp, feature_data, hentry) {
hash_del(&feature_data->hentry); hash_del(&feature_data->hentry);
kfree(feature_data); kfree(feature_data);
} }

View File

@ -354,11 +354,6 @@ int zynqmp_pm_read_pggs(u32 index, u32 *value);
int zynqmp_pm_system_shutdown(const u32 type, const u32 subtype); int zynqmp_pm_system_shutdown(const u32 type, const u32 subtype);
int zynqmp_pm_set_boot_health_status(u32 value); int zynqmp_pm_set_boot_health_status(u32 value);
#else #else
static inline struct zynqmp_eemi_ops *zynqmp_pm_get_eemi_ops(void)
{
return ERR_PTR(-ENODEV);
}
static inline int zynqmp_pm_get_api_version(u32 *version) static inline int zynqmp_pm_get_api_version(u32 *version)
{ {
return -ENODEV; return -ENODEV;