From nobody Sun Nov 24 11:13:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=samsung.com ARC-Seal: i=1; a=rsa-sha256; t=1724246133; cv=none; d=zohomail.com; s=zohoarc; b=LdnfOkd9YIjAaEGBe7Af3OO/Y1lPS5M+IE66lMVFdQ3JaA43e8NG4s7gTVEKN4hdZwn3r2LjcPv+niVpVX/CfuMIfn8NZ+8smPgTnbIogFJto2DenHvSu1r2JEjHU9bKyRKdKJaxTsgb0wPx7ML+nU8fCHB8fmpe7jg2YWgEK2o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724246133; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=N6uyiVAmxim8U0k7mpyvuJCgeFofxB0uCWjTNL6vsZY=; b=ZluDSG1IWPslKS9WcezER6shlnynDQwzB51E+S1n7Qp4PFeGYwifTvflqlKweKejHbQHQo/fc+B84iXeHeL+X1zDA4anHeKNM6Dq07VqsXCjnKa+kVsdykA19rycx5gT6D8h4hnVUw9xDFywHzOe6cO4G7nR6ZxNkOVFk38HKb8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1724246133798281.08130142824973; Wed, 21 Aug 2024 06:15:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sglAW-0000jn-VY; Wed, 21 Aug 2024 09:14:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sgb9a-0001sm-AT for qemu-devel@nongnu.org; Tue, 20 Aug 2024 22:32:54 -0400 Received: from mailout1.samsung.com ([203.254.224.24]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sgb9W-00074T-L2 for qemu-devel@nongnu.org; Tue, 20 Aug 2024 22:32:54 -0400 Received: from epcas1p3.samsung.com (unknown [182.195.41.47]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20240821023245epoutp01f83a0804d6fd04552f712065019e8968~tnaVPfXzC2284722847epoutp01I for ; Wed, 21 Aug 2024 02:32:45 +0000 (GMT) Received: from epsmges1p4.samsung.com (unknown [182.195.42.56]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20240821023245epcas1p1cd8fa7dbae7f73653208bfb041b26786~tnaVAU8O31099710997epcas1p1Q; Wed, 21 Aug 2024 02:32:45 +0000 (GMT) Received: from epcas1p1.samsung.com ( [182.195.41.45]) by epsmges1p4.samsung.com (Symantec Messaging Gateway) with SMTP id 92.E8.10258.DC155C66; Wed, 21 Aug 2024 11:32:45 +0900 (KST) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20240821023245epoutp01f83a0804d6fd04552f712065019e8968~tnaVPfXzC2284722847epoutp01I DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1724207565; bh=N6uyiVAmxim8U0k7mpyvuJCgeFofxB0uCWjTNL6vsZY=; h=Subject:Reply-To:From:To:CC:In-Reply-To:Date:References:From; b=cdqgwOGuqwe9Z4Rb129EnJ3LQDZaXiuPfvFP1Zf+t7sr/pxq0Lvcw15oT6sfDp0hj 1AzlYKIYXgIwEZYh6TnlaK5RbpKpEldoBpvxcbk8Vhd3its1wV2SohkurUmoiekD7j P/5Tt4AiZgtP3gYCqei8LeRda8jyOw5YnQ3IjckQ= X-AuditID: b6c32a38-995ff70000002812-71-66c551cd5fbf Mime-Version: 1.0 Subject: [PATCH 1/4] hw/ufs: minor bug fixes related to ufs-test From: =?UTF-8?B?7KCV7Jyg7LCs?= To: =?UTF-8?B?6rmA7KCc7Jqx?= CC: =?UTF-8?B?7KCV7Jyg7LCs?= , "thuth@redhat.com" , "lvivier@redhat.com" , "pbonzini@redhat.com" , "qemu-devel@nongnu.org" , "jeongyuchan0629@gmail.com" X-Priority: 3 X-Content-Kind-Code: NORMAL In-Reply-To: <20240821023025epcms1p4de36db95f4d3a66727f128ef6be860e4@epcms1p4> X-Drm-Type: N,general X-Msg-Generator: Mail X-Msg-Type: PERSONAL X-Reply-Demand: N Message-ID: <20240821023245epcms1p31ada9c24041d9b34f7e9938abe93189b@epcms1p3> Date: Wed, 21 Aug 2024 11:32:45 +0900 X-CMS-MailID: 20240821023245epcms1p31ada9c24041d9b34f7e9938abe93189b Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" CMS-TYPE: 101P X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrJIsWRmVeSWpSXmKPExsWy7bCmru7ZwKNpBo3NvBY9r/axWdzfeo3R 4lODlMX+bf9YLY737mCxWHnMxmL32ZlsDuweO2fdZfd4cm0zk8f7fVfZPPq2rGIMYInisklJ zcksSy3St0vgymju+c1a8Muw4tHdw+wNjB1qXYycHBICJhL/n3xm6WLk4hAS2MEoseziMyCH g4NXQFDi7w5hkBphAQeJdR3H2UFsIQEFiR/Lb7JBxC0lPj+ZBmazCZhLvJ90nRHEFhEwlfjz fR3YTGaBZUwSj29OYIJYxisxo/0pC4QtLbF9+VawBk4BP4nZn5dB1YhK3Fz9lh3Gfn9sPiOE LSLReu8sM4QtKPHg525GkDslBCQl1r/WhAjXS9y49pgNwq6ReNR2C2qMvsS1jo1ga3kFfCUu L94GVsMioCrxZSfMWheJy8/vgK1iFpCX2P52DjPIeGYBTYn1u/QhwnwS7772sMJ8smPeE6hW FYlFF99DrZWS+HpiHTPEZR4S++85Q0J2KqPEie4ulgmM8rMQgTsLybJZCMsWMDKvYhRLLSjO TU8tNiww0StOzC0uzUvXS87P3cQITh1aFjsY5779oHeIkYmD8RCjBAezkghv98uDaUK8KYmV ValF+fFFpTmpxYcYpTlYlMR5z1wpSxUSSE8sSc1OTS1ILYLJMnFwSjUwtTQuOfLhjPo3topt rHV3Ano0/goZmz07tezN2aC4yff2Z0mcULm9tfZMaoLa8VsnkzXlfj9vEFv0Qeb2H/VPH1dv bW7Otpe2FLE2kvSWjcreFXAxX+Ttc4nZ0sq7djR/mzZn/6Wz6uGx1R671rKu//CxQUYvWDx5 3lkWqdrdzCJZYckdTyeHNU2WVL/jmBjubZL7R+q4WYUZyzv5vTXL45vMJsl7sfLm8M6/dK5j pmX3pdrlXDpKXJ1CTO1P9HuUimqSF6ysLOm5tnHG2n0TMnsmzHZWzC/e2GA5+ciz0/Nbn5+d adbFumf1xjUZ2zMV3f/dZ3e4KsMgttdq4nJV0ScyqiJqTxR0eZZU/c5XYinOSDTUYi4qTgQA 8jq6EIwDAAA= X-CMS-RootMailID: 20240821022726epcms1p127d8cd71ca3e1354592de8a4a5c97a10 References: <20240821023025epcms1p4de36db95f4d3a66727f128ef6be860e4@epcms1p4> Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=203.254.224.24; envelope-from=yc01.jeong@samsung.com; helo=mailout1.samsung.com X-Spam_score_int: -45 X-Spam_score: -4.6 X-Spam_bar: ---- X-Spam_report: (-4.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.144, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 21 Aug 2024 09:14:17 -0400 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: yc01.jeong@samsung.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @samsung.com) X-ZM-MESSAGEID: 1724246135542116600 From d0ae8e25aec4ae7d222a2ea667d5ddb61f14fe02 Mon Sep 17 00:00:00 2001 From: Yoochan Jeong Date: Wed, 21 Aug 2024 09:03:06 +0900 Subject: [PATCH 1/4] hw/ufs: minor bug fixes related to ufs-test Minor bugs and errors related to ufs-test are resolved. Some permissions and code implementations that are not synchronized with the ufs spec are edited. Based on: 20240802051902epcms2p319bc095a15eaef8de4e6955f6718371d@epcms2p3 Signed-off-by: Yoochan Jeong --- hw/ufs/ufs.c | 26 +++++++++++++++++++++----- tests/qtest/ufs-test.c | 12 +++++++++--- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/hw/ufs/ufs.c b/hw/ufs/ufs.c index ce2c96aeea..9472a3c14a 100644 --- a/hw/ufs/ufs.c +++ b/hw/ufs/ufs.c @@ -971,7 +971,7 @@ static const int attr_permission[UFS_QUERY_ATTR_IDN_COU= NT] =3D { UFS_QUERY_ATTR_READ | UFS_QUERY_ATTR_WRITE, [UFS_QUERY_ATTR_IDN_EE_STATUS] =3D UFS_QUERY_ATTR_READ, [UFS_QUERY_ATTR_IDN_SECONDS_PASSED] =3D UFS_QUERY_ATTR_WRITE, - [UFS_QUERY_ATTR_IDN_CNTX_CONF] =3D UFS_QUERY_ATTR_READ, + [UFS_QUERY_ATTR_IDN_CNTX_CONF] =3D UFS_QUERY_ATTR_READ | UFS_QUERY_ATT= R_WRITE, [UFS_QUERY_ATTR_IDN_FFU_STATUS] =3D UFS_QUERY_ATTR_READ, [UFS_QUERY_ATTR_IDN_PSA_STATE] =3D UFS_QUERY_ATTR_READ | UFS_QUERY_ATT= R_WRITE, [UFS_QUERY_ATTR_IDN_PSA_DATA_SIZE] =3D @@ -1038,7 +1038,7 @@ static QueryRespCode ufs_exec_query_flag(UfsRequest *= req, int op) } =20 *(((uint8_t *)&u->flags) + idn) =3D value; - req->rsp_upiu.qr.value =3D cpu_to_be32(value); + req->rsp_upiu.qr.value =3D value; return UFS_QUERY_RESULT_SUCCESS; } =20 @@ -1148,8 +1148,11 @@ static QueryRespCode ufs_exec_query_attr(UfsRequest = *req, int op) { UfsHc *u =3D req->hc; uint8_t idn =3D req->req_upiu.qr.idn; + uint8_t selector =3D req->req_upiu.qr.selector; uint32_t value; QueryRespCode ret; + const uint8_t UFS_QUERY_ATTR_CNTX_CONF_SELECTOR =3D 15; + const uint32_t UFS_QUERY_ATTR_MAXVALUE =3D 0x0F; =20 ret =3D ufs_attr_check_idn_valid(idn, op); if (ret) { @@ -1159,10 +1162,20 @@ static QueryRespCode ufs_exec_query_attr(UfsRequest= *req, int op) if (op =3D=3D UFS_QUERY_ATTR_READ) { value =3D ufs_read_attr_value(u, idn); } else { - value =3D be32_to_cpu(req->req_upiu.qr.value); + value =3D req->req_upiu.qr.value; + if (idn =3D=3D UFS_QUERY_ATTR_IDN_ACTIVE_ICC_LVL && + value > UFS_QUERY_ATTR_MAXVALUE) { + return UFS_QUERY_RESULT_INVALID_VALUE; + } + if (idn =3D=3D UFS_QUERY_ATTR_IDN_CNTX_CONF) { + if (selector !=3D UFS_QUERY_ATTR_CNTX_CONF_SELECTOR) { + return UFS_QUERY_RESULT_INVALID_SELECTOR; + } else if (value =3D=3D 0x00 || value > UFS_QUERY_ATTR_MAXVALU= E) { + return UFS_QUERY_RESULT_INVALID_VALUE; + } + } ufs_write_attr_value(u, idn, value); } - req->rsp_upiu.qr.value =3D cpu_to_be32(value); return UFS_QUERY_RESULT_SUCCESS; } @@ -1287,9 +1300,12 @@ static QueryRespCode ufs_read_desc(UfsRequest *req) UfsHc *u =3D req->hc; QueryRespCode status; uint8_t idn =3D req->req_upiu.qr.idn; + uint8_t selector =3D req->req_upiu.qr.selector; uint16_t length =3D be16_to_cpu(req->req_upiu.qr.length); InterconnectDescriptor desc; - + if (selector !=3D 0) { + return UFS_QUERY_RESULT_INVALID_SELECTOR; + } switch (idn) { case UFS_QUERY_DESC_IDN_DEVICE: memcpy(&req->rsp_upiu.qr.data, &u->device_desc, sizeof(u->device_d= esc)); diff --git a/tests/qtest/ufs-test.c b/tests/qtest/ufs-test.c index 82ec3f0671..d70c2ee4a3 100644 --- a/tests/qtest/ufs-test.c +++ b/tests/qtest/ufs-test.c @@ -119,8 +119,10 @@ static void ufs_send_nop_out(QUfs *ufs, uint8_t slot, =20 static void ufs_send_query(QUfs *ufs, uint8_t slot, uint8_t query_function, uint8_t query_opcode, uint8_t idn, uint8_t inde= x, + uint8_t selector, uint32_t attr_value, UtpTransferReqDesc *utrd_out, UtpUpiuRsp *rsp_o= ut) { + const uint16_t UFS_QUERY_DESC_MAXLENGTH =3D 0x62; /* Build up utp transfer request descriptor */ UtpTransferReqDesc utrd =3D ufs_build_req_utrd(ufs->cmd_desc_addr, slo= t, UFS_UTP_NO_DATA_TRANSFER,= 0); @@ -136,13 +138,16 @@ static void ufs_send_query(QUfs *ufs, uint8_t slot, u= int8_t query_function, req_upiu.header.query_func =3D query_function; req_upiu.header.task_tag =3D slot; /* - * QEMU UFS does not currently support Write descriptor and Write attr= ibute, + * QEMU UFS does not currently support Write descriptor, * so the value of data_segment_length is always 0. */ req_upiu.header.data_segment_length =3D 0; req_upiu.qr.opcode =3D query_opcode; req_upiu.qr.idn =3D idn; req_upiu.qr.index =3D index; + req_upiu.qr.selector =3D selector; + req_upiu.qr.value =3D attr_value; + req_upiu.qr.length =3D UFS_QUERY_DESC_MAXLENGTH; qtest_memwrite(ufs->dev.bus->qts, req_upiu_addr, &req_upiu, sizeof(req_upiu)); =20 @@ -344,7 +349,7 @@ static void ufs_init(QUfs *ufs, QGuestAllocator *alloc) /* Set fDeviceInit flag via query request */ ufs_send_query(ufs, 0, UFS_UPIU_QUERY_FUNC_STANDARD_WRITE_REQUEST, UFS_UPIU_QUERY_OPCODE_SET_FLAG, - UFS_QUERY_FLAG_IDN_FDEVICEINIT, 0, &utrd, &rsp_upiu); + UFS_QUERY_FLAG_IDN_FDEVICEINIT, 0, 0, 0, &utrd, &rsp_up= iu); g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), =3D=3D, UFS_OCS_SUC= CESS); =20 /* Wait for device to reset */ @@ -353,7 +358,8 @@ static void ufs_init(QUfs *ufs, QGuestAllocator *alloc) qtest_clock_step(ufs->dev.bus->qts, 100); ufs_send_query(ufs, 0, UFS_UPIU_QUERY_FUNC_STANDARD_READ_REQUEST, UFS_UPIU_QUERY_OPCODE_READ_FLAG, - UFS_QUERY_FLAG_IDN_FDEVICEINIT, 0, &utrd, &rsp_upiu= ); + UFS_QUERY_FLAG_IDN_FDEVICEINIT, 0, 0, 0, &utrd, + &rsp_upiu); } while (be32_to_cpu(rsp_upiu.qr.value) !=3D 0 && g_get_monotonic_time() < end_time); g_assert_cmpuint(be32_to_cpu(rsp_upiu.qr.value), =3D=3D, 0); --=20 2.34.1 From nobody Sun Nov 24 11:13:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=samsung.com ARC-Seal: i=1; a=rsa-sha256; t=1724246147; cv=none; d=zohomail.com; s=zohoarc; b=SvgEqK7S7GOvvtGzh5fcK4HobSAvSEZiFAEAZx01CrM8oLiU2AoSp7AAuF10aRhzsL03aYN79OkqcXmeiYPUPweklHdv3ihnPmzeiIN8DIbA4DRvROJmqA5AYd93s4YYyLo8hF7v5R2bieir1nSmlm/v8PQKUlVELf/NpS16VNI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724246147; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=/jnEXg82krZrCK9RGKVhlkHKL0aHSxH2jLNY8e03PA0=; b=jjdJKBsF7dcyLWjk90kdkl+nC4MRFS7zencq/0obUFImIM9+9gcl85xZ1/7tO8K7zsPf6M+usvWi5mMLTi5eNa8uZ6HRJj7bYh2lquShYkq/skFJTi+1c/n40TRT3/DnvRTUEFsBwz7SYO3tH/8Y4J93ARoDhB7HXv3bh+hG5vg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1724246147527243.2984614526314; Wed, 21 Aug 2024 06:15:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sglAP-0000Pi-S1; Wed, 21 Aug 2024 09:14:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sgbAt-00024v-IO for qemu-devel@nongnu.org; Tue, 20 Aug 2024 22:34:15 -0400 Received: from mailout4.samsung.com ([203.254.224.34]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sgbAo-000789-Pn for qemu-devel@nongnu.org; Tue, 20 Aug 2024 22:34:15 -0400 Received: from epcas1p2.samsung.com (unknown [182.195.41.46]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20240821023405epoutp0479ebd9095d1118374d7d0ab328e8503c~tnbf7N7761606216062epoutp04G for ; Wed, 21 Aug 2024 02:34:05 +0000 (GMT) Received: from epsmges1p4.samsung.com (unknown [182.195.42.56]) by epcas1p2.samsung.com (KnoxPortal) with ESMTP id 20240821023405epcas1p2ef2e059ba13c8207f54837b0c91ed65c~tnbfn-yjX2808428084epcas1p2r; Wed, 21 Aug 2024 02:34:05 +0000 (GMT) Received: from epcas1p3.samsung.com ( [182.195.41.47]) by epsmges1p4.samsung.com (Symantec Messaging Gateway) with SMTP id 8F.49.10258.D1255C66; Wed, 21 Aug 2024 11:34:05 +0900 (KST) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20240821023405epoutp0479ebd9095d1118374d7d0ab328e8503c~tnbf7N7761606216062epoutp04G DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1724207645; bh=/jnEXg82krZrCK9RGKVhlkHKL0aHSxH2jLNY8e03PA0=; h=Subject:Reply-To:From:To:CC:In-Reply-To:Date:References:From; b=EleQdOaS9Vk2oIW9GG3Ipk6+qdBNThsGvb3oH35evvxLC1Chm52EtnBcWgxhz14LS WiJMy62mcsH7BZuwJdd5gmraZs93bUz/NEmoOO+z1HOnDbKpGU+V+uovzWZQ+tdvtY hUxZVyeweObdCdAWkbnDKwwCncdKCQ+D5OzMK0Ak= X-AuditID: b6c32a38-995ff70000002812-30-66c5521de89d Mime-Version: 1.0 Subject: [PATCH 2/4] hw/ufs: ufs flag read/write test implemented From: =?UTF-8?B?7KCV7Jyg7LCs?= To: =?UTF-8?B?6rmA7KCc7Jqx?= CC: =?UTF-8?B?7KCV7Jyg7LCs?= , "thuth@redhat.com" , "lvivier@redhat.com" , "pbonzini@redhat.com" , "qemu-devel@nongnu.org" , "jeongyuchan0629@gmail.com" X-Priority: 3 X-Content-Kind-Code: NORMAL In-Reply-To: <20240821023025epcms1p4de36db95f4d3a66727f128ef6be860e4@epcms1p4> X-Drm-Type: N,general X-Msg-Generator: Mail X-Msg-Type: PERSONAL X-Reply-Demand: N Message-ID: <20240821023405epcms1p5c389077e4d12b814f75a50218ea0dd9f@epcms1p5> Date: Wed, 21 Aug 2024 11:34:05 +0900 X-CMS-MailID: 20240821023405epcms1p5c389077e4d12b814f75a50218ea0dd9f Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" CMS-TYPE: 101P X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrOIsWRmVeSWpSXmKPExsWy7bCmvq5s0NE0g3M7RC16Xu1js7i/9Rqj xacGKYv92/6xWhzv3cFisfKYjcXuszPZHNg9ds66y+7x5NpmJo/3+66yefRtWcUYwBLFZZOS mpNZllqkb5fAlXHhlUjBd+2K99u+sDcwPlHqYuTgkBAwkWh+otbFyMUhJLCDUeJzw3d2kDiv gKDE3x3CXYycHMICjhIXpq1jB7GFBBQkfiy/yQYRt5T4/GQamM0mYC7xftJ1RhBbRMBU4s/3 dSwgM5kFljFJPL45gQkkISHAKzGj/SkLhC0tsX35VrAGTgE/idmfl0HViErcXP2WHcZ+f2w+ I4QtItF67ywzhC0o8eDnbkaI+yUl1r/WhAjXS9y49pgNwq6ReNR2C2qMvsS1jo1ga3kFfCV2 nJoCNoZFQFVixY8pUPUuEt0Lr4HZzALyEtvfzmEGGc8soCmxfpc+RJhP4t3XHlaYT3bMewJ1 sYrEoovvocZISXw9sY4Z4jIPif33nCEhO5VRYuW+fqYJjPKzEIE7C8myWQjLFjAyr2IUSy0o zk1PLTYsMNErTswtLs1L10vOz93ECE4bWhY7GOe+/aB3iJGJg/EQowQHs5IIb/fLg2lCvCmJ lVWpRfnxRaU5qcWHGKU5WJTEec9cKUsVEkhPLEnNTk0tSC2CyTJxcEo1MGXM29dfPLOFY4ln fyljp19QleYGztXKBmET+7juM9wXZLwlt5hB7UuPkXfZycfTOt6c2rg+8uWLH3oi6rE+Nw+c CK/YcbyN//MqNQttiy8farVsOI6KNlXOfyT0YJrcUtZsHnde6Xk3PZbniscom0yx3bfwhatd TkzHOzvlLteqsCW69mVbF+asZns+k1Ntbc1p/kkn9U7yLXZS0sq24em0Vpx/73/Qe6tNK760 9di8EGplOLfxRvcWXe+Xfz6WT358NPhlXmfJ08ovCkrhd74xndhgce9xbuz9p13mwnv35rzf NKtDJkjttZ3Hxn9h7D01UyzmXP1b2VhQJ7BZcM300M4Em5UzNiQte1e1W4mlOCPRUIu5qDgR AF+Uf2mKAwAA X-CMS-RootMailID: 20240821022726epcms1p127d8cd71ca3e1354592de8a4a5c97a10 References: <20240821023025epcms1p4de36db95f4d3a66727f128ef6be860e4@epcms1p4> Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=203.254.224.34; envelope-from=yc01.jeong@samsung.com; helo=mailout4.samsung.com X-Spam_score_int: -45 X-Spam_score: -4.6 X-Spam_bar: ---- X-Spam_report: (-4.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.144, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 21 Aug 2024 09:14:17 -0400 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: yc01.jeong@samsung.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @samsung.com) X-ZM-MESSAGEID: 1724246149601116600 From fa2187660e82e7772c2061b22ba9eab95e92f77c Mon Sep 17 00:00:00 2001 From: Yoochan Jeong Date: Wed, 21 Aug 2024 09:08:18 +0900 Subject: [PATCH 2/4] hw/ufs: ufs flag read/write test implemented New test function "ufstest_flag_request" added, which can check one's virtual UFS device can properly read and write its flag data. It tests if reading, setting, clearing and toggling flags work properly. There are some testcases that are intended to make an error caused by permission issues. Based on: 20240802051902epcms2p319bc095a15eaef8de4e6955f6718371d@epcms2p3 Signed-off-by: Yoochan Jeong --- tests/qtest/ufs-test.c | 81 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/tests/qtest/ufs-test.c b/tests/qtest/ufs-test.c index d70c2ee4a3..f93de9f1f2 100644 --- a/tests/qtest/ufs-test.c +++ b/tests/qtest/ufs-test.c @@ -540,6 +540,86 @@ static void ufstest_read_write(void *obj, void *data, = QGuestAllocator *alloc) ufs_exit(ufs, alloc); } =20 +static void ufstest_flag_request(void *obj, void *data, QGuestAllocator *a= lloc) +{ + QUfs *ufs =3D obj; + + UtpTransferReqDesc utrd; + UtpUpiuRsp rsp_upiu; + ufs_init(ufs, alloc); + + /* Read read-only flag */ + ufs_send_query(ufs, 0, UFS_UPIU_QUERY_FUNC_STANDARD_READ_REQUEST, + UFS_UPIU_QUERY_OPCODE_READ_FLAG, + UFS_QUERY_FLAG_IDN_FDEVICEINIT, 0, 0, 0, &utrd, &rsp_up= iu); + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), =3D=3D, UFS_OCS_SUC= CESS); + g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, UFS_COMMAND_RESULT_= SUCCESS); + g_assert_cmpuint(rsp_upiu.qr.opcode, =3D=3D, UFS_UPIU_QUERY_OPCODE_REA= D_FLAG); + g_assert_cmpuint(rsp_upiu.qr.idn, =3D=3D, UFS_QUERY_FLAG_IDN_FDEVICEIN= IT); + g_assert_cmpuint(rsp_upiu.qr.value, =3D=3D, 0); + + /* Flag Set, Clear, Toggle Test with fDeviceLifeSpanModeEn */ + ufs_send_query(ufs, 0, UFS_UPIU_QUERY_FUNC_STANDARD_READ_REQUEST, + UFS_UPIU_QUERY_OPCODE_READ_FLAG, + UFS_QUERY_FLAG_IDN_LIFE_SPAN_MODE_ENABLE, 0, 0, 0, &utr= d, + &rsp_upiu); + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), =3D=3D, UFS_OCS_SUC= CESS); + g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, UFS_COMMAND_RESULT_= SUCCESS); + g_assert_cmpuint(rsp_upiu.qr.value, =3D=3D, 0); + + ufs_send_query(ufs, 0, UFS_UPIU_QUERY_FUNC_STANDARD_WRITE_REQUEST, + UFS_UPIU_QUERY_OPCODE_SET_FLAG, + UFS_QUERY_FLAG_IDN_LIFE_SPAN_MODE_ENABLE, 0, 0, 0, &utr= d, + &rsp_upiu); + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), =3D=3D, UFS_OCS_SUC= CESS); + g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, UFS_COMMAND_RESULT_= SUCCESS); + g_assert_cmpuint(rsp_upiu.qr.value, =3D=3D, 1); + + ufs_send_query(ufs, 0, UFS_UPIU_QUERY_FUNC_STANDARD_WRITE_REQUEST, + UFS_UPIU_QUERY_OPCODE_CLEAR_FLAG, + UFS_QUERY_FLAG_IDN_LIFE_SPAN_MODE_ENABLE, 0, 0, 0, &utr= d, + &rsp_upiu); + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), =3D=3D, UFS_OCS_SUC= CESS); + g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, UFS_COMMAND_RESULT_= SUCCESS); + g_assert_cmpuint(rsp_upiu.qr.value, =3D=3D, 0); + + ufs_send_query(ufs, 0, UFS_UPIU_QUERY_FUNC_STANDARD_WRITE_REQUEST, + UFS_UPIU_QUERY_OPCODE_TOGGLE_FLAG, + UFS_QUERY_FLAG_IDN_LIFE_SPAN_MODE_ENABLE, 0, 0, 0, &utr= d, + &rsp_upiu); + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), =3D=3D, UFS_OCS_SUC= CESS); + g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, UFS_COMMAND_RESULT_= SUCCESS); + g_assert_cmpuint(rsp_upiu.qr.value, =3D=3D, 1); + + ufs_send_query(ufs, 0, UFS_UPIU_QUERY_FUNC_STANDARD_WRITE_REQUEST, + UFS_UPIU_QUERY_OPCODE_TOGGLE_FLAG, + UFS_QUERY_FLAG_IDN_LIFE_SPAN_MODE_ENABLE, 0, 0, 0, &utr= d, + &rsp_upiu); + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), =3D=3D, UFS_OCS_SUC= CESS); + g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, UFS_COMMAND_RESULT_= SUCCESS); + g_assert_cmpuint(rsp_upiu.qr.value, =3D=3D, 0); + + /* Read Write-only Flag (Intended Failure) */ + ufs_send_query(ufs, 0, UFS_UPIU_QUERY_FUNC_STANDARD_READ_REQUEST, + UFS_UPIU_QUERY_OPCODE_READ_FLAG, + UFS_QUERY_FLAG_IDN_PURGE_ENABLE, 0, 0, 0, &utrd, &rsp_u= piu); + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), =3D=3D, + UFS_OCS_INVALID_CMD_TABLE_ATTR); + g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, + UFS_QUERY_RESULT_NOT_READABLE); + + /* Write Read-Only Flag (Intended Failure) */ + ufs_send_query(ufs, 0, UFS_UPIU_QUERY_FUNC_STANDARD_WRITE_REQUEST, + UFS_UPIU_QUERY_OPCODE_SET_FLAG, UFS_QUERY_FLAG_IDN_BUSY= _RTC, + 0, 0, 0, &utrd, &rsp_upiu); + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), =3D=3D, + UFS_OCS_INVALID_CMD_TABLE_ATTR); + g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, + UFS_QUERY_RESULT_NOT_WRITEABLE); + + ufs_exit(ufs, alloc); +} + static void drive_destroy(void *path) { unlink(path); @@ -607,6 +687,7 @@ static void ufs_register_nodes(void) } qos_add_test("init", "ufs", ufstest_init, NULL); 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); } =20 libqos_init(ufs_register_nodes); --=20 2.34.1 From nobody Sun Nov 24 11:13:04 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=samsung.com ARC-Seal: i=1; a=rsa-sha256; t=1724246148; cv=none; d=zohomail.com; s=zohoarc; b=OybhBimLgX0Qn/xIcR5+8V5YPEdCeDVh5k+bKC3M1sZ78sHPlIdjQsqvd7w80ZYV+V+QYJrFGdTf+XDHuXQbZC0g5fP1GsagbbSQl0b3MInAcCBcmK4amukAJ1qZpgiLHxZJdFWW2UFhYUDsaPTcr3CfaNifWaja6lf3A9O4tG8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724246148; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=oK9TosyU+tU+v44bqNhWkIMGnuXQSQIIajL48CtDwaM=; b=g6X2pltNXbMW3Lg6wUSVKbG4sWK9gVdehRcTdDCrtmF4j329NFotDI96mELegOqmg+eDdX1eXy/qZ6Zs74L3YaIn344JidUDIW+oz9S2OVzJJd2HdO6/XqK1oTIIdGGCvLl6rJ7J/J/7pmp4fxRopsFUWwp54DEoPo2HwMeks2E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1724246148058678.7561825323831; Wed, 21 Aug 2024 06:15:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sglAY-0000vS-7q; Wed, 21 Aug 2024 09:14:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sgbBk-0002NC-RF for qemu-devel@nongnu.org; Tue, 20 Aug 2024 22:35:09 -0400 Received: from mailout3.samsung.com ([203.254.224.33]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sgbBh-0007OL-Ny for qemu-devel@nongnu.org; Tue, 20 Aug 2024 22:35:08 -0400 Received: from epcas1p2.samsung.com (unknown [182.195.41.46]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20240821023502epoutp03d6eb5ad5a0fdc3df4e2437d12f4c3f8d~tncUdZnef0325603256epoutp03A for ; Wed, 21 Aug 2024 02:35:02 +0000 (GMT) Received: from epsmgec1p1.samsung.com (unknown [182.195.42.51]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20240821023501epcas1p1da5a0ee714be3a9042b128dd5513588a~tncUKRf-X0575805758epcas1p1k; Wed, 21 Aug 2024 02:35:01 +0000 (GMT) Received: from epcas1p2.samsung.com ( [182.195.41.46]) by epsmgec1p1.samsung.com (Symantec Messaging Gateway) with SMTP id CE.94.08992.55255C66; Wed, 21 Aug 2024 11:35:01 +0900 (KST) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20240821023502epoutp03d6eb5ad5a0fdc3df4e2437d12f4c3f8d~tncUdZnef0325603256epoutp03A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1724207702; bh=oK9TosyU+tU+v44bqNhWkIMGnuXQSQIIajL48CtDwaM=; h=Subject:Reply-To:From:To:CC:In-Reply-To:Date:References:From; b=UG6K/Jtv78FQXfYD+sfRBewf9rlk0aU8+a7GlkLCA68mF0wH7bld3sN1krV+cUKBo gvdxOCCN6wc6HhQtLf0Yj9EIMTnNtlpYXcfUkRmxqyiFZSMkqT0XFGmIJlkcWMYeek v+Rtj5prPJ/kJNLdQEUwle13b0yxUmOTfKW54bhw= X-AuditID: b6c32a33-faa0ca8000002320-44-66c552551175 Mime-Version: 1.0 Subject: [PATCH 3/4] hw/ufs: ufs attribute read/write test implemented From: =?UTF-8?B?7KCV7Jyg7LCs?= To: =?UTF-8?B?6rmA7KCc7Jqx?= CC: =?UTF-8?B?7KCV7Jyg7LCs?= , "thuth@redhat.com" , "lvivier@redhat.com" , "pbonzini@redhat.com" , "qemu-devel@nongnu.org" , "jeongyuchan0629@gmail.com" X-Priority: 3 X-Content-Kind-Code: NORMAL In-Reply-To: <20240821023025epcms1p4de36db95f4d3a66727f128ef6be860e4@epcms1p4> X-Drm-Type: N,general X-Msg-Generator: Mail X-Msg-Type: PERSONAL X-Reply-Demand: N Message-ID: <20240821023501epcms1p1af3e6eb45517d1a1526b32f44c9bc355@epcms1p1> Date: Wed, 21 Aug 2024 11:35:01 +0900 X-CMS-MailID: 20240821023501epcms1p1af3e6eb45517d1a1526b32f44c9bc355 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" CMS-TYPE: 101P X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrOIsWRmVeSWpSXmKPExsWy7bCmnm5o0NE0g7aL+hY9r/axWdzfeo3R 4lODlMX+bf9YLY737mCxWHnMxmL32ZlsDuweO2fdZfd4cm0zk8f7fVfZPPq2rGIMYInisklJ zcksSy3St0vgyjj0ZSZrwZ6Qiqlvz7A1MH506mLk5JAQMJF4+PAqexcjF4eQwA5GiRcfLzJ1 MXJw8AoISvzdIQxSIyzgJrFq83sWEFtIQEHix/KbbBBxS4nPT6aB2WwC5hLvJ11nBLFFBEwl /nxfxwIyk1lgGZPE45sTmCCW8UrMaH/KAmFLS2xfvhWsgVPAT2L252VQNaISN1e/ZYex3x+b zwhhi0i03jvLDGELSjz4uZsR5E4JAUmJ9a81IcL1EjeuPWaDsGskHrXdghqjL3GtYyMLxFu+ Eis7WUHCLAKqEltbu6DKXSTOvb8ENp1ZQF5i+9s5zCDlzAKaEut36UOE+STefe1hhXlkx7wn UAerSCy6+B5qjJTE1xPrmCEO85DYf88ZEmhTGSW2fimcwCg/CxG0s5DsmoWwawEj8ypGsdSC 4tz01GTDAkO94sTc4tK8dL3k/NxNjOC0oWW8g/Hy/H96hxiZOBgPMUpwMCuJ8Ha/PJgmxJuS WFmVWpQfX1Sak1p8iFGag0VJnPfMlbJUIYH0xJLU7NTUgtQimCwTB6dUA9NyDjPLFfsOvnm6 eHeGhDHvzUYvXiaRc5uv7fBc/H6VUUjXX/HFiWJ2mQlvg+pdM780eF//8FH2+vTGxm/qqzOW K23/IHHQReVr+5fTkx9arjYw01wgwHducviBaaul3yfcyLrNKP3kaL/4z6sqO/ce7/JIWtzz 1SP/rlqE8l33Z1oLWU/IXj9fUGC4asutyIcaE94fjN/xJIu1q79hzxuF7PK+tJC3bH5ZDbzK 1RlVm05x2p/cueiHzoVFt05dVvz2Rd5msrOPmtnD9LxbC0/+/FbFW5+9KC/Ht3HfhXNtXKcj mPzcAsUmiS4/vPH0gsgK740Rsxp8LzgKmwRN1nn947fHLOeFL8wDm89vURZTYinOSDTUYi4q TgQAtsCL1YoDAAA= X-CMS-RootMailID: 20240821022726epcms1p127d8cd71ca3e1354592de8a4a5c97a10 References: <20240821023025epcms1p4de36db95f4d3a66727f128ef6be860e4@epcms1p4> Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=203.254.224.33; envelope-from=yc01.jeong@samsung.com; helo=mailout3.samsung.com X-Spam_score_int: -45 X-Spam_score: -4.6 X-Spam_bar: ---- X-Spam_report: (-4.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.144, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 21 Aug 2024 09:14:17 -0400 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: yc01.jeong@samsung.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @samsung.com) X-ZM-MESSAGEID: 1724246149408116600 From 3341c347a70783c5e60a963501e63cb5da8f2e1f Mon Sep 17 00:00:00 2001 From: Yoochan Jeong Date: Wed, 21 Aug 2024 09:09:32 +0900 Subject: [PATCH 3/4] hw/ufs: ufs attribute read/write test implemented New test function "ufstest_attr_request" added, which can check one's virtual UFS device can properly read and write its attribute data. It tests if reading and writing attributes work properly. There are some testcases that are intended to make an error caused by writing an invalid value, allocating an invalid selector and permission issues. Based on: 20240802051902epcms2p319bc095a15eaef8de4e6955f6718371d@epcms2p3 Signed-off-by: Yoochan Jeong --- tests/qtest/ufs-test.c | 166 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 166 insertions(+) diff --git a/tests/qtest/ufs-test.c b/tests/qtest/ufs-test.c index f93de9f1f2..a8fd2f1acc 100644 --- a/tests/qtest/ufs-test.c +++ b/tests/qtest/ufs-test.c @@ -620,6 +620,171 @@ static void ufstest_flag_request(void *obj, void *dat= a, QGuestAllocator *alloc) ufs_exit(ufs, alloc); } =20 +static void ufstest_attr_request(void *obj, void *data, QGuestAllocator *a= lloc) +{ + QUfs *ufs =3D obj; + + UtpTransferReqDesc utrd; + UtpUpiuRsp rsp_upiu; + ufs_init(ufs, alloc); + + /* Read Readable Attributes*/ + ufs_send_query(ufs, 0, UFS_UPIU_QUERY_FUNC_STANDARD_READ_REQUEST, + UFS_UPIU_QUERY_OPCODE_READ_ATTR, + UFS_QUERY_ATTR_IDN_BOOT_LU_EN, 0, 0, 0, &utrd, &rsp_upi= u); + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), =3D=3D, UFS_OCS_SUC= CESS); + g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, UFS_COMMAND_RESULT_= SUCCESS); + g_assert_cmpuint(rsp_upiu.qr.opcode, =3D=3D, UFS_UPIU_QUERY_OPCODE_REA= D_ATTR); + g_assert_cmpuint(rsp_upiu.qr.idn, =3D=3D, UFS_QUERY_ATTR_IDN_BOOT_LU_E= N); + g_assert_cmpuint(rsp_upiu.qr.value, =3D=3D, cpu_to_be32(0x00)); + + ufs_send_query(ufs, 0, UFS_UPIU_QUERY_FUNC_STANDARD_READ_REQUEST, + UFS_UPIU_QUERY_OPCODE_READ_ATTR, + UFS_QUERY_ATTR_IDN_BKOPS_STATUS, 0, 0, 0, &utrd, &rsp_u= piu); + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), =3D=3D, UFS_OCS_SUC= CESS); + g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, UFS_COMMAND_RESULT_= SUCCESS); + g_assert_cmpuint(rsp_upiu.qr.value, =3D=3D, cpu_to_be32(0x00)); + + /* Write Writable Attributes & Read Again */ + ufs_send_query(ufs, 0, UFS_UPIU_QUERY_FUNC_STANDARD_WRITE_REQUEST, + UFS_UPIU_QUERY_OPCODE_WRITE_ATTR, + UFS_QUERY_ATTR_IDN_ACTIVE_ICC_LVL, 0, 0, 0x03, &utrd, + &rsp_upiu); + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), =3D=3D, UFS_OCS_SUC= CESS); + g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, UFS_COMMAND_RESULT_= SUCCESS); + g_assert_cmpuint(rsp_upiu.qr.value, =3D=3D, cpu_to_be32(0x03)); + + ufs_send_query(ufs, 0, UFS_UPIU_QUERY_FUNC_STANDARD_WRITE_REQUEST, + UFS_UPIU_QUERY_OPCODE_WRITE_ATTR, + UFS_QUERY_ATTR_IDN_EE_CONTROL, 0, 0, 0x07, &utrd, &rsp_= upiu); + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), =3D=3D, UFS_OCS_SUC= CESS); + g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, UFS_COMMAND_RESULT_= SUCCESS); + g_assert_cmpuint(rsp_upiu.qr.value, =3D=3D, cpu_to_be32(0x07)); + + ufs_send_query(ufs, 0, UFS_UPIU_QUERY_FUNC_STANDARD_READ_REQUEST, + UFS_UPIU_QUERY_OPCODE_READ_ATTR, + UFS_QUERY_ATTR_IDN_ACTIVE_ICC_LVL, 0, 0, 0, &utrd, + &rsp_upiu); + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), =3D=3D, UFS_OCS_SUC= CESS); + g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, UFS_COMMAND_RESULT_= SUCCESS); + g_assert_cmpuint(rsp_upiu.qr.value, =3D=3D, cpu_to_be32(0x03)); + + ufs_send_query(ufs, 0, UFS_UPIU_QUERY_FUNC_STANDARD_READ_REQUEST, + UFS_UPIU_QUERY_OPCODE_READ_ATTR, + UFS_QUERY_ATTR_IDN_EE_CONTROL, 0, 0, 0, &utrd, &rsp_upi= u); + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), =3D=3D, UFS_OCS_SUC= CESS); + g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, UFS_COMMAND_RESULT_= SUCCESS); + g_assert_cmpuint(rsp_upiu.qr.value, =3D=3D, cpu_to_be32(0x07)); + + /* Write Invalid Value (Intended Error) */ + ufs_send_query(ufs, 0, UFS_UPIU_QUERY_FUNC_STANDARD_WRITE_REQUEST, + UFS_UPIU_QUERY_OPCODE_WRITE_ATTR, + UFS_QUERY_ATTR_IDN_ACTIVE_ICC_LVL, 0, 0, 0x10, &utrd, + &rsp_upiu); + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), =3D=3D, + UFS_OCS_INVALID_CMD_TABLE_ATTR); + g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, + UFS_QUERY_RESULT_INVALID_VALUE); + + ufs_send_query(ufs, 0, UFS_UPIU_QUERY_FUNC_STANDARD_READ_REQUEST, + UFS_UPIU_QUERY_OPCODE_READ_ATTR, + UFS_QUERY_ATTR_IDN_ACTIVE_ICC_LVL, 0, 0, 0, &utrd, + &rsp_upiu); + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), =3D=3D, UFS_OCS_SUC= CESS); + g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, UFS_COMMAND_RESULT_= SUCCESS); + g_assert_cmpuint(rsp_upiu.qr.value, =3D=3D, cpu_to_be32(0x03)); + + ufs_send_query(ufs, 0, UFS_UPIU_QUERY_FUNC_STANDARD_WRITE_REQUEST, + UFS_UPIU_QUERY_OPCODE_WRITE_ATTR, + UFS_QUERY_ATTR_IDN_CNTX_CONF, 0, 15, 0x10, &utrd, &rsp_= upiu); + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), =3D=3D, + UFS_OCS_INVALID_CMD_TABLE_ATTR); + g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, + UFS_QUERY_RESULT_INVALID_VALUE); + + ufs_send_query(ufs, 0, UFS_UPIU_QUERY_FUNC_STANDARD_READ_REQUEST, + UFS_UPIU_QUERY_OPCODE_READ_ATTR, + UFS_QUERY_ATTR_IDN_CNTX_CONF, 0, 15, 0, &utrd, &rsp_upi= u); + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), =3D=3D, UFS_OCS_SUC= CESS); + g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, UFS_COMMAND_RESULT_= SUCCESS); + g_assert_cmpuint(rsp_upiu.qr.value, =3D=3D, cpu_to_be32(0x00)); + + /* Read Write-Only Attribute (Intended Error) */ + ufs_send_query(ufs, 0, UFS_UPIU_QUERY_FUNC_STANDARD_READ_REQUEST, + UFS_UPIU_QUERY_OPCODE_READ_ATTR, + UFS_QUERY_ATTR_IDN_SECONDS_PASSED, 0, 0, 0, &utrd, + &rsp_upiu); + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), =3D=3D, + UFS_OCS_INVALID_CMD_TABLE_ATTR); + g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, + UFS_QUERY_RESULT_NOT_READABLE); + + /* Write Read-Only Attribute (Intended Error) */ + ufs_send_query(ufs, 0, UFS_UPIU_QUERY_FUNC_STANDARD_WRITE_REQUEST, + UFS_UPIU_QUERY_OPCODE_WRITE_ATTR, + UFS_QUERY_ATTR_IDN_POWER_MODE, 0, 0, 0x01, &utrd, &rsp_= upiu); + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), =3D=3D, + UFS_OCS_INVALID_CMD_TABLE_ATTR); + g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, + UFS_QUERY_RESULT_NOT_WRITEABLE); + + ufs_send_query(ufs, 0, UFS_UPIU_QUERY_FUNC_STANDARD_READ_REQUEST, + UFS_UPIU_QUERY_OPCODE_READ_ATTR, + UFS_QUERY_ATTR_IDN_POWER_MODE, 0, 0, 0, &utrd, &rsp_upi= u); + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), =3D=3D, UFS_OCS_SUC= CESS); + g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, UFS_COMMAND_RESULT_= SUCCESS); + g_assert_cmpuint(rsp_upiu.qr.value, =3D=3D, cpu_to_be32(0x00)); + + /* Invalid Selector (Intended Error)*/ + ufs_send_query(ufs, 0, UFS_UPIU_QUERY_FUNC_STANDARD_WRITE_REQUEST, + UFS_UPIU_QUERY_OPCODE_WRITE_ATTR, + UFS_QUERY_ATTR_IDN_CNTX_CONF, 0, 16, 0, &utrd, &rsp_upi= u); + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), =3D=3D, + UFS_OCS_INVALID_CMD_TABLE_ATTR); + g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, + UFS_QUERY_RESULT_INVALID_SELECTOR); + + ufs_send_query(ufs, 0, UFS_UPIU_QUERY_FUNC_STANDARD_READ_REQUEST, + UFS_UPIU_QUERY_OPCODE_READ_ATTR, + UFS_QUERY_ATTR_IDN_CNTX_CONF, 0, 15, 0, &utrd, &rsp_upi= u); + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), =3D=3D, UFS_OCS_SUC= CESS); + g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, UFS_COMMAND_RESULT_= SUCCESS); + g_assert_cmpuint(rsp_upiu.qr.value, =3D=3D, cpu_to_be32(0x00)); + + /* Reset Written Attributes */ + ufs_send_query(ufs, 0, UFS_UPIU_QUERY_FUNC_STANDARD_WRITE_REQUEST, + UFS_UPIU_QUERY_OPCODE_WRITE_ATTR, + UFS_QUERY_ATTR_IDN_ACTIVE_ICC_LVL, 0, 0, 0, &utrd, + &rsp_upiu); + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), =3D=3D, UFS_OCS_SUC= CESS); + g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, UFS_COMMAND_RESULT_= SUCCESS); + g_assert_cmpuint(rsp_upiu.qr.value, =3D=3D, cpu_to_be32(0x00)); + + ufs_send_query(ufs, 0, UFS_UPIU_QUERY_FUNC_STANDARD_WRITE_REQUEST, + UFS_UPIU_QUERY_OPCODE_WRITE_ATTR, + UFS_QUERY_ATTR_IDN_EE_CONTROL, 0, 0, 0, &utrd, &rsp_upi= u); + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), =3D=3D, UFS_OCS_SUC= CESS); + g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, UFS_COMMAND_RESULT_= SUCCESS); + g_assert_cmpuint(rsp_upiu.qr.value, =3D=3D, cpu_to_be32(0x00)); + + ufs_send_query(ufs, 0, UFS_UPIU_QUERY_FUNC_STANDARD_READ_REQUEST, + UFS_UPIU_QUERY_OPCODE_READ_ATTR, + UFS_QUERY_ATTR_IDN_ACTIVE_ICC_LVL, 0, 0, 0, &utrd, + &rsp_upiu); + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), =3D=3D, UFS_OCS_SUC= CESS); + g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, UFS_COMMAND_RESULT_= SUCCESS); + g_assert_cmpuint(rsp_upiu.qr.value, =3D=3D, cpu_to_be32(0x00)); + + ufs_send_query(ufs, 0, UFS_UPIU_QUERY_FUNC_STANDARD_READ_REQUEST, + UFS_UPIU_QUERY_OPCODE_READ_ATTR, + UFS_QUERY_ATTR_IDN_EE_CONTROL, 0, 0, 0, &utrd, &rsp_upi= u); + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), =3D=3D, UFS_OCS_SUC= CESS); + g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, UFS_COMMAND_RESULT_= SUCCESS); + g_assert_cmpuint(rsp_upiu.qr.value, =3D=3D, cpu_to_be32(0x00)); + + ufs_exit(ufs, alloc); +} + static void drive_destroy(void *path) { unlink(path); @@ -688,6 +853,7 @@ static void ufs_register_nodes(void) qos_add_test("init", "ufs", ufstest_init, NULL); 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); } =20 libqos_init(ufs_register_nodes); --=20 2.34.1 From nobody Sun Nov 24 11:13:04 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=samsung.com ARC-Seal: i=1; a=rsa-sha256; t=1724290841; cv=none; d=zohomail.com; s=zohoarc; b=Wfk8POa7fWdYuMqcUkoF4Ytgt2pWvazAr4fzJng/abXs7/nYlamgZX/L7dbP3ylSmQZ08/hCMHbssoCllTAv3iN8z86zgzWL9hXViomFAnJ5NZVqx7s/876dbv55kDqjRswR0l9p6LvOQ8B2NDp0eg88zGKhzrUGWG/20brfWIE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724290841; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=VFXEaE2dL7KYMZX+iDb1LbxR+rtVsZ64x/tLWMXLtvo=; b=ZRMWEjPSKrwTRUvG7FzdvRomY3uameXAGg3/348NW/PFBN/7t9Ul1+OegKfCcCrRONb4KrlzEDN8VD+dYNH3tFkcy/lS76b1GXWBoi7Pp3IfjfsW1Qc5c1X6pjKg8deDAanqXkZZmRtDo54JjHO31q+Gw8tMzZ9P1ZPtGKNVYJk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1724290841308890.5806068375604; Wed, 21 Aug 2024 18:40:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sgwnd-0005Fr-Jb; Wed, 21 Aug 2024 21:39:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sgwnb-0005FO-MJ for qemu-devel@nongnu.org; Wed, 21 Aug 2024 21:39:39 -0400 Received: from mailout4.samsung.com ([203.254.224.34]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sgwnY-0006Cv-6z for qemu-devel@nongnu.org; Wed, 21 Aug 2024 21:39:39 -0400 Received: from epcas1p4.samsung.com (unknown [182.195.41.48]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20240822013926epoutp04a67568b32a24a8d38ac5a6506729eb6e~t6VES7RMM1176511765epoutp042 for ; Thu, 22 Aug 2024 01:39:26 +0000 (GMT) Received: from epsmges1p1.samsung.com (unknown [182.195.42.53]) by epcas1p2.samsung.com (KnoxPortal) with ESMTP id 20240822013926epcas1p2d7ea087cadf907a92117c6e008983541~t6VECIGWL0603406034epcas1p23; Thu, 22 Aug 2024 01:39:26 +0000 (GMT) Received: from epcas1p1.samsung.com ( [182.195.41.45]) by epsmges1p1.samsung.com (Symantec Messaging Gateway) with SMTP id 80.9A.09734.EC696C66; Thu, 22 Aug 2024 10:39:26 +0900 (KST) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20240822013926epoutp04a67568b32a24a8d38ac5a6506729eb6e~t6VES7RMM1176511765epoutp042 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1724290766; bh=VFXEaE2dL7KYMZX+iDb1LbxR+rtVsZ64x/tLWMXLtvo=; h=Subject:Reply-To:From:To:CC:In-Reply-To:Date:References:From; b=eH6MlDi1G9WZcGKHUSraPUgLZvxO6/sllNg7Pf5s1QGOE0la8ehaFslF11OAe2OUd zU1Urg+H7xMTeiCzPtCYU8U+v7Ppd8X6nAeHE93ggL4qDdERbHrlGABnXj1LASt2PY xCQO1VcTf60MIy3V7X+7S1Un9Rqi4fdAEDB7TMHQ= X-AuditID: b6c32a35-c03b870000002606-62-66c696ce3fa8 Mime-Version: 1.0 Subject: [PATCH 4/4] hw/ufs: ufs descriptor read test implemented From: Yoochan Jeong To: Jeuk Kim CC: Yoochan Jeong , "thuth@redhat.com" , "lvivier@redhat.com" , "pbonzini@redhat.com" , "qemu-devel@nongnu.org" , "jeongyuchan0629@gmail.com" X-Priority: 3 X-Content-Kind-Code: NORMAL In-Reply-To: <20240821023025epcms1p4de36db95f4d3a66727f128ef6be860e4@epcms1p4> X-Drm-Type: N,general X-Msg-Generator: Mail X-Msg-Type: PERSONAL X-Reply-Demand: N Message-ID: <20240822013925epcms1p112662453b1f4dcef8bc1e2f101bb6e6a@epcms1p1> Date: Thu, 22 Aug 2024 10:39:25 +0900 X-CMS-MailID: 20240822013925epcms1p112662453b1f4dcef8bc1e2f101bb6e6a Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" CMS-TYPE: 101P X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrGIsWRmVeSWpSXmKPExsWy7bCmru65acfSDCZPFbLoebWPzeL+1muM Fp8apCz2b/vHanG8dweLxcpjNha7z85kc2D32DnrLrvHk2ubmTze77vK5tG3ZRVjAEsUl01K ak5mWWqRvl0CV8bkTzsZCyYFVjyf+Jy5gfG6YxcjB4eEgInE3EcKXYxcHEICOxglprT8ZQKJ 8woISvzdIdzFyMkhLOAo8afrMjuILSSgIPFj+U02iLiexOa1M9lAytkEdCQafjqAhEUEVCVe Ld7EAjKSWWA2k8SOk9MYQRISArwSM9qfskDY0hLbl28Fi3MK+EnM/ryMCSIuKnFz9Vt2GPv9 sflQvSISrffOMkPYghIPfu5mhDhfUmL9a02IcL3EjWuP2SDsGolHbbegxuhLXOvYCLaWV8BX YuGEn2BxFqA7rz79A7XWReLs8d1gq5gF5CW2v53DDDKeWUBTYv0ufYgwn8S7rz2sMJ/smPcE qlVFYtHF91BrpSS+nljHDHGZh8T+e86QQJvKKLH1S+EERvlZiKCdhWTXLIRdCxiZVzGKpRYU 56anFhsWGOoVJ+YWl+al6yXn525iBCcNLdMdjBPfftA7xMjEwXiIUYKDWUmEN+ne0TQh3pTE yqrUovz4otKc1OJDjNIcLErivGeulKUKCaQnlqRmp6YWpBbBZJk4OKUamLyneKkv+qMjPbP3 6eMp3Le3Fhb9qfGd73l+geAc4xuM1enrcx0caxO63/5YsbjY/0D/6paLpttUWl/3qkbYrRKz jz1++P7qF599smYfflBw/edUq0zdvIsZLyfv7p7zQ9h38en3tS7zXzgJVn6azWJ8RIFv+wYT 6a8HmcJtBdlqzrQezp31ds5P59XKd68GnJ54MVePb7q3w3Yu/X/N020fpmWf/VX9JKMwcP+9 Q8Unly7c6Mn0dFLsQW3jSHG+Z++WnIiekLpPRvP4lZ2zN+89df+8vefleK4c4Vli32x8chVW 6EwKv7triexnNvmaG09/sfm5yPvOadllsWN7fktANK+Bh7xkh2SwtPbsqJ9KLMUZiYZazEXF iQAZhwWuiQMAAA== X-CMS-RootMailID: 20240821022726epcms1p127d8cd71ca3e1354592de8a4a5c97a10 References: <20240821023025epcms1p4de36db95f4d3a66727f128ef6be860e4@epcms1p4> Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=203.254.224.34; envelope-from=yc01.jeong@samsung.com; helo=mailout4.samsung.com X-Spam_score_int: -44 X-Spam_score: -4.5 X-Spam_bar: ---- X-Spam_report: (-4.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.138, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: yc01.jeong@samsung.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @samsung.com) X-ZM-MESSAGEID: 1724290843201116600 From 936ef0a907bcf16809f9980c2d37e8fcb13697d2 Mon Sep 17 00:00:00 2001 From: Yoochan Jeong Date: Wed, 21 Aug 2024 09:09:54 +0900 Subject: [PATCH 4/4] hw/ufs: ufs descriptor read test implemented 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 --- 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 *dat= a, QGuestAllocator *alloc) ufs_exit(ufs, alloc); } =20 +static void ufstest_desc_request(void *obj, void *data, QGuestAllocator *a= lloc) +{ + QUfs *ufs =3D 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_DEV= ICE, + 0, 0, 0, &utrd, &rsp_upiu); + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), =3D=3D, UFS_OCS_SUC= CESS); + g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, UFS_COMMAND_RESULT_= SUCCESS); + g_assert_cmpuint(rsp_upiu.qr.opcode, =3D=3D, UFS_UPIU_QUERY_OPCODE_REA= D_DESC); + g_assert_cmpuint(rsp_upiu.qr.idn, =3D=3D, UFS_QUERY_DESC_IDN_DEVICE); + g_assert_cmpuint(rsp_upiu.qr.data[0], =3D=3D, sizeof(DeviceDescriptor)= ); + g_assert_cmpuint(rsp_upiu.qr.data[1], =3D=3D, UFS_QUERY_DESC_IDN_DEVIC= E); + + /* 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_UNI= T, 0, + 0, 0, &utrd, &rsp_upiu); + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), =3D=3D, UFS_OCS_SUC= CESS); + g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, UFS_COMMAND_RESULT_= SUCCESS); + g_assert_cmpuint(rsp_upiu.qr.data[0], =3D=3D, sizeof(UnitDescriptor)); + g_assert_cmpuint(rsp_upiu.qr.data[1], =3D=3D, UFS_QUERY_DESC_IDN_UNIT); + g_assert_cmpuint(rsp_upiu.qr.data[2], =3D=3D, 0); + + ufs_send_query(ufs, 0, UFS_UPIU_QUERY_FUNC_STANDARD_READ_REQUEST, + UFS_UPIU_QUERY_OPCODE_READ_DESC, UFS_QUERY_DESC_IDN_UNI= T, 1, + 0, 0, &utrd, &rsp_upiu); + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), =3D=3D, UFS_OCS_SUC= CESS); + g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, UFS_COMMAND_RESULT_= SUCCESS); + g_assert_cmpuint(rsp_upiu.qr.data[0], =3D=3D, sizeof(UnitDescriptor)); + g_assert_cmpuint(rsp_upiu.qr.data[1], =3D=3D, UFS_QUERY_DESC_IDN_UNIT); + g_assert_cmpuint(rsp_upiu.qr.data[2], =3D=3D, 1); + + ufs_send_query(ufs, 0, UFS_UPIU_QUERY_FUNC_STANDARD_READ_REQUEST, + UFS_UPIU_QUERY_OPCODE_READ_DESC, UFS_QUERY_DESC_IDN_UNI= T, + UFS_UPIU_RPMB_WLUN, 0, 0, &utrd, &rsp_upiu); + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), =3D=3D, UFS_OCS_SUC= CESS); + g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, UFS_COMMAND_RESULT_= SUCCESS); + g_assert_cmpuint(rsp_upiu.qr.data[0], =3D=3D, sizeof(RpmbUnitDescripto= r)); + g_assert_cmpuint(rsp_upiu.qr.data[1], =3D=3D, UFS_QUERY_DESC_IDN_UNIT); + g_assert_cmpuint(rsp_upiu.qr.data[2], =3D=3D, 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_u= piu); + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), =3D=3D, UFS_OCS_SUC= CESS); + g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, UFS_COMMAND_RESULT_= SUCCESS); + g_assert_cmpuint(rsp_upiu.qr.data[0], =3D=3D, sizeof(InterconnectDescr= iptor)); + g_assert_cmpuint(rsp_upiu.qr.data[1], =3D=3D, UFS_QUERY_DESC_IDN_INTER= CONNECT); + g_assert_cmpuint(rsp_upiu.qr.data[2], =3D=3D, 0x01); + g_assert_cmpuint(rsp_upiu.qr.data[3], =3D=3D, 0x80); + g_assert_cmpuint(rsp_upiu.qr.data[4], =3D=3D, 0x04); + g_assert_cmpuint(rsp_upiu.qr.data[5], =3D=3D, 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_STR= ING, + 0, 0, 0, &utrd, &rsp_upiu); + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), =3D=3D, UFS_OCS_SUC= CESS); + g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, UFS_COMMAND_RESULT_= SUCCESS); + g_assert_cmpuint(rsp_upiu.qr.data[0], =3D=3D, 0x12); + g_assert_cmpuint(rsp_upiu.qr.data[1], =3D=3D, UFS_QUERY_DESC_IDN_STRIN= G); + + ufs_send_query(ufs, 0, UFS_UPIU_QUERY_FUNC_STANDARD_READ_REQUEST, + UFS_UPIU_QUERY_OPCODE_READ_DESC, UFS_QUERY_DESC_IDN_STR= ING, + 1, 0, 0, &utrd, &rsp_upiu); + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), =3D=3D, UFS_OCS_SUC= CESS); + g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, UFS_COMMAND_RESULT_= SUCCESS); + g_assert_cmpuint(rsp_upiu.qr.data[0], =3D=3D, 0x22); + g_assert_cmpuint(rsp_upiu.qr.data[1], =3D=3D, UFS_QUERY_DESC_IDN_STRIN= G); + + ufs_send_query(ufs, 0, UFS_UPIU_QUERY_FUNC_STANDARD_READ_REQUEST, + UFS_UPIU_QUERY_OPCODE_READ_DESC, UFS_QUERY_DESC_IDN_STR= ING, + 4, 0, 0, &utrd, &rsp_upiu); + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), =3D=3D, UFS_OCS_SUC= CESS); + g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, UFS_COMMAND_RESULT_= SUCCESS); + g_assert_cmpuint(rsp_upiu.qr.data[0], =3D=3D, 0x0a); + g_assert_cmpuint(rsp_upiu.qr.data[1], =3D=3D, UFS_QUERY_DESC_IDN_STRIN= G); + + /* 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_GEO= METRY, + 0, 0, 0, &utrd, &rsp_upiu); + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), =3D=3D, UFS_OCS_SUC= CESS); + g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, UFS_COMMAND_RESULT_= SUCCESS); + g_assert_cmpuint(rsp_upiu.qr.data[0], =3D=3D, sizeof(GeometryDescripto= r)); + g_assert_cmpuint(rsp_upiu.qr.data[1], =3D=3D, UFS_QUERY_DESC_IDN_GEOME= TRY); + + /* 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_POW= ER, 0, + 0, 0, &utrd, &rsp_upiu); + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), =3D=3D, UFS_OCS_SUC= CESS); + g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, UFS_COMMAND_RESULT_= SUCCESS); + g_assert_cmpuint(rsp_upiu.qr.data[0], =3D=3D, + sizeof(PowerParametersDescriptor)); + g_assert_cmpuint(rsp_upiu.qr.data[1], =3D=3D, 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_HEA= LTH, + 0, 0, 0, &utrd, &rsp_upiu); + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), =3D=3D, UFS_OCS_SUC= CESS); + g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, UFS_COMMAND_RESULT_= SUCCESS); + g_assert_cmpuint(rsp_upiu.qr.data[0], =3D=3D, sizeof(DeviceHealthDescr= iptor)); + g_assert_cmpuint(rsp_upiu.qr.data[1], =3D=3D, UFS_QUERY_DESC_IDN_HEALT= H); + + /* 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_UNI= T, 4, + 0, 0, &utrd, &rsp_upiu); + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), =3D=3D, + UFS_OCS_INVALID_CMD_TABLE_ATTR); + g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, + 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_STR= ING, + 5, 0, 0, &utrd, &rsp_upiu); + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), =3D=3D, + UFS_OCS_INVALID_CMD_TABLE_ATTR); + g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, + 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_DEV= ICE, + 0, 1, 0, &utrd, &rsp_upiu); + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), =3D=3D, + UFS_OCS_INVALID_CMD_TABLE_ATTR); + g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, + 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_STR= ING, + 0, 1, 0, &utrd, &rsp_upiu); + g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), =3D=3D, + UFS_OCS_INVALID_CMD_TABLE_ATTR); + g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, + 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); } =20 libqos_init(ufs_register_nodes); --=20 2.34.1