mbox series

[v1,0/1] *** export interface for custom UPIU transfer ***

Message ID 20250327114604.118030-1-selvakumar.kalimuthu@in.bosch.com
Headers show
Series *** export interface for custom UPIU transfer *** | expand

Message

Selvakumar Kalimuthu (MS/ECC-CF3-XC) March 27, 2025, 11:46 a.m. UTC
Exporting the API ufshcd_exec_raw_upiu_cmd from ufs driver helps
OEM's/vendors to send their customized UPIU with the different
vendor specific transmission code.

Selvakumar Kalimuthu (1):
  ufs: core: Export interface for sending raw UPIU commands

 drivers/ufs/core/ufshcd.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Bart Van Assche March 27, 2025, 11:57 a.m. UTC | #1
On 3/27/25 7:46 AM, Selvakumar Kalimuthu wrote:
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index 78b57e946cdf..226cc90c74b0 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -7360,6 +7360,7 @@ int ufshcd_exec_raw_upiu_cmd(struct ufs_hba *hba,
>   
>   	return err;
>   }
> +EXPORT_SYMBOL_GPL(ufshcd_exec_raw_upiu_cmd);

As I already mentioned off-list, please do not export functions without
adding a caller that needs the export.

Thanks,

Bart.
Avri Altman March 28, 2025, 7:05 a.m. UTC | #2
> Hi Bart,
> 
> Thanks for your feedback.
> 
> The caller for this exported function resides in an OEM/vendor-specific
> module, which is not part of the standard Linux kernel. The intent of this patch
> is to provide an interface that allows vendors to send raw UPIU commands
> from their external modules to retrieve device-specific information or execute
> proprietary commands.
The ufs spec defines a wide range of vendor specific query commands: 0x40-0x7F, and 0xC0-0xFF.
For those you can use the current caller, e.g. ufs-bsg module?

Thanks,
Avri

> Since vendor modules cannot modify the UFS core
> driver directly, exporting ufshcd_exec_raw_upiu_cmd is necessary to enable
> controlled access without modifying the mainline kernel further.
> 
> Would you prefer that we also provide an example of a vendor module using
> this export, even though it won’t be part of the upstream kernel? Or is there a
> preferred approach to enable vendor-specific extensions without modifying
> the standard kernel UFS driver?
> 
> Looking forward to your guidance.
> 
> Mit freundlichen Grüßen / Best regards
> 
> Selvakumar  Kalimuthu
> 
> responsible for Platform 1 projects (MS/ECF1-XC) Robert Bosch GmbH |
> Postfach 10 60 50 | 70049 Stuttgart | GERMANY | www.bosch.com Fax +91
> 422 667-1208 | Selvakumar.Kalimuthu@in.bosch.com
> 
> Registered Office: Stuttgart, Registration Court: Amtsgericht Stuttgart, HRB
> 14000; Chairman of the Supervisory Board: Prof. Dr. Stefan
> Asenkerschbaumer; Managing Directors: Dr. Stefan Hartung, Dr. Christian
> Fischer, Dr. Markus Forschner, Stefan Grosch, Dr. Markus Heyn, Dr. Frank
> Meyer, Katja von Raven, Dr. Tanja Rückert
> 
> -----Original Message-----
> From: Bart Van Assche <bvanassche@acm.org>
> Sent: Thursday, March 27, 2025 5:28 PM
> To: Selvakumar Kalimuthu (MS/ECC-CF3-XC)
> <selvakumar.kalimuthu@in.bosch.com>; Alim Akhtar
> <alim.akhtar@samsung.com>; Avri Altman <avri.altman@wdc.com>; James
> E.J. Bottomley <jejb@linux.ibm.com>; Martin K. Petersen
> <martin.petersen@oracle.com>; Peter Wang <peter.wang@mediatek.com>;
> Manjunatha Madana <quic_c_mamanj@quicinc.com>
> Cc: Antony A (MS/ECC-CF-EP2-XC) <Antony.Ambrose@in.bosch.com>; linux-
> scsi@vger.kernel.org
> Subject: Re: [PATCH v1 1/1] ufs: core: Export interface for sending raw UPIU
> commands
> 
> On 3/27/25 7:46 AM, Selvakumar Kalimuthu wrote:
> > diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> > index 78b57e946cdf..226cc90c74b0 100644
> > --- a/drivers/ufs/core/ufshcd.c
> > +++ b/drivers/ufs/core/ufshcd.c
> > @@ -7360,6 +7360,7 @@ int ufshcd_exec_raw_upiu_cmd(struct ufs_hba
> > *hba,
> >
> >   	return err;
> >   }
> > +EXPORT_SYMBOL_GPL(ufshcd_exec_raw_upiu_cmd);
> 
> As I already mentioned off-list, please do not export functions without adding
> a caller that needs the export.
> 
> Thanks,
> 
> Bart.
Selvakumar Kalimuthu (MS/ECC-CF3-XC) March 28, 2025, 10:22 a.m. UTC | #3
Hi Avri,

Thank you for your insights.

We understand that vendor-specific query commands can be sent using the ufs-bsg module. However, there are a couple of challenges:

* Some vendor-specific commands use unique msgcode values that may not be handled efficiently through the existing ufs-bsg framework.
* In the Android system, access to ufs-bsg is restricted, and not all processes can communicate with it, making it difficult to use for vendor-specific extensions.

Given these constraints, exporting ufshcd_exec_raw_upiu_cmd provides a more flexible solution for vendor modules to execute necessary commands without modifying the mainline kernel.

Looking forward to your thoughts.

Mit freundlichen Grüßen / Best regards

 Selvakumar Kalimuthu

responsible for Platform 1 projects (MS/ECF1-XC)
Robert Bosch GmbH | Postfach 10 60 50 | 70049 Stuttgart | GERMANY | www.bosch.com
Fax +91 422 667-1208 | Selvakumar.Kalimuthu@in.bosch.com

Registered Office: Stuttgart, Registration Court: Amtsgericht Stuttgart, HRB 14000;
Chairman of the Supervisory Board: Prof. Dr. Stefan Asenkerschbaumer; 
Managing Directors: Dr. Stefan Hartung, Dr. Christian Fischer, Dr. Markus Forschner, 
Stefan Grosch, Dr. Markus Heyn, Dr. Frank Meyer, Katja von Raven, Dr. Tanja Rückert

-----Original Message-----
From: Avri Altman <Avri.Altman@sandisk.com> 
Sent: Friday, March 28, 2025 12:36 PM
To: Selvakumar Kalimuthu (MS/ECC-CF3-XC) <selvakumar.kalimuthu@in.bosch.com>; Bart Van Assche <bvanassche@acm.org>; Alim Akhtar <alim.akhtar@samsung.com>; Avri Altman <avri.altman@wdc.com>; James E.J. Bottomley <jejb@linux.ibm.com>; Martin K. Petersen <martin.petersen@oracle.com>; Peter Wang <peter.wang@mediatek.com>; Manjunatha Madana <quic_c_mamanj@quicinc.com>
Cc: Antony A (MS/ECC-CF-EP2-XC) <Antony.Ambrose@in.bosch.com>; linux-scsi@vger.kernel.org
Subject: RE: [PATCH v1 1/1] ufs: core: Export interface for sending raw UPIU commands

> Hi Bart,
> 
> Thanks for your feedback.
> 
> The caller for this exported function resides in an 
> OEM/vendor-specific module, which is not part of the standard Linux 
> kernel. The intent of this patch is to provide an interface that 
> allows vendors to send raw UPIU commands from their external modules 
> to retrieve device-specific information or execute proprietary commands.
The ufs spec defines a wide range of vendor specific query commands: 0x40-0x7F, and 0xC0-0xFF.
For those you can use the current caller, e.g. ufs-bsg module?

Thanks,
Avri

> Since vendor modules cannot modify the UFS core driver directly, 
> exporting ufshcd_exec_raw_upiu_cmd is necessary to enable controlled 
> access without modifying the mainline kernel further.
> 
> Would you prefer that we also provide an example of a vendor module 
> using this export, even though it won't be part of the upstream 
> kernel? Or is there a preferred approach to enable vendor-specific 
> extensions without modifying the standard kernel UFS driver?
> 
> Looking forward to your guidance.
> 
> Mit freundlichen Grüßen / Best regards
> 
> Selvakumar  Kalimuthu
> 
> responsible for Platform 1 projects (MS/ECF1-XC) Robert Bosch GmbH | 
> Postfach 10 60 50 | 70049 Stuttgart | GERMANY | www.bosch.com Fax +91
> 422 667-1208 | Selvakumar.Kalimuthu@in.bosch.com
> 
> Registered Office: Stuttgart, Registration Court: Amtsgericht 
> Stuttgart, HRB 14000; Chairman of the Supervisory Board: Prof. Dr. 
> Stefan Asenkerschbaumer; Managing Directors: Dr. Stefan Hartung, Dr. 
> Christian Fischer, Dr. Markus Forschner, Stefan Grosch, Dr. Markus 
> Heyn, Dr. Frank Meyer, Katja von Raven, Dr. Tanja Rückert
> 
> -----Original Message-----
> From: Bart Van Assche <bvanassche@acm.org>
> Sent: Thursday, March 27, 2025 5:28 PM
> To: Selvakumar Kalimuthu (MS/ECC-CF3-XC) 
> <selvakumar.kalimuthu@in.bosch.com>; Alim Akhtar 
> <alim.akhtar@samsung.com>; Avri Altman <avri.altman@wdc.com>; James 
> E.J. Bottomley <jejb@linux.ibm.com>; Martin K. Petersen 
> <martin.petersen@oracle.com>; Peter Wang <peter.wang@mediatek.com>; 
> Manjunatha Madana <quic_c_mamanj@quicinc.com>
> Cc: Antony A (MS/ECC-CF-EP2-XC) <Antony.Ambrose@in.bosch.com>; linux- 
> scsi@vger.kernel.org
> Subject: Re: [PATCH v1 1/1] ufs: core: Export interface for sending 
> raw UPIU commands
> 
> On 3/27/25 7:46 AM, Selvakumar Kalimuthu wrote:
> > diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c 
> > index 78b57e946cdf..226cc90c74b0 100644
> > --- a/drivers/ufs/core/ufshcd.c
> > +++ b/drivers/ufs/core/ufshcd.c
> > @@ -7360,6 +7360,7 @@ int ufshcd_exec_raw_upiu_cmd(struct ufs_hba 
> > *hba,
> >
> >   	return err;
> >   }
> > +EXPORT_SYMBOL_GPL(ufshcd_exec_raw_upiu_cmd);
> 
> As I already mentioned off-list, please do not export functions 
> without adding a caller that needs the export.
> 
> Thanks,
> 
> Bart.
Avri Altman March 28, 2025, 1:04 p.m. UTC | #4
> Hi Avri,
> 
> Thank you for your insights.
> 
> We understand that vendor-specific query commands can be sent using the
> ufs-bsg module. However, there are a couple of challenges:
> 
> * Some vendor-specific commands use unique msgcode values that may not
> be handled efficiently through the existing ufs-bsg framework.
ufshcd_exec_raw_upiu_cmd only supports a subset of the message codes supported by ufs-bsg.

> * In the Android system, access to ufs-bsg is restricted, and not all processes
> can communicate with it, making it difficult to use for vendor-specific
> extensions.
by 'restricted' you mean privileged?
I don't think that allowing non-privileged access is a good idea.

Thanks,
Avri
> 
> Given these constraints, exporting ufshcd_exec_raw_upiu_cmd provides a
> more flexible solution for vendor modules to execute necessary commands
> without modifying the mainline kernel.
> 
> Looking forward to your thoughts.
> 
> Mit freundlichen Grüßen / Best regards
> 
>  Selvakumar Kalimuthu
> 
> responsible for Platform 1 projects (MS/ECF1-XC) Robert Bosch GmbH |
> Postfach 10 60 50 | 70049 Stuttgart | GERMANY | www.bosch.com Fax +91
> 422 667-1208 | Selvakumar.Kalimuthu@in.bosch.com
> 
> Registered Office: Stuttgart, Registration Court: Amtsgericht Stuttgart, HRB
> 14000; Chairman of the Supervisory Board: Prof. Dr. Stefan
> Asenkerschbaumer; Managing Directors: Dr. Stefan Hartung, Dr. Christian
> Fischer, Dr. Markus Forschner, Stefan Grosch, Dr. Markus Heyn, Dr. Frank
> Meyer, Katja von Raven, Dr. Tanja Rückert
> 
> -----Original Message-----
> From: Avri Altman <Avri.Altman@sandisk.com>
> Sent: Friday, March 28, 2025 12:36 PM
> To: Selvakumar Kalimuthu (MS/ECC-CF3-XC)
> <selvakumar.kalimuthu@in.bosch.com>; Bart Van Assche
> <bvanassche@acm.org>; Alim Akhtar <alim.akhtar@samsung.com>; Avri
> Altman <avri.altman@wdc.com>; James E.J. Bottomley
> <jejb@linux.ibm.com>; Martin K. Petersen <martin.petersen@oracle.com>;
> Peter Wang <peter.wang@mediatek.com>; Manjunatha Madana
> <quic_c_mamanj@quicinc.com>
> Cc: Antony A (MS/ECC-CF-EP2-XC) <Antony.Ambrose@in.bosch.com>; linux-
> scsi@vger.kernel.org
> Subject: RE: [PATCH v1 1/1] ufs: core: Export interface for sending raw UPIU
> commands
> 
> > Hi Bart,
> >
> > Thanks for your feedback.
> >
> > The caller for this exported function resides in an
> > OEM/vendor-specific module, which is not part of the standard Linux
> > kernel. The intent of this patch is to provide an interface that
> > allows vendors to send raw UPIU commands from their external modules
> > to retrieve device-specific information or execute proprietary commands.
> The ufs spec defines a wide range of vendor specific query commands: 0x40-
> 0x7F, and 0xC0-0xFF.
> For those you can use the current caller, e.g. ufs-bsg module?
> 
> Thanks,
> Avri
> 
> > Since vendor modules cannot modify the UFS core driver directly,
> > exporting ufshcd_exec_raw_upiu_cmd is necessary to enable controlled
> > access without modifying the mainline kernel further.
> >
> > Would you prefer that we also provide an example of a vendor module
> > using this export, even though it won't be part of the upstream
> > kernel? Or is there a preferred approach to enable vendor-specific
> > extensions without modifying the standard kernel UFS driver?
> >
> > Looking forward to your guidance.
> >
> > Mit freundlichen Grüßen / Best regards
> >
> > Selvakumar  Kalimuthu
> >
> > responsible for Platform 1 projects (MS/ECF1-XC) Robert Bosch GmbH |
> > Postfach 10 60 50 | 70049 Stuttgart | GERMANY | www.bosch.com Fax +91
> > 422 667-1208 | Selvakumar.Kalimuthu@in.bosch.com
> >
> > Registered Office: Stuttgart, Registration Court: Amtsgericht
> > Stuttgart, HRB 14000; Chairman of the Supervisory Board: Prof. Dr.
> > Stefan Asenkerschbaumer; Managing Directors: Dr. Stefan Hartung, Dr.
> > Christian Fischer, Dr. Markus Forschner, Stefan Grosch, Dr. Markus
> > Heyn, Dr. Frank Meyer, Katja von Raven, Dr. Tanja Rückert
> >
> > -----Original Message-----
> > From: Bart Van Assche <bvanassche@acm.org>
> > Sent: Thursday, March 27, 2025 5:28 PM
> > To: Selvakumar Kalimuthu (MS/ECC-CF3-XC)
> > <selvakumar.kalimuthu@in.bosch.com>; Alim Akhtar
> > <alim.akhtar@samsung.com>; Avri Altman <avri.altman@wdc.com>; James
> > E.J. Bottomley <jejb@linux.ibm.com>; Martin K. Petersen
> > <martin.petersen@oracle.com>; Peter Wang <peter.wang@mediatek.com>;
> > Manjunatha Madana <quic_c_mamanj@quicinc.com>
> > Cc: Antony A (MS/ECC-CF-EP2-XC) <Antony.Ambrose@in.bosch.com>;
> linux-
> > scsi@vger.kernel.org
> > Subject: Re: [PATCH v1 1/1] ufs: core: Export interface for sending
> > raw UPIU commands
> >
> > On 3/27/25 7:46 AM, Selvakumar Kalimuthu wrote:
> > > diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> > > index 78b57e946cdf..226cc90c74b0 100644
> > > --- a/drivers/ufs/core/ufshcd.c
> > > +++ b/drivers/ufs/core/ufshcd.c
> > > @@ -7360,6 +7360,7 @@ int ufshcd_exec_raw_upiu_cmd(struct ufs_hba
> > > *hba,
> > >
> > >   	return err;
> > >   }
> > > +EXPORT_SYMBOL_GPL(ufshcd_exec_raw_upiu_cmd);
> >
> > As I already mentioned off-list, please do not export functions
> > without adding a caller that needs the export.
> >
> > Thanks,
> >
> > Bart.