From: "Cédric Le Goater" <clg@kaod.org>
To: Iris Chen <irischenlj@fb.com>
Cc: <pdel@fb.com>, <qemu-devel@nongnu.org>, <qemu-arm@nongnu.org>,
<patrick@stwcx.xyz>, <alistair@alistair23.me>, <kwolf@redhat.com>,
<hreitz@redhat.com>, <peter.maydell@linaro.org>,
<andrew@aj.id.au>, <joel@jms.id.au>, <thuth@redhat.com>,
<lvivier@redhat.com>, <pbonzini@redhat.com>,
<qemu-block@nongnu.org>, <dz4list@gmail.com>
Subject: Re: [PATCH 1/1] hw: m25p80: fixing individual test failure when tests are running in isolation
Date: Wed, 22 Jun 2022 09:37:49 +0200 [thread overview]
Message-ID: <e5cdcb1d-fdf7-6a82-959e-7dcb28145544@kaod.org> (raw)
In-Reply-To: <20220617230903.2542638-1-irischenlj@fb.com>
On 6/18/22 01:09, Iris Chen wrote:
> Signed-off-by: Iris Chen <irischenlj@fb.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Thanks,
C.
> ---
> tests/qtest/aspeed_smc-test.c | 74 +++++++++++++++++++++++++++++------
> 1 file changed, 63 insertions(+), 11 deletions(-)
>
> diff --git a/tests/qtest/aspeed_smc-test.c b/tests/qtest/aspeed_smc-test.c
> index ec233315e6..b1e682db65 100644
> --- a/tests/qtest/aspeed_smc-test.c
> +++ b/tests/qtest/aspeed_smc-test.c
> @@ -135,6 +135,9 @@ static void flash_reset(void)
> spi_ctrl_start_user();
> writeb(ASPEED_FLASH_BASE, RESET_ENABLE);
> writeb(ASPEED_FLASH_BASE, RESET_MEMORY);
> + writeb(ASPEED_FLASH_BASE, WREN);
> + writeb(ASPEED_FLASH_BASE, BULK_ERASE);
> + writeb(ASPEED_FLASH_BASE, WRDI);
> spi_ctrl_stop_user();
>
> spi_conf_remove(CONF_ENABLE_W0);
> @@ -195,21 +198,41 @@ static void test_erase_sector(void)
>
> spi_conf(CONF_ENABLE_W0);
>
> + /*
> + * Previous page should be full of 0xffs after backend is
> + * initialized
> + */
> + read_page(some_page_addr - FLASH_PAGE_SIZE, page);
> + for (i = 0; i < FLASH_PAGE_SIZE / 4; i++) {
> + g_assert_cmphex(page[i], ==, 0xffffffff);
> + }
> +
> spi_ctrl_start_user();
> - writeb(ASPEED_FLASH_BASE, WREN);
> writeb(ASPEED_FLASH_BASE, EN_4BYTE_ADDR);
> - writeb(ASPEED_FLASH_BASE, ERASE_SECTOR);
> + writeb(ASPEED_FLASH_BASE, WREN);
> + writeb(ASPEED_FLASH_BASE, PP);
> writel(ASPEED_FLASH_BASE, make_be32(some_page_addr));
> +
> + /* Fill the page with its own addresses */
> + for (i = 0; i < FLASH_PAGE_SIZE / 4; i++) {
> + writel(ASPEED_FLASH_BASE, make_be32(some_page_addr + i * 4));
> + }
> spi_ctrl_stop_user();
>
> - /* Previous page should be full of zeroes as backend is not
> - * initialized */
> - read_page(some_page_addr - FLASH_PAGE_SIZE, page);
> + /* Check the page is correctly written */
> + read_page(some_page_addr, page);
> for (i = 0; i < FLASH_PAGE_SIZE / 4; i++) {
> - g_assert_cmphex(page[i], ==, 0x0);
> + g_assert_cmphex(page[i], ==, some_page_addr + i * 4);
> }
>
> - /* But this one was erased */
> + spi_ctrl_start_user();
> + writeb(ASPEED_FLASH_BASE, WREN);
> + writeb(ASPEED_FLASH_BASE, EN_4BYTE_ADDR);
> + writeb(ASPEED_FLASH_BASE, ERASE_SECTOR);
> + writel(ASPEED_FLASH_BASE, make_be32(some_page_addr));
> + spi_ctrl_stop_user();
> +
> + /* Check the page is erased */
> read_page(some_page_addr, page);
> for (i = 0; i < FLASH_PAGE_SIZE / 4; i++) {
> g_assert_cmphex(page[i], ==, 0xffffffff);
> @@ -226,11 +249,31 @@ static void test_erase_all(void)
>
> spi_conf(CONF_ENABLE_W0);
>
> - /* Check some random page. Should be full of zeroes as backend is
> - * not initialized */
> + /*
> + * Previous page should be full of 0xffs after backend is
> + * initialized
> + */
> + read_page(some_page_addr - FLASH_PAGE_SIZE, page);
> + for (i = 0; i < FLASH_PAGE_SIZE / 4; i++) {
> + g_assert_cmphex(page[i], ==, 0xffffffff);
> + }
> +
> + spi_ctrl_start_user();
> + writeb(ASPEED_FLASH_BASE, EN_4BYTE_ADDR);
> + writeb(ASPEED_FLASH_BASE, WREN);
> + writeb(ASPEED_FLASH_BASE, PP);
> + writel(ASPEED_FLASH_BASE, make_be32(some_page_addr));
> +
> + /* Fill the page with its own addresses */
> + for (i = 0; i < FLASH_PAGE_SIZE / 4; i++) {
> + writel(ASPEED_FLASH_BASE, make_be32(some_page_addr + i * 4));
> + }
> + spi_ctrl_stop_user();
> +
> + /* Check the page is correctly written */
> read_page(some_page_addr, page);
> for (i = 0; i < FLASH_PAGE_SIZE / 4; i++) {
> - g_assert_cmphex(page[i], ==, 0x0);
> + g_assert_cmphex(page[i], ==, some_page_addr + i * 4);
> }
>
> spi_ctrl_start_user();
> @@ -238,7 +281,7 @@ static void test_erase_all(void)
> writeb(ASPEED_FLASH_BASE, BULK_ERASE);
> spi_ctrl_stop_user();
>
> - /* Recheck that some random page */
> + /* Check the page is erased */
> read_page(some_page_addr, page);
> for (i = 0; i < FLASH_PAGE_SIZE / 4; i++) {
> g_assert_cmphex(page[i], ==, 0xffffffff);
> @@ -299,6 +342,14 @@ static void test_read_page_mem(void)
> spi_conf(CONF_ENABLE_W0);
> spi_ctrl_start_user();
> writeb(ASPEED_FLASH_BASE, EN_4BYTE_ADDR);
> + writeb(ASPEED_FLASH_BASE, WREN);
> + writeb(ASPEED_FLASH_BASE, PP);
> + writel(ASPEED_FLASH_BASE, make_be32(my_page_addr));
> +
> + /* Fill the page with its own addresses */
> + for (i = 0; i < FLASH_PAGE_SIZE / 4; i++) {
> + writel(ASPEED_FLASH_BASE, make_be32(my_page_addr + i * 4));
> + }
> spi_ctrl_stop_user();
> spi_conf_remove(CONF_ENABLE_W0);
>
> @@ -417,6 +468,7 @@ int main(int argc, char **argv)
> qtest_add_func("/ast2400/smc/write_page_mem", test_write_page_mem);
> qtest_add_func("/ast2400/smc/read_status_reg", test_read_status_reg);
>
> + flash_reset();
> ret = g_test_run();
>
> qtest_quit(global_qtest);
prev parent reply other threads:[~2022-06-22 7:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-17 23:09 [PATCH 1/1] hw: m25p80: fixing individual test failure when tests are running in isolation Iris Chen
2022-06-22 7:37 ` Cédric Le Goater [this message]
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=e5cdcb1d-fdf7-6a82-959e-7dcb28145544@kaod.org \
--to=clg@kaod.org \
--cc=alistair@alistair23.me \
--cc=andrew@aj.id.au \
--cc=dz4list@gmail.com \
--cc=hreitz@redhat.com \
--cc=irischenlj@fb.com \
--cc=joel@jms.id.au \
--cc=kwolf@redhat.com \
--cc=lvivier@redhat.com \
--cc=patrick@stwcx.xyz \
--cc=pbonzini@redhat.com \
--cc=pdel@fb.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=thuth@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).