From 7d5255d9aa2d1b0da0e7fae12264c7582080de63 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Thu, 16 Nov 2017 03:07:14 +0100 Subject: [PATCH 10/30] exec: Explicitly export target AS from address_space_translate_internal RH-Author: David Gibson Message-id: <20171116030732.8560-5-dgibson@redhat.com> Patchwork-id: 77696 O-Subject: [PATCH 04/22] exec: Explicitly export target AS from address_space_translate_internal Bugzilla: 1481593 RH-Acked-by: Thomas Huth RH-Acked-by: Paolo Bonzini RH-Acked-by: Eduardo Habkost RH-Acked-by: Laurent Vivier From: Alexey Kardashevskiy This adds an AS** parameter to address_space_do_translate() to make it easier for the next patch to share FlatViews. This should cause no behavioural change. Signed-off-by: Alexey Kardashevskiy Message-Id: <20170921085110.25598-2-aik@ozlabs.ru> Signed-off-by: Paolo Bonzini (cherry picked from commit e76bb18f7e430e0c50fb38d051feacf268bd78f4) Signed-off-by: Miroslav Rezanina Conflicts: exec.c Conflicts because we applied 076a93d7 "exec: simplify address_space_get_iotlb_entry" out of order downstream. Signed-off-by: David Gibson --- exec.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/exec.c b/exec.c index ae37a60..f00bd4e 100644 --- a/exec.c +++ b/exec.c @@ -478,7 +478,8 @@ static MemoryRegionSection address_space_do_translate(AddressSpace *as, hwaddr *plen_out, hwaddr *page_mask_out, bool is_write, - bool is_mmio) + bool is_mmio, + AddressSpace **target_as) { IOMMUTLBEntry iotlb; MemoryRegionSection *section; @@ -512,6 +513,7 @@ static MemoryRegionSection address_space_do_translate(AddressSpace *as, } as = iotlb.target_as; + *target_as = iotlb.target_as; } *xlat = addr; @@ -547,7 +549,7 @@ IOMMUTLBEntry address_space_get_iotlb_entry(AddressSpace *as, hwaddr addr, * but page mask. */ section = address_space_do_translate(as, addr, &xlat, NULL, - &page_mask, is_write, false); + &page_mask, is_write, false, &as); /* Illegal translation */ if (section.mr == &io_mem_unassigned) { @@ -559,7 +561,7 @@ IOMMUTLBEntry address_space_get_iotlb_entry(AddressSpace *as, hwaddr addr, section.offset_within_region; return (IOMMUTLBEntry) { - .target_as = section.address_space, + .target_as = as, .iova = addr & ~page_mask, .translated_addr = xlat & ~page_mask, .addr_mask = page_mask, @@ -581,7 +583,7 @@ MemoryRegion *address_space_translate(AddressSpace *as, hwaddr addr, /* This can be MMIO, so setup MMIO bit. */ section = address_space_do_translate(as, addr, xlat, plen, NULL, - is_write, true); + is_write, true, &as); mr = section.mr; if (xen_enabled() && memory_access_is_direct(mr, is_write)) { -- 1.8.3.1