qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: John Snow <jsnow@redhat.com>
Cc: qemu-block@nongnu.org, hpoussin@reactos.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2 3/3] ahci-test: test atapi read_cd with bcl, nb_sectors = 0
Date: Wed, 2 Nov 2016 14:33:05 +0100	[thread overview]
Message-ID: <20161102133305.GG6182@noname.redhat.com> (raw)
In-Reply-To: <1477970211-25754-4-git-send-email-jsnow@redhat.com>

Am 01.11.2016 um 04:16 hat John Snow geschrieben:
> Commit 9ef2e93f introduced the concept of tagging ATAPI commands as
> NONDATA, but this introduced a regression for certain commands better
> described as CONDDATA. read_cd is such a command that both requires
> a non-zero BCL if a transfer size is set, but is perfectly content to
> accept a zero BCL if the transfer size is 0.
> 
> This test adds a regression test for the case where BCL and nb_sectors
> are both 0.
> 
> Flesh out the CDROM tests by:
> 
> (1) Allowing the test to specify a BCL
> (2) Allowing the buffer comparison test to compare a 0-size buffer
> (3) Fix the BCL specification in libqos (It is LE, not BE)
> (4) Add a nice human-readable message for future SCSI command additions
> 
> Signed-off-by: John Snow <jsnow@redhat.com>

> diff --git a/tests/libqos/ahci.c b/tests/libqos/ahci.c
> index 5180d65..15fa888 100644
> --- a/tests/libqos/ahci.c
> +++ b/tests/libqos/ahci.c
> @@ -864,16 +865,12 @@ AHCICommand *ahci_command_create(uint8_t command_name)
>      return cmd;
>  }
>  
> -AHCICommand *ahci_atapi_command_create(uint8_t scsi_cmd)
> +AHCICommand *ahci_atapi_command_create(uint8_t scsi_cmd, uint16_t bcl)
>  {
>      AHCICommand *cmd = ahci_command_create(CMD_PACKET);
>      cmd->atapi_cmd = g_malloc0(16);
>      cmd->atapi_cmd[0] = scsi_cmd;
> -    /* ATAPI needs a PIO transfer chunk size set inside of the LBA registers.
> -     * The block/sector size is a natural default. */
> -    cmd->fis.lba_lo[1] = ATAPI_SECTOR_SIZE >> 8 & 0xFF;
> -    cmd->fis.lba_lo[2] = ATAPI_SECTOR_SIZE & 0xFF;
> -
> +    stw_le_p(&cmd->fis.lba_lo[1], bcl);
>      return cmd;
>  }

If I'm not mistaken, you're changing the endianness here, which seems
to be a silent bug fix.

For some reason the test passes both ways. Does the actual value even
matter with AHCI, as long as it's non-zero? Do we end up with the same
result with BCL=0x0200 and BCL=0x0002, just that we split it into some
more iterations for the latter (or deeper recursion, actually)?

Kevin

  reply	other threads:[~2016-11-02 13:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-01  3:16 [Qemu-devel] [PATCH v2 0/3] atapi: classify read_cd as conditionally returning data John Snow
2016-11-01  3:16 ` [Qemu-devel] [PATCH v2 1/3] " John Snow
2016-11-01  3:16 ` [Qemu-devel] [PATCH v2 2/3] ahci-test: Create smaller test ISO images John Snow
2016-11-01  3:16 ` [Qemu-devel] [PATCH v2 3/3] ahci-test: test atapi read_cd with bcl, nb_sectors = 0 John Snow
2016-11-02 13:33   ` Kevin Wolf [this message]
2016-11-02 15:01     ` John Snow
2016-11-02 15:56       ` Kevin Wolf
2016-11-01  3:23 ` [Qemu-devel] [PATCH v2 0/3] atapi: classify read_cd as conditionally returning data no-reply
2016-11-02 13:36 ` Kevin Wolf
2016-11-02 18:31 ` John Snow
2016-11-02 19:49 ` Hervé Poussineau
2016-11-02 20:20   ` John Snow

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=20161102133305.GG6182@noname.redhat.com \
    --to=kwolf@redhat.com \
    --cc=hpoussin@reactos.org \
    --cc=jsnow@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).