linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] soc/tegra: fuse: Export tegra_get_platform() & tegra_is_silicon()
@ 2022-09-26 10:05 Kartik
  2022-10-20  9:54 ` Thierry Reding
  0 siblings, 1 reply; 4+ messages in thread
From: Kartik @ 2022-09-26 10:05 UTC (permalink / raw)
  To: thierry.reding, jonathanh, windhl, sumitg, linux-tegra,
	linux-kernel, linux-arm-kernel

Functions tegra_get_platform() and tegra_is_silicon() are required
for pre-silicon development to correctly identify the platform on
which the software is running.

Export tegra_get_platform() and tegra_is_silicon(), so they can be
used for pre-slicon development of device drivers and kernel space
tests.

Signed-off-by: Kartik <kkartik@nvidia.com>
---
 drivers/soc/tegra/fuse/tegra-apbmisc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/soc/tegra/fuse/tegra-apbmisc.c b/drivers/soc/tegra/fuse/tegra-apbmisc.c
index 3351bd872ab2..904797f651a1 100644
--- a/drivers/soc/tegra/fuse/tegra-apbmisc.c
+++ b/drivers/soc/tegra/fuse/tegra-apbmisc.c
@@ -56,6 +56,7 @@ u8 tegra_get_platform(void)
 {
 	return (tegra_read_chipid() >> 20) & 0xf;
 }
+EXPORT_SYMBOL(tegra_get_platform);
 
 bool tegra_is_silicon(void)
 {
@@ -76,6 +77,7 @@ bool tegra_is_silicon(void)
 	 */
 	return true;
 }
+EXPORT_SYMBOL(tegra_is_silicon);
 
 u32 tegra_read_straps(void)
 {
-- 
2.17.1


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

* Re: [PATCH] soc/tegra: fuse: Export tegra_get_platform() & tegra_is_silicon()
  2022-09-26 10:05 [PATCH] soc/tegra: fuse: Export tegra_get_platform() & tegra_is_silicon() Kartik
@ 2022-10-20  9:54 ` Thierry Reding
  2022-10-20  9:57   ` Arnd Bergmann
  0 siblings, 1 reply; 4+ messages in thread
From: Thierry Reding @ 2022-10-20  9:54 UTC (permalink / raw)
  To: Arnd Bergmann, Olof Johansson
  Cc: Kartik, jonathanh, windhl, sumitg, linux-tegra, linux-kernel,
	linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 1686 bytes --]

On Mon, Sep 26, 2022 at 03:35:59PM +0530, Kartik wrote:
> Functions tegra_get_platform() and tegra_is_silicon() are required
> for pre-silicon development to correctly identify the platform on
> which the software is running.
> 
> Export tegra_get_platform() and tegra_is_silicon(), so they can be
> used for pre-slicon development of device drivers and kernel space
> tests.
> 
> Signed-off-by: Kartik <kkartik@nvidia.com>
> ---
>  drivers/soc/tegra/fuse/tegra-apbmisc.c | 2 ++
>  1 file changed, 2 insertions(+)

Hi Arnd, Olof,

can you take a quick look at this and provide some feedback regarding
acceptance? It's slightly unorthodox because the only in-tree users of
these functions are built-in drivers and early code, so they don't
technically need to be exported for strictly in-kernel users. However,
we do see these used quite frequently in pre-silicon development and
having these available upstream would help with internal kernel
transitions and so on. We may also see them used more commonly in
upstream drivers in the future.

Thierry

> diff --git a/drivers/soc/tegra/fuse/tegra-apbmisc.c b/drivers/soc/tegra/fuse/tegra-apbmisc.c
> index 3351bd872ab2..904797f651a1 100644
> --- a/drivers/soc/tegra/fuse/tegra-apbmisc.c
> +++ b/drivers/soc/tegra/fuse/tegra-apbmisc.c
> @@ -56,6 +56,7 @@ u8 tegra_get_platform(void)
>  {
>  	return (tegra_read_chipid() >> 20) & 0xf;
>  }
> +EXPORT_SYMBOL(tegra_get_platform);
>  
>  bool tegra_is_silicon(void)
>  {
> @@ -76,6 +77,7 @@ bool tegra_is_silicon(void)
>  	 */
>  	return true;
>  }
> +EXPORT_SYMBOL(tegra_is_silicon);
>  
>  u32 tegra_read_straps(void)
>  {
> -- 
> 2.17.1
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] soc/tegra: fuse: Export tegra_get_platform() & tegra_is_silicon()
  2022-10-20  9:54 ` Thierry Reding
@ 2022-10-20  9:57   ` Arnd Bergmann
  2022-10-20 14:06     ` Thierry Reding
  0 siblings, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2022-10-20  9:57 UTC (permalink / raw)
  To: Thierry Reding, Olof Johansson
  Cc: Kartik, Jon Hunter, windhl, sumitg, linux-tegra, linux-kernel,
	linux-arm-kernel

On Thu, Oct 20, 2022, at 11:54, Thierry Reding wrote:
> On Mon, Sep 26, 2022 at 03:35:59PM +0530, Kartik wrote:
>> Functions tegra_get_platform() and tegra_is_silicon() are required
>> for pre-silicon development to correctly identify the platform on
>> which the software is running.
>> 
>> Export tegra_get_platform() and tegra_is_silicon(), so they can be
>> used for pre-slicon development of device drivers and kernel space
>> tests.
>> 
>> Signed-off-by: Kartik <kkartik@nvidia.com>
>> ---
>>  drivers/soc/tegra/fuse/tegra-apbmisc.c | 2 ++
>>  1 file changed, 2 insertions(+)
>
> Hi Arnd, Olof,
>
> can you take a quick look at this and provide some feedback regarding
> acceptance? It's slightly unorthodox because the only in-tree users of
> these functions are built-in drivers and early code, so they don't
> technically need to be exported for strictly in-kernel users. However,
> we do see these used quite frequently in pre-silicon development and
> having these available upstream would help with internal kernel
> transitions and so on. We may also see them used more commonly in
> upstream drivers in the future.

Hi Thierry and Kartik,

Have you looked at using soc_device_match() instead?

As long as the information is part of the soc_device_attribute
prvoided by the soc info driver, any other kernel driver should
be able to just use string matching to get what you need here.

    Arnd

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

* Re: [PATCH] soc/tegra: fuse: Export tegra_get_platform() & tegra_is_silicon()
  2022-10-20  9:57   ` Arnd Bergmann
@ 2022-10-20 14:06     ` Thierry Reding
  0 siblings, 0 replies; 4+ messages in thread
From: Thierry Reding @ 2022-10-20 14:06 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Olof Johansson, Kartik, Jon Hunter, windhl, sumitg, linux-tegra,
	linux-kernel, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 2343 bytes --]

On Thu, Oct 20, 2022 at 11:57:39AM +0200, Arnd Bergmann wrote:
> On Thu, Oct 20, 2022, at 11:54, Thierry Reding wrote:
> > On Mon, Sep 26, 2022 at 03:35:59PM +0530, Kartik wrote:
> >> Functions tegra_get_platform() and tegra_is_silicon() are required
> >> for pre-silicon development to correctly identify the platform on
> >> which the software is running.
> >> 
> >> Export tegra_get_platform() and tegra_is_silicon(), so they can be
> >> used for pre-slicon development of device drivers and kernel space
> >> tests.
> >> 
> >> Signed-off-by: Kartik <kkartik@nvidia.com>
> >> ---
> >>  drivers/soc/tegra/fuse/tegra-apbmisc.c | 2 ++
> >>  1 file changed, 2 insertions(+)
> >
> > Hi Arnd, Olof,
> >
> > can you take a quick look at this and provide some feedback regarding
> > acceptance? It's slightly unorthodox because the only in-tree users of
> > these functions are built-in drivers and early code, so they don't
> > technically need to be exported for strictly in-kernel users. However,
> > we do see these used quite frequently in pre-silicon development and
> > having these available upstream would help with internal kernel
> > transitions and so on. We may also see them used more commonly in
> > upstream drivers in the future.
> 
> Hi Thierry and Kartik,
> 
> Have you looked at using soc_device_match() instead?
> 
> As long as the information is part of the soc_device_attribute
> prvoided by the soc info driver, any other kernel driver should
> be able to just use string matching to get what you need here.

The values that we stash into the struct soc_device_attribute for Tegra
are not very useful for this purpose. If there's no concern about back-
wards compatibility, perhaps that could be changed. I could imagine that
we could store some "simulation" string as a special case into the
revision attribute. Any "revision" that doesn't match "simulation" could
then be considered to be "silicon".

We don't populate "machine" at all it seems, but I'm not sure it would
be a good fit for this anyway.

Kartik, Jon, I wonder if we're really also interested in the platform or
if we export that primarily because it's needed by tegra_is_silicon(). I
see derivatives used in certain cases, but perhaps they can be
represented by other special "revision" strings?

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2022-10-20 14:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-26 10:05 [PATCH] soc/tegra: fuse: Export tegra_get_platform() & tegra_is_silicon() Kartik
2022-10-20  9:54 ` Thierry Reding
2022-10-20  9:57   ` Arnd Bergmann
2022-10-20 14:06     ` Thierry Reding

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).