Arm FF-A firmware driver updates/fixes for v5.19

Couple of fixes to handle fragmented memory descriptors and incorrect
 UUID parameter passed to ffa_partition_probe. Another fix deals with
 the incorrect use of ffa_device's driver_data by the core driver.
 Apart from these fixes, there is an addition of ffa_dev_get_drvdata helper
 function and its use in optee driver.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEunHlEgbzHrJD3ZPhAEG6vDF+4pgFAmJyPeUACgkQAEG6vDF+
 4piw1A//Y/LGEj9+4yv/NWt26M3DujFmQzHdjjJbIMZmy/iV+GJqfl/6uNH49pZZ
 6lNl7N3ZJC/hPakpDPOZUkDwmivlQWiKGbpdtiAXA6qNp5X+bpUk0N2DZTifhl1a
 0M9/iY/77N9CBTe0n0VcY24alm4++94ccMcpleGLYzf1sYU7sy8wZKV+++GDDJld
 TkD1wZ6GQaYQMdQTh+Il92jQbOOnMOfGqPrdRIHDS3R9g099GvFeB34QZfUOJL2d
 3ikKdj+Pe7BUD68FZZ8UQo1irudCi66577ufnN6dgV7Gf0wgqt+f0C+nawmErQCT
 yuYtUd1fOSTLlQCKXKsgF/+VgxwjcGHG1is7jCsBKJRFv3oSYzmaUWTifpxx2HVx
 XfCmrz4N46OmXUkQ1J12qo8F7Swo+VeIYZWIB+PrsUdqFHKK0lOX7mgU1dPZV3wx
 iiwzeexfVk2MCidaE0xqkuP9fQun39/3sZhtMvap6W9A3+jHKJhbz+yWP/AwlEtP
 pTjElKmMHgP1Md6G2kFcHuooPvAe8BPvudGD49U56nenz4uP0o6OnAub6Ay/1GVB
 dmYSdm33BmLM9bxiJqZHb/I3HtYO5suQum4DWQhfcrQX4BtqSu9fjLhkIAuznp2g
 YiBhF0Xdp4XF760JmePZiqCGH7Y8rqyNZHwxWnKunxCb+3uaJiQ=
 =IOMn
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEo6/YBQwIrVS28WGKmmx57+YAGNkFAmJz2EAACgkQmmx57+YA
 GNlnvBAAqHkiCC9z0WW4I7qGQ/uNbsYeX4EU856CXXyI5I9Lz8huJBiXoZwcuJMg
 3WBx8aF1m6xIUORM3NbuI/MLkVZyHI6z6Xfndcd+w8U1mI2CLg7/B+djr0jLyx78
 ckXRhua1g8DGoXdFwDao3ndsAAkMtWFJhNHpOMf2jqGdY1xEAIOfHb7YAeyNf7SZ
 1ygoSAhpys5rcek5r6GQzate4QqiwL2YTnC5vDkOWA1OFsX33d5WVEbrM4KmuLSO
 TdEcBWMxQX52pVZkrBZ1F+tZqgGqyDhf3bJ64zNleycV5U81abndTjkadpZflr1R
 4JgUkzHNkb0Xh3TkcyFBqwerq5FmeCkF6Um0vStngNpsa9fiQ8L5dC1T/NNTl6y5
 pZJhXWMPPgN7GDqLRnTnqdk9t3YS5lbU5BuNU33M1X2y0jMikn2V61WKkejhiXK4
 ZYcs5z31zXkDWXuO149FT38ZUXzf14rolrLx7zc3GVhk6oGp0R7kz+7SKW65P0z5
 NAWLFUmwPYAYgOsFaSY7P+i6UhBtpEk3YixjdYjjU3RvwqAp+YkARQKPApUTXido
 zVB4PRSgf1owEhnlnBzKKwM9ORkL+lrqxpGnB7fvr9UU3LvlI2QxoU+4LGlGmvMh
 cutmev2PBmC6QYmPMwLTvOziyP100riiI5ORb2zJPQVIplzn2EM=
 =MDJg
 -----END PGP SIGNATURE-----

Merge tag 'ffa-updates-5.19' of git://git.kernel.org/pub/scm/linux/kernel/git/sudeep.holla/linux into arm/drivers

Arm FF-A firmware driver updates/fixes for v5.19

Couple of fixes to handle fragmented memory descriptors and incorrect
UUID parameter passed to ffa_partition_probe. Another fix deals with
the incorrect use of ffa_device's driver_data by the core driver.
Apart from these fixes, there is an addition of ffa_dev_get_drvdata helper
function and its use in optee driver.

* tag 'ffa-updates-5.19' of git://git.kernel.org/pub/scm/linux/kernel/git/sudeep.holla/linux:
  tee: optee: Use ffa_dev_get_drvdata to fetch driver_data
  firmware: arm_ffa: Add ffa_dev_get_drvdata helper function
  firmware: arm_ffa: Remove incorrect assignment of driver_data
  firmware: arm_ffa: Fix uuid parameter to ffa_partition_probe
  firmware: arm_ffa: Fix handling of fragmented memory descriptors

Link: https://lore.kernel.org/r/20220504112853.3491961-1-sudeep.holla@arm.com
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
Arnd Bergmann 2022-05-05 15:59:27 +02:00
Родитель a37de2ad8e f3f3bdbd58
Коммит 91f92d7038
3 изменённых файлов: 21 добавлений и 12 удалений

Просмотреть файл

@ -398,11 +398,15 @@ static int ffa_mem_first_frag(u32 func_id, phys_addr_t buf, u32 buf_sz,
if (ret.a0 == FFA_ERROR) if (ret.a0 == FFA_ERROR)
return ffa_to_linux_errno((int)ret.a2); return ffa_to_linux_errno((int)ret.a2);
if (ret.a0 != FFA_SUCCESS) if (ret.a0 == FFA_SUCCESS) {
return -EOPNOTSUPP;
if (handle) if (handle)
*handle = PACK_HANDLE(ret.a2, ret.a3); *handle = PACK_HANDLE(ret.a2, ret.a3);
} else if (ret.a0 == FFA_MEM_FRAG_RX) {
if (handle)
*handle = PACK_HANDLE(ret.a1, ret.a2);
} else {
return -EOPNOTSUPP;
}
return frag_len; return frag_len;
} }
@ -426,10 +430,12 @@ static int ffa_mem_next_frag(u64 handle, u32 frag_len)
if (ret.a0 == FFA_ERROR) if (ret.a0 == FFA_ERROR)
return ffa_to_linux_errno((int)ret.a2); return ffa_to_linux_errno((int)ret.a2);
if (ret.a0 != FFA_MEM_FRAG_RX) if (ret.a0 == FFA_MEM_FRAG_RX)
return -EOPNOTSUPP;
return ret.a3; return ret.a3;
else if (ret.a0 == FFA_SUCCESS)
return 0;
return -EOPNOTSUPP;
} }
static int static int
@ -582,7 +588,7 @@ static int ffa_partition_info_get(const char *uuid_str,
return -ENODEV; return -ENODEV;
} }
count = ffa_partition_probe(&uuid_null, &pbuf); count = ffa_partition_probe(&uuid, &pbuf);
if (count <= 0) if (count <= 0)
return -ENOENT; return -ENOENT;
@ -688,8 +694,6 @@ static void ffa_setup_partitions(void)
__func__, tpbuf->id); __func__, tpbuf->id);
continue; continue;
} }
ffa_dev_set_drvdata(ffa_dev, drv_info);
} }
kfree(pbuf); kfree(pbuf);
} }

Просмотреть файл

@ -759,7 +759,7 @@ static const struct optee_ops optee_ffa_ops = {
static void optee_ffa_remove(struct ffa_device *ffa_dev) static void optee_ffa_remove(struct ffa_device *ffa_dev)
{ {
struct optee *optee = ffa_dev->dev.driver_data; struct optee *optee = ffa_dev_get_drvdata(ffa_dev);
optee_remove_common(optee); optee_remove_common(optee);

Просмотреть файл

@ -38,7 +38,12 @@ struct ffa_driver {
static inline void ffa_dev_set_drvdata(struct ffa_device *fdev, void *data) static inline void ffa_dev_set_drvdata(struct ffa_device *fdev, void *data)
{ {
fdev->dev.driver_data = data; dev_set_drvdata(&fdev->dev, data);
}
static inline void *ffa_dev_get_drvdata(struct ffa_device *fdev)
{
return dev_get_drvdata(&fdev->dev);
} }
#if IS_REACHABLE(CONFIG_ARM_FFA_TRANSPORT) #if IS_REACHABLE(CONFIG_ARM_FFA_TRANSPORT)