Skip to contentSkip to conversation

nvme: do not advertise support for unsupported arbitration mechanism

PATCH Applied Klaus Birkelund Jensen 3 participants 5 messages Jun 6, 2019 – Jun 17, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvme: do not advertise support for unsupported arbitration mechanism

The device mistakenly reports that the Weighted Round Robin with Urgent Priority Class arbitration mechanism is supported.

It is not.

---
 hw/block/nvme.c | 1 -
 1 file changed, 1 deletion(-)
hw/block/nvme.c +0 -1
index 30e50f7a3853..415b4641d6b4 100644
@@ -1383,7 +1383,6 @@ static void nvme_realize(PCIDevice *pci_dev, Error **errp)
     n->bar.cap = 0;
     NVME_CAP_SET_MQES(n->bar.cap, 0x7ff);
     NVME_CAP_SET_CQR(n->bar.cap, 1);
-    NVME_CAP_SET_AMS(n->bar.cap, 1);
     NVME_CAP_SET_TO(n->bar.cap, 0xf);
     NVME_CAP_SET_CSS(n->bar.cap, 1);
     NVME_CAP_SET_MPSMAX(n->bar.cap, 4);
Signature · 1 line
2.21.0
#1 lore raw
Quoted 4 lines · Klaus Birkelund Jensen

The device mistakenly reports that the Weighted Round Robin with Urgent Priority Class arbitration mechanism is supported.

It is not.

I believe you based on the fact that there is no “weight” or “priority” anywhere in nvme.c, and that it does not evaluate the Arbitration Mechanism Selected field.

Quoted 10 lines
---
 hw/block/nvme.c | 1 -
 1 file changed, 1 deletion(-)
hw/block/nvme.c +0 -0
index 30e50f7a3853..415b4641d6b4 100644

hw/block/nvme.c static void nvme_realize(PCIDevice *pci_dev, Error **errp) · line 1386

Quoted 4 lines
hw/block/nvme.c +0 -1
@@ -1383,7 +1383,6 @@ static void nvme_realize(PCIDevice *pci_dev, Error **errp)
     n->bar.cap = 0;
     NVME_CAP_SET_MQES(n->bar.cap, 0x7ff);
     NVME_CAP_SET_CQR(n->bar.cap, 1);
-    NVME_CAP_SET_AMS(n->bar.cap, 1);

I suppose the better way would be to pass 0, so it is more explicit, I think.

(Just removing it looks like it may have just been forgotten.)

Max

Quoted 4 lines
hw/block/nvme.c +0 -0
     NVME_CAP_SET_TO(n->bar.cap, 0xf);
     NVME_CAP_SET_CSS(n->bar.cap, 1);
     NVME_CAP_SET_MPSMAX(n->bar.cap, 4);
#2 lore raw
Quoted 28 lines · Max Reitz
Quoted 4 lines · Klaus Birkelund Jensen

The device mistakenly reports that the Weighted Round Robin with Urgent Priority Class arbitration mechanism is supported.

It is not.

I believe you based on the fact that there is no “weight” or “priority” anywhere in nvme.c, and that it does not evaluate the Arbitration Mechanism Selected field.

Quoted 10 lines
---
 hw/block/nvme.c | 1 -
 1 file changed, 1 deletion(-)
hw/block/nvme.c +0 -0
index 30e50f7a3853..415b4641d6b4 100644

hw/block/nvme.c static void nvme_realize(PCIDevice *pci_dev, Error **errp) · line 1386

Quoted 4 lines
hw/block/nvme.c +0 -1
@@ -1383,7 +1383,6 @@ static void nvme_realize(PCIDevice *pci_dev, Error **errp)
     n->bar.cap = 0;
     NVME_CAP_SET_MQES(n->bar.cap, 0x7ff);
     NVME_CAP_SET_CQR(n->bar.cap, 1);
-    NVME_CAP_SET_AMS(n->bar.cap, 1);

I suppose the better way would be to pass 0, so it is more explicit, I think.

Quoted 10 lines

(Just removing it looks like it may have just been forgotten.)

Max

Quoted 4 lines
hw/block/nvme.c +0 -0
     NVME_CAP_SET_TO(n->bar.cap, 0xf);
     NVME_CAP_SET_CSS(n->bar.cap, 1);
     NVME_CAP_SET_MPSMAX(n->bar.cap, 4);

Yea. no way that this driver supports WRRU and I haven't noticed it. Just checked again to be sure.

To be honest, after some quick look,
that driver doesn' even really support the regular Round-Robin as it uses a timer to process a specific queue, kicked up by a doorbell write :-)

Best regards,
Maxim Levitsky

#3 lore raw
In reply to Max Reitz
Quoted 10 lines · Max Reitz
Quoted 4 lines · Klaus Birkelund Jensen

The device mistakenly reports that the Weighted Round Robin with Urgent Priority Class arbitration mechanism is supported.

It is not.

I believe you based on the fact that there is no “weight” or “priority” anywhere in nvme.c, and that it does not evaluate the Arbitration Mechanism Selected field.

Not sure if you want me to change the commit message? Feel free to change it if you want to ;)

Quoted 18 lines
Quoted 10 lines
---
 hw/block/nvme.c | 1 -
 1 file changed, 1 deletion(-)
hw/block/nvme.c +0 -0
index 30e50f7a3853..415b4641d6b4 100644

hw/block/nvme.c static void nvme_realize(PCIDevice *pci_dev, Error **errp) · line 1386

Quoted 4 lines
hw/block/nvme.c +0 -1
@@ -1383,7 +1383,6 @@ static void nvme_realize(PCIDevice *pci_dev, Error **errp)
     n->bar.cap = 0;
     NVME_CAP_SET_MQES(n->bar.cap, 0x7ff);
     NVME_CAP_SET_CQR(n->bar.cap, 1);
-    NVME_CAP_SET_AMS(n->bar.cap, 1);

I suppose the better way would be to pass 0, so it is more explicit, I think.

Quoted 2 lines

(Just removing it looks like it may have just been forgotten.)

Not explicitly setting it to zero aligns with how the other fields in CAP are also left out if kept at zero. If we explicitly set it to zero I think we should also set all the other fields that way (DSTRD, NSSRS, etc.).

Klaus

Applied
#4 lore raw
Quoted 7 lines · Klaus Birkelund
Quoted 6 lines · Max Reitz
Quoted 4 lines · Klaus Birkelund Jensen

The device mistakenly reports that the Weighted Round Robin with Urgent Priority Class arbitration mechanism is supported.

It is not.

Quoted 7 lines
Quoted 4 lines

I believe you based on the fact that there is no “weight” or “priority” anywhere in nvme.c, and that it does not evaluate the Arbitration Mechanism Selected field.

Not sure if you want me to change the commit message? Feel free to change it if you want to ;)

Oh, no, no. It’s just that I have no idea how the NVMe interface works (well, I did download the spec then, but...), so this was basically just my excuse for “I can review this!!”.

Quoted 18 lines
Quoted 18 lines
Quoted 10 lines
---
 hw/block/nvme.c | 1 -
 1 file changed, 1 deletion(-)
hw/block/nvme.c +0 -0
index 30e50f7a3853..415b4641d6b4 100644

hw/block/nvme.c static void nvme_realize(PCIDevice *pci_dev, Error **errp) · line 1386

Quoted 4 lines
hw/block/nvme.c +0 -1
@@ -1383,7 +1383,6 @@ static void nvme_realize(PCIDevice *pci_dev, Error **errp)
     n->bar.cap = 0;
     NVME_CAP_SET_MQES(n->bar.cap, 0x7ff);
     NVME_CAP_SET_CQR(n->bar.cap, 1);
-    NVME_CAP_SET_AMS(n->bar.cap, 1);

I suppose the better way would be to pass 0, so it is more explicit, I think.

Quoted 7 lines
Quoted 2 lines

(Just removing it looks like it may have just been forgotten.)

Not explicitly setting it to zero aligns with how the other fields in CAP are also left out if kept at zero. If we explicitly set it to zero I think we should also set all the other fields that way (DSTRD, NSSRS, etc.).

OK then.

Thanks, applied to my block branch:

https://git.xanclic.moe/XanClic/qemu/commits/branch/block

Max