Re: [PATCH V2 55/68] powerpc/mm: VMALLOC abstraction

2016-04-27 Thread Aneesh Kumar K.V

vmalloc range differs between hash and radix config. Hence make
VMALLOC_START and related constants a variable which get
runtime initialized depending on hash or radix.


> Signed-off-by: Aneesh Kumar K.V 
> ---
>  arch/powerpc/include/asm/book3s/64/hash.h| 14 +++---
>  arch/powerpc/include/asm/book3s/64/pgtable.h | 15 ---
>  arch/powerpc/include/asm/book3s/64/radix.h   | 21 +
>  arch/powerpc/kernel/pci_64.c |  3 ++-
>  arch/powerpc/mm/hash_utils_64.c  |  8 
>  arch/powerpc/mm/pgtable-radix.c  |  7 +++
>  arch/powerpc/mm/pgtable_64.c | 13 +++--
>  arch/powerpc/mm/slb_low.S|  2 +-
>  8 files changed, 69 insertions(+), 14 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/book3s/64/hash.h 
> b/arch/powerpc/include/asm/book3s/64/hash.h
> index 43bd7d15f41e..9da410ea7e1a 100644
> --- a/arch/powerpc/include/asm/book3s/64/hash.h
> +++ b/arch/powerpc/include/asm/book3s/64/hash.h
> @@ -45,17 +45,17 @@
>  /*
>   * Define the address range of the kernel non-linear virtual area
>   */
> -#define KERN_VIRT_START ASM_CONST(0xD000)
> -#define KERN_VIRT_SIZE   ASM_CONST(0x1000)
> +#define H_KERN_VIRT_START ASM_CONST(0xD000)
> +#define H_KERN_VIRT_SIZE ASM_CONST(0x1000)
>
>  /*
>   * The vmalloc space starts at the beginning of that region, and
>   * occupies half of it on hash CPUs and a quarter of it on Book3E
>   * (we keep a quarter for the virtual memmap)
>   */
> -#define VMALLOC_STARTKERN_VIRT_START
> -#define VMALLOC_SIZE (KERN_VIRT_SIZE >> 1)
> -#define VMALLOC_END  (VMALLOC_START + VMALLOC_SIZE)
> +#define H_VMALLOC_START  H_KERN_VIRT_START
> +#define H_VMALLOC_SIZE   (H_KERN_VIRT_SIZE >> 1)
> +#define H_VMALLOC_END(H_VMALLOC_START + H_VMALLOC_SIZE)
>
>  /*
>   * Region IDs
> @@ -64,7 +64,7 @@
>  #define REGION_MASK  (0xfUL << REGION_SHIFT)
>  #define REGION_ID(ea)(((unsigned long)(ea)) >> REGION_SHIFT)
>
> -#define VMALLOC_REGION_ID(REGION_ID(VMALLOC_START))
> +#define VMALLOC_REGION_ID(REGION_ID(H_VMALLOC_START))
>  #define KERNEL_REGION_ID (REGION_ID(PAGE_OFFSET))
>  #define VMEMMAP_REGION_ID(0xfUL) /* Server only */
>  #define USER_REGION_ID   (0UL)
> @@ -73,7 +73,7 @@
>   * Defines the address of the vmemap area, in its own region on
>   * hash table CPUs.
>   */
> -#define VMEMMAP_BASE (VMEMMAP_REGION_ID << REGION_SHIFT)
> +#define H_VMEMMAP_BASE   (VMEMMAP_REGION_ID << REGION_SHIFT)
>
>  #ifdef CONFIG_PPC_MM_SLICES
>  #define HAVE_ARCH_UNMAPPED_AREA
> diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h 
> b/arch/powerpc/include/asm/book3s/64/pgtable.h
> index b8ee70458bae..87519ad1c5dc 100644
> --- a/arch/powerpc/include/asm/book3s/64/pgtable.h
> +++ b/arch/powerpc/include/asm/book3s/64/pgtable.h
> @@ -208,6 +208,18 @@ extern unsigned long __pgd_val_bits;
>  #define PUD_MASKED_BITS  0xc0ffUL
>  /* Bits to mask out from a PGD to get to the PUD page */
>  #define PGD_MASKED_BITS  0xc0ffUL
> +
> +extern unsigned long __vmalloc_start;
> +extern unsigned long __vmalloc_end;
> +#define VMALLOC_START__vmalloc_start
> +#define VMALLOC_END  __vmalloc_end
> +
> +extern unsigned long __kernel_virt_start;
> +extern unsigned long __kernel_virt_size;
> +#define KERN_VIRT_START __kernel_virt_start
> +#define KERN_VIRT_SIZE  __kernel_virt_size
> +extern struct page *vmemmap;
> +extern unsigned long ioremap_bot;
>  #endif /* __ASSEMBLY__ */
>
>  #include 
> @@ -220,7 +232,6 @@ extern unsigned long __pgd_val_bits;
>  #endif
>
>  #include 
> -
>  /*
>   * The second half of the kernel virtual space is used for IO mappings,
>   * it's itself carved into the PIO region (ISA and PHB IO space) and
> @@ -239,8 +250,6 @@ extern unsigned long __pgd_val_bits;
>  #define IOREMAP_BASE (PHB_IO_END)
>  #define IOREMAP_END  (KERN_VIRT_START + KERN_VIRT_SIZE)
>
> -#define vmemmap  ((struct page *)VMEMMAP_BASE)
> -
>  /* Advertise special mapping type for AGP */
>  #define HAVE_PAGE_AGP
>
> diff --git a/arch/powerpc/include/asm/book3s/64/radix.h 
> b/arch/powerpc/include/asm/book3s/64/radix.h
> index 040c4a56d07b..d0449c0f2166 100644
> --- a/arch/powerpc/include/asm/book3s/64/radix.h
> +++ b/arch/powerpc/include/asm/book3s/64/radix.h
> @@ -30,6 +30,27 @@
>  #define R_PGTABLE_EADDR_SIZE (R_PTE_INDEX_SIZE + R_PMD_INDEX_SIZE +  \
> R_PUD_INDEX_SIZE + R_PGD_INDEX_SIZE + PAGE_SHIFT)
>  #define R_PGTABLE_RANGE (ASM_CONST(1) << R_PGTABLE_EADDR_SIZE)
> +/*
> + * We support 52 bit address space, Use top bit for kernel
> + * virtual mapping. Also make sure kernel fit in the top
> + * quadrant.
> + */
> +#define R_KERN_VIRT_START ASM_CONST(0xc008)
> +#define R_KERN_VIRT_SIZE  ASM_CONST(0x0008)
> +
> +/*
> + * The vmalloc space

Re: [PATCH V2 55/68] powerpc/mm: VMALLOC abstraction

2016-04-25 Thread Balbir Singh


On 23/04/16 13:29, Aneesh Kumar K.V wrote:
> Michael Neuling  writes:
> 
>> Aneesh,
>>
>> I'm not sure why we need this patch.
>>
>> It seems to be moving the initialisation of some global variables into
>> init functions from the definitions.  And renames some things.
> 
> 
> because the value to which it is getting initialized is no more a
> constant.
> 

Isn't it still a constant depending on the type of page table? Or is it a run 
time value depending on the chosen page table type?

Balbir Singh
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH V2 55/68] powerpc/mm: VMALLOC abstraction

2016-04-25 Thread Balbir Singh


On 09/04/16 16:13, Aneesh Kumar K.V wrote:
> Signed-off-by: Aneesh Kumar K.V 
> ---
>  arch/powerpc/include/asm/book3s/64/hash.h| 14 +++---
>  arch/powerpc/include/asm/book3s/64/pgtable.h | 15 ---
>  arch/powerpc/include/asm/book3s/64/radix.h   | 21 +
>  arch/powerpc/kernel/pci_64.c |  3 ++-
>  arch/powerpc/mm/hash_utils_64.c  |  8 
>  arch/powerpc/mm/pgtable-radix.c  |  7 +++
>  arch/powerpc/mm/pgtable_64.c | 13 +++--
>  arch/powerpc/mm/slb_low.S|  2 +-
>  8 files changed, 69 insertions(+), 14 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/book3s/64/hash.h 
> b/arch/powerpc/include/asm/book3s/64/hash.h
> index 43bd7d15f41e..9da410ea7e1a 100644
> --- a/arch/powerpc/include/asm/book3s/64/hash.h
> +++ b/arch/powerpc/include/asm/book3s/64/hash.h
> @@ -45,17 +45,17 @@
>  /*
>   * Define the address range of the kernel non-linear virtual area
>   */
> -#define KERN_VIRT_START ASM_CONST(0xD000)
> -#define KERN_VIRT_SIZE   ASM_CONST(0x1000)
> +#define H_KERN_VIRT_START ASM_CONST(0xD000)
> +#define H_KERN_VIRT_SIZE ASM_CONST(0x1000)
>  
>  /*
>   * The vmalloc space starts at the beginning of that region, and
>   * occupies half of it on hash CPUs and a quarter of it on Book3E
>   * (we keep a quarter for the virtual memmap)
>   */
> -#define VMALLOC_STARTKERN_VIRT_START
> -#define VMALLOC_SIZE (KERN_VIRT_SIZE >> 1)
> -#define VMALLOC_END  (VMALLOC_START + VMALLOC_SIZE)
> +#define H_VMALLOC_START  H_KERN_VIRT_START
> +#define H_VMALLOC_SIZE   (H_KERN_VIRT_SIZE >> 1)
> +#define H_VMALLOC_END(H_VMALLOC_START + H_VMALLOC_SIZE)
>  
>  /*
>   * Region IDs
> @@ -64,7 +64,7 @@
>  #define REGION_MASK  (0xfUL << REGION_SHIFT)
>  #define REGION_ID(ea)(((unsigned long)(ea)) >> REGION_SHIFT)
>  
> -#define VMALLOC_REGION_ID(REGION_ID(VMALLOC_START))
> +#define VMALLOC_REGION_ID(REGION_ID(H_VMALLOC_START))
>  #define KERNEL_REGION_ID (REGION_ID(PAGE_OFFSET))
>  #define VMEMMAP_REGION_ID(0xfUL) /* Server only */
>  #define USER_REGION_ID   (0UL)
> @@ -73,7 +73,7 @@
>   * Defines the address of the vmemap area, in its own region on
>   * hash table CPUs.
>   */
> -#define VMEMMAP_BASE (VMEMMAP_REGION_ID << REGION_SHIFT)
> +#define H_VMEMMAP_BASE   (VMEMMAP_REGION_ID << REGION_SHIFT)
>  
>  #ifdef CONFIG_PPC_MM_SLICES
>  #define HAVE_ARCH_UNMAPPED_AREA
> diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h 
> b/arch/powerpc/include/asm/book3s/64/pgtable.h
> index b8ee70458bae..87519ad1c5dc 100644
> --- a/arch/powerpc/include/asm/book3s/64/pgtable.h
> +++ b/arch/powerpc/include/asm/book3s/64/pgtable.h
> @@ -208,6 +208,18 @@ extern unsigned long __pgd_val_bits;
>  #define PUD_MASKED_BITS  0xc0ffUL
>  /* Bits to mask out from a PGD to get to the PUD page */
>  #define PGD_MASKED_BITS  0xc0ffUL
> +
> +extern unsigned long __vmalloc_start;
> +extern unsigned long __vmalloc_end;
> +#define VMALLOC_START__vmalloc_start
> +#define VMALLOC_END  __vmalloc_end
> +
> +extern unsigned long __kernel_virt_start;
> +extern unsigned long __kernel_virt_size;
> +#define KERN_VIRT_START __kernel_virt_start
> +#define KERN_VIRT_SIZE  __kernel_virt_size
> +extern struct page *vmemmap;
> +extern unsigned long ioremap_bot;
>  #endif /* __ASSEMBLY__ */
>  
>  #include 
> @@ -220,7 +232,6 @@ extern unsigned long __pgd_val_bits;
>  #endif
>  
>  #include 
> -
>  /*
>   * The second half of the kernel virtual space is used for IO mappings,
>   * it's itself carved into the PIO region (ISA and PHB IO space) and
> @@ -239,8 +250,6 @@ extern unsigned long __pgd_val_bits;
>  #define IOREMAP_BASE (PHB_IO_END)
>  #define IOREMAP_END  (KERN_VIRT_START + KERN_VIRT_SIZE)
>  
> -#define vmemmap  ((struct page *)VMEMMAP_BASE)
> -
>  /* Advertise special mapping type for AGP */
>  #define HAVE_PAGE_AGP
>  
> diff --git a/arch/powerpc/include/asm/book3s/64/radix.h 
> b/arch/powerpc/include/asm/book3s/64/radix.h
> index 040c4a56d07b..d0449c0f2166 100644
> --- a/arch/powerpc/include/asm/book3s/64/radix.h
> +++ b/arch/powerpc/include/asm/book3s/64/radix.h
> @@ -30,6 +30,27 @@
>  #define R_PGTABLE_EADDR_SIZE (R_PTE_INDEX_SIZE + R_PMD_INDEX_SIZE +  \
> R_PUD_INDEX_SIZE + R_PGD_INDEX_SIZE + PAGE_SHIFT)
>  #define R_PGTABLE_RANGE (ASM_CONST(1) << R_PGTABLE_EADDR_SIZE)
> +/*
> + * We support 52 bit address space, Use top bit for kernel
> + * virtual mapping. Also make sure kernel fit in the top
> + * quadrant.
> + */
> +#define R_KERN_VIRT_START ASM_CONST(0xc008)
> +#define R_KERN_VIRT_SIZE  ASM_CONST(0x0008)
> +
> +/*
> + * The vmalloc space starts at the beginning of that region, and
> + * occupies a quarter of it on radix config.
> + * (we keep a 

Re: [PATCH V2 55/68] powerpc/mm: VMALLOC abstraction

2016-04-23 Thread Aneesh Kumar K.V
Michael Neuling  writes:

> Aneesh,
>
> I'm not sure why we need this patch.
>
> It seems to be moving the initialisation of some global variables into
> init functions from the definitions.  And renames some things.


because the value to which it is getting initialized is no more a
constant.

>
>> diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
>> index 41503d7d53a1..3759df52bd67 100644
>> --- a/arch/powerpc/kernel/pci_64.c
>> +++ b/arch/powerpc/kernel/pci_64.c
>> @@ -38,7 +38,7 @@
>>   * ISA drivers use hard coded offsets.  If no ISA bus exists nothing
>>   * is mapped on the first 64K of IO space
>>   */
>> -unsigned long pci_io_base = ISA_IO_BASE;
>> +unsigned long pci_io_base;
>>  EXPORT_SYMBOL(pci_io_base);
>>  
>>  static int __init pcibios_init(void)
>> @@ -47,6 +47,7 @@ static int __init pcibios_init(void)
>>  
>>  printk(KERN_INFO "PCI: Probing PCI hardware\n");
>>  
>> +pci_io_base = ISA_IO_BASE;
>
> Did you mean to change this in this patch?  This seems to be a random
> change in pci code.
>

ISA_IO_BASE is not a constant now.

-aneesh

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH V2 55/68] powerpc/mm: VMALLOC abstraction

2016-04-21 Thread Michael Neuling
Aneesh,

I'm not sure why we need this patch.

It seems to be moving the initialisation of some global variables into
init functions from the definitions.  And renames some things.

> diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
> index 41503d7d53a1..3759df52bd67 100644
> --- a/arch/powerpc/kernel/pci_64.c
> +++ b/arch/powerpc/kernel/pci_64.c
> @@ -38,7 +38,7 @@
>   * ISA drivers use hard coded offsets.  If no ISA bus exists nothing
>   * is mapped on the first 64K of IO space
>   */
> -unsigned long pci_io_base = ISA_IO_BASE;
> +unsigned long pci_io_base;
>  EXPORT_SYMBOL(pci_io_base);
>  
>  static int __init pcibios_init(void)
> @@ -47,6 +47,7 @@ static int __init pcibios_init(void)
>  
>   printk(KERN_INFO "PCI: Probing PCI hardware\n");
>  
> + pci_io_base = ISA_IO_BASE;

Did you mean to change this in this patch?  This seems to be a random
change in pci code.

Mikey
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH V2 55/68] powerpc/mm: VMALLOC abstraction

2016-04-09 Thread Aneesh Kumar K.V
Signed-off-by: Aneesh Kumar K.V 
---
 arch/powerpc/include/asm/book3s/64/hash.h| 14 +++---
 arch/powerpc/include/asm/book3s/64/pgtable.h | 15 ---
 arch/powerpc/include/asm/book3s/64/radix.h   | 21 +
 arch/powerpc/kernel/pci_64.c |  3 ++-
 arch/powerpc/mm/hash_utils_64.c  |  8 
 arch/powerpc/mm/pgtable-radix.c  |  7 +++
 arch/powerpc/mm/pgtable_64.c | 13 +++--
 arch/powerpc/mm/slb_low.S|  2 +-
 8 files changed, 69 insertions(+), 14 deletions(-)

diff --git a/arch/powerpc/include/asm/book3s/64/hash.h 
b/arch/powerpc/include/asm/book3s/64/hash.h
index 43bd7d15f41e..9da410ea7e1a 100644
--- a/arch/powerpc/include/asm/book3s/64/hash.h
+++ b/arch/powerpc/include/asm/book3s/64/hash.h
@@ -45,17 +45,17 @@
 /*
  * Define the address range of the kernel non-linear virtual area
  */
-#define KERN_VIRT_START ASM_CONST(0xD000)
-#define KERN_VIRT_SIZE ASM_CONST(0x1000)
+#define H_KERN_VIRT_START ASM_CONST(0xD000)
+#define H_KERN_VIRT_SIZE   ASM_CONST(0x1000)
 
 /*
  * The vmalloc space starts at the beginning of that region, and
  * occupies half of it on hash CPUs and a quarter of it on Book3E
  * (we keep a quarter for the virtual memmap)
  */
-#define VMALLOC_START  KERN_VIRT_START
-#define VMALLOC_SIZE   (KERN_VIRT_SIZE >> 1)
-#define VMALLOC_END(VMALLOC_START + VMALLOC_SIZE)
+#define H_VMALLOC_STARTH_KERN_VIRT_START
+#define H_VMALLOC_SIZE (H_KERN_VIRT_SIZE >> 1)
+#define H_VMALLOC_END  (H_VMALLOC_START + H_VMALLOC_SIZE)
 
 /*
  * Region IDs
@@ -64,7 +64,7 @@
 #define REGION_MASK(0xfUL << REGION_SHIFT)
 #define REGION_ID(ea)  (((unsigned long)(ea)) >> REGION_SHIFT)
 
-#define VMALLOC_REGION_ID  (REGION_ID(VMALLOC_START))
+#define VMALLOC_REGION_ID  (REGION_ID(H_VMALLOC_START))
 #define KERNEL_REGION_ID   (REGION_ID(PAGE_OFFSET))
 #define VMEMMAP_REGION_ID  (0xfUL) /* Server only */
 #define USER_REGION_ID (0UL)
@@ -73,7 +73,7 @@
  * Defines the address of the vmemap area, in its own region on
  * hash table CPUs.
  */
-#define VMEMMAP_BASE   (VMEMMAP_REGION_ID << REGION_SHIFT)
+#define H_VMEMMAP_BASE (VMEMMAP_REGION_ID << REGION_SHIFT)
 
 #ifdef CONFIG_PPC_MM_SLICES
 #define HAVE_ARCH_UNMAPPED_AREA
diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h 
b/arch/powerpc/include/asm/book3s/64/pgtable.h
index b8ee70458bae..87519ad1c5dc 100644
--- a/arch/powerpc/include/asm/book3s/64/pgtable.h
+++ b/arch/powerpc/include/asm/book3s/64/pgtable.h
@@ -208,6 +208,18 @@ extern unsigned long __pgd_val_bits;
 #define PUD_MASKED_BITS0xc0ffUL
 /* Bits to mask out from a PGD to get to the PUD page */
 #define PGD_MASKED_BITS0xc0ffUL
+
+extern unsigned long __vmalloc_start;
+extern unsigned long __vmalloc_end;
+#define VMALLOC_START  __vmalloc_start
+#define VMALLOC_END__vmalloc_end
+
+extern unsigned long __kernel_virt_start;
+extern unsigned long __kernel_virt_size;
+#define KERN_VIRT_START __kernel_virt_start
+#define KERN_VIRT_SIZE  __kernel_virt_size
+extern struct page *vmemmap;
+extern unsigned long ioremap_bot;
 #endif /* __ASSEMBLY__ */
 
 #include 
@@ -220,7 +232,6 @@ extern unsigned long __pgd_val_bits;
 #endif
 
 #include 
-
 /*
  * The second half of the kernel virtual space is used for IO mappings,
  * it's itself carved into the PIO region (ISA and PHB IO space) and
@@ -239,8 +250,6 @@ extern unsigned long __pgd_val_bits;
 #define IOREMAP_BASE   (PHB_IO_END)
 #define IOREMAP_END(KERN_VIRT_START + KERN_VIRT_SIZE)
 
-#define vmemmap((struct page *)VMEMMAP_BASE)
-
 /* Advertise special mapping type for AGP */
 #define HAVE_PAGE_AGP
 
diff --git a/arch/powerpc/include/asm/book3s/64/radix.h 
b/arch/powerpc/include/asm/book3s/64/radix.h
index 040c4a56d07b..d0449c0f2166 100644
--- a/arch/powerpc/include/asm/book3s/64/radix.h
+++ b/arch/powerpc/include/asm/book3s/64/radix.h
@@ -30,6 +30,27 @@
 #define R_PGTABLE_EADDR_SIZE (R_PTE_INDEX_SIZE + R_PMD_INDEX_SIZE +\
  R_PUD_INDEX_SIZE + R_PGD_INDEX_SIZE + PAGE_SHIFT)
 #define R_PGTABLE_RANGE (ASM_CONST(1) << R_PGTABLE_EADDR_SIZE)
+/*
+ * We support 52 bit address space, Use top bit for kernel
+ * virtual mapping. Also make sure kernel fit in the top
+ * quadrant.
+ */
+#define R_KERN_VIRT_START ASM_CONST(0xc008)
+#define R_KERN_VIRT_SIZE  ASM_CONST(0x0008)
+
+/*
+ * The vmalloc space starts at the beginning of that region, and
+ * occupies a quarter of it on radix config.
+ * (we keep a quarter for the virtual memmap)
+ */
+#define R_VMALLOC_STARTR_KERN_VIRT_START
+#define R_VMALLOC_SIZE (R_KERN_VIRT_SIZE >> 2)
+#define R_VMALLOC_END  (R_VMALLOC_START + R_VMALLOC_SIZE)
+/*
+ * Defines the address of the vmemap area, in its own region on
+ * hash table CPUs.
+ */
+#define