qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] hw/block/nvme: use locally assigned QEMU IEEE OUI
@ 2021-02-09 10:45 Klaus Jensen
  2021-02-09 11:10 ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 3+ messages in thread
From: Klaus Jensen @ 2021-02-09 10:45 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, qemu-block, Klaus Jensen, Gollu Appalanaidu,
	Max Reitz, Klaus Jensen, Keith Busch

From: Gollu Appalanaidu <anaidu.gollu@samsung.com>

Commit 6eb7a071292a ("hw/block/nvme: change controller pci id") changed
the controller to use a Red Hat assigned PCI Device and Vendor ID, but
did not change the IEEE OUI away from the Intel IEEE OUI.

Fix that and use the locally assigned QEMU IEEE OUI instead if the
`use-intel-id` parameter is not explicitly set. Also reverse the Intel
IEEE OUI bytes.

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
---

v2: drop telemetry and add a check on the use_intel_id parameter.

 hw/block/nvme.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/hw/block/nvme.c b/hw/block/nvme.c
index c2f0c88fbf39..870e9d8e1c17 100644
--- a/hw/block/nvme.c
+++ b/hw/block/nvme.c
@@ -4685,9 +4685,17 @@ static void nvme_init_ctrl(NvmeCtrl *n, PCIDevice *pci_dev)
     id->cntlid = cpu_to_le16(n->cntlid);
 
     id->rab = 6;
-    id->ieee[0] = 0x00;
-    id->ieee[1] = 0x02;
-    id->ieee[2] = 0xb3;
+
+    if (n->params.use_intel_id) {
+        id->ieee[0] = 0xb3;
+        id->ieee[1] = 0x02;
+        id->ieee[2] = 0x00;
+    } else {
+        id->ieee[0] = 0x00;
+        id->ieee[1] = 0x54;
+        id->ieee[2] = 0x52;
+    }
+
     id->mdts = n->params.mdts;
     id->ver = cpu_to_le32(NVME_SPEC_VER);
     id->oacs = cpu_to_le16(0);
-- 
2.30.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] hw/block/nvme: use locally assigned QEMU IEEE OUI
  2021-02-09 10:45 [PATCH v2] hw/block/nvme: use locally assigned QEMU IEEE OUI Klaus Jensen
@ 2021-02-09 11:10 ` Philippe Mathieu-Daudé
  2021-02-10 20:57   ` Klaus Jensen
  0 siblings, 1 reply; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-02-09 11:10 UTC (permalink / raw)
  To: Klaus Jensen, qemu-devel, Jason Wang
  Cc: Kevin Wolf, qemu-block, Klaus Jensen, Gollu Appalanaidu,
	Max Reitz, Keith Busch

On 2/9/21 11:45 AM, Klaus Jensen wrote:
> From: Gollu Appalanaidu <anaidu.gollu@samsung.com>
> 
> Commit 6eb7a071292a ("hw/block/nvme: change controller pci id") changed
> the controller to use a Red Hat assigned PCI Device and Vendor ID, but
> did not change the IEEE OUI away from the Intel IEEE OUI.
> 
> Fix that and use the locally assigned QEMU IEEE OUI instead if the
> `use-intel-id` parameter is not explicitly set. Also reverse the Intel
> IEEE OUI bytes.
> 
> Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
> Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
> ---
> 
> v2: drop telemetry and add a check on the use_intel_id parameter.
> 
>  hw/block/nvme.c | 14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/block/nvme.c b/hw/block/nvme.c
> index c2f0c88fbf39..870e9d8e1c17 100644
> --- a/hw/block/nvme.c
> +++ b/hw/block/nvme.c
> @@ -4685,9 +4685,17 @@ static void nvme_init_ctrl(NvmeCtrl *n, PCIDevice *pci_dev)
>      id->cntlid = cpu_to_le16(n->cntlid);
>  
>      id->rab = 6;
> -    id->ieee[0] = 0x00;
> -    id->ieee[1] = 0x02;
> -    id->ieee[2] = 0xb3;
> +
> +    if (n->params.use_intel_id) {
> +        id->ieee[0] = 0xb3;
> +        id->ieee[1] = 0x02;
> +        id->ieee[2] = 0x00;
> +    } else {
> +        id->ieee[0] = 0x00;
> +        id->ieee[1] = 0x54;
> +        id->ieee[2] = 0x52;
> +    }

Correct.

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Ideally we should have definitions and use them here and in
qemu_macaddr_default_if_unset() instead of this magic values.

> +
>      id->mdts = n->params.mdts;
>      id->ver = cpu_to_le32(NVME_SPEC_VER);
>      id->oacs = cpu_to_le16(0);
> 



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] hw/block/nvme: use locally assigned QEMU IEEE OUI
  2021-02-09 11:10 ` Philippe Mathieu-Daudé
@ 2021-02-10 20:57   ` Klaus Jensen
  0 siblings, 0 replies; 3+ messages in thread
From: Klaus Jensen @ 2021-02-10 20:57 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Kevin Wolf, qemu-block, Klaus Jensen, Jason Wang, qemu-devel,
	Max Reitz, Keith Busch, Gollu Appalanaidu

[-- Attachment #1: Type: text/plain, Size: 1864 bytes --]

On Feb  9 12:10, Philippe Mathieu-Daudé wrote:
> On 2/9/21 11:45 AM, Klaus Jensen wrote:
> > From: Gollu Appalanaidu <anaidu.gollu@samsung.com>
> > 
> > Commit 6eb7a071292a ("hw/block/nvme: change controller pci id") changed
> > the controller to use a Red Hat assigned PCI Device and Vendor ID, but
> > did not change the IEEE OUI away from the Intel IEEE OUI.
> > 
> > Fix that and use the locally assigned QEMU IEEE OUI instead if the
> > `use-intel-id` parameter is not explicitly set. Also reverse the Intel
> > IEEE OUI bytes.
> > 
> > Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
> > Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
> > ---
> > 
> > v2: drop telemetry and add a check on the use_intel_id parameter.
> > 
> >  hw/block/nvme.c | 14 +++++++++++---
> >  1 file changed, 11 insertions(+), 3 deletions(-)
> > 
> > diff --git a/hw/block/nvme.c b/hw/block/nvme.c
> > index c2f0c88fbf39..870e9d8e1c17 100644
> > --- a/hw/block/nvme.c
> > +++ b/hw/block/nvme.c
> > @@ -4685,9 +4685,17 @@ static void nvme_init_ctrl(NvmeCtrl *n, PCIDevice *pci_dev)
> >      id->cntlid = cpu_to_le16(n->cntlid);
> >  
> >      id->rab = 6;
> > -    id->ieee[0] = 0x00;
> > -    id->ieee[1] = 0x02;
> > -    id->ieee[2] = 0xb3;
> > +
> > +    if (n->params.use_intel_id) {
> > +        id->ieee[0] = 0xb3;
> > +        id->ieee[1] = 0x02;
> > +        id->ieee[2] = 0x00;
> > +    } else {
> > +        id->ieee[0] = 0x00;
> > +        id->ieee[1] = 0x54;
> > +        id->ieee[2] = 0x52;
> > +    }
> 
> Correct.
> 
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> 
> Ideally we should have definitions and use them here and in
> qemu_macaddr_default_if_unset() instead of this magic values.
> 

For MAC-addresses we seem to inject some more bytes.

And thanks! Applied to nvme-next!

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-02-10 21:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-09 10:45 [PATCH v2] hw/block/nvme: use locally assigned QEMU IEEE OUI Klaus Jensen
2021-02-09 11:10 ` Philippe Mathieu-Daudé
2021-02-10 20:57   ` Klaus Jensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).