qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: peterx@redhat.com, pbonzini@redhat.com, mst@redhat.com,
	jasowang@redhat.com, qemu-devel@nongnu.org
Cc: qemu-stable@nongnu.org
Subject: Re: [Qemu-devel] [REBASED 1/2] exec: add page_mask for flatview_do_translate
Date: Fri, 6 Oct 2017 12:28:22 +0200	[thread overview]
Message-ID: <cdcc828e-bd75-cd06-9c95-9e661055a7b4@redhat.com> (raw)
In-Reply-To: <20171005171309.1250-2-maxime.coquelin@redhat.com>



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	other threads:[~2017-10-06 10:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-05 17:13 [Qemu-devel] [REBASED 0/2] exec: further refine address_space_get_iotlb_entry() Maxime Coquelin
2017-10-05 17:13 ` [Qemu-devel] [REBASED 1/2] exec: add page_mask for flatview_do_translate Maxime Coquelin
2017-10-06 10:28   ` Maxime Coquelin [this message]
2017-10-05 17:13 ` [Qemu-devel] [REBASED 2/2] exec: simplify address_space_get_iotlb_entry Maxime Coquelin
2017-10-06  4:04 ` [Qemu-devel] [REBASED 0/2] exec: further refine address_space_get_iotlb_entry() Michael S. Tsirkin

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=cdcc828e-bd75-cd06-9c95-9e661055a7b4@redhat.com \
    --to=maxime.coquelin@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).