[vbox-dev] driver libahci and VirtualBox

Luigi De Simone luigi.desimone3 at gmail.com
Tue Jul 30 16:13:01 GMT 2013


Hi i'm studing how work ahci in detail. I have instrumented device 
driver code libahci.c, in particular the /ahci_qc_issue/ function in 
that way:

static unsigned int ahci_qc_issue(struct ata_queued_cmd *qc)
{
.
.
.
if (qc->tf.protocol == ATA_PROT_NCQ){
         printk(KERN_DEBUG "ISSUE[before SACT]: op1 = %lx, op2 =%08x, 
sact = %08x, cmd = %02x\n", 1<<qc->tag, 
port_mmio+PORT_SCR_ACT,readl(port_mmio+PORT_SCR_ACT),qc->tf.command & 0xff);

         writel(1 << qc->tag, port_mmio + PORT_SCR_ACT);

         printk(KERN_DEBUG "ISSUE[before SACT]: op1 = %lx, op2 =%08x, 
sact = %08x, cmd = %02x\n", 1<<qc->tag, 
port_mmio+PORT_SCR_ACT,readl(port_mmio+PORT_SCR_ACT),qc->tf.command & 0xff);

     }
.
.
.
printk(KERN_DEBUG "ISSUE[before CI]: op1 = %lx, op2 =%08x, ci = %08x, 
cmd = %02x\n",
                             1<<qc->tag, 
port_mmio+PORT_CMD_ISSUE,readl(port_mmio+PORT_CMD_ISSUE),qc->tf.command 
& 0xff);
     writel(1 << qc->tag, port_mmio + PORT_CMD_ISSUE);
     printk(KERN_DEBUG "ISSUE[before CI]: op1 = %lx, op2 =%08x, ci = 
%08x, cmd = %02x\n", 1<<qc->tag, 
port_mmio+PORT_CMD_ISSUE,readl(port_mmio+PORT_CMD_ISSUE),qc->tf.command 
& 0xff);
.
.
.
}

When running driver i observe strange behavior: when driver issues a NCQ 
command, SACT register is written with proper value, while CI register 
not. Why? Instead, when driver issues a NON-NCQ command CI register is 
written with proper value. To better explain i show a piece of log:

Jul 30 15:23:15 test kernel: [ 6673.022957] ISSUE[before SACT]: op1 = 1, 
op2 =f8408134, sact = 00000000, cmd = 61
Jul 30 15:23:15 test kernel: [ 6673.022957] ISSUE[before SACT]: op1 = 1, 
op2 =f8408134, sact = 00000001, cmd = 61
Jul 30 15:23:15 test kernel: [ 6673.022957] ISSUE[before CI]: op1 = 1, 
op2 =f8408138, ci = 00000000, cmd = 61
Jul 30 15:23:15 test kernel: [ 6673.022957] ISSUE[before CI]: op1 = 1, 
op2 =f8408138, ci = 00000000, cmd = 61
Jul 30 15:23:15 test kernel: [ 6673.022957] ISSUE[before CI]: op1 = 1, 
op2 =f8408138, ci = 00000000, cmd = e7
Jul 30 15:23:15 test kernel: [ 6673.022957] ISSUE[before CI]: op1 = 1, 
op2 =f8408138, ci = 00000001, cmd = e7

We note that when driver issues a FPDMA WRITE (61) we observe the anomaly.

My question is: is there some simplification on device implementation? 
Is there an explanation?

Thanks for helping.

Luigi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.virtualbox.org/pipermail/vbox-dev/attachments/20130730/c8c4c2c9/attachment.html>


More information about the vbox-dev mailing list