All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron via <qemu-arm@nongnu.org>
To: Klaus Jensen <its@irrelevant.dk>
Cc: qemu-devel@nongnu.org, "Corey Minyard" <cminyard@mvista.com>,
	"Jeremy Kerr" <jk@codeconstruct.com.au>,
	qemu-arm@nongnu.org, "Peter Delevoryas" <peter@pjd.dev>,
	"Keith Busch" <kbusch@kernel.org>,
	"Cédric Le Goater" <clg@kaod.org>,
	"Jason Wang" <jasowang@redhat.com>,
	"Lior Weintraub" <liorw@pliops.com>,
	qemu-block@nongnu.org, "Peter Maydell" <peter.maydell@linaro.org>,
	"Matt Johnston" <matt@codeconstruct.com.au>,
	"Klaus Jensen" <k.jensen@samsung.com>
Subject: Re: [PATCH v2 3/3] hw/nvme: add nvme management interface model
Date: Thu, 25 May 2023 12:34:49 +0100	[thread overview]
Message-ID: <20230525123449.00001d60@Huawei.com> (raw)
In-Reply-To: <20230425063540.46143-4-its@irrelevant.dk>

On Tue, 25 Apr 2023 08:35:40 +0200
Klaus Jensen <its@irrelevant.dk> wrote:

> From: Klaus Jensen <k.jensen@samsung.com>
> 
> Add the 'nmi-i2c' device that emulates an NVMe Management Interface
> controller.
> 
> Initial support is very basic (Read NMI DS, Configuration Get).
> 
> This is based on previously posted code by Padmakar Kalghatgi, Arun
> Kumar Agasar and Saurav Kumar.
> 
> Signed-off-by: Klaus Jensen <k.jensen@samsung.com>

I don't have time to do too much spec diving so this is very superficial...

Mostly commenting because it gave me a build error.

> diff --git a/hw/nvme/nmi-i2c.c b/hw/nvme/nmi-i2c.c
> new file mode 100644
> index 000000000000..81738f185bba
> --- /dev/null
> +++ b/hw/nvme/nmi-i2c.c
> @@ -0,0 +1,382 @@
...

> +static void nmi_handle_mi_config_get(NMIDevice *nmi, NMIRequest *request)
> +{
> +    uint32_t dw0 = le32_to_cpu(request->dw0);
> +    uint8_t identifier = dw0 & 0xff;
> +    uint8_t *buf;
> +
> +    trace_nmi_handle_mi_config_get(identifier);
> +
> +    switch (identifier) {
> +    case NMI_CMD_CONFIGURATION_GET_SMBUS_FREQ:
> +        buf = (uint8_t[]) {
> +            0x0, 0x1, 0x0, 0x0,
> +        };
> +
> +        break;
> +
> +    case NMI_CMD_CONFIGURATION_GET_HEALTH_STATUS_CHANGE:
> +        buf = (uint8_t[]) {
> +            0x0, 0x0, 0x0, 0x0,
> +        };
> +
> +        break;
> +
> +    case NMI_CMD_CONFIGURATION_GET_MCTP_TRANSMISSION_UNIT:
> +        buf = (uint8_t[]) {
> +            0x0, 0x40, 0x0, 0x0,
> +        };
> +
> +        break;

No default, which gave me a build error as buf is uninitialized.

> +    }
> +
> +    memcpy(nmi->scratch + nmi->pos, buf, 4);
> +    nmi->pos += 4;
> +}
> +
> +enum {
> +    NMI_CMD_READ_NMI_DS         = 0x0,
> +    NMI_CMD_CONFIGURATION_GET   = 0x4,
> +};
> +


> +static size_t nmi_get_message_types(MCTPI2CEndpoint *mctp, uint8_t *data,
> +                                    size_t maxlen)
> +{
> +    uint8_t buf[] = {
> +        0x0, 0x1, 0x4,

PLDM?  Are you using that so far?  Maybe keep it for when you
add PLDM support?

> +    };
> +
> +    memcpy(data, buf, sizeof(buf));
> +
> +    return sizeof(buf);
> +}


WARNING: multiple messages have this Message-ID (diff)
From: Jonathan Cameron via <qemu-devel@nongnu.org>
To: Klaus Jensen <its@irrelevant.dk>
Cc: qemu-devel@nongnu.org, "Corey Minyard" <cminyard@mvista.com>,
	"Jeremy Kerr" <jk@codeconstruct.com.au>,
	qemu-arm@nongnu.org, "Peter Delevoryas" <peter@pjd.dev>,
	"Keith Busch" <kbusch@kernel.org>,
	"Cédric Le Goater" <clg@kaod.org>,
	"Jason Wang" <jasowang@redhat.com>,
	"Lior Weintraub" <liorw@pliops.com>,
	qemu-block@nongnu.org, "Peter Maydell" <peter.maydell@linaro.org>,
	"Matt Johnston" <matt@codeconstruct.com.au>,
	"Klaus Jensen" <k.jensen@samsung.com>
Subject: Re: [PATCH v2 3/3] hw/nvme: add nvme management interface model
Date: Thu, 25 May 2023 12:34:49 +0100	[thread overview]
Message-ID: <20230525123449.00001d60@Huawei.com> (raw)
In-Reply-To: <20230425063540.46143-4-its@irrelevant.dk>

On Tue, 25 Apr 2023 08:35:40 +0200
Klaus Jensen <its@irrelevant.dk> wrote:

> From: Klaus Jensen <k.jensen@samsung.com>
> 
> Add the 'nmi-i2c' device that emulates an NVMe Management Interface
> controller.
> 
> Initial support is very basic (Read NMI DS, Configuration Get).
> 
> This is based on previously posted code by Padmakar Kalghatgi, Arun
> Kumar Agasar and Saurav Kumar.
> 
> Signed-off-by: Klaus Jensen <k.jensen@samsung.com>

I don't have time to do too much spec diving so this is very superficial...

Mostly commenting because it gave me a build error.

> diff --git a/hw/nvme/nmi-i2c.c b/hw/nvme/nmi-i2c.c
> new file mode 100644
> index 000000000000..81738f185bba
> --- /dev/null
> +++ b/hw/nvme/nmi-i2c.c
> @@ -0,0 +1,382 @@
...

> +static void nmi_handle_mi_config_get(NMIDevice *nmi, NMIRequest *request)
> +{
> +    uint32_t dw0 = le32_to_cpu(request->dw0);
> +    uint8_t identifier = dw0 & 0xff;
> +    uint8_t *buf;
> +
> +    trace_nmi_handle_mi_config_get(identifier);
> +
> +    switch (identifier) {
> +    case NMI_CMD_CONFIGURATION_GET_SMBUS_FREQ:
> +        buf = (uint8_t[]) {
> +            0x0, 0x1, 0x0, 0x0,
> +        };
> +
> +        break;
> +
> +    case NMI_CMD_CONFIGURATION_GET_HEALTH_STATUS_CHANGE:
> +        buf = (uint8_t[]) {
> +            0x0, 0x0, 0x0, 0x0,
> +        };
> +
> +        break;
> +
> +    case NMI_CMD_CONFIGURATION_GET_MCTP_TRANSMISSION_UNIT:
> +        buf = (uint8_t[]) {
> +            0x0, 0x40, 0x0, 0x0,
> +        };
> +
> +        break;

No default, which gave me a build error as buf is uninitialized.

> +    }
> +
> +    memcpy(nmi->scratch + nmi->pos, buf, 4);
> +    nmi->pos += 4;
> +}
> +
> +enum {
> +    NMI_CMD_READ_NMI_DS         = 0x0,
> +    NMI_CMD_CONFIGURATION_GET   = 0x4,
> +};
> +


> +static size_t nmi_get_message_types(MCTPI2CEndpoint *mctp, uint8_t *data,
> +                                    size_t maxlen)
> +{
> +    uint8_t buf[] = {
> +        0x0, 0x1, 0x4,

PLDM?  Are you using that so far?  Maybe keep it for when you
add PLDM support?

> +    };
> +
> +    memcpy(data, buf, sizeof(buf));
> +
> +    return sizeof(buf);
> +}



  reply	other threads:[~2023-05-25 11:35 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-25  6:35 [PATCH v2 0/3] hw/{i2c, nvme}: mctp endpoint, nvme management interface model Klaus Jensen
2023-04-25  6:35 ` [PATCH v2 1/3] hw/i2c: add mctp core Klaus Jensen
2023-04-25 15:19   ` Corey Minyard
2023-04-26  7:11     ` Klaus Jensen
2023-04-26 11:52       ` Corey Minyard
2023-05-25 11:27   ` Jonathan Cameron via
2023-05-25 11:27     ` Jonathan Cameron via
2023-05-25 11:33     ` Klaus Jensen
2023-04-25  6:35 ` [PATCH v2 2/3] i2c/mctp: Allow receiving messages to dest eid 0 Klaus Jensen
2023-05-25 11:29   ` Jonathan Cameron via
2023-05-25 11:29     ` Jonathan Cameron via
2023-04-25  6:35 ` [PATCH v2 3/3] hw/nvme: add nvme management interface model Klaus Jensen
2023-05-25 11:34   ` Jonathan Cameron via [this message]
2023-05-25 11:34     ` Jonathan Cameron via

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230525123449.00001d60@Huawei.com \
    --to=qemu-arm@nongnu.org \
    --cc=Jonathan.Cameron@Huawei.com \
    --cc=clg@kaod.org \
    --cc=cminyard@mvista.com \
    --cc=its@irrelevant.dk \
    --cc=jasowang@redhat.com \
    --cc=jk@codeconstruct.com.au \
    --cc=k.jensen@samsung.com \
    --cc=kbusch@kernel.org \
    --cc=liorw@pliops.com \
    --cc=matt@codeconstruct.com.au \
    --cc=peter.maydell@linaro.org \
    --cc=peter@pjd.dev \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.