From: Jeuk Kim <jeuk20.kim@gmail.com>
To: yc01.jeong@samsung.com, Jeuk Kim <jeuk20.kim@samsung.com>
Cc: "thuth@redhat.com" <thuth@redhat.com>,
"lvivier@redhat.com" <lvivier@redhat.com>,
"pbonzini@redhat.com" <pbonzini@redhat.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
"jeongyuchan0629@gmail.com" <jeongyuchan0629@gmail.com>
Subject: Re: [PATCH 4/4] hw/ufs: ufs descriptor read test implemented
Date: Thu, 22 Aug 2024 14:40:31 +0900 [thread overview]
Message-ID: <0c0e649a-f31a-4051-a976-97943f85b951@gmail.com> (raw)
In-Reply-To: <20240822013925epcms1p112662453b1f4dcef8bc1e2f101bb6e6a@epcms1p1>
On 8/22/2024 10:39 AM, Yoochan Jeong wrote:
> From 936ef0a907bcf16809f9980c2d37e8fcb13697d2 Mon Sep 17 00:00:00 2001
> From: Yoochan Jeong <yc01.jeong@samsung.com>
> Date: Wed, 21 Aug 2024 09:09:54 +0900
> Subject: [PATCH 4/4] hw/ufs: ufs descriptor read test implemented
Remove it.
>
> New test function "ufstest_desc_request" added, which can check one's
> virtual UFS device can properly read and its descriptor data.
> (Writing descriptors are not implemented yet.)
> The testcases attempt to read all kinds of descriptors at least once,
> except for configuration descriptors (which are not implemented yet.)
> There are some testcases that are intended to make an error caused by
> an invalid index value or an invalid selector value.
>
> Based on: 20240802051902epcms2p319bc095a15eaef8de4e6955f6718371d@epcms2p3
> Signed-off-by: Yoochan Jeong <yc01.jeong@samsung.com>
> ---
> tests/qtest/ufs-test.c | 155 +++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 155 insertions(+)
>
> diff --git a/tests/qtest/ufs-test.c b/tests/qtest/ufs-test.c
> index a8fd2f1acc..f96061f922 100644
> --- a/tests/qtest/ufs-test.c
> +++ b/tests/qtest/ufs-test.c
> @@ -785,6 +785,160 @@ static void ufstest_attr_request(void *obj, void *data, QGuestAllocator *alloc)
> ufs_exit(ufs, alloc);
> }
>
> +static void ufstest_desc_request(void *obj, void *data, QGuestAllocator *alloc)
> +{
> + QUfs *ufs = obj;
> +
> + UtpTransferReqDesc utrd;
> + UtpUpiuRsp rsp_upiu;
> + ufs_init(ufs, alloc);
> +
> + /* Write Descriptor is not supported yet */
> +
> + /* Read Device Descriptor */
> + ufs_send_query(ufs, 0, UFS_UPIU_QUERY_FUNC_STANDARD_READ_REQUEST,
> + UFS_UPIU_QUERY_OPCODE_READ_DESC, UFS_QUERY_DESC_IDN_DEVICE,
> + 0, 0, 0, &utrd, &rsp_upiu);
> + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), ==, UFS_OCS_SUCCESS);
> + g_assert_cmpuint(rsp_upiu.header.response, ==, UFS_COMMAND_RESULT_SUCCESS);
> + g_assert_cmpuint(rsp_upiu.qr.opcode, ==, UFS_UPIU_QUERY_OPCODE_READ_DESC);
> + g_assert_cmpuint(rsp_upiu.qr.idn, ==, UFS_QUERY_DESC_IDN_DEVICE);
> + g_assert_cmpuint(rsp_upiu.qr.data[0], ==, sizeof(DeviceDescriptor));
> + g_assert_cmpuint(rsp_upiu.qr.data[1], ==, UFS_QUERY_DESC_IDN_DEVICE);
> +
> + /* Read Configuration Descriptor is not supported yet*/
> +
> + /* Read Unit Descriptor */
> + ufs_send_query(ufs, 0, UFS_UPIU_QUERY_FUNC_STANDARD_READ_REQUEST,
> + UFS_UPIU_QUERY_OPCODE_READ_DESC, UFS_QUERY_DESC_IDN_UNIT, 0,
> + 0, 0, &utrd, &rsp_upiu);
> + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), ==, UFS_OCS_SUCCESS);
> + g_assert_cmpuint(rsp_upiu.header.response, ==, UFS_COMMAND_RESULT_SUCCESS);
> + g_assert_cmpuint(rsp_upiu.qr.data[0], ==, sizeof(UnitDescriptor));
> + g_assert_cmpuint(rsp_upiu.qr.data[1], ==, UFS_QUERY_DESC_IDN_UNIT);
> + g_assert_cmpuint(rsp_upiu.qr.data[2], ==, 0);
> +
> + ufs_send_query(ufs, 0, UFS_UPIU_QUERY_FUNC_STANDARD_READ_REQUEST,
> + UFS_UPIU_QUERY_OPCODE_READ_DESC, UFS_QUERY_DESC_IDN_UNIT, 1,
> + 0, 0, &utrd, &rsp_upiu);
> + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), ==, UFS_OCS_SUCCESS);
> + g_assert_cmpuint(rsp_upiu.header.response, ==, UFS_COMMAND_RESULT_SUCCESS);
> + g_assert_cmpuint(rsp_upiu.qr.data[0], ==, sizeof(UnitDescriptor));
> + g_assert_cmpuint(rsp_upiu.qr.data[1], ==, UFS_QUERY_DESC_IDN_UNIT);
> + g_assert_cmpuint(rsp_upiu.qr.data[2], ==, 1);
> +
> + ufs_send_query(ufs, 0, UFS_UPIU_QUERY_FUNC_STANDARD_READ_REQUEST,
> + UFS_UPIU_QUERY_OPCODE_READ_DESC, UFS_QUERY_DESC_IDN_UNIT,
> + UFS_UPIU_RPMB_WLUN, 0, 0, &utrd, &rsp_upiu);
> + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), ==, UFS_OCS_SUCCESS);
> + g_assert_cmpuint(rsp_upiu.header.response, ==, UFS_COMMAND_RESULT_SUCCESS);
> + g_assert_cmpuint(rsp_upiu.qr.data[0], ==, sizeof(RpmbUnitDescriptor));
> + g_assert_cmpuint(rsp_upiu.qr.data[1], ==, UFS_QUERY_DESC_IDN_UNIT);
> + g_assert_cmpuint(rsp_upiu.qr.data[2], ==, UFS_UPIU_RPMB_WLUN);
> +
> + /* Read Interconnect Descriptor */
> + ufs_send_query(ufs, 0, UFS_UPIU_QUERY_FUNC_STANDARD_READ_REQUEST,
> + UFS_UPIU_QUERY_OPCODE_READ_DESC,
> + UFS_QUERY_DESC_IDN_INTERCONNECT, 0, 0, 0, &utrd, &rsp_upiu);
> + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), ==, UFS_OCS_SUCCESS);
> + g_assert_cmpuint(rsp_upiu.header.response, ==, UFS_COMMAND_RESULT_SUCCESS);
> + g_assert_cmpuint(rsp_upiu.qr.data[0], ==, sizeof(InterconnectDescriptor));
> + g_assert_cmpuint(rsp_upiu.qr.data[1], ==, UFS_QUERY_DESC_IDN_INTERCONNECT);
> + g_assert_cmpuint(rsp_upiu.qr.data[2], ==, 0x01);
Depending on the ufs version, the unipro version can vary.
Although they are currently 0x180 & 0x410, they should be 0x200 & 0x500
in ufs v4.0
So I don't think it's a good idea to test these with fixed values.
Please remove it.
> + g_assert_cmpuint(rsp_upiu.qr.data[3], ==, 0x80);
> + g_assert_cmpuint(rsp_upiu.qr.data[4], ==, 0x04);
> + g_assert_cmpuint(rsp_upiu.qr.data[5], ==, 0x10);
> +
> + /* Read String Descriptor */
> + ufs_send_query(ufs, 0, UFS_UPIU_QUERY_FUNC_STANDARD_READ_REQUEST,
> + UFS_UPIU_QUERY_OPCODE_READ_DESC, UFS_QUERY_DESC_IDN_STRING,
> + 0, 0, 0, &utrd, &rsp_upiu);
> + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), ==, UFS_OCS_SUCCESS);
> + g_assert_cmpuint(rsp_upiu.header.response, ==, UFS_COMMAND_RESULT_SUCCESS);
> + g_assert_cmpuint(rsp_upiu.qr.data[0], ==, 0x12);
> + g_assert_cmpuint(rsp_upiu.qr.data[1], ==, UFS_QUERY_DESC_IDN_STRING);
> +
> + ufs_send_query(ufs, 0, UFS_UPIU_QUERY_FUNC_STANDARD_READ_REQUEST,
> + UFS_UPIU_QUERY_OPCODE_READ_DESC, UFS_QUERY_DESC_IDN_STRING,
> + 1, 0, 0, &utrd, &rsp_upiu);
> + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), ==, UFS_OCS_SUCCESS);
> + g_assert_cmpuint(rsp_upiu.header.response, ==, UFS_COMMAND_RESULT_SUCCESS);
> + g_assert_cmpuint(rsp_upiu.qr.data[0], ==, 0x22);
> + g_assert_cmpuint(rsp_upiu.qr.data[1], ==, UFS_QUERY_DESC_IDN_STRING);
> +
> + ufs_send_query(ufs, 0, UFS_UPIU_QUERY_FUNC_STANDARD_READ_REQUEST,
> + UFS_UPIU_QUERY_OPCODE_READ_DESC, UFS_QUERY_DESC_IDN_STRING,
> + 4, 0, 0, &utrd, &rsp_upiu);
> + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), ==, UFS_OCS_SUCCESS);
> + g_assert_cmpuint(rsp_upiu.header.response, ==, UFS_COMMAND_RESULT_SUCCESS);
> + g_assert_cmpuint(rsp_upiu.qr.data[0], ==, 0x0a);
> + g_assert_cmpuint(rsp_upiu.qr.data[1], ==, UFS_QUERY_DESC_IDN_STRING);
> +
> + /* Read Geometry Descriptor */
> + ufs_send_query(ufs, 0, UFS_UPIU_QUERY_FUNC_STANDARD_READ_REQUEST,
> + UFS_UPIU_QUERY_OPCODE_READ_DESC, UFS_QUERY_DESC_IDN_GEOMETRY,
> + 0, 0, 0, &utrd, &rsp_upiu);
> + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), ==, UFS_OCS_SUCCESS);
> + g_assert_cmpuint(rsp_upiu.header.response, ==, UFS_COMMAND_RESULT_SUCCESS);
> + g_assert_cmpuint(rsp_upiu.qr.data[0], ==, sizeof(GeometryDescriptor));
> + g_assert_cmpuint(rsp_upiu.qr.data[1], ==, UFS_QUERY_DESC_IDN_GEOMETRY);
> +
> + /* Read Power Descriptor */
> + ufs_send_query(ufs, 0, UFS_UPIU_QUERY_FUNC_STANDARD_READ_REQUEST,
> + UFS_UPIU_QUERY_OPCODE_READ_DESC, UFS_QUERY_DESC_IDN_POWER, 0,
> + 0, 0, &utrd, &rsp_upiu);
> + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), ==, UFS_OCS_SUCCESS);
> + g_assert_cmpuint(rsp_upiu.header.response, ==, UFS_COMMAND_RESULT_SUCCESS);
> + g_assert_cmpuint(rsp_upiu.qr.data[0], ==,
> + sizeof(PowerParametersDescriptor));
> + g_assert_cmpuint(rsp_upiu.qr.data[1], ==, UFS_QUERY_DESC_IDN_POWER);
> +
> + /* Read Health Descriptor */
> + ufs_send_query(ufs, 0, UFS_UPIU_QUERY_FUNC_STANDARD_READ_REQUEST,
> + UFS_UPIU_QUERY_OPCODE_READ_DESC, UFS_QUERY_DESC_IDN_HEALTH,
> + 0, 0, 0, &utrd, &rsp_upiu);
> + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), ==, UFS_OCS_SUCCESS);
> + g_assert_cmpuint(rsp_upiu.header.response, ==, UFS_COMMAND_RESULT_SUCCESS);
> + g_assert_cmpuint(rsp_upiu.qr.data[0], ==, sizeof(DeviceHealthDescriptor));
> + g_assert_cmpuint(rsp_upiu.qr.data[1], ==, UFS_QUERY_DESC_IDN_HEALTH);
> +
> + /* Invalid Index (Intended Failure) */
> + ufs_send_query(ufs, 0, UFS_UPIU_QUERY_FUNC_STANDARD_READ_REQUEST,
> + UFS_UPIU_QUERY_OPCODE_READ_DESC, UFS_QUERY_DESC_IDN_UNIT, 4,
> + 0, 0, &utrd, &rsp_upiu);
> + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), ==,
> + UFS_OCS_INVALID_CMD_TABLE_ATTR);
> + g_assert_cmpuint(rsp_upiu.header.response, ==,
> + UFS_QUERY_RESULT_INVALID_INDEX);
> +
> + ufs_send_query(ufs, 0, UFS_UPIU_QUERY_FUNC_STANDARD_READ_REQUEST,
> + UFS_UPIU_QUERY_OPCODE_READ_DESC, UFS_QUERY_DESC_IDN_STRING,
> + 5, 0, 0, &utrd, &rsp_upiu);
> + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), ==,
> + UFS_OCS_INVALID_CMD_TABLE_ATTR);
> + g_assert_cmpuint(rsp_upiu.header.response, ==,
> + UFS_QUERY_RESULT_INVALID_INDEX);
> +
> + /* Invalid Selector (Intended Failure) */
> + ufs_send_query(ufs, 0, UFS_UPIU_QUERY_FUNC_STANDARD_READ_REQUEST,
> + UFS_UPIU_QUERY_OPCODE_READ_DESC, UFS_QUERY_DESC_IDN_DEVICE,
> + 0, 1, 0, &utrd, &rsp_upiu);
> + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), ==,
> + UFS_OCS_INVALID_CMD_TABLE_ATTR);
> + g_assert_cmpuint(rsp_upiu.header.response, ==,
> + UFS_QUERY_RESULT_INVALID_SELECTOR);
> +
> + ufs_send_query(ufs, 0, UFS_UPIU_QUERY_FUNC_STANDARD_READ_REQUEST,
> + UFS_UPIU_QUERY_OPCODE_READ_DESC, UFS_QUERY_DESC_IDN_STRING,
> + 0, 1, 0, &utrd, &rsp_upiu);
> + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), ==,
> + UFS_OCS_INVALID_CMD_TABLE_ATTR);
> + g_assert_cmpuint(rsp_upiu.header.response, ==,
> + UFS_QUERY_RESULT_INVALID_SELECTOR);
> +
> + ufs_exit(ufs, alloc);
> +}
> +
> static void drive_destroy(void *path)
> {
> unlink(path);
> @@ -854,6 +1008,7 @@ static void ufs_register_nodes(void)
> qos_add_test("read-write", "ufs", ufstest_read_write, &io_test_opts);
> qos_add_test("flag read-write", "ufs", ufstest_flag_request, &io_test_opts);
> qos_add_test("attr read-write", "ufs", ufstest_attr_request, &io_test_opts);
> + qos_add_test("desc read-write", "ufs", ufstest_desc_request, &io_test_opts);
Why don't we use `ufstest_query_flag_request` &
`ufstest_query_attr_request` & `ufstest_query_desc_request`?
It looks more clear to me.
> }
>
> libqos_init(ufs_register_nodes);
prev parent reply other threads:[~2024-08-22 5:41 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20240821022726epcms1p127d8cd71ca3e1354592de8a4a5c97a10@epcms1p4>
2024-08-21 2:30 ` [PATCH 0/4] hw/ufs: ufs device testing function added and modified 정유찬
[not found] ` <CGME20240821022726epcms1p127d8cd71ca3e1354592de8a4a5c97a10@epcms1p3>
2024-08-21 2:32 ` [PATCH 1/4] hw/ufs: minor bug fixes related to ufs-test 정유찬
2024-08-22 4:50 ` Jeuk Kim
[not found] ` <CGME20240821022726epcms1p127d8cd71ca3e1354592de8a4a5c97a10@epcms1p6>
2024-08-22 6:00 ` Yoochan Jeong
2024-08-22 6:08 ` Jeuk Kim
[not found] ` <CGME20240821022726epcms1p127d8cd71ca3e1354592de8a4a5c97a10@epcms1p5>
2024-08-21 2:34 ` [PATCH 2/4] hw/ufs: ufs flag read/write test implemented 정유찬
[not found] ` <CGME20240821022726epcms1p127d8cd71ca3e1354592de8a4a5c97a10@epcms1p1>
2024-08-21 2:27 ` [PATCH 0/4] hw/ufs: ufs device testing function added and modified 정유찬
2024-08-21 2:35 ` [PATCH 3/4] hw/ufs: ufs attribute read/write test implemented 정유찬
2024-08-22 1:39 ` [PATCH 4/4] hw/ufs: ufs descriptor read " Yoochan Jeong
2024-08-22 5:40 ` Jeuk Kim [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=0c0e649a-f31a-4051-a976-97943f85b951@gmail.com \
--to=jeuk20.kim@gmail.com \
--cc=jeongyuchan0629@gmail.com \
--cc=jeuk20.kim@samsung.com \
--cc=lvivier@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.com \
--cc=yc01.jeong@samsung.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).