From: Steven Sistare <steven.sistare@oracle.com>
To: Yi Liu <yi.l.liu@intel.com>, qemu-devel@nongnu.org
Cc: Eric Auger <eric.auger@redhat.com>,
Zhenzhong Duan <zhenzhong.duan@intel.com>,
Alex Williamson <alex.williamson@redhat.com>,
Cedric Le Goater <clg@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Peter Xu <peterx@redhat.com>, Fabiano Rosas <farosas@suse.de>,
Philippe Mathieu-Daude <philmd@linaro.org>,
David Hildenbrand <david@redhat.com>
Subject: Re: [RFC V1 02/12] iommufd: no DMA to BARs
Date: Tue, 13 Aug 2024 10:53:53 -0400 [thread overview]
Message-ID: <09e41cf4-78fb-4d31-9ada-8493247fec61@oracle.com> (raw)
In-Reply-To: <ff0fe127-bdca-41a4-86a7-c72e9fcbcf3a@intel.com>
On 8/12/2024 9:39 PM, Yi Liu wrote:
> On 2024/7/21 03:15, Steve Sistare wrote:
>> Do not map VFIO PCI BARs for DMA. This stops a raft of warnings of the
>> following form at QEMU start time when using -object iommufd:
>>
>> qemu-kvm: warning: IOMMU_IOAS_MAP failed: Bad address, PCI BAR?
>> qemu-kvm: vfio_container_dma_map(0x555558282db0, 0x8800010000, 0x4000, 0x7ffff7ff0000) = -14 (Bad address)
>
> It is required as Alex pointed, so no need to pay further attempt to hide
> this message. And there were efforts to make it. But not done yet. Below
> links may be helpful if you are interested about the history.
>
> [1] https://lore.kernel.org/kvm/14-v4-0de2f6c78ed0+9d1-iommufd_jgg@nvidia.com/
> [2] https://lore.kernel.org/kvm/20240624141139.GH29266@unreal/
> [3] https://lore.kernel.org/kvm/0-v1-9e6e1739ed95+5fa-vfio_dma_buf_jgg@nvidia.com/
Thanks for the pointers. Good to here the problem is being worked.
- Steve
>> Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
>> ---
>> hw/vfio/common.c | 3 ++-
>> hw/vfio/helpers.c | 1 +
>> include/exec/memory.h | 1 +
>> 3 files changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/hw/vfio/common.c b/hw/vfio/common.c
>> index da2e0ec..403d45a 100644
>> --- a/hw/vfio/common.c
>> +++ b/hw/vfio/common.c
>> @@ -248,7 +248,8 @@ static bool vfio_listener_skipped_section(MemoryRegionSection *section)
>> * are never accessed by the CPU and beyond the address width of
>> * some IOMMU hardware. TODO: VFIO should tell us the IOMMU width.
>> */
>> - section->offset_within_address_space & (1ULL << 63);
>> + section->offset_within_address_space & (1ULL << 63) ||
>> + section->mr->no_dma;
>> }
>> /* Called with rcu_read_lock held. */
>> diff --git a/hw/vfio/helpers.c b/hw/vfio/helpers.c
>> index b14edd4..e4cfdd2 100644
>> --- a/hw/vfio/helpers.c
>> +++ b/hw/vfio/helpers.c
>> @@ -435,6 +435,7 @@ int vfio_region_mmap(VFIORegion *region)
>> memory_region_owner(region->mem),
>> name, region->mmaps[i].size,
>> region->mmaps[i].mmap);
>> + region->mmaps[i].mem.no_dma = true;
>> g_free(name);
>> memory_region_add_subregion(region->mem, region->mmaps[i].offset,
>> ®ion->mmaps[i].mem);
>> diff --git a/include/exec/memory.h b/include/exec/memory.h
>> index ea03ef2..850cc8c 100644
>> --- a/include/exec/memory.h
>> +++ b/include/exec/memory.h
>> @@ -794,6 +794,7 @@ struct MemoryRegion {
>> bool unmergeable;
>> uint8_t dirty_log_mask;
>> bool is_iommu;
>> + bool no_dma;
>> RAMBlock *ram_block;
>> Object *owner;
>> /* owner as TYPE_DEVICE. Used for re-entrancy checks in MR access hotpath */
>
next prev parent reply other threads:[~2024-08-13 14:54 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-20 19:15 [RFC V1 00/12] Live update: iommufd Steve Sistare
2024-07-20 19:15 ` [RFC V1 01/12] vfio: move cpr_exec_notifier Steve Sistare
2024-07-20 19:15 ` [RFC V1 02/12] iommufd: no DMA to BARs Steve Sistare
2024-08-12 22:05 ` Alex Williamson
2024-08-13 1:39 ` Yi Liu
2024-08-13 14:53 ` Steven Sistare [this message]
2024-07-20 19:15 ` [RFC V1 03/12] iommufd: pass name to connect Steve Sistare
2024-07-20 19:15 ` [RFC V1 04/12] migration: cpr_find_fd_any Steve Sistare
2024-07-20 19:15 ` [RFC V1 05/12] iommufd: preserve device fd Steve Sistare
2024-07-20 19:15 ` [RFC V1 06/12] iommufd: export iommufd_cdev_get_info_iova_range Steve Sistare
2024-07-20 19:15 ` [RFC V1 07/12] iommufd: change_process kernel interface Steve Sistare
2024-07-20 19:15 ` [RFC V1 08/12] vfio/iommufd: register container for cpr Steve Sistare
2024-07-20 19:15 ` [RFC V1 09/12] vfio/iommufd: rebuild device Steve Sistare
2024-07-20 19:15 ` [RFC V1 10/12] migration/ram: old host address Steve Sistare
2024-08-16 17:57 ` Fabiano Rosas
2024-08-16 18:13 ` Steven Sistare
2024-07-20 19:15 ` [RFC V1 11/12] iommufd: update DMA virtual addresses Steve Sistare
2024-07-20 19:15 ` [RFC V1 12/12] vfio: mdev blocker Steve Sistare
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=09e41cf4-78fb-4d31-9ada-8493247fec61@oracle.com \
--to=steven.sistare@oracle.com \
--cc=alex.williamson@redhat.com \
--cc=clg@redhat.com \
--cc=david@redhat.com \
--cc=eric.auger@redhat.com \
--cc=farosas@suse.de \
--cc=mst@redhat.com \
--cc=peterx@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=yi.l.liu@intel.com \
--cc=zhenzhong.duan@intel.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).