[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 26/55] exec: simplify address_space_get_iotlb_entry
From: |
Michael Roth |
Subject: |
[Qemu-devel] [PATCH 26/55] exec: simplify address_space_get_iotlb_entry |
Date: |
Wed, 6 Dec 2017 13:16:19 -0600 |
From: Peter Xu <address@hidden>
This patch let address_space_get_iotlb_entry() to use the newly
introduced page_mask parameter in flatview_do_translate(). Then we
will be sure the IOTLB can be aligned to page mask, also we should
nicely support huge pages now when introducing a764040.
Fixes: a764040 ("exec: abstract address_space_do_translate()")
Signed-off-by: Peter Xu <address@hidden>
Signed-off-by: Maxime Coquelin <address@hidden>
Acked-by: Michael S. Tsirkin <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
(cherry picked from commit 076a93d7972c9c1e3839d2f65edc32568a2cce93)
Signed-off-by: Michael Roth <address@hidden>
---
exec.c | 31 ++++++++++---------------------
1 file changed, 10 insertions(+), 21 deletions(-)
diff --git a/exec.c b/exec.c
index 2fd65dc3f2..9a7600eb17 100644
--- a/exec.c
+++ b/exec.c
@@ -557,14 +557,14 @@ IOMMUTLBEntry address_space_get_iotlb_entry(AddressSpace
*as, hwaddr addr,
bool is_write)
{
MemoryRegionSection section;
- hwaddr xlat, plen;
+ hwaddr xlat, page_mask;
- /* Try to get maximum page mask during translation. */
- plen = (hwaddr)-1;
-
- /* This can never be MMIO. */
- section = flatview_do_translate(address_space_to_flatview(as), addr,
- &xlat, &plen, NULL, is_write, false, &as);
+ /*
+ * This can never be MMIO, and we don't really care about plen,
+ * but page mask.
+ */
+ section = flatview_do_translate(address_space_to_flatview(as), addr, &xlat,
+ NULL, &page_mask, is_write, false, &as);
/* Illegal translation */
if (section.mr == &io_mem_unassigned) {
@@ -575,22 +575,11 @@ IOMMUTLBEntry address_space_get_iotlb_entry(AddressSpace
*as, hwaddr addr,
xlat += section.offset_within_address_space -
section.offset_within_region;
- if (plen == (hwaddr)-1) {
- /*
- * We use default page size here. Logically it only happens
- * for identity mappings.
- */
- plen = TARGET_PAGE_SIZE;
- }
-
- /* Convert to address mask */
- plen -= 1;
-
return (IOMMUTLBEntry) {
.target_as = as,
- .iova = addr & ~plen,
- .translated_addr = xlat & ~plen,
- .addr_mask = plen,
+ .iova = addr & ~page_mask,
+ .translated_addr = xlat & ~page_mask,
+ .addr_mask = page_mask,
/* IOTLBs are for DMAs, and DMA only allows on RAMs. */
.perm = IOMMU_RW,
};
--
2.11.0
- [Qemu-devel] [PATCH 19/55] memory: Do not allocate FlatView in address_space_init, (continued)
- [Qemu-devel] [PATCH 19/55] memory: Do not allocate FlatView in address_space_init, Michael Roth, 2017/12/06
- [Qemu-devel] [PATCH 17/55] memory: Move address_space_update_ioeventfds, Michael Roth, 2017/12/06
- [Qemu-devel] [PATCH 01/55] hw/ppc: CAS reset on early device hotplug, Michael Roth, 2017/12/06
- [Qemu-devel] [PATCH 22/55] memory: trace FlatView creation and destruction, Michael Roth, 2017/12/06
- [Qemu-devel] [PATCH 21/55] memory: Create FlatView directly, Michael Roth, 2017/12/06
- [Qemu-devel] [PATCH 23/55] memory: seek FlatView sharing candidates among children subregions, Michael Roth, 2017/12/06
- [Qemu-devel] [PATCH 24/55] memory: Share special empty FlatView, Michael Roth, 2017/12/06
- [Qemu-devel] [PATCH 27/55] memory: fix off-by-one error in memory_region_notify_one(), Michael Roth, 2017/12/06
- [Qemu-devel] [PATCH 29/55] qcow2: Fix unaligned preallocated truncation, Michael Roth, 2017/12/06
- [Qemu-devel] [PATCH 25/55] exec: add page_mask for flatview_do_translate, Michael Roth, 2017/12/06
- [Qemu-devel] [PATCH 26/55] exec: simplify address_space_get_iotlb_entry,
Michael Roth <=
- [Qemu-devel] [PATCH 02/55] hw/usb/bus: Remove bad object_unparent() from usb_try_create_simple(), Michael Roth, 2017/12/06
- [Qemu-devel] [PATCH 32/55] nios2: define tcg_env, Michael Roth, 2017/12/06
- [Qemu-devel] [PATCH 33/55] io: monitor encoutput buffer size from websocket GSource, Michael Roth, 2017/12/06
- [Qemu-devel] [PATCH 34/55] ppc: fix setting of compat mode, Michael Roth, 2017/12/06
- [Qemu-devel] [PATCH 28/55] hw/sd: fix out-of-bounds check for multi block reads, Michael Roth, 2017/12/06
- [Qemu-devel] [PATCH 30/55] qcow2: Always execute preallocate() in a coroutine, Michael Roth, 2017/12/06
- [Qemu-devel] [PATCH 31/55] iotests: Add cluster_size=64k to 125, Michael Roth, 2017/12/06
- [Qemu-devel] [PATCH 36/55] hw/intc/arm_gicv3_its: Don't abort on table save failure, Michael Roth, 2017/12/06
- [Qemu-devel] [PATCH 40/55] util/stats64: Fix min/max comparisons, Michael Roth, 2017/12/06
- [Qemu-devel] [PATCH 38/55] net: fix check for number of parameters to -netdev socket, Michael Roth, 2017/12/06