From: malc <av1474@comtv.ru>
To: Juan Quintela <quintela@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH 00/20] Port audio to vmstate
Date: Fri, 23 Oct 2009 16:41:55 +0400 (MSD) [thread overview]
Message-ID: <Pine.LNX.4.64.0910231635430.2593@linmac.oyster.ru> (raw)
In-Reply-To: <m3vdi6b8js.fsf@neno.mitica>
On Fri, 23 Oct 2009, Juan Quintela wrote:
> malc <av1474@comtv.ru> wrote:
> > On Thu, 22 Oct 2009, Juan Quintela wrote:
> >
>
> Hi
>
> >> - es1370: the best working with migration.
> >> - adlib: I am not able to get sound out of it on any recent Fedora :(
> >
> > It's an FM chip, trying to play PCM with it just not gonna fly.
>
> That could expain it :)
>
> >> I disabled dma_running before loading state. malc can you take a look here?
>
> > Can you please elaborate on what is exactly the problem.
>
> What we have here:
>
> On save_state, we save a state field:
> val = s->dma_running; qemu_put_be32s (f, &val);
>
> Now on load state, we read it to one local variable:
> qemu_get_be32s (f, &dma_running);
>
> My understanding of the code here is that you should never assign
> directly s->dma_running, that you should set/clean it through
> cs_reset_voices()
> (setting this value has _side-effects_
Okay, i've looked at the code dma_running is basically a flag which is
sortof redundant but for the lack of better interface tells us whether
we have DREQ asserted, nothing more nothing less.
>
> So far so good.
>
> Now, the whole point of vmstate is:
> - state is described declaratively
> - and load/save are "kind" of inverse functions. One save
> the value of one field to the state, and the other takes the value
> from the state and put it back in the field.
> - Later (post_load), we do any side-effect that we need to do with the
> new loaded state.
>
> Here we can't do this. How would I do it in any other driver, i.e. (no
> audio). Easy, you just declare dma_running_vmstate in the state, and
> in post_load(), you just call cs_reset_voices depending on that value.
>
> You already ruled out that solution on ac97. Didn't even try here.
>
> No problem, I just read it on s->dma_running(), and on post_load I do:
>
> if (s->dma_running && (s->dregs[Interface_Configuration] & PEN)) {
> s->dma_running = 0;
> cs_reset_voices (s, s->dregs[FS_And_Playback_Data_Format]);
> }
>
> And call it a day :).
>
> But then I thought of what happens if you call loadvm from the monitor
> while s->dma_running = 1.
>
> And decided that the proper thing to do is to do:
>
> in pre_load()
> - we set dma_running to 0 if if it 1, but do it like in
> cs_reset_voices()
>
> if (s->dma_running) {
> DMA_release_DREQ (s->dma);
> AUD_set_active_out (s->voice, 0);
> }
> s->dma_running = 0;
>
> And now, in post_load, we know that s->dma_runing is what was comes from
> migration, and we can set it to this value. Do you think that my
> explanation is clear?
Sorry, i haven't slept in quite a while, so nothing makes any sense
currently, i'll try to do a mental exercise of running it solely
inside my brain sometime later.
> Discussing this with Anthony on irc, he thinks that dma_running is the
> same that (s->dregs[Interface_Configuration] & PEN), and that we could
> remove it from the state, but I am not sure, nad decided not to go that
> route (because I am not sure, not because it is not the same. I don't know).
It's not quite the same as Iconf & PEN (see for instance PPIO
handling, or lack thereof)
[..snip..]
--
mailto:av1474@comtv.ru
prev parent reply other threads:[~2009-10-23 12:41 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-22 14:36 [Qemu-devel] [PATCH 00/20] Port audio to vmstate Juan Quintela
2009-10-22 14:36 ` [Qemu-devel] [PATCH 01/20] audio: fix compilation of DEBUG_PLIVE Juan Quintela
2009-10-22 14:36 ` [Qemu-devel] [PATCH 02/20] audio: port to vmstate Juan Quintela
2009-10-22 14:36 ` [Qemu-devel] [PATCH 03/20] sb16: remove IO_READ_PROTO Juan Quintela
2009-10-22 20:32 ` malc
2009-10-22 20:41 ` Anthony Liguori
2009-10-22 14:36 ` [Qemu-devel] [PATCH 04/20] sb16: remove IO_WRITE_PROTO Juan Quintela
2009-10-22 20:32 ` malc
2009-10-22 14:36 ` [Qemu-devel] [PATCH 05/20] sb16: port to vmstate Juan Quintela
2009-10-22 14:36 ` [Qemu-devel] [PATCH 06/20] es1370: remove IO_READ_PROTO Juan Quintela
2009-10-22 20:33 ` malc
2009-10-22 14:36 ` [Qemu-devel] [PATCH 07/20] es1370: remove IO_WRITE_PROTO Juan Quintela
2009-10-22 20:33 ` malc
2009-10-22 14:36 ` [Qemu-devel] [PATCH 08/20] es1370: port to vmstate Juan Quintela
2009-10-22 14:36 ` [Qemu-devel] [PATCH 09/20] adlib: remove IO_READ_PROTO Juan Quintela
2009-10-22 20:34 ` malc
2009-10-22 14:36 ` [Qemu-devel] [PATCH 10/20] adlib: remove IO_WRITE_PROTO Juan Quintela
2009-10-22 20:34 ` malc
2009-10-22 14:36 ` [Qemu-devel] [PATCH 11/20] c4231a: remove IO_READ_PROTO Juan Quintela
2009-10-22 20:34 ` malc
2009-10-22 14:36 ` [Qemu-devel] [PATCH 12/20] c4231a: remove IO_WRITE_PROTO Juan Quintela
2009-10-22 20:35 ` malc
2009-10-22 14:36 ` [Qemu-devel] [PATCH 13/20] c4231a: port to vmstate Juan Quintela
2009-10-22 14:36 ` [Qemu-devel] [PATCH 14/20] gus: remove IO_READ_PROTO Juan Quintela
2009-10-22 20:35 ` malc
2009-10-22 14:36 ` [Qemu-devel] [PATCH 15/20] gus: remove IO_WRITE_PROTO Juan Quintela
2009-10-22 20:35 ` malc
2009-10-22 14:36 ` [Qemu-devel] [PATCH 16/20] gus: port to vmstate Juan Quintela
2009-10-22 14:36 ` [Qemu-devel] [PATCH 17/20] ac97: sizeof returns unsigned long Juan Quintela
2009-10-22 14:36 ` [Qemu-devel] [PATCH 18/20] ac97: recalculate active after loadvm Juan Quintela
2009-10-22 14:36 ` [Qemu-devel] [PATCH 19/20] ac97: up savevm version and remove active from state Juan Quintela
2009-10-22 14:36 ` [Qemu-devel] [PATCH 20/20] ac97: port to vmstate Juan Quintela
2009-10-22 20:44 ` [Qemu-devel] [PATCH 00/20] Port audio " malc
2009-10-23 12:26 ` [Qemu-devel] " Juan Quintela
2009-10-23 12:41 ` malc [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=Pine.LNX.4.64.0910231635430.2593@linmac.oyster.ru \
--to=av1474@comtv.ru \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.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 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).