Message ID | 20241018053112.1886173-12-jamin_lin@aspeedtech.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Fix write incorrect data into flash in user mode | expand |
On 10/18/24 07:31, Jamin Lin wrote: > Currently, these test cases used the hardcode offset 0x1400000 (0x14000 * 256) > which was beyond the 16MB flash size for flash page read/write command testing. > However, the default fmc flash model of ast1030-a1 EVB is "w25q80bl" whose size > is 1MB. To test all flash models, introduces a new page_addr member in TestData > structure, so users can set the offset for flash parge read/write command > testing. The commit title and description are confusing. By "all flash" models, do you mean "all Aspeed SoC" models ? Since the change is introducing a 'page_addr' data field. I think this should be the title. Thanks, C. > Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com> > --- > tests/qtest/aspeed_smc-test.c | 17 ++++++++++------- > 1 file changed, 10 insertions(+), 7 deletions(-) > > diff --git a/tests/qtest/aspeed_smc-test.c b/tests/qtest/aspeed_smc-test.c > index b8ab20b43d..6db18451d2 100644 > --- a/tests/qtest/aspeed_smc-test.c > +++ b/tests/qtest/aspeed_smc-test.c > @@ -72,6 +72,7 @@ typedef struct TestData { > char *tmp_path; > uint8_t cs; > const char *node; > + uint32_t page_addr; > } TestData; > > /* > @@ -256,7 +257,7 @@ static void assert_page_mem(const TestData *data, uint32_t addr, > static void test_erase_sector(const void *data) > { > const TestData *test_data = (const TestData *)data; > - uint32_t some_page_addr = 0x600 * FLASH_PAGE_SIZE; > + uint32_t some_page_addr = test_data->page_addr; > uint32_t page[FLASH_PAGE_SIZE / 4]; > int i; > > @@ -308,7 +309,7 @@ static void test_erase_sector(const void *data) > static void test_erase_all(const void *data) > { > const TestData *test_data = (const TestData *)data; > - uint32_t some_page_addr = 0x15000 * FLASH_PAGE_SIZE; > + uint32_t some_page_addr = test_data->page_addr; > uint32_t page[FLASH_PAGE_SIZE / 4]; > int i; > > @@ -358,8 +359,8 @@ static void test_erase_all(const void *data) > static void test_write_page(const void *data) > { > const TestData *test_data = (const TestData *)data; > - uint32_t my_page_addr = 0x14000 * FLASH_PAGE_SIZE; /* beyond 16MB */ > - uint32_t some_page_addr = 0x15000 * FLASH_PAGE_SIZE; > + uint32_t my_page_addr = test_data->page_addr; > + uint32_t some_page_addr = my_page_addr + FLASH_PAGE_SIZE; > uint32_t page[FLASH_PAGE_SIZE / 4]; > int i; > > @@ -395,8 +396,8 @@ static void test_write_page(const void *data) > static void test_read_page_mem(const void *data) > { > const TestData *test_data = (const TestData *)data; > - uint32_t my_page_addr = 0x14000 * FLASH_PAGE_SIZE; /* beyond 16MB */ > - uint32_t some_page_addr = 0x15000 * FLASH_PAGE_SIZE; > + uint32_t my_page_addr = test_data->page_addr; > + uint32_t some_page_addr = my_page_addr + FLASH_PAGE_SIZE; > uint32_t page[FLASH_PAGE_SIZE / 4]; > int i; > > @@ -438,7 +439,7 @@ static void test_read_page_mem(const void *data) > static void test_write_page_mem(const void *data) > { > const TestData *test_data = (const TestData *)data; > - uint32_t my_page_addr = 0x15000 * FLASH_PAGE_SIZE; > + uint32_t my_page_addr = test_data->page_addr; > uint32_t page[FLASH_PAGE_SIZE / 4]; > int i; > > @@ -679,6 +680,8 @@ static void test_palmetto_bmc(TestData *data) > data->jedec_id = 0x20ba19; > data->cs = 0; > data->node = "/machine/soc/fmc/ssi.0/child[0]"; > + /* beyond 16MB */ > + data->page_addr = 0x14000 * FLASH_PAGE_SIZE; > > qtest_add_data_func("/ast2400/smc/read_jedec", data, test_read_jedec); > qtest_add_data_func("/ast2400/smc/erase_sector", data, test_erase_sector);
On Mon, 2024-10-21 at 14:39 +0200, Cédric Le Goater wrote: > On 10/18/24 07:31, Jamin Lin wrote: > > Currently, these test cases used the hardcode offset 0x1400000 (0x14000 * 256) > > which was beyond the 16MB flash size for flash page read/write command testing. > > However, the default fmc flash model of ast1030-a1 EVB is "w25q80bl" whose size > > is 1MB. To test all flash models, introduces a new page_addr member in TestData > > structure, so users can set the offset for flash parge read/write command > > testing. > > The commit title and description are confusing. By "all flash" models, > do you mean "all Aspeed SoC" models ? I think it only relates to the SoCs insofar as the AST1030 embeds some flash in the SoC? Otherwise it's dependent on the flash model associated with the board? > > Since the change is introducing a 'page_addr' data field. I think > this should be the title. I agree that including something about page_addr in the title would be an improvement. Andrew
Hi Cedric, > Subject: Re: [SPAM] [PATCH v1 11/16] test/qtest/aspeed_smc-test: Support to > test all flash models > > On 10/18/24 07:31, Jamin Lin wrote: > > Currently, these test cases used the hardcode offset 0x1400000 > > (0x14000 * 256) which was beyond the 16MB flash size for flash page > read/write command testing. > > However, the default fmc flash model of ast1030-a1 EVB is "w25q80bl" > > whose size is 1MB. To test all flash models, introduces a new > > page_addr member in TestData structure, so users can set the offset > > for flash parge read/write command testing. > > The commit title and description are confusing. By "all flash" models, do you > mean "all Aspeed SoC" models ? > > Since the change is introducing a 'page_addr' data field. I think this should be > the title. > Thanks for review and suggestion. Will update it. Jamin > Thanks, > > C. > > > > > > Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com> > > --- > > tests/qtest/aspeed_smc-test.c | 17 ++++++++++------- > > 1 file changed, 10 insertions(+), 7 deletions(-) > > > > diff --git a/tests/qtest/aspeed_smc-test.c > > b/tests/qtest/aspeed_smc-test.c index b8ab20b43d..6db18451d2 100644 > > --- a/tests/qtest/aspeed_smc-test.c > > +++ b/tests/qtest/aspeed_smc-test.c > > @@ -72,6 +72,7 @@ typedef struct TestData { > > char *tmp_path; > > uint8_t cs; > > const char *node; > > + uint32_t page_addr; > > } TestData; > > > > /* > > @@ -256,7 +257,7 @@ static void assert_page_mem(const TestData *data, > uint32_t addr, > > static void test_erase_sector(const void *data) > > { > > const TestData *test_data = (const TestData *)data; > > - uint32_t some_page_addr = 0x600 * FLASH_PAGE_SIZE; > > + uint32_t some_page_addr = test_data->page_addr; > > uint32_t page[FLASH_PAGE_SIZE / 4]; > > int i; > > > > @@ -308,7 +309,7 @@ static void test_erase_sector(const void *data) > > static void test_erase_all(const void *data) > > { > > const TestData *test_data = (const TestData *)data; > > - uint32_t some_page_addr = 0x15000 * FLASH_PAGE_SIZE; > > + uint32_t some_page_addr = test_data->page_addr; > > uint32_t page[FLASH_PAGE_SIZE / 4]; > > int i; > > > > @@ -358,8 +359,8 @@ static void test_erase_all(const void *data) > > static void test_write_page(const void *data) > > { > > const TestData *test_data = (const TestData *)data; > > - uint32_t my_page_addr = 0x14000 * FLASH_PAGE_SIZE; /* beyond > 16MB */ > > - uint32_t some_page_addr = 0x15000 * FLASH_PAGE_SIZE; > > + uint32_t my_page_addr = test_data->page_addr; > > + uint32_t some_page_addr = my_page_addr + FLASH_PAGE_SIZE; > > uint32_t page[FLASH_PAGE_SIZE / 4]; > > int i; > > > > @@ -395,8 +396,8 @@ static void test_write_page(const void *data) > > static void test_read_page_mem(const void *data) > > { > > const TestData *test_data = (const TestData *)data; > > - uint32_t my_page_addr = 0x14000 * FLASH_PAGE_SIZE; /* beyond > 16MB */ > > - uint32_t some_page_addr = 0x15000 * FLASH_PAGE_SIZE; > > + uint32_t my_page_addr = test_data->page_addr; > > + uint32_t some_page_addr = my_page_addr + FLASH_PAGE_SIZE; > > uint32_t page[FLASH_PAGE_SIZE / 4]; > > int i; > > > > @@ -438,7 +439,7 @@ static void test_read_page_mem(const void *data) > > static void test_write_page_mem(const void *data) > > { > > const TestData *test_data = (const TestData *)data; > > - uint32_t my_page_addr = 0x15000 * FLASH_PAGE_SIZE; > > + uint32_t my_page_addr = test_data->page_addr; > > uint32_t page[FLASH_PAGE_SIZE / 4]; > > int i; > > > > @@ -679,6 +680,8 @@ static void test_palmetto_bmc(TestData *data) > > data->jedec_id = 0x20ba19; > > data->cs = 0; > > data->node = "/machine/soc/fmc/ssi.0/child[0]"; > > + /* beyond 16MB */ > > + data->page_addr = 0x14000 * FLASH_PAGE_SIZE; > > > > qtest_add_data_func("/ast2400/smc/read_jedec", data, > test_read_jedec); > > qtest_add_data_func("/ast2400/smc/erase_sector", data, > > test_erase_sector);
Hi Andrew and Cedric, ************* Email Confidentiality Notice ******************** 免責聲明: 本信件(或其附件)可能包含機密資訊,並受法律保護。如 台端非指定之收件者,請以電子郵件通知本電子郵件之發送者, 並請立即刪除本電子郵件及其附件和銷毀所有複印件。謝謝您的合作! DISCLAIMER: This message (and any attachments) may contain legally privileged and/or other confidential information. If you have received it in error, please notify the sender by reply e-mail and immediately delete the e-mail and any attachments without copying or disclosing the contents. Thank you. > -----Original Message----- > From: Andrew Jeffery <andrew@codeconstruct.com.au> > Sent: Tuesday, October 22, 2024 7:34 AM > To: Cédric Le Goater <clg@kaod.org>; Jamin Lin <jamin_lin@aspeedtech.com>; > Peter Maydell <peter.maydell@linaro.org>; Steven Lee > <steven_lee@aspeedtech.com>; Troy Lee <leetroy@gmail.com>; Joel Stanley > <joel@jms.id.au>; Alistair Francis <alistair@alistair23.me>; Kevin Wolf > <kwolf@redhat.com>; Hanna Reitz <hreitz@redhat.com>; Thomas Huth > <thuth@redhat.com>; Laurent Vivier <lvivier@redhat.com>; Paolo Bonzini > <pbonzini@redhat.com>; open list:ASPEED BMCs <qemu-arm@nongnu.org>; > open list:All patches CC here <qemu-devel@nongnu.org>; open list:Block layer > core <qemu-block@nongnu.org> > Cc: Troy Lee <troy_lee@aspeedtech.com>; Yunlin Tang > <yunlin.tang@aspeedtech.com> > Subject: Re: [SPAM] [PATCH v1 11/16] test/qtest/aspeed_smc-test: Support to > test all flash models > > On Mon, 2024-10-21 at 14:39 +0200, Cédric Le Goater wrote: > > On 10/18/24 07:31, Jamin Lin wrote: > > > Currently, these test cases used the hardcode offset 0x1400000 > > > (0x14000 * 256) which was beyond the 16MB flash size for flash page > read/write command testing. > > > However, the default fmc flash model of ast1030-a1 EVB is "w25q80bl" > > > whose size is 1MB. To test all flash models, introduces a new > > > page_addr member in TestData structure, so users can set the offset > > > for flash parge read/write command testing. > > > > The commit title and description are confusing. By "all flash" models, > > do you mean "all Aspeed SoC" models ? > > I think it only relates to the SoCs insofar as the AST1030 embeds some flash in > the SoC? Otherwise it's dependent on the flash model associated with the > board? > > > > > Since the change is introducing a 'page_addr' data field. I think this > > should be the title. > > I agree that including something about page_addr in the title would be an > improvement. > Thanks for review and suggestion. Will update commit title as following. Introducing a "page_addr" data field Thanks-Jamin > Andrew
diff --git a/tests/qtest/aspeed_smc-test.c b/tests/qtest/aspeed_smc-test.c index b8ab20b43d..6db18451d2 100644 --- a/tests/qtest/aspeed_smc-test.c +++ b/tests/qtest/aspeed_smc-test.c @@ -72,6 +72,7 @@ typedef struct TestData { char *tmp_path; uint8_t cs; const char *node; + uint32_t page_addr; } TestData; /* @@ -256,7 +257,7 @@ static void assert_page_mem(const TestData *data, uint32_t addr, static void test_erase_sector(const void *data) { const TestData *test_data = (const TestData *)data; - uint32_t some_page_addr = 0x600 * FLASH_PAGE_SIZE; + uint32_t some_page_addr = test_data->page_addr; uint32_t page[FLASH_PAGE_SIZE / 4]; int i; @@ -308,7 +309,7 @@ static void test_erase_sector(const void *data) static void test_erase_all(const void *data) { const TestData *test_data = (const TestData *)data; - uint32_t some_page_addr = 0x15000 * FLASH_PAGE_SIZE; + uint32_t some_page_addr = test_data->page_addr; uint32_t page[FLASH_PAGE_SIZE / 4]; int i; @@ -358,8 +359,8 @@ static void test_erase_all(const void *data) static void test_write_page(const void *data) { const TestData *test_data = (const TestData *)data; - uint32_t my_page_addr = 0x14000 * FLASH_PAGE_SIZE; /* beyond 16MB */ - uint32_t some_page_addr = 0x15000 * FLASH_PAGE_SIZE; + uint32_t my_page_addr = test_data->page_addr; + uint32_t some_page_addr = my_page_addr + FLASH_PAGE_SIZE; uint32_t page[FLASH_PAGE_SIZE / 4]; int i; @@ -395,8 +396,8 @@ static void test_write_page(const void *data) static void test_read_page_mem(const void *data) { const TestData *test_data = (const TestData *)data; - uint32_t my_page_addr = 0x14000 * FLASH_PAGE_SIZE; /* beyond 16MB */ - uint32_t some_page_addr = 0x15000 * FLASH_PAGE_SIZE; + uint32_t my_page_addr = test_data->page_addr; + uint32_t some_page_addr = my_page_addr + FLASH_PAGE_SIZE; uint32_t page[FLASH_PAGE_SIZE / 4]; int i; @@ -438,7 +439,7 @@ static void test_read_page_mem(const void *data) static void test_write_page_mem(const void *data) { const TestData *test_data = (const TestData *)data; - uint32_t my_page_addr = 0x15000 * FLASH_PAGE_SIZE; + uint32_t my_page_addr = test_data->page_addr; uint32_t page[FLASH_PAGE_SIZE / 4]; int i; @@ -679,6 +680,8 @@ static void test_palmetto_bmc(TestData *data) data->jedec_id = 0x20ba19; data->cs = 0; data->node = "/machine/soc/fmc/ssi.0/child[0]"; + /* beyond 16MB */ + data->page_addr = 0x14000 * FLASH_PAGE_SIZE; qtest_add_data_func("/ast2400/smc/read_jedec", data, test_read_jedec); qtest_add_data_func("/ast2400/smc/erase_sector", data, test_erase_sector);
Currently, these test cases used the hardcode offset 0x1400000 (0x14000 * 256) which was beyond the 16MB flash size for flash page read/write command testing. However, the default fmc flash model of ast1030-a1 EVB is "w25q80bl" whose size is 1MB. To test all flash models, introduces a new page_addr member in TestData structure, so users can set the offset for flash parge read/write command testing. Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com> --- tests/qtest/aspeed_smc-test.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)