From: Sudeep Holla <sudeep.holla@arm.com> To: Will Deacon <will@kernel.org>, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Sudeep Holla <sudeep.holla@arm.com>, linux-kernel@vger.kernel.org, Marc Zyngier <maz@kernel.org> Subject: [RFC PATCH 3/3] firmware: Add example PSA FF-A non-secure VM partition Date: Mon, 1 Jun 2020 10:45:12 +0100 [thread overview] Message-ID: <20200601094512.50509-4-sudeep.holla@arm.com> (raw) In-Reply-To: <20200601094512.50509-1-sudeep.holla@arm.com> This is just an example non-secure VM partition to show how to create the device and use the PSA FF-A interface APIs. Signed-off-by: Sudeep Holla <sudeep.holla@arm.com> --- drivers/firmware/arm_psa_ffa/Kconfig | 7 +++ drivers/firmware/arm_psa_ffa/Makefile | 1 + drivers/firmware/arm_psa_ffa/partition.c | 71 ++++++++++++++++++++++++ 3 files changed, 79 insertions(+) create mode 100644 drivers/firmware/arm_psa_ffa/partition.c diff --git a/drivers/firmware/arm_psa_ffa/Kconfig b/drivers/firmware/arm_psa_ffa/Kconfig index ba699ec68ec4..34ad61e79234 100644 --- a/drivers/firmware/arm_psa_ffa/Kconfig +++ b/drivers/firmware/arm_psa_ffa/Kconfig @@ -13,3 +13,10 @@ config ARM_PSA_FFA_TRANSPORT This driver provides interface for all the client drivers making use of the features offered by ARM PSA-FF-A. + +config ARM_PSA_FFA_PARTITION + tristate "Arm PSA FF-A compliant partition" + depends on ARM_PSA_FFA_TRANSPORT + help + This driver provides example for ARM PSA-FF-A client driver + making use of the interfaces offered by ARM PSA-FF-A driver. diff --git a/drivers/firmware/arm_psa_ffa/Makefile b/drivers/firmware/arm_psa_ffa/Makefile index ac0455ff71a4..8eb03898baf7 100644 --- a/drivers/firmware/arm_psa_ffa/Makefile +++ b/drivers/firmware/arm_psa_ffa/Makefile @@ -1,2 +1,3 @@ # SPDX-License-Identifier: GPL-2.0-only obj-$(CONFIG_ARM_PSA_FFA_TRANSPORT) += driver.o +obj-$(CONFIG_ARM_PSA_FFA_PARTITION) += partition.o diff --git a/drivers/firmware/arm_psa_ffa/partition.c b/drivers/firmware/arm_psa_ffa/partition.c new file mode 100644 index 000000000000..8549f8d61454 --- /dev/null +++ b/drivers/firmware/arm_psa_ffa/partition.c @@ -0,0 +1,71 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Arm PSA FFA example partition driver + * + * Copyright (C) 2020 Arm Ltd. + */ + +#include <linux/arm_psa_ffa.h> +#include <linux/of_address.h> +#include <linux/of_platform.h> +#include <linux/platform_device.h> +#include <linux/module.h> +#include <linux/types.h> +#include <linux/uuid.h> + +static int psa_ffa_partition_probe(struct platform_device *pdev) +{ + u16 vm_id; + uuid_t uuid; + const char *uuid_str; + u32 uuid0_4[4]; + struct device *dev = &pdev->dev; + const struct device_node *np = dev->of_node; + struct arm_psa_ffa_handle *handle; + struct psa_ffa_partition_info **buffer; + + handle = arm_psa_ffa_handle_get(dev); + if (!handle) + return -ENODEV; + + if (of_property_read_string(np, "uuid", &uuid_str)) { + dev_err(dev, "failed to parse \"uuid\" property in '%pOF'\n", np); + return -ENODEV; + } + + if (uuid_parse(uuid_str, &uuid)) { + dev_err(dev, "invalid \"uuid\" property (%s)\n", uuid_str); + return -ENODEV; + } + + export_uuid((u8 *)uuid0_4, &uuid); + + vm_id = handle->id_get(); + + handle->partition_info_get(uuid0_4[0], uuid0_4[1], uuid0_4[2], + uuid0_4[3], buffer); + + return 0; +} + +static const struct of_device_id psa_ffa_partition_of_match[] = { + {.compatible = "arm,psa-ffa-partition"}, + {}, +}; + +MODULE_DEVICE_TABLE(of, psa_ffa_partition_of_match); + +static struct platform_driver psa_ffa_partition_driver = { + .driver = { + .name = "psa-ffa-partition", + .of_match_table = psa_ffa_partition_of_match, + }, + .probe = psa_ffa_partition_probe, +}; + +module_platform_driver(psa_ffa_partition_driver); + +MODULE_ALIAS("platform: arm-psa-ffa"); +MODULE_AUTHOR("Sudeep Holla <sudeep.holla@arm.com>"); +MODULE_DESCRIPTION("Arm PSA FF-A example partition driver"); +MODULE_LICENSE("GPL v2"); -- 2.17.1
WARNING: multiple messages have this Message-ID (diff)
From: Sudeep Holla <sudeep.holla@arm.com> To: Will Deacon <will@kernel.org>, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Marc Zyngier <maz@kernel.org>, linux-kernel@vger.kernel.org, Sudeep Holla <sudeep.holla@arm.com> Subject: [RFC PATCH 3/3] firmware: Add example PSA FF-A non-secure VM partition Date: Mon, 1 Jun 2020 10:45:12 +0100 [thread overview] Message-ID: <20200601094512.50509-4-sudeep.holla@arm.com> (raw) In-Reply-To: <20200601094512.50509-1-sudeep.holla@arm.com> This is just an example non-secure VM partition to show how to create the device and use the PSA FF-A interface APIs. Signed-off-by: Sudeep Holla <sudeep.holla@arm.com> --- drivers/firmware/arm_psa_ffa/Kconfig | 7 +++ drivers/firmware/arm_psa_ffa/Makefile | 1 + drivers/firmware/arm_psa_ffa/partition.c | 71 ++++++++++++++++++++++++ 3 files changed, 79 insertions(+) create mode 100644 drivers/firmware/arm_psa_ffa/partition.c diff --git a/drivers/firmware/arm_psa_ffa/Kconfig b/drivers/firmware/arm_psa_ffa/Kconfig index ba699ec68ec4..34ad61e79234 100644 --- a/drivers/firmware/arm_psa_ffa/Kconfig +++ b/drivers/firmware/arm_psa_ffa/Kconfig @@ -13,3 +13,10 @@ config ARM_PSA_FFA_TRANSPORT This driver provides interface for all the client drivers making use of the features offered by ARM PSA-FF-A. + +config ARM_PSA_FFA_PARTITION + tristate "Arm PSA FF-A compliant partition" + depends on ARM_PSA_FFA_TRANSPORT + help + This driver provides example for ARM PSA-FF-A client driver + making use of the interfaces offered by ARM PSA-FF-A driver. diff --git a/drivers/firmware/arm_psa_ffa/Makefile b/drivers/firmware/arm_psa_ffa/Makefile index ac0455ff71a4..8eb03898baf7 100644 --- a/drivers/firmware/arm_psa_ffa/Makefile +++ b/drivers/firmware/arm_psa_ffa/Makefile @@ -1,2 +1,3 @@ # SPDX-License-Identifier: GPL-2.0-only obj-$(CONFIG_ARM_PSA_FFA_TRANSPORT) += driver.o +obj-$(CONFIG_ARM_PSA_FFA_PARTITION) += partition.o diff --git a/drivers/firmware/arm_psa_ffa/partition.c b/drivers/firmware/arm_psa_ffa/partition.c new file mode 100644 index 000000000000..8549f8d61454 --- /dev/null +++ b/drivers/firmware/arm_psa_ffa/partition.c @@ -0,0 +1,71 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Arm PSA FFA example partition driver + * + * Copyright (C) 2020 Arm Ltd. + */ + +#include <linux/arm_psa_ffa.h> +#include <linux/of_address.h> +#include <linux/of_platform.h> +#include <linux/platform_device.h> +#include <linux/module.h> +#include <linux/types.h> +#include <linux/uuid.h> + +static int psa_ffa_partition_probe(struct platform_device *pdev) +{ + u16 vm_id; + uuid_t uuid; + const char *uuid_str; + u32 uuid0_4[4]; + struct device *dev = &pdev->dev; + const struct device_node *np = dev->of_node; + struct arm_psa_ffa_handle *handle; + struct psa_ffa_partition_info **buffer; + + handle = arm_psa_ffa_handle_get(dev); + if (!handle) + return -ENODEV; + + if (of_property_read_string(np, "uuid", &uuid_str)) { + dev_err(dev, "failed to parse \"uuid\" property in '%pOF'\n", np); + return -ENODEV; + } + + if (uuid_parse(uuid_str, &uuid)) { + dev_err(dev, "invalid \"uuid\" property (%s)\n", uuid_str); + return -ENODEV; + } + + export_uuid((u8 *)uuid0_4, &uuid); + + vm_id = handle->id_get(); + + handle->partition_info_get(uuid0_4[0], uuid0_4[1], uuid0_4[2], + uuid0_4[3], buffer); + + return 0; +} + +static const struct of_device_id psa_ffa_partition_of_match[] = { + {.compatible = "arm,psa-ffa-partition"}, + {}, +}; + +MODULE_DEVICE_TABLE(of, psa_ffa_partition_of_match); + +static struct platform_driver psa_ffa_partition_driver = { + .driver = { + .name = "psa-ffa-partition", + .of_match_table = psa_ffa_partition_of_match, + }, + .probe = psa_ffa_partition_probe, +}; + +module_platform_driver(psa_ffa_partition_driver); + +MODULE_ALIAS("platform: arm-psa-ffa"); +MODULE_AUTHOR("Sudeep Holla <sudeep.holla@arm.com>"); +MODULE_DESCRIPTION("Arm PSA FF-A example partition driver"); +MODULE_LICENSE("GPL v2"); -- 2.17.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-06-01 9:45 UTC|newest] Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-06-01 9:45 [RFC PATCH 0/3] firmware: Add support for PSA FF-A interface Sudeep Holla 2020-06-01 9:45 ` Sudeep Holla 2020-06-01 9:45 ` [RFC PATCH 1/3] dt-bindings: Add ARM PSA FF binding for non-secure VM partitions Sudeep Holla 2020-06-01 9:45 ` Sudeep Holla 2020-06-09 22:35 ` Rob Herring 2020-06-09 22:35 ` Rob Herring 2020-06-10 7:43 ` Will Deacon 2020-06-10 7:43 ` Will Deacon 2020-06-10 13:56 ` Rob Herring 2020-06-10 13:56 ` Rob Herring 2020-06-11 15:46 ` Achin Gupta 2020-06-11 15:46 ` Achin Gupta 2020-06-11 17:12 ` Will Deacon 2020-06-11 17:12 ` Will Deacon 2020-06-15 9:16 ` Achin Gupta 2020-06-15 9:16 ` Achin Gupta 2020-06-15 9:51 ` Will Deacon 2020-06-15 9:51 ` Will Deacon 2020-06-15 11:42 ` Achin Gupta 2020-06-15 11:42 ` Achin Gupta 2020-06-15 11:55 ` Will Deacon 2020-06-15 11:55 ` Will Deacon 2020-06-15 16:48 ` Achin Gupta 2020-06-15 16:48 ` Achin Gupta 2020-06-10 8:32 ` Sudeep Holla 2020-06-10 8:32 ` Sudeep Holla 2020-06-01 9:45 ` [RFC PATCH 2/3] firmware: Add support for PSA FF-A transport for " Sudeep Holla 2020-06-01 9:45 ` Sudeep Holla 2020-06-01 13:46 ` kbuild test robot 2020-06-02 7:11 ` kbuild test robot 2020-07-09 22:15 ` Arve Hjønnevåg 2020-07-09 22:15 ` Arve Hjønnevåg 2020-06-01 9:45 ` Sudeep Holla [this message] 2020-06-01 9:45 ` [RFC PATCH 3/3] firmware: Add example PSA FF-A non-secure VM partition Sudeep Holla 2020-06-01 14:22 ` kbuild test robot 2020-06-04 13:37 ` [RFC PATCH 0/3] firmware: Add support for PSA FF-A interface Will Deacon 2020-06-04 13:37 ` Will Deacon 2020-06-09 17:41 ` Sudeep Holla 2020-06-09 17:41 ` Sudeep Holla 2020-06-10 7:57 ` Will Deacon 2020-06-10 7:57 ` Will Deacon 2020-06-10 8:10 ` Sudeep Holla 2020-06-10 8:10 ` Sudeep Holla 2020-06-15 11:38 ` Jens Wiklander 2020-06-15 11:38 ` Jens Wiklander
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200601094512.50509-4-sudeep.holla@arm.com \ --to=sudeep.holla@arm.com \ --cc=devicetree@vger.kernel.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=maz@kernel.org \ --cc=will@kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.