* [PATCH 1/1] tty: serial: uartlite: allow 64 bit address
@ 2021-11-23 18:45 Lizhi Hou
2021-11-23 18:59 ` Greg KH
0 siblings, 1 reply; 5+ messages in thread
From: Lizhi Hou @ 2021-11-23 18:45 UTC (permalink / raw)
To: linux-kernel, linux-serial, gregkh, jacmet; +Cc: Lizhi Hou
Fix the uartlite probe failure when it is mapped to address above 4G.
Signed-off-by: Lizhi Hou <lizhi.hou@xilinx.com>
---
drivers/tty/serial/uartlite.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c
index d3d9566e5dbd..e1fa52d31474 100644
--- a/drivers/tty/serial/uartlite.c
+++ b/drivers/tty/serial/uartlite.c
@@ -626,7 +626,7 @@ static struct uart_driver ulite_uart_driver = {
*
* Returns: 0 on success, <0 otherwise
*/
-static int ulite_assign(struct device *dev, int id, u32 base, int irq,
+static int ulite_assign(struct device *dev, int id, phys_addr_t base, int irq,
struct uartlite_data *pdata)
{
struct uart_port *port;
--
2.27.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] tty: serial: uartlite: allow 64 bit address
2021-11-23 18:45 [PATCH 1/1] tty: serial: uartlite: allow 64 bit address Lizhi Hou
@ 2021-11-23 18:59 ` Greg KH
2021-11-23 20:12 ` Lizhi Hou
0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2021-11-23 18:59 UTC (permalink / raw)
To: Lizhi Hou; +Cc: linux-kernel, linux-serial, jacmet
On Tue, Nov 23, 2021 at 10:45:06AM -0800, Lizhi Hou wrote:
> Fix the uartlite probe failure when it is mapped to address above 4G.
Fix it how?
> Signed-off-by: Lizhi Hou <lizhi.hou@xilinx.com>
What commit caused this problem? What commit does this fix? Should it
go to stable kernels?
> ---
> drivers/tty/serial/uartlite.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c
> index d3d9566e5dbd..e1fa52d31474 100644
> --- a/drivers/tty/serial/uartlite.c
> +++ b/drivers/tty/serial/uartlite.c
> @@ -626,7 +626,7 @@ static struct uart_driver ulite_uart_driver = {
> *
> * Returns: 0 on success, <0 otherwise
> */
> -static int ulite_assign(struct device *dev, int id, u32 base, int irq,
> +static int ulite_assign(struct device *dev, int id, phys_addr_t base, int irq,
> struct uartlite_data *pdata)
So you changed the variable type which does what exactly here?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] tty: serial: uartlite: allow 64 bit address
2021-11-23 18:59 ` Greg KH
@ 2021-11-23 20:12 ` Lizhi Hou
2021-11-24 8:13 ` Greg KH
0 siblings, 1 reply; 5+ messages in thread
From: Lizhi Hou @ 2021-11-23 20:12 UTC (permalink / raw)
To: Greg KH, Lizhi Hou; +Cc: linux-kernel, linux-serial, jacmet
On 11/23/21 10:59 AM, Greg KH wrote:
>
> On Tue, Nov 23, 2021 at 10:45:06AM -0800, Lizhi Hou wrote:
>> Fix the uartlite probe failure when it is mapped to address above 4G.
> Fix it how?
Does this detail comment look ok to you?
The base address of uartlite registers could be 64 bit address which is
from device resource. When ulite_probe() calls ulite_assign(), this 64
bit address is casted to 32-bit. The fix is to replace "u32" type with
"phys_addr_t" type for the base address in ulite_assign() argument list.
>
>> Signed-off-by: Lizhi Hou <lizhi.hou@xilinx.com>
> What commit caused this problem? What commit does this fix? Should it
> go to stable kernels?
I searched the history. This problem was introduced by
https://github.com/torvalds/linux/commit/8fa7b6100693e0b648ffd34564f6f41226502a19
And yes, I agree this should go to stable kernels. I will add
stable@vger.kernel.org to cc list.
>
>> ---
>> drivers/tty/serial/uartlite.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c
>> index d3d9566e5dbd..e1fa52d31474 100644
>> --- a/drivers/tty/serial/uartlite.c
>> +++ b/drivers/tty/serial/uartlite.c
>> @@ -626,7 +626,7 @@ static struct uart_driver ulite_uart_driver = {
>> *
>> * Returns: 0 on success, <0 otherwise
>> */
>> -static int ulite_assign(struct device *dev, int id, u32 base, int irq,
>> +static int ulite_assign(struct device *dev, int id, phys_addr_t base, int irq,
>> struct uartlite_data *pdata)
> So you changed the variable type which does what exactly here?
ulite_probe()
-> ulite_assign(&pdev->dev, id, res->start, irq, pdata)
^^^^^^ could be
64-bit address. Thus "u32 base" may lose the high 32-bit.
Hopefully this makes sense to you. And I can re-submit an updated patch.
Thanks,
Lizhi
>
> thanks,
>
> greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] tty: serial: uartlite: allow 64 bit address
2021-11-23 20:12 ` Lizhi Hou
@ 2021-11-24 8:13 ` Greg KH
0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2021-11-24 8:13 UTC (permalink / raw)
To: Lizhi Hou; +Cc: linux-kernel, linux-serial, jacmet
On Tue, Nov 23, 2021 at 12:12:06PM -0800, Lizhi Hou wrote:
>
> On 11/23/21 10:59 AM, Greg KH wrote:
> >
> > On Tue, Nov 23, 2021 at 10:45:06AM -0800, Lizhi Hou wrote:
> > > Fix the uartlite probe failure when it is mapped to address above 4G.
> > Fix it how?
>
> Does this detail comment look ok to you?
>
> The base address of uartlite registers could be 64 bit address which is from
> device resource. When ulite_probe() calls ulite_assign(), this 64 bit
> address is casted to 32-bit. The fix is to replace "u32" type with
> "phys_addr_t" type for the base address in ulite_assign() argument list.
Much better.
> >
> > > Signed-off-by: Lizhi Hou <lizhi.hou@xilinx.com>
> > What commit caused this problem? What commit does this fix? Should it
> > go to stable kernels?
>
> I searched the history. This problem was introduced by https://github.com/torvalds/linux/commit/8fa7b6100693e0b648ffd34564f6f41226502a19
>
> And yes, I agree this should go to stable kernels. I will add
> stable@vger.kernel.org to cc list.
Thank you, please add a Fixes: tag to the patch as well when you
resubmit it.
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/1] tty: serial: uartlite: allow 64 bit address
@ 2021-11-29 20:23 Lizhi Hou
0 siblings, 0 replies; 5+ messages in thread
From: Lizhi Hou @ 2021-11-29 20:23 UTC (permalink / raw)
To: linux-kernel, linux-serial, gregkh, jacmet; +Cc: Lizhi Hou, stable
The base address of uartlite registers could be 64 bit address which is from
device resource. When ulite_probe() calls ulite_assign(), this 64 bit
address is casted to 32-bit. The fix is to replace "u32" type with
"phys_addr_t" type for the base address in ulite_assign() argument list.
Fixes: 8fa7b6100693 ("[POWERPC] Uartlite: Separate the bus binding from the driver proper")
Signed-off-by: Lizhi Hou <lizhi.hou@xilinx.com>
---
drivers/tty/serial/uartlite.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c
index d3d9566e5dbd..e1fa52d31474 100644
--- a/drivers/tty/serial/uartlite.c
+++ b/drivers/tty/serial/uartlite.c
@@ -626,7 +626,7 @@ static struct uart_driver ulite_uart_driver = {
*
* Returns: 0 on success, <0 otherwise
*/
-static int ulite_assign(struct device *dev, int id, u32 base, int irq,
+static int ulite_assign(struct device *dev, int id, phys_addr_t base, int irq,
struct uartlite_data *pdata)
{
struct uart_port *port;
--
2.27.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-11-29 20:28 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-23 18:45 [PATCH 1/1] tty: serial: uartlite: allow 64 bit address Lizhi Hou
2021-11-23 18:59 ` Greg KH
2021-11-23 20:12 ` Lizhi Hou
2021-11-24 8:13 ` Greg KH
2021-11-29 20:23 Lizhi Hou
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).