Skip to content
Snippets Groups Projects
  1. Jul 20, 2022
  2. Jul 18, 2022
  3. Jul 15, 2022
    • Darren Kenny's avatar
      nvme: Fix misleading macro when mixed with ternary operator · 43f76aac
      Darren Kenny authored
      
      Using the Parfait source code analyser and issue was found in
      hw/nvme/ctrl.c where the macros NVME_CAP_SET_CMBS and NVME_CAP_SET_PMRS
      are called with a ternary operatore in the second parameter, resulting
      in a potentially unexpected expansion of the form:
      
        x ? a: b & FLAG_TEST
      
      which will result in a different result to:
      
        (x ? a: b) & FLAG_TEST.
      
      The macros should wrap each of the parameters in brackets to ensure the
      correct result on expansion.
      
      Signed-off-by: default avatarDarren Kenny <darren.kenny@oracle.com>
      Reviewed-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: default avatarKlaus Jensen <k.jensen@samsung.com>
      Signed-off-by: default avatarKlaus Jensen <k.jensen@samsung.com>
      43f76aac
    • Jinhao Fan's avatar
      hw/nvme: Implement shadow doorbell buffer support · 3f7fe8de
      Jinhao Fan authored
      
      Implement Doorbel Buffer Config command (Section 5.7 in NVMe Spec 1.3)
      and Shadow Doorbel buffer & EventIdx buffer handling logic (Section 7.13
      in NVMe Spec 1.3). For queues created before the Doorbell Buffer Config
      command, the nvme_dbbuf_config function tries to associate each existing
      SQ and CQ with its Shadow Doorbel buffer and EventIdx buffer address.
      Queues created after the Doorbell Buffer Config command will have the
      doorbell buffers associated with them when they are initialized.
      
      In nvme_process_sq and nvme_post_cqe, proactively check for Shadow
      Doorbell buffer changes instead of wait for doorbell register changes.
      This reduces the number of MMIOs.
      
      In nvme_process_db(), update the shadow doorbell buffer value with
      the doorbell register value if it is the admin queue. This is a hack
      since hosts like Linux NVMe driver and SPDK do not use shadow
      doorbell buffer for the admin queue. Copying the doorbell register
      value to the shadow doorbell buffer allows us to support these hosts
      as well as spec-compliant hosts that use shadow doorbell buffer for
      the admin queue.
      
      Signed-off-by: default avatarJinhao Fan <fanjinhao21s@ict.ac.cn>
      Reviewed-by: default avatarKlaus Jensen <k.jensen@samsung.com>
      Reviewed-by: default avatarKeith Busch <kbusch@kernel.org>
      [k.jensen: rebased]
      Signed-off-by: default avatarKlaus Jensen <k.jensen@samsung.com>
      3f7fe8de
  4. Jul 14, 2022
Loading