1. 29 6月, 2021 2 次提交
  2. 17 5月, 2021 8 次提交
  3. 07 4月, 2021 3 次提交
    • K
      hw/block/nvme: fix handling of private namespaces · e5489356
      Klaus Jensen 提交于
      Prior to this patch, if a private nvme-ns device (that is, a namespace
      that is not linked to a subsystem) is wired up to an nvme-subsys linked
      nvme controller device, the device fails to verify that the namespace id
      is unique within the subsystem. NVM Express v1.4b, Section 6.1.6 ("NSID
      and Namespace Usage") states that because the device supports Namespace
      Management, "NSIDs *shall* be unique within the NVM subsystem".
      
      Additionally, prior to this patch, private namespaces are not known to
      the subsystem and the namespace is considered exclusive to the
      controller with which it is initially wired up to. However, this is not
      the definition of a private namespace; per Section 1.6.33 ("private
      namespace"), a private namespace is just a namespace that does not
      support multipath I/O or namespace sharing, which means "that it is only
      able to be attached to one controller at a time".
      
      Fix this by always allocating namespaces in the subsystem (if one is
      linked to the controller), regardless of the shared/private status of
      the namespace. Whether or not the namespace is shareable is controlled
      by a new `shared` nvme-ns parameter.
      
      Finally, this fix allows the nvme-ns `subsys` parameter to be removed,
      since the `shared` parameter now serves the purpose of attaching the
      namespace to all controllers in the subsystem upon device realization.
      It is invalid to have an nvme-ns namespace device with a linked
      subsystem without the parent nvme controller device also being linked to
      one and since the nvme-ns devices will unconditionally be "attached" (in
      QEMU terms that is) to an nvme controller device through an NvmeBus, the
      nvme-ns namespace device can always get a reference to the subsystem of
      the controller it is explicitly (using 'bus=' parameter) or implicitly
      attaching to.
      
      Fixes: e5707685 ("hw/block/nvme: support for shared namespace in subsystem")
      Cc: Minwoo Im <minwoo.im.dev@gmail.com>
      Signed-off-by: NKlaus Jensen <k.jensen@samsung.com>
      Reviewed-by: NGollu Appalanaidu <anaidu.gollu@samsung.com>
      Reviewed-by: NKeith Busch <kbusch@kernel.org>
      Reviewed-by: NMinwoo Im <minwoo.im.dev@gmail.com>
      e5489356
    • K
      hw/block/nvme: fix warning about legacy namespace configuration · f447f92c
      Klaus Jensen 提交于
      Remove the unused BlockConf from the controller structure and remove the
      noop constraint checking.
      
      Device works just fine with both legacy drive parameter namespace and
      nvme-ns namespace definitions.
      Signed-off-by: NKlaus Jensen <k.jensen@samsung.com>
      Reviewed-by: NGollu Appalanaidu <anaidu.gollu@samsung.com>
      f447f92c
    • K
      hw/block/nvme: fix missing string representation for ns attachment · 349bf41d
      Klaus Jensen 提交于
      Add the missing nvme_adm_opc_str entry for the Namespace Attachment
      command.
      Signed-off-by: NKlaus Jensen <k.jensen@samsung.com>
      Reviewed-by: NGollu Appalanaidu <anaidu.gollu@samsung.com>
      Reviewed-by: NKeith Busch <kbusch@kernel.org>
      349bf41d
  4. 18 3月, 2021 5 次提交
  5. 09 3月, 2021 10 次提交
  6. 09 2月, 2021 8 次提交
  7. 27 10月, 2020 4 次提交
    • K
      hw/block/nvme: change controller pci id · 6eb7a071
      Klaus Jensen 提交于
      There are two reasons for changing this:
      
        1. The nvme device currently uses an internal Intel device id.
      
        2. Since commits "nvme: fix write zeroes offset and count" and "nvme:
           support multiple namespaces" the controller device no longer has
           the quirks that the Linux kernel think it has.
      
           As the quirks are applied based on pci vendor and device id, change
           them to get rid of the quirks.
      
      To keep backward compatibility, add a new 'use-intel-id' parameter to
      the nvme device to force use of the Intel vendor and device id. This is
      off by default but add a compat property to set this for 5.1 machines
      and older. If a 5.1 machine is booted (or the use-intel-id parameter is
      explicitly set to true), the Linux kernel will just apply these
      unnecessary quirks:
      
        1. NVME_QUIRK_IDENTIFY_CNS which says that the device does not support
           anything else than values 0x0 and 0x1 for CNS (Identify Namespace
           and Identify Namespace). With multiple namespace support, this just
           means that the kernel will "scan" namespaces instead of using
           "Active Namespace ID list" (CNS 0x2).
      
        2. NVME_QUIRK_DISABLE_WRITE_ZEROES. The nvme device started out with a
           broken Write Zeroes implementation which has since been fixed in
           commit 9d6459d2 ("nvme: fix write zeroes offset and count").
      Signed-off-by: NKlaus Jensen <k.jensen@samsung.com>
      Reviewed-by: NKeith Busch <kbusch@kernel.org>
      Reviewed-by: NMaxim Levitsky <mlevitsk@redhat.com>
      6eb7a071
    • K
      hw/block/nvme: support multiple namespaces · 7f0f1ace
      Klaus Jensen 提交于
      This adds support for multiple namespaces by introducing a new 'nvme-ns'
      device model. The nvme device creates a bus named from the device name
      ('id'). The nvme-ns devices then connect to this and registers
      themselves with the nvme device.
      
      This changes how an nvme device is created. Example with two namespaces:
      
        -drive file=nvme0n1.img,if=none,id=disk1
        -drive file=nvme0n2.img,if=none,id=disk2
        -device nvme,serial=deadbeef,id=nvme0
        -device nvme-ns,drive=disk1,bus=nvme0,nsid=1
        -device nvme-ns,drive=disk2,bus=nvme0,nsid=2
      
      The drive property is kept on the nvme device to keep the change
      backward compatible, but the property is now optional. Specifying a
      drive for the nvme device will always create the namespace with nsid 1.
      Signed-off-by: NKlaus Jensen <k.jensen@samsung.com>
      Reviewed-by: NKeith Busch <kbusch@kernel.org>
      Reviewed-by: NMinwoo Im <minwoo.im.dev@gmail.com>
      7f0f1ace
    • K
      hw/block/nvme: refactor aio submission · 6a09a3d7
      Klaus Jensen 提交于
      This pulls block layer aio submission/completion to common functions.
      
      For completions, additionally map an AIO error to the Unrecovered Read
      and Write Fault status codes.
      Signed-off-by: NKlaus Jensen <k.jensen@samsung.com>
      Reviewed-by: NKeith Busch <kbusch@kernel.org>
      6a09a3d7
    • K
      hw/block/nvme: add symbolic command name to trace events · e2f79209
      Klaus Jensen 提交于
      Add the symbolic command name to the pci_nvme_{io,admin}_cmd and
      pci_nvme_rw trace events.
      Signed-off-by: NKlaus Jensen <k.jensen@samsung.com>
      Reviewed-by: NPhilippe Mathieu-Daudé <philmd@redhat.com>
      Reviewed-by: NKeith Busch <kbusch@kernel.org>
      e2f79209