qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] linux-user: Replace __u64 with uint64_t
@ 2021-11-08 19:42 Khem Raj
  2021-11-09  9:09 ` Philippe Mathieu-Daudé
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Khem Raj @ 2021-11-08 19:42 UTC (permalink / raw)
  To: qemu-devel; +Cc: Khem Raj

uint64_t is available in all userspaces via compiler include stdint.h
therefore use it instead of __u64 which is linux internal type, it fixes
build on some platforms eg. aarch64 systems using musl C library

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 linux-user/host/aarch64/hostdep.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/linux-user/host/aarch64/hostdep.h b/linux-user/host/aarch64/hostdep.h
index a8d41a21ad..34d934f665 100644
--- a/linux-user/host/aarch64/hostdep.h
+++ b/linux-user/host/aarch64/hostdep.h
@@ -25,7 +25,7 @@ extern char safe_syscall_end[];
 static inline void rewind_if_in_safe_syscall(void *puc)
 {
     ucontext_t *uc = puc;
-    __u64 *pcreg = &uc->uc_mcontext.pc;
+    uint64_t *pcreg = &uc->uc_mcontext.pc;
 
     if (*pcreg > (uintptr_t)safe_syscall_start
         && *pcreg < (uintptr_t)safe_syscall_end) {
-- 
2.33.1



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

* Re: [PATCH] linux-user: Replace __u64 with uint64_t
  2021-11-08 19:42 [PATCH] linux-user: Replace __u64 with uint64_t Khem Raj
@ 2021-11-09  9:09 ` Philippe Mathieu-Daudé
  2021-11-09 16:39 ` Warner Losh
  2021-11-10  9:25 ` Richard Henderson
  2 siblings, 0 replies; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-11-09  9:09 UTC (permalink / raw)
  To: Khem Raj, qemu-devel; +Cc: Laurent Vivier

On 11/8/21 20:42, Khem Raj wrote:
> uint64_t is available in all userspaces via compiler include stdint.h
> therefore use it instead of __u64 which is linux internal type, it fixes
> build on some platforms eg. aarch64 systems using musl C library
> 
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
>  linux-user/host/aarch64/hostdep.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/linux-user/host/aarch64/hostdep.h b/linux-user/host/aarch64/hostdep.h
> index a8d41a21ad..34d934f665 100644
> --- a/linux-user/host/aarch64/hostdep.h
> +++ b/linux-user/host/aarch64/hostdep.h
> @@ -25,7 +25,7 @@ extern char safe_syscall_end[];
>  static inline void rewind_if_in_safe_syscall(void *puc)
>  {
>      ucontext_t *uc = puc;
> -    __u64 *pcreg = &uc->uc_mcontext.pc;
> +    uint64_t *pcreg = &uc->uc_mcontext.pc;
>  
>      if (*pcreg > (uintptr_t)safe_syscall_start
>          && *pcreg < (uintptr_t)safe_syscall_end) {
> 

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>


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

* Re: [PATCH] linux-user: Replace __u64 with uint64_t
  2021-11-08 19:42 [PATCH] linux-user: Replace __u64 with uint64_t Khem Raj
  2021-11-09  9:09 ` Philippe Mathieu-Daudé
@ 2021-11-09 16:39 ` Warner Losh
  2021-11-10  9:25 ` Richard Henderson
  2 siblings, 0 replies; 9+ messages in thread
From: Warner Losh @ 2021-11-09 16:39 UTC (permalink / raw)
  To: Khem Raj; +Cc: qemu-devel



> On Nov 8, 2021, at 12:42 PM, Khem Raj <raj.khem@gmail.com> wrote:
> 
> uint64_t is available in all userspaces via compiler include stdint.h
> therefore use it instead of __u64 which is linux internal type, it fixes
> build on some platforms eg. aarch64 systems using musl C library
> 
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
> linux-user/host/aarch64/hostdep.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/linux-user/host/aarch64/hostdep.h b/linux-user/host/aarch64/hostdep.h
> index a8d41a21ad..34d934f665 100644
> --- a/linux-user/host/aarch64/hostdep.h
> +++ b/linux-user/host/aarch64/hostdep.h
> @@ -25,7 +25,7 @@ extern char safe_syscall_end[];
> static inline void rewind_if_in_safe_syscall(void *puc)
> {
>     ucontext_t *uc = puc;
> -    __u64 *pcreg = &uc->uc_mcontext.pc;
> +    uint64_t *pcreg = &uc->uc_mcontext.pc;
> 
>     if (*pcreg > (uintptr_t)safe_syscall_start
>         && *pcreg < (uintptr_t)safe_syscall_end) {

Reviewed-by: Warner Losh <imp@bsdimp.com>

I wonder why we don’t have a typedef like bed’s register_t though…



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

* Re: [PATCH] linux-user: Replace __u64 with uint64_t
  2021-11-08 19:42 [PATCH] linux-user: Replace __u64 with uint64_t Khem Raj
  2021-11-09  9:09 ` Philippe Mathieu-Daudé
  2021-11-09 16:39 ` Warner Losh
@ 2021-11-10  9:25 ` Richard Henderson
  2021-11-10 15:12   ` Richard Henderson
  2 siblings, 1 reply; 9+ messages in thread
From: Richard Henderson @ 2021-11-10  9:25 UTC (permalink / raw)
  To: Khem Raj, qemu-devel

On 11/8/21 8:42 PM, Khem Raj wrote:
> uint64_t is available in all userspaces via compiler include stdint.h
> therefore use it instead of __u64 which is linux internal type, it fixes
> build on some platforms eg. aarch64 systems using musl C library
> 
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
>   linux-user/host/aarch64/hostdep.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/linux-user/host/aarch64/hostdep.h b/linux-user/host/aarch64/hostdep.h
> index a8d41a21ad..34d934f665 100644
> --- a/linux-user/host/aarch64/hostdep.h
> +++ b/linux-user/host/aarch64/hostdep.h
> @@ -25,7 +25,7 @@ extern char safe_syscall_end[];
>   static inline void rewind_if_in_safe_syscall(void *puc)
>   {
>       ucontext_t *uc = puc;
> -    __u64 *pcreg = &uc->uc_mcontext.pc;
> +    uint64_t *pcreg = &uc->uc_mcontext.pc;
>   
>       if (*pcreg > (uintptr_t)safe_syscall_start
>           && *pcreg < (uintptr_t)safe_syscall_end) {

Queued to tcg-next, since that's where the original patch came from.

r~



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

* Re: [PATCH] linux-user: Replace __u64 with uint64_t
  2021-11-10  9:25 ` Richard Henderson
@ 2021-11-10 15:12   ` Richard Henderson
  2021-11-10 15:18     ` Richard Henderson
  0 siblings, 1 reply; 9+ messages in thread
From: Richard Henderson @ 2021-11-10 15:12 UTC (permalink / raw)
  To: Khem Raj, qemu-devel

On 11/10/21 10:25 AM, Richard Henderson wrote:
> On 11/8/21 8:42 PM, Khem Raj wrote:
>> uint64_t is available in all userspaces via compiler include stdint.h
>> therefore use it instead of __u64 which is linux internal type, it fixes
>> build on some platforms eg. aarch64 systems using musl C library
>>
>> Signed-off-by: Khem Raj <raj.khem@gmail.com>
>> ---
>>   linux-user/host/aarch64/hostdep.h | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/linux-user/host/aarch64/hostdep.h b/linux-user/host/aarch64/hostdep.h
>> index a8d41a21ad..34d934f665 100644
>> --- a/linux-user/host/aarch64/hostdep.h
>> +++ b/linux-user/host/aarch64/hostdep.h
>> @@ -25,7 +25,7 @@ extern char safe_syscall_end[];
>>   static inline void rewind_if_in_safe_syscall(void *puc)
>>   {
>>       ucontext_t *uc = puc;
>> -    __u64 *pcreg = &uc->uc_mcontext.pc;
>> +    uint64_t *pcreg = &uc->uc_mcontext.pc;
>>       if (*pcreg > (uintptr_t)safe_syscall_start
>>           && *pcreg < (uintptr_t)safe_syscall_end) {
> 
> Queued to tcg-next, since that's where the original patch came from.

Dequeued.  We need something more, because on debian we now get:

../linux-user/host/aarch64/hostdep.h:28:23: error: initialization of 'uint64_t *' {aka 
'long unsigned int *'} from incompatible pointer type 'long long unsigned int *' 
[-Werror=incompatible-pointer-types]
      uint64_t *pcreg = &uc->uc_mcontext.pc;
                        ^
cc1: all warnings being treated as errors

Perhaps we need to use __typeof() to get the correct pointer type?  Oh for c++11 auto 
declarations... :-)


r~


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

* Re: [PATCH] linux-user: Replace __u64 with uint64_t
  2021-11-10 15:12   ` Richard Henderson
@ 2021-11-10 15:18     ` Richard Henderson
  2021-11-10 16:03       ` Warner Losh
  0 siblings, 1 reply; 9+ messages in thread
From: Richard Henderson @ 2021-11-10 15:18 UTC (permalink / raw)
  To: Khem Raj, qemu-devel, Laurent Vivier, Warner Losh

On 11/10/21 4:12 PM, Richard Henderson wrote:
> On 11/10/21 10:25 AM, Richard Henderson wrote:
>> On 11/8/21 8:42 PM, Khem Raj wrote:
>>> uint64_t is available in all userspaces via compiler include stdint.h
>>> therefore use it instead of __u64 which is linux internal type, it fixes
>>> build on some platforms eg. aarch64 systems using musl C library
>>>
>>> Signed-off-by: Khem Raj <raj.khem@gmail.com>
>>> ---
>>>   linux-user/host/aarch64/hostdep.h | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/linux-user/host/aarch64/hostdep.h b/linux-user/host/aarch64/hostdep.h
>>> index a8d41a21ad..34d934f665 100644
>>> --- a/linux-user/host/aarch64/hostdep.h
>>> +++ b/linux-user/host/aarch64/hostdep.h
>>> @@ -25,7 +25,7 @@ extern char safe_syscall_end[];
>>>   static inline void rewind_if_in_safe_syscall(void *puc)
>>>   {
>>>       ucontext_t *uc = puc;
>>> -    __u64 *pcreg = &uc->uc_mcontext.pc;
>>> +    uint64_t *pcreg = &uc->uc_mcontext.pc;
>>>       if (*pcreg > (uintptr_t)safe_syscall_start
>>>           && *pcreg < (uintptr_t)safe_syscall_end) {
>>
>> Queued to tcg-next, since that's where the original patch came from.
> 
> Dequeued.  We need something more, because on debian we now get:
> 
> ../linux-user/host/aarch64/hostdep.h:28:23: error: initialization of 'uint64_t *' {aka 
> 'long unsigned int *'} from incompatible pointer type 'long long unsigned int *' 
> [-Werror=incompatible-pointer-types]
>       uint64_t *pcreg = &uc->uc_mcontext.pc;
>                         ^
> cc1: all warnings being treated as errors
> 
> Perhaps we need to use __typeof() to get the correct pointer type?  Oh for c++11 auto 
> declarations... :-)

No, we need to not use a pointer at all and grab Warner's

   https://patchew.org/QEMU/20211108023738.42125-1-imp@bsdimp.com/

Even grabbing the first two patches of that series for 6.2 would fix this.


r~


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

* Re: [PATCH] linux-user: Replace __u64 with uint64_t
  2021-11-10 15:18     ` Richard Henderson
@ 2021-11-10 16:03       ` Warner Losh
  2021-11-10 16:31         ` Khem Raj
  0 siblings, 1 reply; 9+ messages in thread
From: Warner Losh @ 2021-11-10 16:03 UTC (permalink / raw)
  To: Richard Henderson; +Cc: Laurent Vivier, Khem Raj, QEMU Developers

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

On Wed, Nov 10, 2021 at 8:19 AM Richard Henderson <
richard.henderson@linaro.org> wrote:

> On 11/10/21 4:12 PM, Richard Henderson wrote:
> > On 11/10/21 10:25 AM, Richard Henderson wrote:
> >> On 11/8/21 8:42 PM, Khem Raj wrote:
> >>> uint64_t is available in all userspaces via compiler include stdint.h
> >>> therefore use it instead of __u64 which is linux internal type, it
> fixes
> >>> build on some platforms eg. aarch64 systems using musl C library
> >>>
> >>> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> >>> ---
> >>>   linux-user/host/aarch64/hostdep.h | 2 +-
> >>>   1 file changed, 1 insertion(+), 1 deletion(-)
> >>>
> >>> diff --git a/linux-user/host/aarch64/hostdep.h
> b/linux-user/host/aarch64/hostdep.h
> >>> index a8d41a21ad..34d934f665 100644
> >>> --- a/linux-user/host/aarch64/hostdep.h
> >>> +++ b/linux-user/host/aarch64/hostdep.h
> >>> @@ -25,7 +25,7 @@ extern char safe_syscall_end[];
> >>>   static inline void rewind_if_in_safe_syscall(void *puc)
> >>>   {
> >>>       ucontext_t *uc = puc;
> >>> -    __u64 *pcreg = &uc->uc_mcontext.pc;
> >>> +    uint64_t *pcreg = &uc->uc_mcontext.pc;
> >>>       if (*pcreg > (uintptr_t)safe_syscall_start
> >>>           && *pcreg < (uintptr_t)safe_syscall_end) {
> >>
> >> Queued to tcg-next, since that's where the original patch came from.
> >
> > Dequeued.  We need something more, because on debian we now get:
> >
> > ../linux-user/host/aarch64/hostdep.h:28:23: error: initialization of
> 'uint64_t *' {aka
> > 'long unsigned int *'} from incompatible pointer type 'long long
> unsigned int *'
> > [-Werror=incompatible-pointer-types]
> >       uint64_t *pcreg = &uc->uc_mcontext.pc;
> >                         ^
> > cc1: all warnings being treated as errors
> >
> > Perhaps we need to use __typeof() to get the correct pointer type?  Oh
> for c++11 auto
> > declarations... :-)
>
> No, we need to not use a pointer at all and grab Warner's
>
>    https://patchew.org/QEMU/20211108023738.42125-1-imp@bsdimp.com/
>
> Even grabbing the first two patches of that series for 6.2 would fix this.
>

I tried to do a pointer for this stuff, only to find several places where
there
were mismatches like's reported there.

I also have an improvement to that series I was going to send later today
that fixes the check-patch warning by moving some externs around.  I was
going to do that after looking through my inbox to see if there'd been more
comments or not. I'll make sure the relevant fixes are first for this issue.

Warner

[-- Attachment #2: Type: text/html, Size: 3612 bytes --]

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

* Re: [PATCH] linux-user: Replace __u64 with uint64_t
  2021-11-10 16:03       ` Warner Losh
@ 2021-11-10 16:31         ` Khem Raj
  0 siblings, 0 replies; 9+ messages in thread
From: Khem Raj @ 2021-11-10 16:31 UTC (permalink / raw)
  To: Warner Losh; +Cc: Richard Henderson, QEMU Developers, Laurent Vivier

On Wed, Nov 10, 2021 at 8:03 AM Warner Losh <imp@bsdimp.com> wrote:
>
>
>
> On Wed, Nov 10, 2021 at 8:19 AM Richard Henderson <richard.henderson@linaro.org> wrote:
>>
>> On 11/10/21 4:12 PM, Richard Henderson wrote:
>> > On 11/10/21 10:25 AM, Richard Henderson wrote:
>> >> On 11/8/21 8:42 PM, Khem Raj wrote:
>> >>> uint64_t is available in all userspaces via compiler include stdint.h
>> >>> therefore use it instead of __u64 which is linux internal type, it fixes
>> >>> build on some platforms eg. aarch64 systems using musl C library
>> >>>
>> >>> Signed-off-by: Khem Raj <raj.khem@gmail.com>
>> >>> ---
>> >>>   linux-user/host/aarch64/hostdep.h | 2 +-
>> >>>   1 file changed, 1 insertion(+), 1 deletion(-)
>> >>>
>> >>> diff --git a/linux-user/host/aarch64/hostdep.h b/linux-user/host/aarch64/hostdep.h
>> >>> index a8d41a21ad..34d934f665 100644
>> >>> --- a/linux-user/host/aarch64/hostdep.h
>> >>> +++ b/linux-user/host/aarch64/hostdep.h
>> >>> @@ -25,7 +25,7 @@ extern char safe_syscall_end[];
>> >>>   static inline void rewind_if_in_safe_syscall(void *puc)
>> >>>   {
>> >>>       ucontext_t *uc = puc;
>> >>> -    __u64 *pcreg = &uc->uc_mcontext.pc;
>> >>> +    uint64_t *pcreg = &uc->uc_mcontext.pc;
>> >>>       if (*pcreg > (uintptr_t)safe_syscall_start
>> >>>           && *pcreg < (uintptr_t)safe_syscall_end) {
>> >>
>> >> Queued to tcg-next, since that's where the original patch came from.
>> >
>> > Dequeued.  We need something more, because on debian we now get:
>> >
>> > ../linux-user/host/aarch64/hostdep.h:28:23: error: initialization of 'uint64_t *' {aka
>> > 'long unsigned int *'} from incompatible pointer type 'long long unsigned int *'
>> > [-Werror=incompatible-pointer-types]
>> >       uint64_t *pcreg = &uc->uc_mcontext.pc;
>> >                         ^
>> > cc1: all warnings being treated as errors
>> >
>> > Perhaps we need to use __typeof() to get the correct pointer type?  Oh for c++11 auto
>> > declarations... :-)
>>
>> No, we need to not use a pointer at all and grab Warner's
>>
>>    https://patchew.org/QEMU/20211108023738.42125-1-imp@bsdimp.com/
>>
>> Even grabbing the first two patches of that series for 6.2 would fix this.
>
>
> I tried to do a pointer for this stuff, only to find several places where there
> were mismatches like's reported there.
>
> I also have an improvement to that series I was going to send later today
> that fixes the check-patch warning by moving some externs around.  I was
> going to do that after looking through my inbox to see if there'd been more
> comments or not. I'll make sure the relevant fixes are first for this issue.

Thanks Warner, if you are fixing it in your series, then we should
drop this.  Should we
use uintptr_t or something

>
> Warner


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

* [PATCH] linux-user: Replace __u64 with uint64_t
@ 2021-11-08 19:51 Khem Raj
  0 siblings, 0 replies; 9+ messages in thread
From: Khem Raj @ 2021-11-08 19:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Khem Raj

uint64_t is available in all userspaces via compiler include stdint.h
therefore use it instead of __u64 which is linux internal type, it fixes
build on some platforms eg. aarch64 systems using musl C library

Upstream-Status: Submitted []
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 linux-user/host/aarch64/hostdep.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/linux-user/host/aarch64/hostdep.h b/linux-user/host/aarch64/hostdep.h
index a8d41a21ad..34d934f665 100644
--- a/linux-user/host/aarch64/hostdep.h
+++ b/linux-user/host/aarch64/hostdep.h
@@ -25,7 +25,7 @@ extern char safe_syscall_end[];
 static inline void rewind_if_in_safe_syscall(void *puc)
 {
     ucontext_t *uc = puc;
-    __u64 *pcreg = &uc->uc_mcontext.pc;
+    uint64_t *pcreg = &uc->uc_mcontext.pc;
 
     if (*pcreg > (uintptr_t)safe_syscall_start
         && *pcreg < (uintptr_t)safe_syscall_end) {
-- 
2.33.1



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

end of thread, other threads:[~2021-11-10 16:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-08 19:42 [PATCH] linux-user: Replace __u64 with uint64_t Khem Raj
2021-11-09  9:09 ` Philippe Mathieu-Daudé
2021-11-09 16:39 ` Warner Losh
2021-11-10  9:25 ` Richard Henderson
2021-11-10 15:12   ` Richard Henderson
2021-11-10 15:18     ` Richard Henderson
2021-11-10 16:03       ` Warner Losh
2021-11-10 16:31         ` Khem Raj
2021-11-08 19:51 Khem Raj

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