linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] serial: uartlite: Use dynamic allocation for major number
@ 2023-11-09 12:36 Manikanta Guntupalli
  2023-11-09 13:20 ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Manikanta Guntupalli @ 2023-11-09 12:36 UTC (permalink / raw)
  To: git, michal.simek, jacmet, gregkh, jirislaby, linux-serial,
	linux-kernel
  Cc: radhey.shyam.pandey, srinivas.goud, shubhrajyoti.datta,
	manion05gk, Manikanta Guntupalli

Device number 204 has a range of minors on major number.
uart_register_driver is failing due to lack of minor numbers
when more number of uart ports used. So, use dynamic allocation
for major number to avoid minor number limitation on 204 major
number.

https://docs.kernel.org/arch/arm/sa1100/serial_uart.html

Signed-off-by: Manikanta Guntupalli <manikanta.guntupalli@amd.com>
---
 drivers/tty/serial/uartlite.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c
index 404c14acafa5..c80ed0373b44 100644
--- a/drivers/tty/serial/uartlite.c
+++ b/drivers/tty/serial/uartlite.c
@@ -24,8 +24,8 @@
 #include <linux/pm_runtime.h>
 
 #define ULITE_NAME		"ttyUL"
-#define ULITE_MAJOR		204
-#define ULITE_MINOR		187
+#define ULITE_MAJOR		0	/* use dynamic node allocation */
+#define ULITE_MINOR		0
 #define ULITE_NR_UARTS		CONFIG_SERIAL_UARTLITE_NR_UARTS
 
 /* ---------------------------------------------------------------------
-- 
2.25.1


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

* Re: [PATCH] serial: uartlite: Use dynamic allocation for major number
  2023-11-09 12:36 [PATCH] serial: uartlite: Use dynamic allocation for major number Manikanta Guntupalli
@ 2023-11-09 13:20 ` Greg KH
  2023-11-10  9:28   ` Guntupalli, Manikanta
  0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2023-11-09 13:20 UTC (permalink / raw)
  To: Manikanta Guntupalli
  Cc: git, michal.simek, jacmet, jirislaby, linux-serial, linux-kernel,
	radhey.shyam.pandey, srinivas.goud, shubhrajyoti.datta,
	manion05gk

On Thu, Nov 09, 2023 at 06:06:40PM +0530, Manikanta Guntupalli wrote:
> Device number 204 has a range of minors on major number.
> uart_register_driver is failing due to lack of minor numbers
> when more number of uart ports used.

So you need more than the 4 allocated to you?

> So, use dynamic allocation
> for major number to avoid minor number limitation on 204 major
> number.
> 
> https://docs.kernel.org/arch/arm/sa1100/serial_uart.html

What does this break by doing this?

Also, you forgot to update the documentation :(

And how was this tested?  What about older systems with static device
nodes, are you sure none are out there for this old hardware anymore?

thanks,

greg k-h

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

* RE: [PATCH] serial: uartlite: Use dynamic allocation for major number
  2023-11-09 13:20 ` Greg KH
@ 2023-11-10  9:28   ` Guntupalli, Manikanta
  2023-11-10 10:55     ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Guntupalli, Manikanta @ 2023-11-10  9:28 UTC (permalink / raw)
  To: Greg KH
  Cc: git (AMD-Xilinx), Simek, Michal, jacmet@sunsite.dk,
	jirislaby@kernel.org, linux-serial@vger.kernel.org,
	linux-kernel@vger.kernel.org, Pandey, Radhey Shyam,
	Goud, Srinivas, Datta, Shubhrajyoti, manion05gk@gmail.com

Hi Greg,

> -----Original Message-----
> From: Greg KH <gregkh@linuxfoundation.org>
> Sent: Thursday, November 9, 2023 6:50 PM
> To: Guntupalli, Manikanta <manikanta.guntupalli@amd.com>
> Cc: git (AMD-Xilinx) <git@amd.com>; Simek, Michal
> <michal.simek@amd.com>; jacmet@sunsite.dk; jirislaby@kernel.org; linux-
> serial@vger.kernel.org; linux-kernel@vger.kernel.org; Pandey, Radhey Shyam
> <radhey.shyam.pandey@amd.com>; Goud, Srinivas
> <srinivas.goud@amd.com>; Datta, Shubhrajyoti
> <shubhrajyoti.datta@amd.com>; manion05gk@gmail.com
> Subject: Re: [PATCH] serial: uartlite: Use dynamic allocation for major number
> 
> On Thu, Nov 09, 2023 at 06:06:40PM +0530, Manikanta Guntupalli wrote:
> > Device number 204 has a range of minors on major number.
> > uart_register_driver is failing due to lack of minor numbers when more
> > number of uart ports used.
> 
> So you need more than the 4 allocated to you?
Yes, we have a customer who has 32 uartlite instances in his board.
> 
> > So, use dynamic allocation
> > for major number to avoid minor number limitation on 204 major number.
> >
> > https://docs.kernel.org/arch/arm/sa1100/serial_uart.html
> 
> What does this break by doing this?
uart_register_driver() is failing due to lack of minor numbers when the customer
has 32 uartlite instances in his board.
> 
> Also, you forgot to update the documentation :(
We will update the documentation.
> 
> And how was this tested?  
We tested on both ZCU106 AMD/Xilinx evaluation board with 32 uartlite instances with customer design.

>What about older systems with static device nodes,
> are you sure none are out there for this old hardware anymore?
Shall we use below approach to support both legacy hardware and hardware with more number of uartlite instances use case. Please suggest.
diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c
index 404c14acafa5..517f1f34143d 100644
--- a/drivers/tty/serial/uartlite.c
+++ b/drivers/tty/serial/uartlite.c
@@ -24,8 +24,13 @@
 #include <linux/pm_runtime.h>
 
 #define ULITE_NAME             "ttyUL"
+#if (CONFIG_SERIAL_UARTLITE_NR_UARTS > 4)
+#define ULITE_MAJOR             0       /* use dynamic node allocation */
+#define ULITE_MINOR             0
+#else
 #define ULITE_MAJOR            204
 #define ULITE_MINOR            187
+#endif
 #define ULITE_NR_UARTS         CONFIG_SERIAL_UARTLITE_NR_UARTS


Thanks,
Manikanta.


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

* Re: [PATCH] serial: uartlite: Use dynamic allocation for major number
  2023-11-10  9:28   ` Guntupalli, Manikanta
@ 2023-11-10 10:55     ` Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2023-11-10 10:55 UTC (permalink / raw)
  To: Guntupalli, Manikanta
  Cc: git (AMD-Xilinx), Simek, Michal, jacmet@sunsite.dk,
	jirislaby@kernel.org, linux-serial@vger.kernel.org,
	linux-kernel@vger.kernel.org, Pandey, Radhey Shyam,
	Goud, Srinivas, Datta, Shubhrajyoti, manion05gk@gmail.com

On Fri, Nov 10, 2023 at 09:28:40AM +0000, Guntupalli, Manikanta wrote:
> Hi Greg,
> 
> > -----Original Message-----
> > From: Greg KH <gregkh@linuxfoundation.org>
> > Sent: Thursday, November 9, 2023 6:50 PM
> > To: Guntupalli, Manikanta <manikanta.guntupalli@amd.com>
> > Cc: git (AMD-Xilinx) <git@amd.com>; Simek, Michal
> > <michal.simek@amd.com>; jacmet@sunsite.dk; jirislaby@kernel.org; linux-
> > serial@vger.kernel.org; linux-kernel@vger.kernel.org; Pandey, Radhey Shyam
> > <radhey.shyam.pandey@amd.com>; Goud, Srinivas
> > <srinivas.goud@amd.com>; Datta, Shubhrajyoti
> > <shubhrajyoti.datta@amd.com>; manion05gk@gmail.com
> > Subject: Re: [PATCH] serial: uartlite: Use dynamic allocation for major number
> > 
> > On Thu, Nov 09, 2023 at 06:06:40PM +0530, Manikanta Guntupalli wrote:
> > > Device number 204 has a range of minors on major number.
> > > uart_register_driver is failing due to lack of minor numbers when more
> > > number of uart ports used.
> > 
> > So you need more than the 4 allocated to you?
> Yes, we have a customer who has 32 uartlite instances in his board.
> > 
> > > So, use dynamic allocation
> > > for major number to avoid minor number limitation on 204 major number.
> > >
> > > https://docs.kernel.org/arch/arm/sa1100/serial_uart.html
> > 
> > What does this break by doing this?
> uart_register_driver() is failing due to lack of minor numbers when the customer
> has 32 uartlite instances in his board.
> > 
> > Also, you forgot to update the documentation :(
> We will update the documentation.
> > 
> > And how was this tested?  
> We tested on both ZCU106 AMD/Xilinx evaluation board with 32 uartlite instances with customer design.
> 
> >What about older systems with static device nodes,
> > are you sure none are out there for this old hardware anymore?
> Shall we use below approach to support both legacy hardware and hardware with more number of uartlite instances use case. Please suggest.

Yes, that looks much better, also update the Kconfig entry for
CONFIG_SERIAL_UARTLITE_NR_UARTS as well so that people know the
major/minor will be dynamic and will not be the other entry if they ask
for over 4.

thanks,

greg k-h

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

end of thread, other threads:[~2023-11-10 17:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-09 12:36 [PATCH] serial: uartlite: Use dynamic allocation for major number Manikanta Guntupalli
2023-11-09 13:20 ` Greg KH
2023-11-10  9:28   ` Guntupalli, Manikanta
2023-11-10 10:55     ` Greg KH

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