From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JBb4J-0001rj-Ga for qemu-devel@nongnu.org; Sun, 06 Jan 2008 14:21:59 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JBb4I-0001r5-7p for qemu-devel@nongnu.org; Sun, 06 Jan 2008 14:21:58 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JBb4H-0001qs-LT for qemu-devel@nongnu.org; Sun, 06 Jan 2008 14:21:57 -0500 Received: from ecfrec.frec.bull.fr ([129.183.4.8]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JBb4H-0003Z2-6H for qemu-devel@nongnu.org; Sun, 06 Jan 2008 14:21:57 -0500 Received: from localhost (localhost [127.0.0.1]) by ecfrec.frec.bull.fr (Postfix) with ESMTP id EC96819DEA3 for ; Sun, 6 Jan 2008 20:22:01 +0100 (CET) Received: from ecfrec.frec.bull.fr ([127.0.0.1]) by localhost (ecfrec.frec.bull.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 32287-05 for ; Sun, 6 Jan 2008 20:21:57 +0100 (CET) Received: from ecn002.frec.bull.fr (ecn002.frec.bull.fr [129.183.4.6]) by ecfrec.frec.bull.fr (Postfix) with ESMTP id 8705219DE97 for ; Sun, 6 Jan 2008 20:21:57 +0100 (CET) Subject: Re: [Qemu-devel] [PATCH] SCSI passthrough: DVD support From: Laurent Vivier In-Reply-To: <47812257.5030408@bellard.org> References: <47812257.5030408@bellard.org> Date: Sun, 06 Jan 2008 20:22:17 +0100 Message-Id: <1199647337.15700.12.camel@frecb07144> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-ie4TYW5iZd2yS1PWbdZz" Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org --=-ie4TYW5iZd2yS1PWbdZz Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Le dimanche 06 janvier 2008 =C3=A0 19:47 +0100, Fabrice Bellard a =C3=A9cri= t : > Can you explain why you use the block layer (block-raw-posix.c) to send > your low level SCSI commands ?=20 only because it uses asynchrones AIO and I don't want to rewrite block-raw-posix.c for this special case. > I suggest to remove your patches to As you want... > block-raw-posix.c and to implement all the SCSI passthough in > scsi-generic.c. and I'll do as you want. > Regards, >=20 > Fabrice. Regards, Laurent > Laurent Vivier wrote: > > This patch allows to use SCSI passthrough to read movies from DVD. > > It has been tested with PowerDVD and XP. > >=20 > > It also introduces some comments in block-raw-posix.c to explain behavi= or of > > negative offset and negative nb_sectors. > > It restores original value of aio_num and aio_threads. > >=20 > > Laurent > > --- > > block-raw-posix.c | 7 +++++-- > > hw/scsi-generic.c | 14 ++++++++++++-- > > 2 files changed, 17 insertions(+), 4 deletions(-) > >=20 > > Index: qemu/hw/scsi-generic.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > --- qemu.orig/hw/scsi-generic.c 2008-01-06 18:43:44.000000000 +0100 > > +++ qemu/hw/scsi-generic.c 2008-01-06 18:55:46.000000000 +0100 > > @@ -44,9 +44,12 @@ do { fprintf(stderr, "scsi-generic: " fm > > #include > > #include > > =20 > > +#define BLANK 0xa1 > > +#define SEND_KEY 0xa3 > > +#define REPORT_KEY 0xa4 > > #define LOAD_UNLOAD 0xa6 > > +#define READ_DVD_STRUCTURE 0xad > > #define SET_CD_SPEED 0xbb > > -#define BLANK 0xa1 > > =20 > > #define SCSI_CMD_BUF_SIZE 16 > > #define SCSI_SENSE_BUF_SIZE 32 > > @@ -166,7 +169,7 @@ static void scsi_command_complete(void * > > sense =3D s->sensebuf[2] & 0x0f; > > } > > =20 > > - DPRINTF("Command complete 0x%p tag=3D0x%x sense=3D%d\n", r, r->tag= , sense); > > + DPRINTF("Command complete %p tag=3D0x%x sense=3D%d\n", r, r->tag, = sense); > > tag =3D r->tag; > > scsi_remove_request(r); > > s->completion(s->opaque, SCSI_REASON_DONE, tag, sense); > > @@ -427,6 +430,12 @@ static int scsi_length(uint8_t *cmd, int > > case READ_12: > > *len *=3D blocksize; > > break; > > + case READ_DVD_STRUCTURE: > > + case SEND_KEY: > > + case REPORT_KEY: > > + *len &=3D 0xffff; > > + break; > > + > > } > > return 0; > > } > > @@ -464,6 +473,7 @@ static int is_write(int command) > > case MEDIUM_SCAN: > > case SEND_VOLUME_TAG: > > case WRITE_LONG_2: > > + case SEND_KEY: > > return 1; > > } > > return 0; > > Index: qemu/block-raw-posix.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > --- qemu.orig/block-raw-posix.c 2008-01-06 18:43:44.000000000 +0100 > > +++ qemu/block-raw-posix.c 2008-01-06 18:45:38.000000000 +0100 > > @@ -151,6 +151,8 @@ static int raw_pread(BlockDriverState *b > > if (ret < 0) > > return ret; > > =20 > > + /* if offset < 0, we don't make lseek() */ > > + > > if (offset >=3D 0 && lseek(s->fd, offset, SEEK_SET) =3D=3D (off_t)= -1) { > > ++(s->lseek_err_cnt); > > if(s->lseek_err_cnt <=3D 10) { > > @@ -276,8 +278,8 @@ void qemu_aio_init(void) > > seems to fix the problem. */ > > struct aioinit ai; > > memset(&ai, 0, sizeof(ai)); > > - ai.aio_threads =3D 16; > > - ai.aio_num =3D 16; > > + ai.aio_threads =3D 1; > > + ai.aio_num =3D 1; > > ai.aio_idle_time =3D 365 * 100000; > > aio_init(&ai); > > } > > @@ -387,6 +389,7 @@ static RawAIOCB *raw_aio_setup(BlockDriv > > acb->aiocb.aio_sigevent.sigev_signo =3D aio_sig_num; > > acb->aiocb.aio_sigevent.sigev_notify =3D SIGEV_SIGNAL; > > acb->aiocb.aio_buf =3D buf; > > + /* if nb_sectors < 0, -nb_sectors is a number of bytes */ > > if (nb_sectors < 0) > > acb->aiocb.aio_nbytes =3D -nb_sectors; > > else > >=20 > >=20 > >=20 > >=20 >=20 >=20 >=20 --=20 ----------------- Laurent.Vivier@bull.net ------------------ "La perfection est atteinte non quand il ne reste rien =C3=A0 ajouter mais quand il ne reste rien =C3=A0 enlever." Saint Exup=C3=A9ry --=-ie4TYW5iZd2yS1PWbdZz Content-Type: application/pgp-signature; name=signature.asc Content-Description: Ceci est une partie de message =?ISO-8859-1?Q?num=E9riquement?= =?ISO-8859-1?Q?_sign=E9e?= -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQBHgSpp9Kffa9pFVzwRAmAFAJ44DgQungmy8Y72PspKkXlqWrX6kwCfaiCd XBSO0rwO6spyLRHQOrMd8NQ= =2jLj -----END PGP SIGNATURE----- --=-ie4TYW5iZd2yS1PWbdZz--