From: sleybo Date: Wed, 7 Feb 2007 12:11:24 +0000 (+0000) Subject: [MTHCA] Better implementation of doorbells on 64 bit systems. X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=70c05e2c7c78ff7fe153c413f44d563540ad2a4b;p=~shefty%2Frdma-win.git [MTHCA] Better implementation of doorbells on 64 bit systems. git-svn-id: svn://openib.tc.cornell.edu/gen1@580 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86 --- diff --git a/trunk/hw/mthca/kernel/mthca_doorbell.h b/trunk/hw/mthca/kernel/mthca_doorbell.h index e848b366..c873c9c9 100644 --- a/trunk/hw/mthca/kernel/mthca_doorbell.h +++ b/trunk/hw/mthca/kernel/mthca_doorbell.h @@ -38,13 +38,15 @@ enum { MTHCA_SEND_DOORBELL_FENCE = 1 << 5 }; -#if BITS_PER_LONG == 64 +#ifdef _WIN64 /* * Assume that we can just write a 64-bit doorbell atomically. s390 * actually doesn't have writeq() but S/390 systems don't even have * PCI so we won't worry about it. */ + + #define MTHCA_DECLARE_DOORBELL_LOCK(name) #define MTHCA_INIT_DOORBELL_LOCK(ptr) do { } while (0) #define MTHCA_GET_DOORBELL_LOCK(ptr) (NULL) @@ -57,12 +59,13 @@ static inline void mthca_write64_raw(__be64 val, void __iomem *dest) static inline void mthca_write64(__be32 val[2], void __iomem *dest, spinlock_t *doorbell_lock) { - __raw_writeq(*(u64 *) val, dest); + UNUSED_PARAM(doorbell_lock); + *(volatile u64 *)dest = *(volatile u64 *)val; } static inline void mthca_write_db_rec(__be32 val[2], __be32 *db) { - *(u64 *) db = *(u64 *) val; + *(volatile u64 *) db = *(volatile u64 *) val; } #else diff --git a/trunk/hw/mthca/user/mlnx_uvp_doorbell.h b/trunk/hw/mthca/user/mlnx_uvp_doorbell.h index 95458e90..7928eceb 100644 --- a/trunk/hw/mthca/user/mlnx_uvp_doorbell.h +++ b/trunk/hw/mthca/user/mlnx_uvp_doorbell.h @@ -38,48 +38,18 @@ enum { MTHCA_SEND_DOORBELL_FENCE = 1 << 5 }; - -#if defined (_WIN64) - - -#ifdef __WRITE_QWORD_ATOMIC__ - -#if __BYTE_ORDER == __LITTLE_ENDIAN -# define MTHCA_PAIR_TO_64(val) ((uint64_t) val[1] << 32 | val[0]) -#elif __BYTE_ORDER == __BIG_ENDIAN -# define MTHCA_PAIR_TO_64(val) ((uint64_t) val[0] << 32 | val[1]) -#else -# error __BYTE_ORDER not defined -#endif +#if defined _WIN64 static inline void mthca_write64(uint32_t val[2], struct mthca_context *ctx, int offset) { - *(volatile uint64_t *) (ctx->uar + offset) = MTHCA_PAIR_TO_64(val); + *(volatile uint64_t *) ((char *)ctx->uar + offset) = *(volatile uint64_t*)val; } static inline void mthca_write_db_rec(uint32_t val[2], uint32_t *db) { - *(volatile uint64_t *) db = MTHCA_PAIR_TO_64(val); + *(volatile uint64_t *) db = *(volatile uint64_t*)val; } -#else - -static inline void mthca_write64(uint32_t val[2], struct mthca_context *ctx, int offset) -{ - cl_spinlock_acquire(&ctx->uar_lock); - *(volatile uint32_t *) ((uint8_t*)ctx->uar + offset) = val[0]; - *(volatile uint32_t *) ((uint8_t*)ctx->uar + offset + 4) = val[1]; - cl_spinlock_release(&ctx->uar_lock); -} - -static inline void mthca_write_db_rec(uint32_t val[2], uint32_t *db) -{ - *(volatile uint32_t *) db = val[0]; - mb(); - *(volatile uint32_t *) (db + 1) = val[1]; -} - -#endif #elif defined(_WIN32)