From: Paolo Bonzini <pbonzini@redhat.com>
To: David Gibson <david@gibson.dropbear.id.au>, peter.maydell@linaro.org
Cc: aik@ozlabs.ru, agraf@suse.de, qemu-devel@nongnu.org,
alex.williamson@redhat.com, qemu-ppc@nongnu.org
Subject: Re: [Qemu-devel] [PULL 07/14] vfio/spapr: Create DMA window dynamically (SPAPR IOMMU v2)
Date: Mon, 11 Jul 2016 15:51:44 +0200 [thread overview]
Message-ID: <c61a6851-bc0b-2f0c-6a23-b42928f22af4@redhat.com> (raw)
In-Reply-To: <1467696699-8941-8-git-send-email-david@gibson.dropbear.id.au>
On 05/07/2016 07:31, David Gibson wrote:
> + ret = ioctl(container->fd, VFIO_IOMMU_SPAPR_TCE_CREATE, &create);
> + if (ret) {
> + error_report("Failed to create a window, ret = %d (%m)", ret);
> + return -errno;
> + }
> +
> + if (create.start_addr != section->offset_within_address_space) {
> + vfio_spapr_remove_window(container, create.start_addr);
> +
> + error_report("Host doesn't support DMA window at %"HWADDR_PRIx", must be %"PRIx64,
> + section->offset_within_address_space,
> + (uint64_t)create.start_addr);
> + ioctl(container->fd, VFIO_IOMMU_SPAPR_TCE_REMOVE, &remove);
Was this ioctl left there by mistake? It passes the address of the
remove *function* to VFIO_IOMMU_SPAPR_TCE_REMOVE.
Thanks,
Paolo
> + return -EINVAL;
> + }
> + trace_vfio_spapr_create_window(create.page_shift,
> + create.window_size,
> + create.start_addr);
> + *pgsize = pagesize;
> +
> + return 0;
> +}
> +
> +int vfio_spapr_remove_window(VFIOContainer *container,
> + hwaddr offset_within_address_space)
> +{
> + struct vfio_iommu_spapr_tce_remove remove = {
> + .argsz = sizeof(remove),
> + .start_addr = offset_within_address_space,
> + };
> + int ret;
> +
> + ret = ioctl(container->fd, VFIO_IOMMU_SPAPR_TCE_REMOVE, &remove);
> + if (ret) {
> + error_report("Failed to remove window at %"PRIx64,
> + (uint64_t)remove.start_addr);
> + return -errno;
> + }
> +
> + trace_vfio_spapr_remove_window(offset_within_address_space);
> +
> + return 0;
> +}
> diff --git a/hw/vfio/trace-events b/hw/vfio/trace-events
> index 0b02a3b..4bb7690 100644
> --- a/hw/vfio/trace-events
> +++ b/hw/vfio/trace-events
> @@ -121,3 +121,5 @@ vfio_prereg_listener_region_add_skip(uint64_t start, uint64_t end) "%"PRIx64" -
> vfio_prereg_listener_region_del_skip(uint64_t start, uint64_t end) "%"PRIx64" - %"PRIx64
> vfio_prereg_register(uint64_t va, uint64_t size, int ret) "va=%"PRIx64" size=%"PRIx64" ret=%d"
> vfio_prereg_unregister(uint64_t va, uint64_t size, int ret) "va=%"PRIx64" size=%"PRIx64" ret=%d"
> +vfio_spapr_create_window(int ps, uint64_t ws, uint64_t off) "pageshift=0x%x winsize=0x%"PRIx64" offset=0x%"PRIx64
> +vfio_spapr_remove_window(uint64_t off) "offset=%"PRIx64
> diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h
> index b1f3e92..07f7188 100644
> --- a/include/hw/vfio/vfio-common.h
> +++ b/include/hw/vfio/vfio-common.h
> @@ -168,4 +168,10 @@ int vfio_get_dev_region_info(VFIODevice *vbasedev, uint32_t type,
> #endif
> extern const MemoryListener vfio_prereg_listener;
>
> +int vfio_spapr_create_window(VFIOContainer *container,
> + MemoryRegionSection *section,
> + hwaddr *pgsize);
> +int vfio_spapr_remove_window(VFIOContainer *container,
> + hwaddr offset_within_address_space);
> +
> #endif /* !HW_VFIO_VFIO_COMMON_H */
>
next prev parent reply other threads:[~2016-07-11 13:51 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-05 5:31 [Qemu-devel] [PULL 00/14] ppc-for-2.7 queue 20160705 (v2) David Gibson
2016-07-05 5:31 ` [Qemu-devel] [PULL 01/14] ppc: Fix xsrdpi, xvrdpi and xvrspi rounding David Gibson
2016-07-05 5:31 ` [Qemu-devel] [PULL 02/14] spapr: Ensure thread0 of CPU core is always realized first David Gibson
2016-07-05 5:31 ` [Qemu-devel] [PULL 03/14] ppc: simplify max_smt initialization in ppc_cpu_realizefn() David Gibson
2016-07-05 5:31 ` [Qemu-devel] [PULL 04/14] spapr_iommu: Realloc guest visible TCE table when starting/stopping listening David Gibson
2016-07-05 5:31 ` [Qemu-devel] [PULL 05/14] vfio: spapr: Add DMA memory preregistering (SPAPR IOMMU v2) David Gibson
2016-07-05 5:31 ` [Qemu-devel] [PULL 06/14] vfio: Add host side DMA window capabilities David Gibson
2016-07-05 5:31 ` [Qemu-devel] [PULL 07/14] vfio/spapr: Create DMA window dynamically (SPAPR IOMMU v2) David Gibson
2016-07-11 13:51 ` Paolo Bonzini [this message]
2016-07-12 5:26 ` David Gibson
2016-07-05 5:31 ` [Qemu-devel] [PULL 08/14] spapr_pci/spapr_pci_vfio: Support Dynamic DMA Windows (DDW) David Gibson
2016-07-11 14:21 ` Paolo Bonzini
2016-07-12 5:20 ` David Gibson
2017-11-07 8:42 ` [Qemu-devel] [PULL, " Laurent Vivier
2017-11-07 22:52 ` Alexey Kardashevskiy
2017-11-10 3:18 ` David Gibson
2016-07-05 5:31 ` [Qemu-devel] [PULL 09/14] ppc: simplify ppc_hash64_hpte_page_shift_noslb() David Gibson
2016-07-05 5:31 ` [Qemu-devel] [PULL 10/14] target-ppc: Correct page size decoding in ppc_hash64_pteg_search() David Gibson
2016-07-05 5:31 ` [Qemu-devel] [PULL 11/14] target-ppc: Simplify HPTE matching David Gibson
2016-07-05 5:31 ` [Qemu-devel] [PULL 12/14] target-ppc: Return page shift from PTEG search David Gibson
2016-07-05 5:31 ` [Qemu-devel] [PULL 13/14] ppc/hash64: Add proper real mode translation support David Gibson
2016-07-05 5:31 ` [Qemu-devel] [PULL 14/14] ppc/hash64: Fix support for LPCR:ISL David Gibson
2016-07-05 11:46 ` [Qemu-devel] [PULL 00/14] ppc-for-2.7 queue 20160705 (v2) Peter Maydell
-- strict thread matches above, loose matches on Subject: below --
2016-07-05 5:10 [Qemu-devel] [PULL 00/14] ppc-for-2.7 queue 20160705 David Gibson
2016-07-05 5:10 ` [Qemu-devel] [PULL 07/14] vfio/spapr: Create DMA window dynamically (SPAPR IOMMU v2) David Gibson
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=c61a6851-bc0b-2f0c-6a23-b42928f22af4@redhat.com \
--to=pbonzini@redhat.com \
--cc=agraf@suse.de \
--cc=aik@ozlabs.ru \
--cc=alex.williamson@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@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).