qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: John Snow <jsnow@redhat.com>
Cc: pbonzini@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com,
	mst@redhat.com
Subject: Re: [Qemu-devel] [PATCH 24/28] ahci: Add test_pci_spec to ahci-test.
Date: Thu, 31 Jul 2014 14:19:02 +0100	[thread overview]
Message-ID: <20140731131902.GA25929@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <1404757089-4836-25-git-send-email-jsnow@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 3893 bytes --]

On Mon, Jul 07, 2014 at 02:18:05PM -0400, John Snow wrote:
> +/*** Macro Utilities ***/
> +#define bitany(data, mask) (((data) & (mask)) != 0)
> +#define bitset(data, mask) (((data) & (mask)) == (mask))
> +#define bitclr(data, mask) (((data) & (mask)) == 0)

Unused, please remove.

> +#ifdef AHCI_13_STRICT

Please drop the #ifdef.  #ifdefs mean dead code that is not being
compiled or tested.  Just decide which case we should take and keep that
one.

> +    /* AHCI 1.3 specifies that at-boot, the RID should reset to 0x00. */
> +    assert_bit_clear(datal, 0xFF);
> +#else
> +    if (datal & 0xFF) {
> +        g_test_message("WARN: Revision ID (%u) != 0", datal & 0xFF);
> +    }
> +#endif

Tests should not produce output.  Either this is a failure that needs to
be fixed in QEMU, or it is not a failure and we shouldn't produce
output.

The rationale is that producing "warning" output means we now need to
diff the make check output to see when it changes.  In practice no one
will pay attention and warnings will build up.

> +
> +    /* BCC *must* equal 0x01. */
> +    g_assert(PCI_BCC(datal) == 0x01);

g_assert_cmphex() would make the error message more useful by including
the incorrect value.  The same applies elsewhere in this patch.

> +#ifdef AHCI_13_STRICT
> +    /* AHCI 1.3, Section 2.1.14 -- CAP must point to PMCAP. */
> +    g_assert((data & 0xFF) == PCI_CAP_ID_PM);
> +#elif defined Q35
> +    /* Intel ICH9 Family Datasheet 14.1.19 p.550 */
> +    if ((data & 0xFF) != PCI_CAP_ID_MSI) {
> +        g_test_message("WARN: 1st Capability ID (%u) is not MSICAP (%u)",
> +                       data & 0xFF, PCI_CAP_ID_MSI);
> +    }
> +    /*g_assert((data & 0xFF) == PCI_CAP_ID_MSI);*/
> +#else
> +    if ((data & 0xFF) != PCI_CAP_ID_PM) {
> +        g_test_message("WARN: 1st Capability ID (%u) is not PMCAP (%u)",
> +                       data & 0xFF, PCI_CAP_ID_PM);
> +    }
> +#endif

Since the test hardcodes the q35 machine type when calling
qtest_start(), I guess the Q35 case always applies.

Please remove the #ifdef and warning (either it's a failure that needs
to be fixed, or it's not a failure).

> +static void ahci_test_pci_caps(QPCIDevice *ahci, uint16_t header,
> +                               uint8_t offset)
> +{
> +    uint8_t cid = header & 0xFF;
> +    uint8_t next = header >> 8;
> +
> +    g_test_message("CID: %02x; next: %02x", cid, next);

Debugging output that should be removed?

> +
> +    switch (cid) {
> +    case PCI_CAP_ID_PM:
> +        ahci_test_pmcap(ahci, offset);
> +        break;
> +    case PCI_CAP_ID_MSI:
> +        ahci_test_msicap(ahci, offset);
> +        break;
> +    case PCI_CAP_ID_SATA:
> +        ahci_test_satacap(ahci, offset);
> +        break;
> +
> +    default:
> +        g_test_message("Unknown CAP 0x%02x", cid);

This should be a failure.  If a new capability is added, the test should
be extended for that capability.

> +static void ahci_test_satacap(QPCIDevice *ahci, uint8_t offset)
> +{
> +    uint16_t dataw;
> +    uint32_t datal;
> +
> +    g_test_message("Verifying SATACAP");

Debug message that should be removed?

> +static void ahci_test_msicap(QPCIDevice *ahci, uint8_t offset)
> +{
> +    uint16_t dataw;
> +    uint32_t datal;
> +
> +    g_test_message("Verifying MSICAP");

Debug message that should be removed?

> +    if (dataw & PCI_MSI_FLAGS_64BIT) {
> +        g_test_message("MSICAP is 64bit");

Debug message that should be removed?

> +        g_assert(qpci_config_readl(ahci, offset + PCI_MSI_ADDRESS_HI) == 0x00);
> +        g_assert(qpci_config_readw(ahci, offset + PCI_MSI_DATA_64) == 0x00);
> +    } else {
> +        g_test_message("MSICAP is 32bit");

Debug message that should be removed?

> +static void ahci_test_pmcap(QPCIDevice *ahci, uint8_t offset)
> +{
> +    uint16_t dataw;
> +
> +    g_test_message("Verifying PMCAP");

Debug message that should be removed?

[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]

  reply	other threads:[~2014-07-31 13:19 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-07 18:17 [Qemu-devel] [PATCH 00/28] ahci refactoring to support ahci-test suite John Snow
2014-07-07 18:17 ` [Qemu-devel] [PATCH 01/28] blkdebug: report errors on flush too John Snow
2014-07-17 13:28   ` Stefan Hajnoczi
2014-07-07 18:17 ` [Qemu-devel] [PATCH 02/28] libqtest: add QTEST_LOG for debugging qtest testcases John Snow
2014-07-17 13:32   ` Stefan Hajnoczi
2014-07-07 18:17 ` [Qemu-devel] [PATCH 03/28] ide-test: add test for werror=stop John Snow
2014-07-31 10:58   ` Stefan Hajnoczi
2014-07-31 22:06     ` John Snow
2014-08-01  7:13       ` Markus Armbruster
2014-07-07 18:17 ` [Qemu-devel] [PATCH 04/28] ide: stash aiocb for flushes John Snow
2014-07-31 11:53   ` Stefan Hajnoczi
2014-07-07 18:17 ` [Qemu-devel] [PATCH 05/28] ide: simplify reset callbacks John Snow
2014-07-31 11:54   ` Stefan Hajnoczi
2014-07-07 18:17 ` [Qemu-devel] [PATCH 06/28] ide: simplify set_inactive callbacks John Snow
2014-07-31 11:54   ` Stefan Hajnoczi
2014-07-07 18:17 ` [Qemu-devel] [PATCH 07/28] ide: simplify async_cmd_done callbacks John Snow
2014-07-31 11:54   ` Stefan Hajnoczi
2014-07-07 18:17 ` [Qemu-devel] [PATCH 08/28] ide: simplify start_transfer callbacks John Snow
2014-07-31 11:55   ` Stefan Hajnoczi
2014-07-07 18:17 ` [Qemu-devel] [PATCH 09/28] ide: wrap start_dma callback John Snow
2014-07-31 11:55   ` Stefan Hajnoczi
2014-07-07 18:17 ` [Qemu-devel] [PATCH 10/28] ide: remove wrong setting of BM_STATUS_INT John Snow
2014-07-31 11:56   ` Stefan Hajnoczi
2014-07-07 18:17 ` [Qemu-devel] [PATCH 11/28] ide: fold add_status callback into set_inactive John Snow
2014-07-31 11:57   ` Stefan Hajnoczi
2014-07-07 18:17 ` [Qemu-devel] [PATCH 12/28] ide: move BM_STATUS bits to pci.[ch] John Snow
2014-07-31 11:57   ` Stefan Hajnoczi
2014-07-07 18:17 ` [Qemu-devel] [PATCH 13/28] ide: move retry constants out of BM_STATUS_* namespace John Snow
2014-07-31 12:06   ` Stefan Hajnoczi
2014-07-07 18:17 ` [Qemu-devel] [PATCH 14/28] ahci: remove duplicate PORT_IRQ_* constants John Snow
2014-07-31 12:12   ` Stefan Hajnoczi
2014-07-07 18:17 ` [Qemu-devel] [PATCH 15/28] ide: stop PIO transfer on errors John Snow
2014-07-31 12:23   ` Stefan Hajnoczi
2014-07-31 23:32     ` John Snow
2014-08-01  7:15     ` Paolo Bonzini
2014-07-07 18:17 ` [Qemu-devel] [PATCH 16/28] ide: make all commands go through cmd_done John Snow
2014-07-31 12:25   ` Stefan Hajnoczi
2014-07-07 18:17 ` [Qemu-devel] [PATCH 17/28] ahci: construct PIO Setup FIS for PIO commands John Snow
2014-07-31 12:32   ` Stefan Hajnoczi
2014-07-07 18:17 ` [Qemu-devel] [PATCH 18/28] q35: Enable the ioapic device to be seen by qtest John Snow
2014-07-31 12:33   ` Stefan Hajnoczi
2014-07-07 18:18 ` [Qemu-devel] [PATCH 19/28] qtest: Adding qtest_memset and qmemset John Snow
2014-07-31 12:37   ` Stefan Hajnoczi
2014-07-07 18:18 ` [Qemu-devel] [PATCH 20/28] libqos: Correct memory leak John Snow
2014-07-31 12:38   ` Stefan Hajnoczi
2014-07-07 18:18 ` [Qemu-devel] [PATCH 21/28] libqtest: Correct small " John Snow
2014-07-31 12:39   ` Stefan Hajnoczi
2014-07-07 18:18 ` [Qemu-devel] [PATCH 22/28] libqos: Fixes a " John Snow
2014-07-31 12:40   ` Stefan Hajnoczi
2014-07-07 18:18 ` [Qemu-devel] [PATCH 23/28] ahci: Adding basic functionality qtest John Snow
2014-07-31 12:54   ` Stefan Hajnoczi
2014-07-07 18:18 ` [Qemu-devel] [PATCH 24/28] ahci: Add test_pci_spec to ahci-test John Snow
2014-07-31 13:19   ` Stefan Hajnoczi [this message]
2014-07-31 17:42     ` John Snow
2014-08-01 11:14       ` Stefan Hajnoczi
2014-07-07 18:18 ` [Qemu-devel] [PATCH 25/28] ahci: add test_pci_enable " John Snow
2014-07-31 13:36   ` Stefan Hajnoczi
2014-07-07 18:18 ` [Qemu-devel] [PATCH 26/28] ahci: Add test_hba_spec " John Snow
2014-07-31 14:01   ` Stefan Hajnoczi
2014-07-31 20:03     ` John Snow
2014-08-01 23:27     ` John Snow
2014-08-04  9:51       ` Stefan Hajnoczi
2014-07-07 18:18 ` [Qemu-devel] [PATCH 27/28] ahci: Add test_hba_enable " John Snow
2014-07-31 15:24   ` Stefan Hajnoczi
2014-07-07 18:18 ` [Qemu-devel] [PATCH 28/28] ahci: Add test_identify case " John Snow
2014-07-31 15:28   ` Stefan Hajnoczi

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=20140731131902.GA25929@stefanha-thinkpad.redhat.com \
    --to=stefanha@gmail.com \
    --cc=jsnow@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /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).