From patchwork Tue Jan 7 08:43:56 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Keoseong Park X-Patchwork-Id: 13928470 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B8E01E77197 for ; Tue, 7 Jan 2025 08:44:42 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tV5CG-0003jk-JX; Tue, 07 Jan 2025 03:44:20 -0500 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 1tV5CE-0003jP-NS for qemu-devel@nongnu.org; Tue, 07 Jan 2025 03:44:19 -0500 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 1tV5C6-0008VZ-7y for qemu-devel@nongnu.org; Tue, 07 Jan 2025 03:44:18 -0500 Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20250107084357epoutp01c1e91fd854fdfd6159a96bada791fa34~YXJHMCndD2624526245epoutp01k for ; Tue, 7 Jan 2025 08:43:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20250107084357epoutp01c1e91fd854fdfd6159a96bada791fa34~YXJHMCndD2624526245epoutp01k DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1736239437; bh=qMVTTSrMbBxUY+BObY6KkjD7t/14XIBA7i8I9M0jDso=; h=Subject:Reply-To:From:To:CC:Date:References:From; b=UJU7d0kTj8L1VYzqUCV5YSm01O4f2ElCRTIlqCtuSkacvEzwpFxTNizyc967V8mKT Nwwnac3yx8EE16/9uExVWGV60dBjY2mtJRLmIfPw1Wa6j4K4Y9/r7X0AtcRRUUVvyT SZOiqmafyA+X/Oz0w7rYKsPP6aW5o+wrgM3e/PTk= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas2p4.samsung.com (KnoxPortal) with ESMTP id 20250107084357epcas2p490bd9a8aa015af73bb28e7acab61acce~YXJG7FdYJ2756227562epcas2p44; Tue, 7 Jan 2025 08:43:57 +0000 (GMT) Received: from epsmges2p3.samsung.com (unknown [182.195.36.69]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4YS4Mw3ZpVz4x9Pr; Tue, 7 Jan 2025 08:43:56 +0000 (GMT) X-AuditID: b6c32a47-fd1c970000005659-12-677ce94ce160 Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p3.samsung.com (Symantec Messaging Gateway) with SMTP id CD.97.22105.C49EC776; Tue, 7 Jan 2025 17:43:56 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH v2] hw/ufs: Adjust value to match CPU's endian format From: Keoseong Park To: Jeuk Kim , "philmd@linaro.org" , "qemu-devel@nongnu.org" CC: "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: <20250107084356epcms2p2af4d86432174d76ea57336933e46b4c3@epcms2p2> Date: Tue, 07 Jan 2025 17:43:56 +0900 X-CMS-MailID: 20250107084356epcms2p2af4d86432174d76ea57336933e46b4c3 X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-CPGSPASS: Y X-CPGSPASS: Y X-Brightm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1VTOT4F PpTZ9+st60wuZ3OjOZ+OXehYwuec1ih8qcpu6aTQXD4lg6u9ZhXP2YTv/tj4UPrnKbedLR82 6eTP1tuS7WvQ/2tebmHhloSUfyl+qqy6Zux9PvZHP71zc1R7+zeO9eAMHt+KxRZKLMUZiYZa zEXFiQDw5Ck6FwQAAA== DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20250107084356epcms2p2af4d86432174d76ea57336933e46b4c3 References: Received-SPF: pass client-ip=203.254.224.24; envelope-from=keosung.park@samsung.com; helo=mailout1.samsung.com X-Spam_score_int: -47 X-Spam_score: -4.8 X-Spam_bar: ---- X-Spam_report: (-4.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.446, 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 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: keosung.park@samsung.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org In ufs_write_attr_value(), the value parameter is handled in the CPU's endian format but provided in big-endian format by the caller. Thus, it is converted to the CPU's endian format. The related test code is also fixed to reflect this change. Fixes: 7c85332a2b3e ("hw/ufs: minor bug fixes related to ufs-test") Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Keoseong Park Reviewed-by: Jeuk Kim --- hw/ufs/ufs.c | 2 +- tests/qtest/ufs-test.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/ufs/ufs.c b/hw/ufs/ufs.c index 8d26d13791..428fe927ad 100644 --- a/hw/ufs/ufs.c +++ b/hw/ufs/ufs.c @@ -1164,7 +1164,7 @@ static QueryRespCode ufs_exec_query_attr(UfsRequest *req, int op) value = ufs_read_attr_value(u, idn); ret = UFS_QUERY_RESULT_SUCCESS; } else { - value = req->req_upiu.qr.value; + value = be32_to_cpu(req->req_upiu.qr.value); ret = ufs_write_attr_value(u, idn, value); } req->rsp_upiu.qr.value = cpu_to_be32(value); diff --git a/tests/qtest/ufs-test.c b/tests/qtest/ufs-test.c index 60199abbee..1f860b41c0 100644 --- a/tests/qtest/ufs-test.c +++ b/tests/qtest/ufs-test.c @@ -145,7 +145,7 @@ static void ufs_send_query(QUfs *ufs, uint8_t slot, uint8_t query_function, req_upiu.qr.idn = idn; req_upiu.qr.index = index; req_upiu.qr.selector = selector; - req_upiu.qr.value = attr_value; + req_upiu.qr.value = cpu_to_be32(attr_value); req_upiu.qr.length = UFS_QUERY_DESC_MAX_SIZE; qtest_memwrite(ufs->dev.bus->qts, req_upiu_addr, &req_upiu, sizeof(req_upiu));