[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH for-4.5 v3 2/3] xen: add helpers for PDX mask initialisation calculations
On Thu, 2014-09-18 at 12:16 -0700, Julien Grall wrote: > > +u64 pdx_region_mask(u64 base, u64 len) > > fill_mask is marked as __init. For consistency, those 2 functions should > be marked too. Just resending that one patch: -------------------------- From 6a554cc2d7dc076eb4f6ed6f922fa95eea113fa5 Mon Sep 17 00:00:00 2001 From: Ian Campbell <ian.campbell@xxxxxxxxxx> Date: Tue, 16 Sep 2014 21:01:41 +0100 Subject: [PATCH] xen: add helpers for PDX mask initialisation calculations I wanted to make fill_mask a public function so I could use it on ARM, but it was actually easier to think of a (semi) reasonable public name for the users of it, so that is what I have done. Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx> Acked-by: Jan Beulich <jbeulich@xxxxxxxx> --- v3.1: Added __init to new functions. v3: New patch --- xen/arch/x86/srat.c | 16 +++------------- xen/common/pdx.c | 18 ++++++++++++++++++ xen/include/xen/pdx.h | 3 +++ 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/xen/arch/x86/srat.c b/xen/arch/x86/srat.c index 2b05272..29fc724 100644 --- a/xen/arch/x86/srat.c +++ b/xen/arch/x86/srat.c @@ -339,13 +339,6 @@ void __init acpi_numa_arch_fixup(void) {} static u64 __initdata srat_region_mask; -static u64 __init fill_mask(u64 mask) -{ - while (mask & (mask + 1)) - mask |= mask + 1; - return mask; -} - static int __init srat_parse_region(struct acpi_subtable_header *header, const unsigned long end) { @@ -366,8 +359,7 @@ static int __init srat_parse_region(struct acpi_subtable_header *header, ma->base_address, ma->base_address + ma->length - 1); srat_region_mask |= ma->base_address | - fill_mask(ma->base_address ^ - (ma->base_address + ma->length - 1)); + pdx_region_mask(ma->base_address, ma->length); return 0; } @@ -381,7 +373,7 @@ void __init srat_parse_regions(u64 addr) acpi_table_parse(ACPI_SIG_SRAT, acpi_parse_srat)) return; - srat_region_mask = fill_mask(addr - 1); + srat_region_mask = pdx_init_mask(addr); acpi_table_parse_srat(ACPI_SRAT_TYPE_MEMORY_AFFINITY, srat_parse_region, 0); @@ -389,9 +381,7 @@ void __init srat_parse_regions(u64 addr) if (e820.map[i].type != E820_RAM) continue; - if (~mask & - fill_mask(e820.map[i].addr ^ - (e820.map[i].addr + e820.map[i].size - 1))) + if (~mask & pdx_region_mask(e820.map[i].addr, e820.map[i].size)) mask = 0; } diff --git a/xen/common/pdx.c b/xen/common/pdx.c index 11349a7..cf8b9b5 100644 --- a/xen/common/pdx.c +++ b/xen/common/pdx.c @@ -41,6 +41,24 @@ int __mfn_valid(unsigned long mfn) pdx_group_valid)); } +/* Sets all bits from the most-significant 1-bit down to the LSB */ +static u64 __init fill_mask(u64 mask) +{ + while (mask & (mask + 1)) + mask |= mask + 1; + return mask; +} + +u64 __init pdx_init_mask(u64 base_addr) +{ + return fill_mask(base_addr - 1); +} + +u64 __init pdx_region_mask(u64 base, u64 len) +{ + return fill_mask(base ^ (base + len - 1)); +} + void set_pdx_range(unsigned long smfn, unsigned long emfn) { unsigned long idx, eidx; diff --git a/xen/include/xen/pdx.h b/xen/include/xen/pdx.h index 624f04f..18fe8e5 100644 --- a/xen/include/xen/pdx.h +++ b/xen/include/xen/pdx.h @@ -13,6 +13,9 @@ extern unsigned long pfn_top_mask, ma_top_mask; (sizeof(*frame_table) & -sizeof(*frame_table))) extern unsigned long pdx_group_valid[]; +extern u64 pdx_init_mask(u64 base_addr); +extern u64 pdx_region_mask(u64 base, u64 len); + extern void set_pdx_range(unsigned long smfn, unsigned long emfn); #define page_to_pdx(pg) ((pg) - frame_table) -- 1.7.10.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |