All of lore.kernel.org
 help / color / mirror / Atom feed
From: Corey Minyard <corey@minyard.net>
To: Nicholas Piggin <npiggin@gmail.com>
Cc: Corey Minyard <minyard@acm.org>, qemu-devel@nongnu.org
Subject: Re: [PATCH 3/3] ipmi/bmc-sim: Add 'Get Channel Info' command
Date: Mon, 31 Mar 2025 19:11:06 -0500	[thread overview]
Message-ID: <Z-svGoCWnvYz3Shj@mail.minyard.net> (raw)
In-Reply-To: <D8UULC4ZS27K.2JYUFGLKD5Q8Q@gmail.com>

On Tue, Apr 01, 2025 at 09:42:01AM +1000, Nicholas Piggin wrote:
> On Mon Mar 31, 2025 at 11:25 PM AEST, Corey Minyard wrote:
> > On Mon, Mar 31, 2025 at 10:57:24PM +1000, Nicholas Piggin wrote:
> >> +static void get_channel_info(IPMIBmcSim *ibs,
> >> +                             uint8_t *cmd, unsigned int cmd_len,
> >> +                             RspBuffer *rsp)
> >> +{
> >> +    IPMIInterface *s = ibs->parent.intf;
> >> +    IPMIInterfaceClass *k = IPMI_INTERFACE_GET_CLASS(s);
> >> +    uint8_t ch = cmd[1] & 0x0f;
> >> +
> >> +    /* Only define channel 0h (IPMB) and Fh (system interface) */
> >> +
> >> +    if (ch == 0x0e) { /* "This channel" */
> >> +        ch = IPMI_CHANNEL_SYSTEM;
> >> +    }
> >> +    rsp_buffer_push(rsp, ch);
> >> +
> >> +    if (ch != IPMI_CHANNEL_IPMB && ch != IPMI_CHANNEL_SYSTEM) {
> >> +        /* Not supported */
> >
> > I think that an all zero response is a valid response.  I think you
> > should return a IPMI_CC_INVALID_DATA_FIELD instead, right?
> 
> I can't remember, I dug the patch out from a while ago. I can't actually
> see anywhere it is made clear in the spec, do you? I agree an invalid
> error sounds better. I'll try to see how ipmi tools handles it.

I'm fairly sure an error response is ok.  Please pursue that.

> 
> >> +        int i;
> >> +        for (i = 0; i < 8; i++) {
> >> +            rsp_buffer_push(rsp, 0x00);
> >> +        }
> >> +        return;
> >> +    }
> >> +
> >> +    if (ch == IPMI_CHANNEL_IPMB) {
> >> +        rsp_buffer_push(rsp, IPMI_CH_MEDIUM_IPMB);
> >> +        rsp_buffer_push(rsp, IPMI_CH_PROTOCOL_IPMB);
> >> +    } else { /* IPMI_CHANNEL_SYSTEM */
> >> +        rsp_buffer_push(rsp, IPMI_CH_MEDIUM_SYSTEM);
> >> +        rsp_buffer_push(rsp, k->protocol);
> >> +    }
> >> +
> >> +    rsp_buffer_push(rsp, 0x00); /* Session-less */
> >> +
> >> +    /* IPMI Vendor ID */
> >> +    rsp_buffer_push(rsp, 0xf2);
> >> +    rsp_buffer_push(rsp, 0x1b);
> >> +    rsp_buffer_push(rsp, 0x00);
> >
> > Where does this come from?
> 
> IPMI spec Get Channel Info Command, search "IPMI Enterprise Number"
> From my reading, all channel info responses contain this.

Oh, sorry, I should have read on this.  This is fine.

> 
> >> +
> >> +    if (ch == IPMI_CHANNEL_SYSTEM) {
> >> +        /* IRQ assigned by ACPI/PnP (XXX?) */
> >> +        rsp_buffer_push(rsp, 0x60);
> >> +        rsp_buffer_push(rsp, 0x60);
> >
> > The interrupt should be available.  For the isa versions there is a
> > get_fwinfo function pointer that you can fetch this with.  For PCI it's
> > more complicated, unfortunately.
> 
> These are for the two interrupts. QEMU seems to tie both to the
> same line, I guess that's okay?

Yes, they are the same.

> 
> That interface looks good, but what I was concerned about is whether
> that implies the irq is hard coded or whether the platform can assign
> it, does it mean unassigned? I don't know a lot about irq routing or
> what IPMI clients would use it for.

For isa-based devices, it's hard-coded by the configuration.  That one
should be easy to get.

For PCI, I'm not so sure.  It would take some research to figure it out.

> 
> Anyhow I'll respin with changes.

Thanks,

-corey

> 
> Thanks,
> Nick


      reply	other threads:[~2025-04-01  0:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-31 12:57 [PATCH 0/3] ipmi: bmc-sim improvements Nicholas Piggin
2025-03-31 12:57 ` [PATCH 1/3] ipmi/bmc-sim: implement watchdog dont log flag Nicholas Piggin
2025-03-31 13:13   ` Corey Minyard
2025-03-31 22:37     ` Nicholas Piggin
2025-03-31 23:03       ` Corey Minyard
2025-04-01  1:36         ` Corey Minyard
2025-03-31 12:57 ` [PATCH 2/3] ipmi/bmc-sim: add error handling for 'Set BMC Global Enables' command Nicholas Piggin
2025-03-31 12:57 ` [PATCH 3/3] ipmi/bmc-sim: Add 'Get Channel Info' command Nicholas Piggin
2025-03-31 13:25   ` Corey Minyard
2025-03-31 23:42     ` Nicholas Piggin
2025-04-01  0:11       ` Corey Minyard [this message]

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=Z-svGoCWnvYz3Shj@mail.minyard.net \
    --to=corey@minyard.net \
    --cc=minyard@acm.org \
    --cc=npiggin@gmail.com \
    --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.