Skip to content
Snippets Groups Projects
  1. May 21, 2021
    • Peter Maydell's avatar
      Merge remote-tracking branch 'remotes/vsementsov/tags/pull-simplebench-2021-05-04' into staging · 6c769690
      Peter Maydell authored
      
      scripts/simplebench improvements for 2021-05-04
      
      # gpg: Signature made Tue 04 May 2021 09:45:15 BST
      # gpg:                using RSA key 8B9C26CDB2FD147C880E86A1561F24C1F19F79FB
      # gpg: Good signature from "Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>" [unknown]
      # gpg: WARNING: This key is not certified with a trusted signature!
      # gpg:          There is no indication that the signature belongs to the owner.
      # Primary key fingerprint: 8B9C 26CD B2FD 147C 880E  86A1 561F 24C1 F19F 79FB
      
      * remotes/vsementsov/tags/pull-simplebench-2021-05-04:
        MAINTAINERS: update Benchmark util: add git tree
        simplebench/bench-backup: add --drop-caches argument
        simplebench/bench-backup: add --count and --no-initial-run
        simplebench/bench-backup: support qcow2 source files
        simplebench/bench_block_job: handle error in BLOCK_JOB_COMPLETED
        simplebench/bench-backup: add target-cache argument
        simplebench/bench-backup: add --compressed option
        simplebench: bench_one(): support count=1
        simplebench: bench_one(): add slow_limit argument
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      6c769690
    • Peter Maydell's avatar
      Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2021-05-11' into staging · da9076f3
      Peter Maydell authored
      
      nbd patches for 2021-05-11
      
      - fix fd passing to qemu-storage-daemon --nbd-server
      
      # gpg: Signature made Tue 11 May 2021 20:26:22 BST
      # gpg:                using RSA key 71C2CC22B1C4602927D2F3AAA7A16B4A2527436A
      # gpg: Good signature from "Eric Blake <eblake@redhat.com>" [full]
      # gpg:                 aka "Eric Blake (Free Software Programmer) <ebb9@byu.net>" [full]
      # gpg:                 aka "[jpeg image of size 6874]" [full]
      # Primary key fingerprint: 71C2 CC22 B1C4 6029 27D2  F3AA A7A1 6B4A 2527 436A
      
      * remotes/ericb/tags/pull-nbd-2021-05-11:
        sockets: update SOCKET_ADDRESS_TYPE_FD listen(2) backlog
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      da9076f3
  2. May 20, 2021
    • Peter Maydell's avatar
      Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2021-05-20' into staging · 0b5acf89
      Peter Maydell authored
      
      QAPI patches patches for 2021-05-20
      
      # gpg: Signature made Thu 20 May 2021 16:10:21 BST
      # gpg:                using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653
      # gpg:                issuer "armbru@redhat.com"
      # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full]
      # gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>" [full]
      # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653
      
      * remotes/armbru/tags/pull-qapi-2021-05-20:
        qapi/parser: add docstrings
        qapi/parser: allow 'ch' variable name
        qapi/parser: Remove superfluous list comprehension
        qapi/parser: add type hint annotations
        qapi/parser: Rework _check_pragma_list_of_str as a TypeGuard
        qapi/parser: Fix token membership tests when token can be None
        qapi: add must_match helper
        qapi/parser: Use @staticmethod where appropriate
        qapi/parser: assert object keys are strings
        qapi/parser: enforce all top-level expressions must be dict in _parse()
        qapi/parser: Assert lexer value is a string
        qapi/parser: factor parsing routine into method
        qapi/source: Remove line number from QAPISourceInfo initializer
        qapi: Add test for nonexistent schema file
        qapi/parser: Don't try to handle file errors
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      0b5acf89
    • Peter Maydell's avatar
      Merge remote-tracking branch 'remotes/cohuck-gitlab/tags/s390x-20210520-v2' into staging · 972e848b
      Peter Maydell authored
      
      s390x fixes and cleanups; also related fixes in xtensa,
      arm, and x86 code
      
      # gpg: Signature made Thu 20 May 2021 13:23:15 BST
      # gpg:                using RSA key C3D0D66DC3624FF6A8C018CEDECF6B93C6F02FAF
      # gpg:                issuer "cohuck@redhat.com"
      # gpg: Good signature from "Cornelia Huck <conny@cornelia-huck.de>" [unknown]
      # gpg:                 aka "Cornelia Huck <huckc@linux.vnet.ibm.com>" [full]
      # gpg:                 aka "Cornelia Huck <cornelia.huck@de.ibm.com>" [full]
      # gpg:                 aka "Cornelia Huck <cohuck@kernel.org>" [unknown]
      # gpg:                 aka "Cornelia Huck <cohuck@redhat.com>" [unknown]
      # Primary key fingerprint: C3D0 D66D C362 4FF6 A8C0  18CE DECF 6B93 C6F0 2FAF
      
      * remotes/cohuck-gitlab/tags/s390x-20210520-v2:
        tests/tcg/x86_64: add vsyscall smoke test
        target/i386: Make sure that vsyscall's tb->size != 0
        vfio-ccw: Attempt to clean up all IRQs on error
        hw/s390x/ccw: Register qbus type in abstract TYPE_CCW_DEVICE parent
        vfio-ccw: Permit missing IRQs
        accel/tcg: Assert that tb->size != 0 after translation
        target/xtensa: Make sure that tb->size != 0
        target/arm: Make sure that commpage's tb->size != 0
        target/s390x: Fix translation exception on illegal instruction
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      972e848b
    • John Snow's avatar
      qapi/parser: add docstrings · d4092ffa
      John Snow authored
      
      Signed-off-by: default avatarJohn Snow <jsnow@redhat.com>
      Message-Id: <20210519183951.3946870-16-jsnow@redhat.com>
      Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
      [Doc string spacing tweaked slightly]
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      d4092ffa
    • John Snow's avatar
      qapi/parser: allow 'ch' variable name · 9b91e76b
      John Snow authored
      
      We can have a two-letter variable name, as a treat.
      
      Signed-off-by: default avatarJohn Snow <jsnow@redhat.com>
      Message-Id: <20210519183951.3946870-15-jsnow@redhat.com>
      Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      9b91e76b
    • Peter Maydell's avatar
      Merge remote-tracking branch 'remotes/bsdimp/tags/pull-bsd-user-20210511' into staging · a1362f39
      Peter Maydell authored
      
      pull-bsd-user-20210511 is the next round of cleanups to bsd-user in merging the
      bsd-user fork into qemu. It contains a number of style commits, as well as 3
      commits that start to change things: Some unused files are deleted, building the
      sparc and sparc64 targets are removed, and a structure is renamed.
      
      The next set of pull requests will start to execute the following plan:
      1. Move existing code around to have a structure similar to the bsd-user fork.
      2. Incrementally merge groups of system calls, focused on making x86 work.
      3. Once the groups of system calls are all merged, additional platforms will
         be added back.
      4. Concurrently, as changes are requested as part of the merge happen, those
         changes will be merged into the fork. An experimental merge to tip of master
         is under test and is what will be updated.
      5. Eventually, there will be no diference, and the bsd-user fork will only
         be a staging area for cutting-edge features prior to upstreaming into
         qemu mainline.
      
      The bsd-user code in qemu has a lot of style issues. This cleans up a number in
      the files touched. However, the checkpatch.pl detects some incremental issues in
      the commits. The following are expected, but are corrected in later hashes in
      this branch. MAINTAINERS does not need to be updated, since all the files added
      or deleted are covered under existing regexp in MAINTAINERS.
      
      Checking all commits since f9a576a8...
      d60c3b93:101: ERROR: consider using qemu_strtol in preference to strtol
      d60c3b93:142: ERROR: braces {} are necessary for all arms of this statement
      d60c3b93:145: ERROR: braces {} are necessary for all arms of this statement
      total: 3 errors, 0 warnings, 119 lines checked
      b4bebeee:148: WARNING: line over 80 characters
      b4bebeee:330: ERROR: braces {} are necessary for all arms of this statement
      b4bebeee:340: ERROR: braces {} are necessary for all arms of this statement
      b4bebeee:381: ERROR: space prohibited between function name and open parenthesis '('
      b4bebeee:390: ERROR: spaces required around that '<' (ctx:VxV)
      b4bebeee:408: WARNING: Block comments use a leading /* on a separate line
      b4bebeee:409: WARNING: Block comments use * on subsequent lines
      b4bebeee:409: WARNING: Block comments use a trailing */ on a separate line
      b4bebeee:441: WARNING: line over 80 characters
      b4bebeee:445: WARNING: line over 80 characters
      b4bebeee:502: ERROR: line over 90 characters
      b4bebeee:551: ERROR: space required after that ',' (ctx:VxV)
      b4bebeee:552: ERROR: space required after that ',' (ctx:VxV)
      b4bebeee:587: ERROR: space required after that ';' (ctx:VxV)
      b4bebeee:623: ERROR: suspect code indent for conditional statements (12, 14)
      total: 9 errors, 6 warnings, 664 lines checked
      86545e7a:31: ERROR: space required after that ';' (ctx:VxV)
      86545e7a:40: ERROR: space required after that ';' (ctx:VxV)
      total: 2 errors, 0 warnings, 60 lines checked
      Use of uninitialized value $acpi_testexpected in string eq at scripts/checkpatch.pl line 1529.
      65d58c91:22: WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
      total: 0 errors, 1 warnings, 14 lines checked
      Use of uninitialized value $acpi_testexpected in string eq at scripts/checkpatch.pl line 1529.
      f8ce3970:21: WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
      total: 0 errors, 1 warnings, 0 lines checked
         FAIL one or more commits failed scripts/checkpatch.pl
      Cleaning up file based variables
      ERROR: Job failed: exit code 1
      
      # gpg: Signature made Wed 12 May 2021 17:40:34 BST
      # gpg:                using RSA key 2035F894B00AA3CF7CCDE1B76C1CD1287DB01100
      # gpg: Good signature from "Warner Losh <wlosh@netflix.com>" [unknown]
      # gpg:                 aka "Warner Losh <imp@bsdimp.com>" [unknown]
      # gpg:                 aka "Warner Losh <imp@freebsd.org>" [unknown]
      # gpg:                 aka "Warner Losh <imp@village.org>" [unknown]
      # gpg:                 aka "Warner Losh <wlosh@bsdimp.com>" [unknown]
      # gpg: WARNING: This key is not certified with a trusted signature!
      # gpg:          There is no indication that the signature belongs to the owner.
      # Primary key fingerprint: 2035 F894 B00A A3CF 7CCD  E1B7 6C1C D128 7DB0 1100
      
      * remotes/bsdimp/tags/pull-bsd-user-20210511:
        bsd-user: rename linux_binprm to bsd_binprm
        bsd-user: Stop building the sparc targets
        bsd-user: remove target_signal.h, it's unused
        bsd-user: style tweak: keyword space (
        bsd-user: style tweak: Remove #if 0'd code
        bsd-user: style tweak: keyword space (
        bsd-user: style tweak: keyword space (
        bsd-user: whitespace changes
        bsd-user: use qemu_strtoul in preference to strtol
        bsd-user: style tweak: use {} consistently in for / if / else statements
        bsd-user: style tweak: use {} for all if statements, format else correctly
        bsd-user: style tweak: don't assign in if statements
        bsd-user: style tweak: Use preferred block comments
        bsd-user: style tweak: remove spacing after '*' and add after }
        bsd-user: style tweak: move extern to header file
        bsd-user: Remove commented out code
        bsd-user: style tweak: Use preferred block comments
        bsd-user: style tweak: Remove #if 0'd code
        bsd-user: style tweak: use C not C++ comments
        bsd-user: whitespace changes
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      a1362f39
    • Ilya Leoshkevich's avatar
      tests/tcg/x86_64: add vsyscall smoke test · f6648775
      Ilya Leoshkevich authored
      
      Having a small test will prevent trivial regressions in the future.
      
      Signed-off-by: default avatarIlya Leoshkevich <iii@linux.ibm.com>
      Message-Id: <20210519045738.1335210-3-iii@linux.ibm.com>
      Reviewed-by: default avatarRichard Henderson <richard.henderson@linaro.org>
      Signed-off-by: default avatarCornelia Huck <cohuck@redhat.com>
      f6648775
    • Ilya Leoshkevich's avatar
      target/i386: Make sure that vsyscall's tb->size != 0 · 9b21049e
      Ilya Leoshkevich authored
      
      tb_gen_code() assumes that tb->size must never be zero, otherwise it
      may produce spurious exceptions. For x86_64 this may happen when
      creating a translation block for the vsyscall page.
      
      Fix by pretending that vsyscall translation blocks have at least one
      instruction.
      
      Signed-off-by: default avatarIlya Leoshkevich <iii@linux.ibm.com>
      Reviewed-by: default avatarRichard Henderson <richard.henderson@linaro.org>
      Message-Id: <20210519045738.1335210-2-iii@linux.ibm.com>
      Signed-off-by: default avatarCornelia Huck <cohuck@redhat.com>
      9b21049e
    • Eric Farman's avatar
      vfio-ccw: Attempt to clean up all IRQs on error · dcc9cf38
      Eric Farman authored
      
      The vfio_ccw_unrealize() routine makes an unconditional attempt to
      unregister every IRQ notifier, though they may not have been registered
      in the first place (when running on an older kernel, for example).
      
      Let's mirror this behavior in the error cleanups in vfio_ccw_realize()
      so that if/when new IRQs are added, it is less confusing to recognize
      the necessary procedures. The worst case scenario would be some extra
      messages about an undefined IRQ, but since this is an error exit that
      won't be the only thing to worry about.
      
      And regarding those messages, let's change it to a warning instead of
      an error, to better reflect their severity. The existing code in both
      paths handles everything anyway.
      
      Signed-off-by: default avatarEric Farman <farman@linux.ibm.com>
      Acked-by: default avatarMatthew Rosato <mjrosato@linux.ibm.com>
      Message-Id: <20210428143652.1571487-1-farman@linux.ibm.com>
      Signed-off-by: default avatarCornelia Huck <cohuck@redhat.com>
      dcc9cf38
    • Philippe Mathieu-Daudé's avatar
      hw/s390x/ccw: Register qbus type in abstract TYPE_CCW_DEVICE parent · a6d8b731
      Philippe Mathieu-Daudé authored
      
      Instead of having all TYPE_CCW_DEVICE children set the bus type to
      TYPE_VIRTUAL_CSS_BUS, do it once in the abstract parent.
      
      Signed-off-by: default avatarPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Acked-by: default avatarEric Farman <farman@linux.ibm.com>
      Message-Id: <20210424145313.3287400-1-f4bug@amsat.org>
      Signed-off-by: default avatarCornelia Huck <cohuck@redhat.com>
      a6d8b731
    • Eric Farman's avatar
      vfio-ccw: Permit missing IRQs · 6178d468
      Eric Farman authored
      
      Commit 690e29b9 ("vfio-ccw: Refactor ccw irq handler") changed
      one of the checks for the IRQ notifier registration from saying
      "the host needs to recognize the only IRQ that exists" to saying
      "the host needs to recognize ANY IRQ that exists."
      
      And this worked fine, because the subsequent change to support the
      CRW IRQ notifier doesn't get into this code when running on an older
      kernel, thanks to a guard by a capability region. The later addition
      of the REQ(uest) IRQ by commit b2f96f9e ("vfio-ccw: Connect the
      device request notifier") broke this assumption because there is no
      matching capability region. Thus, running new QEMU on an older
      kernel fails with:
      
        vfio: unexpected number of irqs 2
      
      Let's adapt the message here so that there's a better clue of what
      IRQ is missing.
      
      Furthermore, let's make the REQ(uest) IRQ not fail when attempting
      to register it, to permit running vfio-ccw on a newer QEMU with an
      older kernel.
      
      Fixes: b2f96f9e ("vfio-ccw: Connect the device request notifier")
      Signed-off-by: default avatarEric Farman <farman@linux.ibm.com>
      Message-Id: <20210421152053.2379873-1-farman@linux.ibm.com>
      Signed-off-by: default avatarCornelia Huck <cohuck@redhat.com>
      6178d468
    • Ilya Leoshkevich's avatar
      accel/tcg: Assert that tb->size != 0 after translation · 0b00b0c1
      Ilya Leoshkevich authored
      
      If arch-specific code generates a translation block of size 0,
      tb_gen_code() may generate a spurious exception. Add an assertion in
      order to catch such situations early.
      
      Signed-off-by: default avatarIlya Leoshkevich <iii@linux.ibm.com>
      Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
      Message-Id: <20210416154939.32404-5-iii@linux.ibm.com>
      Signed-off-by: default avatarCornelia Huck <cohuck@redhat.com>
      0b00b0c1
    • Ilya Leoshkevich's avatar
      target/xtensa: Make sure that tb->size != 0 · f689befd
      Ilya Leoshkevich authored
      
      tb_gen_code() assumes that tb->size must never be zero, otherwise it
      may produce spurious exceptions. For xtensa this may happen when
      decoding an unknown instruction, when handling a write into the
      CCOUNT or CCOMPARE special register and when single-stepping the first
      instruction of an exception handler.
      
      Fix by pretending that the size of the respective translation block is
      1 in all these cases.
      
      Signed-off-by: default avatarIlya Leoshkevich <iii@linux.ibm.com>
      Tested-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
      Acked-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
      Message-Id: <20210416154939.32404-4-iii@linux.ibm.com>
      Signed-off-by: default avatarCornelia Huck <cohuck@redhat.com>
      f689befd
    • Ilya Leoshkevich's avatar
      target/arm: Make sure that commpage's tb->size != 0 · 48a13092
      Ilya Leoshkevich authored
      
      tb_gen_code() assumes that tb->size must never be zero, otherwise it
      may produce spurious exceptions. For ARM this may happen when creating
      a translation block for the commpage.
      
      Fix by pretending that commpage translation blocks have at least one
      instruction.
      
      Signed-off-by: default avatarIlya Leoshkevich <iii@linux.ibm.com>
      Reviewed-by: default avatarRichard Henderson <richard.henderson@linaro.org>
      Message-Id: <20210416154939.32404-3-iii@linux.ibm.com>
      Signed-off-by: default avatarCornelia Huck <cohuck@redhat.com>
      48a13092
    • Ilya Leoshkevich's avatar
      target/s390x: Fix translation exception on illegal instruction · 86131c71
      Ilya Leoshkevich authored
      
      Hitting an uretprobe in a s390x TCG guest causes a SIGSEGV. What
      happens is:
      
      * uretprobe maps a userspace page containing an invalid instruction.
      * uretprobe replaces the target function's return address with the
        address of that page.
      * When tb_gen_code() is called on that page, tb->size ends up being 0
        (because the page starts with the invalid instruction), which causes
        virt_page2 to point to the previous page.
      * The previous page is not mapped, so this causes a spurious
        translation exception.
      
      tb->size must never be 0: even if there is an illegal instruction, the
      instruction bytes that have been looked at must count towards tb->size.
      So adjust s390x's translate_one() to act this way for both illegal
      instructions and instructions that are known to generate exceptions.
      
      Signed-off-by: default avatarIlya Leoshkevich <iii@linux.ibm.com>
      Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
      Message-Id: <20210416154939.32404-2-iii@linux.ibm.com>
      Signed-off-by: default avatarCornelia Huck <cohuck@redhat.com>
      86131c71
    • Peter Maydell's avatar
      Merge remote-tracking branch 'remotes/rth-gitlab/tags/pull-x86-20210519' into staging · be05216b
      Peter Maydell authored
      
      Eliminate user-only helper stubs for privledged insns.
      
      # gpg: Signature made Wed 19 May 2021 19:24:27 BST
      # gpg:                using RSA key 7A481E78868B4DB6A85A05C064DF38E8AF7E215F
      # gpg:                issuer "richard.henderson@linaro.org"
      # gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org>" [full]
      # Primary key fingerprint: 7A48 1E78 868B 4DB6 A85A  05C0 64DF 38E8 AF7E 215F
      
      * remotes/rth-gitlab/tags/pull-x86-20210519: (50 commits)
        target/i386: Remove user-only i/o stubs
        target/i386: Move helper_check_io to sysemu
        target/i386: Create helper_check_io
        target/i386: Pass in port to gen_check_io
        target/i386: Tidy gen_check_io
        target/i386: Exit tb after wrmsr
        target/i386: Eliminate user stubs for read/write_crN, rd/wrmsr
        target/i386: Inline user cpu_svm_check_intercept_param
        target/i386: Unify invlpg, invlpga
        target/i386: Move invlpg, hlt, monitor, mwait to sysemu
        target/i386: Pass env to do_pause and do_hlt
        target/i386: Cleanup read_crN, write_crN, lmsw
        target/i386: Remove user stub for cpu_vmexit
        target/i386: Remove pc_start argument to gen_svm_check_intercept
        target/i386: Tidy svm_check_intercept from tcg
        target/i386: Simplify gen_debug usage
        target/i386: Mark some helpers as noreturn
        target/i386: Eliminate SVM helpers for user-only
        target/i386: Implement skinit in translate.c
        target/i386: Assert !GUEST for user-only
        ...
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      be05216b
    • John Snow's avatar
      qapi/parser: Remove superfluous list comprehension · 013a3ace
      John Snow authored
      
      A generator suffices (and quiets a pylint warning).
      
      Signed-off-by: default avatarJohn Snow <jsnow@redhat.com>
      Message-Id: <20210519183951.3946870-14-jsnow@redhat.com>
      Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      013a3ace
    • John Snow's avatar
      qapi/parser: add type hint annotations · 810aff8f
      John Snow authored
      
      Annotations do not change runtime behavior.
      This commit *only* adds annotations.
      
      (Annotations for QAPIDoc are in a forthcoming commit.)
      
      Signed-off-by: default avatarJohn Snow <jsnow@redhat.com>
      Message-Id: <20210519183951.3946870-13-jsnow@redhat.com>
      Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      810aff8f
    • John Snow's avatar
      qapi/parser: Rework _check_pragma_list_of_str as a TypeGuard · 03386200
      John Snow authored
      
      TypeGuards wont exist in Python proper until 3.10. Ah well. We can hack
      up our own by declaring this function to return the type we claim it
      checks for and using this to safely downcast object -> List[str].
      
      In so doing, I bring this function under _pragma so it can use the
      'info' object in its closure. Having done this, _pragma also now no
      longer needs to take a 'self' parameter, so drop it.
      
      To help with line-length, and with the context evident from its new
      scope, rename the function to the shorter check_list_str().
      
      Signed-off-by: default avatarJohn Snow <jsnow@redhat.com>
      
      Message-Id: <20210519183951.3946870-12-jsnow@redhat.com>
      Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      03386200
    • John Snow's avatar
      qapi/parser: Fix token membership tests when token can be None · c256263f
      John Snow authored
      
      When the token can be None (EOF), we can't use 'x in "abc"' style
      membership tests to group types of tokens together, because 'None in
      "abc"' is a TypeError.
      
      Easy enough to fix. (Use a tuple: It's neither a static typing error nor
      a runtime error to check for None in Tuple[str, ...])
      
      Add tests to prevent a regression. (Note: they cannot be added prior to
      this fix, as the unhandled stack trace will not match test output in the
      CI system.)
      
      Signed-off-by: default avatarJohn Snow <jsnow@redhat.com>
      Message-Id: <20210519183951.3946870-11-jsnow@redhat.com>
      Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      c256263f
    • John Snow's avatar
      qapi: add must_match helper · e0e8a0ac
      John Snow authored
      
      Mypy cannot generally understand that these regex functions cannot
      possibly fail. Add a "must_match" helper that makes this clear for
      mypy.
      
      Signed-off-by: default avatarJohn Snow <jsnow@redhat.com>
      Message-Id: <20210519183951.3946870-10-jsnow@redhat.com>
      Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      e0e8a0ac
    • John Snow's avatar
      qapi/parser: Use @staticmethod where appropriate · 43b1be65
      John Snow authored
      
      No self, no thank you!
      
      (Quiets pylint warnings.)
      
      Signed-off-by: default avatarJohn Snow <jsnow@redhat.com>
      Message-Id: <20210519183951.3946870-9-jsnow@redhat.com>
      Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      43b1be65
    • John Snow's avatar
      qapi/parser: assert object keys are strings · 234dce2c
      John Snow authored
      
      The single quote token implies the value is a string. Assert this to be
      the case, to allow us to write an accurate return type for get_members.
      
      Signed-off-by: default avatarJohn Snow <jsnow@redhat.com>
      Message-Id: <20210519183951.3946870-8-jsnow@redhat.com>
      Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      234dce2c
    • John Snow's avatar
      qapi/parser: enforce all top-level expressions must be dict in _parse() · 9cd0205d
      John Snow authored
      
      Instead of using get_expr nested=False, allow get_expr to always return
      any expression. In exchange, add a new error message to the top-level
      parser that explains the semantic error: Top-level expressions must
      always be JSON objects.
      
      This helps mypy understand the rest of this function which assumes that
      get_expr did indeed return a dict.
      
      The exception type changes from QAPIParseError to QAPISemError as a
      result, and the error message in two tests now changes.
      
      Signed-off-by: default avatarJohn Snow <jsnow@redhat.com>
      
      Message-Id: <20210519183951.3946870-7-jsnow@redhat.com>
      Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      9cd0205d
    • John Snow's avatar
      qapi/parser: Assert lexer value is a string · 7c610ce6
      John Snow authored
      
      The type checker can't narrow the type of the token value to string,
      because it's only loosely correlated with the return token.
      
      We know that a token of '#' should always have a "str" value.
      Add an assertion.
      
      Signed-off-by: default avatarJohn Snow <jsnow@redhat.com>
      Message-Id: <20210519183951.3946870-6-jsnow@redhat.com>
      Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      7c610ce6
    • John Snow's avatar
      qapi/parser: factor parsing routine into method · 16ff40ac
      John Snow authored
      
      For the sake of keeping __init__ smaller (and treating it more like a
      gallery of what state variables we can expect to see), put the actual
      parsing action into a parse method. It remains invoked from the init
      method to reduce churn.
      
      To accomplish this, @previously_included becomes the private data
      member ._included, and the filename is stashed as ._fname.
      
      Add any missing declarations to the init method, and group them by
      function so they can be understood quickly at a glance.
      
      Signed-off-by: default avatarJohn Snow <jsnow@redhat.com>
      Message-Id: <20210519183951.3946870-5-jsnow@redhat.com>
      Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      16ff40ac
    • John Snow's avatar
      qapi/source: Remove line number from QAPISourceInfo initializer · b2b31fdf
      John Snow authored
      
      With the QAPISourceInfo(None, None, None) construct gone, there's no
      longer any reason to have to specify that a file starts on the first
      line. Remove it from the initializer and default it to 1.
      
      Remove the last vestiges where we check for 'line' being unset, that
      can't happen, now.
      
      Signed-off-by: default avatarJohn Snow <jsnow@redhat.com>
      Message-Id: <20210519183951.3946870-4-jsnow@redhat.com>
      Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      b2b31fdf
    • John Snow's avatar
      qapi: Add test for nonexistent schema file · 334c3cd5
      John Snow authored
      
      This tests the error-return pathway introduced in the previous commit.
      (Thanks to Paolo for the help with the Meson magic.)
      
      Signed-off-by: default avatarJohn Snow <jsnow@redhat.com>
      
      Message-Id: <20210519183951.3946870-3-jsnow@redhat.com>
      Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      334c3cd5
    • John Snow's avatar
      qapi/parser: Don't try to handle file errors · 3404e574
      John Snow authored
      
      Fixes: f5d4361c
      Fixes: 52a47418
      Fixes: 46f49468
      
      Remove the try/except block that handles file-opening errors in
      QAPISchemaParser.__init__() and add one each to
      QAPISchemaParser._include() and QAPISchema.__init__() respectively.
      
      This simultaneously fixes the typing of info.fname (f5d4361c), A
      static typing violation in test-qapi (46f49468), and a regression of
      an error message (52a47418).
      
      The short-ish version of what motivates this patch is:
      
      - It's hard to write a good error message in the init method,
        because we need to determine the context of our caller to do so.
        It's easier to just let the caller write the message.
      - We don't want to allow QAPISourceInfo(None, None, None) to exist. The
        typing introduced by commit f5d4361c types the 'fname' field as
        (non-optional) str, which was premature until the removal of this
        construct.
      - Errors made using such an object are currently incorrect (since
        52a47418)
      - It's not technically a semantic error if we cannot open the schema.
      - There are various typing constraints that make mixing these two cases
        undesirable for a single special case.
      - test-qapi's code handling an fname of 'None' is now dead, drop it.
        Additionally, Not all QAPIError objects have an 'info' field (since
        46f49468), so deleting this stanza corrects a typing oversight in
        test-qapi introduced by that commit.
      
      Other considerations:
      
      - open() is moved to a 'with' block to ensure file pointers are
        cleaned up deterministically.
      - Python 3.3 deprecated IOError and made it a synonym for OSError.
        Avoid the misleading perception these exception handlers are
        narrower than they really are.
      
      The long version:
      
      The error message here is incorrect (since commit 52a47418):
      
      > python3 qapi-gen.py 'fake.json'
      qapi-gen.py: qapi-gen.py: can't read schema file 'fake.json': No such file or directory
      
      In pursuing it, we find that QAPISourceInfo has a special accommodation
      for when there's no filename. Meanwhile, the intent when QAPISourceInfo
      was typed (f5d4361c) was non-optional 'str'. This usage was
      overlooked.
      
      To remove this, I'd want to avoid having a "fake" QAPISourceInfo
      object. I also don't want to explicitly begin accommodating
      QAPISourceInfo itself being None, because we actually want to eventually
      prove that this can never happen -- We don't want to confuse "The file
      isn't open yet" with "This error stems from a definition that wasn't
      defined in any file".
      
      (An earlier series tried to create a dummy info object, but it was tough
      to prove in review that it worked correctly without creating new
      regressions. This patch avoids that distraction. We would like to first
      prove that we never raise QAPISemError for any built-in object before we
      add "special" info objects. We aren't ready to do that yet.)
      
      So, which way out of the labyrinth?
      
      Here's one way: Don't try to handle errors at a level with "mixed"
      semantic contexts; i.e. don't mix inclusion errors (should report a
      source line where the include was triggered) and command line errors
      (where we specified a file we couldn't read).
      
      Remove the error handling from the initializer of the parser. Pythonic!
      Now it's the caller's job to figure out what to do about it. Handle the
      error in QAPISchemaParser._include() instead, where we can write a
      targeted error message where we are guaranteed to have an 'info' context
      to report with.
      
      The root level error can similarly move to QAPISchema.__init__(), where
      we know we'll never have an info context to report with, so we use a
      more abstract error type.
      
      Now the error looks sensible again:
      
      > python3 qapi-gen.py 'fake.json'
      qapi-gen.py: can't read schema file 'fake.json': No such file or directory
      
      With these error cases separated, QAPISourceInfo can be solidified as
      never having placeholder arguments that violate our desired types. Clean
      up test-qapi along similar lines.
      
      Signed-off-by: default avatarJohn Snow <jsnow@redhat.com>
      Message-Id: <20210519183951.3946870-2-jsnow@redhat.com>
      Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      3404e574
    • Peter Maydell's avatar
      Merge remote-tracking branch... · fea2ad71
      Peter Maydell authored
      Merge remote-tracking branch 'remotes/stsquad/tags/pull-testing-and-plugin-updates-180521-2' into staging
      
      testing and plugin updates:
      
        - various fixes for binfmt_misc docker images
        - add hexagon check-tcg support docker image
        - add tricore check-tcg support
        - refactor ppc docker images
        - add missing ppc64le tests
        - don't use host_cc for test fallback
        - check-tcg configure.sh tweaks for cross compile/clang
        - fix some memory leaks in plugins
      
      # gpg: Signature made Tue 18 May 2021 09:37:21 BST
      # gpg:                using RSA key 6685AE99E75167BCAFC8DF35FBD0DB095A9E2A44
      # gpg: Good signature from "Alex Bennée (Master Work Key) <alex.bennee@linaro.org>" [full]
      # Primary key fingerprint: 6685 AE99 E751 67BC AFC8  DF35 FBD0 DB09 5A9E 2A44
      
      * remotes/stsquad/tags/pull-testing-and-plugin-updates-180521-2: (29 commits)
        configure: use cc, not host_cc to set cross_cc for build arch
        tests/tcg: don't allow clang as a cross compiler
        tests/tcg: fix missing return
        tests/tcg/ppc64le: tests for brh/brw/brd
        tests/docker: gcc-10 based images for ppc64{,le} tests
        tests/tcg/tricore: Add muls test
        tests/tcg/tricore: Add msub test
        tests/tcg/tricore: Add madd test
        tests/tcg/tricore: Add ftoi test
        tests/tcg/tricore: Add fmul test
        tests/tcg/tricore: Add fadd test
        tests/tcg/tricore: Add dvstep test
        tests/tcg/tricore: Add clz test
        tests/tcg/tricore: Add bmerge test
        tests/tcg/tricore: Add macros to create tests and first test 'abs'
        configure: Emit HOST_CC to config-host.mak
        tests/tcg/tricore: Add build infrastructure
        hw/tricore: Add testdevice for tests in tests/tcg/
        tests/tcg: Run timeout cmds using --foreground
        tests/tcg: Add docker_as and docker_ld cmds
        ...
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      fea2ad71
  3. May 19, 2021
Loading