All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xen-devel] [PATCH] ns16550: Re-order the serial port address checking
@ 2020-02-24 11:30 Wei Xu
  2020-02-24 22:03 ` Julien Grall
  0 siblings, 1 reply; 5+ messages in thread
From: Wei Xu @ 2020-02-24 11:30 UTC (permalink / raw)
  To: xen-devel
  Cc: Stefano Stabellini, Julien Grall, Zengtao (B),
	Wei Liu, Konrad Rzeszutek Wilk, George Dunlap, Andrew Cooper,
	Ian Jackson, Linuxarm, xuwei5, Shameerali Kolothum Thodi,
	Jan Beulich

Check the serial port address space before checking the address.

Signed-off-by: Wei Xu <xuwei5@hisilicon.com>
---
 xen/drivers/char/ns16550.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c
index dc8ac4c..425e044 100644
--- a/xen/drivers/char/ns16550.c
+++ b/xen/drivers/char/ns16550.c
@@ -1644,6 +1644,12 @@ static int __init ns16550_acpi_uart_init(const void *data)

     spcr = container_of(table, struct acpi_table_spcr, header);

+    if ( unlikely(spcr->serial_port.space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) )
+    {
+        printk("ns16550: Address space type is not mmio\n");
+        return -EINVAL;
+    }
+
     /*
      * The serial port address may be 0 for example
      * if the console redirection is disabled.
@@ -1654,12 +1660,6 @@ static int __init ns16550_acpi_uart_init(const void *data)
         return -EINVAL;
     }

-    if ( unlikely(spcr->serial_port.space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) )
-    {
-        printk("ns16550: Address space type is not mmio\n");
-        return -EINVAL;
-    }
-
     ns16550_init_common(uart);

     /*
-- 
2.8.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [Xen-devel] [PATCH] ns16550: Re-order the serial port address checking
  2020-02-24 11:30 [Xen-devel] [PATCH] ns16550: Re-order the serial port address checking Wei Xu
@ 2020-02-24 22:03 ` Julien Grall
  2020-02-25  0:33   ` Wei Xu
  0 siblings, 1 reply; 5+ messages in thread
From: Julien Grall @ 2020-02-24 22:03 UTC (permalink / raw)
  To: Wei Xu, xen-devel
  Cc: Stefano Stabellini, Zengtao (B),
	Wei Liu, Konrad Rzeszutek Wilk, George Dunlap, Andrew Cooper,
	Ian Jackson, Linuxarm, Shameerali Kolothum Thodi, Jan Beulich

Hi Wei,

Thank you for sending a follow-up.

On 24/02/2020 11:30, Wei Xu wrote:
> Check the serial port address space before checking the address.

Could you explain in a sentence why you want to re-order?

Cheers,

> 
> Signed-off-by: Wei Xu <xuwei5@hisilicon.com>
> ---
>   xen/drivers/char/ns16550.c | 12 ++++++------
>   1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c
> index dc8ac4c..425e044 100644
> --- a/xen/drivers/char/ns16550.c
> +++ b/xen/drivers/char/ns16550.c
> @@ -1644,6 +1644,12 @@ static int __init ns16550_acpi_uart_init(const void *data)
> 
>       spcr = container_of(table, struct acpi_table_spcr, header);
> 
> +    if ( unlikely(spcr->serial_port.space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) )
> +    {
> +        printk("ns16550: Address space type is not mmio\n");
> +        return -EINVAL;
> +    }
> +
>       /*
>        * The serial port address may be 0 for example
>        * if the console redirection is disabled.
> @@ -1654,12 +1660,6 @@ static int __init ns16550_acpi_uart_init(const void *data)
>           return -EINVAL;
>       }
> 
> -    if ( unlikely(spcr->serial_port.space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) )
> -    {
> -        printk("ns16550: Address space type is not mmio\n");
> -        return -EINVAL;
> -    }
> -
>       ns16550_init_common(uart);
> 
>       /*
> 

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [Xen-devel] [PATCH] ns16550: Re-order the serial port address checking
  2020-02-24 22:03 ` Julien Grall
@ 2020-02-25  0:33   ` Wei Xu
  2020-02-25 13:10     ` Jan Beulich
  0 siblings, 1 reply; 5+ messages in thread
From: Wei Xu @ 2020-02-25  0:33 UTC (permalink / raw)
  To: Julien Grall, xen-devel
  Cc: Stefano Stabellini, Zengtao (B),
	Wei Liu, Konrad Rzeszutek Wilk, George Dunlap, Andrew Cooper,
	Ian Jackson, Linuxarm, Shameerali Kolothum Thodi, Jan Beulich

Hi Julien,

On 2020/2/25 6:03, Julien Grall wrote:
> Hi Wei,
> 
> Thank you for sending a follow-up.
> 
> On 24/02/2020 11:30, Wei Xu wrote:
>> Check the serial port address space before checking the address.
> 
> Could you explain in a sentence why you want to re-order?

Do you think is it OK to explain as following:

The serial port address space ID qualifies the address.
Whether a value of zero for the serial port address can sensibly
mean "disabled" depends on the address space ID. Hence check the
address space ID before checking the address.

Thanks!

Best Regards,
Wei

> 
> Cheers,
> 
>>
>> Signed-off-by: Wei Xu <xuwei5@hisilicon.com>
>> ---
>>   xen/drivers/char/ns16550.c | 12 ++++++------
>>   1 file changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c
>> index dc8ac4c..425e044 100644
>> --- a/xen/drivers/char/ns16550.c
>> +++ b/xen/drivers/char/ns16550.c
>> @@ -1644,6 +1644,12 @@ static int __init ns16550_acpi_uart_init(const void *data)
>>
>>       spcr = container_of(table, struct acpi_table_spcr, header);
>>
>> +    if ( unlikely(spcr->serial_port.space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) )
>> +    {
>> +        printk("ns16550: Address space type is not mmio\n");
>> +        return -EINVAL;
>> +    }
>> +
>>       /*
>>        * The serial port address may be 0 for example
>>        * if the console redirection is disabled.
>> @@ -1654,12 +1660,6 @@ static int __init ns16550_acpi_uart_init(const void *data)
>>           return -EINVAL;
>>       }
>>
>> -    if ( unlikely(spcr->serial_port.space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) )
>> -    {
>> -        printk("ns16550: Address space type is not mmio\n");
>> -        return -EINVAL;
>> -    }
>> -
>>       ns16550_init_common(uart);
>>
>>       /*
>>
> 


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [Xen-devel] [PATCH] ns16550: Re-order the serial port address checking
  2020-02-25  0:33   ` Wei Xu
@ 2020-02-25 13:10     ` Jan Beulich
  2020-02-26  0:41       ` Wei Xu
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Beulich @ 2020-02-25 13:10 UTC (permalink / raw)
  To: Wei Xu
  Cc: Stefano Stabellini, Julien Grall, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Ian Jackson, Linuxarm,
	Shameerali Kolothum Thodi, Zengtao (B),
	xen-devel

On 25.02.2020 01:33, Wei Xu wrote:
> On 2020/2/25 6:03, Julien Grall wrote:
>> Thank you for sending a follow-up.
>>
>> On 24/02/2020 11:30, Wei Xu wrote:
>>> Check the serial port address space before checking the address.
>>
>> Could you explain in a sentence why you want to re-order?
> 
> Do you think is it OK to explain as following:
> 
> The serial port address space ID qualifies the address.
> Whether a value of zero for the serial port address can sensibly
> mean "disabled" depends on the address space ID. Hence check the
> address space ID before checking the address.

With this description ...

>>> Signed-off-by: Wei Xu <xuwei5@hisilicon.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>

And I'm sorry for having forgotten to switch these around
while committing your earlier patch.

Jan

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [Xen-devel] [PATCH] ns16550: Re-order the serial port address checking
  2020-02-25 13:10     ` Jan Beulich
@ 2020-02-26  0:41       ` Wei Xu
  0 siblings, 0 replies; 5+ messages in thread
From: Wei Xu @ 2020-02-26  0:41 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Stefano Stabellini, Julien Grall, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Ian Jackson, Linuxarm,
	Shameerali Kolothum Thodi, Zengtao (B),
	xen-devel

Hi Jan,

On 2020/2/25 21:10, Jan Beulich wrote:
> On 25.02.2020 01:33, Wei Xu wrote:
>> On 2020/2/25 6:03, Julien Grall wrote:
>>> Thank you for sending a follow-up.
>>>
>>> On 24/02/2020 11:30, Wei Xu wrote:
>>>> Check the serial port address space before checking the address.
>>>
>>> Could you explain in a sentence why you want to re-order?
>>
>> Do you think is it OK to explain as following:
>>
>> The serial port address space ID qualifies the address.
>> Whether a value of zero for the serial port address can sensibly
>> mean "disabled" depends on the address space ID. Hence check the
>> address space ID before checking the address.
> 
> With this description ...
> 
>>>> Signed-off-by: Wei Xu <xuwei5@hisilicon.com>
> 
> Reviewed-by: Jan Beulich <jbeulich@suse.com>

Thanks!

Best Regards,
Wei

> 
> And I'm sorry for having forgotten to switch these around
> while committing your earlier patch.
> 
> Jan
> 
> .
> 


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

end of thread, other threads:[~2020-02-26  0:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-24 11:30 [Xen-devel] [PATCH] ns16550: Re-order the serial port address checking Wei Xu
2020-02-24 22:03 ` Julien Grall
2020-02-25  0:33   ` Wei Xu
2020-02-25 13:10     ` Jan Beulich
2020-02-26  0:41       ` Wei Xu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.