linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bus: fsl-mc: add api to retrieve mc version
@ 2020-01-27 11:16 Andrei Botila
  2020-01-27 11:48 ` Laurentiu Tudor
  0 siblings, 1 reply; 3+ messages in thread
From: Andrei Botila @ 2020-01-27 11:16 UTC (permalink / raw)
  To: Stuart Yoder, Laurentiu Tudor, Li Yang
  Cc: Andrei Botila, linuxppc-dev, linux-kernel, linux-arm-kernel

Add a new api that returns Management Complex firmware version
and make the required structure public. The api's first user will be
the caam driver for setting prediction resistance bits.

Signed-off-by: Andrei Botila <andrei.botila@nxp.com>
---
 drivers/bus/fsl-mc/fsl-mc-bus.c | 33 +++++++++++++++++----------------
 include/linux/fsl/mc.h          | 16 ++++++++++++++++
 2 files changed, 33 insertions(+), 16 deletions(-)

diff --git a/drivers/bus/fsl-mc/fsl-mc-bus.c b/drivers/bus/fsl-mc/fsl-mc-bus.c
index a07cc19becdb..330c76181604 100644
--- a/drivers/bus/fsl-mc/fsl-mc-bus.c
+++ b/drivers/bus/fsl-mc/fsl-mc-bus.c
@@ -26,6 +26,8 @@
  */
 #define FSL_MC_DEFAULT_DMA_MASK	(~0ULL)
 
+static struct fsl_mc_version mc_version;
+
 /**
  * struct fsl_mc - Private data of a "fsl,qoriq-mc" platform device
  * @root_mc_bus_dev: fsl-mc device representing the root DPRC
@@ -54,20 +56,6 @@ struct fsl_mc_addr_translation_range {
 	phys_addr_t start_phys_addr;
 };
 
-/**
- * struct mc_version
- * @major: Major version number: incremented on API compatibility changes
- * @minor: Minor version number: incremented on API additions (that are
- *		backward compatible); reset when major version is incremented
- * @revision: Internal revision number: incremented on implementation changes
- *		and/or bug fixes that have no impact on API
- */
-struct mc_version {
-	u32 major;
-	u32 minor;
-	u32 revision;
-};
-
 /**
  * fsl_mc_bus_match - device to driver matching callback
  * @dev: the fsl-mc device to match against
@@ -338,7 +326,7 @@ EXPORT_SYMBOL_GPL(fsl_mc_driver_unregister);
  */
 static int mc_get_version(struct fsl_mc_io *mc_io,
 			  u32 cmd_flags,
-			  struct mc_version *mc_ver_info)
+			  struct fsl_mc_version *mc_ver_info)
 {
 	struct fsl_mc_command cmd = { 0 };
 	struct dpmng_rsp_get_version *rsp_params;
@@ -363,6 +351,20 @@ static int mc_get_version(struct fsl_mc_io *mc_io,
 	return 0;
 }
 
+/**
+ * fsl_mc_get_version - function to retrieve the MC f/w version information
+ *
+ * Return:	mc version when called after fsl-mc-bus probe; NULL otherwise.
+ */
+struct fsl_mc_version *fsl_mc_get_version(void)
+{
+	if (mc_version.major)
+		return &mc_version;
+
+	return NULL;
+}
+EXPORT_SYMBOL_GPL(fsl_mc_get_version);
+
 /**
  * fsl_mc_get_root_dprc - function to traverse to the root dprc
  */
@@ -862,7 +864,6 @@ static int fsl_mc_bus_probe(struct platform_device *pdev)
 	int container_id;
 	phys_addr_t mc_portal_phys_addr;
 	u32 mc_portal_size;
-	struct mc_version mc_version;
 	struct resource res;
 
 	mc = devm_kzalloc(&pdev->dev, sizeof(*mc), GFP_KERNEL);
diff --git a/include/linux/fsl/mc.h b/include/linux/fsl/mc.h
index 54d9436600c7..2b5f8366dbe1 100644
--- a/include/linux/fsl/mc.h
+++ b/include/linux/fsl/mc.h
@@ -381,6 +381,22 @@ int __must_check __fsl_mc_driver_register(struct fsl_mc_driver *fsl_mc_driver,
 
 void fsl_mc_driver_unregister(struct fsl_mc_driver *driver);
 
+/**
+ * struct fsl_mc_version
+ * @major: Major version number: incremented on API compatibility changes
+ * @minor: Minor version number: incremented on API additions (that are
+ *		backward compatible); reset when major version is incremented
+ * @revision: Internal revision number: incremented on implementation changes
+ *		and/or bug fixes that have no impact on API
+ */
+struct fsl_mc_version {
+	u32 major;
+	u32 minor;
+	u32 revision;
+};
+
+struct fsl_mc_version *fsl_mc_get_version(void);
+
 int __must_check fsl_mc_portal_allocate(struct fsl_mc_device *mc_dev,
 					u16 mc_io_flags,
 					struct fsl_mc_io **new_mc_io);
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] bus: fsl-mc: add api to retrieve mc version
  2020-01-27 11:16 [PATCH] bus: fsl-mc: add api to retrieve mc version Andrei Botila
@ 2020-01-27 11:48 ` Laurentiu Tudor
  2020-01-30 13:27   ` Horia Geanta
  0 siblings, 1 reply; 3+ messages in thread
From: Laurentiu Tudor @ 2020-01-27 11:48 UTC (permalink / raw)
  To: Andrei Botila, Stuart Yoder, Leo Li
  Cc: Greg Kroah-Hartman, Andrei Botila, linuxppc-dev, linux-kernel,
	linux-arm-kernel


> -----Original Message-----
> From: Andrei Botila <andrei.botila@nxp.com>
> Sent: Monday, January 27, 2020 1:16 PM
> 
> Add a new api that returns Management Complex firmware version
> and make the required structure public. The api's first user will be
> the caam driver for setting prediction resistance bits.
> 
> Signed-off-by: Andrei Botila <andrei.botila@nxp.com>

Acked-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>

> ---
>  drivers/bus/fsl-mc/fsl-mc-bus.c | 33 +++++++++++++++++----------------
>  include/linux/fsl/mc.h          | 16 ++++++++++++++++
>  2 files changed, 33 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/bus/fsl-mc/fsl-mc-bus.c b/drivers/bus/fsl-mc/fsl-mc-
> bus.c
> index a07cc19becdb..330c76181604 100644
> --- a/drivers/bus/fsl-mc/fsl-mc-bus.c
> +++ b/drivers/bus/fsl-mc/fsl-mc-bus.c
> @@ -26,6 +26,8 @@
>   */
>  #define FSL_MC_DEFAULT_DMA_MASK	(~0ULL)
> 
> +static struct fsl_mc_version mc_version;
> +
>  /**
>   * struct fsl_mc - Private data of a "fsl,qoriq-mc" platform device
>   * @root_mc_bus_dev: fsl-mc device representing the root DPRC
> @@ -54,20 +56,6 @@ struct fsl_mc_addr_translation_range {
>  	phys_addr_t start_phys_addr;
>  };
> 
> -/**
> - * struct mc_version
> - * @major: Major version number: incremented on API compatibility changes
> - * @minor: Minor version number: incremented on API additions (that are
> - *		backward compatible); reset when major version is incremented
> - * @revision: Internal revision number: incremented on implementation
> changes
> - *		and/or bug fixes that have no impact on API
> - */
> -struct mc_version {
> -	u32 major;
> -	u32 minor;
> -	u32 revision;
> -};
> -
>  /**
>   * fsl_mc_bus_match - device to driver matching callback
>   * @dev: the fsl-mc device to match against
> @@ -338,7 +326,7 @@ EXPORT_SYMBOL_GPL(fsl_mc_driver_unregister);
>   */
>  static int mc_get_version(struct fsl_mc_io *mc_io,
>  			  u32 cmd_flags,
> -			  struct mc_version *mc_ver_info)
> +			  struct fsl_mc_version *mc_ver_info)
>  {
>  	struct fsl_mc_command cmd = { 0 };
>  	struct dpmng_rsp_get_version *rsp_params;
> @@ -363,6 +351,20 @@ static int mc_get_version(struct fsl_mc_io *mc_io,
>  	return 0;
>  }
> 
> +/**
> + * fsl_mc_get_version - function to retrieve the MC f/w version
> information
> + *
> + * Return:	mc version when called after fsl-mc-bus probe; NULL otherwise.
> + */
> +struct fsl_mc_version *fsl_mc_get_version(void)
> +{
> +	if (mc_version.major)
> +		return &mc_version;
> +
> +	return NULL;
> +}
> +EXPORT_SYMBOL_GPL(fsl_mc_get_version);
> +
>  /**
>   * fsl_mc_get_root_dprc - function to traverse to the root dprc
>   */
> @@ -862,7 +864,6 @@ static int fsl_mc_bus_probe(struct platform_device
> *pdev)
>  	int container_id;
>  	phys_addr_t mc_portal_phys_addr;
>  	u32 mc_portal_size;
> -	struct mc_version mc_version;
>  	struct resource res;
> 
>  	mc = devm_kzalloc(&pdev->dev, sizeof(*mc), GFP_KERNEL);
> diff --git a/include/linux/fsl/mc.h b/include/linux/fsl/mc.h
> index 54d9436600c7..2b5f8366dbe1 100644
> --- a/include/linux/fsl/mc.h
> +++ b/include/linux/fsl/mc.h
> @@ -381,6 +381,22 @@ int __must_check __fsl_mc_driver_register(struct
> fsl_mc_driver *fsl_mc_driver,
> 
>  void fsl_mc_driver_unregister(struct fsl_mc_driver *driver);
> 
> +/**
> + * struct fsl_mc_version
> + * @major: Major version number: incremented on API compatibility changes
> + * @minor: Minor version number: incremented on API additions (that are
> + *		backward compatible); reset when major version is incremented
> + * @revision: Internal revision number: incremented on implementation
> changes
> + *		and/or bug fixes that have no impact on API
> + */
> +struct fsl_mc_version {
> +	u32 major;
> +	u32 minor;
> +	u32 revision;
> +};
> +
> +struct fsl_mc_version *fsl_mc_get_version(void);
> +
>  int __must_check fsl_mc_portal_allocate(struct fsl_mc_device *mc_dev,
>  					u16 mc_io_flags,
>  					struct fsl_mc_io **new_mc_io);
> --
> 2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] bus: fsl-mc: add api to retrieve mc version
  2020-01-27 11:48 ` Laurentiu Tudor
@ 2020-01-30 13:27   ` Horia Geanta
  0 siblings, 0 replies; 3+ messages in thread
From: Horia Geanta @ 2020-01-30 13:27 UTC (permalink / raw)
  To: Laurentiu Tudor, Andrei Botila, Stuart Yoder, Leo Li, Herbert Xu
  Cc: Andrey Smirnov, Greg Kroah-Hartman, linux-kernel, linux-crypto,
	linuxppc-dev, linux-arm-kernel

On 1/27/2020 1:49 PM, Laurentiu Tudor wrote:
> 
>> -----Original Message-----
>> From: Andrei Botila <andrei.botila@nxp.com>
>> Sent: Monday, January 27, 2020 1:16 PM
>>
>> Add a new api that returns Management Complex firmware version
>> and make the required structure public. The api's first user will be
>> the caam driver for setting prediction resistance bits.
>>
>> Signed-off-by: Andrei Botila <andrei.botila@nxp.com>
> 
> Acked-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
Reviewed-by: Horia Geantă <horia.geanta@nxp.com>

We'll need this patch in the crypto subsystem,
such that the CAAM HWRNG patch series (currently v7)
https://patchwork.kernel.org/project/linux-crypto/list/?series=233763&archive=both&state=*
is updated to work with existing (and future) FSL MC f/w versions.

CAAM HWRNG series has been in review for quite some time
and AFAICT is in pretty good shape.
Unfortunately it missed v5.6 merge window. I would like it to go
in v5.7, but for this we'll need current patch (a dependency)
to go through (or be cherry-picked into) the crypto tree.

>> ---
>>  drivers/bus/fsl-mc/fsl-mc-bus.c | 33 +++++++++++++++++----------------
>>  include/linux/fsl/mc.h          | 16 ++++++++++++++++
>>  2 files changed, 33 insertions(+), 16 deletions(-)
>>
>> diff --git a/drivers/bus/fsl-mc/fsl-mc-bus.c b/drivers/bus/fsl-mc/fsl-mc-
>> bus.c
>> index a07cc19becdb..330c76181604 100644
>> --- a/drivers/bus/fsl-mc/fsl-mc-bus.c
>> +++ b/drivers/bus/fsl-mc/fsl-mc-bus.c
>> @@ -26,6 +26,8 @@
>>   */
>>  #define FSL_MC_DEFAULT_DMA_MASK	(~0ULL)
>>
>> +static struct fsl_mc_version mc_version;
>> +
>>  /**
>>   * struct fsl_mc - Private data of a "fsl,qoriq-mc" platform device
>>   * @root_mc_bus_dev: fsl-mc device representing the root DPRC
>> @@ -54,20 +56,6 @@ struct fsl_mc_addr_translation_range {
>>  	phys_addr_t start_phys_addr;
>>  };
>>
>> -/**
>> - * struct mc_version
>> - * @major: Major version number: incremented on API compatibility changes
>> - * @minor: Minor version number: incremented on API additions (that are
>> - *		backward compatible); reset when major version is incremented
>> - * @revision: Internal revision number: incremented on implementation
>> changes
>> - *		and/or bug fixes that have no impact on API
>> - */
>> -struct mc_version {
>> -	u32 major;
>> -	u32 minor;
>> -	u32 revision;
>> -};
>> -
>>  /**
>>   * fsl_mc_bus_match - device to driver matching callback
>>   * @dev: the fsl-mc device to match against
>> @@ -338,7 +326,7 @@ EXPORT_SYMBOL_GPL(fsl_mc_driver_unregister);
>>   */
>>  static int mc_get_version(struct fsl_mc_io *mc_io,
>>  			  u32 cmd_flags,
>> -			  struct mc_version *mc_ver_info)
>> +			  struct fsl_mc_version *mc_ver_info)
>>  {
>>  	struct fsl_mc_command cmd = { 0 };
>>  	struct dpmng_rsp_get_version *rsp_params;
>> @@ -363,6 +351,20 @@ static int mc_get_version(struct fsl_mc_io *mc_io,
>>  	return 0;
>>  }
>>
>> +/**
>> + * fsl_mc_get_version - function to retrieve the MC f/w version
>> information
>> + *
>> + * Return:	mc version when called after fsl-mc-bus probe; NULL otherwise.
>> + */
>> +struct fsl_mc_version *fsl_mc_get_version(void)
>> +{
>> +	if (mc_version.major)
>> +		return &mc_version;
>> +
>> +	return NULL;
>> +}
>> +EXPORT_SYMBOL_GPL(fsl_mc_get_version);
>> +
>>  /**
>>   * fsl_mc_get_root_dprc - function to traverse to the root dprc
>>   */
>> @@ -862,7 +864,6 @@ static int fsl_mc_bus_probe(struct platform_device
>> *pdev)
>>  	int container_id;
>>  	phys_addr_t mc_portal_phys_addr;
>>  	u32 mc_portal_size;
>> -	struct mc_version mc_version;
>>  	struct resource res;
>>
>>  	mc = devm_kzalloc(&pdev->dev, sizeof(*mc), GFP_KERNEL);
>> diff --git a/include/linux/fsl/mc.h b/include/linux/fsl/mc.h
>> index 54d9436600c7..2b5f8366dbe1 100644
>> --- a/include/linux/fsl/mc.h
>> +++ b/include/linux/fsl/mc.h
>> @@ -381,6 +381,22 @@ int __must_check __fsl_mc_driver_register(struct
>> fsl_mc_driver *fsl_mc_driver,
>>
>>  void fsl_mc_driver_unregister(struct fsl_mc_driver *driver);
>>
>> +/**
>> + * struct fsl_mc_version
>> + * @major: Major version number: incremented on API compatibility changes
>> + * @minor: Minor version number: incremented on API additions (that are
>> + *		backward compatible); reset when major version is incremented
>> + * @revision: Internal revision number: incremented on implementation
>> changes
>> + *		and/or bug fixes that have no impact on API
>> + */
>> +struct fsl_mc_version {
>> +	u32 major;
>> +	u32 minor;
>> +	u32 revision;
>> +};
>> +
>> +struct fsl_mc_version *fsl_mc_get_version(void);
>> +
>>  int __must_check fsl_mc_portal_allocate(struct fsl_mc_device *mc_dev,
>>  					u16 mc_io_flags,
>>  					struct fsl_mc_io **new_mc_io);
>> --
>> 2.17.1
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-01-30 13:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-27 11:16 [PATCH] bus: fsl-mc: add api to retrieve mc version Andrei Botila
2020-01-27 11:48 ` Laurentiu Tudor
2020-01-30 13:27   ` Horia Geanta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).