All of lore.kernel.org
 help / color / mirror / Atom feed
From: <zhuyijun@huawei.com>
To: qemu-arm@nongnu.org, qemu-devel@nongnu.org, eric.auger@redhat.com
Cc: peter.maydell@linaro.org, shameerali.kolothum.thodi@huawei.com,
	zhaoshenglong@huawei.com
Subject: [Qemu-devel] [RFC 0/5] arm: Exclude reserved memory regions of iommu to avoid
Date: Tue, 14 Nov 2017 09:15:49 +0800	[thread overview]
Message-ID: <1510622154-17224-1-git-send-email-zhuyijun@huawei.com> (raw)

From: Zhu Yijun <zhuyijun@huawei.com>

With kernel 4.11, iommu/smmu will populate the MSI IOVA reserved window and
PCI reserved window which has to be excluded from Guest iova allocations.

And on certain HiSilicon platforms (hip06/hip07), the GIC ITS and PCIe RC 
deviates from the standard implementation will reserve the hw msi regions in
the smmu-v3 driver which means these address regions will not be translated.

https://www.spinics.net/lists/linux-pci/msg65125.html

On such platforms, reserved memory regions will export like this:

root:~# cat /sys/kernel/iommu_groups/7/reserved_regions
0x00000000a8800000 0x00000000affeffff reserved
0x00000000c6000000 0x00000000c601ffff msi

However, it falls within the Qemu default virtual memory address space.

Take a look at hw/arm/virt.c:

[VIRT_MEM] =             { 0x40000000, RAMLIMIT_BYTES },
    . . .

    memory_region_allocate_system_memory(ram, NULL, "mach-virt.ram",
                                                     machine->ram_size);
memory_region_add_subregion(sysmem, vms->memmap[VIRT_MEM].base, ram);

So suppose we allocate 4GB mem to a VM, there is a chance that the reserved
regions will get allocated for a Guest VF DMA iova and it will fail.

This patchset create holes in the Qemu RAM address space which exclude
the sysfs exported regions.


Zhu Yijun (5):
  hw/vfio: Add function for getting reserved_region of device iommu
    group
  hw/arm/virt: Enable dynamic generation of guest RAM memory regions
  hw/arm: add scattered RAM memory region support
  hw/arm/boot: set fdt size cell of memory node from mem_list
  hw/arm/virt-acpi-build: Build srat table according to mem_list

 hw/arm/boot.c                 | 155 +++++++++++++++++++++++++++++++-----------
 hw/arm/virt-acpi-build.c      |  40 +++++++++--
 hw/arm/virt.c                 | 120 ++++++++++++++++++++++++++++++--
 hw/vfio/common.c              |  67 ++++++++++++++++++
 hw/vfio/pci.c                 |   2 +
 hw/vfio/platform.c            |   2 +
 include/exec/memory.h         |   7 ++
 include/hw/arm/arm.h          |   1 +
 include/hw/arm/virt.h         |   1 +
 include/hw/vfio/vfio-common.h |   3 +
 10 files changed, 347 insertions(+), 51 deletions(-)

-- 
1.8.3.1

             reply	other threads:[~2017-11-14  1:16 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-14  1:15 zhuyijun [this message]
2017-11-14  1:15 ` [Qemu-devel] [RFC 1/5] hw/vfio: Add function for getting reserved_region of device iommu group zhuyijun
2017-11-14 15:47   ` Alex Williamson
2017-11-15  9:49     ` Shameerali Kolothum Thodi
2017-11-15 18:25       ` Alex Williamson
2017-11-20 11:58         ` Shameerali Kolothum Thodi
2017-11-20 15:57           ` Alex Williamson
2017-11-20 16:31             ` Shameerali Kolothum Thodi
2017-12-06 10:30             ` Shameerali Kolothum Thodi
2017-12-06 14:01               ` Auger Eric
2017-12-06 14:38                 ` Shameerali Kolothum Thodi
2017-12-06 14:59                   ` Auger Eric
2017-12-06 15:19                     ` Shameerali Kolothum Thodi
2017-11-14  1:15 ` [Qemu-devel] [RFC 2/5] hw/arm/virt: Enable dynamic generation of guest RAM memory regions zhuyijun
2017-11-14 14:47   ` Andrew Jones
2017-11-20  9:22     ` Zhu Yijun
2017-11-14  1:15 ` [Qemu-devel] [RFC 3/5] hw/arm: add scattered RAM memory region support zhuyijun
2017-11-14 14:50   ` Andrew Jones
2017-11-20  9:54     ` Zhu Yijun
2018-04-19  9:06     ` Shameerali Kolothum Thodi
2018-04-24 15:29       ` Andrew Jones
2018-04-25 13:24         ` Shameerali Kolothum Thodi
2017-11-14  1:15 ` [Qemu-devel] [RFC 4/5] hw/arm/boot: set fdt size cell of memory node from mem_list zhuyijun
2017-11-14 14:51   ` Andrew Jones
2017-11-20  9:38     ` Zhu Yijun
2017-11-14  1:15 ` [Qemu-devel] [RFC 5/5] hw/arm/virt-acpi-build: Build srat table according to mem_list zhuyijun
2017-11-14 14:51   ` Andrew Jones
2017-11-20  9:39     ` Zhu Yijun
2017-11-14  1:42 ` [Qemu-devel] [RFC 0/5] arm: Exclude reserved memory regions of iommu to avoid no-reply
  -- strict thread matches above, loose matches on Subject: below --
2017-11-13 12:29 zhuyijun
2017-11-13 20:01 ` Auger Eric

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=1510622154-17224-1-git-send-email-zhuyijun@huawei.com \
    --to=zhuyijun@huawei.com \
    --cc=eric.auger@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=shameerali.kolothum.thodi@huawei.com \
    --cc=zhaoshenglong@huawei.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 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.