Re: [PATCH linux dev-5.10 2/7] ipmi: kcs_bmc: Add a "raw" character device interface

Andrew Jeffery andrew at aj.id.au
Wed Jun 23 13:20:26 AEST 2021



On Wed, 23 Jun 2021, at 10:34, Joel Stanley wrote:
> On Wed, 23 Jun 2021 at 00:48, Andrew Jeffery <andrew at aj.id.au> wrote:
> >
> >
> >
> > On Fri, 18 Jun 2021, at 13:28, Andrew Jeffery wrote:
> > > +static int kcs_bmc_raw_add_device(struct kcs_bmc_device *kcs_bmc)
> > > +{
> > > +     struct kcs_bmc_raw *priv;
> > > +     int rc;
> > > +
> > > +     priv = devm_kzalloc(kcs_bmc->dev, sizeof(*priv), GFP_KERNEL);
> > > +     if (!priv)
> > > +             return -ENOMEM;
> > > +
> > > +     priv->client.dev = kcs_bmc;
> > > +     priv->client.ops = &kcs_bmc_raw_client_ops;
> > > +
> > > +     init_waitqueue_head(&priv->queue);
> > > +     priv->writable = false;
> > > +     priv->readable = false;
> > > +
> > > +     priv->miscdev.minor = MISC_DYNAMIC_MINOR;
> > > +     priv->miscdev.name = devm_kasprintf(kcs_bmc->dev, GFP_KERNEL, "%s%u",
> > > DEVICE_NAME,
> > > +                                        kcs_bmc->channel);
> > > +     if (!priv->miscdev.name)
> > > +             return -EINVAL;
> > > +
> > > +     priv->miscdev.fops = &kcs_bmc_raw_fops;
> > > +
> > > +     /* Initialise our expected events. Listen for IBF but ignore OBE
> > > until necessary */
> > > +     kcs_bmc_raw_update_event_mask(priv, (KCS_BMC_EVENT_TYPE_IBF |
> > > KCS_BMC_EVENT_TYPE_OBE),
> > > +                                   KCS_BMC_EVENT_TYPE_IBF);
> >
> > Ah, this is now wrong wrt to some other rework that went on, we should be disabling IBF and OBE until the chardev is opened.
> >
> > With the code as it is we can get a "nobody cared" WARN().
> >
> > I'll send a v2.
> 
> Best to put it on the upstream lists. We can pull it in if you need it sooner.

This driver is just a stop-gap until we get Jeremy's socket-based MCTP work merged. It replaces the pile of hacks known as the mctp-lpc driver.

I've explained a bit more in the cover letter:

https://lore.kernel.org/openbmc/20210618035858.4024689-1-andrew@aj.id.au/

Andrew


More information about the openbmc mailing list