qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [REBASED 1/2] exec: add page_mask for flatview_do_trans


From: Maxime Coquelin
Subject: Re: [Qemu-devel] [REBASED 1/2] exec: add page_mask for flatview_do_translate
Date: Fri, 6 Oct 2017 12:28:22 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0



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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]