From: Stefan Hajnoczi <stefanha@redhat.com>
To: Jeuk Kim <jeuk20.kim@gmail.com>
Cc: qemu-devel@nongnu.org, fam@euphon.net, hreitz@redhat.com,
k.jensen@samsung.com, kwolf@redhat.com, pbonzini@redhat.com,
qemu-block@nongnu.org, berrange@redhat.com,
marcandre.lureau@redhat.com, marcel.apfelbaum@gmail.com,
mst@redhat.com, philmd@linaro.org, thuth@redhat.com,
Jeuk Kim <jeuk20.kim@samsung.com>
Subject: Re: [PATCH v4 2/3] hw/ufs: Support for Query Transfer Requests
Date: Tue, 18 Jul 2023 16:42:03 -0400 [thread overview]
Message-ID: <20230718204203.GP44841@fedora> (raw)
In-Reply-To: <f01e773fc73d56d48d9f0e2adac4d40209d3b223.1688459061.git.jeuk20.kim@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1417 bytes --]
On Tue, Jul 04, 2023 at 05:33:58PM +0900, Jeuk Kim wrote:
> +static MemTxResult ufs_dma_read_prdt(UfsRequest *req)
> +{
> + UfsHc *u = req->hc;
> + uint16_t prdt_len = le16_to_cpu(req->utrd.prd_table_length);
> + uint16_t prdt_byte_off =
> + le16_to_cpu(req->utrd.prd_table_offset) * sizeof(uint32_t);
> + uint32_t prdt_size = prdt_len * sizeof(UfshcdSgEntry);
> + g_autofree UfshcdSgEntry *prd_entries = NULL;
> + hwaddr req_upiu_base_addr, prdt_base_addr;
> + int err;
> +
> + assert(!req->sg);
> +
> + if (prdt_len == 0) {
> + return MEMTX_OK;
> + }
> +
> + prd_entries = g_new(UfshcdSgEntry, prdt_size);
> + if (!prd_entries) {
g_new() never returns NULL. The process aborts if there is not enough
memory available.
Use g_try_new() if you want to handle memory allocation failure.
> + trace_ufs_err_memory_allocation();
> + return MEMTX_ERROR;
> + }
> +
> + req_upiu_base_addr = ufs_get_req_upiu_base_addr(&req->utrd);
> + prdt_base_addr = req_upiu_base_addr + prdt_byte_off;
> +
> + err = ufs_addr_read(u, prdt_base_addr, prd_entries, prdt_size);
> + if (err) {
> + trace_ufs_err_dma_read_prdt(req->slot, prdt_base_addr);
> + return err;
> + }
> +
> + req->sg = g_malloc0(sizeof(QEMUSGList));
> + if (!req->sg) {
g_malloc0() never returns NULL. The process aborts if there is not
enough memory available.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2023-07-18 20:43 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-04 8:33 [PATCH v4 0/3] hw/ufs: Add Universal Flash Storage (UFS) support Jeuk Kim
2023-07-04 8:33 ` [PATCH v4 1/3] hw/ufs: Initial commit for emulated Universal-Flash-Storage Jeuk Kim
2023-07-18 20:29 ` Stefan Hajnoczi
2023-07-04 8:33 ` [PATCH v4 2/3] hw/ufs: Support for Query Transfer Requests Jeuk Kim
2023-07-18 20:42 ` Stefan Hajnoczi [this message]
2023-07-04 8:33 ` [PATCH v4 3/3] hw/ufs: Support for UFS logical unit Jeuk Kim
2023-07-18 20:56 ` Stefan Hajnoczi
2023-07-11 10:31 ` PING: [PATCH v4 0/3] hw/ufs: Add Universal Flash Storage (UFS) support Jeuk Kim
2023-07-18 18:56 ` Stefan Hajnoczi
2023-07-18 23:01 ` Jeuk Kim
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=20230718204203.GP44841@fedora \
--to=stefanha@redhat.com \
--cc=berrange@redhat.com \
--cc=fam@euphon.net \
--cc=hreitz@redhat.com \
--cc=jeuk20.kim@gmail.com \
--cc=jeuk20.kim@samsung.com \
--cc=k.jensen@samsung.com \
--cc=kwolf@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.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).