Received: from eggs.gnu.org ([208.118.235.92]:53348) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uapu5-0007dk-8Y for qemu-devel@nongnu.org; Fri, 10 May 2013 12:10:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uapu2-0006JV-HH for qemu-devel@nongnu.org; Fri, 10 May 2013 12:10:41 -0400 Received: from mail-lb0-f177.google.com ([209.85.217.177]:46544) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uapu2-0006JR-9P for qemu-devel@nongnu.org; Fri, 10 May 2013 12:10:38 -0400 Received: by mail-lb0-f177.google.com with SMTP id 13so4393238lba.36 for ; Fri, 10 May 2013 09:10:37 -0700 (PDT) From: Igor Mitsyanko Date: Fri, 10 May 2013 20:10:18 +0400 Message-Id: <1368202225-45798-1-git-send-email-i.mitsyanko@gmail.com> Subject: [Qemu-devel] [RFC 0/7] Convert SD card model to AIO List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, aliguori@us.ibm.com, i.mitsyanko@gmail.com, sw@weilnetz.de, peter.crosthwaite@xilinx.com, blauwirbel@gmail.com, paul@codesourcery.com, stefanha@redhat.com, pbonzini@redhat.com, afaerber@suse.de This is an initial attempt to change our SD card model to use asynchronious input/output API instead of synchronious one. This will require converting of every user also. Right now I've converted only PL181 model, and I'll wait for some feedback on taken approach before I'll continue with other users. New async SD interface is built on two callbacks: 1 Callback which models arrival of start bit on DAT line from card (start bit) 2 Callback modeling deasserting of DAT0 line by card when it has finished programming data (data busy end) This is based on SD card specification. Start bit is issued for every new block of data coming from card. DAT0 line is kept low by card to signal busy state, while data block is being programmed by card and it can't receive new data. Furthermore, I decided to drop data buffering on SD controller side. We already have two buffers in SD card model, no need to have another one in controller model. We can avoid intermediate copying from card's buffer to controller's buffer, and read/write directly from card. Tested by running this Fedora image https://fedoraproject.org/wiki/Architectures/ARM/F18/Versatile_Express on versatile board. Igor Mitsyanko (7): sd.c: introduce AIO related members in SD state sd.c: introduce variable for trekking valid data sd.c: introduce "start bit" and "busy deasserted" callbacks sd.c: use callbacks as a flag to use async IO sd.c: introduce async read operation sd.c: introduce async write interface pl181.c: convert to async IO SD card interface hw/sd/omap_mmc.c | 6 +- hw/sd/pl181.c | 302 +++++++++++++++++++++++++++++++++------------------- hw/sd/pxa2xx_mmci.c | 2 +- hw/sd/sd.c | 272 ++++++++++++++++++++++++++++++++++++++++++---- hw/sd/sdhci.c | 4 +- include/hw/sd.h | 3 +- 6 files changed, 449 insertions(+), 140 deletions(-) -- 1.8.1.4