* [PATCH v2] hw/ufs: Adjust value to match CPU's endian format
[not found] <CGME20250107084356epcms2p2af4d86432174d76ea57336933e46b4c3@epcms2p2>
@ 2025-01-07 8:43 ` Keoseong Park
2025-01-07 9:17 ` Jeuk Kim
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Keoseong Park @ 2025-01-07 8:43 UTC (permalink / raw)
To: Jeuk Kim, philmd@linaro.org, qemu-devel@nongnu.org
Cc: farosas@suse.de, lvivier@redhat.com, pbonzini@redhat.com
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é <philmd@linaro.org>
Signed-off-by: Keoseong Park <keosung.park@samsung.com>
---
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));
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] hw/ufs: Adjust value to match CPU's endian format
2025-01-07 8:43 ` [PATCH v2] hw/ufs: Adjust value to match CPU's endian format Keoseong Park
@ 2025-01-07 9:17 ` Jeuk Kim
2025-01-09 14:47 ` Philippe Mathieu-Daudé
2025-01-15 12:53 ` Michael Tokarev
2 siblings, 0 replies; 5+ messages in thread
From: Jeuk Kim @ 2025-01-07 9:17 UTC (permalink / raw)
To: keosung.park, Jeuk Kim, philmd@linaro.org, qemu-devel@nongnu.org
Cc: farosas@suse.de, lvivier@redhat.com, pbonzini@redhat.com
On 1/7/2025 5:43 PM, Keoseong Park wrote:
> 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é <philmd@linaro.org>
> Signed-off-by: Keoseong Park <keosung.park@samsung.com>
> ---
> 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));
Thank you for your contribution.
Reviewed-by: Jeuk Kim <jeuk20.kim@samsung.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] hw/ufs: Adjust value to match CPU's endian format
2025-01-07 8:43 ` [PATCH v2] hw/ufs: Adjust value to match CPU's endian format Keoseong Park
2025-01-07 9:17 ` Jeuk Kim
@ 2025-01-09 14:47 ` Philippe Mathieu-Daudé
2025-01-15 12:53 ` Michael Tokarev
2 siblings, 0 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-09 14:47 UTC (permalink / raw)
To: keosung.park, Jeuk Kim, qemu-devel@nongnu.org
Cc: farosas@suse.de, lvivier@redhat.com, pbonzini@redhat.com
On 7/1/25 09:43, Keoseong Park wrote:
> 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é <philmd@linaro.org>
> Signed-off-by: Keoseong Park <keosung.park@samsung.com>
> ---
> hw/ufs/ufs.c | 2 +-
> tests/qtest/ufs-test.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
Patch queued, thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] hw/ufs: Adjust value to match CPU's endian format
2025-01-07 8:43 ` [PATCH v2] hw/ufs: Adjust value to match CPU's endian format Keoseong Park
2025-01-07 9:17 ` Jeuk Kim
2025-01-09 14:47 ` Philippe Mathieu-Daudé
@ 2025-01-15 12:53 ` Michael Tokarev
2025-01-15 13:03 ` Philippe Mathieu-Daudé
2 siblings, 1 reply; 5+ messages in thread
From: Michael Tokarev @ 2025-01-15 12:53 UTC (permalink / raw)
To: keosung.park, Jeuk Kim, philmd@linaro.org, qemu-devel@nongnu.org
Cc: farosas@suse.de, lvivier@redhat.com, pbonzini@redhat.com
07.01.2025 11:43, Keoseong Park wrote:
> 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")
This seems to be a qemu-stable material. I'm picking it up for 9.2,
please let me know if I should not.
Thanks,
/mjt
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] hw/ufs: Adjust value to match CPU's endian format
2025-01-15 12:53 ` Michael Tokarev
@ 2025-01-15 13:03 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-15 13:03 UTC (permalink / raw)
To: Michael Tokarev, keosung.park, Jeuk Kim, qemu-devel@nongnu.org
Cc: farosas@suse.de, lvivier@redhat.com, pbonzini@redhat.com
On 15/1/25 13:53, Michael Tokarev wrote:
> 07.01.2025 11:43, Keoseong Park wrote:
>> 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")
>
> This seems to be a qemu-stable material. I'm picking it up for 9.2,
> please let me know if I should not.
Correct, sorry for missing adding a Cc:stable tag here.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-01-15 13:03 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20250107084356epcms2p2af4d86432174d76ea57336933e46b4c3@epcms2p2>
2025-01-07 8:43 ` [PATCH v2] hw/ufs: Adjust value to match CPU's endian format Keoseong Park
2025-01-07 9:17 ` Jeuk Kim
2025-01-09 14:47 ` Philippe Mathieu-Daudé
2025-01-15 12:53 ` Michael Tokarev
2025-01-15 13:03 ` Philippe Mathieu-Daudé
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).