From nobody Mon Nov 23 04:36:02 2026 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=1794578322; cv=none; d=zohomail.com; s=zohoarc; b=W2kC3xNA23WCbGj6h3moVUat5GqI/oPN9bshG81jmFiLyppA8fljSBxHupMrqCuRAG2aZ8LF/CyJOA4KK3T5R55U5of+0Xiyu+9UAGgfedHJdDq8CRkWZz95SStUz0cu7oI13P+sktxt3M0PfBGPWkf7Ax7PZzGgHFN08c5hHaA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794578322; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Sender:Subject:Subject:To:To:Message-Id; bh=iCmQpHxQ1PfRl+LfLZjoMP+ssjAoTsUJWXZSBPrEbds=; b=G/wxLJHXtIn+TMWLM5/OaEgrzMYsyG7cXsqct61sWhRWV2Ot4Pb7ElUjBJX6WMwN1Z/W1jpRQoropoSmKDExwOHOLK10Hh04FufcRNDTtIqfcQ6yE/YV9JIpqyh2PIZnpV0VvF6Vs6Kqzgux+gqZ1SE30wwQIfCl4V8ZYXm2dkI= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794578321996610.0172412051245; Fri, 13 Nov 2026 05:58:41 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xRrj6-0000zL-E8; Fri, 13 Nov 2026 08:54:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xRioy-00005Y-RK for qemu-devel@nongnu.org; Thu, 12 Nov 2026 23:23:28 -0500 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 1xRiou-0006pT-UJ for qemu-devel@nongnu.org; Thu, 12 Nov 2026 23:23:28 -0500 Received: from epcas2p3.samsung.com (unknown [182.195.41.55]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20261113042311epoutp03a40493ecb21cca39a7d289b778c84822~ngBIVWe1P0142001420epoutp03H for ; Fri, 13 Nov 2026 04:23:11 +0000 (GMT) Received: from epsnrtp03.localdomain (unknown [182.195.42.155]) by epcas2p3.samsung.com (KnoxPortal) with ESMTPS id 20261113042311epcas2p3103320309a196e255ca73c771e3a7c61~ngBH2ke8o1853018530epcas2p3n; Fri, 13 Nov 2026 04:23:11 +0000 (GMT) Received: from epcas2p3.samsung.com (unknown [182.195.38.212]) by epsnrtp03.localdomain (Postfix) with ESMTP id 4jQkdV5rlqz3hhT7; Fri, 13 Nov 2026 04:23:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20261113042311epoutp03a40493ecb21cca39a7d289b778c84822~ngBIVWe1P0142001420epoutp03H DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1794543791; bh=iCmQpHxQ1PfRl+LfLZjoMP+ssjAoTsUJWXZSBPrEbds=; h=Subject:Reply-To:From:To:CC:Date:References:From; b=lGcxWlqfLs3iSCPSpr8dBZkU8LZyPSiHFVO+oSGbaI+1XhSrIIMw3ZhhOuKNPnuk1 q7wC+HUsmlmGv6akN2awJLgrkr6t9mZythcrmo5nPYSsPC5JzL5/o+jA14QmuEWEgh 2bMLXq1eKJ/Iqzj8jAZSpkdqBRU7cXjJRLYSN3+c= Mime-Version: 1.0 Subject: [PATCH] hw/ufs: Complete rejected query requests with OCS SUCCESS From: Nayeon Kim To: "qemu-devel@nongnu.org" CC: Jeuk Kim , "farosas@suse.de" , "lvivier@redhat.com" , "pbonzini@redhat.com" X-Priority: 3 X-Content-Kind-Code: NORMAL X-CPGS-Detection: blocking_info_exchange X-Drm-Type: N,general X-Msg-Generator: Mail X-Msg-Type: PERSONAL X-Reply-Demand: N Message-ID: <20261113042310epcms2p7ebd28a583ec7a5b7af016f674d88d63c@epcms2p7> Date: Fri, 13 Nov 2026 13:23:10 +0900 X-CMS-MailID: 20261113042310epcms2p7ebd28a583ec7a5b7af016f674d88d63c Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-CPGSPASS: Y X-CPGSPASS: Y cpgsPolicy: CPGSC10-223,Y X-CFilter-Loop: Reflected X-CMS-RootMailID: 20261113042310epcms2p7ebd28a583ec7a5b7af016f674d88d63c References: 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=lists1p.gnu.org; Received-SPF: pass client-ip=203.254.224.33; envelope-from=nayeoni.kim@samsung.com; helo=mailout3.samsung.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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, SPF_HELO_PASS=-0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Fri, 13 Nov 2026 08:53:46 -0500 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: nayeoni.kim@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: 1794578323605158500 When the device rejects a QUERY REQUEST, ufs_exec_query_cmd() puts the Query Response code in the QUERY RESPONSE UPIU but also returns UFS_REQUEST_FAIL, so the UTRD OCS becomes INVALID COMMAND TABLE ATTRIBUTES. A rejected query is a device response, not a host controller error. UFSHCI states that the QUERY RESPONSE UPIU completes the request. A Linux guest reads the Query Response code only when OCS is SUCCESS, so it sees every rejected query as a transfer error. Report query failures only in the Query Response field and update the qtest expectations. The tests still check each Query Response code. Signed-off-by: Nayeon Kim --- hw/ufs/ufs.c | 3 --- tests/qtest/ufs-test.c | 26 +++++++++++++------------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/hw/ufs/ufs.c b/hw/ufs/ufs.c index 3de67831eaeb..6e441b0c8557 100644 --- a/hw/ufs/ufs.c +++ b/hw/ufs/ufs.c @@ -2577,9 +2577,6 @@ static UfsReqResult ufs_exec_query_cmd(UfsRequest *re= q) data_segment_length); ufs_build_query_response(req); =20 - if (status !=3D UFS_QUERY_RESULT_SUCCESS) { - return UFS_REQUEST_FAIL; - } return UFS_REQUEST_SUCCESS; } =20 diff --git a/tests/qtest/ufs-test.c b/tests/qtest/ufs-test.c index 1f86d834ac97..e64954872f6d 100644 --- a/tests/qtest/ufs-test.c +++ b/tests/qtest/ufs-test.c @@ -1106,7 +1106,7 @@ static void ufstest_query_flag_request(void *obj, voi= d *data, ocs =3D ufs_send_query(ufs, UFS_UPIU_QUERY_FUNC_STANDARD_READ_REQUEST, UFS_UPIU_QUERY_OPCODE_READ_FLAG, UFS_QUERY_FLAG_IDN_PURGE_ENABLE, 0, 0, 0, &rsp_up= iu); - g_assert_cmpuint(ocs, =3D=3D, UFS_OCS_INVALID_CMD_TABLE_ATTR); + g_assert_cmpuint(ocs, =3D=3D, UFS_OCS_SUCCESS); g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, UFS_QUERY_RESULT_NOT_READABLE); =20 @@ -1114,7 +1114,7 @@ static void ufstest_query_flag_request(void *obj, voi= d *data, ocs =3D ufs_send_query(ufs, UFS_UPIU_QUERY_FUNC_STANDARD_WRITE_REQUEST, UFS_UPIU_QUERY_OPCODE_SET_FLAG, UFS_QUERY_FLAG_IDN_BUSY_RTC, 0, 0, 0, &rsp_upiu); - g_assert_cmpuint(ocs, =3D=3D, UFS_OCS_INVALID_CMD_TABLE_ATTR); + g_assert_cmpuint(ocs, =3D=3D, UFS_OCS_SUCCESS); g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, UFS_QUERY_RESULT_NOT_WRITEABLE); =20 @@ -1206,7 +1206,7 @@ static void ufstest_query_attr_request(void *obj, voi= d *data, UFS_UPIU_QUERY_OPCODE_WRITE_ATTR, UFS_QUERY_ATTR_IDN_ACTIVE_ICC_LVL, 0, 0, 0x10, &rsp_upiu); - g_assert_cmpuint(ocs, =3D=3D, UFS_OCS_INVALID_CMD_TABLE_ATTR); + g_assert_cmpuint(ocs, =3D=3D, UFS_OCS_SUCCESS); g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, UFS_QUERY_RESULT_INVALID_VALUE); =20 @@ -1221,7 +1221,7 @@ static void ufstest_query_attr_request(void *obj, voi= d *data, ocs =3D ufs_send_query(ufs, UFS_UPIU_QUERY_FUNC_STANDARD_READ_REQUEST, UFS_UPIU_QUERY_OPCODE_READ_ATTR, UFS_QUERY_ATTR_IDN_SECONDS_PASSED, 0, 0, 0, &rsp_= upiu); - g_assert_cmpuint(ocs, =3D=3D, UFS_OCS_INVALID_CMD_TABLE_ATTR); + g_assert_cmpuint(ocs, =3D=3D, UFS_OCS_SUCCESS); g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, UFS_QUERY_RESULT_NOT_READABLE); =20 @@ -1229,7 +1229,7 @@ static void ufstest_query_attr_request(void *obj, voi= d *data, ocs =3D ufs_send_query(ufs, UFS_UPIU_QUERY_FUNC_STANDARD_WRITE_REQUEST, UFS_UPIU_QUERY_OPCODE_WRITE_ATTR, UFS_QUERY_ATTR_IDN_POWER_MODE, 0, 0, 0x01, &rsp_u= piu); - g_assert_cmpuint(ocs, =3D=3D, UFS_OCS_INVALID_CMD_TABLE_ATTR); + g_assert_cmpuint(ocs, =3D=3D, UFS_OCS_SUCCESS); g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, UFS_QUERY_RESULT_NOT_WRITEABLE); =20 @@ -1391,14 +1391,14 @@ static void ufstest_query_desc_request(void *obj, v= oid *data, ocs =3D ufs_send_query(ufs, UFS_UPIU_QUERY_FUNC_STANDARD_READ_REQUEST, UFS_UPIU_QUERY_OPCODE_READ_DESC, UFS_QUERY_DESC_IDN_UNIT, 4, 0, 0, &rsp_upiu); - g_assert_cmpuint(ocs, =3D=3D, UFS_OCS_INVALID_CMD_TABLE_ATTR); + g_assert_cmpuint(ocs, =3D=3D, UFS_OCS_SUCCESS); g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, UFS_QUERY_RESULT_INVALID_INDEX); =20 ocs =3D ufs_send_query(ufs, UFS_UPIU_QUERY_FUNC_STANDARD_READ_REQUEST, UFS_UPIU_QUERY_OPCODE_READ_DESC, UFS_QUERY_DESC_IDN_STRING, 5, 0, 0, &rsp_upiu); - g_assert_cmpuint(ocs, =3D=3D, UFS_OCS_INVALID_CMD_TABLE_ATTR); + g_assert_cmpuint(ocs, =3D=3D, UFS_OCS_SUCCESS); g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, UFS_QUERY_RESULT_INVALID_INDEX); =20 @@ -1406,14 +1406,14 @@ static void ufstest_query_desc_request(void *obj, v= oid *data, ocs =3D ufs_send_query(ufs, UFS_UPIU_QUERY_FUNC_STANDARD_READ_REQUEST, UFS_UPIU_QUERY_OPCODE_READ_DESC, UFS_QUERY_DESC_IDN_DEVICE, 0, 1, 0, &rsp_upiu); - g_assert_cmpuint(ocs, =3D=3D, UFS_OCS_INVALID_CMD_TABLE_ATTR); + g_assert_cmpuint(ocs, =3D=3D, UFS_OCS_SUCCESS); g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, UFS_QUERY_RESULT_INVALID_SELECTOR); =20 ocs =3D ufs_send_query(ufs, UFS_UPIU_QUERY_FUNC_STANDARD_READ_REQUEST, UFS_UPIU_QUERY_OPCODE_READ_DESC, UFS_QUERY_DESC_IDN_STRING, 0, 1, 0, &rsp_upiu); - g_assert_cmpuint(ocs, =3D=3D, UFS_OCS_INVALID_CMD_TABLE_ATTR); + g_assert_cmpuint(ocs, =3D=3D, UFS_OCS_SUCCESS); g_assert_cmpuint(rsp_upiu.header.response, =3D=3D, UFS_QUERY_RESULT_INVALID_SELECTOR); =20 @@ -1748,19 +1748,19 @@ static void ufstest_hid(void *obj, void *data, QGue= stAllocator *alloc) ocs =3D ufs_send_query(ufs, UFS_UPIU_QUERY_FUNC_STANDARD_WRITE_REQUEST, UFS_UPIU_QUERY_OPCODE_WRITE_ATTR, UFS_QUERY_ATTR_IDN_HID_AVAIL_SIZE, 0, 0, 0x100, &= rsp); - g_assert_cmpuint(ocs, =3D=3D, UFS_OCS_INVALID_CMD_TABLE_ATTR); + g_assert_cmpuint(ocs, =3D=3D, UFS_OCS_SUCCESS); g_assert_cmpuint(rsp.header.response, =3D=3D, UFS_QUERY_RESULT_NOT_WRI= TEABLE); =20 ocs =3D ufs_send_query(ufs, UFS_UPIU_QUERY_FUNC_STANDARD_WRITE_REQUEST, UFS_UPIU_QUERY_OPCODE_WRITE_ATTR, UFS_QUERY_ATTR_IDN_HID_PROG_RATIO, 0, 0, 50, &rsp= ); - g_assert_cmpuint(ocs, =3D=3D, UFS_OCS_INVALID_CMD_TABLE_ATTR); + g_assert_cmpuint(ocs, =3D=3D, UFS_OCS_SUCCESS); g_assert_cmpuint(rsp.header.response, =3D=3D, UFS_QUERY_RESULT_NOT_WRI= TEABLE); =20 ocs =3D ufs_send_query(ufs, UFS_UPIU_QUERY_FUNC_STANDARD_WRITE_REQUEST, UFS_UPIU_QUERY_OPCODE_WRITE_ATTR, UFS_QUERY_ATTR_IDN_HID_STATE, 0, 0, 0x01, &rsp); - g_assert_cmpuint(ocs, =3D=3D, UFS_OCS_INVALID_CMD_TABLE_ATTR); + g_assert_cmpuint(ocs, =3D=3D, UFS_OCS_SUCCESS); g_assert_cmpuint(rsp.header.response, =3D=3D, UFS_QUERY_RESULT_NOT_WRI= TEABLE); =20 /* @@ -1769,7 +1769,7 @@ static void ufstest_hid(void *obj, void *data, QGuest= Allocator *alloc) ocs =3D ufs_send_query(ufs, UFS_UPIU_QUERY_FUNC_STANDARD_WRITE_REQUEST, UFS_UPIU_QUERY_OPCODE_WRITE_ATTR, UFS_QUERY_ATTR_IDN_DEFRAG_OP, 0, 0, 0x03, &rsp); - g_assert_cmpuint(ocs, =3D=3D, UFS_OCS_INVALID_CMD_TABLE_ATTR); + g_assert_cmpuint(ocs, =3D=3D, UFS_OCS_SUCCESS); g_assert_cmpuint(rsp.header.response, =3D=3D, UFS_QUERY_RESULT_INVALID= _VALUE); =20 /* --=20 2.43.0