From: Luiz Capitulino <lcapitulino@redhat.com>
To: "Andreas Färber" <afaerber@suse.de>
Cc: Markus Armbruster <armbru@redhat.com>,
qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] fix bits 39:32 of the final physical address when using 4M page
Date: Mon, 7 Jan 2013 11:40:08 -0200 [thread overview]
Message-ID: <20130107114008.7419e2fd@doriath.home> (raw)
In-Reply-To: <50EAC956.40409@suse.de>
On Mon, 07 Jan 2013 14:10:46 +0100
Andreas Färber <afaerber@suse.de> wrote:
> Am 07.01.2013 13:06, schrieb Markus Armbruster:
> > Wen Congyang <wency@cn.fujitsu.com> writes:
> >
> >> ((pde & 0x1fe000) << 19) is the bits 39:32 of the final physical address, and
> >> we shouldn't use unit32_t to calculate it. Convert the type to hwaddr to fix
> >> this problem.
> >
> > Spotted by Coverity.
> >
> >> Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
> >>
> >> ---
> >> target-i386/arch_memory_mapping.c | 11 ++++++++---
> >> 1 file changed, 8 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/target-i386/arch_memory_mapping.c b/target-i386/arch_memory_mapping.c
> >> index c6c7874..844893f 100644
> >> --- a/target-i386/arch_memory_mapping.c
> >> +++ b/target-i386/arch_memory_mapping.c
> >> @@ -115,7 +115,7 @@ static void walk_pde2(MemoryMappingList *list,
> >> hwaddr pde_start_addr, int32_t a20_mask,
> >> bool pse)
> >> {
> >> - hwaddr pde_addr, pte_start_addr, start_paddr;
> >> + hwaddr pde_addr, pte_start_addr, start_paddr, high_paddr;
> >> uint32_t pde;
> >> target_ulong line_addr, start_vaddr;
> >> int i;
> >> @@ -130,8 +130,13 @@ static void walk_pde2(MemoryMappingList *list,
> >>
> >> line_addr = (((unsigned int)i & 0x3ff) << 22);
> >> if ((pde & PG_PSE_MASK) && pse) {
> >> - /* 4 MB page */
> >> - start_paddr = (pde & ~0x3fffff) | ((pde & 0x1fe000) << 19);
> >> + /*
> >> + * 4 MB page:
> >> + * bits 39:32 are bits 20:13 of the PDE
> >> + * bit3 31:22 are bits 31:22 of the PDE
> >> + */
> >> + high_paddr = ((hwaddr)(pde & 0x1fe000) << 19);
> >> + start_paddr = (pde & ~0x3fffff) | high_paddr;
> >> if (cpu_physical_memory_is_io(start_paddr)) {
> >> /* I/O region */
> >> continue;
> >
> > Extra points for extending the comment.
>
> ...and a "target-i386: " prefix in the subject would be appreciated,
> since it does not seem to fix a general issue.
I can do that myself when I apply the patch (which will take a little bit,
as I'm just back from vacation).
>
> Andreas
>
> >
> > Reviewed-by: Markus Armbruster <armbru@redhat.com>
> >
>
>
next prev parent reply other threads:[~2013-01-07 14:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-22 7:13 [Qemu-devel] [PATCH] fix bits 39:32 of the final physical address when using 4M page Wen Congyang
2013-01-07 12:06 ` Markus Armbruster
2013-01-07 13:10 ` Andreas Färber
2013-01-07 13:40 ` Luiz Capitulino [this message]
2013-01-09 11:47 ` Luiz Capitulino
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=20130107114008.7419e2fd@doriath.home \
--to=lcapitulino@redhat.com \
--cc=afaerber@suse.de \
--cc=armbru@redhat.com \
--cc=qemu-devel@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).