xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Shailesh Kumar <tsaileshkumar@gmail.com>
To: "xen-devel@lists.xen.org" <xen-devel@lists.xen.org>,
	qemu-devel@nongnu.org
Subject: [Block dev] : Qemu block ide_dma_read call routine
Date: Tue, 10 Feb 2015 19:51:05 -0800	[thread overview]
Message-ID: <CACY1rB4rJc=D0qPFSMU0F2QjoTWEE6Bydc_aUmmPjvXyRorvrQ@mail.gmail.com> (raw)

Hi,

    I am implementing read equivalent routine in qemu. Can some one
help me understand  control flow of the qemu read/write
implementation.

I am using xen-4.2.0 and qemu-1.6.1

My requirement is simple:

I have a 1024*1024 buffer already filled with some useful data.

Now when windows (my guest OS) does IDE_DMA_READ command to the disk,
I want to intercept it and fill data from my private buffer.

my intention is to leverage existing dma_read infrastructure and
overwrite the read buffer-data at the lowest level of qemu . That way
the buffers /vectors "qiov" which are prepared due to cmd IDE_DMA_READ
will copy and return data from my data-buffer to guest-OS.

I could trace the control from.

ide_sector_start_dma
-> s->bus->dma->ops->start_dma
    -> ide_dma_cb
        ->dma_bdrv_read
           -> bdrv_aio_readv
.              ->bdrv_co_aio_rw_vector
                  -> bdrv_co_do_rw   "coroutine"
                      -> bdrv_co_do_readv
                          -> drv->bdrv_co_readv (( in my case it is
from raw.c raw_co_readv ))
                             -> bdrv_co_readv
                      -> bdrv_co_do_readv

                   ->in bdrv_co_do_rw  the bottom half is scheduled
bdrv_co_em_bh -->> this will invoke     -> ide_dma_cb () which is
again the starting point. Looks like there a double-linked list
maintained for the coroutine entries and are off loaded to qemu-wait
queue during this process.

Now I need help to understand where to look for to find the last
read/write system call which will get the data out from the disk for
guest-OS (windows) .

I am seeking suggestions and help for the same.

thanks
S. Kumar

             reply	other threads:[~2015-02-11  3:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-11  3:51 Shailesh Kumar [this message]
2015-02-23 11:25 ` [Qemu-devel] [Block dev] : Qemu block ide_dma_read call routine Kevin Wolf
     [not found] ` <20150223112557.GC4302@noname.str.redhat.com>
2015-07-23 19:20   ` Shailesh Kumar
     [not found]   ` <CACY1rB71Y+t4Lm9OtjNog+ZeKughw_Owv_A9fu9KM69rh2ZzBQ@mail.gmail.com>
2015-07-24 10:58     ` Kevin Wolf

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='CACY1rB4rJc=D0qPFSMU0F2QjoTWEE6Bydc_aUmmPjvXyRorvrQ@mail.gmail.com' \
    --to=tsaileshkumar@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=xen-devel@lists.xen.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).