summaryrefslogtreecommitdiff
path: root/usr.sbin/bhyve
diff options
context:
space:
mode:
authorChuck Tuffli <chuck@FreeBSD.org>2020-06-29 00:32:15 +0000
committerChuck Tuffli <chuck@FreeBSD.org>2020-06-29 00:32:15 +0000
commitf97ed1512322b5c413224c5072429ea879ee1cfa (patch)
treeabceabbf55df24c6dc8713b2eeda27ab246ff805 /usr.sbin/bhyve
parent46ea62737453e40942035c199355cb801c4c09af (diff)
downloadsrc-test2-f97ed1512322b5c413224c5072429ea879ee1cfa.tar.gz
src-test2-f97ed1512322b5c413224c5072429ea879ee1cfa.zip
bhyve: add NVMe Feature Interrupt Vector Config
This adds support for NVMe Get Features, Interrupt Vector Config parameter error checking done by the UNH compliance tests. Fixes UNH Tests 1.6.8 and 5.5.6 Tested by: Jason Tubnor MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D24898
Notes
Notes: svn path=/head/; revision=362763
Diffstat (limited to 'usr.sbin/bhyve')
-rw-r--r--usr.sbin/bhyve/pci_nvme.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/usr.sbin/bhyve/pci_nvme.c b/usr.sbin/bhyve/pci_nvme.c
index 7271d7d7e859..93be8a290514 100644
--- a/usr.sbin/bhyve/pci_nvme.c
+++ b/usr.sbin/bhyve/pci_nvme.c
@@ -356,6 +356,10 @@ static void nvme_feature_num_queues(struct pci_nvme_softc *,
struct nvme_feature_obj *,
struct nvme_command *,
struct nvme_completion *);
+static void nvme_feature_iv_config(struct pci_nvme_softc *,
+ struct nvme_feature_obj *,
+ struct nvme_command *,
+ struct nvme_completion *);
static __inline void
cpywithpad(char *dst, size_t dst_size, const char *src, char pad)
@@ -612,6 +616,8 @@ pci_nvme_init_features(struct pci_nvme_softc *sc)
sc->feat[NVME_FEAT_LBA_RANGE_TYPE].namespace_specific = true;
sc->feat[NVME_FEAT_ERROR_RECOVERY].namespace_specific = true;
sc->feat[NVME_FEAT_NUMBER_OF_QUEUES].set = nvme_feature_num_queues;
+ sc->feat[NVME_FEAT_INTERRUPT_VECTOR_CONFIGURATION].set =
+ nvme_feature_iv_config;
}
static void
@@ -1276,6 +1282,39 @@ nvme_feature_invalid_cb(struct pci_nvme_softc *sc,
}
static void
+nvme_feature_iv_config(struct pci_nvme_softc *sc,
+ struct nvme_feature_obj *feat,
+ struct nvme_command *command,
+ struct nvme_completion *compl)
+{
+ uint32_t i;
+ uint32_t cdw11 = command->cdw11;
+ uint16_t iv;
+ bool cd;
+
+ pci_nvme_status_genc(&compl->status, NVME_SC_INVALID_FIELD);
+
+ iv = cdw11 & 0xffff;
+ cd = cdw11 & (1 << 16);
+
+ if (iv > (sc->max_queues + 1)) {
+ return;
+ }
+
+ /* No Interrupt Coalescing (i.e. not Coalescing Disable) for Admin Q */
+ if ((iv == 0) && !cd)
+ return;
+
+ /* Requested Interrupt Vector must be used by a CQ */
+ for (i = 0; i < sc->num_cqueues + 1; i++) {
+ if (sc->compl_queues[i].intr_vec == iv) {
+ pci_nvme_status_genc(&compl->status, NVME_SC_SUCCESS);
+ }
+ }
+
+}
+
+static void
nvme_feature_num_queues(struct pci_nvme_softc *sc,
struct nvme_feature_obj *feat,
struct nvme_command *command,