All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Cédric Le Goater" <clg@kaod.org>
To: Titus Rwantare <titusr@google.com>
Cc: "Corey Minyard" <minyard@acm.org>,
	"andrew@aj.id.au" <andrew@aj.id.au>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"QEMU Developers" <qemu-devel@nongnu.org>,
	"Hao Wu" <wuhaotsh@google.com>,
	qemu-arm@nongnu.org
Subject: Re: [PATCH] hw/misc: Add an iBT device model
Date: Tue, 28 Sep 2021 19:54:26 +0200	[thread overview]
Message-ID: <4da8f6cf-0397-e2dd-2a3d-e81bfcaefd67@kaod.org> (raw)
In-Reply-To: <CAMvPwGpWftHwxJBbRUzHmsuguspUPBXgU+ROZqRJ2ypa4z6ETg@mail.gmail.com>

On 9/24/21 20:43, Titus Rwantare wrote:
> On Fri, 24 Sept 2021 at 03:55, Cédric Le Goater <clg@kaod.org> wrote:
>>
>> Hello Titus,
>>
>> On 9/24/21 10:42, Philippe Mathieu-Daudé wrote:
>>> On 9/24/21 01:48, Titus Rwantare wrote:
>>>> Hello all,
>>>>
>>>> I'd like some clarification on how the following code transfers irqs
>>>> back and forth:
>>>>> b/hw/arm/aspeed_soc.c
>>>>> +    /* iBT */
>>>>> +    if (!sysbus_realize(SYS_BUS_DEVICE(&s->ibt), errp)) {
>>>>> +        return;
>>>>> +    }
>>>>> +    memory_region_add_subregion(&s->lpc.iomem,
>>>>> +                   sc->memmap[ASPEED_DEV_IBT] - sc->memmap[ASPEED_DEV_LPC],
>>>>> +                   &s->ibt.iomem);
>>>>> +    sysbus_connect_irq(SYS_BUS_DEVICE(&s->lpc), 1 + aspeed_lpc_ibt,
>>
>>
>> The iBT device IRQ is connected to a subdevice irq of the LPC device.
>> See aspeed_lpc_realize(). And triggered in aspeed_lpc_set_irq()
> 
> Yes, that side makes sense. I tried to get at that irq from
> aspeed_ibt.c as follows:
> 
> qemu_irq_lower(ibt->lpc->subdevice_irqs[aspeed_lpc_ibt]); // or raise
> 
> static void aspeed_ibt_realize(DeviceState *dev, Error **errp)
> {
> AspeedIBTState *ibt = ASPEED_IBT(dev);
> SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
> IPMIInterface *ii = IPMI_INTERFACE(dev);
> ibt->lpc = ASPEED_LPC(dev);
> ...
> 
> but this doesn't work and maybe I'm misusing the dynamic cast?
> 
>>>>> +                       qdev_get_gpio_in(DEVICE(&s->lpc), aspeed_lpc_ibt));
>>>>> }
>>>>
>>>> and
>>>>
>>>>> hw/misc/aspeed_ibt.c
>>>>> +static void aspeed_ibt_realize(DeviceState *dev, Error **errp)
>>>>> +{
>>>>> +    SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
>>>>> +    AspeedIBTState *ibt = ASPEED_IBT(dev);
>>>> ...
>>>>> +
>>>>> +    sysbus_init_irq(sbd, &ibt->irq);
>>>>
>>>> I ask because the code in aspeed_soc.c seems to connect to the
>>>> lpc->subdevice_irqs[aspeed_lpc_ibt], initialised on
>>>> hw/misc/aspeed_lpc.c:408.
>>>> I noticed that bmc firmware running in qemu was checking the BT_CTRL
>>>> register less frequently than I'd like while editing this patch to use
>>>> the IPMIInterface.
>>
>> OK.
>>
>> This might be a problem in aspeed_ibt_update_irq(). This patch is
>> an experiment from some few years ago. It still works good enough
>> for the witherspoon-bmc and powernv9 machines for simple IPMI
>> commands: fru, sdr, lan, power off (to be checked).
>>
>> Could you share your BMC and host command line ?
>>
> 
> Host:
> -chardev socket,id=ipmichr1,host=localhost,port=9999,reconnect=10 \
> -device ipmi-bmc-extern,chardev=ipmichr1,id=bmc0 \
> -device isa-ipmi-bt,bmc=bmc0,irq=10 -nodefaults
> 
> BMC:
> -chardev socket,id=ipmichr1,host=localhost,port=9999,server=on,wait=off \
> -device ipmi-host-extern,chardev=ipmichr1,responder=/machine/soc/ibt

This looks correct.

> But for this to work you need Hao's patch as well: [PATCH 7/8]
> hw/ipmi: Add an IPMI external host device.
  
Is it based on my aspeed branch which contains the iBT model ?
Could you send the patchset as an RFC maybe ?


Thanks,

C.




  reply	other threads:[~2021-09-28 17:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-23 23:48 [PATCH] hw/misc: Add an iBT device model Titus Rwantare
2021-09-24  8:42 ` Philippe Mathieu-Daudé
2021-09-24 10:55   ` Cédric Le Goater
2021-09-24 18:43     ` Titus Rwantare
2021-09-28 17:54       ` Cédric Le Goater [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-03-29 12:19 Cédric Le Goater
2021-03-29 21:43 ` Joel Stanley
2021-04-05 16:54 ` Hao Wu
2021-04-06  7:09   ` Cédric Le Goater
2021-04-27 12:41 ` Cédric Le Goater

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=4da8f6cf-0397-e2dd-2a3d-e81bfcaefd67@kaod.org \
    --to=clg@kaod.org \
    --cc=andrew@aj.id.au \
    --cc=f4bug@amsat.org \
    --cc=minyard@acm.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=titusr@google.com \
    --cc=wuhaotsh@google.com \
    /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.