diff mbox series

[v2] Replace round_page() with TARGET_PAGE_ALIGN()

Message ID 20170911201610.15204-1-n54@gmx.com
State New
Headers show
Series [v2] Replace round_page() with TARGET_PAGE_ALIGN() | expand

Commit Message

Kamil Rytarowski Sept. 11, 2017, 8:16 p.m. UTC
This change fixes conflict with the DragonFly BSD headers.

Signed-off-by: Kamil Rytarowski <n54@gmx.com>
---
 hw/ppc/mac_newworld.c | 11 +++--------
 hw/ppc/mac_oldworld.c | 11 +++--------
 2 files changed, 6 insertions(+), 16 deletions(-)

Comments

Thomas Huth Sept. 12, 2017, 11:46 a.m. UTC | #1
On 11.09.2017 22:16, Kamil Rytarowski wrote:
> This change fixes conflict with the DragonFly BSD headers.
> 
> Signed-off-by: Kamil Rytarowski <n54@gmx.com>
> ---
>  hw/ppc/mac_newworld.c | 11 +++--------
>  hw/ppc/mac_oldworld.c | 11 +++--------
>  2 files changed, 6 insertions(+), 16 deletions(-)
> 
> diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
> index d466634997..51bf83019b 100644
> --- a/hw/ppc/mac_newworld.c
> +++ b/hw/ppc/mac_newworld.c
> @@ -124,11 +124,6 @@ static uint64_t translate_kernel_address(void *opaque, uint64_t addr)
>      return (addr & 0x0fffffff) + KERNEL_LOAD_ADDR;
>  }
>  
> -static hwaddr round_page(hwaddr addr)
> -{
> -    return (addr + TARGET_PAGE_SIZE - 1) & TARGET_PAGE_MASK;
> -}
> -
>  static void ppc_core99_reset(void *opaque)
>  {
>      PowerPCCPU *cpu = opaque;
> @@ -256,7 +251,7 @@ static void ppc_core99_init(MachineState *machine)
>          }
>          /* load initrd */
>          if (initrd_filename) {
> -            initrd_base = round_page(kernel_base + kernel_size + KERNEL_GAP);
> +            initrd_base = TARGET_PAGE_ALIGN(kernel_base + kernel_size + KERNEL_GAP);
>              initrd_size = load_image_targphys(initrd_filename, initrd_base,
>                                                ram_size - initrd_base);
>              if (initrd_size < 0) {
> @@ -264,11 +259,11 @@ static void ppc_core99_init(MachineState *machine)
>                               initrd_filename);
>                  exit(1);
>              }
> -            cmdline_base = round_page(initrd_base + initrd_size);
> +            cmdline_base = TARGET_PAGE_ALIGN(initrd_base + initrd_size);
>          } else {
>              initrd_base = 0;
>              initrd_size = 0;
> -            cmdline_base = round_page(kernel_base + kernel_size + KERNEL_GAP);
> +            cmdline_base = TARGET_PAGE_ALIGN(kernel_base + kernel_size + KERNEL_GAP);
>          }
>          ppc_boot_device = 'm';
>      } else {
> diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c
> index fcac399562..feb31911ca 100644
> --- a/hw/ppc/mac_oldworld.c
> +++ b/hw/ppc/mac_oldworld.c
> @@ -66,11 +66,6 @@ static uint64_t translate_kernel_address(void *opaque, uint64_t addr)
>      return (addr & 0x0fffffff) + KERNEL_LOAD_ADDR;
>  }
>  
> -static hwaddr round_page(hwaddr addr)
> -{
> -    return (addr + TARGET_PAGE_SIZE - 1) & TARGET_PAGE_MASK;
> -}
> -
>  static void ppc_heathrow_reset(void *opaque)
>  {
>      PowerPCCPU *cpu = opaque;
> @@ -191,7 +186,7 @@ static void ppc_heathrow_init(MachineState *machine)
>          }
>          /* load initrd */
>          if (initrd_filename) {
> -            initrd_base = round_page(kernel_base + kernel_size + KERNEL_GAP);
> +            initrd_base = TARGET_PAGE_ALIGN(kernel_base + kernel_size + KERNEL_GAP);
>              initrd_size = load_image_targphys(initrd_filename, initrd_base,
>                                                ram_size - initrd_base);
>              if (initrd_size < 0) {
> @@ -199,11 +194,11 @@ static void ppc_heathrow_init(MachineState *machine)
>                               initrd_filename);
>                  exit(1);
>              }
> -            cmdline_base = round_page(initrd_base + initrd_size);
> +            cmdline_base = TARGET_PAGE_ALIGN(initrd_base + initrd_size);
>          } else {
>              initrd_base = 0;
>              initrd_size = 0;
> -            cmdline_base = round_page(kernel_base + kernel_size + KERNEL_GAP);
> +            cmdline_base = TARGET_PAGE_ALIGN(kernel_base + kernel_size + KERNEL_GAP);
>          }
>          ppc_boot_device = 'm';
>      } else {
> 

Reviewed-by: Thomas Huth <thuth@redhat.com>

(and please make sure to CC: qemu-ppc@nongnu.org for ppc related changes)
Michael Tokarev Sept. 14, 2017, 7:41 a.m. UTC | #2
11.09.2017 23:16, Kamil Rytarowski пишет:
> This change fixes conflict with the DragonFly BSD headers.

Applied to -trivial, thanks!

/mjt
diff mbox series

Patch

diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
index d466634997..51bf83019b 100644
--- a/hw/ppc/mac_newworld.c
+++ b/hw/ppc/mac_newworld.c
@@ -124,11 +124,6 @@  static uint64_t translate_kernel_address(void *opaque, uint64_t addr)
     return (addr & 0x0fffffff) + KERNEL_LOAD_ADDR;
 }
 
-static hwaddr round_page(hwaddr addr)
-{
-    return (addr + TARGET_PAGE_SIZE - 1) & TARGET_PAGE_MASK;
-}
-
 static void ppc_core99_reset(void *opaque)
 {
     PowerPCCPU *cpu = opaque;
@@ -256,7 +251,7 @@  static void ppc_core99_init(MachineState *machine)
         }
         /* load initrd */
         if (initrd_filename) {
-            initrd_base = round_page(kernel_base + kernel_size + KERNEL_GAP);
+            initrd_base = TARGET_PAGE_ALIGN(kernel_base + kernel_size + KERNEL_GAP);
             initrd_size = load_image_targphys(initrd_filename, initrd_base,
                                               ram_size - initrd_base);
             if (initrd_size < 0) {
@@ -264,11 +259,11 @@  static void ppc_core99_init(MachineState *machine)
                              initrd_filename);
                 exit(1);
             }
-            cmdline_base = round_page(initrd_base + initrd_size);
+            cmdline_base = TARGET_PAGE_ALIGN(initrd_base + initrd_size);
         } else {
             initrd_base = 0;
             initrd_size = 0;
-            cmdline_base = round_page(kernel_base + kernel_size + KERNEL_GAP);
+            cmdline_base = TARGET_PAGE_ALIGN(kernel_base + kernel_size + KERNEL_GAP);
         }
         ppc_boot_device = 'm';
     } else {
diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c
index fcac399562..feb31911ca 100644
--- a/hw/ppc/mac_oldworld.c
+++ b/hw/ppc/mac_oldworld.c
@@ -66,11 +66,6 @@  static uint64_t translate_kernel_address(void *opaque, uint64_t addr)
     return (addr & 0x0fffffff) + KERNEL_LOAD_ADDR;
 }
 
-static hwaddr round_page(hwaddr addr)
-{
-    return (addr + TARGET_PAGE_SIZE - 1) & TARGET_PAGE_MASK;
-}
-
 static void ppc_heathrow_reset(void *opaque)
 {
     PowerPCCPU *cpu = opaque;
@@ -191,7 +186,7 @@  static void ppc_heathrow_init(MachineState *machine)
         }
         /* load initrd */
         if (initrd_filename) {
-            initrd_base = round_page(kernel_base + kernel_size + KERNEL_GAP);
+            initrd_base = TARGET_PAGE_ALIGN(kernel_base + kernel_size + KERNEL_GAP);
             initrd_size = load_image_targphys(initrd_filename, initrd_base,
                                               ram_size - initrd_base);
             if (initrd_size < 0) {
@@ -199,11 +194,11 @@  static void ppc_heathrow_init(MachineState *machine)
                              initrd_filename);
                 exit(1);
             }
-            cmdline_base = round_page(initrd_base + initrd_size);
+            cmdline_base = TARGET_PAGE_ALIGN(initrd_base + initrd_size);
         } else {
             initrd_base = 0;
             initrd_size = 0;
-            cmdline_base = round_page(kernel_base + kernel_size + KERNEL_GAP);
+            cmdline_base = TARGET_PAGE_ALIGN(kernel_base + kernel_size + KERNEL_GAP);
         }
         ppc_boot_device = 'm';
     } else {