Page MenuHomeFreeBSD

D32798.id97850.diff
No OneTemporary

D32798.id97850.diff

Index: usr.sbin/bhyve/pci_nvme.c
===================================================================
--- usr.sbin/bhyve/pci_nvme.c
+++ usr.sbin/bhyve/pci_nvme.c
@@ -156,6 +156,16 @@
NVME_COPY_FROM_PRP,
};
+struct nvme_lba_range_type {
+ uint8_t type;
+ uint8_t attribute;
+ uint8_t reserved1[14];
+ uint64_t slba;
+ uint64_t nlb;
+ uint8_t guid[16];
+ uint8_t reserved2[16];
+} __packed __aligned(4);
+
#define NVME_CQ_INTEN 0x01
#define NVME_CQ_INTCOAL 0x02
@@ -351,6 +361,10 @@
struct nvme_feature_obj *,
struct nvme_command *,
struct nvme_completion *);
+static void nvme_feature_lba_range_type_get(struct pci_nvme_softc *,
+ struct nvme_feature_obj *,
+ struct nvme_command *,
+ struct nvme_completion *);
static void nvme_feature_num_queues(struct pci_nvme_softc *,
struct nvme_feature_obj *,
struct nvme_command *,
@@ -619,6 +633,7 @@
sc->feat[0].get = nvme_feature_invalid_cb;
sc->feat[NVME_FEAT_LBA_RANGE_TYPE].namespace_specific = true;
+ sc->feat[NVME_FEAT_LBA_RANGE_TYPE].get = nvme_feature_lba_range_type_get;
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 =
@@ -1326,6 +1341,27 @@
}
+static void
+nvme_feature_lba_range_type_get(struct pci_nvme_softc *sc,
+ struct nvme_feature_obj *feat,
+ struct nvme_command *command,
+ struct nvme_completion *compl)
+{
+ struct nvme_lba_range_type range;
+
+ memset(&range, 0, sizeof(range));
+ range.type = 0x00; /* Reserved */
+ range.attribute = 0x01; /* Writable */
+ range.slba = 0; /* Starting LBA */
+ range.nlb = sc->nsdata.nsze; /* Number of Logical Blocks */
+
+ command->cdw11 = 0; /* 1 range */
+
+ nvme_prp_memcpy(sc->nsc_pi->pi_vmctx, command->prp1,
+ command->prp2, (uint8_t *)&range,
+ sizeof(range), NVME_COPY_TO_PRP);
+}
+
static void
nvme_feature_num_queues(struct pci_nvme_softc *sc,
struct nvme_feature_obj *feat,

File Metadata

Mime Type
text/plain
Expires
Wed, Dec 24, 4:25 AM (10 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27211741
Default Alt Text
D32798.id97850.diff (1 KB)

Event Timeline