From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: ankita@nvidia.com, jgg@nvidia.com, alex.williamson@redhat.com
Cc: qemu-devel@nongnu.org, "Cédric Le Goater" <clg@redhat.com>
Subject: Re: [RFC v1 4/4] qemu: adjust queried bar size to power-of-2
Date: Tue, 6 Jun 2023 07:03:08 +0200 [thread overview]
Message-ID: <19e16466-7ca7-d16d-8d11-72d4adc3359c@linaro.org> (raw)
In-Reply-To: <20230605235005.20649-5-ankita@nvidia.com>
On 6/6/23 01:50, ankita@nvidia.com wrote:
> From: Ankit Agrawal <ankita@nvidia.com>
>
> The GPU device memory is reported to the VM as a BAR. The device memory
> may not be aligned to the power-of-2, but the QEMU expects the PCI BAR to
> be. Align the reported device memory size to the next power-of-2 before
> QEMU does an mmap.
>
> Signed-off-by: Ankit Agrawal <ankita@nvidia.com>
> ---
> hw/vfio/common.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/vfio/common.c b/hw/vfio/common.c
> index 4d01ea3515..bb49200458 100644
> --- a/hw/vfio/common.c
> +++ b/hw/vfio/common.c
> @@ -2061,7 +2061,7 @@ int vfio_region_setup(Object *obj, VFIODevice *vbasedev, VFIORegion *region,
>
> region->vbasedev = vbasedev;
> region->flags = info->flags;
> - region->size = info->size;
> + region->size = info->size ? pow2ceil(info->size) : info->size;
region->size = [REAL_]HOST_PAGE_ALIGN(info->size)?
> region->fd_offset = info->offset;
> region->nr = index;
>
next prev parent reply other threads:[~2023-06-06 5:03 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-05 23:50 [RFC v1 0/4] Expose GPU memory as coherently CPU accessible ankita
2023-06-05 23:50 ` [RFC v1 1/4] qemu: add GPU memory information as object ankita
2023-06-06 15:19 ` Alex Williamson
2023-06-05 23:50 ` [RFC v1 2/4] qemu: patch guest SRAT for GPU memory ankita
2023-06-06 4:58 ` Philippe Mathieu-Daudé
2023-06-05 23:50 ` [RFC v1 3/4] qemu: patch guest DSDT " ankita
2023-06-05 23:50 ` [RFC v1 4/4] qemu: adjust queried bar size to power-of-2 ankita
2023-06-06 5:03 ` Philippe Mathieu-Daudé [this message]
2023-06-06 12:54 ` Alex Williamson
2023-06-06 14:19 ` Philippe Mathieu-Daudé
2023-06-06 14:54 ` [RFC v1 0/4] Expose GPU memory as coherently CPU accessible Cédric Le Goater
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=19e16466-7ca7-d16d-8d11-72d4adc3359c@linaro.org \
--to=philmd@linaro.org \
--cc=alex.williamson@redhat.com \
--cc=ankita@nvidia.com \
--cc=clg@redhat.com \
--cc=jgg@nvidia.com \
--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 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).