Page MenuHomeFreeBSD

D36119.1789904405.diff
No OneTemporary

Size
2 KB
Referenced Files
None
Subscribers
None

D36119.1789904405.diff

Index: usr.sbin/bhyve/pci_nvme.c
===================================================================
--- usr.sbin/bhyve/pci_nvme.c
+++ usr.sbin/bhyve/pci_nvme.c
@@ -1386,9 +1386,7 @@
{
uint64_t logoff;
uint32_t logsize;
- uint8_t logpage = command->cdw10 & 0xFF;
-
- DPRINTF("%s log page %u len %u", __func__, logpage, logsize);
+ uint8_t logpage;
pci_nvme_status_genc(&compl->status, NVME_SC_SUCCESS);
@@ -1396,10 +1394,13 @@
* Command specifies the number of dwords to return in fields NUMDU
* and NUMDL. This is a zero-based value.
*/
+ logpage = command->cdw10 & 0xFF;
logsize = ((command->cdw11 << 16) | (command->cdw10 >> 16)) + 1;
logsize *= sizeof(uint32_t);
logoff = ((uint64_t)(command->cdw13) << 32) | command->cdw12;
+ DPRINTF("%s log page %u len %u", __func__, logpage, logsize);
+
switch (logpage) {
case NVME_LOG_ERROR:
if (logoff >= sizeof(sc->err_log)) {
@@ -2224,11 +2225,7 @@
__func__, sqid, sq->cqid, cid, NVME_STATUS_GET_SCT(status),
NVME_STATUS_GET_SC(status));
- pci_nvme_cq_update(sc, cq,
- 0, /* CDW0 */
- cid,
- sqid,
- status);
+ pci_nvme_cq_update(sc, cq, cdw0, cid, sqid, status);
if (cq->head != cq->tail) {
if (cq->intr_en & NVME_CQ_INTEN) {
@@ -2463,6 +2460,12 @@
lba = ((uint64_t)cmd->cdw11 << 32) | cmd->cdw10;
nblocks = (cmd->cdw12 & 0xFFFF) + 1;
+ bytes = nblocks << nvstore->sectsz_bits;
+ if (bytes > NVME_MAX_DATA_SIZE) {
+ WPRINTF("%s command would exceed MDTS", __func__);
+ pci_nvme_status_genc(status, NVME_SC_INVALID_FIELD);
+ goto out;
+ }
if (pci_nvme_out_of_range(nvstore, lba, nblocks)) {
WPRINTF("%s command would exceed LBA range(slba=%#lx nblocks=%#lx)",
@@ -2471,13 +2474,6 @@
goto out;
}
- bytes = nblocks << nvstore->sectsz_bits;
- if (bytes > NVME_MAX_DATA_SIZE) {
- WPRINTF("%s command would exceed MDTS", __func__);
- pci_nvme_status_genc(status, NVME_SC_INVALID_FIELD);
- goto out;
- }
-
offset = lba << nvstore->sectsz_bits;
req->bytes = bytes;
@@ -2546,7 +2542,7 @@
struct pci_nvme_ioreq *req,
uint16_t *status)
{
- struct nvme_dsm_range *range;
+ struct nvme_dsm_range *range = NULL;
uint32_t nr, r, non_zero, dr;
int err;
bool pending = false;

File Metadata

Mime Type
text/plain
Expires
Sun, Sep 20, 11:40 AM (23 h, 2 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29816782
Default Alt Text
D36119.1789904405.diff (2 KB)

Event Timeline