Commit c5b130d0 authored by Jan-Bernd Themann's avatar Jan-Bernd Themann Committed by Greg Kroah-Hartman

ehea: 64K page kernel support fix

based on 2c69448b in mainline.

The current eHEA module compiled for 64K page kernels can not
be loaded with insmod due to bad hypervisor call parameters.
The patch is a subset of the follwing patch which has been applied
for 2.6.24 upstream:

http://www.spinics.net/lists/netdev/msg42814.htmlSigned-off-by: default avatarJan-Bernd Themann <themann@de.ibm.com>
Cc: Jeff Garzik <jeff@garzik.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 48884d97
...@@ -563,8 +563,7 @@ int ehea_destroy_qp(struct ehea_qp *qp) ...@@ -563,8 +563,7 @@ int ehea_destroy_qp(struct ehea_qp *qp)
int ehea_create_busmap( void ) int ehea_create_busmap( void )
{ {
u64 vaddr = EHEA_BUSMAP_START; u64 vaddr = EHEA_BUSMAP_START;
unsigned long abs_max_pfn = 0; unsigned long high_section_index = 0;
unsigned long sec_max_pfn;
int i; int i;
/* /*
...@@ -574,14 +573,10 @@ int ehea_create_busmap( void ) ...@@ -574,14 +573,10 @@ int ehea_create_busmap( void )
ehea_bmap.valid_sections = 0; ehea_bmap.valid_sections = 0;
for (i = 0; i < NR_MEM_SECTIONS; i++) for (i = 0; i < NR_MEM_SECTIONS; i++)
if (valid_section_nr(i)) { if (valid_section_nr(i))
sec_max_pfn = section_nr_to_pfn(i); high_section_index = i;
if (sec_max_pfn > abs_max_pfn)
abs_max_pfn = sec_max_pfn;
ehea_bmap.valid_sections++;
}
ehea_bmap.entries = abs_max_pfn / EHEA_PAGES_PER_SECTION + 1; ehea_bmap.entries = high_section_index + 1;
ehea_bmap.vaddr = vmalloc(ehea_bmap.entries * sizeof(*ehea_bmap.vaddr)); ehea_bmap.vaddr = vmalloc(ehea_bmap.entries * sizeof(*ehea_bmap.vaddr));
if (!ehea_bmap.vaddr) if (!ehea_bmap.vaddr)
...@@ -593,6 +588,7 @@ int ehea_create_busmap( void ) ...@@ -593,6 +588,7 @@ int ehea_create_busmap( void )
if (pfn_valid(pfn)) { if (pfn_valid(pfn)) {
ehea_bmap.vaddr[i] = vaddr; ehea_bmap.vaddr[i] = vaddr;
vaddr += EHEA_SECTSIZE; vaddr += EHEA_SECTSIZE;
ehea_bmap.valid_sections++;
} else } else
ehea_bmap.vaddr[i] = 0; ehea_bmap.vaddr[i] = 0;
} }
...@@ -637,7 +633,7 @@ int ehea_reg_kernel_mr(struct ehea_adapter *adapter, struct ehea_mr *mr) ...@@ -637,7 +633,7 @@ int ehea_reg_kernel_mr(struct ehea_adapter *adapter, struct ehea_mr *mr)
mr_len = ehea_bmap.valid_sections * EHEA_SECTSIZE; mr_len = ehea_bmap.valid_sections * EHEA_SECTSIZE;
pt = kzalloc(EHEA_MAX_RPAGE * sizeof(u64), GFP_KERNEL); pt = kzalloc(PAGE_SIZE, GFP_KERNEL);
if (!pt) { if (!pt) {
ehea_error("no mem"); ehea_error("no mem");
ret = -ENOMEM; ret = -ENOMEM;
...@@ -660,8 +656,8 @@ int ehea_reg_kernel_mr(struct ehea_adapter *adapter, struct ehea_mr *mr) ...@@ -660,8 +656,8 @@ int ehea_reg_kernel_mr(struct ehea_adapter *adapter, struct ehea_mr *mr)
void *sectbase = __va(i << SECTION_SIZE_BITS); void *sectbase = __va(i << SECTION_SIZE_BITS);
unsigned long k = 0; unsigned long k = 0;
for (j = 0; j < (PAGES_PER_SECTION / EHEA_MAX_RPAGE); for (j = 0; j < (EHEA_PAGES_PER_SECTION /
j++) { EHEA_MAX_RPAGE); j++) {
for (m = 0; m < EHEA_MAX_RPAGE; m++) { for (m = 0; m < EHEA_MAX_RPAGE; m++) {
pg = sectbase + ((k++) * EHEA_PAGESIZE); pg = sectbase + ((k++) * EHEA_PAGESIZE);
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
#define EHEA_PAGESHIFT 12 #define EHEA_PAGESHIFT 12
#define EHEA_PAGESIZE (1UL << EHEA_PAGESHIFT) #define EHEA_PAGESIZE (1UL << EHEA_PAGESHIFT)
#define EHEA_SECTSIZE (1UL << 24) #define EHEA_SECTSIZE (1UL << 24)
#define EHEA_PAGES_PER_SECTION (EHEA_SECTSIZE >> PAGE_SHIFT) #define EHEA_PAGES_PER_SECTION (EHEA_SECTSIZE >> EHEA_PAGESHIFT)
#if (1UL << SECTION_SIZE_BITS) < EHEA_SECTSIZE #if (1UL << SECTION_SIZE_BITS) < EHEA_SECTSIZE
#error eHEA module can't work if kernel sectionsize < ehea sectionsize #error eHEA module can't work if kernel sectionsize < ehea sectionsize
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment