EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
fi
if test -n "$VIBNAL"; then
- AC_MSG_CHECKING([if Voltaire still uses void * sg addresses])
EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
EXTRA_KCFLAGS="$EXTRA_KCFLAGS $VIBCPPFLAGS"
+ AC_MSG_CHECKING([if Voltaire still uses void * sg addresses])
LB_LINUX_TRY_COMPILE([
#include <linux/list.h>
#include <asm/byteorder.h>
],[
AC_MSG_RESULT([no])
])
+ AC_MSG_CHECKING([if page_to_phys() must avoid sign extension])
+ LB_LINUX_TRY_COMPILE([
+ #include <linux/kernel.h>
+ #include <linux/mm.h>
+ #include <linux/unistd.h>
+ #include <asm/system.h>
+ #include <asm/io.h>
+ ],[
+ struct page p;
+
+ switch (42) {
+ case 0:
+ case (sizeof(typeof(page_to_phys(&p))) < 8):
+ break;
+ }
+ ],[
+ AC_MSG_RESULT([yes])
+ VIBCPPFLAGS="$VIBCPPFLAGS -DIBNAL_32BIT_PAGE2PHYS=1"
+ ],[
+ AC_MSG_RESULT([no])
+ ])
EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
fi
AC_SUBST(VIBCPPFLAGS)
static inline __u64
kibnal_page2phys (struct page *p)
{
- return ((__u64)(p - mem_map)) << PAGE_SHIFT;
+#if IBNAL_32BIT_PAGE2PHYS
+ CLASSERT (sizeof(typeof(page_to_phys(p))) == 4);
+ CLASSERT (sizeof(unsigned long) == 4);
+ /* page_to_phys returns a 32 bit physical address. This must be a 32
+ * bit machine with <= 4G memory and we must ensure we don't sign
+ * extend when converting to 64 bits. */
+ return (unsigned long)page_to_phys(p);
+#else
+ CLASSERT (sizeof(typeof(page_to_phys(p))) == 8);
+ /* page_to_phys returns a 64 bit physical address :) */
+ return page_to_phys(p);
+#endif
}
#if IBNAL_VOIDSTAR_SGADDR
vv_r_key_t r_key;
__u64 addr;
__u64 frag_addr;
- void *ptr;
vv_mem_reg_h_t mem_h;
vv_return_t vvrc;
struct page *page;
if (vaddr >= VMALLOC_START &&
- vaddr < VMALLOC_END)
+ vaddr < VMALLOC_END) {
page = vmalloc_to_page ((void *)vaddr);
+ LASSERT (page != NULL);
+ return page;
+ }
#if CONFIG_HIGHMEM
- else if (vaddr >= PKMAP_BASE &&
- vaddr < (PKMAP_BASE + LAST_PKMAP * PAGE_SIZE))
- page = vmalloc_to_page ((void *)vaddr);
- /* in 2.4 ^ just walks the page tables */
+ if (vaddr >= PKMAP_BASE &&
+ vaddr < (PKMAP_BASE + LAST_PKMAP * PAGE_SIZE)) {
+ /* No highmem pages only used for bulk (kiov) I/O */
+ CERROR("find page for address in highmem\n");
+ LBUG();
+ }
#endif
- else
- page = virt_to_page (vaddr);
-
- return VALID_PAGE(page) ? page : NULL;
+ page = virt_to_page (vaddr);
+ LASSERT (page != NULL);
+ return page;
}
int
kib_tx_t *tx;
vv_return_t vvrc;
int rc;
- int i;
int done;
/* Don't send anything until after the connection is established */