qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: Blue Swirl <blauwirbel@gmail.com>
Cc: qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH 4/4] i8254: convert to qdev
Date: Sun, 06 Mar 2011 11:47:58 -0600	[thread overview]
Message-ID: <4D73C8CE.6080800@codemonkey.ws> (raw)
In-Reply-To: <AANLkTi=LHVBgZ+mxOXOidTNKrVavhBm+AL5Bwdf2V4A4@mail.gmail.com>

On 03/06/2011 10:47 AM, Blue Swirl wrote:
>> The PIT is not an ISA device.  Modelling it as such is worse than leaving it
>> unmodelled.
>>      
> No. These days, PIT is part of Super I/O chip, which is accessed via
> LPC bus. LPC is from software point of view equal to ISA. Therefore,
> in absence of LPC, ISA is correct.
>    

In the system we model, the PIT is part of the PIIX3.  The right way to 
model it is as a DeviceState that's no_user=1 and created as part of the 
initialized of PIIX3 (for the PC at least).

LPC is still an expansion bus and it's primarily used for discrete 
components like a TPM.  For components that are all part of a Super I/O 
chip, there really just isn't a bus in the middle.

>>> -PITState *pit_init(int base, qemu_irq irq);
>>> -void pit_set_gate(PITState *pit, int channel, int val);
>>> -int pit_get_gate(PITState *pit, int channel);
>>> -int pit_get_initial_count(PITState *pit, int channel);
>>> -int pit_get_mode(PITState *pit, int channel);
>>> -int pit_get_out(PITState *pit, int channel, int64_t current_time);
>>> +void pit_set_gate(ISADevice *dev, int channel, int val);
>>> +int pit_get_gate(ISADevice *dev, int channel);
>>> +int pit_get_initial_count(ISADevice *dev, int channel);
>>> +int pit_get_mode(ISADevice *dev, int channel);
>>> +int pit_get_out(ISADevice *dev, int channel, int64_t current_time);
>>>
>>>        
>> Making these functions take an ISADevice hurts type safety.  They should
>> take a PITState.
>>      
> These functions should be removed anyway. For example, pcspk probably
> should be merged with i825, or a signal like interface could be used.
>    

It's tough to do that without doing a real simulation.  The PC speaker 
uses one of the PIT channel outputs to drive its tone output.  But we 
don't want to do something like use a qemu_irq with a timer programmed 
to generate the right frequency wave to drive the tone.

So having the PC speaker hold a reference to the PIT and providing a 
high level method interface makes sense to me.

Regards,

Anthony Liguori

  parent reply	other threads:[~2011-03-06 17:48 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-13 21:10 [Qemu-devel] [PATCH 4/4] i8254: convert to qdev Blue Swirl
2011-03-06 15:10 ` [Qemu-devel] " Jan Kiszka
2011-03-06 15:35   ` Blue Swirl
2011-03-06 15:39     ` Jan Kiszka
2011-03-06 16:06       ` Blue Swirl
2011-03-06 16:08         ` Jan Kiszka
2011-03-06 16:31 ` [Qemu-devel] " Anthony Liguori
2011-03-06 16:47   ` Blue Swirl
2011-03-06 17:35     ` Blue Swirl
2011-03-06 17:47     ` Anthony Liguori [this message]
2011-03-06 18:06       ` [Qemu-devel] " Jan Kiszka
2011-03-06 20:45         ` Anthony Liguori
2011-03-06 21:15           ` Blue Swirl
2011-03-06 21:18           ` Jan Kiszka
2011-03-07  0:32             ` Anthony Liguori
2011-03-07  7:58               ` Jan Kiszka
2011-03-07 14:57                 ` Anthony Liguori
2011-03-07 15:46                   ` Jan Kiszka

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=4D73C8CE.6080800@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=blauwirbel@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 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).