Skip to content
Snippets Groups Projects
  1. Sep 08, 2023
  2. Sep 07, 2023
    • Stefan Hajnoczi's avatar
      Merge tag 'ide-pull-request' of https://gitlab.com/jsnow/qemu into staging · 13d9f6dc
      Stefan Hajnoczi authored
      IDE Pull request
      
      # -----BEGIN PGP SIGNATURE-----
      #
      # iQIzBAABCAAdFiEE+ber27ys35W+dsvQfe+BBqr8OQ4FAmT5RpYACgkQfe+BBqr8
      # OQ7GuA//S/gyyqsnltz4W9D0liaan1a2YsSx7Q2gcKdotdmFwgEHWWuVKorCteQt
      # 1AtkFiA1bawF9ZSRQIpQzMNDOkSJHOs/0HXhdbNRs6JZ6C+c/aLnNSpxIfFpkP3I
      # Wcrmi98F8zHlRc+KGqvZFHW+woqWJxTvglG4OmpMhMWCZRuqADeaxWaywgSXxlK+
      # MtmpsslPeTxHdwa6ijXCJd2ghP59z391Ulo4kZ7YOMou/YLEd/AnezBDtepDGnbb
      # TnyDcvGf+Dp5nJ4Rcp22frZdcxb44+wt2QlQFDp+h6r7KzIEwGIK2LL37sN8VHwU
      # B8GbYkjoPnau2cOaLgmpC1reWkdwaiXfaI+1B/35/jg6hwYHFe6F03+JstMWXHXt
      # ++Wy4MKDx5wRt7cmOu6htS776UC15NMcZB0AzxQuE5mL+eSNp1n5Nw5UW2iD/USL
      # LD2dlMO05acdqn2iXoMTX/K1cUo1wRkEns7PISk+F2ve0PTS1RJUvuiNXs+aDrt9
      # +AfE/e025YMQY8CWLiaihfNH7/QY8vS874SrcDr5rtfhitu16nqq5JpjnyzkqgbR
      # PE+5JWT3QGBOcDMQeNUDfxFlcCVDm3ffIKo/7/PDCfeKQsJkG/nVGF7OmlAVmoUD
      # GsvIlKBegIQvpp8LRabzfeTfbj7NGKFwaShQ6wcqxOakjy+iKx8=
      # =ZRVt
      # -----END PGP SIGNATURE-----
      # gpg: Signature made Wed 06 Sep 2023 23:42:14 EDT
      # gpg:                using RSA key F9B7ABDBBCACDF95BE76CBD07DEF8106AAFC390E
      # gpg: Good signature from "John Snow (John Huston) <jsnow@redhat.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: FAEB 9711 A12C F475 812F  18F2 88A9 064D 1835 61EB
      #      Subkey fingerprint: F9B7 ABDB BCAC DF95 BE76  CBD0 7DEF 8106 AAFC 390E
      
      * tag 'ide-pull-request' of https://gitlab.com/jsnow/qemu
      
      :
        hw/ide/ahci: fix broken SError handling
        hw/ide/ahci: fix ahci_write_fis_sdb()
        hw/ide/ahci: PxCI should not get cleared when ERR_STAT is set
        hw/ide/ahci: PxSACT and PxCI is cleared when PxCMD.ST is cleared
        hw/ide/ahci: simplify and document PxCI handling
        hw/ide/ahci: write D2H FIS when processing NCQ command
        hw/ide/core: set ERR_STAT in unsupported command completion
      
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      13d9f6dc
    • Stefan Hajnoczi's avatar
      Merge tag 'pull-parallels-2023-09-06' of https://src.openvz.org/scm/~den/qemu into staging · c97d45d5
      Stefan Hajnoczi authored
      Parallels format driver changes:
        * Fix comments formatting inside parallels driver
        * Incorrect data end calculation in parallels_open()
        * Check if data_end greater than the file size
        * Add "explicit" argument to parallels_check_leak()
        * Add data_start field to BDRVParallelsState
        * Add checking and repairing duplicate offsets in BAT
        * Image repairing in parallels_open()
        * Use bdrv_co_getlength() in parallels_check_outside_image()
        * Add data_off check
        * Add data_off repairing to parallels_open()
        * Fix record in MAINTAINERS
      
      Parallels format driver tests:
        * Add out-of-image check test for parallels format
        * Add leak check test for parallels format
        * Add test for BAT entries duplication check
        * Refactor tests of parallels images checks (131)
        * Fix cluster size in parallels images tests (131)
        * Fix test 131 after repair was added to parallels_open()
        * Add test for data_off check
      
      # -----BEGIN PGP SIGNATURE-----
      #
      # iQHDBAABCgAtFiEE9vE2f3B8+RUZInytPzClrpN3nJ8FAmT4nUgPHGRlbkBvcGVu
      # dnoub3JnAAoJED8wpa6Td5yf1F4L/j4RsGv+NRJRqZb9JNn2wUm4JdWGyv6ftuuh
      # hT25F44B5S6J3tR3LalDFxHpr+kCXD1Xa3ZJNK14d1G9atw7Bsp5ntxpCmzEALBk
      # 0PH+5fvNuhvt4ZnuYwQX70n3ZmalgzGpwf/jbs9mXUhdLinEr1RWi2f9yfCLmeZU
      # x+0MSOhAdC6ZVsJOTJhGuRWWKL1q5KteuTwQlRCwDay8KF/Mc1OS/iPFqfmlWenM
      # dc88PZBlg2Le15sWWNLc1AZHYguO+4xEPw6fk6RcswccILB2gCUPS6BJB0AuKNOO
      # STPIgzUFMXfgIFhNUOvz58A7UnQGI4dMsRe/2UJIG+Y3qkM4DpjcZ7U/rHxhR6t0
      # +GeeLS+a+aObz79TpB3gZi7leX2bpRUZ8nLkaAnL2umhtdFo5sdqD3xo4xcg4Ebk
      # TbYSmgIM0eZ75d+48g7A+ddkyKYCmworGS9g9Cry6udclbs8yXhVB8KkUbYwtJlC
      # HtNzgaWlw6J7n0MoSpz4OQVKq3bY0A==
      # =grCk
      # -----END PGP SIGNATURE-----
      # gpg: Signature made Wed 06 Sep 2023 11:39:52 EDT
      # gpg:                using RSA key F6F1367F707CF91519227CAD3F30A5AE93779C9F
      # gpg:                issuer "den@openvz.org"
      # gpg: Good signature from "Denis V. Lunev <den@openvz.org>" [unknown]
      # gpg: WARNING: The key's User ID is not certified with a trusted signature!
      # gpg:          There is no indication that the signature belongs to the owner.
      # Primary key fingerprint: F6F1 367F 707C F915 1922  7CAD 3F30 A5AE 9377 9C9F
      
      * tag 'pull-parallels-2023-09-06' of https://src.openvz.org/scm/~den/qemu
      
      :
        iotests: Add test for data_off check
        iotests: Fix test 131 after repair was added to parallels_open()
        iotests: Fix cluster size in parallels images tests (131)
        iotests: Refactor tests of parallels images checks (131)
        iotests: Add test for BAT entries duplication check
        iotests: Add leak check test for parallels format
        iotests: Add out-of-image check test for parallels format
        parallels: Add data_off repairing to parallels_open()
        parallels: Add data_off check
        parallels: Use bdrv_co_getlength() in parallels_check_outside_image()
        parallels: Image repairing in parallels_open()
        parallels: Add checking and repairing duplicate offsets in BAT
        parallels: Add data_start field to BDRVParallelsState
        parallels: Add "explicit" argument to parallels_check_leak()
        parallels: Check if data_end greater than the file size
        parallels: Incorrect data end calculation in parallels_open()
        parallels: Fix comments formatting inside parallels driver
        MAINTAINERS: add tree to keep parallels format driver changes
      
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      c97d45d5
    • Stefan Hajnoczi's avatar
      Merge tag 'pull-ppc-20230906' of https://github.com/legoater/qemu into staging · 269e6063
      Stefan Hajnoczi authored
      ppc queue :
      
      * debug facility improvements
      * timebase and decrementer fixes
      * record-replay fixes
      * TCG fixes
      * XIVE model improvements for multichip
      
      # -----BEGIN PGP SIGNATURE-----
      #
      # iQIzBAABCAAdFiEEoPZlSPBIlev+awtgUaNDx8/77KEFAmT4WKoACgkQUaNDx8/7
      # 7KHjOg//bwENCptopnvX5XVTdGLRgBKoMWPkQhWPv4aHYz4t+bxHVWopdMU7i0aL
      # hge+ZCCkMKsg2rADczbpWytAvC3vo1Pn4zZhZNQuEvYKIpiWVN6hSflmXWP/bN1I
      # AGHlptKvNYKlPfGsmzZ2OZ2yItzrOwKFC/PnPSEc6dxjWfe9hEwzApxaAkOfX8wf
      # C+oH8DPvFmh3PH3rI4psCn/xYtxAPW1zosBtgT7Ii1XreABMHLIfIpOmPPh1yF0d
      # J7BgBdmxIvsN+syH/vh5jTtU4N/gQVorwyds9MX82Y3j0roxBVVLqH8rFjJA3Jsq
      # c/g8WTi1hHiDd8G4m1JcLI1VAhsgh1KhqG9pDaSdQXhP0E4p8N/XjxOR5ro+KxM3
      # Dz/Q77VoEKuat+AXg71kc68i11CninhTVSyGnjI80ISWWYvHFQ2Sv8J9U6sS/d0m
      # +fo6hed7DDgfXg4OMtedF4HMmc6JAfm9eBzHUoanaoIzX0vX6vetXeMfWh6iceYW
      # KNcQuUi3Pvvh/AjE36jusqTkbTleP5Yo4OKNJz4pEP4sU2wQPYU32Lo7Kg7p4WPA
      # j+emWmWX4gcn9zTvm2LPYwkdgQ5HgigUJzq9i9qlMqfOOCpRwAsE7V0KxyV0NwDT
      # cAAOBCdNm4t94Ni3KEING7xuDzERvJ7H2D6uRQjVsre8cMUO0QE=
      # =BUg6
      # -----END PGP SIGNATURE-----
      # gpg: Signature made Wed 06 Sep 2023 06:47:06 EDT
      # gpg:                using RSA key A0F66548F04895EBFE6B0B6051A343C7CFFBECA1
      # gpg: Good signature from "Cédric Le Goater <clg@redhat.com>" [unknown]
      # gpg:                 aka "Cédric Le Goater <clg@kaod.org>" [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: A0F6 6548 F048 95EB FE6B  0B60 51A3 43C7 CFFB ECA1
      
      * tag 'pull-ppc-20230906' of https://github.com/legoater/qemu
      
      : (35 commits)
        ppc/xive: Add support for the PC MMIOs
        ppc/xive: Handle END triggers between chips with MMIOs
        ppc/xive: Introduce a new XiveRouter end_notify() handler
        ppc/xive: Use address_space routines to access the machine RAM
        target/ppc: Fix the order of kvm_enable judgment about kvmppc_set_interrupt()
        hw/ppc/e500: fix broken snapshot replay
        target/ppc: Flush inputs to zero with NJ in ppc_store_vscr
        target/ppc: Fix LQ, STQ register-pair order for big-endian
        tests/avocado: ppc64 reverse debugging tests for pseries and powernv
        tests/avocado: reverse-debugging cope with re-executing breakpoints
        tests/avocado: boot ppc64 pseries replay-record test to Linux VFS mount
        spapr: Fix record-replay machine reset consuming too many events
        spapr: Fix machine reset deadlock from replay-record
        target/ppc: Fix timebase reset with record-replay
        target/ppc: Fix CPU reservation migration for record-replay
        hw/ppc: Read time only once to perform decrementer write
        hw/ppc: Reset timebase facilities on machine reset
        target/ppc: Migrate DECR SPR
        hw/ppc: Always store the decrementer value
        target/ppc: Sign-extend large decrementer to 64-bits
        ...
      
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      269e6063
    • Niklas Cassel's avatar
      hw/ide/ahci: fix broken SError handling · 9f894235
      Niklas Cassel authored
      
      When encountering an NCQ error, you should not write the NCQ tag to the
      SError register. This is completely wrong.
      
      The SError register has a clear definition, where each bit represents a
      different error, see PxSERR definition in AHCI 1.3.1.
      
      If we write a random value (like the NCQ tag) in SError, e.g. Linux will
      read SError, and will trigger arbitrary error handling depending on the
      NCQ tag that happened to be executing.
      
      In case of success, ncq_cb() will call ncq_finish().
      In case of error, ncq_cb() will call ncq_err() (which will clear
      ncq_tfs->used), and then call ncq_finish(), thus using ncq_tfs->used is
      sufficient to tell if finished should get set or not.
      
      Signed-off-by: default avatarNiklas Cassel <niklas.cassel@wdc.com>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@linaro.org>
      Message-id: 20230609140844.202795-9-nks@flawful.org
      Signed-off-by: default avatarJohn Snow <jsnow@redhat.com>
      9f894235
    • Niklas Cassel's avatar
      hw/ide/ahci: fix ahci_write_fis_sdb() · 7e85cb0d
      Niklas Cassel authored
      
      When there is an error, we need to raise a TFES error irq, see AHCI 1.3.1,
      5.3.13.1 SDB:Entry.
      
      If ERR_STAT is set, we jump to state ERR:FatalTaskfile, which will raise
      a TFES IRQ unconditionally, regardless if the I bit is set in the FIS or
      not.
      
      Thus, we should never raise a normal IRQ after having sent an error IRQ.
      
      It is valid to signal successfully completed commands as finished in the
      same SDB FIS that generates the error IRQ. The important thing is that
      commands that did not complete successfully (e.g. commands that were
      aborted, do not get the finished bit set).
      
      Before this commit, there was never a TFES IRQ raised on NCQ error.
      
      Signed-off-by: default avatarNiklas Cassel <niklas.cassel@wdc.com>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@linaro.org>
      Message-id: 20230609140844.202795-8-nks@flawful.org
      Signed-off-by: default avatarJohn Snow <jsnow@redhat.com>
      7e85cb0d
    • Niklas Cassel's avatar
      hw/ide/ahci: PxCI should not get cleared when ERR_STAT is set · 1a16ce64
      Niklas Cassel authored
      
      For NCQ, PxCI is cleared on command queued successfully.
      For non-NCQ, PxCI is cleared on command completed successfully.
      Successfully means ERR_STAT, BUSY and DRQ are all cleared.
      
      A command that has ERR_STAT set, does not get to clear PxCI.
      See AHCI 1.3.1, section 5.3.8, states RegFIS:Entry and RegFIS:ClearCI,
      and 5.3.16.5 ERR:FatalTaskfile.
      
      In the case of non-NCQ commands, not clearing PxCI is needed in order
      for host software to be able to see which command slot that failed.
      
      Signed-off-by: default avatarNiklas Cassel <niklas.cassel@wdc.com>
      Message-id: 20230609140844.202795-7-nks@flawful.org
      Signed-off-by: default avatarJohn Snow <jsnow@redhat.com>
      1a16ce64
    • Niklas Cassel's avatar
      hw/ide/ahci: PxSACT and PxCI is cleared when PxCMD.ST is cleared · d73b84d0
      Niklas Cassel authored
      
      According to AHCI 1.3.1 definition of PxSACT:
      This field is cleared when PxCMD.ST is written from a '1' to a '0' by
      software. This field is not cleared by a COMRESET or a software reset.
      
      According to AHCI 1.3.1 definition of PxCI:
      This field is also cleared when PxCMD.ST is written from a '1' to a '0'
      by software.
      
      Clearing PxCMD.ST is part of the error recovery procedure, see
      AHCI 1.3.1, section "6.2 Error Recovery".
      
      If we don't clear PxCI on error recovery, the previous command will
      incorrectly still be marked as pending after error recovery.
      
      Signed-off-by: default avatarNiklas Cassel <niklas.cassel@wdc.com>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@linaro.org>
      Message-id: 20230609140844.202795-6-nks@flawful.org
      Signed-off-by: default avatarJohn Snow <jsnow@redhat.com>
      d73b84d0
    • Niklas Cassel's avatar
      hw/ide/ahci: simplify and document PxCI handling · e2a5d9b3
      Niklas Cassel authored
      
      The AHCI spec states that:
      For NCQ, PxCI is cleared on command queued successfully.
      
      For non-NCQ, PxCI is cleared on command completed successfully.
      (A non-NCQ command that completes with error does not clear PxCI.)
      
      The current QEMU implementation either clears PxCI in check_cmd(),
      or in ahci_cmd_done().
      
      check_cmd() will clear PxCI for a command if handle_cmd() returns 0.
      handle_cmd() will return -1 if BUSY or DRQ is set.
      
      The QEMU implementation for NCQ commands will currently not set BUSY
      or DRQ, so they will always have PxCI cleared by handle_cmd().
      ahci_cmd_done() will never even get called for NCQ commands.
      
      Non-NCQ commands are executed by ide_bus_exec_cmd().
      Non-NCQ commands in QEMU are implemented either in a sync or in an async
      way.
      
      For non-NCQ commands implemented in a sync way, the command handler will
      return true, and when ide_bus_exec_cmd() sees that a command handler
      returns true, it will call ide_cmd_done() (which will call
      ahci_cmd_done()). For a command implemented in a sync way,
      ahci_cmd_done() will do nothing (since busy_slot is not set). Instead,
      after ide_bus_exec_cmd() has finished, check_cmd() will clear PxCI for
      these commands.
      
      For non-NCQ commands implemented in an async way (using either aiocb or
      pio_aiocb), the command handler will return false, ide_bus_exec_cmd()
      will not call ide_cmd_done(), instead it is expected that the async
      callback function will call ide_cmd_done() once the async command is
      done. handle_cmd() will set busy_slot, if and only if BUSY or DRQ is
      set, and this is checked _after_ ide_bus_exec_cmd() has returned.
      handle_cmd() will return -1, so check_cmd() will not clear PxCI.
      When the async callback calls ide_cmd_done() (which will call
      ahci_cmd_done()), it will see that busy_slot is set, and
      ahci_cmd_done() will clear PxCI.
      
      This seems racy, since busy_slot is set _after_ ide_bus_exec_cmd() has
      returned. The callback might come before busy_slot gets set. And it is
      quite confusing that ahci_cmd_done() will be called for all non-NCQ
      commands when the command is done, but will only clear PxCI in certain
      cases, even though it will always write a D2H FIS and raise an IRQ.
      
      Even worse, in the case where ahci_cmd_done() does not clear PxCI, it
      still raises an IRQ. Host software might thus read an old PxCI value,
      since PxCI is cleared (by check_cmd()) after the IRQ has been raised.
      
      Try to simplify this by always setting busy_slot for non-NCQ commands,
      such that ahci_cmd_done() will always be responsible for clearing PxCI
      for non-NCQ commands.
      
      For NCQ commands, clear PxCI when we receive the D2H FIS, but before
      raising the IRQ, see AHCI 1.3.1, section 5.3.8, states RegFIS:Entry and
      RegFIS:ClearCI.
      
      Signed-off-by: default avatarNiklas Cassel <niklas.cassel@wdc.com>
      Message-id: 20230609140844.202795-5-nks@flawful.org
      Signed-off-by: default avatarJohn Snow <jsnow@redhat.com>
      e2a5d9b3
    • Niklas Cassel's avatar
      hw/ide/ahci: write D2H FIS when processing NCQ command · 2967dc82
      Niklas Cassel authored
      
      The way that BUSY + PxCI is cleared for NCQ (FPDMA QUEUED) commands is
      described in SATA 3.5a Gold:
      
      11.15 FPDMA QUEUED command protocol
      DFPDMAQ2: ClearInterfaceBsy
      "Transmit Register Device to Host FIS with the BSY bit cleared to zero
      and the DRQ bit cleared to zero and Interrupt bit cleared to zero to
      mark interface ready for the next command."
      
      PxCI is currently cleared by handle_cmd(), but we don't write the D2H
      FIS to the FIS Receive Area that actually caused PxCI to be cleared.
      
      Similar to how ahci_pio_transfer() calls ahci_write_fis_pio() with an
      additional parameter to write a PIO Setup FIS without raising an IRQ,
      add a parameter to ahci_write_fis_d2h() so that ahci_write_fis_d2h()
      also can write the FIS to the FIS Receive Area without raising an IRQ.
      
      Change process_ncq_command() to call ahci_write_fis_d2h() without
      raising an IRQ (similar to ahci_pio_transfer()), such that the FIS
      Receive Area is in sync with the PxTFD shadow register.
      
      E.g. Linux reads status and error fields from the FIS Receive Area
      directly, so it is wise to keep the FIS Receive Area and the PxTFD
      shadow register in sync.
      
      Signed-off-by: default avatarNiklas Cassel <niklas.cassel@wdc.com>
      Message-id: 20230609140844.202795-4-nks@flawful.org
      Signed-off-by: default avatarJohn Snow <jsnow@redhat.com>
      2967dc82
    • Niklas Cassel's avatar
      hw/ide/core: set ERR_STAT in unsupported command completion · c3461c62
      Niklas Cassel authored
      
      Currently, the first time sending an unsupported command
      (e.g. READ LOG DMA EXT) will not have ERR_STAT set in the completion.
      Sending the unsupported command again, will correctly have ERR_STAT set.
      
      When ide_cmd_permitted() returns false, it calls ide_abort_command().
      ide_abort_command() first calls ide_transfer_stop(), which will call
      ide_transfer_halt() and ide_cmd_done(), after that ide_abort_command()
      sets ERR_STAT in status.
      
      ide_cmd_done() for AHCI will call ahci_write_fis_d2h() which writes the
      current status in the FIS, and raises an IRQ. (The status here will not
      have ERR_STAT set!).
      
      Thus, we cannot call ide_transfer_stop() before setting ERR_STAT, as
      ide_transfer_stop() will result in the FIS being written and an IRQ
      being raised.
      
      The reason why it works the second time, is that ERR_STAT will still
      be set from the previous command, so when writing the FIS, the
      completion will correctly have ERR_STAT set.
      
      Set ERR_STAT before writing the FIS (calling cmd_done), so that we will
      raise an error IRQ correctly when receiving an unsupported command.
      
      Signed-off-by: default avatarNiklas Cassel <niklas.cassel@wdc.com>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@linaro.org>
      Message-id: 20230609140844.202795-3-nks@flawful.org
      Signed-off-by: default avatarJohn Snow <jsnow@redhat.com>
      c3461c62
  3. Sep 06, 2023
Loading