On 24.03.2016 17:07, Paolo Bonzini wrote:


On 24/03/2016 14:38, Pavel Butsykin wrote:
Look at the ide_sector_read_cb function. The ->dma_cmd field is used
only for the DMA, we can't use the ide_cmd_is_read macro for PIO or
ATAPI. In fact, the ide_handle_rw_error looks like a generic function
and I do not see any good reason to move the handling of the dma_cmd
field(especially in the context of bug fixes).

I agree now.

However, if it works, using dma_cmd would be better than using the
dma_cb.

We can't use the dma_cmd field to build the ATAPI ->error_status. Your
proposal is quite logical, but please look at the 3rd patch, there to
build ->error_status we can use the same dma_cb, it is very convenient.

Couldn't you just add a new dma_cmd value IDE_DMA_ATAPI, and set it
before every call to ide_start_dma(s, ide_atapi_cmd_read_dma_cb)?

You want something like this:
dma_cb()
{
...
    if (ret < 0) {
        if (ide_handle_rw_error(s, -ret, ide_dma_cmd_to_retry(s))) {
            return;
        }
    }
...
}

static void ide_bmdma_pre_save(void *opaque)
{
...
    if (!(bm->status & BM_STATUS_DMAING) && bm->dma_cb) {
        bm->bus->error_status = ide_dma_cmd_to_retry(bmdma_active_if(bm));
    }
...
}

??

Thanks,

Paolo


Reply via email to