From: Stefan Hajnoczi <stefanha@redhat.com>
To: Gollu Appalanaidu <anaidu.gollu@samsung.com>
Cc: fam@euphon.net, kwolf@redhat.com, qemu-block@nongnu.org,
qemu-devel@nongnu.org, mreitz@redhat.com, its@irrelevant.dk,
kbusch@kernel.org
Subject: Re: [PATCH v2 1/2] hw/nvme: add support for boot partiotions
Date: Thu, 3 Jun 2021 10:48:22 +0100 [thread overview]
Message-ID: <YLilZqgEZyQjnRwX@stefanha-x1.localdomain> (raw)
In-Reply-To: <20210601143749.1669-2-anaidu.gollu@samsung.com>
[-- Attachment #1: Type: text/plain, Size: 1854 bytes --]
On Tue, Jun 01, 2021 at 08:07:48PM +0530, Gollu Appalanaidu wrote:
> @@ -5546,6 +5665,47 @@ static void nvme_write_bar(NvmeCtrl *n, hwaddr offset, uint64_t data,
> NVME_GUEST_ERR(pci_nvme_ub_mmiowr_cmbsz_readonly,
> "invalid write to read only CMBSZ, ignored");
> return;
> + case 0x44: /* BPRSEL */
> + n->bar.bprsel = data & 0xffffffff;
> + size_t bp_len = NVME_BPRSEL_BPRSZ(n->bar.bprsel) * 4 * KiB;
> + int64_t bp_offset = NVME_BPRSEL_BPROF(n->bar.bprsel) * 4 * KiB;
> + int64_t off = 0;
> + struct nvme_bp_read_ctx *ctx;
> +
> + trace_pci_nvme_mmio_bprsel(data, n->bar.bprsel,
> + NVME_BPRSEL_BPID(n->bar.bpinfo),
> + bp_offset, bp_len);
> +
> + if (bp_len + bp_offset > n->bp_size) {
> + NVME_BPINFO_CLEAR_BRS(n->bar.bpinfo);
> + NVME_BPINFO_SET_BRS(n->bar.bpinfo, NVME_BPINFO_BRS_ERROR);
> + return;
> + }
> +
> + off = NVME_BPRSEL_BPID(n->bar.bpinfo) * n->bp_size + bp_offset;
> +
> + NVME_BPINFO_CLEAR_BRS(n->bar.bpinfo);
> + NVME_BPINFO_SET_BRS(n->bar.bpinfo, NVME_BPINFO_BRS_READING);
> +
> + ctx = g_new(struct nvme_bp_read_ctx, 1);
> +
> + ctx->n = n;
> +
> + pci_dma_sglist_init(&ctx->qsg, &n->parent_obj, 1);
> +
> + qemu_sglist_add(&ctx->qsg, n->bar.bpmbl, bp_len);
> +
> + dma_blk_read(n->blk_bp, &ctx->qsg, off , BDRV_SECTOR_SIZE,
> + nvme_bp_read_cb, ctx);
The returned BlockAIOCB is not stored. Two questions:
1. Can the guest allocate unbounded amounts of QEMU memory (struct
nvme_bp_read_ctx) by repeatedly writing to this register?
2. What happens if the NVMe device is hot unplugged or reset while a
boot partition read request is in flight?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2021-06-03 9:49 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20210601144231epcas5p3b931fe9421737d104dc3c5be50c928f3@epcas5p3.samsung.com>
2021-06-01 14:37 ` [PATCH v2 0/2] add boot partitions support and read test case Gollu Appalanaidu
[not found] ` <CGME20210601144234epcas5p153e855ad673876cf67e57d4b539dc274@epcas5p1.samsung.com>
2021-06-01 14:37 ` [PATCH v2 1/2] hw/nvme: add support for boot partiotions Gollu Appalanaidu
2021-06-01 17:19 ` Keith Busch
2021-06-01 17:41 ` Klaus Jensen
2021-06-01 17:46 ` Klaus Jensen
2021-06-01 18:07 ` Keith Busch
2021-06-01 19:07 ` Klaus Jensen
2021-06-01 20:23 ` Keith Busch
2021-06-03 9:48 ` Stefan Hajnoczi [this message]
2021-06-03 10:04 ` Klaus Jensen
2021-06-03 11:51 ` Stefan Hajnoczi
[not found] ` <CGME20210601144242epcas5p1292f656f45aebd1b9c75fe54797d6b46@epcas5p1.samsung.com>
2021-06-01 14:37 ` [PATCH v2 2/2] tests/qtest/nvme-test: add boot partition read test Gollu Appalanaidu
2021-06-01 17:43 ` Klaus Jensen
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=YLilZqgEZyQjnRwX@stefanha-x1.localdomain \
--to=stefanha@redhat.com \
--cc=anaidu.gollu@samsung.com \
--cc=fam@euphon.net \
--cc=its@irrelevant.dk \
--cc=kbusch@kernel.org \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.