qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] phys_page_find_alloc: Use correct initial region_offset.
@ 2011-12-13 10:52 Alex_Rozenman
  2011-12-15 18:11 ` Anthony Liguori
  0 siblings, 1 reply; 2+ messages in thread
From: Alex_Rozenman @ 2011-12-13 10:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anthony Liguori, Alex Rozenman

From: Alex Rozenman <Alex_Rozenman@mentor.com>

This fixes a common bug with initial region_offset value.
Usually, the pages are re-assigned afterwards, so the bug
has a very small effect on regular QEMU use flows.

Signed-off-by: Alex Rozenman <Alex_Rozenman@mentor.com>
---
 exec.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/exec.c b/exec.c
index d8b2180..14628d9 100644
--- a/exec.c
+++ b/exec.c
@@ -418,6 +418,7 @@ static PhysPageDesc *phys_page_find_alloc(target_phys_addr_t index, int alloc)
     pd = *lp;
     if (pd == NULL) {
         int i;
+        int first_index = index & ~(L2_SIZE - 1);
 
         if (!alloc) {
             return NULL;
@@ -427,7 +428,7 @@ static PhysPageDesc *phys_page_find_alloc(target_phys_addr_t index, int alloc)
 
         for (i = 0; i < L2_SIZE; i++) {
             pd[i].phys_offset = IO_MEM_UNASSIGNED;
-            pd[i].region_offset = (index + i) << TARGET_PAGE_BITS;
+            pd[i].region_offset = (first_index + i) << TARGET_PAGE_BITS;
         }
     }
 
-- 
1.7.8

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] phys_page_find_alloc: Use correct initial region_offset.
  2011-12-13 10:52 [Qemu-devel] [PATCH] phys_page_find_alloc: Use correct initial region_offset Alex_Rozenman
@ 2011-12-15 18:11 ` Anthony Liguori
  0 siblings, 0 replies; 2+ messages in thread
From: Anthony Liguori @ 2011-12-15 18:11 UTC (permalink / raw)
  To: Alex_Rozenman; +Cc: qemu-devel

On 12/13/2011 04:52 AM, Alex_Rozenman@mentor.com wrote:
> From: Alex Rozenman<Alex_Rozenman@mentor.com>
>
> This fixes a common bug with initial region_offset value.
> Usually, the pages are re-assigned afterwards, so the bug
> has a very small effect on regular QEMU use flows.
>
> Signed-off-by: Alex Rozenman<Alex_Rozenman@mentor.com>

Applied.  Thanks.

Regards,

Anthony Liguori

> ---
>   exec.c |    3 ++-
>   1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/exec.c b/exec.c
> index d8b2180..14628d9 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -418,6 +418,7 @@ static PhysPageDesc *phys_page_find_alloc(target_phys_addr_t index, int alloc)
>       pd = *lp;
>       if (pd == NULL) {
>           int i;
> +        int first_index = index&  ~(L2_SIZE - 1);
>
>           if (!alloc) {
>               return NULL;
> @@ -427,7 +428,7 @@ static PhysPageDesc *phys_page_find_alloc(target_phys_addr_t index, int alloc)
>
>           for (i = 0; i<  L2_SIZE; i++) {
>               pd[i].phys_offset = IO_MEM_UNASSIGNED;
> -            pd[i].region_offset = (index + i)<<  TARGET_PAGE_BITS;
> +            pd[i].region_offset = (first_index + i)<<  TARGET_PAGE_BITS;
>           }
>       }
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-12-15 18:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-13 10:52 [Qemu-devel] [PATCH] phys_page_find_alloc: Use correct initial region_offset Alex_Rozenman
2011-12-15 18:11 ` Anthony Liguori

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).