All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v1] include/exec/helper-head.h: support "const void *" in helper calls
@ 2019-02-21  9:34 David Hildenbrand
  2019-02-21 18:25 ` Richard Henderson
  2019-02-27 15:36 ` no-reply
  0 siblings, 2 replies; 5+ messages in thread
From: David Hildenbrand @ 2019-02-21  9:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: Richard Henderson, Paolo Bonzini, David Hildenbrand

Especially when dealing with out-of-line gvec helpers, it is often
helpful to specify some vector pointers as constant. E.g. when
we have two inputs and one output, marking the two inputs as consts
pointers helps to avoid bugs.

Const pointers can be specified via "cptr", however behave in TCG just
like ordinary pointers. We can specify helpers like:

DEF_HELPER_FLAGS_4(gvec_vbperm, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32)

void HELPER(gvec_vbperm)(void *v1, const void *v2, const void *v3,
                         uint32_t desc)

And make sure that here, only v1 will be written (as long as const is
not casted away, of course).

Signed-off-by: David Hildenbrand <david@redhat.com>
---
 include/exec/helper-head.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/exec/helper-head.h b/include/exec/helper-head.h
index ab4f8b6623..f2519c9741 100644
--- a/include/exec/helper-head.h
+++ b/include/exec/helper-head.h
@@ -30,6 +30,7 @@
 #define dh_alias_f32 i32
 #define dh_alias_f64 i64
 #define dh_alias_ptr ptr
+#define dh_alias_cptr ptr
 #define dh_alias_void void
 #define dh_alias_noreturn noreturn
 #define dh_alias(t) glue(dh_alias_, t)
@@ -43,6 +44,7 @@
 #define dh_ctype_f32 float32
 #define dh_ctype_f64 float64
 #define dh_ctype_ptr void *
+#define dh_ctype_cptr const void *
 #define dh_ctype_void void
 #define dh_ctype_noreturn void QEMU_NORETURN
 #define dh_ctype(t) dh_ctype_##t
@@ -88,6 +90,7 @@
 #define dh_is_64bit_i32 0
 #define dh_is_64bit_i64 1
 #define dh_is_64bit_ptr (sizeof(void *) == 8)
+#define dh_is_64bit_cptr dh_is_64bit_ptr
 #define dh_is_64bit(t) glue(dh_is_64bit_, dh_alias(t))
 
 #define dh_is_signed_void 0
@@ -105,6 +108,7 @@
    extension instructions that may be required, e.g. ia64's addp4.  But
    for now we don't support any 64-bit targets with 32-bit pointers.  */
 #define dh_is_signed_ptr 0
+#define dh_is_signed_cptr dh_is_signed_ptr
 #define dh_is_signed_env dh_is_signed_ptr
 #define dh_is_signed(t) dh_is_signed_##t
 
@@ -117,6 +121,7 @@
 #define dh_callflag_f32  0
 #define dh_callflag_f64  0
 #define dh_callflag_ptr  0
+#define dh_callflag_cptr dh_callflag_ptr
 #define dh_callflag_void 0
 #define dh_callflag_noreturn TCG_CALL_NO_RETURN
 #define dh_callflag(t) glue(dh_callflag_, dh_alias(t))
-- 
2.17.2

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

* Re: [Qemu-devel] [PATCH v1] include/exec/helper-head.h: support "const void *" in helper calls
  2019-02-21  9:34 [Qemu-devel] [PATCH v1] include/exec/helper-head.h: support "const void *" in helper calls David Hildenbrand
@ 2019-02-21 18:25 ` Richard Henderson
  2019-02-27 15:36 ` no-reply
  1 sibling, 0 replies; 5+ messages in thread
From: Richard Henderson @ 2019-02-21 18:25 UTC (permalink / raw)
  To: David Hildenbrand, qemu-devel; +Cc: Paolo Bonzini, Richard Henderson

On 2/21/19 1:34 AM, David Hildenbrand wrote:
> Especially when dealing with out-of-line gvec helpers, it is often
> helpful to specify some vector pointers as constant. E.g. when
> we have two inputs and one output, marking the two inputs as consts
> pointers helps to avoid bugs.
> 
> Const pointers can be specified via "cptr", however behave in TCG just
> like ordinary pointers. We can specify helpers like:
> 
> DEF_HELPER_FLAGS_4(gvec_vbperm, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32)
> 
> void HELPER(gvec_vbperm)(void *v1, const void *v2, const void *v3,
>                          uint32_t desc)
> 
> And make sure that here, only v1 will be written (as long as const is
> not casted away, of course).
> 
> Signed-off-by: David Hildenbrand <david@redhat.com>
> ---
>  include/exec/helper-head.h | 5 +++++
>  1 file changed, 5 insertions(+)

Queued, thanks.


r~

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

* Re: [Qemu-devel] [PATCH v1] include/exec/helper-head.h: support "const void *" in helper calls
  2019-02-21  9:34 [Qemu-devel] [PATCH v1] include/exec/helper-head.h: support "const void *" in helper calls David Hildenbrand
  2019-02-21 18:25 ` Richard Henderson
@ 2019-02-27 15:36 ` no-reply
  2019-02-27 16:10   ` David Hildenbrand
  1 sibling, 1 reply; 5+ messages in thread
From: no-reply @ 2019-02-27 15:36 UTC (permalink / raw)
  To: david; +Cc: fam, qemu-devel, pbonzini, rth

Patchew URL: https://patchew.org/QEMU/20190221093459.22547-1-david@redhat.com/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Message-id: 20190221093459.22547-1-david@redhat.com
Subject: [Qemu-devel] [PATCH v1] include/exec/helper-head.h: support "const void *" in helper calls
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 * [new tag]               patchew/20190221093459.22547-1-david@redhat.com -> patchew/20190221093459.22547-1-david@redhat.com
 * [new tag]               patchew/20190225012530.28225-1-richardw.yang@linux.intel.com -> patchew/20190225012530.28225-1-richardw.yang@linux.intel.com
 * [new tag]               patchew/20190225162325.24008-1-maxiwell@linux.ibm.com -> patchew/20190225162325.24008-1-maxiwell@linux.ibm.com
Switched to a new branch 'test'

=== OUTPUT BEGIN ===
checkpatch.pl: no revisions returned for revlist '1'
=== OUTPUT END ===

Test command exited with code: 255


The full log is available at
http://patchew.org/logs/20190221093459.22547-1-david@redhat.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

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

* Re: [Qemu-devel] [PATCH v1] include/exec/helper-head.h: support "const void *" in helper calls
  2019-02-27 15:36 ` no-reply
@ 2019-02-27 16:10   ` David Hildenbrand
  2019-02-27 16:29     ` Paolo Bonzini
  0 siblings, 1 reply; 5+ messages in thread
From: David Hildenbrand @ 2019-02-27 16:10 UTC (permalink / raw)
  To: qemu-devel; +Cc: fam, pbonzini, rth

On 27.02.19 16:36, no-reply@patchew.org wrote:
> Patchew URL: https://patchew.org/QEMU/20190221093459.22547-1-david@redhat.com/
> 
> 
> 
> Hi,
> 
> This series seems to have some coding style problems. See output below for
> more information:
> 
> Message-id: 20190221093459.22547-1-david@redhat.com
> Subject: [Qemu-devel] [PATCH v1] include/exec/helper-head.h: support "const void *" in helper calls
> Type: series
> 
> === TEST SCRIPT BEGIN ===
> #!/bin/bash
> git rev-parse base > /dev/null || exit 0
> git config --local diff.renamelimit 0
> git config --local diff.renames True
> git config --local diff.algorithm histogram
> ./scripts/checkpatch.pl --mailback base..
> === TEST SCRIPT END ===
> 
> Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
> From https://github.com/patchew-project/qemu
>  * [new tag]               patchew/20190221093459.22547-1-david@redhat.com -> patchew/20190221093459.22547-1-david@redhat.com
>  * [new tag]               patchew/20190225012530.28225-1-richardw.yang@linux.intel.com -> patchew/20190225012530.28225-1-richardw.yang@linux.intel.com
>  * [new tag]               patchew/20190225162325.24008-1-maxiwell@linux.ibm.com -> patchew/20190225162325.24008-1-maxiwell@linux.ibm.com
> Switched to a new branch 'test'
> 
> === OUTPUT BEGIN ===
> checkpatch.pl: no revisions returned for revlist '1'

While patchew seems to be broken right now, I wonder why patches are
tested that are long upstream? Is this some leftover from fixing patchew?

-- 

Thanks,

David / dhildenb

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

* Re: [Qemu-devel] [PATCH v1] include/exec/helper-head.h: support "const void *" in helper calls
  2019-02-27 16:10   ` David Hildenbrand
@ 2019-02-27 16:29     ` Paolo Bonzini
  0 siblings, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2019-02-27 16:29 UTC (permalink / raw)
  To: David Hildenbrand, qemu-devel; +Cc: fam, rth

On 27/02/19 17:10, David Hildenbrand wrote:
> On 27.02.19 16:36, no-reply@patchew.org wrote:
>> Patchew URL: https://patchew.org/QEMU/20190221093459.22547-1-david@redhat.com/
>>
>>
>>
>> Hi,
>>
>> This series seems to have some coding style problems. See output below for
>> more information:
>>
>> Message-id: 20190221093459.22547-1-david@redhat.com
>> Subject: [Qemu-devel] [PATCH v1] include/exec/helper-head.h: support "const void *" in helper calls
>> Type: series
>>
>> === TEST SCRIPT BEGIN ===
>> #!/bin/bash
>> git rev-parse base > /dev/null || exit 0
>> git config --local diff.renamelimit 0
>> git config --local diff.renames True
>> git config --local diff.algorithm histogram
>> ./scripts/checkpatch.pl --mailback base..
>> === TEST SCRIPT END ===
>>
>> Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
>> From https://github.com/patchew-project/qemu
>>  * [new tag]               patchew/20190221093459.22547-1-david@redhat.com -> patchew/20190221093459.22547-1-david@redhat.com
>>  * [new tag]               patchew/20190225012530.28225-1-richardw.yang@linux.intel.com -> patchew/20190225012530.28225-1-richardw.yang@linux.intel.com
>>  * [new tag]               patchew/20190225162325.24008-1-maxiwell@linux.ibm.com -> patchew/20190225162325.24008-1-maxiwell@linux.ibm.com
>> Switched to a new branch 'test'
>>
>> === OUTPUT BEGIN ===
>> checkpatch.pl: no revisions returned for revlist '1'
> 
> While patchew seems to be broken right now, I wonder why patches are
> tested that are long upstream? Is this some leftover from fixing patchew?

Yes, Patchew is just catching up. :)

Paolo

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

end of thread, other threads:[~2019-02-27 16:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-21  9:34 [Qemu-devel] [PATCH v1] include/exec/helper-head.h: support "const void *" in helper calls David Hildenbrand
2019-02-21 18:25 ` Richard Henderson
2019-02-27 15:36 ` no-reply
2019-02-27 16:10   ` David Hildenbrand
2019-02-27 16:29     ` Paolo Bonzini

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.