• J
    hw/nvme: Implement shadow doorbell buffer support · 3f7fe8de
    Jinhao Fan 提交于
    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: NJinhao Fan <fanjinhao21s@ict.ac.cn>
    Reviewed-by: NKlaus Jensen <k.jensen@samsung.com>
    Reviewed-by: NKeith Busch <kbusch@kernel.org>
    [k.jensen: rebased]
    Signed-off-by: NKlaus Jensen <k.jensen@samsung.com>
    3f7fe8de
nvme.h 15.0 KB