summaryrefslogtreecommitdiffstats
path: root/hw
Commit message (Collapse)AuthorAgeFilesLines
* adb: Correct class size on TYPE_ADB_DEVICEDavid Gibson2020-09-081-0/+1
| | | | | | | | | | The TypeInfo incorrectly just lets the class size be inherited. It won't actually break things, since the class is abstract, but we should get it right. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Cédric Le Goater <clg@kaod.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
* cirrus: handle wraparound in cirrus_invalidate_regionGerd Hoffmann2020-09-041-3/+9
| | | | | | | | | | | | | | Code simply asserts that there is no wraparound instead of handling it properly. The assert() can be triggered by the guest (must be privilidged inside the guest though). Fix it. Buglink: https://bugs.launchpad.net/qemu/+bug/1880189 Cc: Li Qiang <liq3ea@163.com> Reported-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Li Qiang <liq3ea@163.com> Message-id: 20200901140944.24101-1-kraxel@redhat.com
* virtio-gpu: fix unmap the already mapped itemsLi Zhijian2020-09-041-1/+4
| | | | | | | | | | we go here either (!(*iov)[i].iov_base) or (len != l), so we need to consider to unmap the 'i'th item as well when the 'i'th item is not nil CC: Li Qiang <liq3ea@gmail.com> Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com> Message-id: 20200827035855.24354-1-lizhijian@cn.fujitsu.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* Merge remote-tracking branch ↵Peter Maydell2020-09-032-11/+47
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 'remotes/huth-gitlab/tags/pull-request-2020-09-03' into staging * Cirrus-CI improvements and fixes (compile with -Werror & fix for 1h problem) * Two build system fixes to fix some failures the CI * One m68k QOMification patch * Some trivial qtest patches * Some small improvements for the Gitlab CI # gpg: Signature made Thu 03 Sep 2020 12:04:32 BST # gpg: using RSA key 27B88847EEE0250118F3EAB92ED9D774FE702DB5 # gpg: issuer "thuth@redhat.com" # gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [full] # gpg: aka "Thomas Huth <thuth@redhat.com>" [full] # gpg: aka "Thomas Huth <huth@tuxfamily.org>" [full] # gpg: aka "Thomas Huth <th.huth@posteo.de>" [unknown] # Primary key fingerprint: 27B8 8847 EEE0 2501 18F3 EAB9 2ED9 D774 FE70 2DB5 * remotes/huth-gitlab/tags/pull-request-2020-09-03: gitlab-ci.yml: Set artifacts expiration time gitlab-ci.yml: Run check-qtest and check-unit at the end of the fuzzer job gitlab/travis: Rework the disabled features tests libqtest: Rename qmp_assert_error_class() to qmp_expect_error_and_unref() tests/qtest/ipmi-kcs: Fix assert side-effect tests/qtest/tpm: Declare input buffers const and static tests/qtest/ahci: Improve error handling (NEGATIVE_RETURNS) hw/m68k: QOMify the mcf5206 system integration module configure: Add system = 'linux' for meson when cross-compiling meson: fix keymaps without qemu-keymap cirrus.yml: Split FreeBSD job into two parts cirrus.yml: Update the macOS jobs to Catalina cirrus.yml: Compile macOS with -Werror cirrus.yml: Compile FreeBSD with -Werror configure: Fix atomic64 test for --enable-werror on macOS Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
| * hw/m68k: QOMify the mcf5206 system integration moduleThomas Huth2020-09-032-11/+47
| | | | | | | | | | | | | | | | The mcf5206 system integration module should be a proper device. Let's finally QOMify it. Signed-off-by: Thomas Huth <huth@tuxfamily.org> Message-Id: <20200819065201.4045-1-huth@tuxfamily.org>
* | Merge remote-tracking branch 'remotes/legoater/tags/pull-aspeed-20200901' ↵Peter Maydell2020-09-037-94/+195
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into staging Various fixes of Aspeed machines : * New Supermicro X11 BMC machine (Erik) * Fixed valid access size on AST2400 SCU * Improved robustness of the ftgmac100 model. * New flash models in m25p80 (Igor) * Fixed reset sequence of SDHCI/eMMC controllers * Improved support of the AST2600 SDMC (Joel) * Couple of SMC cleanups # gpg: Signature made Tue 01 Sep 2020 13:39:20 BST # gpg: using RSA key A0F66548F04895EBFE6B0B6051A343C7CFFBECA1 # gpg: Good signature from "Cédric Le Goater <clg@kaod.org>" [undefined] # 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 * remotes/legoater/tags/pull-aspeed-20200901: hw: add a number of SPI-flash's of m25p80 family arm: aspeed: add strap define `25HZ` of AST2500 aspeed/smc: Open AHB window of the second chip of the AST2600 FMC controller aspeed/sdmc: Simplify calculation of RAM bits aspeed/sdmc: Allow writes to unprotected registers aspeed/sdmc: Perform memory training ftgmac100: Improve software reset ftgmac100: Fix integer overflow in ftgmac100_do_tx() ftgmac100: Check for invalid len and address before doing a DMA transfer ftgmac100: Change interrupt status when a DMA error occurs ftgmac100: Fix interrupt status "Packet moved to RX FIFO" ftgmac100: Fix interrupt status "Packet transmitted on ethernet" ftgmac100: Fix registers that can be read aspeed/sdhci: Fix reset sequence aspeed/smc: Fix max_slaves of the legacy SMC device aspeed/smc: Fix MemoryRegionOps definition hw/arm/aspeed: Add board model for Supermicro X11 BMC aspeed/scu: Fix valid access size on AST2400 m25p80: Add support for n25q512ax3 m25p80: Return the JEDEC ID twice for mx25l25635e Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
| * | hw: add a number of SPI-flash's of m25p80 familyIgor Kononenko2020-09-011-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Support a following SPI flashes: * mx66l51235f * mt25ql512ab Signed-off-by: Igor Kononenko <i.kononenko@yadro.com> Reviewed-by: Cédric Le Goater <clg@kaod.org> Message-Id: <20200811203724.20699-1-i.kononenko@yadro.com> Message-Id: <20200819100956.2216690-22-clg@kaod.org> Signed-off-by: Cédric Le Goater <clg@kaod.org>
| * | aspeed/smc: Open AHB window of the second chip of the AST2600 FMC controllerCédric Le Goater2020-09-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change works around the HW default values to be able to test the Tacoma board with -kernel command line option. This was required when we had both flash chips enabled in the device tree, otherwise Linux would fail to probe the entire controller leaving it with no rootfs. Reviewed-by: Joel Stanley <joel@jms.id.au> Message-Id: <20200819100956.2216690-20-clg@kaod.org> Signed-off-by: Cédric Le Goater <clg@kaod.org>
| * | aspeed/sdmc: Simplify calculation of RAM bitsCédric Le Goater2020-09-011-54/+25Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changes in commit 533eb415df2e ("arm/aspeed: actually check RAM size") introduced a 'valid_ram_sizes' array which can be used to compute the associated bit field value encoding the RAM size. The field is simply the index of the array. Reviewed-by: Joel Stanley <joel@jms.id.au> Message-Id: <20200819100956.2216690-19-clg@kaod.org> Signed-off-by: Cédric Le Goater <clg@kaod.org>
| * | aspeed/sdmc: Allow writes to unprotected registersJoel Stanley2020-09-011-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | A subset of registers are not protected by the lock behaviour, so allow unconditionally writing to those. Signed-off-by: Joel Stanley <joel@jms.id.au> Message-Id: <20200819100956.2216690-18-clg@kaod.org> Signed-off-by: Cédric Le Goater <clg@kaod.org>
| * | aspeed/sdmc: Perform memory trainingJoel Stanley2020-09-012-3/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows qemu to run the "normal" power on reset boot path through u-boot, where the DDR is trained. An enhancement would be to have the SCU bit stick across qemu reboots, but be unset on initial boot. Proper modelling would be to discard all writes to the phy setting regs at offset 0x100 - 0x400 and to model the phy status regs at offset 0x400. The status regs model would only need to account for offets 0x00, 0x50, 0x68 and 0x7c. Signed-off-by: Joel Stanley <joel@jms.id.au> [ clg: checkpatch fixes ] Message-Id: <20200819100956.2216690-17-clg@kaod.org> Signed-off-by: Cédric Le Goater <clg@kaod.org>
| * | ftgmac100: Improve software resetCédric Le Goater2020-09-011-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The software reset of the MAC needs a finer granularity. Some settings in MACCR are kept. Cc: Frederic Konrad <konrad.frederic@yahoo.fr> Fixes: bd44300d1afc ("net: add FTGMAC100 support") Message-Id: <20200819100956.2216690-16-clg@kaod.org> Signed-off-by: Cédric Le Goater <clg@kaod.org>
| * | ftgmac100: Fix integer overflow in ftgmac100_do_tx()Cédric Le Goater2020-09-011-16/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When inserting the VLAN tag in packets, memmove() can generate an integer overflow for packets whose length is less than 12 bytes. Move the VLAN insertion when the last segment of the frame is reached and check length against the size of the ethernet header (14 bytes) to avoid the crash. Return FTGMAC100_INT_XPKT_LOST status if the frame is too small. This seems like a good modeling choice even if Aspeed does not specify anything in that case. Cc: Frederic Konrad <konrad.frederic@yahoo.fr> Cc: Mauro Matteo Cascella <mcascell@redhat.com> Reported-by: Ziming Zhang <ezrakiez@gmail.com> Message-Id: <20200819100956.2216690-15-clg@kaod.org> Signed-off-by: Cédric Le Goater <clg@kaod.org>
| * | ftgmac100: Check for invalid len and address before doing a DMA transferCédric Le Goater2020-09-011-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | According to the Aspeed specs, no interrupts are raised in that case but a "Tx-packets lost" status seems like a good modeling choice for all implementations. It is covered by the Linux kernel. Cc: Frederic Konrad <konrad.frederic@yahoo.fr> Reviewed-by: Joel Stanley <joel@jms.id.au> Message-Id: <20200819100956.2216690-14-clg@kaod.org> Signed-off-by: Cédric Le Goater <clg@kaod.org>
| * | ftgmac100: Change interrupt status when a DMA error occursCédric Le Goater2020-09-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The model uses today the "Normal priority transmit buffer unavailable" interrupt status which it is not appropriate. According to the Aspeed specs, no interrupts are raised in that case. An "AHB error" status seems like a better modeling choice for all implementations since it is covered by the Linux kernel. Cc: Frederic Konrad <konrad.frederic@yahoo.fr> Reviewed-by: Joel Stanley <joel@jms.id.au> Message-Id: <20200819100956.2216690-13-clg@kaod.org> Signed-off-by: Cédric Le Goater <clg@kaod.org>
| * | ftgmac100: Fix interrupt status "Packet moved to RX FIFO"Cédric Le Goater2020-09-011-2/+1Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As we don't model the RX or TX FIFO, raise the "Packet moved to RX FIFO" interrupt status bit as soon as we are handling a RX packet. Cc: Frederic Konrad <konrad.frederic@yahoo.fr> Reviewed-by: Joel Stanley <joel@jms.id.au> Message-Id: <20200819100956.2216690-12-clg@kaod.org> Signed-off-by: Cédric Le Goater <clg@kaod.org>
| * | ftgmac100: Fix interrupt status "Packet transmitted on ethernet"Cédric Le Goater2020-09-011-3/+1Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The second field of the TX descriptor has a set of flags to choose when the transmit interrupt is raised : after the packet has been sent on the ethernet or after it has been moved into the TX FIFO. But we don't model that today. Simply raise the "Packet transmitted on ethernet" interrupt status bit as soon as the packet is sent by QEMU. Cc: Frederic Konrad <konrad.frederic@yahoo.fr> Reviewed-by: Joel Stanley <joel@jms.id.au> Message-Id: <20200819100956.2216690-11-clg@kaod.org> Signed-off-by: Cédric Le Goater <clg@kaod.org>
| * | ftgmac100: Fix registers that can be readCédric Le Goater2020-09-011-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Receive Ring Base Address Register (RXR_BADR) and the Normal Priority Transmit Receive Ring Base Address Register (NPTXR_BADR) can also be read. Cc: Frederic Konrad <konrad.frederic@yahoo.fr> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Joel Stanley <joel@jms.id.au> Message-Id: <20200819100956.2216690-10-clg@kaod.org> Signed-off-by: Cédric Le Goater <clg@kaod.org>
| * | aspeed/sdhci: Fix reset sequenceCédric Le Goater2020-09-011-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | BIT(0) of the ASPEED_SDHCI_INFO register is set by SW and polled until the bit is cleared by HW. Use the number of supported slots to define the default value of this register (The AST2600 eMMC Controller only has one). Fix the reset sequence by clearing automatically the RESET bit. Cc: Eddie James <eajames@linux.ibm.com> Fixes: 2bea128c3d0b ("hw/sd/aspeed_sdhci: New device") Reviewed-by: Joel Stanley <joel@jms.id.au> Message-Id: <20200819100956.2216690-9-clg@kaod.org> Signed-off-by: Cédric Le Goater <clg@kaod.org>
| * | aspeed/smc: Fix max_slaves of the legacy SMC deviceCédric Le Goater2020-09-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | The legacy controller only has one slave. Reviewed-by: Joel Stanley <joel@jms.id.au> Message-Id: <20200819100956.2216690-8-clg@kaod.org> Signed-off-by: Cédric Le Goater <clg@kaod.org>
| * | aspeed/smc: Fix MemoryRegionOps definitionCédric Le Goater2020-09-011-2/+0Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unaligned access support is a leftover from the initial commit. There is no such need on this device register mapping. Remove it. Cc: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Joel Stanley <joel@jms.id.au> Message-Id: <20200819100956.2216690-7-clg@kaod.org> Signed-off-by: Cédric Le Goater <clg@kaod.org>
| * | hw/arm/aspeed: Add board model for Supermicro X11 BMCErik Smit2020-09-011-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The BMC Firmware can be downloaded from : https://www.supermicro.com/en/products/motherboard/X11SSL-F Signed-off-by: Erik Smit <erik.lucas.smit@gmail.com> Reviewed-by: Joel Stanley <joel@jms.id.au> Reviewed-by: Cédric Le Goater <clg@kaod.org> [ clg: Prettified Erik's name in email Modified commit log ] Message-Id: <20200715173418.186-1-erik.lucas.smit@gmail.com> Message-Id: <20200819100956.2216690-6-clg@kaod.org> Signed-off-by: Cédric Le Goater <clg@kaod.org>
| * | aspeed/scu: Fix valid access size on AST2400Cédric Le Goater2020-09-011-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The read access size of the SCU registers can be 1/2/4 bytes and write is 4 bytes and all Aspeed models would need a .valid.accepts() handler. For the moment, set the min access size to 1 byte to cover both read and write operations on the AST2400 but keep the min access size of the other SoCs to 4 bytes as this is an unusual access size. This fixes support for some old firmware doing 2 bytes reads on the AST2400 SoC. Reported-by: Erik Smit <erik.lucas.smit@gmail.com> Reviewed-by: Joel Stanley <joel@jms.id.au> Message-Id: <20200819100956.2216690-5-clg@kaod.org> Signed-off-by: Cédric Le Goater <clg@kaod.org>
| * | m25p80: Add support for n25q512ax3Cédric Le Goater2020-09-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Datasheet available here : https://www.micron.com/-/media/client/global/Documents/Products/Data%20Sheet/NOR%20Flash/Serial%20NOR/N25Q/n25q_512mb_1ce_3v_65nm.pdf Reviewed-by: Joel Stanley <joel@jms.id.au> Message-Id: <20200819100956.2216690-4-clg@kaod.org> Signed-off-by: Cédric Le Goater <clg@kaod.org>
| * | m25p80: Return the JEDEC ID twice for mx25l25635eCédric Le Goater2020-09-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The mx25l25635e returns the JEDEC ID twice when issuing a RDID command : [ 2.512027] aspeed-smc 1e630000.spi: reading JEDEC ID C2:20:19:C2:20:19 This can break some firmware testing for this condition on the supermicrox11-bmc machine. Reported-by: Erik Smit <erik.lucas.smit@gmail.com> Message-Id: <20200819100956.2216690-2-clg@kaod.org> Signed-off-by: Cédric Le Goater <clg@kaod.org>
* | | Merge remote-tracking branch 'remotes/nvme/tags/pull-nvme-20200902' into stagingPeter Maydell2020-09-023-172/+1021
|\ \ \ | |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | qemu-nvme # gpg: Signature made Wed 02 Sep 2020 15:39:10 BST # gpg: using RSA key DBC11D2D373B4A3755F502EC625156610A4F6CC0 # gpg: Good signature from "Keith Busch <kbusch@kernel.org>" [unknown] # gpg: aka "Keith Busch <keith.busch@gmail.com>" [unknown] # gpg: aka "Keith Busch <keith.busch@intel.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: DBC1 1D2D 373B 4A37 55F5 02EC 6251 5661 0A4F 6CC0 * remotes/nvme/tags/pull-nvme-20200902: (39 commits) hw/block/nvme: remove explicit qsg/iov parameters hw/block/nvme: use preallocated qsg/iov in nvme_dma_prp hw/block/nvme: consolidate qsg/iov clearing hw/block/nvme: add ns/cmd references in NvmeRequest hw/block/nvme: be consistent about zeros vs zeroes hw/block/nvme: add check for mdts hw/block/nvme: refactor request bounds checking hw/block/nvme: verify validity of prp lists in the cmb hw/block/nvme: add request mapping helper hw/block/nvme: add tracing to nvme_map_prp hw/block/nvme: refactor dma read/write hw/block/nvme: destroy request iov before reuse hw/block/nvme: remove redundant has_sg member hw/block/nvme: replace dma_acct with blk_acct equivalent hw/block/nvme: add mapping helpers hw/block/nvme: memset preallocated requests structures hw/block/nvme: bump supported version to v1.3 hw/block/nvme: provide the mandatory subnqn field hw/block/nvme: enforce valid queue creation sequence hw/block/nvme: reject invalid nsid values in active namespace id list ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
| * | hw/block/nvme: remove explicit qsg/iov parametersKlaus Jensen2020-09-021-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since nvme_map_prp always operate on the request-scoped qsg/iovs, just pass a single pointer to the NvmeRequest instead of two for each of the qsg and iov. Suggested-by: Minwoo Im <minwoo.im.dev@gmail.com> Signed-off-by: Klaus Jensen <k.jensen@samsung.com> Reviewed-by: Minwoo Im <minwoo.im.dev@gmail.com> Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
| * | hw/block/nvme: use preallocated qsg/iov in nvme_dma_prpKlaus Jensen2020-09-021-23/+18Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since clean up of the request qsg/iov is now always done post-use, there is no need to use a stack-allocated qsg/iov in nvme_dma_prp. Signed-off-by: Klaus Jensen <k.jensen@samsung.com> Acked-by: Keith Busch <kbusch@kernel.org> Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> Reviewed-by: Minwoo Im <minwoo.im.dev@gmail.com>
| * | hw/block/nvme: consolidate qsg/iov clearingKlaus Jensen2020-09-021-31/+21Star
| | | | | | | | | | | | | | | | | | | | | | | | Always destroy the request qsg/iov at the end of request use. Signed-off-by: Klaus Jensen <k.jensen@samsung.com> Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> Reviewed-by: Minwoo Im <minwoo.im.dev@gmail.com>
| * | hw/block/nvme: add ns/cmd references in NvmeRequestKlaus Jensen2020-09-022-85/+104
| | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of passing around the NvmeNamespace and the NvmeCmd, add them as members in the NvmeRequest structure. Signed-off-by: Klaus Jensen <k.jensen@samsung.com> Reviewed-by: Minwoo Im <minwoo.im.dev@gmail.com> Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
| * | hw/block/nvme: be consistent about zeros vs zeroesKlaus Jensen2020-09-021-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The NVM Express specification generally uses 'zeroes' and not 'zeros', so let us align with it. Cc: Fam Zheng <fam@euphon.net> Signed-off-by: Klaus Jensen <k.jensen@samsung.com> Reviewed-by: Minwoo Im <minwoo.im.dev@gmail.com> Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
| * | hw/block/nvme: add check for mdtsKlaus Jensen2020-09-023-1/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add 'mdts' device parameter to control the Maximum Data Transfer Size of the controller and check that it is respected. Signed-off-by: Klaus Jensen <k.jensen@samsung.com> Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> Reviewed-by: Minwoo Im <minwoo.im.dev@gmail.com>
| * | hw/block/nvme: refactor request bounds checkingKlaus Jensen2020-09-021-5/+21
| | | | | | | | | | | | | | | | | | | | | | | | Hoist bounds checking into its own function and check for wrap-around. Signed-off-by: Klaus Jensen <k.jensen@samsung.com> Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> Reviewed-by: Minwoo Im <minwoo.im.dev@gmail.com>
| * | hw/block/nvme: verify validity of prp lists in the cmbKlaus Jensen2020-09-021-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this patch the device already supported PRP lists in the CMB, but it did not check for the validity of it nor announced the support in the Identify Controller data structure LISTS field. If some of the PRPs in a PRP list are in the CMB, then ALL entries must be there. This patch makes sure that requirement is verified as well as properly announcing support for PRP lists in the CMB. Signed-off-by: Klaus Jensen <k.jensen@samsung.com> Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> Reviewed-by: Minwoo Im <minwoo.im.dev@gmail.com>
| * | hw/block/nvme: add request mapping helperKlaus Jensen2020-09-021-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce the nvme_map helper to remove some noise in the main nvme_rw function. Signed-off-by: Klaus Jensen <k.jensen@samsung.com> Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> Reviewed-by: Minwoo Im <minwoo.im.dev@gmail.com>
| * | hw/block/nvme: add tracing to nvme_map_prpKlaus Jensen2020-09-022-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | Add tracing to nvme_map_prp. Signed-off-by: Klaus Jensen <k.jensen@samsung.com> Reviewed-by: Minwoo Im <minwoo.im.dev@gmail.com> Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
| * | hw/block/nvme: refactor dma read/writeKlaus Jensen2020-09-021-45/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | Refactor the nvme_dma_{read,write}_prp functions into a common function taking a DMADirection parameter. Signed-off-by: Klaus Jensen <k.jensen@samsung.com> Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> Reviewed-by: Minwoo Im <minwoo.im.dev@gmail.com>
| * | hw/block/nvme: destroy request iov before reuseKlaus Jensen2020-09-021-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | Make sure the request iov is destroyed before reuse; fixing a memory leak. Signed-off-by: Klaus Jensen <k.jensen@samsung.com> Reviewed-by: Minwoo Im <minwoo.im.dev@gmail.com> Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
| * | hw/block/nvme: remove redundant has_sg memberKlaus Jensen2020-09-022-6/+2Star
| | | | | | | | | | | | | | | | | | | | | | | | Remove the has_sg member from NvmeRequest since it's redundant. Signed-off-by: Klaus Jensen <k.jensen@samsung.com> Reviewed-by: Minwoo Im <minwoo.im.dev@gmail.com> Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
| * | hw/block/nvme: replace dma_acct with blk_acct equivalentKlaus Jensen2020-09-021-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The QSG isn't always initialized, so accounting could be wrong. Issue a call to blk_acct_start instead with the size taken from the QSG or IOV depending on the kind of I/O. Signed-off-by: Klaus Jensen <k.jensen@samsung.com> Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> Reviewed-by: Minwoo Im <minwoo.im.dev@gmail.com>
| * | hw/block/nvme: add mapping helpersKlaus Jensen2020-09-022-17/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add nvme_map_addr, nvme_map_addr_cmb and nvme_addr_to_cmb helpers and use them in nvme_map_prp. This fixes a bug where in the case of a CMB transfer, the device would map to the buffer with a wrong length. Fixes: b2b2b67a00574 ("nvme: Add support for Read Data and Write Data in CMBs.") Signed-off-by: Klaus Jensen <k.jensen@samsung.com> Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> Reviewed-by: Minwoo Im <minwoo.im.dev@gmail.com> Reviewed-by: Andrzej Jakowski <andrzej.jakowski@linux.intel.com>
| * | hw/block/nvme: memset preallocated requests structuresKlaus Jensen2020-09-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is preparatory to subsequent patches that change how QSGs/IOVs are handled. It is important that the qsg and iov members of the NvmeRequest are initially zeroed. Signed-off-by: Klaus Jensen <k.jensen@samsung.com> Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> Reviewed-by: Minwoo Im <minwoo.im.dev@gmail.com>
| * | hw/block/nvme: bump supported version to v1.3Klaus Jensen2020-09-021-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Bump the supported NVM Express version to v1.3. Signed-off-by: Klaus Jensen <k.jensen@samsung.com> Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> Reviewed-by: Dmitry Fomichev <dmitry.fomichev@wdc.com> Message-Id: <20200706061303.246057-19-its@irrelevant.dk>
| * | hw/block/nvme: provide the mandatory subnqn fieldKlaus Jensen2020-09-021-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The SUBNQN field is mandatory in NVM Express 1.3. Signed-off-by: Klaus Jensen <k.jensen@samsung.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Dmitry Fomichev <dmitry.fomichev@wdc.com> Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> Message-Id: <20200706061303.246057-18-its@irrelevant.dk>
| * | hw/block/nvme: enforce valid queue creation sequenceKlaus Jensen2020-09-022-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Support returning Command Sequence Error if Set Features on Number of Queues is called after queues have been created. Signed-off-by: Klaus Jensen <k.jensen@samsung.com> Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> Reviewed-by: Dmitry Fomichev <dmitry.fomichev@wdc.com> Message-Id: <20200706061303.246057-17-its@irrelevant.dk>
| * | hw/block/nvme: reject invalid nsid values in active namespace id listKlaus Jensen2020-09-021-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reject the nsid broadcast value (0xffffffff) and 0xfffffffe in the Active Namespace ID list. Signed-off-by: Klaus Jensen <k.jensen@samsung.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Dmitry Fomichev <dmitry.fomichev@wdc.com> Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> Message-Id: <20200706061303.246057-16-its@irrelevant.dk>
| * | hw/block/nvme: support identify namespace descriptor listKlaus Jensen2020-09-022-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since we are not providing the NGUID or EUI64 fields, we must support the Namespace UUID. We do not have any way of storing a persistent unique identifier, so conjure up a UUID that is just the namespace id. Signed-off-by: Klaus Jensen <k.jensen@samsung.com> Reviewed-by: Dmitry Fomichev <dmitry.fomichev@wdc.com> Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> Message-Id: <20200706061303.246057-15-its@irrelevant.dk>
| * | hw/block/nvme: make sure ncqr and nsqr is validKlaus Jensen2020-09-021-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 0xffff is not an allowed value for NCQR and NSQR in Set Features on Number of Queues. Signed-off-by: Klaus Jensen <k.jensen@samsung.com> Acked-by: Keith Busch <kbusch@kernel.org> Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> Reviewed-by: Dmitry Fomichev <dmitry.fomichev@wdc.com> Message-Id: <20200706061303.246057-14-its@irrelevant.dk>
| * | hw/block/nvme: support the get/set features select and save fieldsKlaus Jensen2020-09-022-14/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since the device does not have any persistent state storage, no features are "saveable" and setting the Save (SV) field in any Set Features command will result in a Feature Identifier Not Saveable status code. Similarly, if the Select (SEL) field is set to request saved values, the devices will (as it should) return the default values instead. Since this also introduces "Supported Capabilities", the nsid field is now also checked for validity wrt. the feature being get/set'ed. Signed-off-by: Klaus Jensen <k.jensen@samsung.com> Reviewed-by: Dmitry Fomichev <dmitry.fomichev@wdc.com> Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> Message-Id: <20200706061303.246057-13-its@irrelevant.dk>
| * | hw/block/nvme: add remaining mandatory controller parametersKlaus Jensen2020-09-022-6/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for any remaining mandatory controller operating parameters (features). Signed-off-by: Klaus Jensen <k.jensen@samsung.com> Reviewed-by: Dmitry Fomichev <dmitry.fomichev@wdc.com> Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> Message-Id: <20200706061303.246057-12-its@irrelevant.dk>