All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] xen: various cleanups
@ 2015-01-28  6:44 Juergen Gross
  2015-01-28  6:44 ` [PATCH 1/5] xen: cleanup arch/x86/xen/setup.c Juergen Gross
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Juergen Gross @ 2015-01-28  6:44 UTC (permalink / raw)
  To: linux-kernel, xen-devel, konrad.wilk, david.vrabel, boris.ostrovsky
  Cc: Juergen Gross

Several cleanups in xen kernel files:
- move declarations to header file
- delete not needed lines
- annotate functions as __init
- make functions static
- use correct types for addresses

No functional changes.

Juergen Gross (5):
  xen: cleanup arch/x86/xen/setup.c
  xen: use correct types for addresses in arch/x86/xen/setup.c
  xen: add some __init and static annotations in arch/x86/xen/setup.c
  xen: add some __init annotations in arch/x86/xen/mmu.c
  xen: cleanup arch/x86/xen/mmu.c

 arch/x86/xen/mmu.c     | 17 ++++++++---------
 arch/x86/xen/setup.c   | 37 ++++++++++++++-----------------------
 arch/x86/xen/xen-ops.h |  6 ++++++
 3 files changed, 28 insertions(+), 32 deletions(-)

-- 
2.1.2


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

* [PATCH 1/5] xen: cleanup arch/x86/xen/setup.c
  2015-01-28  6:44 [PATCH 0/5] xen: various cleanups Juergen Gross
@ 2015-01-28  6:44 ` Juergen Gross
  2015-01-28  6:44 ` [PATCH 2/5] xen: use correct types for addresses in arch/x86/xen/setup.c Juergen Gross
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Juergen Gross @ 2015-01-28  6:44 UTC (permalink / raw)
  To: linux-kernel, xen-devel, konrad.wilk, david.vrabel, boris.ostrovsky
  Cc: Juergen Gross

Remove extern declarations in arch/x86/xen/setup.c which are either
not used or redundant. Move needed other extern declarations to
xen-ops.h

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 arch/x86/xen/setup.c   | 10 ----------
 arch/x86/xen/xen-ops.h |  6 ++++++
 2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index 865e56c..d2520c3 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -32,16 +32,6 @@
 #include "p2m.h"
 #include "mmu.h"
 
-/* These are code, but not functions.  Defined in entry.S */
-extern const char xen_hypervisor_callback[];
-extern const char xen_failsafe_callback[];
-#ifdef CONFIG_X86_64
-extern asmlinkage void nmi(void);
-#endif
-extern void xen_sysenter_target(void);
-extern void xen_syscall_target(void);
-extern void xen_syscall32_target(void);
-
 /* Amount of extra memory space we add to the e820 ranges */
 struct xen_memory_region xen_extra_mem[XEN_EXTRA_MEM_MAX_REGIONS] __initdata;
 
diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h
index 5686bd9..9e195c6 100644
--- a/arch/x86/xen/xen-ops.h
+++ b/arch/x86/xen/xen-ops.h
@@ -10,6 +10,12 @@
 extern const char xen_hypervisor_callback[];
 extern const char xen_failsafe_callback[];
 
+void xen_sysenter_target(void);
+#ifdef CONFIG_X86_64
+void xen_syscall_target(void);
+void xen_syscall32_target(void);
+#endif
+
 extern void *xen_initial_gdt;
 
 struct trap_info;
-- 
2.1.2


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

* [PATCH 2/5] xen: use correct types for addresses in arch/x86/xen/setup.c
  2015-01-28  6:44 [PATCH 0/5] xen: various cleanups Juergen Gross
  2015-01-28  6:44 ` [PATCH 1/5] xen: cleanup arch/x86/xen/setup.c Juergen Gross
@ 2015-01-28  6:44 ` Juergen Gross
  2015-01-28  6:44 ` [PATCH 3/5] xen: add some __init and static annotations " Juergen Gross
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Juergen Gross @ 2015-01-28  6:44 UTC (permalink / raw)
  To: linux-kernel, xen-devel, konrad.wilk, david.vrabel, boris.ostrovsky
  Cc: Juergen Gross

In many places in arch/x86/xen/setup.c wrong types are used for
physical addresses (u64 or unsigned long long). Use phys_addr_t
instead.

Use macros already defined instead of open coding them.

Correct some other type mismatches.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 arch/x86/xen/setup.c | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index d2520c3..4dcc608 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -64,7 +64,7 @@ static unsigned long xen_remap_mfn __initdata = INVALID_P2M_ENTRY;
  */
 #define EXTRA_MEM_RATIO		(10)
 
-static void __init xen_add_extra_mem(u64 start, u64 size)
+static void __init xen_add_extra_mem(phys_addr_t start, phys_addr_t size)
 {
 	int i;
 
@@ -87,10 +87,10 @@ static void __init xen_add_extra_mem(u64 start, u64 size)
 	memblock_reserve(start, size);
 }
 
-static void __init xen_del_extra_mem(u64 start, u64 size)
+static void __init xen_del_extra_mem(phys_addr_t start, phys_addr_t size)
 {
 	int i;
-	u64 start_r, size_r;
+	phys_addr_t start_r, size_r;
 
 	for (i = 0; i < XEN_EXTRA_MEM_MAX_REGIONS; i++) {
 		start_r = xen_extra_mem[i].start;
@@ -257,7 +257,7 @@ static void __init xen_set_identity_and_release_chunk(unsigned long start_pfn,
 static void __init xen_update_mem_tables(unsigned long pfn, unsigned long mfn)
 {
 	struct mmu_update update = {
-		.ptr = ((unsigned long long)mfn << PAGE_SHIFT) | MMU_MACHPHYS_UPDATE,
+		.ptr = ((uint64_t)mfn << PAGE_SHIFT) | MMU_MACHPHYS_UPDATE,
 		.val = pfn
 	};
 
@@ -535,14 +535,15 @@ static unsigned long __init xen_get_max_pages(void)
 	return min(max_pages, MAX_DOMAIN_PAGES);
 }
 
-static void xen_align_and_add_e820_region(u64 start, u64 size, int type)
+static void xen_align_and_add_e820_region(phys_addr_t start, phys_addr_t size,
+					  int type)
 {
-	u64 end = start + size;
+	phys_addr_t end = start + size;
 
 	/* Align RAM regions to page boundaries. */
 	if (type == E820_RAM) {
 		start = PAGE_ALIGN(start);
-		end &= ~((u64)PAGE_SIZE - 1);
+		end &= ~((phys_addr_t)PAGE_SIZE - 1);
 	}
 
 	e820_add_region(start, end - start, type);
@@ -567,7 +568,7 @@ char * __init xen_memory_setup(void)
 	static struct e820entry map[E820MAX] __initdata;
 
 	unsigned long max_pfn = xen_start_info->nr_pages;
-	unsigned long long mem_end;
+	phys_addr_t mem_end;
 	int rc;
 	struct xen_memory_map memmap;
 	unsigned long max_pages;
@@ -642,16 +643,16 @@ char * __init xen_memory_setup(void)
 			  extra_pages);
 	i = 0;
 	while (i < memmap.nr_entries) {
-		u64 addr = map[i].addr;
-		u64 size = map[i].size;
+		phys_addr_t addr = map[i].addr;
+		phys_addr_t size = map[i].size;
 		u32 type = map[i].type;
 
 		if (type == E820_RAM) {
 			if (addr < mem_end) {
 				size = min(size, mem_end - addr);
 			} else if (extra_pages) {
-				size = min(size, (u64)extra_pages * PAGE_SIZE);
-				extra_pages -= size / PAGE_SIZE;
+				size = min(size, PFN_PHYS(extra_pages));
+				extra_pages -= PFN_DOWN(size);
 				xen_add_extra_mem(addr, size);
 				xen_max_p2m_pfn = PFN_DOWN(addr + size);
 			} else
-- 
2.1.2


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

* [PATCH 3/5] xen: add some __init and static annotations in arch/x86/xen/setup.c
  2015-01-28  6:44 [PATCH 0/5] xen: various cleanups Juergen Gross
  2015-01-28  6:44 ` [PATCH 1/5] xen: cleanup arch/x86/xen/setup.c Juergen Gross
  2015-01-28  6:44 ` [PATCH 2/5] xen: use correct types for addresses in arch/x86/xen/setup.c Juergen Gross
@ 2015-01-28  6:44 ` Juergen Gross
  2015-01-28  6:44 ` [PATCH 4/5] xen: add some __init annotations in arch/x86/xen/mmu.c Juergen Gross
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Juergen Gross @ 2015-01-28  6:44 UTC (permalink / raw)
  To: linux-kernel, xen-devel, konrad.wilk, david.vrabel, boris.ostrovsky
  Cc: Juergen Gross

Some more functions in arch/x86/xen/setup.c can be made "__init".
xen_ignore_unusable() can be made "static".

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 arch/x86/xen/setup.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index 4dcc608..55f388e 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -535,8 +535,8 @@ static unsigned long __init xen_get_max_pages(void)
 	return min(max_pages, MAX_DOMAIN_PAGES);
 }
 
-static void xen_align_and_add_e820_region(phys_addr_t start, phys_addr_t size,
-					  int type)
+static void __init xen_align_and_add_e820_region(phys_addr_t start,
+						 phys_addr_t size, int type)
 {
 	phys_addr_t end = start + size;
 
@@ -549,7 +549,7 @@ static void xen_align_and_add_e820_region(phys_addr_t start, phys_addr_t size,
 	e820_add_region(start, end - start, type);
 }
 
-void xen_ignore_unusable(struct e820entry *list, size_t map_size)
+static void __init xen_ignore_unusable(struct e820entry *list, size_t map_size)
 {
 	struct e820entry *entry;
 	unsigned int i;
-- 
2.1.2


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

* [PATCH 4/5] xen: add some __init annotations in arch/x86/xen/mmu.c
  2015-01-28  6:44 [PATCH 0/5] xen: various cleanups Juergen Gross
                   ` (2 preceding siblings ...)
  2015-01-28  6:44 ` [PATCH 3/5] xen: add some __init and static annotations " Juergen Gross
@ 2015-01-28  6:44 ` Juergen Gross
  2015-01-28  6:44 ` [PATCH 5/5] xen: cleanup arch/x86/xen/mmu.c Juergen Gross
  2015-01-28 10:04   ` David Vrabel
  5 siblings, 0 replies; 8+ messages in thread
From: Juergen Gross @ 2015-01-28  6:44 UTC (permalink / raw)
  To: linux-kernel, xen-devel, konrad.wilk, david.vrabel, boris.ostrovsky
  Cc: Juergen Gross

The file arch/x86/xen/mmu.c has some functions that can be annotated
with "__init".

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 arch/x86/xen/mmu.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index 5c1f9ac..6a8bbf4 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -1489,7 +1489,7 @@ static void __init xen_set_pte_init(pte_t *ptep, pte_t pte)
 	native_set_pte(ptep, pte);
 }
 
-static void pin_pagetable_pfn(unsigned cmd, unsigned long pfn)
+static void __init pin_pagetable_pfn(unsigned cmd, unsigned long pfn)
 {
 	struct mmuext_op op;
 	op.cmd = cmd;
@@ -1657,7 +1657,7 @@ void __init xen_reserve_top(void)
  * Like __va(), but returns address in the kernel mapping (which is
  * all we have until the physical memory mapping has been set up.
  */
-static void *__ka(phys_addr_t paddr)
+static void * __init __ka(phys_addr_t paddr)
 {
 #ifdef CONFIG_X86_64
 	return (void *)(paddr + __START_KERNEL_map);
@@ -1667,7 +1667,7 @@ static void *__ka(phys_addr_t paddr)
 }
 
 /* Convert a machine address to physical address */
-static unsigned long m2p(phys_addr_t maddr)
+static unsigned long __init m2p(phys_addr_t maddr)
 {
 	phys_addr_t paddr;
 
@@ -1678,13 +1678,14 @@ static unsigned long m2p(phys_addr_t maddr)
 }
 
 /* Convert a machine address to kernel virtual */
-static void *m2v(phys_addr_t maddr)
+static void * __init m2v(phys_addr_t maddr)
 {
 	return __ka(m2p(maddr));
 }
 
 /* Set the page permissions on an identity-mapped pages */
-static void set_page_prot_flags(void *addr, pgprot_t prot, unsigned long flags)
+static void __init set_page_prot_flags(void *addr, pgprot_t prot,
+				       unsigned long flags)
 {
 	unsigned long pfn = __pa(addr) >> PAGE_SHIFT;
 	pte_t pte = pfn_pte(pfn, prot);
@@ -1696,7 +1697,7 @@ static void set_page_prot_flags(void *addr, pgprot_t prot, unsigned long flags)
 	if (HYPERVISOR_update_va_mapping((unsigned long)addr, pte, flags))
 		BUG();
 }
-static void set_page_prot(void *addr, pgprot_t prot)
+static void __init set_page_prot(void *addr, pgprot_t prot)
 {
 	return set_page_prot_flags(addr, prot, UVMF_NONE);
 }
@@ -1769,7 +1770,7 @@ void __init xen_setup_machphys_mapping(void)
 }
 
 #ifdef CONFIG_X86_64
-static void convert_pfn_mfn(void *v)
+static void __init convert_pfn_mfn(void *v)
 {
 	pte_t *pte = v;
 	int i;
-- 
2.1.2


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

* [PATCH 5/5] xen: cleanup arch/x86/xen/mmu.c
  2015-01-28  6:44 [PATCH 0/5] xen: various cleanups Juergen Gross
                   ` (3 preceding siblings ...)
  2015-01-28  6:44 ` [PATCH 4/5] xen: add some __init annotations in arch/x86/xen/mmu.c Juergen Gross
@ 2015-01-28  6:44 ` Juergen Gross
  2015-01-28 10:04   ` David Vrabel
  5 siblings, 0 replies; 8+ messages in thread
From: Juergen Gross @ 2015-01-28  6:44 UTC (permalink / raw)
  To: linux-kernel, xen-devel, konrad.wilk, david.vrabel, boris.ostrovsky
  Cc: Juergen Gross

Remove a nested ifdef.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 arch/x86/xen/mmu.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index 6a8bbf4..adca9e2 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -1734,10 +1734,8 @@ static void __init xen_map_identity_early(pmd_t *pmd, unsigned long max_pfn)
 		for (pteidx = 0; pteidx < PTRS_PER_PTE; pteidx++, pfn++) {
 			pte_t pte;
 
-#ifdef CONFIG_X86_32
 			if (pfn > max_pfn_mapped)
 				max_pfn_mapped = pfn;
-#endif
 
 			if (!pte_none(pte_page[pteidx]))
 				continue;
-- 
2.1.2


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

* Re: [Xen-devel] [PATCH 0/5] xen: various cleanups
  2015-01-28  6:44 [PATCH 0/5] xen: various cleanups Juergen Gross
@ 2015-01-28 10:04   ` David Vrabel
  2015-01-28  6:44 ` [PATCH 2/5] xen: use correct types for addresses in arch/x86/xen/setup.c Juergen Gross
                     ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: David Vrabel @ 2015-01-28 10:04 UTC (permalink / raw)
  To: Juergen Gross, linux-kernel, xen-devel, konrad.wilk,
	david.vrabel, boris.ostrovsky

On 28/01/15 06:44, Juergen Gross wrote:
> Several cleanups in xen kernel files:
> - move declarations to header file
> - delete not needed lines
> - annotate functions as __init
> - make functions static
> - use correct types for addresses
> 
> No functional changes.

Applied to devel/for-linus-3.20, thanks.

David

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

* Re: [PATCH 0/5] xen: various cleanups
@ 2015-01-28 10:04   ` David Vrabel
  0 siblings, 0 replies; 8+ messages in thread
From: David Vrabel @ 2015-01-28 10:04 UTC (permalink / raw)
  To: Juergen Gross, linux-kernel, xen-devel, konrad.wilk,
	david.vrabel, boris.ostrovsky

On 28/01/15 06:44, Juergen Gross wrote:
> Several cleanups in xen kernel files:
> - move declarations to header file
> - delete not needed lines
> - annotate functions as __init
> - make functions static
> - use correct types for addresses
> 
> No functional changes.

Applied to devel/for-linus-3.20, thanks.

David

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

end of thread, other threads:[~2015-01-28 20:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-28  6:44 [PATCH 0/5] xen: various cleanups Juergen Gross
2015-01-28  6:44 ` [PATCH 1/5] xen: cleanup arch/x86/xen/setup.c Juergen Gross
2015-01-28  6:44 ` [PATCH 2/5] xen: use correct types for addresses in arch/x86/xen/setup.c Juergen Gross
2015-01-28  6:44 ` [PATCH 3/5] xen: add some __init and static annotations " Juergen Gross
2015-01-28  6:44 ` [PATCH 4/5] xen: add some __init annotations in arch/x86/xen/mmu.c Juergen Gross
2015-01-28  6:44 ` [PATCH 5/5] xen: cleanup arch/x86/xen/mmu.c Juergen Gross
2015-01-28 10:04 ` [Xen-devel] [PATCH 0/5] xen: various cleanups David Vrabel
2015-01-28 10:04   ` David Vrabel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.