On 10/05/2017 07:13 PM, Maxime Coquelin wrote:
static MemoryRegionSection flatview_do_translate(FlatView *fv,
hwaddr addr,
hwaddr *xlat,
- hwaddr *plen,
+ hwaddr *plen_out,
+ hwaddr *page_mask_out,
bool is_write,
bool is_mmio,
AddressSpace **target_as)
@@ -480,11 +498,17 @@ static MemoryRegionSection flatview_do_translate(FlatView
*fv,
MemoryRegionSection *section;
IOMMUMemoryRegion *iommu_mr;
IOMMUMemoryRegionClass *imrc;
+ hwaddr page_mask = TARGET_PAGE_MASK;
There is a bug here that breaks the case when iommu is not enabled in
kernel cmdline. In this case returned page_mask is the about init value.
But TARGET_PAGE_MASK actually represents the pfn mask, from cpu-all.h:
#define TARGET_PAGE_SIZE (1 << TARGET_PAGE_BITS)
#define TARGET_PAGE_MASK ~(TARGET_PAGE_SIZE - 1)
With TARGET_PAGE_SIZE being 12 on x86.
What we expect here as init value is its complement, i.e. 0xfff on x86.
I'll send a follow-up patch in a short while.
Regards,
Maxime