Re: [Qemu-devel] [PATCH RFC] scripts/checkpatch.pl:Add check for `while` and `for`

2018-02-24 Thread no-reply
Hi,

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

Type: series
Message-id: 1519480458-9573-1-git-send-email-suhan...@mails.ucas.ac.cn
Subject: [Qemu-devel] [PATCH RFC] scripts/checkpatch.pl:Add check for `while` 
and `for`

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram

commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
failed=1
echo
fi
n=$((n+1))
done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
d557d98ca9 scripts/checkpatch.pl:Add check for `while` and `for`

=== OUTPUT BEGIN ===
Checking PATCH 1/1: scripts/checkpatch.pl:Add check for `while` and `for`...
ERROR: line over 90 characters
#32: FILE: scripts/checkpatch.pl:2356:
+   if ($line =~ /(^.*)\b(if|for|while)\b/ && $line !~ 
/\#\s*(if|for|while)/) {

total: 1 errors, 0 warnings, 8 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

=== OUTPUT END ===

Test command exited with code: 1


---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-de...@freelists.org

Re: [Qemu-devel] [PATCH v4 RFC 0/3] util/uri.c: Coding style format

2018-02-24 Thread no-reply
Hi,

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

Type: series
Message-id: 1519532963-12976-1-git-send-email-suhan...@mails.ucas.ac.cn
Subject: [Qemu-devel]  [PATCH v4 RFC 0/3] util/uri.c: Coding style format

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram

commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
failed=1
echo
fi
n=$((n+1))
done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 * [new tag]   
patchew/1519532963-12976-1-git-send-email-suhan...@mails.ucas.ac.cn -> 
patchew/1519532963-12976-1-git-send-email-suhan...@mails.ucas.ac.cn
Switched to a new branch 'test'
957d502227 util/uri.c: wrap single statement blocks with braces {}
fe53592725 util/uri.c: remove brackets that wrap `return` statement's content.
d00aae9b66 util/uri.c: Coding style check, Only whitespace involved. Using 
`clang-format -i util/uri.c` first, then change back few code manually, to make 
sure only whitespace involved.

=== OUTPUT BEGIN ===
Checking PATCH 1/3: util/uri.c: Coding style check, Only whitespace involved. 
Using `clang-format -i util/uri.c` first, then change back few code manually, 
to make sure only whitespace involved
ERROR: return is not a function, parentheses are not required
#167: FILE: util/uri.c:215:
+return (-1);

ERROR: return is not a function, parentheses are not required
#172: FILE: util/uri.c:219:
+return (2);

ERROR: return is not a function, parentheses are not required
#186: FILE: util/uri.c:229:
+return (0);

ERROR: braces {} are necessary for all arms of this statement
#208: FILE: util/uri.c:262:
+if (uri->cleanup & 2)
[...]
+else
[...]

ERROR: braces {} are necessary for all arms of this statement
#272: FILE: util/uri.c:359:
+if (uri->cleanup & 2)
[...]
+else
[...]

ERROR: return is not a function, parentheses are not required
#278: FILE: util/uri.c:365:
+return (0);

ERROR: return is not a function, parentheses are not required
#281: FILE: util/uri.c:367:
+return (1);

ERROR: return is not a function, parentheses are not required
#301: FILE: util/uri.c:389:
+return (1);

ERROR: braces {} are necessary for all arms of this statement
#302: FILE: util/uri.c:390:
+if (!ISA_DIGIT(cur + 1))
[...]
+else if ((*cur != '0') && (ISA_DIGIT(cur + 1)) && (!ISA_DIGIT(cur + 2)))
[...]
 else if ((*cur == '1') && (ISA_DIGIT(cur + 1)) && (ISA_DIGIT(cur + 2)))
[...]
-else if ((*cur == '2') && (*(cur + 1) >= '0') &&
[...]
-else if ((*cur == '2') && (*(cur + 1) == '5') &&
[...]
+cur += 3;
[...]

ERROR: braces {} are necessary for all arms of this statement
#304: FILE: util/uri.c:392:
+else if ((*cur != '0') && (ISA_DIGIT(cur + 1)) && (!ISA_DIGIT(cur + 2)))
[...]
 else if ((*cur == '1') && (ISA_DIGIT(cur + 1)) && (ISA_DIGIT(cur + 2)))
[...]
-else if ((*cur == '2') && (*(cur + 1) >= '0') &&
[...]
-else if ((*cur == '2') && (*(cur + 1) == '5') &&
[...]
+cur += 3;
[...]

ERROR: braces {} are necessary for all arms of this statement
#315: FILE: util/uri.c:396:
+else if ((*cur == '2') && (*(cur + 1) >= '0') && (*(cur + 1) <= '4') &&
[...]
+else if ((*cur == '2') && (*(cur + 1) == '5') && (*(cur + 2) >= '0') &&
[...]
 else
[...]

ERROR: braces {} are necessary for all arms of this statement
#318: FILE: util/uri.c:399:
+else if ((*cur == '2') && (*(cur + 1) == '5') && (*(cur + 2) >= '0') &&
[...]
 else
[...]

ERROR: return is not a function, parentheses are not required
#323: FILE: util/uri.c:403:
+return (1);

ERROR: return is not a function, parentheses are not required
#326: FILE: util/uri.c:405:
+return (0);

ERROR: braces {} are necessary even for single statement blocks
#350: FILE: util/uri.c:433:
+while ((*cur != ']') && (*cur != 0))
+cur++;

ERROR: braces {} are necessary for all arms of this statement
#352: FILE: util/uri.c:435:
+if (*cur != ']')
[...]

ERROR: return is not a function, parentheses are not required
#353: FILE: util/uri.c:436:
+return (1);

ERROR: braces {} are necessary for all arms of this statement
#367: FILE: util/uri.c:446:
+if (*cur != '.')
[...]

ERROR: braces {} are necessary for all arms of this statement
#375: FILE: util/uri.c:451:
+if (*cur != '.')
[...]

ERROR: braces {} are necessary for all arms of this statement
#382: FILE: util/uri.c:455:
+if (*cur != '.')
[...]

ERROR: braces {} are necessary for all arms of this statement
#408: FILE: 

Re: [Qemu-devel] [PATCH 1/5] Add a git-publish configuration file

2018-02-24 Thread Fam Zheng
On Wed, 02/14 14:37, Philippe Mathieu-Daudé wrote:
> On 02/13/2018 02:34 PM, Stefan Hajnoczi wrote:
> > From: Fam Zheng 
> > 
> > git-publish [1] is a convenient tool to send patches and has been
> > popular among QEMU developers.  Recently it has been made available in
> > Fedora official repo thanks to Stefan's work.
> 
> Also Debian:
> https://packages.debian.org/sid/git-publish

Thank you for doing that! I will add the pointer.

Fam



Re: [Qemu-devel] [PATCH 1/5] Add a git-publish configuration file

2018-02-24 Thread Fam Zheng
On Wed, 02/14 15:08, Paolo Bonzini wrote:
> On 13/02/2018 19:09, Daniel P. Berrangé wrote:
> > Why is a custom entry needed for block here (and other things
> > below).   Won't running get_maintainer.pl already correctly
> > report when a patch needs cc'ing to qemu-bl...@nongnu.org
> > based on MAINTAINER rules ?
> 
> Sometimes you want to CC block people even on a non-block patch, for
> example if you want their opinion about using the API.
> 
> We should probably add at least arm and ppc profiles, too.
> 
> > --nogit --nogit-fallback
> 
> QEMU's getmaintainer (unlike the Linux version!) already tries to avoid
> falling back to git if a maintainer is listed.  Are these options necessary?
> 

Falling back to git is usually more noisy than useful even when a maintainer is
not listed, in my past experience. That's why I don't use it myself and propose
such here. But I'm open to different opinions.

Fam



Re: [Qemu-devel] [PATCH] docker: dump 'config.log' if ./configure fails

2018-02-24 Thread Fam Zheng
On Thu, 02/15 14:23, Philippe Mathieu-Daudé wrote:
> Suggested-by: Eric Blake 
> Signed-off-by: Philippe Mathieu-Daudé 
> ---
>  tests/docker/common.rc | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/docker/common.rc b/tests/docker/common.rc
> index 7951555e3f..dd011cdf1e 100755
> --- a/tests/docker/common.rc
> +++ b/tests/docker/common.rc
> @@ -30,7 +30,9 @@ build_qemu()
>   $@"
>  echo "Configure options:"
>  echo $config_opts
> -$QEMU_SRC/configure $config_opts && make $MAKEFLAGS
> +$QEMU_SRC/configure $config_opts || \
> +(cat config.log && prep_fail "Failed to run 'configure'")
> +make $MAKEFLAGS

If the configure failure is due to "this" patch, which it likely is, then
prep_fail is wrong. We want test_fail instead.

Fam



Re: [Qemu-devel] [PATCH v4 RFC 0/3] util/uri.c: Coding style format

2018-02-24 Thread no-reply
Hi,

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

Type: series
Message-id: 1519533358-13759-1-git-send-email-suhan...@mails.ucas.ac.cn
Subject: [Qemu-devel]  [PATCH v4 RFC 0/3] util/uri.c: Coding style format

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram

commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
failed=1
echo
fi
n=$((n+1))
done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
0b643d64f7 util/uri.c: wrap single statement blocks with braces {}
ab404fc551 util/uri.c: remove brackets that wrap `return` statement's content.
37847b66db util/uri.c: Coding style check, Only whitespace involved. Using 
`clang-format -i util/uri.c` first, then change back few code manually, to make 
sure only whitespace involved.

=== OUTPUT BEGIN ===
Checking PATCH 1/3: util/uri.c: Coding style check, Only whitespace involved. 
Using `clang-format -i util/uri.c` first, then change back few code manually, 
to make sure only whitespace involved
ERROR: return is not a function, parentheses are not required
#167: FILE: util/uri.c:215:
+return (-1);

ERROR: return is not a function, parentheses are not required
#172: FILE: util/uri.c:219:
+return (2);

ERROR: return is not a function, parentheses are not required
#186: FILE: util/uri.c:229:
+return (0);

ERROR: braces {} are necessary for all arms of this statement
#208: FILE: util/uri.c:262:
+if (uri->cleanup & 2)
[...]
+else
[...]

ERROR: braces {} are necessary for all arms of this statement
#272: FILE: util/uri.c:359:
+if (uri->cleanup & 2)
[...]
+else
[...]

ERROR: return is not a function, parentheses are not required
#278: FILE: util/uri.c:365:
+return (0);

ERROR: return is not a function, parentheses are not required
#281: FILE: util/uri.c:367:
+return (1);

ERROR: return is not a function, parentheses are not required
#301: FILE: util/uri.c:389:
+return (1);

ERROR: braces {} are necessary for all arms of this statement
#302: FILE: util/uri.c:390:
+if (!ISA_DIGIT(cur + 1))
[...]
+else if ((*cur != '0') && (ISA_DIGIT(cur + 1)) && (!ISA_DIGIT(cur + 2)))
[...]
 else if ((*cur == '1') && (ISA_DIGIT(cur + 1)) && (ISA_DIGIT(cur + 2)))
[...]
-else if ((*cur == '2') && (*(cur + 1) >= '0') &&
[...]
-else if ((*cur == '2') && (*(cur + 1) == '5') &&
[...]
+cur += 3;
[...]

ERROR: braces {} are necessary for all arms of this statement
#304: FILE: util/uri.c:392:
+else if ((*cur != '0') && (ISA_DIGIT(cur + 1)) && (!ISA_DIGIT(cur + 2)))
[...]
 else if ((*cur == '1') && (ISA_DIGIT(cur + 1)) && (ISA_DIGIT(cur + 2)))
[...]
-else if ((*cur == '2') && (*(cur + 1) >= '0') &&
[...]
-else if ((*cur == '2') && (*(cur + 1) == '5') &&
[...]
+cur += 3;
[...]

ERROR: braces {} are necessary for all arms of this statement
#315: FILE: util/uri.c:396:
+else if ((*cur == '2') && (*(cur + 1) >= '0') && (*(cur + 1) <= '4') &&
[...]
+else if ((*cur == '2') && (*(cur + 1) == '5') && (*(cur + 2) >= '0') &&
[...]
 else
[...]

ERROR: braces {} are necessary for all arms of this statement
#318: FILE: util/uri.c:399:
+else if ((*cur == '2') && (*(cur + 1) == '5') && (*(cur + 2) >= '0') &&
[...]
 else
[...]

ERROR: return is not a function, parentheses are not required
#323: FILE: util/uri.c:403:
+return (1);

ERROR: return is not a function, parentheses are not required
#326: FILE: util/uri.c:405:
+return (0);

ERROR: braces {} are necessary even for single statement blocks
#350: FILE: util/uri.c:433:
+while ((*cur != ']') && (*cur != 0))
+cur++;

ERROR: braces {} are necessary for all arms of this statement
#352: FILE: util/uri.c:435:
+if (*cur != ']')
[...]

ERROR: return is not a function, parentheses are not required
#353: FILE: util/uri.c:436:
+return (1);

ERROR: braces {} are necessary for all arms of this statement
#367: FILE: util/uri.c:446:
+if (*cur != '.')
[...]

ERROR: braces {} are necessary for all arms of this statement
#375: FILE: util/uri.c:451:
+if (*cur != '.')
[...]

ERROR: braces {} are necessary for all arms of this statement
#382: FILE: util/uri.c:455:
+if (*cur != '.')
[...]

ERROR: braces {} are necessary for all arms of this statement
#408: FILE: util/uri.c:473:
+if (cur != host) {
[...]
+} else
[...]

ERROR: braces {} are necessary for all arms of this statement
#409: FILE: util/uri.c:474:
+if (uri->cleanup & 2)
[...]
+

[Qemu-devel] [PATCH v4 RFC 1/3] util/uri.c: Coding style check, Only whitespace involved. Using `clang-format -i util/uri.c` first, then change back few code manually, to make sure only whitespace in

2018-02-24 Thread Su Hang
Signed-off-by: Su Hang 
---
 util/uri.c | 1468 ++--
 1 file changed, 735 insertions(+), 733 deletions(-)

diff --git a/util/uri.c b/util/uri.c
index 21b18281703a..cf09f41735a1 100644
--- a/util/uri.c
+++ b/util/uri.c
@@ -63,7 +63,6 @@ static void uri_clean(URI *uri);
  */
 #define IS_ALPHA(x) (IS_LOWALPHA(x) || IS_UPALPHA(x))
 
-
 /*
  * lowalpha = "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" |
  *"k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" |
@@ -97,27 +96,27 @@ static void uri_clean(URI *uri);
  * mark = "-" | "_" | "." | "!" | "~" | "*" | "'" | "(" | ")"
  */
 
-#define IS_MARK(x) (((x) == '-') || ((x) == '_') || ((x) == '.') || \
-((x) == '!') || ((x) == '~') || ((x) == '*') || ((x) == '\'') ||\
+#define IS_MARK(x) (((x) == '-') || ((x) == '_') || ((x) == '.') ||
\
+((x) == '!') || ((x) == '~') || ((x) == '*') || ((x) == '\'') ||   
\
 ((x) == '(') || ((x) == ')'))
 
 /*
  * unwise = "{" | "}" | "|" | "\" | "^" | "`"
  */
 
-#define IS_UNWISE(p)\
-  (((*(p) == '{')) || ((*(p) == '}')) || ((*(p) == '|')) || \
-   ((*(p) == '\\')) || ((*(p) == '^')) || ((*(p) == '[')) ||\
-   ((*(p) == ']')) || ((*(p) == '`')))
+#define IS_UNWISE(p)   
\
+(((*(p) == '{')) || ((*(p) == '}')) || ((*(p) == '|')) ||  
\
+ ((*(p) == '\\')) || ((*(p) == '^')) || ((*(p) == '[')) || 
\
+ ((*(p) == ']')) || ((*(p) == '`')))
 /*
  * reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" | "$" | "," |
  *"[" | "]"
  */
 
-#define IS_RESERVED(x) (((x) == ';') || ((x) == '/') || ((x) == '?') || \
-((x) == ':') || ((x) == '@') || ((x) == '&') || ((x) == '=') || \
-((x) == '+') || ((x) == '$') || ((x) == ',') || ((x) == '[') || \
-((x) == ']'))
+#define IS_RESERVED(x) (((x) == ';') || ((x) == '/') || ((x) == '?') ||
\
+((x) == ':') || ((x) == '@') || ((x) == '&') || ((x) == '=') ||
\
+((x) == '+') || ((x) == '$') || ((x) == ',') || ((x) == '[') ||
\
+((x) == ']'))
 
 /*
  * unreserved = alphanum | mark
@@ -129,7 +128,7 @@ static void uri_clean(URI *uri);
  * Skip to next pointer char, handle escaped sequences
  */
 
-#define NEXT(p) ((*p == '%')? p += 3 : p++)
+#define NEXT(p) ((*p == '%') ? p += 3 : p++)
 
 /*
  * Productions from the spec.
@@ -141,37 +140,36 @@ static void uri_clean(URI *uri);
  * path  = [ abs_path | opaque_part ]
  */
 
-
 /
- * *
- * RFC 3986 parser *
- * *
+ *  *
+ * RFC 3986 parser  *
+ *  *
  /
 
 #define ISA_DIGIT(p) ((*(p) >= '0') && (*(p) <= '9'))
-#define ISA_ALPHA(p) (((*(p) >= 'a') && (*(p) <= 'z')) ||  \
+#define ISA_ALPHA(p) (((*(p) >= 'a') && (*(p) <= 'z')) ||  
\
   ((*(p) >= 'A') && (*(p) <= 'Z')))
-#define ISA_HEXDIG(p)  \
-   (ISA_DIGIT(p) || ((*(p) >= 'a') && (*(p) <= 'f')) ||\
-((*(p) >= 'A') && (*(p) <= 'F')))
+#define ISA_HEXDIG(p)  
\
+(ISA_DIGIT(p) || ((*(p) >= 'a') && (*(p) <= 'f')) ||   
\
+ ((*(p) >= 'A') && (*(p) <= 'F')))
 
 /*
  *sub-delims= "!" / "$" / "&" / "'" / "(" / ")"
  * / "*" / "+" / "," / ";" / "="
  */
-#define ISA_SUB_DELIM(p)   \
-  (((*(p) == '!')) || ((*(p) == '$')) || ((*(p) == '&')) ||
\
-   ((*(p) == '(')) || ((*(p) == ')')) || ((*(p) == '*')) ||
\
-   ((*(p) == '+')) || ((*(p) == ',')) || ((*(p) == ';')) ||
\
-   ((*(p) == '=')) || ((*(p) == '\'')))
+#define ISA_SUB_DELIM(p)   
\
+(((*(p) == '!')) || ((*(p) == '$')) || ((*(p) == '&')) ||  
\
+ ((*(p) == '(')) || ((*(p) == ')')) || ((*(p) == '*')) ||  
\
+ ((*(p) == '+')) || ((*(p) == ',')) || ((*(p) == ';')) ||  
\
+ ((*(p) == '=')) || ((*(p) == '\'')))
 
 /*
  *gen-delims= ":" / "/" / "?" / "#" / "[" / "]" / "@"
  */
-#define ISA_GEN_DELIM(p)   \
-  (((*(p) == ':')) || ((*(p) 

[Qemu-devel] [PATCH v4 RFC 3/3] util/uri.c: wrap single statement blocks with braces {}

2018-02-24 Thread Su Hang
For this patch, using curly braces to wrap `if` `while` `else` statements,
which only hold single statement. For example:
'''
if (cond)
statement;
'''
to
'''
if (cond) {
statement;
}
'''

And using tricks that compare the disassemblies before and after
code changes, to make sure code logic isn't changed:
'''
git checkout master
make util/uri.o
strip util/uri.o
objdump -Drx util/uri.o > /tmp/uri-master.txt
git checkout cleanupbranch
make util/uri.o
strip util/uri.o
objdump -Drx util/uri.o > /tmp/uri-cleanup.txt
diff -u /tmp/uri-*.txt
'''

With that, all complaints raised by checkpatch.pl have been suppressed.  

Suggested-by: Thomas Huth 
Suggested-by: Eric Blake 
Signed-off-by: Su Hang 
---
 util/uri.c | 463 +++--
 1 file changed, 294 insertions(+), 169 deletions(-)

diff --git a/util/uri.c b/util/uri.c
index bb2576cf2190..93ecefdaaf7d 100644
--- a/util/uri.c
+++ b/util/uri.c
@@ -211,16 +211,19 @@ static int rfc3986_parse_scheme(URI *uri, const char 
**str)
 {
 const char *cur;
 
-if (str == NULL)
+if (str == NULL) {
 return -1;
+}
 
 cur = *str;
-if (!ISA_ALPHA(cur))
+if (!ISA_ALPHA(cur)) {
 return 2;
+}
 cur++;
 while (ISA_ALPHA(cur) || ISA_DIGIT(cur) || (*cur == '+') || (*cur == '-') 
||
-   (*cur == '.'))
+   (*cur == '.')) {
 cur++;
+}
 if (uri != NULL) {
 g_free(uri->scheme);
 uri->scheme = g_strndup(*str, cur - *str);
@@ -248,21 +251,24 @@ static int rfc3986_parse_fragment(URI *uri, const char 
**str)
 {
 const char *cur;
 
-if (str == NULL)
+if (str == NULL) {
 return -1;
+}
 
 cur = *str;
 
 while ((ISA_PCHAR(cur)) || (*cur == '/') || (*cur == '?') ||
(*cur == '[') || (*cur == ']') ||
-   ((uri != NULL) && (uri->cleanup & 1) && (IS_UNWISE(cur
+   ((uri != NULL) && (uri->cleanup & 1) && (IS_UNWISE(cur {
 NEXT(cur);
+}
 if (uri != NULL) {
 g_free(uri->fragment);
-if (uri->cleanup & 2)
+if (uri->cleanup & 2) {
 uri->fragment = g_strndup(*str, cur - *str);
-else
+} else {
 uri->fragment = uri_string_unescape(*str, cur - *str, NULL);
+}
 }
 *str = cur;
 return 0;
@@ -283,14 +289,16 @@ static int rfc3986_parse_query(URI *uri, const char **str)
 {
 const char *cur;
 
-if (str == NULL)
+if (str == NULL) {
 return -1;
+}
 
 cur = *str;
 
 while ((ISA_PCHAR(cur)) || (*cur == '/') || (*cur == '?') ||
-   ((uri != NULL) && (uri->cleanup & 1) && (IS_UNWISE(cur
+   ((uri != NULL) && (uri->cleanup & 1) && (IS_UNWISE(cur {
 NEXT(cur);
+}
 if (uri != NULL) {
 g_free(uri->query);
 uri->query = g_strndup(*str, cur - *str);
@@ -351,15 +359,17 @@ static int rfc3986_parse_user_info(URI *uri, const char 
**str)
 
 cur = *str;
 while (ISA_UNRESERVED(cur) || ISA_PCT_ENCODED(cur) || ISA_SUB_DELIM(cur) ||
-   (*cur == ':'))
+   (*cur == ':')) {
 NEXT(cur);
+}
 if (*cur == '@') {
 if (uri != NULL) {
 g_free(uri->user);
-if (uri->cleanup & 2)
+if (uri->cleanup & 2) {
 uri->user = g_strndup(*str, cur - *str);
-else
+} else {
 uri->user = uri_string_unescape(*str, cur - *str, NULL);
+}
 }
 *str = cur;
 return 0;
@@ -385,22 +395,24 @@ static int rfc3986_parse_dec_octet(const char **str)
 {
 const char *cur = *str;
 
-if (!(ISA_DIGIT(cur)))
+if (!(ISA_DIGIT(cur))) {
 return 1;
-if (!ISA_DIGIT(cur + 1))
+}
+if (!ISA_DIGIT(cur + 1)) {
 cur++;
-else if ((*cur != '0') && (ISA_DIGIT(cur + 1)) && (!ISA_DIGIT(cur + 2)))
+} else if ((*cur != '0') && (ISA_DIGIT(cur + 1)) && (!ISA_DIGIT(cur + 2))) 
{
 cur += 2;
-else if ((*cur == '1') && (ISA_DIGIT(cur + 1)) && (ISA_DIGIT(cur + 2)))
+} else if ((*cur == '1') && (ISA_DIGIT(cur + 1)) && (ISA_DIGIT(cur + 2))) {
 cur += 3;
-else if ((*cur == '2') && (*(cur + 1) >= '0') && (*(cur + 1) <= '4') &&
- (ISA_DIGIT(cur + 2)))
+} else if ((*cur == '2') && (*(cur + 1) >= '0') && (*(cur + 1) <= '4') &&
+ (ISA_DIGIT(cur + 2))) {
 cur += 3;
-else if ((*cur == '2') && (*(cur + 1) == '5') && (*(cur + 2) >= '0') &&
- (*(cur + 1) <= '5'))
+} else if ((*cur == '2') && (*(cur + 1) == '5') && (*(cur + 2) >= '0') &&
+ (*(cur + 1) <= '5')) {
 cur += 3;
-else
+} else {
 return 1;
+}
 *str = cur;
 return 0;
 }
@@ -430,10 +442,12 @@ static int rfc3986_parse_host(URI *uri, const char **str)
  */
 if (*cur == '[') {
 cur++;
-while ((*cur != ']') && (*cur != 0))
+  

[Qemu-devel] [PATCH v4 RFC 2/3] util/uri.c: remove brackets that wrap `return` statement's content.

2018-02-24 Thread Su Hang
only remove brackets that wrap `return` statements' content.

use `perl -pi -e "s/return \((.*?)\);/return \1;/g" util/uri.c`
to remove pattern like this: "return (1);"

Signed-off-by: Su Hang 
---
 util/uri.c | 160 ++---
 1 file changed, 80 insertions(+), 80 deletions(-)

diff --git a/util/uri.c b/util/uri.c
index cf09f41735a1..bb2576cf2190 100644
--- a/util/uri.c
+++ b/util/uri.c
@@ -212,11 +212,11 @@ static int rfc3986_parse_scheme(URI *uri, const char 
**str)
 const char *cur;
 
 if (str == NULL)
-return (-1);
+return -1;
 
 cur = *str;
 if (!ISA_ALPHA(cur))
-return (2);
+return 2;
 cur++;
 while (ISA_ALPHA(cur) || ISA_DIGIT(cur) || (*cur == '+') || (*cur == '-') 
||
(*cur == '.'))
@@ -226,7 +226,7 @@ static int rfc3986_parse_scheme(URI *uri, const char **str)
 uri->scheme = g_strndup(*str, cur - *str);
 }
 *str = cur;
-return (0);
+return 0;
 }
 
 /**
@@ -249,7 +249,7 @@ static int rfc3986_parse_fragment(URI *uri, const char 
**str)
 const char *cur;
 
 if (str == NULL)
-return (-1);
+return -1;
 
 cur = *str;
 
@@ -265,7 +265,7 @@ static int rfc3986_parse_fragment(URI *uri, const char 
**str)
 uri->fragment = uri_string_unescape(*str, cur - *str, NULL);
 }
 *str = cur;
-return (0);
+return 0;
 }
 
 /**
@@ -284,7 +284,7 @@ static int rfc3986_parse_query(URI *uri, const char **str)
 const char *cur;
 
 if (str == NULL)
-return (-1);
+return -1;
 
 cur = *str;
 
@@ -296,7 +296,7 @@ static int rfc3986_parse_query(URI *uri, const char **str)
 uri->query = g_strndup(*str, cur - *str);
 }
 *str = cur;
-return (0);
+return 0;
 }
 
 /**
@@ -362,9 +362,9 @@ static int rfc3986_parse_user_info(URI *uri, const char 
**str)
 uri->user = uri_string_unescape(*str, cur - *str, NULL);
 }
 *str = cur;
-return (0);
+return 0;
 }
-return (1);
+return 1;
 }
 
 /**
@@ -386,7 +386,7 @@ static int rfc3986_parse_dec_octet(const char **str)
 const char *cur = *str;
 
 if (!(ISA_DIGIT(cur)))
-return (1);
+return 1;
 if (!ISA_DIGIT(cur + 1))
 cur++;
 else if ((*cur != '0') && (ISA_DIGIT(cur + 1)) && (!ISA_DIGIT(cur + 2)))
@@ -400,9 +400,9 @@ static int rfc3986_parse_dec_octet(const char **str)
  (*(cur + 1) <= '5'))
 cur += 3;
 else
-return (1);
+return 1;
 *str = cur;
-return (0);
+return 0;
 }
 /**
  * rfc3986_parse_host:
@@ -433,7 +433,7 @@ static int rfc3986_parse_host(URI *uri, const char **str)
 while ((*cur != ']') && (*cur != 0))
 cur++;
 if (*cur != ']')
-return (1);
+return 1;
 cur++;
 goto found;
 }
@@ -479,7 +479,7 @@ found:
 uri->server = NULL;
 }
 *str = cur;
-return (0);
+return 0;
 }
 
 /**
@@ -510,15 +510,15 @@ static int rfc3986_parse_authority(URI *uri, const char 
**str)
 cur++;
 ret = rfc3986_parse_host(uri, );
 if (ret != 0)
-return (ret);
+return ret;
 if (*cur == ':') {
 cur++;
 ret = rfc3986_parse_port(uri, );
 if (ret != 0)
-return (ret);
+return ret;
 }
 *str = cur;
-return (0);
+return 0;
 }
 
 /**
@@ -544,13 +544,13 @@ static int rfc3986_parse_segment(const char **str, char 
forbid, int empty)
 cur = *str;
 if (!ISA_PCHAR(cur)) {
 if (empty)
-return (0);
-return (1);
+return 0;
+return 1;
 }
 while (ISA_PCHAR(cur) && (*cur != forbid))
 NEXT(cur);
 *str = cur;
-return (0);
+return 0;
 }
 
 /**
@@ -576,7 +576,7 @@ static int rfc3986_parse_path_ab_empty(URI *uri, const char 
**str)
 cur++;
 ret = rfc3986_parse_segment(, 0, 1);
 if (ret != 0)
-return (ret);
+return ret;
 }
 if (uri != NULL) {
 g_free(uri->path);
@@ -590,7 +590,7 @@ static int rfc3986_parse_path_ab_empty(URI *uri, const char 
**str)
 }
 }
 *str = cur;
-return (0);
+return 0;
 }
 
 /**
@@ -613,7 +613,7 @@ static int rfc3986_parse_path_absolute(URI *uri, const char 
**str)
 cur = *str;
 
 if (*cur != '/')
-return (1);
+return 1;
 cur++;
 ret = rfc3986_parse_segment(, 0, 0);
 if (ret == 0) {
@@ -621,7 +621,7 @@ static int rfc3986_parse_path_absolute(URI *uri, const char 
**str)
 cur++;
 ret = rfc3986_parse_segment(, 0, 1);
 if (ret != 0)
-return (ret);
+return ret;
 }
 }
 if (uri != NULL) {
@@ -636,7 +636,7 @@ static int rfc3986_parse_path_absolute(URI *uri, const char 
**str)
 }
 }
 *str = cur;
-return (0);
+   

[Qemu-devel] [PATCH v4 RFC 0/3] util/uri.c: Coding style format

2018-02-24 Thread Su Hang
Su Hang (3):
  util/uri.c: Coding style check, Only whitespace involved.
  util/uri.c: remove brackets () that wrap `return` statement's content.
  util/uri.c: wrap single statement blocks with braces {}

 util/uri.c | 1753 
 1 file changed, 940 insertions(+), 813 deletions(-)

Using `git diff -w` to make sure that the first patch only contains
whitespace changes, replace all TAB with whitespace.
Here is what I actually use:
'''
[core]
whitespace = -trailing-space,-indent-with-non-tab,-tab-in-indent

git diff -w  --word-diff-regex=[^[:space:]]
'''

For second patch, using
`perl -pi -e "s/return \((.*?)\);/return \1;/g" util/uri.c`
to remove brackets () that wrap `return` statement's content.
Changing patterns like this:
`return (a);` to `return a;`.

For third patch, using curly braces to wrap `if` `while` `else` statements,
which only hold single statement. For example:
'''
if (cond)
statement;
'''
to
'''
if (cond) {
statement;
}
'''

And using tricks that compare the disassemblies before and after
code changes, to make sure code logic isn't changed:
'''
git checkout master
make util/uri.o
strip util/uri.o
objdump -Drx util/uri.o > /tmp/uri-master.txt
git checkout cleanupbranch
make util/uri.o
strip util/uri.o
objdump -Drx util/uri.o > /tmp/uri-cleanup.txt
diff -u /tmp/uri-*.txt
'''

--
2.7.4




[Qemu-devel] [PATCH v4 RFC 1/3] util/uri.c: Coding style check, Only whitespace involved. Using `clang-format -i util/uri.c` first, then change back few code manually, to make sure only whitespace in

2018-02-24 Thread Su Hang
Signed-off-by: Su Hang 
---
 util/uri.c | 1468 ++--
 1 file changed, 735 insertions(+), 733 deletions(-)

diff --git a/util/uri.c b/util/uri.c
index 21b18281703a..cf09f41735a1 100644
--- a/util/uri.c
+++ b/util/uri.c
@@ -63,7 +63,6 @@ static void uri_clean(URI *uri);
  */
 #define IS_ALPHA(x) (IS_LOWALPHA(x) || IS_UPALPHA(x))
 
-
 /*
  * lowalpha = "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" |
  *"k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" |
@@ -97,27 +96,27 @@ static void uri_clean(URI *uri);
  * mark = "-" | "_" | "." | "!" | "~" | "*" | "'" | "(" | ")"
  */
 
-#define IS_MARK(x) (((x) == '-') || ((x) == '_') || ((x) == '.') || \
-((x) == '!') || ((x) == '~') || ((x) == '*') || ((x) == '\'') ||\
+#define IS_MARK(x) (((x) == '-') || ((x) == '_') || ((x) == '.') ||
\
+((x) == '!') || ((x) == '~') || ((x) == '*') || ((x) == '\'') ||   
\
 ((x) == '(') || ((x) == ')'))
 
 /*
  * unwise = "{" | "}" | "|" | "\" | "^" | "`"
  */
 
-#define IS_UNWISE(p)\
-  (((*(p) == '{')) || ((*(p) == '}')) || ((*(p) == '|')) || \
-   ((*(p) == '\\')) || ((*(p) == '^')) || ((*(p) == '[')) ||\
-   ((*(p) == ']')) || ((*(p) == '`')))
+#define IS_UNWISE(p)   
\
+(((*(p) == '{')) || ((*(p) == '}')) || ((*(p) == '|')) ||  
\
+ ((*(p) == '\\')) || ((*(p) == '^')) || ((*(p) == '[')) || 
\
+ ((*(p) == ']')) || ((*(p) == '`')))
 /*
  * reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" | "$" | "," |
  *"[" | "]"
  */
 
-#define IS_RESERVED(x) (((x) == ';') || ((x) == '/') || ((x) == '?') || \
-((x) == ':') || ((x) == '@') || ((x) == '&') || ((x) == '=') || \
-((x) == '+') || ((x) == '$') || ((x) == ',') || ((x) == '[') || \
-((x) == ']'))
+#define IS_RESERVED(x) (((x) == ';') || ((x) == '/') || ((x) == '?') ||
\
+((x) == ':') || ((x) == '@') || ((x) == '&') || ((x) == '=') ||
\
+((x) == '+') || ((x) == '$') || ((x) == ',') || ((x) == '[') ||
\
+((x) == ']'))
 
 /*
  * unreserved = alphanum | mark
@@ -129,7 +128,7 @@ static void uri_clean(URI *uri);
  * Skip to next pointer char, handle escaped sequences
  */
 
-#define NEXT(p) ((*p == '%')? p += 3 : p++)
+#define NEXT(p) ((*p == '%') ? p += 3 : p++)
 
 /*
  * Productions from the spec.
@@ -141,37 +140,36 @@ static void uri_clean(URI *uri);
  * path  = [ abs_path | opaque_part ]
  */
 
-
 /
- * *
- * RFC 3986 parser *
- * *
+ *  *
+ * RFC 3986 parser  *
+ *  *
  /
 
 #define ISA_DIGIT(p) ((*(p) >= '0') && (*(p) <= '9'))
-#define ISA_ALPHA(p) (((*(p) >= 'a') && (*(p) <= 'z')) ||  \
+#define ISA_ALPHA(p) (((*(p) >= 'a') && (*(p) <= 'z')) ||  
\
   ((*(p) >= 'A') && (*(p) <= 'Z')))
-#define ISA_HEXDIG(p)  \
-   (ISA_DIGIT(p) || ((*(p) >= 'a') && (*(p) <= 'f')) ||\
-((*(p) >= 'A') && (*(p) <= 'F')))
+#define ISA_HEXDIG(p)  
\
+(ISA_DIGIT(p) || ((*(p) >= 'a') && (*(p) <= 'f')) ||   
\
+ ((*(p) >= 'A') && (*(p) <= 'F')))
 
 /*
  *sub-delims= "!" / "$" / "&" / "'" / "(" / ")"
  * / "*" / "+" / "," / ";" / "="
  */
-#define ISA_SUB_DELIM(p)   \
-  (((*(p) == '!')) || ((*(p) == '$')) || ((*(p) == '&')) ||
\
-   ((*(p) == '(')) || ((*(p) == ')')) || ((*(p) == '*')) ||
\
-   ((*(p) == '+')) || ((*(p) == ',')) || ((*(p) == ';')) ||
\
-   ((*(p) == '=')) || ((*(p) == '\'')))
+#define ISA_SUB_DELIM(p)   
\
+(((*(p) == '!')) || ((*(p) == '$')) || ((*(p) == '&')) ||  
\
+ ((*(p) == '(')) || ((*(p) == ')')) || ((*(p) == '*')) ||  
\
+ ((*(p) == '+')) || ((*(p) == ',')) || ((*(p) == ';')) ||  
\
+ ((*(p) == '=')) || ((*(p) == '\'')))
 
 /*
  *gen-delims= ":" / "/" / "?" / "#" / "[" / "]" / "@"
  */
-#define ISA_GEN_DELIM(p)   \
-  (((*(p) == ':')) || ((*(p) 

[Qemu-devel] [PATCH v4 RFC 3/3] util/uri.c: wrap single statement blocks with braces {}

2018-02-24 Thread Su Hang
For this patch, using curly braces to wrap `if` `while` `else` statements,
which only hold single statement. For example:
'''
if (cond)
statement;
'''
to
'''
if (cond) {
statement;
}
'''

And using tricks that compare the disassemblies before and after
code changes, to make sure code logic isn't changed:
'''
git checkout master
make util/uri.o
strip util/uri.o
objdump -Drx util/uri.o > /tmp/uri-master.txt
git checkout cleanupbranch
make util/uri.o
strip util/uri.o
objdump -Drx util/uri.o > /tmp/uri-cleanup.txt
diff -u /tmp/uri-*.txt
'''

With that, all complaints raised by checkpatch.pl have been suppressed.  

Suggested-by: Thomas Huth 
Suggested-by: Eric Blake 
Signed-off-by: Su Hang 
---
 util/uri.c | 463 +++--
 1 file changed, 294 insertions(+), 169 deletions(-)

diff --git a/util/uri.c b/util/uri.c
index bb2576cf2190..93ecefdaaf7d 100644
--- a/util/uri.c
+++ b/util/uri.c
@@ -211,16 +211,19 @@ static int rfc3986_parse_scheme(URI *uri, const char 
**str)
 {
 const char *cur;
 
-if (str == NULL)
+if (str == NULL) {
 return -1;
+}
 
 cur = *str;
-if (!ISA_ALPHA(cur))
+if (!ISA_ALPHA(cur)) {
 return 2;
+}
 cur++;
 while (ISA_ALPHA(cur) || ISA_DIGIT(cur) || (*cur == '+') || (*cur == '-') 
||
-   (*cur == '.'))
+   (*cur == '.')) {
 cur++;
+}
 if (uri != NULL) {
 g_free(uri->scheme);
 uri->scheme = g_strndup(*str, cur - *str);
@@ -248,21 +251,24 @@ static int rfc3986_parse_fragment(URI *uri, const char 
**str)
 {
 const char *cur;
 
-if (str == NULL)
+if (str == NULL) {
 return -1;
+}
 
 cur = *str;
 
 while ((ISA_PCHAR(cur)) || (*cur == '/') || (*cur == '?') ||
(*cur == '[') || (*cur == ']') ||
-   ((uri != NULL) && (uri->cleanup & 1) && (IS_UNWISE(cur
+   ((uri != NULL) && (uri->cleanup & 1) && (IS_UNWISE(cur {
 NEXT(cur);
+}
 if (uri != NULL) {
 g_free(uri->fragment);
-if (uri->cleanup & 2)
+if (uri->cleanup & 2) {
 uri->fragment = g_strndup(*str, cur - *str);
-else
+} else {
 uri->fragment = uri_string_unescape(*str, cur - *str, NULL);
+}
 }
 *str = cur;
 return 0;
@@ -283,14 +289,16 @@ static int rfc3986_parse_query(URI *uri, const char **str)
 {
 const char *cur;
 
-if (str == NULL)
+if (str == NULL) {
 return -1;
+}
 
 cur = *str;
 
 while ((ISA_PCHAR(cur)) || (*cur == '/') || (*cur == '?') ||
-   ((uri != NULL) && (uri->cleanup & 1) && (IS_UNWISE(cur
+   ((uri != NULL) && (uri->cleanup & 1) && (IS_UNWISE(cur {
 NEXT(cur);
+}
 if (uri != NULL) {
 g_free(uri->query);
 uri->query = g_strndup(*str, cur - *str);
@@ -351,15 +359,17 @@ static int rfc3986_parse_user_info(URI *uri, const char 
**str)
 
 cur = *str;
 while (ISA_UNRESERVED(cur) || ISA_PCT_ENCODED(cur) || ISA_SUB_DELIM(cur) ||
-   (*cur == ':'))
+   (*cur == ':')) {
 NEXT(cur);
+}
 if (*cur == '@') {
 if (uri != NULL) {
 g_free(uri->user);
-if (uri->cleanup & 2)
+if (uri->cleanup & 2) {
 uri->user = g_strndup(*str, cur - *str);
-else
+} else {
 uri->user = uri_string_unescape(*str, cur - *str, NULL);
+}
 }
 *str = cur;
 return 0;
@@ -385,22 +395,24 @@ static int rfc3986_parse_dec_octet(const char **str)
 {
 const char *cur = *str;
 
-if (!(ISA_DIGIT(cur)))
+if (!(ISA_DIGIT(cur))) {
 return 1;
-if (!ISA_DIGIT(cur + 1))
+}
+if (!ISA_DIGIT(cur + 1)) {
 cur++;
-else if ((*cur != '0') && (ISA_DIGIT(cur + 1)) && (!ISA_DIGIT(cur + 2)))
+} else if ((*cur != '0') && (ISA_DIGIT(cur + 1)) && (!ISA_DIGIT(cur + 2))) 
{
 cur += 2;
-else if ((*cur == '1') && (ISA_DIGIT(cur + 1)) && (ISA_DIGIT(cur + 2)))
+} else if ((*cur == '1') && (ISA_DIGIT(cur + 1)) && (ISA_DIGIT(cur + 2))) {
 cur += 3;
-else if ((*cur == '2') && (*(cur + 1) >= '0') && (*(cur + 1) <= '4') &&
- (ISA_DIGIT(cur + 2)))
+} else if ((*cur == '2') && (*(cur + 1) >= '0') && (*(cur + 1) <= '4') &&
+ (ISA_DIGIT(cur + 2))) {
 cur += 3;
-else if ((*cur == '2') && (*(cur + 1) == '5') && (*(cur + 2) >= '0') &&
- (*(cur + 1) <= '5'))
+} else if ((*cur == '2') && (*(cur + 1) == '5') && (*(cur + 2) >= '0') &&
+ (*(cur + 1) <= '5')) {
 cur += 3;
-else
+} else {
 return 1;
+}
 *str = cur;
 return 0;
 }
@@ -430,10 +442,12 @@ static int rfc3986_parse_host(URI *uri, const char **str)
  */
 if (*cur == '[') {
 cur++;
-while ((*cur != ']') && (*cur != 0))
+  

[Qemu-devel] [PATCH v4 RFC 2/3] util/uri.c: remove brackets that wrap `return` statement's content.

2018-02-24 Thread Su Hang
only remove brackets that wrap `return` statements' content.

use `perl -pi -e "s/return \((.*?)\);/return \1;/g" util/uri.c`
to remove pattern like this: "return (1);"

Signed-off-by: Su Hang 
---
 util/uri.c | 160 ++---
 1 file changed, 80 insertions(+), 80 deletions(-)

diff --git a/util/uri.c b/util/uri.c
index cf09f41735a1..bb2576cf2190 100644
--- a/util/uri.c
+++ b/util/uri.c
@@ -212,11 +212,11 @@ static int rfc3986_parse_scheme(URI *uri, const char 
**str)
 const char *cur;
 
 if (str == NULL)
-return (-1);
+return -1;
 
 cur = *str;
 if (!ISA_ALPHA(cur))
-return (2);
+return 2;
 cur++;
 while (ISA_ALPHA(cur) || ISA_DIGIT(cur) || (*cur == '+') || (*cur == '-') 
||
(*cur == '.'))
@@ -226,7 +226,7 @@ static int rfc3986_parse_scheme(URI *uri, const char **str)
 uri->scheme = g_strndup(*str, cur - *str);
 }
 *str = cur;
-return (0);
+return 0;
 }
 
 /**
@@ -249,7 +249,7 @@ static int rfc3986_parse_fragment(URI *uri, const char 
**str)
 const char *cur;
 
 if (str == NULL)
-return (-1);
+return -1;
 
 cur = *str;
 
@@ -265,7 +265,7 @@ static int rfc3986_parse_fragment(URI *uri, const char 
**str)
 uri->fragment = uri_string_unescape(*str, cur - *str, NULL);
 }
 *str = cur;
-return (0);
+return 0;
 }
 
 /**
@@ -284,7 +284,7 @@ static int rfc3986_parse_query(URI *uri, const char **str)
 const char *cur;
 
 if (str == NULL)
-return (-1);
+return -1;
 
 cur = *str;
 
@@ -296,7 +296,7 @@ static int rfc3986_parse_query(URI *uri, const char **str)
 uri->query = g_strndup(*str, cur - *str);
 }
 *str = cur;
-return (0);
+return 0;
 }
 
 /**
@@ -362,9 +362,9 @@ static int rfc3986_parse_user_info(URI *uri, const char 
**str)
 uri->user = uri_string_unescape(*str, cur - *str, NULL);
 }
 *str = cur;
-return (0);
+return 0;
 }
-return (1);
+return 1;
 }
 
 /**
@@ -386,7 +386,7 @@ static int rfc3986_parse_dec_octet(const char **str)
 const char *cur = *str;
 
 if (!(ISA_DIGIT(cur)))
-return (1);
+return 1;
 if (!ISA_DIGIT(cur + 1))
 cur++;
 else if ((*cur != '0') && (ISA_DIGIT(cur + 1)) && (!ISA_DIGIT(cur + 2)))
@@ -400,9 +400,9 @@ static int rfc3986_parse_dec_octet(const char **str)
  (*(cur + 1) <= '5'))
 cur += 3;
 else
-return (1);
+return 1;
 *str = cur;
-return (0);
+return 0;
 }
 /**
  * rfc3986_parse_host:
@@ -433,7 +433,7 @@ static int rfc3986_parse_host(URI *uri, const char **str)
 while ((*cur != ']') && (*cur != 0))
 cur++;
 if (*cur != ']')
-return (1);
+return 1;
 cur++;
 goto found;
 }
@@ -479,7 +479,7 @@ found:
 uri->server = NULL;
 }
 *str = cur;
-return (0);
+return 0;
 }
 
 /**
@@ -510,15 +510,15 @@ static int rfc3986_parse_authority(URI *uri, const char 
**str)
 cur++;
 ret = rfc3986_parse_host(uri, );
 if (ret != 0)
-return (ret);
+return ret;
 if (*cur == ':') {
 cur++;
 ret = rfc3986_parse_port(uri, );
 if (ret != 0)
-return (ret);
+return ret;
 }
 *str = cur;
-return (0);
+return 0;
 }
 
 /**
@@ -544,13 +544,13 @@ static int rfc3986_parse_segment(const char **str, char 
forbid, int empty)
 cur = *str;
 if (!ISA_PCHAR(cur)) {
 if (empty)
-return (0);
-return (1);
+return 0;
+return 1;
 }
 while (ISA_PCHAR(cur) && (*cur != forbid))
 NEXT(cur);
 *str = cur;
-return (0);
+return 0;
 }
 
 /**
@@ -576,7 +576,7 @@ static int rfc3986_parse_path_ab_empty(URI *uri, const char 
**str)
 cur++;
 ret = rfc3986_parse_segment(, 0, 1);
 if (ret != 0)
-return (ret);
+return ret;
 }
 if (uri != NULL) {
 g_free(uri->path);
@@ -590,7 +590,7 @@ static int rfc3986_parse_path_ab_empty(URI *uri, const char 
**str)
 }
 }
 *str = cur;
-return (0);
+return 0;
 }
 
 /**
@@ -613,7 +613,7 @@ static int rfc3986_parse_path_absolute(URI *uri, const char 
**str)
 cur = *str;
 
 if (*cur != '/')
-return (1);
+return 1;
 cur++;
 ret = rfc3986_parse_segment(, 0, 0);
 if (ret == 0) {
@@ -621,7 +621,7 @@ static int rfc3986_parse_path_absolute(URI *uri, const char 
**str)
 cur++;
 ret = rfc3986_parse_segment(, 0, 1);
 if (ret != 0)
-return (ret);
+return ret;
 }
 }
 if (uri != NULL) {
@@ -636,7 +636,7 @@ static int rfc3986_parse_path_absolute(URI *uri, const char 
**str)
 }
 }
 *str = cur;
-return (0);
+   

[Qemu-devel] [PATCH v4 RFC 0/3] util/uri.c: Coding style format

2018-02-24 Thread Su Hang
*** BLURB HERE ***

Su Hang (3):
  util/uri.c: Coding style check, Only whitespace involved.
  util/uri.c: remove brackets () that wrap `return` statement's content.
  util/uri.c: wrap single statement blocks with braces {}

 util/uri.c | 1753 
 1 file changed, 940 insertions(+), 813 deletions(-)

Using `git diff -w` to make sure that the first patch only contains
whitespace changes, replace all TAB with whitespace.
Here is what I actually use:
'''
[core]
whitespace = -trailing-space,-indent-with-non-tab,-tab-in-indent

git diff -w  --word-diff-regex=[^[:space:]]
'''

For second patch, using
`perl -pi -e "s/return \((.*?)\);/return \1;/g" util/uri.c`
to remove brackets () that wrap `return` statement's content.
Changing patterns like this:
`return (a);` to `return a;`.

For third patch, using curly braces to wrap `if` `while` `else` statements,
which only hold single statement. For example:
'''
if (cond)
statement;
'''
to
'''
if (cond) {
statement;
}
'''

And using tricks that compare the disassemblies before and after
code changes, to make sure code logic isn't changed:
'''
git checkout master
make util/uri.o
strip util/uri.o
objdump -Drx util/uri.o > /tmp/uri-master.txt
git checkout cleanupbranch
make util/uri.o
strip util/uri.o
objdump -Drx util/uri.o > /tmp/uri-cleanup.txt
diff -u /tmp/uri-*.txt
'''

--
2.7.4




[Qemu-devel] [PATCH] HMP: Initialize err before using

2018-02-24 Thread Zhangjixiang
From 295640e6f4aa83b843e245bb1af9995be37de84d Mon Sep 17 00:00:00 2001
From: zhangjixiang 
Date: Sun, 25 Feb 2018 09:47:51 +0800
Subject: [PATCH] HMP: Initialize err before using

When bdrv_snapshot_delete return fail, the errp will not be
assigned a valid value in error_propagate as errp didn't be
initialized in hmp_delvm, then error_reportf_err will use an
uninitialized value(call by hmp_delvm), and qemu crash.

Signed-off-by: zhangjixiang 
---
hmp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hmp.c b/hmp.c
index 7870d6a300..4a4da004e9 100644
--- a/hmp.c
+++ b/hmp.c
@@ -1340,7 +1340,7 @@ void hmp_savevm(Monitor *mon, const QDict *qdict)
void hmp_delvm(Monitor *mon, const QDict *qdict)
{
 BlockDriverState *bs;
-Error *err;
+Error *err = NULL;
 const char *name = qdict_get_str(qdict, "name");
 if (bdrv_all_delete_snapshot(name, , ) < 0) {
--
2.11.0
-
本邮件及其附件含有新华三技术有限公司的保密信息,仅限于发送给上面地址中列出
的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、
或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本
邮件!
This e-mail and its attachments contain confidential information from New H3C, 
which is
intended only for the person or entity whose address is listed above. Any use 
of the
information contained herein in any way (including, but not limited to, total 
or partial
disclosure, reproduction, or dissemination) by persons other than the intended
recipient(s) is prohibited. If you receive this e-mail in error, please notify 
the sender
by phone or email immediately and delete it!


[Qemu-devel] [PATCH v2 RFC] scripts/checkpatch.pl:Add check for `while` and `for`

2018-02-24 Thread Su Hang
Add check for `while` and `for` statement, which condition has more than
one line.

The former checkpatch.pl can check `if` statement, which condition has more
than one line, whether block misses brace round, like this:
'''
if (cond1 ||
cond2)
statement;
'''
But it doesn't do the same check for `for` and `while` statement.

Suggested-by: Eric Blake 
Suggested-by: Thomas Huth 
Signed-off-by: Su Hang 
---
 scripts/checkpatch.pl | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 1b4b812e28fa..7e332135e177 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2353,7 +2353,8 @@ sub process {
}
 
 # check for missing bracing round if etc
-   if ($line =~ /(^.*)\bif\b/ && $line !~ /\#\s*if/) {
+   if ($line =~ /(^.*)\b(if|for|while)\b/ &&
+   $line !~ /\#\s*(if|for|while)/) {
my ($level, $endln, @chunks) =
ctx_statement_full($linenr, $realcnt, 1);
 if ($dbg_adv_apw) {
-- 
2.7.4




Re: [Qemu-devel] [PATCH v4 3/4] softfloat: use floatx80_infinity in softfloat

2018-02-24 Thread Richard Henderson
On 02/24/2018 12:18 PM, Laurent Vivier wrote:
> Since f3218a8 ("softfloat: add floatx80 constants")
> floatx80_infinity is defined but never used.
> 
> This patch updates floatx80 functions to use
> this definition.
> 
> This allows to define a different default Infinity
> value on m68k: the m68k FPU defines infinity with
> all bits set to zero in the mantissa.
> 
> Signed-off-by: Laurent Vivier 
> ---
> CC: Aurelien Jarno 
> v4: fix floatx80_to_int64() to check for NaN, not for infinity
> fix floatx80_is_infinity() to ignore mantissa's MSB
> 
>  fpu/softfloat-specialize.h | 14 ++
>  fpu/softfloat.c| 39 +--
>  include/fpu/softfloat.h| 13 +++--
>  3 files changed, 50 insertions(+), 16 deletions(-)

Reviewed-by: Richard Henderson 


r~



Re: [Qemu-devel] [PATCH v3 0/7] block: Handle null backing link

2018-02-24 Thread no-reply
Hi,

This series failed docker-build@min-glib build test. Please find the testing 
commands and
their output below. If you have Docker installed, you can probably reproduce it
locally.

Type: series
Message-id: 20180224154033.29559-1-mre...@redhat.com
Subject: [Qemu-devel] [PATCH v3 0/7] block: Handle null backing link

=== TEST SCRIPT BEGIN ===
#!/bin/bash
set -e
git submodule update --init dtc
# Let docker tests dump environment info
export SHOW_ENV=1
export J=8
time make docker-test-build@min-glib
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 * [new tag]   patchew/20180224201802.911-1-laur...@vivier.eu -> 
patchew/20180224201802.911-1-laur...@vivier.eu
Switched to a new branch 'test'
ae347da068 block: Deprecate "backing": ""
3342c14431 block: Handle null backing link
84a81f6c30 qapi: Make more of qobject_to()
d4231e47f1 qapi: Remove qobject_to_X() functions
1f269ff09a qapi: Replace qobject_to_X(o) by qobject_to(o, X)
7075fc4b99 qapi: Add qobject_to()
07f4ad1be0 compiler: Add QEMU_BUILD_BUG_MSG() macro

=== OUTPUT BEGIN ===
Submodule 'dtc' (git://git.qemu-project.org/dtc.git) registered for path 'dtc'
Cloning into '/var/tmp/patchew-tester-tmp-v9s3mez6/src/dtc'...
Submodule path 'dtc': checked out 'e54388015af1fb4bf04d0bca99caba1074d9cc42'
  BUILD   min-glib
make[1]: Entering directory '/var/tmp/patchew-tester-tmp-v9s3mez6/src'
  GEN 
/var/tmp/patchew-tester-tmp-v9s3mez6/src/docker-src.2018-02-24-15.29.13.1133/qemu.tar
Cloning into 
'/var/tmp/patchew-tester-tmp-v9s3mez6/src/docker-src.2018-02-24-15.29.13.1133/qemu.tar.vroot'...
done.
Checking out files:  45% (2674/5878)   
Checking out files:  46% (2704/5878)   
Checking out files:  47% (2763/5878)   
Checking out files:  48% (2822/5878)   
Checking out files:  49% (2881/5878)   
Checking out files:  50% (2939/5878)   
Checking out files:  51% (2998/5878)   
Checking out files:  52% (3057/5878)   
Checking out files:  53% (3116/5878)   
Checking out files:  54% (3175/5878)   
Checking out files:  55% (3233/5878)   
Checking out files:  56% (3292/5878)   
Checking out files:  57% (3351/5878)   
Checking out files:  58% (3410/5878)   
Checking out files:  59% (3469/5878)   
Checking out files:  60% (3527/5878)   
Checking out files:  61% (3586/5878)   
Checking out files:  62% (3645/5878)   
Checking out files:  63% (3704/5878)   
Checking out files:  64% (3762/5878)   
Checking out files:  65% (3821/5878)   
Checking out files:  66% (3880/5878)   
Checking out files:  67% (3939/5878)   
Checking out files:  68% (3998/5878)   
Checking out files:  69% (4056/5878)   
Checking out files:  70% (4115/5878)   
Checking out files:  71% (4174/5878)   
Checking out files:  72% (4233/5878)   
Checking out files:  73% (4291/5878)   
Checking out files:  74% (4350/5878)   
Checking out files:  75% (4409/5878)   
Checking out files:  76% (4468/5878)   
Checking out files:  77% (4527/5878)   
Checking out files:  78% (4585/5878)   
Checking out files:  79% (4644/5878)   
Checking out files:  80% (4703/5878)   
Checking out files:  81% (4762/5878)   
Checking out files:  82% (4820/5878)   
Checking out files:  83% (4879/5878)   
Checking out files:  84% (4938/5878)   
Checking out files:  85% (4997/5878)   
Checking out files:  86% (5056/5878)   
Checking out files:  87% (5114/5878)   
Checking out files:  88% (5173/5878)   
Checking out files:  89% (5232/5878)   
Checking out files:  90% (5291/5878)   
Checking out files:  91% (5349/5878)   
Checking out files:  92% (5408/5878)   
Checking out files:  92% (5454/5878)   
Checking out files:  93% (5467/5878)   
Checking out files:  94% (5526/5878)   
Checking out files:  95% (5585/5878)   
Checking out files:  96% (5643/5878)   
Checking out files:  97% (5702/5878)   
Checking out files:  98% (5761/5878)   
Checking out files:  99% (5820/5878)   
Checking out files: 100% (5878/5878)   
Checking out files: 100% (5878/5878), done.
Your branch is up-to-date with 'origin/test'.
Submodule 'dtc' (git://git.qemu-project.org/dtc.git) registered for path 'dtc'
Cloning into 
'/var/tmp/patchew-tester-tmp-v9s3mez6/src/docker-src.2018-02-24-15.29.13.1133/qemu.tar.vroot/dtc'...
Submodule path 'dtc': checked out 'e54388015af1fb4bf04d0bca99caba1074d9cc42'
Submodule 'ui/keycodemapdb' (git://git.qemu.org/keycodemapdb.git) registered 
for path 'ui/keycodemapdb'
Cloning into 
'/var/tmp/patchew-tester-tmp-v9s3mez6/src/docker-src.2018-02-24-15.29.13.1133/qemu.tar.vroot/ui/keycodemapdb'...
Submodule path 'ui/keycodemapdb': checked out 
'6b3d716e2b6472eb7189d3220552280ef3d832ce'
  COPYRUNNER
RUN test-build in qemu:min-glib 
Environment variables:
HOSTNAME=20668db02e12
MAKEFLAGS= -j8
J=8
CCACHE_DIR=/var/tmp/ccache
EXTRA_CONFIGURE_OPTS=
V=
SHOW_ENV=1
PATH=/usr/lib/ccache:/usr/lib64/ccache:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PWD=/
TARGET_LIST=
SHLVL=1
HOME=/root
TEST_DIR=/tmp/qemu-test
FEATURES= dtc
DEBUG=
_=/usr/bin/env


Re: [Qemu-devel] [PATCH v3 6/7] block: Handle null backing link

2018-02-24 Thread Eric Blake

On 02/24/2018 09:40 AM, Max Reitz wrote:

Instead of converting all "backing": null instances into "backing": "",
handle a null value directly in bdrv_open_inherit().

This enables explicitly null backing links for json:{} filenames.

Signed-off-by: Max Reitz 
Reviewed-by: Alberto Garcia 
---
  block.c|  4 +++-
  blockdev.c | 14 --
  tests/qemu-iotests/089 | 20 
  tests/qemu-iotests/089.out |  8 
  4 files changed, 31 insertions(+), 15 deletions(-)



Reviewed-by: Eric Blake 

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.   +1-919-301-3266
Virtualization:  qemu.org | libvirt.org



Re: [Qemu-devel] [PATCH v3 5/7] qapi: Make more of qobject_to()

2018-02-24 Thread Eric Blake

On 02/24/2018 09:40 AM, Max Reitz wrote:

This patch reworks some places which use either qobject_type() checks
plus qobject_to(), where the latter alone is sufficient, or NULL checks
plus qobject_type() checks where we can simply do a qobject_to() != NULL
check.

Signed-off-by: Max Reitz 
Reviewed-by: Alberto Garcia 
---
  qapi/qobject-input-visitor.c |  4 ++--
  qobject/json-parser.c| 13 +++--
  qobject/qdict.c  | 20 +++-
  3 files changed, 20 insertions(+), 17 deletions(-)



Reviewed-by: Eric Blake 

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.   +1-919-301-3266
Virtualization:  qemu.org | libvirt.org



Re: [Qemu-devel] [PATCH v3 4/7] qapi: Remove qobject_to_X() functions

2018-02-24 Thread Eric Blake

On 02/24/2018 09:40 AM, Max Reitz wrote:

They are no longer needed now.

Signed-off-by: Max Reitz 
Reviewed-by: Alberto Garcia 
---
  include/qapi/qmp/qbool.h   |  1 -
  include/qapi/qmp/qdict.h   |  1 -
  include/qapi/qmp/qlist.h   |  1 -
  include/qapi/qmp/qnum.h|  1 -
  include/qapi/qmp/qstring.h |  1 -
  qobject/qbool.c| 11 ---
  qobject/qdict.c| 11 ---
  qobject/qlist.c| 11 ---
  qobject/qnum.c | 11 ---
  qobject/qstring.c  | 11 ---
  10 files changed, 60 deletions(-)


Reviewed-by: Eric Blake 

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.   +1-919-301-3266
Virtualization:  qemu.org | libvirt.org



Re: [Qemu-devel] [PATCH v3 3/7] qapi: Replace qobject_to_X(o) by qobject_to(o, X)

2018-02-24 Thread Eric Blake

On 02/24/2018 09:40 AM, Max Reitz wrote:

This patch was generated using the following Coccinelle script:




and a bit of manual fix-up for overly long lines and three places in
tests/check-qjson.c that Coccinelle did not find.

Signed-off-by: Max Reitz 
Reviewed-by: Alberto Garcia 
---



diff --git a/block.c b/block.c
index 814e5a02da..cb69fd7ae4 100644
--- a/block.c
+++ b/block.c
@@ -1457,7 +1457,7 @@ static QDict *parse_json_filename(const char *filename, 
Error **errp)
  return NULL;
  }
  
-options = qobject_to_qdict(options_obj);

+options = qobject_to(options_obj, QDict);


Bikeshedding - would it read any easier as:

options = qobject_to(QDict, options_obj);

?  If so, your Coccinelle script can be touched up, and patch 2/7 swaps 
argument order around, so it would be tolerable but still slightly 
busywork to regenerate the series.  But I'm not strongly attached to 
either order, and so I'm also willing to take this as-is (especially 
since that's less work), if no one else has a strong opinion that 
swapping order would aid legibility.


Reviewed-by: Eric Blake 



+++ b/block/rbd.c
@@ -256,14 +256,14 @@ static int qemu_rbd_set_keypairs(rados_t cluster, const 
char *keypairs_json,
  if (!keypairs_json) {
  return ret;
  }
-keypairs = qobject_to_qlist(qobject_from_json(keypairs_json,
-  _abort));
+keypairs = qobject_to(qobject_from_json(keypairs_json, _abort),
+  QList);


The question about legibility gets a bit more obvious when you span lines.


@@ -893,8 +893,9 @@ static void simple_number(void)
  QNum *qnum;
  int64_t val;
  
-qnum = qobject_to_qnum(qobject_from_json(test_cases[i].encoded,

- _abort));
+qnum = qobject_to(qobject_from_json(test_cases[i].encoded,
+_abort),
+  QNum);


--
Eric Blake, Principal Software Engineer
Red Hat, Inc.   +1-919-301-3266
Virtualization:  qemu.org | libvirt.org



Re: [Qemu-devel] [PATCH v3 2/7] qapi: Add qobject_to()

2018-02-24 Thread Eric Blake

On 02/24/2018 09:40 AM, Max Reitz wrote:

This is a dynamic casting macro that, given a QObject type, returns an
object as that type or NULL if the object is of a different type (or
NULL itself).

The macro uses lower-case letters because:
1. There does not seem to be a hard rule on whether qemu macros have to
be upper-cased,
2. The current situation in qapi/qmp is inconsistent (compare e.g.
QINCREF() vs. qdict_put()),
3. qobject_to() will evaluate its @obj parameter only once, thus it is
generally not important to the caller whether it is a macro or not,
4. I prefer it aesthetically.

Signed-off-by: Max Reitz 
---
  include/qapi/qmp/qobject.h | 30 ++
  1 file changed, 30 insertions(+)




+++ b/include/qapi/qmp/qobject.h
@@ -50,6 +50,22 @@ struct QObject {
  #define QDECREF(obj)  \
  qobject_decref(obj ? QOBJECT(obj) : NULL)
  
+/* Required for qobject_to() */

+#define QTYPE_CAST_TO_QNull QTYPE_QNULL
+#define QTYPE_CAST_TO_QNum  QTYPE_QNUM
+#define QTYPE_CAST_TO_QString   QTYPE_QSTRING
+#define QTYPE_CAST_TO_QDict QTYPE_QDICT
+#define QTYPE_CAST_TO_QList QTYPE_QLIST
+#define QTYPE_CAST_TO_QBool QTYPE_QBOOL
+
+QEMU_BUILD_BUG_MSG(QTYPE__MAX != 7,
+   "The QTYPE_CAST_TO_* list needs to be extended");
+
+#define qobject_to(obj, type) \
+container_of(qobject_check_type(obj, glue(QTYPE_CAST_TO_, type)) ?: \
+ QOBJECT((type *)NULL), \


I guess the third (second?) branch of the ternary is written this way, 
rather than the simpler 'NULL', to ensure that 'type' is still something 
that can have the QOBJECT() macro applied to it?  Should be okay.



+ type, base)
+


Reviewed-by: Eric Blake 

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.   +1-919-301-3266
Virtualization:  qemu.org | libvirt.org



Re: [Qemu-devel] [PATCH v3 0/7] block: Handle null backing link

2018-02-24 Thread no-reply
Hi,

This series failed docker-quick@centos6 build test. Please find the testing 
commands and
their output below. If you have Docker installed, you can probably reproduce it
locally.

Type: series
Message-id: 20180224154033.29559-1-mre...@redhat.com
Subject: [Qemu-devel] [PATCH v3 0/7] block: Handle null backing link

=== TEST SCRIPT BEGIN ===
#!/bin/bash
set -e
git submodule update --init dtc
# Let docker tests dump environment info
export SHOW_ENV=1
export J=8
time make docker-test-quick@centos6
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
ae347da068 block: Deprecate "backing": ""
3342c14431 block: Handle null backing link
84a81f6c30 qapi: Make more of qobject_to()
d4231e47f1 qapi: Remove qobject_to_X() functions
1f269ff09a qapi: Replace qobject_to_X(o) by qobject_to(o, X)
7075fc4b99 qapi: Add qobject_to()
07f4ad1be0 compiler: Add QEMU_BUILD_BUG_MSG() macro

=== OUTPUT BEGIN ===
Submodule 'dtc' (git://git.qemu-project.org/dtc.git) registered for path 'dtc'
Cloning into '/var/tmp/patchew-tester-tmp-li_k8n_s/src/dtc'...
Submodule path 'dtc': checked out 'e54388015af1fb4bf04d0bca99caba1074d9cc42'
  BUILD   centos6
make[1]: Entering directory '/var/tmp/patchew-tester-tmp-li_k8n_s/src'
  GEN 
/var/tmp/patchew-tester-tmp-li_k8n_s/src/docker-src.2018-02-24-15.18.28.15352/qemu.tar
Cloning into 
'/var/tmp/patchew-tester-tmp-li_k8n_s/src/docker-src.2018-02-24-15.18.28.15352/qemu.tar.vroot'...
done.
Checking out files:  48% (2827/5878)   
Checking out files:  49% (2881/5878)   
Checking out files:  50% (2939/5878)   
Checking out files:  51% (2998/5878)   
Checking out files:  52% (3057/5878)   
Checking out files:  53% (3116/5878)   
Checking out files:  54% (3175/5878)   
Checking out files:  55% (3233/5878)   
Checking out files:  56% (3292/5878)   
Checking out files:  57% (3351/5878)   
Checking out files:  58% (3410/5878)   
Checking out files:  59% (3469/5878)   
Checking out files:  60% (3527/5878)   
Checking out files:  61% (3586/5878)   
Checking out files:  62% (3645/5878)   
Checking out files:  63% (3704/5878)   
Checking out files:  64% (3762/5878)   
Checking out files:  65% (3821/5878)   
Checking out files:  66% (3880/5878)   
Checking out files:  67% (3939/5878)   
Checking out files:  68% (3998/5878)   
Checking out files:  69% (4056/5878)   
Checking out files:  70% (4115/5878)   
Checking out files:  71% (4174/5878)   
Checking out files:  72% (4233/5878)   
Checking out files:  73% (4291/5878)   
Checking out files:  74% (4350/5878)   
Checking out files:  75% (4409/5878)   
Checking out files:  76% (4468/5878)   
Checking out files:  77% (4527/5878)   
Checking out files:  78% (4585/5878)   
Checking out files:  79% (4644/5878)   
Checking out files:  80% (4703/5878)   
Checking out files:  81% (4762/5878)   
Checking out files:  82% (4820/5878)   
Checking out files:  83% (4879/5878)   
Checking out files:  84% (4938/5878)   
Checking out files:  85% (4997/5878)   
Checking out files:  86% (5056/5878)   
Checking out files:  87% (5114/5878)   
Checking out files:  88% (5173/5878)   
Checking out files:  89% (5232/5878)   
Checking out files:  90% (5291/5878)   
Checking out files:  91% (5349/5878)   
Checking out files:  92% (5408/5878)   
Checking out files:  93% (5467/5878)   
Checking out files:  94% (5526/5878)   
Checking out files:  95% (5585/5878)   
Checking out files:  96% (5643/5878)   
Checking out files:  97% (5702/5878)   
Checking out files:  98% (5761/5878)   
Checking out files:  99% (5820/5878)   
Checking out files: 100% (5878/5878)   
Checking out files: 100% (5878/5878), done.
Your branch is up-to-date with 'origin/test'.
Submodule 'dtc' (git://git.qemu-project.org/dtc.git) registered for path 'dtc'
Cloning into 
'/var/tmp/patchew-tester-tmp-li_k8n_s/src/docker-src.2018-02-24-15.18.28.15352/qemu.tar.vroot/dtc'...
Submodule path 'dtc': checked out 'e54388015af1fb4bf04d0bca99caba1074d9cc42'
Submodule 'ui/keycodemapdb' (git://git.qemu.org/keycodemapdb.git) registered 
for path 'ui/keycodemapdb'
Cloning into 
'/var/tmp/patchew-tester-tmp-li_k8n_s/src/docker-src.2018-02-24-15.18.28.15352/qemu.tar.vroot/ui/keycodemapdb'...
Submodule path 'ui/keycodemapdb': checked out 
'6b3d716e2b6472eb7189d3220552280ef3d832ce'
  COPYRUNNER
RUN test-quick in qemu:centos6 
Packages installed:
SDL-devel-1.2.14-7.el6_7.1.x86_64
bison-2.4.1-5.el6.x86_64
bzip2-devel-1.0.5-7.el6_0.x86_64
ccache-3.1.6-2.el6.x86_64
csnappy-devel-0-6.20150729gitd7bc683.el6.x86_64
flex-2.5.35-9.el6.x86_64
gcc-4.4.7-18.el6.x86_64
gettext-0.17-18.el6.x86_64
git-1.7.1-9.el6_9.x86_64
glib2-devel-2.28.8-9.el6.x86_64
libepoxy-devel-1.2-3.el6.x86_64
libfdt-devel-1.4.0-1.el6.x86_64
librdmacm-devel-1.0.21-0.el6.x86_64
lzo-devel-2.03-3.1.el6_5.1.x86_64
make-3.81-23.el6.x86_64
mesa-libEGL-devel-11.0.7-4.el6.x86_64
mesa-libgbm-devel-11.0.7-4.el6.x86_64
package g++ is not installed
pixman-devel-0.32.8-1.el6.x86_64
spice-glib-devel-0.26-8.el6.x86_64

[Qemu-devel] [PATCH v4 1/4] softfloat: export some functions

2018-02-24 Thread Laurent Vivier
Move fpu/softfloat-macros.h to include/fpu/

Export floatx80 functions to be used by target floatx80
specific implementations.

Exports:
  propagateFloatx80NaN(), extractFloatx80Frac(),
  extractFloatx80Exp(), extractFloatx80Sign(),
  normalizeFloatx80Subnormal(), packFloatx80(),
  roundAndPackFloatx80(), normalizeRoundAndPackFloatx80()

Also exports packFloat32() that will be used to implement
m68k fsinh, fcos, fsin, ftan operations.

Signed-off-by: Laurent Vivier 
Reviewed-by: Richard Henderson 
---
CC: Aurelien Jarno 
CC: Alex Bennée 
CC: Peter Maydell 

 fpu/softfloat-specialize.h  |   3 +-
 fpu/softfloat.c |  91 +++-
 {fpu => include/fpu}/softfloat-macros.h |  10 +--
 include/fpu/softfloat.h | 120 
 4 files changed, 136 insertions(+), 88 deletions(-)
 rename {fpu => include/fpu}/softfloat-macros.h (98%)

diff --git a/fpu/softfloat-specialize.h b/fpu/softfloat-specialize.h
index e81ca001e1..46126e9e0a 100644
--- a/fpu/softfloat-specialize.h
+++ b/fpu/softfloat-specialize.h
@@ -1011,8 +1011,7 @@ static floatx80 commonNaNToFloatx80(commonNaNT a, 
float_status *status)
 | `b' is a signaling NaN, the invalid exception is raised.
 **/
 
-static floatx80 propagateFloatx80NaN(floatx80 a, floatx80 b,
- float_status *status)
+floatx80 propagateFloatx80NaN(floatx80 a, floatx80 b, float_status *status)
 {
 flag aIsQuietNaN, aIsSignalingNaN, bIsQuietNaN, bIsSignalingNaN;
 flag aIsLargerSignificand;
diff --git a/fpu/softfloat.c b/fpu/softfloat.c
index e7fb0d357a..fb4853682e 100644
--- a/fpu/softfloat.c
+++ b/fpu/softfloat.c
@@ -93,7 +93,7 @@ this code that are retained.
 | division and square root approximations.  (Can be specialized to target if
 | desired.)
 **/
-#include "softfloat-macros.h"
+#include "fpu/softfloat-macros.h"
 
 /*
 | Functions and definitions to determine:  (1) whether tininess for underflow
@@ -2192,25 +2192,6 @@ static void
 
 }
 
-/*
-| Packs the sign `zSign', exponent `zExp', and significand `zSig' into a
-| single-precision floating-point value, returning the result.  After being
-| shifted into the proper positions, the three fields are simply added
-| together to form the result.  This means that any integer portion of `zSig'
-| will be added into the exponent.  Since a properly normalized significand
-| will have an integer portion equal to 1, the `zExp' input should be 1 less
-| than the desired result exponent whenever `zSig' is a complete, normalized
-| significand.
-**/
-
-static inline float32 packFloat32(flag zSign, int zExp, uint32_t zSig)
-{
-
-return make_float32(
-  ( ( (uint32_t) zSign )<<31 ) + ( ( (uint32_t) zExp )<<23 ) + zSig);
-
-}
-
 /*
 | Takes an abstract floating-point value having sign `zSign', exponent `zExp',
 | and significand `zSig', and returns the proper single-precision floating-
@@ -2490,42 +2471,6 @@ static float64
 
 }
 
-/*
-| Returns the fraction bits of the extended double-precision floating-point
-| value `a'.
-**/
-
-static inline uint64_t extractFloatx80Frac( floatx80 a )
-{
-
-return a.low;
-
-}
-
-/*
-| Returns the exponent bits of the extended double-precision floating-point
-| value `a'.
-**/
-
-static inline int32_t extractFloatx80Exp( floatx80 a )
-{
-
-return a.high & 0x7FFF;
-
-}
-
-/*
-| Returns the sign bit of the extended double-precision floating-point value
-| `a'.
-**/
-
-static inline flag extractFloatx80Sign( floatx80 a )
-{
-
-return a.high>>15;
-
-}
-
 /*
 | Normalizes the subnormal extended double-precision floating-point value
 | represented by the denormalized significand `aSig'.  The normalized exponent
@@ -2533,30 +2478,14 @@ static inline flag extractFloatx80Sign( floatx80 a )
 | `zSigPtr', respectively.
 

[Qemu-devel] [PATCH v4 3/4] softfloat: use floatx80_infinity in softfloat

2018-02-24 Thread Laurent Vivier
Since f3218a8 ("softfloat: add floatx80 constants")
floatx80_infinity is defined but never used.

This patch updates floatx80 functions to use
this definition.

This allows to define a different default Infinity
value on m68k: the m68k FPU defines infinity with
all bits set to zero in the mantissa.

Signed-off-by: Laurent Vivier 
---
CC: Aurelien Jarno 
v4: fix floatx80_to_int64() to check for NaN, not for infinity
fix floatx80_is_infinity() to ignore mantissa's MSB

 fpu/softfloat-specialize.h | 14 ++
 fpu/softfloat.c| 39 +--
 include/fpu/softfloat.h| 13 +++--
 3 files changed, 50 insertions(+), 16 deletions(-)

diff --git a/fpu/softfloat-specialize.h b/fpu/softfloat-specialize.h
index 46126e9e0a..9ccb59422c 100644
--- a/fpu/softfloat-specialize.h
+++ b/fpu/softfloat-specialize.h
@@ -177,6 +177,20 @@ floatx80 floatx80_default_nan(float_status *status)
 return r;
 }
 
+/*
+| The pattern for a default generated extended double-precision inf.
+**/
+
+#define floatx80_infinity_high 0x7FFF
+#if defined(TARGET_M68K)
+#define floatx80_infinity_low  LIT64(0x)
+#else
+#define floatx80_infinity_low  LIT64(0x8000)
+#endif
+
+const floatx80 floatx80_infinity
+= make_floatx80_init(floatx80_infinity_high, floatx80_infinity_low);
+
 /*
 | The pattern for a default generated quadruple-precision NaN.
 **/
diff --git a/fpu/softfloat.c b/fpu/softfloat.c
index fb4853682e..e124df9f7e 100644
--- a/fpu/softfloat.c
+++ b/fpu/softfloat.c
@@ -2636,7 +2636,9 @@ floatx80 roundAndPackFloatx80(int8_t roundingPrecision, 
flag zSign,
) {
 return packFloatx80( zSign, 0x7FFE, ~ roundMask );
 }
-return packFloatx80( zSign, 0x7FFF, LIT64( 0x8000 ) );
+return packFloatx80(zSign,
+floatx80_infinity_high,
+floatx80_infinity_low);
 }
 if ( zExp <= 0 ) {
 isTiny =
@@ -3182,7 +3184,9 @@ floatx80 float32_to_floatx80(float32 a, float_status 
*status)
 if (aSig) {
 return commonNaNToFloatx80(float32ToCommonNaN(a, status), status);
 }
-return packFloatx80( aSign, 0x7FFF, LIT64( 0x8000 ) );
+return packFloatx80(aSign,
+floatx80_infinity_high,
+floatx80_infinity_low);
 }
 if ( aExp == 0 ) {
 if ( aSig == 0 ) return packFloatx80( aSign, 0, 0 );
@@ -4037,7 +4041,9 @@ floatx80 float64_to_floatx80(float64 a, float_status 
*status)
 if (aSig) {
 return commonNaNToFloatx80(float64ToCommonNaN(a, status), status);
 }
-return packFloatx80( aSign, 0x7FFF, LIT64( 0x8000 ) );
+return packFloatx80(aSign,
+floatx80_infinity_high,
+floatx80_infinity_low);
 }
 if ( aExp == 0 ) {
 if ( aSig == 0 ) return packFloatx80( aSign, 0, 0 );
@@ -4549,10 +4555,7 @@ int64_t floatx80_to_int64(floatx80 a, float_status 
*status)
 if ( shiftCount <= 0 ) {
 if ( shiftCount ) {
 float_raise(float_flag_invalid, status);
-if (! aSign
- || (( aExp == 0x7FFF )
-  && ( aSig != LIT64( 0x8000 ) ) )
-   ) {
+if (!aSign || floatx80_is_any_nan(a)) {
 return LIT64( 0x7FFF );
 }
 return (int64_t) LIT64( 0x8000 );
@@ -4858,7 +4861,9 @@ static floatx80 addFloatx80Sigs(floatx80 a, floatx80 b, 
flag zSign,
 if ((uint64_t)(bSig << 1)) {
 return propagateFloatx80NaN(a, b, status);
 }
-return packFloatx80( zSign, 0x7FFF, LIT64( 0x8000 ) );
+return packFloatx80(zSign,
+floatx80_infinity_high,
+floatx80_infinity_low);
 }
 if ( aExp == 0 ) ++expDiff;
 shift64ExtraRightJamming( aSig, 0, - expDiff, ,  );
@@ -4933,7 +4938,8 @@ static floatx80 subFloatx80Sigs(floatx80 a, floatx80 b, 
flag zSign,
 if ((uint64_t)(bSig << 1)) {
 return propagateFloatx80NaN(a, b, status);
 }
-return packFloatx80( zSign ^ 1, 0x7FFF, LIT64( 0x8000 ) );
+return packFloatx80(zSign ^ 1, floatx80_infinity_high,
+floatx80_infinity_low);
 }
 if ( aExp == 0 ) ++expDiff;
 shift128RightJamming( aSig, 0, - expDiff, ,  );
@@ -5038,7 

[Qemu-devel] [PATCH v4 4/4] target/m68k: add fscale, fgetman and fgetexp

2018-02-24 Thread Laurent Vivier
Using local m68k floatx80_getman(), floatx80_getexp(), floatx80_scale()
[copied from previous:
Written by Andreas Grabher for Previous, NeXT Computer Emulator.]

Signed-off-by: Laurent Vivier 
Reviewed-by: Richard Henderson 
---
 target/m68k/fpu_helper.c |  15 +
 target/m68k/helper.h |   3 +
 target/m68k/softfloat.c  | 144 +++
 target/m68k/softfloat.h  |   3 +
 target/m68k/translate.c  |   9 +++
 5 files changed, 174 insertions(+)

diff --git a/target/m68k/fpu_helper.c b/target/m68k/fpu_helper.c
index 8286228b81..cdb9b50462 100644
--- a/target/m68k/fpu_helper.c
+++ b/target/m68k/fpu_helper.c
@@ -542,3 +542,18 @@ void HELPER(frem)(CPUM68KState *env, FPReg *res, FPReg 
*val0, FPReg *val1)
 
 make_quotient(env, res->d);
 }
+
+void HELPER(fgetexp)(CPUM68KState *env, FPReg *res, FPReg *val)
+{
+res->d = floatx80_getexp(val->d, >fp_status);
+}
+
+void HELPER(fgetman)(CPUM68KState *env, FPReg *res, FPReg *val)
+{
+res->d = floatx80_getman(val->d, >fp_status);
+}
+
+void HELPER(fscale)(CPUM68KState *env, FPReg *res, FPReg *val0, FPReg *val1)
+{
+res->d = floatx80_scale(val1->d, val0->d, >fp_status);
+}
diff --git a/target/m68k/helper.h b/target/m68k/helper.h
index 76a0590c9c..c348dced3a 100644
--- a/target/m68k/helper.h
+++ b/target/m68k/helper.h
@@ -65,6 +65,9 @@ DEF_HELPER_3(fmovemd_st_postinc, i32, env, i32, i32)
 DEF_HELPER_3(fmovemd_ld_postinc, i32, env, i32, i32)
 DEF_HELPER_4(fmod, void, env, fp, fp, fp)
 DEF_HELPER_4(frem, void, env, fp, fp, fp)
+DEF_HELPER_3(fgetexp, void, env, fp, fp)
+DEF_HELPER_3(fgetman, void, env, fp, fp)
+DEF_HELPER_4(fscale, void, env, fp, fp, fp)
 
 DEF_HELPER_3(mac_move, void, env, i32, i32)
 DEF_HELPER_3(macmulf, i64, env, i32, i32)
diff --git a/target/m68k/softfloat.c b/target/m68k/softfloat.c
index 8c77757b4e..9cb141900c 100644
--- a/target/m68k/softfloat.c
+++ b/target/m68k/softfloat.c
@@ -22,6 +22,19 @@
 #include "softfloat.h"
 #include "fpu/softfloat-macros.h"
 
+static floatx80 propagateFloatx80NaNOneArg(floatx80 a, float_status *status)
+{
+if (floatx80_is_signaling_nan(a, status)) {
+float_raise(float_flag_invalid, status);
+}
+
+if (status->default_nan_mode) {
+return floatx80_default_nan(status);
+}
+
+return floatx80_maybe_silence_nan(a, status);
+}
+
 /*
  | Returns the modulo remainder of the extended double-precision floating-point
  | value `a' with respect to the corresponding value `b'.
@@ -103,3 +116,134 @@ floatx80 floatx80_mod(floatx80 a, floatx80 b, 
float_status *status)
 normalizeRoundAndPackFloatx80(
 80, zSign, bExp + expDiff, aSig0, aSig1, status);
 }
+
+/*
+ | Returns the mantissa of the extended double-precision floating-point
+ | value `a'.
+ 
**/
+
+floatx80 floatx80_getman(floatx80 a, float_status *status)
+{
+flag aSign;
+int32_t aExp;
+uint64_t aSig;
+
+aSig = extractFloatx80Frac(a);
+aExp = extractFloatx80Exp(a);
+aSign = extractFloatx80Sign(a);
+
+if (aExp == 0x7FFF) {
+if ((uint64_t) (aSig << 1)) {
+return propagateFloatx80NaNOneArg(a , status);
+}
+float_raise(float_flag_invalid , status);
+return floatx80_default_nan(status);
+}
+
+if (aExp == 0) {
+if (aSig == 0) {
+return packFloatx80(aSign, 0, 0);
+}
+normalizeFloatx80Subnormal(aSig, , );
+}
+
+return roundAndPackFloatx80(status->floatx80_rounding_precision, aSign,
+0x3FFF, aSig, 0, status);
+}
+
+/*
+ | Returns the exponent of the extended double-precision floating-point
+ | value `a' as an extended double-precision value.
+ 
**/
+
+floatx80 floatx80_getexp(floatx80 a, float_status *status)
+{
+flag aSign;
+int32_t aExp;
+uint64_t aSig;
+
+aSig = extractFloatx80Frac(a);
+aExp = extractFloatx80Exp(a);
+aSign = extractFloatx80Sign(a);
+
+if (aExp == 0x7FFF) {
+if ((uint64_t) (aSig << 1)) {
+return propagateFloatx80NaNOneArg(a , status);
+}
+float_raise(float_flag_invalid , status);
+return floatx80_default_nan(status);
+}
+
+if (aExp == 0) {
+if (aSig == 0) {
+return packFloatx80(aSign, 0, 0);
+}
+normalizeFloatx80Subnormal(aSig, , );
+}
+
+return int32_to_floatx80(aExp - 0x3FFF, status);
+}
+
+/*
+ | Scales extended double-precision floating-point value in operand `a' by
+ | value `b'. The 

[Qemu-devel] [PATCH v4 2/4] target/m68k: add fmod/frem

2018-02-24 Thread Laurent Vivier
Using a local m68k floatx80_mod()
[copied from previous:
Written by Andreas Grabher for Previous, NeXT Computer Emulator.]

The quotient byte of the FPSR is updated with
the result of the operation.

Signed-off-by: Laurent Vivier 
Reviewed-by: Richard Henderson 
---
 target/m68k/Makefile.objs |   3 +-
 target/m68k/cpu.h |   1 +
 target/m68k/fpu_helper.c  |  35 +++-
 target/m68k/helper.h  |   2 +
 target/m68k/softfloat.c   | 105 ++
 target/m68k/softfloat.h   |  26 
 target/m68k/translate.c   |   6 +++
 7 files changed, 176 insertions(+), 2 deletions(-)
 create mode 100644 target/m68k/softfloat.c
 create mode 100644 target/m68k/softfloat.h

diff --git a/target/m68k/Makefile.objs b/target/m68k/Makefile.objs
index d143f20270..ac61948676 100644
--- a/target/m68k/Makefile.objs
+++ b/target/m68k/Makefile.objs
@@ -1,4 +1,5 @@
 obj-y += m68k-semi.o
-obj-y += translate.o op_helper.o helper.o cpu.o fpu_helper.o
+obj-y += translate.o op_helper.o helper.o cpu.o
+obj-y += fpu_helper.o softfloat.o
 obj-y += gdbstub.o
 obj-$(CONFIG_SOFTMMU) += monitor.o
diff --git a/target/m68k/cpu.h b/target/m68k/cpu.h
index 65f4fb95cb..2259bf22dc 100644
--- a/target/m68k/cpu.h
+++ b/target/m68k/cpu.h
@@ -427,6 +427,7 @@ typedef enum {
 /* Quotient */
 
 #define FPSR_QT_MASK  0x00ff
+#define FPSR_QT_SHIFT 16
 
 /* Floating-Point Control Register */
 /* Rounding mode */
diff --git a/target/m68k/fpu_helper.c b/target/m68k/fpu_helper.c
index 3c5a82aaa0..8286228b81 100644
--- a/target/m68k/fpu_helper.c
+++ b/target/m68k/fpu_helper.c
@@ -23,7 +23,7 @@
 #include "exec/helper-proto.h"
 #include "exec/exec-all.h"
 #include "exec/cpu_ldst.h"
-#include "fpu/softfloat.h"
+#include "softfloat.h"
 
 /* Undefined offsets may be different on various FPU.
  * On 68040 they return 0.0 (floatx80_zero)
@@ -509,3 +509,36 @@ uint32_t HELPER(fmovemd_ld_postinc)(CPUM68KState *env, 
uint32_t addr,
 {
 return fmovem_postinc(env, addr, mask, cpu_ld_float64_ra);
 }
+
+static void make_quotient(CPUM68KState *env, floatx80 val)
+{
+int32_t quotient;
+int sign;
+
+if (floatx80_is_any_nan(val)) {
+return;
+}
+
+quotient = floatx80_to_int32(val, >fp_status);
+sign = quotient < 0;
+if (sign) {
+quotient = -quotient;
+}
+
+quotient = (sign << 7) | (quotient & 0x7f);
+env->fpsr = (env->fpsr & ~FPSR_QT_MASK) | (quotient << FPSR_QT_SHIFT);
+}
+
+void HELPER(fmod)(CPUM68KState *env, FPReg *res, FPReg *val0, FPReg *val1)
+{
+res->d = floatx80_mod(val1->d, val0->d, >fp_status);
+
+make_quotient(env, res->d);
+}
+
+void HELPER(frem)(CPUM68KState *env, FPReg *res, FPReg *val0, FPReg *val1)
+{
+res->d = floatx80_rem(val1->d, val0->d, >fp_status);
+
+make_quotient(env, res->d);
+}
diff --git a/target/m68k/helper.h b/target/m68k/helper.h
index 7f400f0def..76a0590c9c 100644
--- a/target/m68k/helper.h
+++ b/target/m68k/helper.h
@@ -63,6 +63,8 @@ DEF_HELPER_3(fmovemx_ld_postinc, i32, env, i32, i32)
 DEF_HELPER_3(fmovemd_st_predec, i32, env, i32, i32)
 DEF_HELPER_3(fmovemd_st_postinc, i32, env, i32, i32)
 DEF_HELPER_3(fmovemd_ld_postinc, i32, env, i32, i32)
+DEF_HELPER_4(fmod, void, env, fp, fp, fp)
+DEF_HELPER_4(frem, void, env, fp, fp, fp)
 
 DEF_HELPER_3(mac_move, void, env, i32, i32)
 DEF_HELPER_3(macmulf, i64, env, i32, i32)
diff --git a/target/m68k/softfloat.c b/target/m68k/softfloat.c
new file mode 100644
index 00..8c77757b4e
--- /dev/null
+++ b/target/m68k/softfloat.c
@@ -0,0 +1,105 @@
+/*
+ * Ported from a work by Andreas Grabher for Previous, NeXT Computer Emulator,
+ * derived from NetBSD M68040 FPSP functions,
+ * derived from release 2a of the SoftFloat IEC/IEEE Floating-point Arithmetic
+ * Package. Those parts of the code (and some later contributions) are
+ * provided under that license, as detailed below.
+ * It has subsequently been modified by contributors to the QEMU Project,
+ * so some portions are provided under:
+ *  the SoftFloat-2a license
+ *  the BSD license
+ *  GPL-v2-or-later
+ *
+ * Any future contributions to this file will be taken to be licensed under
+ * the Softfloat-2a license unless specifically indicated otherwise.
+ */
+
+/* Portions of this work are licensed under the terms of the GNU GPL,
+ * version 2 or later. See the COPYING file in the top-level directory.
+ */
+
+#include "qemu/osdep.h"
+#include "softfloat.h"
+#include "fpu/softfloat-macros.h"
+
+/*
+ | Returns the modulo remainder of the extended double-precision floating-point
+ | value `a' with respect to the corresponding value `b'.
+ 
**/
+
+floatx80 floatx80_mod(floatx80 a, floatx80 b, float_status *status)
+{
+flag aSign, zSign;
+int32_t aExp, bExp, expDiff;
+uint64_t aSig0, aSig1, bSig;
+uint64_t 

[Qemu-devel] [PATCH v4 0/4] target/m68k: implement 680x0 FPU (part 3)

2018-02-24 Thread Laurent Vivier
Implement fmod, frem, fscale, fgetman and fgetexp.

Instead of using functions of libm (v1 of this series)
and converting between host long double and floatx80 type
the new version (v2) adds new floatx80 functions in softfloat.

All the floatx80 functions are copied from "Previous",
the NeXT Computer Emulator, and written by Andreas Grabher.

v4: fix floatx80_to_int64() to check for NaN, not for infinity
fix floatx80_is_infinity() to ignore mantissa's MSB

v3: Move all new functions to target/m68k/softfloat.c
Exports needed functions from fpu/softfloat.c

Laurent Vivier (4):
  softfloat: export some functions
  target/m68k: add fmod/frem
  softfloat: use floatx80_infinity in softfloat
  target/m68k: add fscale, fgetman and fgetexp

 fpu/softfloat-specialize.h  |  17 ++-
 fpu/softfloat.c | 130 +
 {fpu => include/fpu}/softfloat-macros.h |  10 +-
 include/fpu/softfloat.h | 133 -
 target/m68k/Makefile.objs   |   3 +-
 target/m68k/cpu.h   |   1 +
 target/m68k/fpu_helper.c|  50 ++-
 target/m68k/helper.h|   5 +
 target/m68k/softfloat.c | 249 
 target/m68k/softfloat.h |  29 
 target/m68k/translate.c |  15 ++
 11 files changed, 536 insertions(+), 106 deletions(-)
 rename {fpu => include/fpu}/softfloat-macros.h (98%)
 create mode 100644 target/m68k/softfloat.c
 create mode 100644 target/m68k/softfloat.h

-- 
2.14.3




Re: [Qemu-devel] [PATCH v3 1/7] compiler: Add QEMU_BUILD_BUG_MSG() macro

2018-02-24 Thread Eric Blake

On 02/24/2018 09:40 AM, Max Reitz wrote:

_Static_assert() allows us to specify messages, and that may come in
handy.  Even without _Static_assert(), encouraging developers to put a
helpful message next to the QEMU_BUILD_BUG_* may make debugging easier
whenever it breaks.

Signed-off-by: Max Reitz 
---
  include/qemu/compiler.h | 12 +---
  1 file changed, 9 insertions(+), 3 deletions(-)



Reviewed-by: Eric Blake 

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.   +1-919-301-3266
Virtualization:  qemu.org | libvirt.org



Re: [Qemu-devel] [PATCH v3 0/7] block: Handle null backing link

2018-02-24 Thread no-reply
Hi,

This series failed docker-mingw@fedora build test. Please find the testing 
commands and
their output below. If you have Docker installed, you can probably reproduce it
locally.

Type: series
Message-id: 20180224154033.29559-1-mre...@redhat.com
Subject: [Qemu-devel] [PATCH v3 0/7] block: Handle null backing link

=== TEST SCRIPT BEGIN ===
#!/bin/bash
set -e
git submodule update --init dtc
# Let docker tests dump environment info
export SHOW_ENV=1
export J=8
time make docker-test-mingw@fedora
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
191251e7ae block: Deprecate "backing": ""
1264694004 block: Handle null backing link
8fbce19250 qapi: Make more of qobject_to()
f21c23cfc2 qapi: Remove qobject_to_X() functions
48d64d436f qapi: Replace qobject_to_X(o) by qobject_to(o, X)
9902f9c3e4 qapi: Add qobject_to()
0b6050a86e compiler: Add QEMU_BUILD_BUG_MSG() macro

=== OUTPUT BEGIN ===
Submodule 'dtc' (git://git.qemu-project.org/dtc.git) registered for path 'dtc'
Cloning into '/var/tmp/patchew-tester-tmp-5eaf6ced/src/dtc'...
Submodule path 'dtc': checked out 'e54388015af1fb4bf04d0bca99caba1074d9cc42'
  BUILD   fedora
make[1]: Entering directory '/var/tmp/patchew-tester-tmp-5eaf6ced/src'
  GEN 
/var/tmp/patchew-tester-tmp-5eaf6ced/src/docker-src.2018-02-24-14.49.44.23087/qemu.tar
Cloning into 
'/var/tmp/patchew-tester-tmp-5eaf6ced/src/docker-src.2018-02-24-14.49.44.23087/qemu.tar.vroot'...
done.
Checking out files:  45% (2701/5878)   
Checking out files:  46% (2704/5878)   
Checking out files:  47% (2763/5878)   
Checking out files:  48% (2822/5878)   
Checking out files:  49% (2881/5878)   
Checking out files:  50% (2939/5878)   
Checking out files:  51% (2998/5878)   
Checking out files:  52% (3057/5878)   
Checking out files:  53% (3116/5878)   
Checking out files:  54% (3175/5878)   
Checking out files:  55% (3233/5878)   
Checking out files:  56% (3292/5878)   
Checking out files:  57% (3351/5878)   
Checking out files:  58% (3410/5878)   
Checking out files:  59% (3469/5878)   
Checking out files:  60% (3527/5878)   
Checking out files:  61% (3586/5878)   
Checking out files:  62% (3645/5878)   
Checking out files:  63% (3704/5878)   
Checking out files:  64% (3762/5878)   
Checking out files:  65% (3821/5878)   
Checking out files:  66% (3880/5878)   
Checking out files:  67% (3939/5878)   
Checking out files:  68% (3998/5878)   
Checking out files:  69% (4056/5878)   
Checking out files:  70% (4115/5878)   
Checking out files:  71% (4174/5878)   
Checking out files:  72% (4233/5878)   
Checking out files:  73% (4291/5878)   
Checking out files:  74% (4350/5878)   
Checking out files:  75% (4409/5878)   
Checking out files:  76% (4468/5878)   
Checking out files:  77% (4527/5878)   
Checking out files:  78% (4585/5878)   
Checking out files:  79% (4644/5878)   
Checking out files:  80% (4703/5878)   
Checking out files:  81% (4762/5878)   
Checking out files:  82% (4820/5878)   
Checking out files:  83% (4879/5878)   
Checking out files:  84% (4938/5878)   
Checking out files:  85% (4997/5878)   
Checking out files:  86% (5056/5878)   
Checking out files:  87% (5114/5878)   
Checking out files:  88% (5173/5878)   
Checking out files:  89% (5232/5878)   
Checking out files:  90% (5291/5878)   
Checking out files:  91% (5349/5878)   
Checking out files:  92% (5408/5878)   
Checking out files:  93% (5467/5878)   
Checking out files:  94% (5526/5878)   
Checking out files:  95% (5585/5878)   
Checking out files:  96% (5643/5878)   
Checking out files:  97% (5702/5878)   
Checking out files:  98% (5761/5878)   
Checking out files:  99% (5820/5878)   
Checking out files: 100% (5878/5878)   
Checking out files: 100% (5878/5878), done.
Your branch is up-to-date with 'origin/test'.
Submodule 'dtc' (git://git.qemu-project.org/dtc.git) registered for path 'dtc'
Cloning into 
'/var/tmp/patchew-tester-tmp-5eaf6ced/src/docker-src.2018-02-24-14.49.44.23087/qemu.tar.vroot/dtc'...
Submodule path 'dtc': checked out 'e54388015af1fb4bf04d0bca99caba1074d9cc42'
Submodule 'ui/keycodemapdb' (git://git.qemu.org/keycodemapdb.git) registered 
for path 'ui/keycodemapdb'
Cloning into 
'/var/tmp/patchew-tester-tmp-5eaf6ced/src/docker-src.2018-02-24-14.49.44.23087/qemu.tar.vroot/ui/keycodemapdb'...
Submodule path 'ui/keycodemapdb': checked out 
'6b3d716e2b6472eb7189d3220552280ef3d832ce'
  COPYRUNNER
RUN test-mingw in qemu:fedora 
Packages installed:
PyYAML-3.12-5.fc27.x86_64
SDL-devel-1.2.15-29.fc27.x86_64
bc-1.07.1-3.fc27.x86_64
bison-3.0.4-8.fc27.x86_64
bzip2-1.0.6-24.fc27.x86_64
ccache-3.3.5-1.fc27.x86_64
clang-5.0.1-1.fc27.x86_64
findutils-4.6.0-14.fc27.x86_64
flex-2.6.1-5.fc27.x86_64
gcc-7.3.1-2.fc27.x86_64
gcc-c++-7.3.1-2.fc27.x86_64
gettext-0.19.8.1-12.fc27.x86_64
git-2.14.3-2.fc27.x86_64
glib2-devel-2.54.3-2.fc27.x86_64
hostname-3.18-4.fc27.x86_64
libaio-devel-0.3.110-9.fc27.x86_64
libasan-7.3.1-2.fc27.x86_64
libfdt-devel-1.4.6-1.fc27.x86_64

Re: [Qemu-devel] [PATCH v3 3/3] util/uri.c: add brackets to `if` statements

2018-02-24 Thread Eric Blake

On 02/24/2018 06:56 AM, 苏航 wrote:

Hi, when I try to change
`while (cond) ;`
to
`while (cond) {
}`
checkpatch.pl complains about this:
'''
ERROR: suspect code indent for conditional statements (8, 8)
#1506: FILE: uri.c:1506:
+while ((*tmp++ = *segp++) != 0) {
[...]
+}

ERROR: suspect code indent for conditional statements (8, 8)
#1512: FILE: uri.c:1512:
+while ((segp > path) && ((--segp)[0] == '/')) {
[...]
+}
'''

When I add a semicolon, checkpatch.pl stop complaining.
`while (cond) {
 ;
}`
What should I do now?


Keeping a semicolon is one option, another is a well-placed comment:

while (cond) {
/* No further work */
}


And in general, we try to avoid top-posting on this list.

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.   +1-919-301-3266
Virtualization:  qemu.org | libvirt.org



[Qemu-devel] [Bug 1751494] [NEW] tag-target.inc.c:3495:no such instruction: `xgetbv'

2018-02-24 Thread John Arbuckle
Public bug reported:

While building QEMU on Mac OS 10.6.8 I saw this error message:
tag-target.inc.c:3495:no such instruction: `xgetbv'
In the file tcg/i386/tcg-target.inc.c at line 3495 is where the issue is 
located. This is the problem code:
asm ("xgetbv" : "=a" (xcrl), "=d" (xcrh) : "c" (0));

https://github.com/asmjit/asmjit/issues/78
According to the above link, another project also experienced this problem on 
Mac OS X. The fix was to replace the name of the instruction with the encoded 
form '.byte 0x0F, 0x01, 0xd0'. 

Host info:
Mac OS 10.6.8
GCC 5.2.0

Additional information:
This may be a gcc issue. I have compiled QEMU on Mac OS 10.12 and didn't 
experience any issues. The compiler used was Apple's clang.

** Affects: qemu
 Importance: Undecided
 Status: New

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1751494

Title:
  tag-target.inc.c:3495:no such instruction: `xgetbv'

Status in QEMU:
  New

Bug description:
  While building QEMU on Mac OS 10.6.8 I saw this error message:
  tag-target.inc.c:3495:no such instruction: `xgetbv'
  In the file tcg/i386/tcg-target.inc.c at line 3495 is where the issue is 
located. This is the problem code:
  asm ("xgetbv" : "=a" (xcrl), "=d" (xcrh) : "c" (0));

  https://github.com/asmjit/asmjit/issues/78
  According to the above link, another project also experienced this problem on 
Mac OS X. The fix was to replace the name of the instruction with the encoded 
form '.byte 0x0F, 0x01, 0xd0'. 

  Host info:
  Mac OS 10.6.8
  GCC 5.2.0

  Additional information:
  This may be a gcc issue. I have compiled QEMU on Mac OS 10.12 and didn't 
experience any issues. The compiler used was Apple's clang.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1751494/+subscriptions



Re: [Qemu-devel] [PATCH v3 0/7] block: Handle null backing link

2018-02-24 Thread no-reply
Hi,

This series failed build test on s390x host. Please find the details below.

Type: series
Message-id: 20180224154033.29559-1-mre...@redhat.com
Subject: [Qemu-devel] [PATCH v3 0/7] block: Handle null backing link

=== TEST SCRIPT BEGIN ===
#!/bin/bash
# Testing script will be invoked under the git checkout with
# HEAD pointing to a commit that has the patches applied on top of "base"
# branch
set -e
echo "=== ENV ==="
env
echo "=== PACKAGES ==="
rpm -qa
echo "=== TEST BEGIN ==="
CC=$HOME/bin/cc
INSTALL=$PWD/install
BUILD=$PWD/build
echo -n "Using CC: "
realpath $CC
mkdir -p $BUILD $INSTALL
SRC=$PWD
cd $BUILD
$SRC/configure --cc=$CC --prefix=$INSTALL
make -j4
# XXX: we need reliable clean up
# make check -j4 V=1
make install
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
191251e7ae block: Deprecate "backing": ""
1264694004 block: Handle null backing link
8fbce19250 qapi: Make more of qobject_to()
f21c23cfc2 qapi: Remove qobject_to_X() functions
48d64d436f qapi: Replace qobject_to_X(o) by qobject_to(o, X)
9902f9c3e4 qapi: Add qobject_to()
0b6050a86e compiler: Add QEMU_BUILD_BUG_MSG() macro

=== OUTPUT BEGIN ===
=== ENV ===
LANG=en_US.UTF-8
XDG_SESSION_ID=71140
USER=fam
PWD=/var/tmp/patchew-tester-tmp-wr4zoy33/src
HOME=/home/fam
SHELL=/bin/sh
SHLVL=2
PATCHEW=/home/fam/patchew/patchew-cli -s http://patchew.org --nodebug
LOGNAME=fam
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1012/bus
XDG_RUNTIME_DIR=/run/user/1012
PATH=/usr/bin:/bin
_=/usr/bin/env
=== PACKAGES ===
gpg-pubkey-873529b8-54e386ff
glibc-debuginfo-common-2.24-10.fc25.s390x
fedora-release-26-1.noarch
dejavu-sans-mono-fonts-2.35-4.fc26.noarch
xemacs-filesystem-21.5.34-22.20170124hgf412e9f093d4.fc26.noarch
bash-4.4.12-7.fc26.s390x
freetype-2.7.1-9.fc26.s390x
libSM-1.2.2-5.fc26.s390x
libmpc-1.0.2-6.fc26.s390x
libaio-0.3.110-7.fc26.s390x
libverto-0.2.6-7.fc26.s390x
perl-Scalar-List-Utils-1.48-1.fc26.s390x
iptables-libs-1.6.1-2.fc26.s390x
perl-threads-shared-1.57-1.fc26.s390x
p11-kit-trust-0.23.9-2.fc26.s390x
tcl-8.6.6-2.fc26.s390x
libxshmfence-1.2-4.fc26.s390x
expect-5.45-23.fc26.s390x
perl-Thread-Queue-3.12-1.fc26.noarch
perl-encoding-2.19-6.fc26.s390x
keyutils-1.5.10-1.fc26.s390x
gmp-devel-6.1.2-4.fc26.s390x
enchant-1.6.0-16.fc26.s390x
net-snmp-libs-5.7.3-17.fc26.s390x
python-gobject-base-3.24.1-1.fc26.s390x
python3-distro-1.0.3-1.fc26.noarch
python3-enchant-1.6.10-1.fc26.noarch
python-lockfile-0.11.0-6.fc26.noarch
python2-pyparsing-2.1.10-3.fc26.noarch
python2-lxml-4.1.1-1.fc26.s390x
librados2-10.2.7-2.fc26.s390x
trousers-lib-0.3.13-7.fc26.s390x
libpaper-1.1.24-14.fc26.s390x
libdatrie-0.2.9-4.fc26.s390x
libsoup-2.58.2-1.fc26.s390x
passwd-0.79-9.fc26.s390x
bind99-libs-9.9.10-3.P3.fc26.s390x
python3-rpm-4.13.0.2-1.fc26.s390x
mock-core-configs-27.4-1.fc26.noarch
systemd-233-7.fc26.s390x
virglrenderer-0.6.0-1.20170210git76b3da97b.fc26.s390x
s390utils-ziomon-1.36.1-3.fc26.s390x
s390utils-osasnmpd-1.36.1-3.fc26.s390x
libXrandr-1.5.1-2.fc26.s390x
libglvnd-glx-1.0.0-1.fc26.s390x
texlive-ifxetex-svn19685.0.5-33.fc26.2.noarch
texlive-psnfss-svn33946.9.2a-33.fc26.2.noarch
texlive-dvipdfmx-def-svn40328-33.fc26.2.noarch
texlive-natbib-svn20668.8.31b-33.fc26.2.noarch
texlive-xdvi-bin-svn40750-33.20160520.fc26.2.s390x
texlive-cm-svn32865.0-33.fc26.2.noarch
texlive-beton-svn15878.0-33.fc26.2.noarch
texlive-fpl-svn15878.1.002-33.fc26.2.noarch
texlive-mflogo-svn38628-33.fc26.2.noarch
texlive-texlive-docindex-svn41430-33.fc26.2.noarch
texlive-luaotfload-bin-svn34647.0-33.20160520.fc26.2.noarch
texlive-koma-script-svn41508-33.fc26.2.noarch
texlive-pst-tree-svn24142.1.12-33.fc26.2.noarch
texlive-breqn-svn38099.0.98d-33.fc26.2.noarch
texlive-xetex-svn41438-33.fc26.2.noarch
gstreamer1-plugins-bad-free-1.12.3-1.fc26.s390x
xorg-x11-font-utils-7.5-33.fc26.s390x
ghostscript-fonts-5.50-36.fc26.noarch
libXext-devel-1.3.3-5.fc26.s390x
libusbx-devel-1.0.21-2.fc26.s390x
libglvnd-devel-1.0.0-1.fc26.s390x
emacs-25.3-3.fc26.s390x
alsa-lib-devel-1.1.4.1-1.fc26.s390x
kbd-2.0.4-2.fc26.s390x
dconf-0.26.0-2.fc26.s390x
ccache-3.3.4-1.fc26.s390x
glibc-static-2.25-12.fc26.s390x
mc-4.8.19-5.fc26.s390x
doxygen-1.8.13-9.fc26.s390x
dpkg-1.18.24-1.fc26.s390x
libtdb-1.3.13-1.fc26.s390x
python2-pynacl-1.1.1-1.fc26.s390x
nss-sysinit-3.34.0-1.0.fc26.s390x
kernel-4.13.16-202.fc26.s390x
perl-Filter-1.58-1.fc26.s390x
python2-pip-9.0.1-11.fc26.noarch
dnf-2.7.5-2.fc26.noarch
pcre2-utf16-10.23-11.fc26.s390x
glusterfs-devel-3.10.8-1.fc26.s390x
sssd-common-1.16.0-4.fc26.s390x
python2-sssdconfig-1.16.0-4.fc26.noarch
acpica-tools-20171110-1.fc26.s390x
glibc-debuginfo-2.24-10.fc25.s390x
fedora-repos-26-1.noarch
dejavu-fonts-common-2.35-4.fc26.noarch
bind99-license-9.9.10-3.P3.fc26.noarch
ncurses-libs-6.0-8.20170212.fc26.s390x
libpng-1.6.28-2.fc26.s390x
libICE-1.0.9-9.fc26.s390x
kmod-24-1.fc26.s390x
libseccomp-2.3.2-1.fc26.s390x
perl-Text-ParseWords-3.30-366.fc26.noarch
libtool-ltdl-2.4.6-17.fc26.s390x
perl-threads-2.16-1.fc26.s390x

Re: [Qemu-devel] [PATCH v3 3/4] softfloat: use floatx80_infinity in softfloat

2018-02-24 Thread Laurent Vivier
Le 24/02/2018 à 18:26, Richard Henderson a écrit :
> On 02/24/2018 09:21 AM, Laurent Vivier wrote:
>> I think the change should be in fact:
>>
>> @@ -4549,10 +4555,7 @@ int64_t floatx80_to_int64(floatx80 a,
>> float_status *status)
>>  if ( shiftCount <= 0 ) {
>>  if ( shiftCount ) {
>>  float_raise(float_flag_invalid, status);
>> -if (! aSign
>> - || (( aExp == 0x7FFF )
>> -  && ( aSig != LIT64( 0x8000 ) ) )
>> -   ) {
>> +if (!aSign || floatx80_is_any_nan(a)) {
>>  return LIT64( 0x7FFF );
>>  }
>>  return (int64_t) LIT64( 0x8000 );
>>
>> Do you agree?
> 
> Yep, looks good.

Thank you.

And according to your previous comment, floatx80_is_infinity() should
become:

static inline int floatx80_is_infinity(floatx80 a)
{
#if defined(TARGET_M68K)
return (a.high & 0x7fff) == floatx80_infinity.high && !(a.low << 1);
#else
return (a.high & 0x7fff) == floatx80_infinity.high &&
   a.low == floatx80_infinity.low;
#endif
}

Laurent



Re: [Qemu-devel] [PATCH v3 3/4] softfloat: use floatx80_infinity in softfloat

2018-02-24 Thread Richard Henderson
On 02/24/2018 09:21 AM, Laurent Vivier wrote:
> I think the change should be in fact:
> 
> @@ -4549,10 +4555,7 @@ int64_t floatx80_to_int64(floatx80 a,
> float_status *status)
>  if ( shiftCount <= 0 ) {
>  if ( shiftCount ) {
>  float_raise(float_flag_invalid, status);
> -if (! aSign
> - || (( aExp == 0x7FFF )
> -  && ( aSig != LIT64( 0x8000 ) ) )
> -   ) {
> +if (!aSign || floatx80_is_any_nan(a)) {
>  return LIT64( 0x7FFF );
>  }
>  return (int64_t) LIT64( 0x8000 );
> 
> Do you agree?

Yep, looks good.


r~



Re: [Qemu-devel] [PATCH v3 3/4] softfloat: use floatx80_infinity in softfloat

2018-02-24 Thread Laurent Vivier
Le 24/02/2018 à 03:26, Richard Henderson a écrit :
> On 02/23/2018 06:59 AM, Laurent Vivier wrote:
>> @@ -4550,8 +4556,8 @@ int64_t floatx80_to_int64(floatx80 a, float_status 
>> *status)
>>  if ( shiftCount ) {
>>  float_raise(float_flag_invalid, status);
>>  if (! aSign
>> - || (( aExp == 0x7FFF )
>> -  && ( aSig != LIT64( 0x8000 ) ) )
>> + || ((aExp == floatx80_infinity_high)
>> + && (aSig != floatx80_infinity_low))
>> ) {
> 
> As long as you're cleaning this up, m68k ignores the explicit integer bit when
> considering an infinity.  However, Intel doesn't ignore the bit -- it appears
> to treat 7fff.0* as a NaN.

According to the comment above the function:

"... If `a' is a NaN, the largest positive integer is returned.
Otherwise, if the conversion overflows, the largest integer with the
same sign as `a' is returned."

I think the change should be in fact:

@@ -4549,10 +4555,7 @@ int64_t floatx80_to_int64(floatx80 a,
float_status *status)
 if ( shiftCount <= 0 ) {
 if ( shiftCount ) {
 float_raise(float_flag_invalid, status);
-if (! aSign
- || (( aExp == 0x7FFF )
-  && ( aSig != LIT64( 0x8000 ) ) )
-   ) {
+if (!aSign || floatx80_is_any_nan(a)) {
 return LIT64( 0x7FFF );
 }
 return (int64_t) LIT64( 0x8000 );

Do you agree?

Thanks,
Laurent



Re: [Qemu-devel] [PULL 0/9] Ui 20180222 patches

2018-02-24 Thread no-reply
Hi,

This series failed build test on s390x host. Please find the details below.

N/A. Internal error while reading log file



---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-de...@freelists.org

[Qemu-devel] [PATCH v3 3/7] qapi: Replace qobject_to_X(o) by qobject_to(o, X)

2018-02-24 Thread Max Reitz
This patch was generated using the following Coccinelle script:

@@
expression Obj;
@@
(
- qobject_to_qnum(Obj)
+ qobject_to(Obj, QNum)
|
- qobject_to_qstring(Obj)
+ qobject_to(Obj, QString)
|
- qobject_to_qdict(Obj)
+ qobject_to(Obj, QDict)
|
- qobject_to_qlist(Obj)
+ qobject_to(Obj, QList)
|
- qobject_to_qbool(Obj)
+ qobject_to(Obj, QBool)
)

and a bit of manual fix-up for overly long lines and three places in
tests/check-qjson.c that Coccinelle did not find.

Signed-off-by: Max Reitz 
Reviewed-by: Alberto Garcia 
---
 block.c |  2 +-
 block/qapi.c| 12 -
 block/rbd.c |  8 +++---
 blockdev.c  |  7 ++---
 hw/i386/acpi-build.c| 14 +-
 monitor.c   |  8 +++---
 qapi/qmp-dispatch.c |  2 +-
 qapi/qobject-input-visitor.c| 20 +++---
 qapi/qobject-output-visitor.c   |  4 +--
 qga/main.c  |  2 +-
 qmp.c   |  2 +-
 qobject/json-parser.c   |  2 +-
 qobject/qbool.c |  4 +--
 qobject/qdict.c | 38 +-
 qobject/qjson.c | 10 +++
 qobject/qlist.c |  6 ++---
 qobject/qlit.c  | 10 +++
 qobject/qnum.c  |  6 ++---
 qobject/qstring.c   |  6 ++---
 qom/object.c|  8 +++---
 target/i386/cpu.c   |  2 +-
 target/s390x/cpu_models.c   |  2 +-
 tests/check-qdict.c | 20 +++---
 tests/check-qjson.c | 41 ++--
 tests/check-qlist.c |  4 +--
 tests/check-qlit.c  |  2 +-
 tests/check-qnum.c  |  4 +--
 tests/check-qobject.c   |  2 +-
 tests/check-qstring.c   |  2 +-
 tests/device-introspect-test.c  | 14 +-
 tests/libqtest.c|  6 ++---
 tests/numa-test.c   |  8 +++---
 tests/qom-test.c|  4 +--
 tests/test-char.c   |  2 +-
 tests/test-keyval.c |  8 +++---
 tests/test-qga.c| 19 ++---
 tests/test-qmp-commands.c   | 12 -
 tests/test-qmp-event.c  | 16 +--
 tests/test-qobject-input-visitor.c  | 10 +++
 tests/test-qobject-output-visitor.c | 54 ++---
 tests/test-x86-cpuid-compat.c   | 17 ++--
 util/keyval.c   |  4 +--
 util/qemu-config.c  |  2 +-
 util/qemu-option.c  |  6 ++---
 44 files changed, 218 insertions(+), 214 deletions(-)

diff --git a/block.c b/block.c
index 814e5a02da..cb69fd7ae4 100644
--- a/block.c
+++ b/block.c
@@ -1457,7 +1457,7 @@ static QDict *parse_json_filename(const char *filename, 
Error **errp)
 return NULL;
 }
 
-options = qobject_to_qdict(options_obj);
+options = qobject_to(options_obj, QDict);
 if (!options) {
 qobject_decref(options_obj);
 error_setg(errp, "Invalid JSON object given");
diff --git a/block/qapi.c b/block/qapi.c
index 1fdeb1ef2f..0a3d4261df 100644
--- a/block/qapi.c
+++ b/block/qapi.c
@@ -647,29 +647,29 @@ static void dump_qobject(fprintf_function func_fprintf, 
void *f,
 {
 switch (qobject_type(obj)) {
 case QTYPE_QNUM: {
-QNum *value = qobject_to_qnum(obj);
+QNum *value = qobject_to(obj, QNum);
 char *tmp = qnum_to_string(value);
 func_fprintf(f, "%s", tmp);
 g_free(tmp);
 break;
 }
 case QTYPE_QSTRING: {
-QString *value = qobject_to_qstring(obj);
+QString *value = qobject_to(obj, QString);
 func_fprintf(f, "%s", qstring_get_str(value));
 break;
 }
 case QTYPE_QDICT: {
-QDict *value = qobject_to_qdict(obj);
+QDict *value = qobject_to(obj, QDict);
 dump_qdict(func_fprintf, f, comp_indent, value);
 break;
 }
 case QTYPE_QLIST: {
-QList *value = qobject_to_qlist(obj);
+QList *value = qobject_to(obj, QList);
 dump_qlist(func_fprintf, f, comp_indent, value);
 break;
 }
 case QTYPE_QBOOL: {
-QBool *value = qobject_to_qbool(obj);
+QBool *value = qobject_to(obj, QBool);
 func_fprintf(f, "%s", qbool_get_bool(value) ? "true" : "false");
 break;
 }
@@ -730,7 +730,7 @@ void bdrv_image_info_specific_dump(fprintf_function 
func_fprintf, void *f,
 
 visit_type_ImageInfoSpecific(v, NULL, _spec, _abort);
 visit_complete(v, );
-data = qdict_get(qobject_to_qdict(obj), "data");
+data = qdict_get(qobject_to(obj, QDict), "data");
 

[Qemu-devel] [PATCH v3 5/7] qapi: Make more of qobject_to()

2018-02-24 Thread Max Reitz
This patch reworks some places which use either qobject_type() checks
plus qobject_to(), where the latter alone is sufficient, or NULL checks
plus qobject_type() checks where we can simply do a qobject_to() != NULL
check.

Signed-off-by: Max Reitz 
Reviewed-by: Alberto Garcia 
---
 qapi/qobject-input-visitor.c |  4 ++--
 qobject/json-parser.c| 13 +++--
 qobject/qdict.c  | 20 +++-
 3 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/qapi/qobject-input-visitor.c b/qapi/qobject-input-visitor.c
index f0c7f3e370..a1a3f9dcd7 100644
--- a/qapi/qobject-input-visitor.c
+++ b/qapi/qobject-input-visitor.c
@@ -339,7 +339,7 @@ static GenericList *qobject_input_next_list(Visitor *v, 
GenericList *tail,
 QObjectInputVisitor *qiv = to_qiv(v);
 StackObject *tos = QSLIST_FIRST(>stack);
 
-assert(tos && tos->obj && qobject_type(tos->obj) == QTYPE_QLIST);
+assert(tos && qobject_to(tos->obj, QList));
 
 if (!tos->entry) {
 return NULL;
@@ -353,7 +353,7 @@ static void qobject_input_check_list(Visitor *v, Error 
**errp)
 QObjectInputVisitor *qiv = to_qiv(v);
 StackObject *tos = QSLIST_FIRST(>stack);
 
-assert(tos && tos->obj && qobject_type(tos->obj) == QTYPE_QLIST);
+assert(tos && qobject_to(tos->obj, QList));
 
 if (tos->entry) {
 error_setg(errp, "Only %u list elements expected in %s",
diff --git a/qobject/json-parser.c b/qobject/json-parser.c
index 9192c7f054..6063d31427 100644
--- a/qobject/json-parser.c
+++ b/qobject/json-parser.c
@@ -276,7 +276,8 @@ static void parser_context_free(JSONParserContext *ctxt)
  */
 static int parse_pair(JSONParserContext *ctxt, QDict *dict, va_list *ap)
 {
-QObject *key = NULL, *value;
+QObject *value;
+QString *key = NULL;
 JSONToken *peek, *token;
 
 peek = parser_context_peek_token(ctxt);
@@ -285,8 +286,8 @@ static int parse_pair(JSONParserContext *ctxt, QDict *dict, 
va_list *ap)
 goto out;
 }
 
-key = parse_value(ctxt, ap);
-if (!key || qobject_type(key) != QTYPE_QSTRING) {
+key = qobject_to(parse_value(ctxt, ap), QString);
+if (!key) {
 parse_error(ctxt, peek, "key is not a string in object");
 goto out;
 }
@@ -308,14 +309,14 @@ static int parse_pair(JSONParserContext *ctxt, QDict 
*dict, va_list *ap)
 goto out;
 }
 
-qdict_put_obj(dict, qstring_get_str(qobject_to(key, QString)), value);
+qdict_put_obj(dict, qstring_get_str(key), value);
 
-qobject_decref(key);
+QDECREF(key);
 
 return 0;
 
 out:
-qobject_decref(key);
+QDECREF(key);
 
 return -1;
 }
diff --git a/qobject/qdict.c b/qobject/qdict.c
index 2562f7a426..ad048cba6e 100644
--- a/qobject/qdict.c
+++ b/qobject/qdict.c
@@ -882,18 +882,20 @@ QObject *qdict_crumple(const QDict *src, Error **errp)
 
 child = qdict_get(two_level, prefix);
 if (suffix) {
-if (child) {
-if (qobject_type(child) != QTYPE_QDICT) {
+QDict *child_dict = qobject_to(child, QDict);
+if (!child_dict) {
+if (child) {
 error_setg(errp, "Key %s prefix is already set as a 
scalar",
prefix);
 goto error;
 }
-} else {
-child = QOBJECT(qdict_new());
-qdict_put_obj(two_level, prefix, child);
+
+child_dict = qdict_new();
+qdict_put_obj(two_level, prefix, QOBJECT(child_dict));
 }
+
 qobject_incref(ent->value);
-qdict_put_obj(qobject_to(child, QDict), suffix, ent->value);
+qdict_put_obj(child_dict, suffix, ent->value);
 } else {
 if (child) {
 error_setg(errp, "Key %s prefix is already set as a dict",
@@ -913,9 +915,9 @@ QObject *qdict_crumple(const QDict *src, Error **errp)
 multi_level = qdict_new();
 for (ent = qdict_first(two_level); ent != NULL;
  ent = qdict_next(two_level, ent)) {
-
-if (qobject_type(ent->value) == QTYPE_QDICT) {
-child = qdict_crumple(qobject_to(ent->value, QDict), errp);
+QDict *dict = qobject_to(ent->value, QDict);
+if (dict) {
+child = qdict_crumple(dict, errp);
 if (!child) {
 goto error;
 }
-- 
2.14.3




[Qemu-devel] [PATCH v3 4/7] qapi: Remove qobject_to_X() functions

2018-02-24 Thread Max Reitz
They are no longer needed now.

Signed-off-by: Max Reitz 
Reviewed-by: Alberto Garcia 
---
 include/qapi/qmp/qbool.h   |  1 -
 include/qapi/qmp/qdict.h   |  1 -
 include/qapi/qmp/qlist.h   |  1 -
 include/qapi/qmp/qnum.h|  1 -
 include/qapi/qmp/qstring.h |  1 -
 qobject/qbool.c| 11 ---
 qobject/qdict.c| 11 ---
 qobject/qlist.c| 11 ---
 qobject/qnum.c | 11 ---
 qobject/qstring.c  | 11 ---
 10 files changed, 60 deletions(-)

diff --git a/include/qapi/qmp/qbool.h b/include/qapi/qmp/qbool.h
index 629c508d34..b9a44a1bfe 100644
--- a/include/qapi/qmp/qbool.h
+++ b/include/qapi/qmp/qbool.h
@@ -23,7 +23,6 @@ struct QBool {
 
 QBool *qbool_from_bool(bool value);
 bool qbool_get_bool(const QBool *qb);
-QBool *qobject_to_qbool(const QObject *obj);
 bool qbool_is_equal(const QObject *x, const QObject *y);
 void qbool_destroy_obj(QObject *obj);
 
diff --git a/include/qapi/qmp/qdict.h b/include/qapi/qmp/qdict.h
index ff6f7842c3..c19b7aa2c4 100644
--- a/include/qapi/qmp/qdict.h
+++ b/include/qapi/qmp/qdict.h
@@ -39,7 +39,6 @@ void qdict_put_obj(QDict *qdict, const char *key, QObject 
*value);
 void qdict_del(QDict *qdict, const char *key);
 int qdict_haskey(const QDict *qdict, const char *key);
 QObject *qdict_get(const QDict *qdict, const char *key);
-QDict *qobject_to_qdict(const QObject *obj);
 bool qdict_is_equal(const QObject *x, const QObject *y);
 void qdict_iter(const QDict *qdict,
 void (*iter)(const char *key, QObject *obj, void *opaque),
diff --git a/include/qapi/qmp/qlist.h b/include/qapi/qmp/qlist.h
index 5fd976a398..5c673acb06 100644
--- a/include/qapi/qmp/qlist.h
+++ b/include/qapi/qmp/qlist.h
@@ -53,7 +53,6 @@ QObject *qlist_pop(QList *qlist);
 QObject *qlist_peek(QList *qlist);
 int qlist_empty(const QList *qlist);
 size_t qlist_size(const QList *qlist);
-QList *qobject_to_qlist(const QObject *obj);
 bool qlist_is_equal(const QObject *x, const QObject *y);
 void qlist_destroy_obj(QObject *obj);
 
diff --git a/include/qapi/qmp/qnum.h b/include/qapi/qmp/qnum.h
index 15e3971c7f..3e47475b2c 100644
--- a/include/qapi/qmp/qnum.h
+++ b/include/qapi/qmp/qnum.h
@@ -68,7 +68,6 @@ double qnum_get_double(QNum *qn);
 
 char *qnum_to_string(QNum *qn);
 
-QNum *qobject_to_qnum(const QObject *obj);
 bool qnum_is_equal(const QObject *x, const QObject *y);
 void qnum_destroy_obj(QObject *obj);
 
diff --git a/include/qapi/qmp/qstring.h b/include/qapi/qmp/qstring.h
index 98070ef3d6..b72843fc1b 100644
--- a/include/qapi/qmp/qstring.h
+++ b/include/qapi/qmp/qstring.h
@@ -30,7 +30,6 @@ const char *qstring_get_str(const QString *qstring);
 void qstring_append_int(QString *qstring, int64_t value);
 void qstring_append(QString *qstring, const char *str);
 void qstring_append_chr(QString *qstring, int c);
-QString *qobject_to_qstring(const QObject *obj);
 bool qstring_is_equal(const QObject *x, const QObject *y);
 void qstring_destroy_obj(QObject *obj);
 
diff --git a/qobject/qbool.c b/qobject/qbool.c
index 14d57c03fd..c45cbc1d3a 100644
--- a/qobject/qbool.c
+++ b/qobject/qbool.c
@@ -39,17 +39,6 @@ bool qbool_get_bool(const QBool *qb)
 return qb->value;
 }
 
-/**
- * qobject_to_qbool(): Convert a QObject into a QBool
- */
-QBool *qobject_to_qbool(const QObject *obj)
-{
-if (!obj || qobject_type(obj) != QTYPE_QBOOL) {
-return NULL;
-}
-return container_of(obj, QBool, base);
-}
-
 /**
  * qbool_is_equal(): Test whether the two QBools are equal
  */
diff --git a/qobject/qdict.c b/qobject/qdict.c
index b85c37cd1d..2562f7a426 100644
--- a/qobject/qdict.c
+++ b/qobject/qdict.c
@@ -37,17 +37,6 @@ QDict *qdict_new(void)
 return qdict;
 }
 
-/**
- * qobject_to_qdict(): Convert a QObject into a QDict
- */
-QDict *qobject_to_qdict(const QObject *obj)
-{
-if (!obj || qobject_type(obj) != QTYPE_QDICT) {
-return NULL;
-}
-return container_of(obj, QDict, base);
-}
-
 /**
  * tdb_hash(): based on the hash agorithm from gdbm, via tdb
  * (from module-init-tools)
diff --git a/qobject/qlist.c b/qobject/qlist.c
index 9deb66fd5c..782df470cf 100644
--- a/qobject/qlist.c
+++ b/qobject/qlist.c
@@ -151,17 +151,6 @@ size_t qlist_size(const QList *qlist)
 return count;
 }
 
-/**
- * qobject_to_qlist(): Convert a QObject into a QList
- */
-QList *qobject_to_qlist(const QObject *obj)
-{
-if (!obj || qobject_type(obj) != QTYPE_QLIST) {
-return NULL;
-}
-return container_of(obj, QList, base);
-}
-
 /**
  * qlist_is_equal(): Test whether the two QLists are equal
  *
diff --git a/qobject/qnum.c b/qobject/qnum.c
index a6444d7c7f..986bf325a5 100644
--- a/qobject/qnum.c
+++ b/qobject/qnum.c
@@ -199,17 +199,6 @@ char *qnum_to_string(QNum *qn)
 return NULL;
 }
 
-/**
- * qobject_to_qnum(): Convert a QObject into a QNum
- */
-QNum *qobject_to_qnum(const QObject *obj)
-{
-if (!obj || qobject_type(obj) != QTYPE_QNUM) {
-return NULL;

[Qemu-devel] [PATCH v3 7/7] block: Deprecate "backing": ""

2018-02-24 Thread Max Reitz
We have a clear replacement, so let's deprecate it.

Signed-off-by: Max Reitz 
Reviewed-by: Eric Blake 
Reviewed-by: Alberto Garcia 
---
 qapi/block-core.json | 4 ++--
 block.c  | 4 
 qemu-doc.texi| 7 +++
 qemu-options.hx  | 4 ++--
 4 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/qapi/block-core.json b/qapi/block-core.json
index 5c5921bfb7..6cf695dfc5 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -1090,7 +1090,7 @@
 # @overlay: reference to the existing block device that will become
 #   the overlay of @node, as part of creating the snapshot.
 #   It must not have a current backing file (this can be
-#   achieved by passing "backing": "" to blockdev-add).
+#   achieved by passing "backing": null to blockdev-add).
 #
 # Since: 2.5
 ##
@@ -1238,7 +1238,7 @@
 # "node-name": "node1534",
 # "file": { "driver": "file",
 #   "filename": "hd1.qcow2" },
-# "backing": "" } }
+# "backing": null } }
 #
 # <- { "return": {} }
 #
diff --git a/block.c b/block.c
index b86614d8ad..797706199d 100644
--- a/block.c
+++ b/block.c
@@ -2603,6 +2603,10 @@ static BlockDriverState *bdrv_open_inherit(const char 
*filename,
 if (qobject_to(qdict_get(options, "backing"), QNull) != NULL ||
 (backing && *backing == '\0'))
 {
+if (backing) {
+warn_report("Use of \"backing\": \"\" is deprecated; "
+"use \"backing\": null instead");
+}
 flags |= BDRV_O_NO_BACKING;
 qdict_del(options, "backing");
 }
diff --git a/qemu-doc.texi b/qemu-doc.texi
index 8e3556976b..1b537f3e00 100644
--- a/qemu-doc.texi
+++ b/qemu-doc.texi
@@ -2792,6 +2792,13 @@ support page sizes < 4096 any longer.
 The ``xlnx-ep108'' machine has been replaced by the ``xlnx-zcu102'' machine.
 The ``xlnx-zcu102'' machine has the same features and capabilites in QEMU.
 
+@section Block device options
+
+@subsection "backing": "" (since 2.12.0)
+
+In order to prevent QEMU from automatically opening an image's backing
+chain, use ``"backing": null'' instead.
+
 @node License
 @appendix License
 
diff --git a/qemu-options.hx b/qemu-options.hx
index 8ccd5dcaa6..ff84563206 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -743,8 +743,8 @@ Reference to or definition of the data source block driver 
node
 
 @item backing
 Reference to or definition of the backing file block device (default is taken
-from the image file). It is allowed to pass an empty string here in order to
-disable the default backing file.
+from the image file). It is allowed to pass @code{null} here in order to 
disable
+the default backing file.
 
 @item lazy-refcounts
 Whether to enable the lazy refcounts feature (on/off; default is taken from the
-- 
2.14.3




Re: [Qemu-devel] [PATCH v2 00/16] block/mirror: Add active-sync mirroring

2018-02-24 Thread Max Reitz
Pïng

On 2018-01-22 23:07, Max Reitz wrote:
> This series implements an active and synchronous mirroring mode.
> 
> Currently, the mirror block job is passive an asynchronous: Depending on
> your start conditions, some part of the source disk starts as "dirty".
> Then, the block job will (as a background operation) continuously copy
> dirty parts to the target disk until all of the source disk is clean.
> In the meantime, any write to the source disk dirties the affected area.
> 
> One effect of this operational mode is that the job may never converge:
> If the writes to the source happen faster than the block job copies data
> to the target, the job can never finish.
> 
> When the active mode implemented in this series is enabled, every write
> request to the source will automatically trigger a synchronous write to
> the target right afterwards.  Therefore, the source can never get dirty
> faster than data is copied to the target.  Most importantly, once source
> and target are in sync (BLOCK_JOB_READY is emitted), they will not
> diverge (unless e.g. an I/O error occurs).
> 
> Active mirroring also improves on a second issue of the passive mode: We
> do not have to read data from the source in order to write it to the
> target.  When new data is written to the source in active mode, it is
> automatically mirrored to the target, which saves us the superfluous
> read from the source.



signature.asc
Description: OpenPGP digital signature


[Qemu-devel] [PATCH v3 2/7] qapi: Add qobject_to()

2018-02-24 Thread Max Reitz
This is a dynamic casting macro that, given a QObject type, returns an
object as that type or NULL if the object is of a different type (or
NULL itself).

The macro uses lower-case letters because:
1. There does not seem to be a hard rule on whether qemu macros have to
   be upper-cased,
2. The current situation in qapi/qmp is inconsistent (compare e.g.
   QINCREF() vs. qdict_put()),
3. qobject_to() will evaluate its @obj parameter only once, thus it is
   generally not important to the caller whether it is a macro or not,
4. I prefer it aesthetically.

Signed-off-by: Max Reitz 
---
 include/qapi/qmp/qobject.h | 30 ++
 1 file changed, 30 insertions(+)

diff --git a/include/qapi/qmp/qobject.h b/include/qapi/qmp/qobject.h
index 38ac68845c..a448576b46 100644
--- a/include/qapi/qmp/qobject.h
+++ b/include/qapi/qmp/qobject.h
@@ -50,6 +50,22 @@ struct QObject {
 #define QDECREF(obj)  \
 qobject_decref(obj ? QOBJECT(obj) : NULL)
 
+/* Required for qobject_to() */
+#define QTYPE_CAST_TO_QNull QTYPE_QNULL
+#define QTYPE_CAST_TO_QNum  QTYPE_QNUM
+#define QTYPE_CAST_TO_QString   QTYPE_QSTRING
+#define QTYPE_CAST_TO_QDict QTYPE_QDICT
+#define QTYPE_CAST_TO_QList QTYPE_QLIST
+#define QTYPE_CAST_TO_QBool QTYPE_QBOOL
+
+QEMU_BUILD_BUG_MSG(QTYPE__MAX != 7,
+   "The QTYPE_CAST_TO_* list needs to be extended");
+
+#define qobject_to(obj, type) \
+container_of(qobject_check_type(obj, glue(QTYPE_CAST_TO_, type)) ?: \
+ QOBJECT((type *)NULL), \
+ type, base)
+
 /* Initialize an object to default values */
 static inline void qobject_init(QObject *obj, QType type)
 {
@@ -102,4 +118,18 @@ static inline QType qobject_type(const QObject *obj)
 return obj->type;
 }
 
+/**
+ * qobject_check_type(): Helper function for the qobject_to() macro.
+ * Return @obj, but only if @obj is not NULL and @type is equal to
+ * @obj's type.  Return NULL otherwise.
+ */
+static inline QObject *qobject_check_type(const QObject *obj, QType type)
+{
+if (obj && qobject_type(obj) == type) {
+return (QObject *)obj;
+} else {
+return NULL;
+}
+}
+
 #endif /* QOBJECT_H */
-- 
2.14.3




[Qemu-devel] [PATCH v3 6/7] block: Handle null backing link

2018-02-24 Thread Max Reitz
Instead of converting all "backing": null instances into "backing": "",
handle a null value directly in bdrv_open_inherit().

This enables explicitly null backing links for json:{} filenames.

Signed-off-by: Max Reitz 
Reviewed-by: Alberto Garcia 
---
 block.c|  4 +++-
 blockdev.c | 14 --
 tests/qemu-iotests/089 | 20 
 tests/qemu-iotests/089.out |  8 
 4 files changed, 31 insertions(+), 15 deletions(-)

diff --git a/block.c b/block.c
index cb69fd7ae4..b86614d8ad 100644
--- a/block.c
+++ b/block.c
@@ -2600,7 +2600,9 @@ static BlockDriverState *bdrv_open_inherit(const char 
*filename,
 
 /* See cautionary note on accessing @options above */
 backing = qdict_get_try_str(options, "backing");
-if (backing && *backing == '\0') {
+if (qobject_to(qdict_get(options, "backing"), QNull) != NULL ||
+(backing && *backing == '\0'))
+{
 flags |= BDRV_O_NO_BACKING;
 qdict_del(options, "backing");
 }
diff --git a/blockdev.c b/blockdev.c
index edc699ae15..003245c6cb 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -3972,7 +3972,6 @@ void qmp_blockdev_add(BlockdevOptions *options, Error 
**errp)
 QObject *obj;
 Visitor *v = qobject_output_visitor_new();
 QDict *qdict;
-const QDictEntry *ent;
 Error *local_err = NULL;
 
 visit_type_BlockdevOptions(v, NULL, , _err);
@@ -3986,19 +3985,6 @@ void qmp_blockdev_add(BlockdevOptions *options, Error 
**errp)
 
 qdict_flatten(qdict);
 
-/*
- * Rewrite "backing": null to "backing": ""
- * TODO Rewrite "" to null instead, and perhaps not even here
- */
-for (ent = qdict_first(qdict); ent; ent = qdict_next(qdict, ent)) {
-char *dot = strrchr(ent->key, '.');
-
-if (!strcmp(dot ? dot + 1 : ent->key, "backing")
-&& qobject_type(ent->value) == QTYPE_QNULL) {
-qdict_put(qdict, ent->key, qstring_new());
-}
-}
-
 if (!qdict_get_try_str(qdict, "node-name")) {
 error_setg(errp, "'node-name' must be specified for the root node");
 goto fail;
diff --git a/tests/qemu-iotests/089 b/tests/qemu-iotests/089
index 0b059aba90..aa1ba4a98e 100755
--- a/tests/qemu-iotests/089
+++ b/tests/qemu-iotests/089
@@ -82,6 +82,26 @@ $QEMU_IO_PROG --cache $CACHEMODE \
 $QEMU_IO -c 'read -P 42 0 512' "$TEST_IMG" | _filter_qemu_io
 
 
+echo
+echo "=== Testing correct handling of 'backing':null ==="
+echo
+
+_make_test_img -b "$TEST_IMG.base" $IMG_SIZE
+
+# This should read 42
+$QEMU_IO -c 'read -P 42 0 512' "$TEST_IMG" | _filter_qemu_io
+
+# This should read 0
+$QEMU_IO -c 'read -P 0 0 512' "json:{\
+'driver': '$IMGFMT',
+'file': {
+'driver': 'file',
+'filename': '$TEST_IMG'
+},
+'backing': null
+}" | _filter_qemu_io
+
+
 # Taken from test 071
 echo
 echo "=== Testing blkdebug ==="
diff --git a/tests/qemu-iotests/089.out b/tests/qemu-iotests/089.out
index 0bf5a13ec1..89e3e4340a 100644
--- a/tests/qemu-iotests/089.out
+++ b/tests/qemu-iotests/089.out
@@ -19,6 +19,14 @@ Pattern verification failed at offset 0, 512 bytes
 read 512/512 bytes at offset 0
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 
+=== Testing correct handling of 'backing':null ===
+
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 
backing_file=TEST_DIR/t.IMGFMT.base
+read 512/512 bytes at offset 0
+512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+read 512/512 bytes at offset 0
+512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+
 === Testing blkdebug ===
 
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
-- 
2.14.3




[Qemu-devel] [PATCH v3 0/7] block: Handle null backing link

2018-02-24 Thread Max Reitz
Currently, we try to rewrite every occurrence of "backing": null into
"backing": "" in qmp_blockdev_add().  However, that breaks using the
same "backing": null construction in json:{} file names (which do not go
through qmp_blockdev_add()).  Currently, these then just behave as if
the option has not been specified.

Since there is actually only one place where we evaluate the @backing
option to find out whether not to use a backing file, we can instead
just check for null there.  It doesn't matter that this changes the
runtime state of the option from "" to null, because nobody really does
anything with that runtime state anyway (except put it into qemu again,
but qemu doesn't care whether it's "" or null).

And in the future, it's much better if we get it to be null in that
runtime state sooner than later -- see patch 7.


Note that it was Markus (who's away having a good time, I hope) who
proposed qobject_to(), so I guess he won't object too much to seeing the
concept having landed in his tree once he returns.
(Although he hasn't reviewed the previous iteration of this series,
 which included it already.)


v3:
- Added patch 1 so we can use a common macro in patch 2 (instead of
  invoking _Static_assert() directly), but still keep the explanatory
  message


git-backport-diff against v1:

Key:
[] : patches are identical
[] : number of functional differences between upstream/downstream patch
[down] : patch is downstream-only
The flags [FC] indicate (F)unctional and (C)ontextual differences, respectively

001/7:[down] 'compiler: Add QEMU_BUILD_BUG_MSG() macro'
002/7:[0006] [FC] 'qapi: Add qobject_to()'
003/7:[] [--] 'qapi: Replace qobject_to_X(o) by qobject_to(o, X)'
004/7:[] [-C] 'qapi: Remove qobject_to_X() functions'
005/7:[] [--] 'qapi: Make more of qobject_to()'
006/7:[] [--] 'block: Handle null backing link'
007/7:[] [-C] 'block: Deprecate "backing": ""'


Max Reitz (7):
  compiler: Add QEMU_BUILD_BUG_MSG() macro
  qapi: Add qobject_to()
  qapi: Replace qobject_to_X(o) by qobject_to(o, X)
  qapi: Remove qobject_to_X() functions
  qapi: Make more of qobject_to()
  block: Handle null backing link
  block: Deprecate "backing": ""

 qapi/block-core.json|  4 +--
 include/qapi/qmp/qbool.h|  1 -
 include/qapi/qmp/qdict.h|  1 -
 include/qapi/qmp/qlist.h|  1 -
 include/qapi/qmp/qnum.h |  1 -
 include/qapi/qmp/qobject.h  | 30 +
 include/qapi/qmp/qstring.h  |  1 -
 include/qemu/compiler.h | 12 +--
 block.c | 10 --
 block/qapi.c| 12 +++
 block/rbd.c |  8 ++---
 blockdev.c  | 21 +++-
 hw/i386/acpi-build.c| 14 
 monitor.c   |  8 ++---
 qapi/qmp-dispatch.c |  2 +-
 qapi/qobject-input-visitor.c| 24 +++---
 qapi/qobject-output-visitor.c   |  4 +--
 qga/main.c  |  2 +-
 qmp.c   |  2 +-
 qobject/json-parser.c   | 13 
 qobject/qbool.c | 15 ++---
 qobject/qdict.c | 65 -
 qobject/qjson.c | 10 +++---
 qobject/qlist.c | 17 ++
 qobject/qlit.c  | 10 +++---
 qobject/qnum.c  | 17 ++
 qobject/qstring.c   | 17 ++
 qom/object.c|  8 ++---
 target/i386/cpu.c   |  2 +-
 target/s390x/cpu_models.c   |  2 +-
 tests/check-qdict.c | 20 ++--
 tests/check-qjson.c | 41 +++
 tests/check-qlist.c |  4 +--
 tests/check-qlit.c  |  2 +-
 tests/check-qnum.c  |  4 +--
 tests/check-qobject.c   |  2 +-
 tests/check-qstring.c   |  2 +-
 tests/device-introspect-test.c  | 14 
 tests/libqtest.c|  6 ++--
 tests/numa-test.c   |  8 ++---
 tests/qom-test.c|  4 +--
 tests/test-char.c   |  2 +-
 tests/test-keyval.c |  8 ++---
 tests/test-qga.c| 19 ++-
 tests/test-qmp-commands.c   | 12 +++
 tests/test-qmp-event.c  | 16 -
 tests/test-qobject-input-visitor.c  | 10 +++---
 tests/test-qobject-output-visitor.c | 54 +++---
 tests/test-x86-cpuid-compat.c   | 17 +-
 util/keyval.c   |  4 +--
 util/qemu-config.c  |  2 +-
 util/qemu-option.c  |  6 ++--
 qemu-doc.texi   |  7 
 qemu-options.hx |  4 +--
 tests/qemu-iotests/089  | 20 
 tests/qemu-iotests/089.out  |  8 +
 56 

[Qemu-devel] [PATCH v3 1/7] compiler: Add QEMU_BUILD_BUG_MSG() macro

2018-02-24 Thread Max Reitz
_Static_assert() allows us to specify messages, and that may come in
handy.  Even without _Static_assert(), encouraging developers to put a
helpful message next to the QEMU_BUILD_BUG_* may make debugging easier
whenever it breaks.

Signed-off-by: Max Reitz 
---
 include/qemu/compiler.h | 12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h
index 2cbe6a4f16..9f762695d1 100644
--- a/include/qemu/compiler.h
+++ b/include/qemu/compiler.h
@@ -82,15 +82,21 @@
 int:(x) ? -1 : 1; \
 }
 
+/* QEMU_BUILD_BUG_MSG() emits the message given if _Static_assert is
+ * supported; otherwise, it will be omitted from the compiler error
+ * message (but as it remains present in the source code, it can still
+ * be useful when debugging). */
 #if defined(CONFIG_STATIC_ASSERT)
-#define QEMU_BUILD_BUG_ON(x) _Static_assert(!(x), "not expecting: " #x)
+#define QEMU_BUILD_BUG_MSG(x, msg) _Static_assert(!(x), msg)
 #elif defined(__COUNTER__)
-#define QEMU_BUILD_BUG_ON(x) typedef QEMU_BUILD_BUG_ON_STRUCT(x) \
+#define QEMU_BUILD_BUG_MSG(x, msg) typedef QEMU_BUILD_BUG_ON_STRUCT(x) \
 glue(qemu_build_bug_on__, __COUNTER__) __attribute__((unused))
 #else
-#define QEMU_BUILD_BUG_ON(x)
+#define QEMU_BUILD_BUG_MSG(x, msg)
 #endif
 
+#define QEMU_BUILD_BUG_ON(x) QEMU_BUILD_BUG_MSG(x, "not expecting: " #x)
+
 #define QEMU_BUILD_BUG_ON_ZERO(x) (sizeof(QEMU_BUILD_BUG_ON_STRUCT(x)) - \
sizeof(QEMU_BUILD_BUG_ON_STRUCT(x)))
 
-- 
2.14.3




[Qemu-devel] VM memory caching model

2018-02-24 Thread Matwey V. Kornilov
Hi,

Sorry in advance, if wrong maillist.

Where may I find comprehensive description how virtualization CPU
extensions (like VMX) interact with CPU data caches as well as
corresponding qemu implementation details? I've looked through
memory_ldst.inc.c with little success.

I am trying to debug virtio_blk issues found on Xeon X5675. I run nested
guest under qemu-kvm from ESXi 5.5 hosted guest, this is quite odd setup
but still. Currently (master qemu, host and guest - 4.15 kernel), virtio
is broken in this setup due to some kind of memory synchronization
issues. Let me please recall, that main virtio communication abstraction
is a queue. The queue is consisted from three parts: descriptor table,
avail ring, used ring. This structures are supposed to be shared memory
between the guest and the hypervisor. All of them are structures
allocated by the guest device driver, pointers in guest physical address
space are transferred to the hypervisor through PCI MMIO configuration
BAR. This is so-called modern PCI virtio.

When the guest wants to notify the hypervisor for update, the guest
device driver writes to PCI BAR. At the hypervisor side, notification is
implemented through eventfd and KVM_IOEVENTFD ioctl. It works as
expected, since I see that qemu receives a lot of notification for the
queue. However, qemu sees no updates in avail ring where guest driver
increments so called "avail index" at each transfer. At the hypervisor
side avail ring index is always 1, so as virtio_queue_empty_rcu() always
says that incoming queue is empty one.




Re: [Qemu-devel] [RFC v4 00/21] blockjobs: add explicit job management

2018-02-24 Thread no-reply
Hi,

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

Type: series
Message-id: 20180223235142.21501-1-js...@redhat.com
Subject: [Qemu-devel] [RFC v4 00/21] blockjobs: add explicit job management

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram

commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
failed=1
echo
fi
n=$((n+1))
done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
230e578fa2 blockjobs: add manual_mgmt option to transactions
f278a5155a iotests: test manual job dismissal
8e473ab4a8 blockjobs: Expose manual property
7ad2d0164f blockjobs: add block-job-finalize
3857c91315 blockjobs: add PENDING status and event
18eb8a4130 blockjobs: add waiting status
daf9613432 blockjobs: add prepare callback
78be501212 blockjobs: add block_job_txn_apply function
4b659abe69 blockjobs: add commit, abort, clean helpers
4023046d76 blockjobs: ensure abort is called for cancelled jobs
e9300b122e blockjobs: add block_job_dismiss
4fc045eae4 blockjobs: add NULL state
e6aa454753 blockjobs: add CONCLUDED state
78efa2f937 blockjobs: add ABORTING state
057ad2472f blockjobs: add block_job_verb permission table
c62c5b75a3 iotests: add pause_wait
4aadb9c38c blockjobs: add state transition table
afc594c4b0 blockjobs: add status enum
434d3811fa blockjobs: add manual property
fc3e3eebc9 blockjobs: model single jobs as transactions
8d32662676 blockjobs: fix set-speed kick

=== OUTPUT BEGIN ===
Checking PATCH 1/21: blockjobs: fix set-speed kick...
Checking PATCH 2/21: blockjobs: model single jobs as transactions...
Checking PATCH 3/21: blockjobs: add manual property...
Checking PATCH 4/21: blockjobs: add status enum...
Checking PATCH 5/21: blockjobs: add state transition table...
ERROR: space prohibited before open square bracket '['
#81: FILE: blockjob.c:48:
+/* U: */ [BLOCK_JOB_STATUS_UNDEFINED] = {0, 1, 0, 0, 0, 0},

ERROR: space prohibited before open square bracket '['
#82: FILE: blockjob.c:49:
+/* C: */ [BLOCK_JOB_STATUS_CREATED]   = {0, 0, 1, 0, 0, 0},

ERROR: space prohibited before open square bracket '['
#83: FILE: blockjob.c:50:
+/* R: */ [BLOCK_JOB_STATUS_RUNNING]   = {0, 0, 0, 1, 1, 0},

ERROR: space prohibited before open square bracket '['
#84: FILE: blockjob.c:51:
+/* P: */ [BLOCK_JOB_STATUS_PAUSED]= {0, 0, 1, 0, 0, 0},

ERROR: space prohibited before open square bracket '['
#85: FILE: blockjob.c:52:
+/* Y: */ [BLOCK_JOB_STATUS_READY] = {0, 0, 0, 0, 0, 1},

ERROR: space prohibited before open square bracket '['
#86: FILE: blockjob.c:53:
+/* S: */ [BLOCK_JOB_STATUS_STANDBY]   = {0, 0, 0, 0, 1, 0},

total: 6 errors, 0 warnings, 90 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 6/21: iotests: add pause_wait...
Checking PATCH 7/21: blockjobs: add block_job_verb permission table...
Checking PATCH 8/21: blockjobs: add ABORTING state...
ERROR: space prohibited before open square bracket '['
#61: FILE: blockjob.c:48:
+/* U: */ [BLOCK_JOB_STATUS_UNDEFINED] = {0, 1, 0, 0, 0, 0, 0},

ERROR: space prohibited before open square bracket '['
#62: FILE: blockjob.c:49:
+/* C: */ [BLOCK_JOB_STATUS_CREATED]   = {0, 0, 1, 0, 0, 0, 0},

ERROR: space prohibited before open square bracket '['
#63: FILE: blockjob.c:50:
+/* R: */ [BLOCK_JOB_STATUS_RUNNING]   = {0, 0, 0, 1, 1, 0, 1},

ERROR: space prohibited before open square bracket '['
#64: FILE: blockjob.c:51:
+/* P: */ [BLOCK_JOB_STATUS_PAUSED]= {0, 0, 1, 0, 0, 0, 0},

ERROR: space prohibited before open square bracket '['
#65: FILE: blockjob.c:52:
+/* Y: */ [BLOCK_JOB_STATUS_READY] = {0, 0, 0, 0, 0, 1, 1},

ERROR: space prohibited before open square bracket '['
#66: FILE: blockjob.c:53:
+/* S: */ [BLOCK_JOB_STATUS_STANDBY]   = {0, 0, 0, 0, 1, 0, 0},

ERROR: space prohibited before open square bracket '['
#67: FILE: blockjob.c:54:
+/* X: */ [BLOCK_JOB_STATUS_ABORTING]  = {0, 0, 0, 0, 0, 0, 0},

total: 7 errors, 0 warnings, 62 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 9/21: blockjobs: add CONCLUDED state...
ERROR: space prohibited before open square bracket '['
#63: FILE: blockjob.c:48:
+/* U: */ [BLOCK_JOB_STATUS_UNDEFINED] = {0, 1, 0, 0, 0, 0, 0, 0},

ERROR: space prohibited before open square bracket '['
#64: FILE: blockjob.c:49:
+/* C: */ 

[Qemu-devel] [PATCH RFC] scripts/checkpatch.pl:Add check for `while` and `for`

2018-02-24 Thread Su Hang
Add check for `while` and `for` statement, which condition has more than
one line.

The former checkpatch.pl can check `if` statement, which condition has more
than one line, whether block misses brace round, like this:
'''
if (cond1 ||
cond2)
statement;
'''
But it doesn't do the same check for `for` and `while`.

Suggested-by: Eric Blake 
Suggested-by: Thomas Huth 
Signed-off-by: Su Hang 
---
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 1b4b812e28fa..cfe7e77d156f 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2353,7 +2353,7 @@ sub process {
}
 
 # check for missing bracing round if etc
-   if ($line =~ /(^.*)\bif\b/ && $line !~ /\#\s*if/) {
+   if ($line =~ /(^.*)\b(if|for|while)\b/ && $line !~ 
/\#\s*(if|for|while)/) {
my ($level, $endln, @chunks) =
ctx_statement_full($linenr, $realcnt, 1);
 if ($dbg_adv_apw) {
-- 
2.7.4




Re: [Qemu-devel] [PATCH v3 3/3] util/uri.c: add brackets to `if` statements

2018-02-24 Thread 苏航
Hi, when I try to change 
`while (cond) ;` 
to
`while (cond) {
}`
checkpatch.pl complains about this:
'''
ERROR: suspect code indent for conditional statements (8, 8)
#1506: FILE: uri.c:1506:
+while ((*tmp++ = *segp++) != 0) {
[...]
+}

ERROR: suspect code indent for conditional statements (8, 8)
#1512: FILE: uri.c:1512:
+while ((segp > path) && ((--segp)[0] == '/')) {
[...]
+}
'''

When I add a semicolon, checkpatch.pl stop complaining.
`while (cond) {
;
}`
What should I do now?

"Eric Blake" wrote:
> On 02/23/2018 03:34 AM, Thomas Huth wrote:
> > On 23.02.2018 08:51, Su Hang wrote:
> >> Add brackets that wrap `if`, `else`, `while` that hold single
> >> statements.
> >>
> >> In order to do this, I write a simple python regex script.
> 
> Without documenting the script, no one else can reproduce this; but it's 
> no different than if they had manually made changes instead of trying to 
> script it, so I'm not sure this sentence adds much in its current form.
> 
> >>
> >> Since then, all complaints rised by checkpatch.pl has been suppressed.
> 
> s/rised/raised/
> s/Since then,/With that/
> s/has/have/
> 
> >>
> >> Signed-off-by: Su Hang 
> >> ---
> >>   util/uri.c | 462 
> >> ++---
> >>   1 file changed, 291 insertions(+), 171 deletions(-)
> >>
> 
> >>   cur = *str;
> >> -if (!ISA_ALPHA(cur))
> >> +if (!ISA_ALPHA(cur)) {
> >>   return 2;
> >> +}
> >>   cur++;
> >> -while (ISA_ALPHA(cur) || ISA_DIGIT(cur) ||
> >> -   (*cur == '+') || (*cur == '-') || (*cur == '.'))
> >> +while (ISA_ALPHA(cur) || ISA_DIGIT(cur) || (*cur == '+') || (*cur == 
> >> '-') ||
> >> +   (*cur == '.'))
> >>   cur++;
> > 
> > You've changed the while statement, but checkpatch.pl apparently does not
> > complain about missing curly braces here ... that's strange, I thought we'd
> > also wanted to enforce curly braces for while loops.
> 
> Maybe because it gets lost since the condition expanded over more than 
> one line?  But yes, now that we've noticed it manually, it should be 
> fixed.  While at it, you can avoid the redundant ():
> 
> while (ISA_ALPHA(cur) || ISA_DIGIT(cur) || *cur == '+' || *cur == '-' ||
> *cur == '.') {
> 
> 
> >> -while ((*tmp++ = *segp++) != 0)
> >> +while ((*tmp++ = *segp++) != 0) {
> >>   ;
> >> +}
> > 
> > A bikeshed-painting-friday question for everybody on qemu-devel:
> > Should there be a single semicolon inside curly braces in this case, or not?
> > 
> 
> Checkpatch doesn't complain, but lone ';' statements are rare.  I'd omit 
> it, and use just:
> 
> while (cond) {
> }
> 
> 
> -- 
> Eric Blake, Principal Software Engineer
> Red Hat, Inc.   +1-919-301-3266
> Virtualization:  qemu.org | libvirt.org


Re: [Qemu-devel] [PATCH] Fix ast2500 protection register emulation

2018-02-24 Thread no-reply
Hi,

This series failed build test on s390x host. Please find the details below.

N/A. Internal error while reading log file



---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-de...@freelists.org

Re: [Qemu-devel] [PATCH v3 00/31] Add ARMv8.2 half-precision functions

2018-02-24 Thread no-reply
Hi,

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

Type: series
Message-id: 20180223153636.29809-1-alex.ben...@linaro.org
Subject: [Qemu-devel] [PATCH v3 00/31] Add ARMv8.2 half-precision functions

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram

commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
failed=1
echo
fi
n=$((n+1))
done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
973d6ea847 arm/translate-a64: add all single op FP16 to handle_fp_1src_half
865c5efee7 arm/translate-a64: implement simd_scalar_three_reg_same_fp16
fd1fec9d84 arm/translate-a64: add all FP16 ops in simd_scalar_pairwise
34a9ee1b72 arm/translate-a64: add FP16 FMOV to simd_mod_imm
e61c7193a5 arm/translate-a64: add FP16 FRSQRTE to simd_two_reg_misc_fp16
dbbbc15721 arm/helper.c: re-factor rsqrte and add rsqrte_f16
1f776415c0 arm/translate-a64: add FP16 FSQRT to simd_two_reg_misc_fp16
01a7993654 arm/translate-a64: add FP16 FRCPX to simd_two_reg_misc_fp16
3e2b3ca80f arm/translate-a64: add FP16 FRECPE
33514ae31f arm/helper.c: re-factor recpe and add recepe_f16
a1dfb85e0f arm/translate-a64: add FP16 FNEG/FABS to simd_two_reg_misc_fp16
92e3338b5a arm/translate-a64: add FP16 SCVTF/UCVFT to simd_two_reg_misc_fp16
5b86cb374f arm/translate-a64: add FP16 FCMxx (zero) to simd_two_reg_misc_fp16
17e2eee31c arm/translate-a64: add FCVTxx to simd_two_reg_misc_fp16
893c84283a arm/translate-a64: add FP16 FPRINTx to simd_two_reg_misc_fp16
c29baaf9c1 arm/translate-a64: initial decode for simd_two_reg_misc_fp16
714d9395cc arm/translate-a64: add FP16 x2 ops for simd_indexed
b026878d1c arm/translate-a64: add FP16 FMULX/MLS/FMLA to simd_indexed
ea0357c725 arm/translate-a64: add FP16 pairwise ops simd_three_reg_same_fp16
dfbe2602d6 arm/translate-a64: add FP16 FR[ECP/SQRT]S to simd_three_reg_same_fp16
c17489ca3b arm/translate-a64: add FP16 FMULA/X/S to simd_three_reg_same_fp16
e4fa306574 arm/translate-a64: add FP16 F[A]C[EQ/GE/GT] to 
simd_three_reg_same_fp16
688c5a1edc arm/translate-a64: add FP16 FADD/FABD/FSUB/FMUL/FDIV to 
simd_three_reg_same_fp16
3d44f35de5 arm/translate-a64: initial decode for simd_three_reg_same_fp16
db5773e357 arm/translate-a64: handle_3same_64 comment fix
2e96f5c4ee arm/translate-a64: implement half-precision F(MIN|MAX)(V|NMV)
278b916615 target/arm/helper: pass explicit fpst to set_rmode
4ef0855eb3 target/arm/cpu.h: add additional float_status flags
9360101ac7 target/arm/cpu.h: update comment for half-precision values
7a30500e92 target/arm/cpu64: introduce ARM_V8_FP16 feature bit
47fba618d4 include/exec/helper-head.h: support f16 in helper calls

=== OUTPUT BEGIN ===
Checking PATCH 1/31: include/exec/helper-head.h: support f16 in helper calls...
Checking PATCH 2/31: target/arm/cpu64: introduce ARM_V8_FP16 feature bit...
Checking PATCH 3/31: target/arm/cpu.h: update comment for half-precision 
values...
Checking PATCH 4/31: target/arm/cpu.h: add additional float_status flags...
Checking PATCH 5/31: target/arm/helper: pass explicit fpst to set_rmode...
Checking PATCH 6/31: arm/translate-a64: implement half-precision 
F(MIN|MAX)(V|NMV)...
Checking PATCH 7/31: arm/translate-a64: handle_3same_64 comment fix...
Checking PATCH 8/31: arm/translate-a64: initial decode for 
simd_three_reg_same_fp16...
Checking PATCH 9/31: arm/translate-a64: add FP16 FADD/FABD/FSUB/FMUL/FDIV to 
simd_three_reg_same_fp16...
Checking PATCH 10/31: arm/translate-a64: add FP16 F[A]C[EQ/GE/GT] to 
simd_three_reg_same_fp16...
Checking PATCH 11/31: arm/translate-a64: add FP16 FMULA/X/S to 
simd_three_reg_same_fp16...
Checking PATCH 12/31: arm/translate-a64: add FP16 FR[ECP/SQRT]S to 
simd_three_reg_same_fp16...
Checking PATCH 13/31: arm/translate-a64: add FP16 pairwise ops 
simd_three_reg_same_fp16...
Checking PATCH 14/31: arm/translate-a64: add FP16 FMULX/MLS/FMLA to 
simd_indexed...
Checking PATCH 15/31: arm/translate-a64: add FP16 x2 ops for simd_indexed...
Checking PATCH 16/31: arm/translate-a64: initial decode for 
simd_two_reg_misc_fp16...
Checking PATCH 17/31: arm/translate-a64: add FP16 FPRINTx to 
simd_two_reg_misc_fp16...
Checking PATCH 18/31: arm/translate-a64: add FCVTxx to simd_two_reg_misc_fp16...
Checking PATCH 19/31: arm/translate-a64: add FP16 FCMxx (zero) to 
simd_two_reg_misc_fp16...
Checking PATCH 20/31: arm/translate-a64: add FP16 SCVTF/UCVFT to 
simd_two_reg_misc_fp16...
ERROR: space prohibited before that close parenthesis ')'
#26: FILE: target/arm/helper.c:11305:
+FLOAT_CONVS(si, h, 16, )

total: 1 errors, 0 warnings, 208 lines checked

Your patch has style 

Re: [Qemu-devel] [PATCH] migration: do not transfer ram during bulk storage migration

2018-02-24 Thread no-reply
Hi,

This series failed docker-build@min-glib build test. Please find the testing 
commands and
their output below. If you have Docker installed, you can probably reproduce it
locally.

Type: series
Message-id: 1519139403-2646-1-git-send-email...@kamp.de
Subject: [Qemu-devel] [PATCH] migration: do not transfer ram during bulk 
storage migration

=== TEST SCRIPT BEGIN ===
#!/bin/bash
set -e
git submodule update --init dtc
# Let docker tests dump environment info
export SHOW_ENV=1
export J=8
time make docker-test-build@min-glib
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
   205e3e78d2..0a773d55ac  master -> master
 t [tag update]
patchew/1519241752-28083-1-git-send-email-wall...@linux.vnet.ibm.com -> 
patchew/1519241752-28083-1-git-send-email-wall...@linux.vnet.ibm.com
 t [tag update]
patchew/1519344729-73482-1-git-send-email-...@sifive.com -> 
patchew/1519344729-73482-1-git-send-email-...@sifive.com
 * [new tag]   
patchew/1519390265-15576-1-git-send-email-imbre...@linux.vnet.ibm.com -> 
patchew/1519390265-15576-1-git-send-email-imbre...@linux.vnet.ibm.com
 * [new tag]   
patchew/1519400599-21081-1-git-send-email-wall...@linux.vnet.ibm.com -> 
patchew/1519400599-21081-1-git-send-email-wall...@linux.vnet.ibm.com
 * [new tag]   
patchew/1519407778-23095-1-git-send-email-imbre...@linux.vnet.ibm.com -> 
patchew/1519407778-23095-1-git-send-email-imbre...@linux.vnet.ibm.com
 * [new tag]   
patchew/1519421985-18185-1-git-send-email-stef...@linux.vnet.ibm.com -> 
patchew/1519421985-18185-1-git-send-email-stef...@linux.vnet.ibm.com
 * [new tag]   
patchew/1519439425-27883-1-git-send-email-babu.mo...@amd.com -> 
patchew/1519439425-27883-1-git-send-email-babu.mo...@amd.com
 t [tag update]patchew/20171228180814.9749-1-luke...@lukeshu.com -> 
patchew/20171228180814.9749-1-luke...@lukeshu.com
 t [tag update]patchew/20180213202701.15858-1-ebl...@redhat.com -> 
patchew/20180213202701.15858-1-ebl...@redhat.com
 t [tag update]patchew/20180214204915.7980-1-mre...@redhat.com -> 
patchew/20180214204915.7980-1-mre...@redhat.com
 t [tag update]
patchew/20180215212552.26997-1-marcandre.lur...@redhat.com -> 
patchew/20180215212552.26997-1-marcandre.lur...@redhat.com
 * [new tag]   patchew/20180223095406.18251-1-coh...@redhat.com -> 
patchew/20180223095406.18251-1-coh...@redhat.com
 * [new tag]   
patchew/20180223112933.4135-1-mark.cave-ayl...@ilande.co.uk -> 
patchew/20180223112933.4135-1-mark.cave-ayl...@ilande.co.uk
 * [new tag]   patchew/20180223125047.343-1-be...@igalia.com -> 
patchew/20180223125047.343-1-be...@igalia.com
 * [new tag]   patchew/20180223145959.18761-1-laur...@vivier.eu -> 
patchew/20180223145959.18761-1-laur...@vivier.eu
 * [new tag]   patchew/20180223150201.2960-1-thomas@oracle.com 
-> patchew/20180223150201.2960-1-thomas@oracle.com
 * [new tag]   patchew/20180223152640.11459-1-pbonz...@redhat.com 
-> patchew/20180223152640.11459-1-pbonz...@redhat.com
 * [new tag]   
patchew/20180223153636.29809-1-alex.ben...@linaro.org -> 
patchew/20180223153636.29809-1-alex.ben...@linaro.org
 * [new tag]   
patchew/20180223161226.11640-1-richard.hender...@linaro.org -> 
patchew/20180223161226.11640-1-richard.hender...@linaro.org
 * [new tag]   patchew/20180223164829.29683-1-...@redhat.com -> 
patchew/20180223164829.29683-1-...@redhat.com
 * [new tag]   patchew/20180223173657.29125-1-da...@redhat.com -> 
patchew/20180223173657.29125-1-da...@redhat.com
 * [new tag]   
patchew/20180223184700.28854-1-mark.cave-ayl...@ilande.co.uk -> 
patchew/20180223184700.28854-1-mark.cave-ayl...@ilande.co.uk
 * [new tag]   patchew/20180223215858.16987-1-...@redhat.com -> 
patchew/20180223215858.16987-1-...@redhat.com
 * [new tag]   
patchew/20180223232233.31482-1-frasse.igles...@gmail.com -> 
patchew/20180223232233.31482-1-frasse.igles...@gmail.com
 * [new tag]   patchew/20180223235142.21501-1-js...@redhat.com -> 
patchew/20180223235142.21501-1-js...@redhat.com
 * [new tag]   
patchew/alpine.lsu.2.21.1802231729040.10...@wotan.suse.de -> 
patchew/alpine.lsu.2.21.1802231729040.10...@wotan.suse.de
Switched to a new branch 'test'
83862115e8 migration: do not transfer ram during bulk storage migration

=== OUTPUT BEGIN ===
Submodule 'dtc' (git://git.qemu-project.org/dtc.git) registered for path 'dtc'
Cloning into '/var/tmp/patchew-tester-tmp-b2bnyei8/src/dtc'...
Submodule path 'dtc': checked out 'e54388015af1fb4bf04d0bca99caba1074d9cc42'
  BUILD   min-glib
make[1]: Entering directory '/var/tmp/patchew-tester-tmp-b2bnyei8/src'
  GEN 
/var/tmp/patchew-tester-tmp-b2bnyei8/src/docker-src.2018-02-23-22.39.25.21756/qemu.tar
Cloning into 

Re: [Qemu-devel] [PATCH v3 3/3] util/uri.c: add brackets to `if` statements

2018-02-24 Thread 苏航
Thanks for your comments :)
I will pay more attention to what you point out.

"Eric Blake" wrote:
> On 02/23/2018 03:34 AM, Thomas Huth wrote:
> > On 23.02.2018 08:51, Su Hang wrote:
> >> Add brackets that wrap `if`, `else`, `while` that hold single
> >> statements.
> >>
> >> In order to do this, I write a simple python regex script.
> 
> Without documenting the script, no one else can reproduce this; but it's 
> no different than if they had manually made changes instead of trying to 
> script it, so I'm not sure this sentence adds much in its current form.
> 
> >>
> >> Since then, all complaints rised by checkpatch.pl has been suppressed.
> 
> s/rised/raised/
> s/Since then,/With that/
> s/has/have/
> 
> >>
> >> Signed-off-by: Su Hang 
> >> ---
> >>   util/uri.c | 462 
> >> ++---
> >>   1 file changed, 291 insertions(+), 171 deletions(-)
> >>
> 
> >>   cur = *str;
> >> -if (!ISA_ALPHA(cur))
> >> +if (!ISA_ALPHA(cur)) {
> >>   return 2;
> >> +}
> >>   cur++;
> >> -while (ISA_ALPHA(cur) || ISA_DIGIT(cur) ||
> >> -   (*cur == '+') || (*cur == '-') || (*cur == '.'))
> >> +while (ISA_ALPHA(cur) || ISA_DIGIT(cur) || (*cur == '+') || (*cur == 
> >> '-') ||
> >> +   (*cur == '.'))
> >>   cur++;
> > 
> > You've changed the while statement, but checkpatch.pl apparently does not
> > complain about missing curly braces here ... that's strange, I thought we'd
> > also wanted to enforce curly braces for while loops.
> 
> Maybe because it gets lost since the condition expanded over more than 
> one line?  But yes, now that we've noticed it manually, it should be 
> fixed.  While at it, you can avoid the redundant ():
> 
> while (ISA_ALPHA(cur) || ISA_DIGIT(cur) || *cur == '+' || *cur == '-' ||
> *cur == '.') {
> 
> 
> >> -while ((*tmp++ = *segp++) != 0)
> >> +while ((*tmp++ = *segp++) != 0) {
> >>   ;
> >> +}
> > 
> > A bikeshed-painting-friday question for everybody on qemu-devel:
> > Should there be a single semicolon inside curly braces in this case, or not?
> > 
> 
> Checkpatch doesn't complain, but lone ';' statements are rare.  I'd omit 
> it, and use just:
> 
> while (cond) {
> }
> 
> 
> -- 
> Eric Blake, Principal Software Engineer
> Red Hat, Inc.   +1-919-301-3266
> Virtualization:  qemu.org | libvirt.org


[Qemu-devel] [Bug 1688231] Re: [Qemu-ppc] sendkey is not working for any of the keystrokes

2018-02-24 Thread Daniel Henrique Barboza
Yes, you are right: sendkey does not send keys to the serial console. I
had a chat with Peter last year about it in the IRC where the explained:

 hey! quick question: is the 'sendkey' monitor command supposed to 
send the key presses to the serial console of the guest when running with 
-nographics ? The command works fine with VGA/VNC graphics but the serial 
console doesn't show the character key being sent by the command
 no, 'sendkey' sends a key to whatever physical keyboard is currently 
being emulated, regardless of what is being done with serial devices
 pm215, I 've debugged the code and saw that the scancodes are being 
sent to the emulated keyboard via sendkey. I just wondered why the serial 
console doesn't show the keysyms but the VGA does
 because keyboards don't plug into serial terminals
 this is like having a server with a PC keyboard plugged into it and 
also a serial port which you're using as the serial terminal
 pressing a key on the PC keyboard doesn't do anything to the serial 
terminal
 pm215, that makes sense, haven't thought of  that. thanks!

Given that the bug report was created around a wrong assumption, this
should be closed.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1688231

Title:
  [Qemu-ppc] sendkey is not working for any of the keystrokes

Status in QEMU:
  New

Bug description:
  sendkey option is not working for any of the keystrokes in ppc64le,

  Qemu version:
  # qemu-img --version
  qemu-img version 2.9.50 (v2.9.0-303-g81b2d5c-dirty)

  Qemu command line:
  # qemu-system-ppc64 --enable-kvm --nographic -vga none -machine pseries -m 
4G,slots=32,maxmem=32G -smp 16,maxcpus=32 -device virtio-blk-pci,drive=rootdisk 
-drive 
file=/var/lib/libvirt/images/f25-upstream-ppc64le.qcow2,if=none,cache=none,format=qcow2,id=rootdisk
 -monitor telnet:127.0.0.1:1234,server,nowait -net nic,model=virtio -net user 
-redir tcp:2000::22

  Guest booted successfully and logged in
  Fedora 25 (Twenty Five)
  Kernel 4.11.0-rc4 on an ppc64le (hvc0)

  atest-guest login: updatedb (5582) used greatest stack depth: 9568 bytes left
  root
  Password: 
  Last login: Mon Mar 27 01:57:51 on hvc0
  [root@atest-guest ~]# 

  Qemu monitor:
  # telnet 127.0.0.1 1234
  Trying 127.0.0.1...
  Connected to 127.0.0.1.
  Escape character is '^]'.
  QEMU 2.9.50 monitor - type 'help' for more information
  (qemu) sendkey a
  (qemu) sendkey ret

  But from the console, I couldn't observe the keystroke a or return.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1688231/+subscriptions



Re: [Qemu-devel] [RFC, PATCH, v1] hw/audio/opl2lpt: add support for OPL2LPT

2018-02-24 Thread no-reply
Hi,

This series failed docker-build@min-glib build test. Please find the testing 
commands and
their output below. If you have Docker installed, you can probably reproduce it
locally.

Type: series
Message-id: 20180218144021.11641-1-vinc...@bernat.im
Subject: [Qemu-devel] [RFC, PATCH, v1] hw/audio/opl2lpt: add support for OPL2LPT

=== TEST SCRIPT BEGIN ===
#!/bin/bash
set -e
git submodule update --init dtc
# Let docker tests dump environment info
export SHOW_ENV=1
export J=8
time make docker-test-build@min-glib
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
c83e23c953 hw/audio/opl2lpt: add support for OPL2LPT

=== OUTPUT BEGIN ===
Submodule 'dtc' (git://git.qemu-project.org/dtc.git) registered for path 'dtc'
Cloning into '/var/tmp/patchew-tester-tmp-_kso1q75/src/dtc'...
Submodule path 'dtc': checked out 'e54388015af1fb4bf04d0bca99caba1074d9cc42'
  BUILD   min-glib
make[1]: Entering directory '/var/tmp/patchew-tester-tmp-_kso1q75/src'
  GEN 
/var/tmp/patchew-tester-tmp-_kso1q75/src/docker-src.2018-02-24-05.22.36.20222/qemu.tar
Cloning into 
'/var/tmp/patchew-tester-tmp-_kso1q75/src/docker-src.2018-02-24-05.22.36.20222/qemu.tar.vroot'...
done.
Checking out files:  46% (2748/5855)   
Checking out files:  47% (2752/5855)   
Checking out files:  48% (2811/5855)   
Checking out files:  49% (2869/5855)   
Checking out files:  50% (2928/5855)   
Checking out files:  51% (2987/5855)   
Checking out files:  52% (3045/5855)   
Checking out files:  53% (3104/5855)   
Checking out files:  54% (3162/5855)   
Checking out files:  55% (3221/5855)   
Checking out files:  56% (3279/5855)   
Checking out files:  57% (3338/5855)   
Checking out files:  58% (3396/5855)   
Checking out files:  59% (3455/5855)   
Checking out files:  60% (3513/5855)   
Checking out files:  61% (3572/5855)   
Checking out files:  62% (3631/5855)   
Checking out files:  63% (3689/5855)   
Checking out files:  64% (3748/5855)   
Checking out files:  65% (3806/5855)   
Checking out files:  66% (3865/5855)   
Checking out files:  67% (3923/5855)   
Checking out files:  68% (3982/5855)   
Checking out files:  69% (4040/5855)   
Checking out files:  70% (4099/5855)   
Checking out files:  71% (4158/5855)   
Checking out files:  72% (4216/5855)   
Checking out files:  73% (4275/5855)   
Checking out files:  74% (4333/5855)   
Checking out files:  75% (4392/5855)   
Checking out files:  76% (4450/5855)   
Checking out files:  77% (4509/5855)   
Checking out files:  78% (4567/5855)   
Checking out files:  79% (4626/5855)   
Checking out files:  80% (4684/5855)   
Checking out files:  81% (4743/5855)   
Checking out files:  82% (4802/5855)   
Checking out files:  83% (4860/5855)   
Checking out files:  84% (4919/5855)   
Checking out files:  85% (4977/5855)   
Checking out files:  86% (5036/5855)   
Checking out files:  87% (5094/5855)   
Checking out files:  88% (5153/5855)   
Checking out files:  89% (5211/5855)   
Checking out files:  90% (5270/5855)   
Checking out files:  91% (5329/5855)   
Checking out files:  92% (5387/5855)   
Checking out files:  93% (5446/5855)   
Checking out files:  94% (5504/5855)   
Checking out files:  95% (5563/5855)   
Checking out files:  96% (5621/5855)   
Checking out files:  97% (5680/5855)   
Checking out files:  98% (5738/5855)   
Checking out files:  99% (5797/5855)   
Checking out files: 100% (5855/5855)   
Checking out files: 100% (5855/5855), done.
Your branch is up-to-date with 'origin/test'.
Submodule 'dtc' (git://git.qemu-project.org/dtc.git) registered for path 'dtc'
Cloning into 
'/var/tmp/patchew-tester-tmp-_kso1q75/src/docker-src.2018-02-24-05.22.36.20222/qemu.tar.vroot/dtc'...
Submodule path 'dtc': checked out 'e54388015af1fb4bf04d0bca99caba1074d9cc42'
Submodule 'ui/keycodemapdb' (git://git.qemu.org/keycodemapdb.git) registered 
for path 'ui/keycodemapdb'
Cloning into 
'/var/tmp/patchew-tester-tmp-_kso1q75/src/docker-src.2018-02-24-05.22.36.20222/qemu.tar.vroot/ui/keycodemapdb'...
Submodule path 'ui/keycodemapdb': checked out 
'6b3d716e2b6472eb7189d3220552280ef3d832ce'
  COPYRUNNER
RUN test-build in qemu:min-glib 
Environment variables:
HOSTNAME=2a4ff165842d
MAKEFLAGS= -j8
J=8
CCACHE_DIR=/var/tmp/ccache
EXTRA_CONFIGURE_OPTS=
V=
SHOW_ENV=1
PATH=/usr/lib/ccache:/usr/lib64/ccache:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PWD=/
TARGET_LIST=
SHLVL=1
HOME=/root
TEST_DIR=/tmp/qemu-test
FEATURES= dtc
DEBUG=
_=/usr/bin/env

Configure options:
--enable-werror --target-list=x86_64-softmmu,aarch64-softmmu 
--prefix=/tmp/qemu-test/install
No C++ compiler available; disabling C++ specific optional code
Install prefix/tmp/qemu-test/install
BIOS directory/tmp/qemu-test/install/share/qemu
firmware path /tmp/qemu-test/install/share/qemu-firmware
binary directory  /tmp/qemu-test/install/bin
library directory /tmp/qemu-test/install/lib
module directory  /tmp/qemu-test/install/lib/qemu
libexec directory 

[Qemu-devel] [PATCH v2] intel-iommu: Accept 64-bit writes to FEADDR

2018-02-24 Thread Jan Kiszka
From: Jan Kiszka 

Xen is doing this [1] and currently triggers an abort.

[1] 
http://xenbits.xenproject.org/gitweb/?p=xen.git;a=blob;f=xen/drivers/passthrough/vtd/iommu.c;h=daaed0abbdd06b6ba3d948ea103aadf02651e83c;hb=refs/heads/master#l1108

Reported-by: Luis Lloret 
Signed-off-by: Jan Kiszka 
---
 hw/i386/intel_iommu.c | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
index 2e841cde27..fb31de9416 100644
--- a/hw/i386/intel_iommu.c
+++ b/hw/i386/intel_iommu.c
@@ -2129,8 +2129,15 @@ static void vtd_mem_write(void *opaque, hwaddr addr,
 
 /* Fault Event Address Register, 32-bit */
 case DMAR_FEADDR_REG:
-assert(size == 4);
-vtd_set_long(s, addr, val);
+if (size == 4) {
+vtd_set_long(s, addr, val);
+} else {
+/*
+ * While the register is 32-bit only, some guests (Xen...) write to
+ * it with 64-bit.
+ */
+vtd_set_quad(s, addr, val);
+}
 break;
 
 /* Fault Event Upper Address Register, 32-bit */



Re: [Qemu-devel] [PATCH] ppc: Fix size of ppc64 xer register (fwd)

2018-02-24 Thread no-reply
Hi,

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

Type: series
Message-id: alpine.lsu.2.21.1802231729040.10...@wotan.suse.de
Subject: [Qemu-devel] [PATCH] ppc: Fix size of ppc64 xer register (fwd)

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram

commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
failed=1
echo
fi
n=$((n+1))
done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
41b2585f4d ppc: Fix size of ppc64 xer register (fwd)

=== OUTPUT BEGIN ===
Checking PATCH 1/1: ppc: Fix size of ppc64 xer register (fwd)...
ERROR: spaces required around that '+' (ctx:VxV)
#39: FILE: target/ppc/gdbstub.c:43:
+case 69+32: /* xer */
^

total: 1 errors, 0 warnings, 59 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

=== OUTPUT END ===

Test command exited with code: 1


---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-de...@freelists.org