From: Thomas Huth <thuth@redhat.com>
To: Stephen Checkoway <stephen.checkoway@oberlin.edu>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Stephen Checkoway <s@pahtak.org>,
qemu-block@nongnu.org, Laurent Vivier <lvivier@redhat.com>,
Max Reitz <mreitz@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 01/10] block/pflash_cfi02: Add test for supported commands
Date: Tue, 9 Apr 2019 08:13:33 +0200 [thread overview]
Message-ID: <9409d9bf-c513-d82b-d438-9173fc582d7f@redhat.com> (raw)
In-Reply-To: <c03b48badb28e3c98bcbaed092b5c40e7284db08.1554755001.git.stephen.checkoway@oberlin.edu>
On 08/04/2019 22.55, Stephen Checkoway wrote:
> From: Stephen Checkoway <s@pahtak.org>
>
> Test the AMD command set for parallel flash chips. This test uses an
> ARM musicpal board with a pflash drive to test the following list of
> currently-supported commands.
> - Autoselect
> - CFI
> - Sector erase
> - Chip erase
> - Program
> - Unlock bypass
> - Reset
>
> Signed-off-by: Stephen Checkoway <stephen.checkoway@oberlin.edu>
> ---
> tests/Makefile.include | 2 +
> tests/pflash-cfi02-test.c | 224 ++++++++++++++++++++++++++++++++++++++
> 2 files changed, 226 insertions(+)
> create mode 100644 tests/pflash-cfi02-test.c
>
> diff --git a/tests/Makefile.include b/tests/Makefile.include
> index 6b904d7430..0a26eacce0 100644
> --- a/tests/Makefile.include
> +++ b/tests/Makefile.include
> @@ -263,6 +263,7 @@ check-qtest-arm-y += tests/m25p80-test$(EXESUF)
> check-qtest-arm-y += tests/test-arm-mptimer$(EXESUF)
> check-qtest-arm-y += tests/boot-serial-test$(EXESUF)
> check-qtest-arm-y += tests/hexloader-test$(EXESUF)
> +check-qtest-arm-$(CONFIG_PFLASH_CFI02) += tests/pflash-cfi02-test$(EXESUF)
>
> check-qtest-aarch64-y = tests/numa-test$(EXESUF)
> check-qtest-aarch64-y += tests/boot-serial-test$(EXESUF)
> @@ -773,6 +774,7 @@ tests/device-introspect-test$(EXESUF): tests/device-introspect-test.o
> tests/rtc-test$(EXESUF): tests/rtc-test.o
> tests/m48t59-test$(EXESUF): tests/m48t59-test.o
> tests/hexloader-test$(EXESUF): tests/hexloader-test.o
> +tests/pflash-cfi02$(EXESUF): tests/pflash-cfi02-test.o
> tests/endianness-test$(EXESUF): tests/endianness-test.o
> tests/prom-env-test$(EXESUF): tests/prom-env-test.o $(libqos-obj-y)
> tests/rtas-test$(EXESUF): tests/rtas-test.o $(libqos-spapr-obj-y)
> diff --git a/tests/pflash-cfi02-test.c b/tests/pflash-cfi02-test.c
> new file mode 100644
> index 0000000000..d349b2cc22
> --- /dev/null
> +++ b/tests/pflash-cfi02-test.c
> @@ -0,0 +1,224 @@
> +/*
> + * QTest testcase for parallel flash with AMD command set
> + *
> + * Copyright (c) 2018 Stephen Checkoway
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + */
> +
> +#include "qemu/osdep.h"
> +#include <err.h>
> +#include <unistd.h>
> +#include "libqtest.h"
> +
> +/*
> + * To test the pflash_cfi02 device, we run QEMU with the musicpal machine with
> + * a pflash drive. This enables us to test some flash configurations, but not
> + * all. In particular, we're limited to a 16-bit wide flash device.
> + */
> +
> +#define MP_FLASH_SIZE_MAX (32*1024*1024)
> +#define BASE_ADDR (0x100000000ULL-MP_FLASH_SIZE_MAX)
> +
> +#define FLASH_WIDTH 2
> +#define CFI_ADDR (FLASH_WIDTH*0x55)
> +#define UNLOCK0_ADDR (FLASH_WIDTH*0x5555)
> +#define UNLOCK1_ADDR (FLASH_WIDTH*0x2AAA)
> +
> +#define CFI_CMD 0x98
> +#define UNLOCK0_CMD 0xAA
> +#define UNLOCK1_CMD 0x55
> +#define AUTOSELECT_CMD 0x90
> +#define RESET_CMD 0xF0
> +#define PROGRAM_CMD 0xA0
> +#define SECTOR_ERASE_CMD 0x30
> +#define CHIP_ERASE_CMD 0x10
> +#define UNLOCK_BYPASS_CMD 0x20
> +#define UNLOCK_BYPASS_RESET_CMD 0x00
> +
> +static char image_path[] = "/tmp/qtest.XXXXXX";
> +
> +static inline void flash_write(uint64_t byte_addr, uint16_t data)
> +{
> + qtest_writew(global_qtest, BASE_ADDR + byte_addr, data);
> +}
> +
> +static inline uint16_t flash_read(uint64_t byte_addr)
> +{
> + return qtest_readw(global_qtest, BASE_ADDR + byte_addr);
> +}
We'd like to get rid of global_qtest in the long run (since it is
causing trouble for tests that run multiple instances of QEMU in
parallel, e.g. migration tests)... so if it is feasible, please don't
use it in new code anymore. Try to use a local variable in the function
that call qtest_initf() and pass the test state around via a parameter
to the functions that need it.
Thanks,
Thomas
next prev parent reply other threads:[~2019-04-09 6:13 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-08 20:55 [Qemu-devel] [PATCH 00/10] block/pflash_cfi02: Implement missing AMD pflash functionality Stephen Checkoway
2019-04-08 20:55 ` Stephen Checkoway
2019-04-08 20:55 ` [Qemu-devel] [PATCH 01/10] block/pflash_cfi02: Add test for supported commands Stephen Checkoway
2019-04-08 20:55 ` Stephen Checkoway
2019-04-09 6:13 ` Thomas Huth [this message]
2019-04-09 6:13 ` Thomas Huth
2019-04-09 7:45 ` Markus Armbruster
2019-04-09 7:45 ` Markus Armbruster
2019-04-09 8:16 ` Thomas Huth
2019-04-09 8:16 ` Thomas Huth
2019-04-09 8:35 ` Markus Armbruster
2019-04-09 8:35 ` Markus Armbruster
2019-04-09 8:40 ` Thomas Huth
2019-04-09 8:40 ` Thomas Huth
2019-04-09 8:50 ` Markus Armbruster
2019-04-09 8:50 ` Markus Armbruster
2019-04-09 15:37 ` Stephen Checkoway
2019-04-09 15:37 ` Stephen Checkoway
2019-04-10 14:39 ` Thomas Huth
2019-04-10 14:39 ` Thomas Huth
2019-04-08 20:55 ` [Qemu-devel] [PATCH 02/10] block/pflash_cfi02: Refactor, NFC intended Stephen Checkoway
2019-04-08 20:55 ` Stephen Checkoway
2019-04-08 20:55 ` [Qemu-devel] [PATCH 03/10] block/pflash_cfi02: Fix command address comparison Stephen Checkoway
2019-04-08 20:55 ` Stephen Checkoway
2019-04-08 20:55 ` [Qemu-devel] [PATCH 04/10] block/pflash_cfi02: Implement intereleaved flash devices Stephen Checkoway
2019-04-08 20:55 ` Stephen Checkoway
2019-04-08 20:55 ` [Qemu-devel] [PATCH 05/10] block/pflash_cfi02: Implement nonuniform sector sizes Stephen Checkoway
2019-04-08 20:55 ` Stephen Checkoway
2019-04-08 20:55 ` [Qemu-devel] [PATCH 06/10] block/pflash_cfi02: Fix CFI in autoselect mode Stephen Checkoway
2019-04-08 20:55 ` Stephen Checkoway
2019-04-08 20:55 ` [Qemu-devel] [PATCH 07/10] block/pflash_cfi02: Fix reset command not ignored during erase Stephen Checkoway
2019-04-08 20:55 ` Stephen Checkoway
2019-04-08 20:55 ` [Qemu-devel] [PATCH 08/10] block/pflash_cfi02: Implement multi-sector erase Stephen Checkoway
2019-04-08 20:55 ` Stephen Checkoway
2019-04-08 20:55 ` [Qemu-devel] [PATCH 09/10] block/pflash_cfi02: Implement erase suspend/resume Stephen Checkoway
2019-04-08 20:55 ` Stephen Checkoway
2019-04-08 20:55 ` [Qemu-devel] [PATCH 10/10] block/pflash_cfi02: Use the chip erase time specified in the CFI table Stephen Checkoway
2019-04-08 20:55 ` Stephen Checkoway
2019-04-08 21:11 ` [Qemu-devel] [PATCH 00/10] block/pflash_cfi02: Implement missing AMD pflash functionality no-reply
2019-04-08 21:11 ` no-reply
2019-04-09 10:34 ` Philippe Mathieu-Daudé
2019-04-09 10:34 ` Philippe Mathieu-Daudé
2019-04-09 15:55 ` Stephen Checkoway
2019-04-09 15:55 ` Stephen Checkoway
2019-04-09 16:15 ` Philippe Mathieu-Daudé
2019-04-09 16:15 ` Philippe Mathieu-Daudé
2019-04-09 18:00 ` Stephen Checkoway
2019-04-09 18:00 ` Stephen Checkoway
2019-04-18 21:00 ` Stephen Checkoway
2019-04-18 21:00 ` Stephen Checkoway
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=9409d9bf-c513-d82b-d438-9173fc582d7f@redhat.com \
--to=thuth@redhat.com \
--cc=kwolf@redhat.com \
--cc=lvivier@redhat.com \
--cc=mreitz@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=s@pahtak.org \
--cc=stephen.checkoway@oberlin.edu \
/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).