[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/8] hw/block/nvme: indicate CMB support through controller capab
From: |
Klaus Jensen |
Subject: |
[PATCH 1/8] hw/block/nvme: indicate CMB support through controller capabilities register |
Date: |
Fri, 18 Dec 2020 14:28:58 +0100 |
From: Andrzej Jakowski <andrzej.jakowski@linux.intel.com>
This patch sets CMBS bit in controller capabilities register when user
configures NVMe driver with CMB support, so capabilites are correctly
reported to guest OS.
Signed-off-by: Andrzej Jakowski <andrzej.jakowski@linux.intel.com>
Reviewed-by: Maxim Levitsky <mlevitsky@gmail.com>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
---
include/block/nvme.h | 10 +++++++---
hw/block/nvme.c | 1 +
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/include/block/nvme.h b/include/block/nvme.h
index 11ac1c2b7dfb..24f3c256a7f9 100644
--- a/include/block/nvme.h
+++ b/include/block/nvme.h
@@ -36,6 +36,7 @@ enum NvmeCapShift {
CAP_MPSMIN_SHIFT = 48,
CAP_MPSMAX_SHIFT = 52,
CAP_PMR_SHIFT = 56,
+ CAP_CMB_SHIFT = 57,
};
enum NvmeCapMask {
@@ -49,6 +50,7 @@ enum NvmeCapMask {
CAP_MPSMIN_MASK = 0xf,
CAP_MPSMAX_MASK = 0xf,
CAP_PMR_MASK = 0x1,
+ CAP_CMB_MASK = 0x1,
};
#define NVME_CAP_MQES(cap) (((cap) >> CAP_MQES_SHIFT) & CAP_MQES_MASK)
@@ -78,9 +80,11 @@ enum NvmeCapMask {
#define NVME_CAP_SET_MPSMIN(cap, val) (cap |= (uint64_t)(val &
CAP_MPSMIN_MASK)\
<< CAP_MPSMIN_SHIFT)
#define NVME_CAP_SET_MPSMAX(cap, val) (cap |= (uint64_t)(val &
CAP_MPSMAX_MASK)\
- <<
CAP_MPSMAX_SHIFT)
-#define NVME_CAP_SET_PMRS(cap, val) (cap |= (uint64_t)(val & CAP_PMR_MASK)\
- << CAP_PMR_SHIFT)
+ << CAP_MPSMAX_SHIFT)
+#define NVME_CAP_SET_PMRS(cap, val) (cap |= (uint64_t)(val & CAP_PMR_MASK)
\
+ << CAP_PMR_SHIFT)
+#define NVME_CAP_SET_CMBS(cap, val) (cap |= (uint64_t)(val & CAP_CMB_MASK)
\
+ << CAP_CMB_SHIFT)
enum NvmeCapCss {
NVME_CAP_CSS_NVM = 1 << 0,
diff --git a/hw/block/nvme.c b/hw/block/nvme.c
index 28416b18a5c0..fe809195a08a 100644
--- a/hw/block/nvme.c
+++ b/hw/block/nvme.c
@@ -3046,6 +3046,7 @@ static void nvme_init_ctrl(NvmeCtrl *n, PCIDevice
*pci_dev)
NVME_CAP_SET_CSS(n->bar.cap, NVME_CAP_CSS_NVM);
NVME_CAP_SET_CSS(n->bar.cap, NVME_CAP_CSS_ADMIN_ONLY);
NVME_CAP_SET_MPSMAX(n->bar.cap, 4);
+ NVME_CAP_SET_CMBS(n->bar.cap, n->params.cmb_size_mb ? 1 : 0);
n->bar.vs = NVME_SPEC_VER;
n->bar.intmc = n->bar.intms = 0;
--
2.29.2
- [PATCH 0/8] hw/block/nvme: misc cmb/pmr patches, Klaus Jensen, 2020/12/18
- [PATCH 1/8] hw/block/nvme: indicate CMB support through controller capabilities register,
Klaus Jensen <=
- [PATCH 4/8] hw/block/nvme: fix controller reset/shutdown logic, Klaus Jensen, 2020/12/18
- [PATCH 2/8] hw/block/nvme: move msix table and pba to BAR 0, Klaus Jensen, 2020/12/18
- [PATCH 8/8] hw/block/nvme: add PMR RDS/WDS support, Klaus Jensen, 2020/12/18
- [PATCH 6/8] hw/block/nvme: remove redundant zeroing of PMR registers, Klaus Jensen, 2020/12/18
- [PATCH 3/8] hw/block/nvme: allow cmb and pmr to coexist, Klaus Jensen, 2020/12/18
- [PATCH 7/8] hw/block/nvme: disable PMR at boot up, Klaus Jensen, 2020/12/18
- [PATCH 5/8] hw/block/nvme: rename CAP_PMR_{SHIFT, MASK} to CAP_PMRS_{SHIFT, MASK}, Klaus Jensen, 2020/12/18