All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
To: BALATON Zoltan <balaton@eik.bme.hu>
Cc: qemu-ppc@nongnu.org, Alexander Graf <agraf@suse.de>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [Qemu-ppc] macio ide question/bug report
Date: Thu, 15 May 2014 10:30:58 +0100	[thread overview]
Message-ID: <53748952.9080909@ilande.co.uk> (raw)
In-Reply-To: <alpine.LMD.2.02.1405150053120.29947@jedlik.phy.bme.hu>

On 15/05/14 00:21, BALATON Zoltan wrote:

>> Which part is it that's still confusing you? Putting breakpoints on
>> pmac_ide_transfer() and pmac_ide_atapi_transfer_cb() will show you the
>> iterations on each DMA request (be sure to compare against a "known
>> good" example to understand how it should work first). If you can give
>> more detail as to which bits are confusing, I will try my best to
>> explain them.
>
> Looking at the backtrace:
>
> #0  ide_atapi_cmd_error (s=0x5555563cb238, sense_key=5, asc=33)
>      at hw/ide/atapi.c:141
> #1  0x00005555556cecf5 in ide_atapi_io_error (s=0x5555563cb238, ret=-5)
>      at hw/ide/atapi.c:160
> #2  0x00005555556d9d01 in pmac_ide_atapi_transfer_cb
> (opaque=0x5555563ccc68,
>      ret=-5) at hw/ide/macio.c:64
> #3  0x00005555556780d2 in dma_complete (dbs=0x5555563ab840, ret=-5)
>      at dma-helpers.c:121
> #4  0x00005555556781db in dma_bdrv_cb (opaque=0x5555563ab840, ret=-5)
>      at dma-helpers.c:149
> #5  0x0000555555614dd1 in bdrv_co_em_bh (opaque=0x5555563b5000) at
> block.c:4602
> #6  0x00005555555f8170 in aio_bh_poll (ctx=0x55555637fc00) at async.c:81
> #7  0x00005555555f7dc9 in aio_poll (ctx=0x55555637fc00, blocking=false)
>      at aio-posix.c:188
> #8  0x00005555555f8587 in aio_ctx_dispatch (source=0x55555637fc00,
> callback=
>      0x0, user_data=0x0) at async.c:205
> #9  0x00007ffff78ca6d5 in g_main_context_dispatch ()
>     from /lib64/libglib-2.0.so.0
> #10 0x00005555557a0f42 in glib_pollfds_poll () at main-loop.c:190
> #11 0x00005555557a1042 in os_host_main_loop_wait (timeout=0) at
> main-loop.c:235
> #12 0x00005555557a1115 in main_loop_wait (nonblocking=1) at main-loop.c:484
> #13 0x0000555555844190 in main_loop () at vl.c:2075
> #14 0x000055555584bc23 in main (argc=30, argv=0x7fffffffdc88, envp=
>      0x7fffffffdd80) at vl.c:4556
>
> shows that pmac_ide_atapi_transfer_cb is called with ret=-5 which is why
> it fails, so putting a breakpoint there is too late. What I don't
> understand is where this -5 value comes from. I don't have a known good
> example because Darwin reads the TOC differently (probably before
> enabling DMA, I did not trace it more than the logs I've included
> earlier though) and MorphOS always fails.

Have you noticed that the dma_bdrv_*() functions use a function pointer 
to pmac_ide_atapi_transfer_cb() as their callback function? The 
dma_bdrv_*() functions operate in a separate thread and then invoke the 
callback function when finished.

The breakpoint you are hitting above is the invocation of 
pmac_ide_atapi_transfer_cb() as a result of the callback *after* the 
command has already failed, and not the invocation of 
pmac_ide_atapi_transfer_cb() which calls dma_bdrv_*() to setup the 
asynchronous transfer. Hence the DMA has already failed and the -5 value 
is being returned from the IDE code. I can only guess the reason this 
works with Darwin is because it is a non-DMA request.

If you place a breakpoint on pmac_ide_transfer() then its invocation of 
pmac_ide_atapi_transfer_cb() should be the first iteration which sets up 
the DMA request, and the second invocation should be the (failing) 
callback from the dma_bdrv_*() functions. But as I mentioned before, I 
think the problem is that these functions shouldn't be called in the 
first place when requesting a TOC.


HTH,

Mark.

  reply	other threads:[~2014-05-15  9:33 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <alpine.LMD.2.02.1405040120250.2612@jedlik.phy.bme.hu>
     [not found] ` <5366CA94.3030803@ilande.co.uk>
     [not found]   ` <alpine.LMD.2.02.1405071132470.25770@jedlik.phy.bme.hu>
     [not found]     ` <536A328F.6070100@ilande.co.uk>
     [not found]       ` <alpine.LMD.2.02.1405071854390.26524@jedlik.phy.bme.hu>
     [not found]         ` <536A6F3C.1030708@ilande.co.uk>
2014-05-10 12:30           ` [Qemu-devel] [Qemu-ppc] macio ide question/bug report BALATON Zoltan
2014-05-12 16:26             ` Mark Cave-Ayland
2014-05-12 19:32               ` BALATON Zoltan
2014-05-12 20:34                 ` Mark Cave-Ayland
2014-05-13 23:02                   ` BALATON Zoltan
2014-05-14  4:55                     ` Mark Cave-Ayland
2014-05-14 11:10                       ` BALATON Zoltan
2014-05-14 20:09                         ` Mark Cave-Ayland
2014-05-14 23:21                           ` BALATON Zoltan
2014-05-15  9:30                             ` Mark Cave-Ayland [this message]
2014-05-15 17:28                               ` BALATON Zoltan
2014-05-15 19:22                                 ` Mark Cave-Ayland
2014-05-15 20:14                                   ` BALATON Zoltan
2014-05-15 20:26                                     ` BALATON Zoltan
2014-05-15 20:28                                       ` BALATON Zoltan
2014-05-16 11:22                                         ` Mark Cave-Ayland
2014-05-16 20:31                                           ` BALATON Zoltan

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=53748952.9080909@ilande.co.uk \
    --to=mark.cave-ayland@ilande.co.uk \
    --cc=agraf@suse.de \
    --cc=balaton@eik.bme.hu \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@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 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.