From 42706f289f82a54242eeb1116c945b223bf5bfad Mon Sep 17 00:00:00 2001 From: Bryan Cantrill Date: Tue, 2 Aug 2011 15:39:27 -0700 Subject: HVM-547 rip out unused bit operation functions --- kvm_bitops.c | 145 ----------------------------------------------------------- kvm_bitops.h | 72 ----------------------------- 2 files changed, 217 deletions(-) diff --git a/kvm_bitops.c b/kvm_bitops.c index 04b3ff8..bc88fd1 100644 --- a/kvm_bitops.c +++ b/kvm_bitops.c @@ -79,96 +79,12 @@ clear_bit(int nr, volatile unsigned long *addr) } } -/* - * clear_bit_unlock - Clears a bit in memory - * @nr: Bit to clear - * @addr: Address to start counting from - * - * clear_bit() is atomic and implies release semantics before the memory - * operation. It can be used for an unlock. - */ -inline void -clear_bit_unlock(unsigned nr, volatile unsigned long *addr) -{ -#ifdef XXX - barrier(); -#else - XXX_KVM_SYNC_PROBE; -#endif - clear_bit(nr, addr); -} - inline void __clear_bit(int nr, volatile unsigned long *addr) { __asm__ volatile("btr %1,%0" : ADDR : "Ir" (nr)); } - -/* - * __clear_bit_unlock - Clears a bit in memory - * @nr: Bit to clear - * @addr: Address to start counting from - * - * __clear_bit() is non-atomic and implies release semantics before the memory - * operation. It can be used for an unlock if no other CPUs can concurrently - * modify other bits in the word. - * - * No memory barrier is required here, because x86 cannot reorder stores past - * older loads. Same principle as spin_unlock. - */ -inline void -__clear_bit_unlock(unsigned nr, volatile unsigned long *addr) -{ -#ifdef XXX - barrier(); -#else - XXX_KVM_SYNC_PROBE; -#endif - __clear_bit(nr, addr); -} - -#define smp_mb__before_clear_bit() barrier() -#define smp_mb__after_clear_bit() barrier() - -/* - * __change_bit - Toggle a bit in memory - * @nr: the bit to change - * @addr: the address to start counting from - * - * Unlike change_bit(), this function is non-atomic and may be reordered. - * If it's called on the same region of memory simultaneously, the effect - * may be that only one operation succeeds. - */ -inline void -__change_bit(int nr, volatile unsigned long *addr) -{ - __asm__ volatile("btc %1,%0" : ADDR : "Ir" (nr)); -} - -/* - * change_bit - Toggle a bit in memory - * @nr: Bit to change - * @addr: Address to start counting from - * - * change_bit() is atomic and may not be reordered. - * Note that @nr may be almost arbitrarily large; this function is not - * restricted to acting on a single-word quantity. - */ -inline void -change_bit(int nr, volatile unsigned long *addr) -{ - if (IS_IMMEDIATE(nr)) { - __asm__ volatile("lock xorb %1,%0" - : CONST_MASK_ADDR(nr, addr) - : "iq" ((uint8_t)CONST_MASK(nr))); - } else { - __asm__ volatile("lock btc %1,%0" - : BITOP_ADDR(addr) - : "Ir" (nr)); - } -} - /* * test_and_set_bit - Set a bit and return its old value * @nr: Bit to set @@ -188,19 +104,6 @@ test_and_set_bit(int nr, volatile unsigned long *addr) return (oldbit); } -/* - * test_and_set_bit_lock - Set a bit and return its old value for lock - * @nr: Bit to set - * @addr: Address to count from - * - * This is the same as test_and_set_bit on x86. - */ -inline int -test_and_set_bit_lock(int nr, volatile unsigned long *addr) -{ - return (test_and_set_bit(nr, addr)); -} - /* * __test_and_set_bit - Set a bit and return its old value * @nr: Bit to set @@ -264,40 +167,6 @@ __test_and_clear_bit(int nr, volatile unsigned long *addr) return (oldbit); } -/* WARNING: non atomic and it can be reordered! */ -inline int -__test_and_change_bit(int nr, volatile unsigned long *addr) -{ - int oldbit; - - __asm__ volatile("btc %2,%1\n\t" - "sbb %0,%0" - : "=r" (oldbit), ADDR - : "Ir" (nr) : "memory"); - - return (oldbit); -} - -/* - * test_and_change_bit - Change a bit and return its old value - * @nr: Bit to change - * @addr: Address to count from - * - * This operation is atomic and cannot be reordered. - * It also implies a memory barrier. - */ -inline int -test_and_change_bit(int nr, volatile unsigned long *addr) -{ - int oldbit; - - __asm__ volatile("lock btc %2,%1\n\t" - "sbb %0,%0" - : "=r" (oldbit), ADDR : "Ir" (nr) : "memory"); - - return (oldbit); -} - inline int constant_test_bit(unsigned int nr, const volatile unsigned long *addr) { @@ -318,20 +187,6 @@ variable_test_bit(int nr, volatile const unsigned long *addr) return (oldbit); } -#if 0 /* Fool kernel-doc since it doesn't do macros yet */ -/* - * test_bit - Determine whether a bit is set - * @nr: bit number to test - * @addr: Address to start counting from - */ -int test_bit(int nr, const volatile unsigned long *addr); -#endif - -#define test_bit(nr, addr) \ - (__builtin_constant_p((nr)) \ - ? constant_test_bit((nr), (addr)) \ - : variable_test_bit((nr), (addr))) - /* * __ffs - find first set bit in word * @word: The word to search diff --git a/kvm_bitops.h b/kvm_bitops.h index 2d6ed05..6323aae 100644 --- a/kvm_bitops.h +++ b/kvm_bitops.h @@ -76,58 +76,8 @@ extern inline void __set_bit(int, volatile unsigned long *); * in order to ensure changes are visible on other processors. */ extern inline void clear_bit(int, volatile unsigned long *); - -/* - * clear_bit_unlock - Clears a bit in memory - * @nr: Bit to clear - * @addr: Address to start counting from - * - * clear_bit() is atomic and implies release semantics before the memory - * operation. It can be used for an unlock. - */ -extern inline void clear_bit_unlock(unsigned, volatile unsigned long *); - extern inline void __clear_bit(int, volatile unsigned long *); -/* - * __clear_bit_unlock - Clears a bit in memory - * @nr: Bit to clear - * @addr: Address to start counting from - * - * __clear_bit() is non-atomic and implies release semantics before the memory - * operation. It can be used for an unlock if no other CPUs can concurrently - * modify other bits in the word. - * - * No memory barrier is required here, because x86 cannot reorder stores past - * older loads. Same principle as spin_unlock. - */ -extern inline void __clear_bit_unlock(unsigned, volatile unsigned long *); - -#define smp_mb__before_clear_bit() barrier() -#define smp_mb__after_clear_bit() barrier() - -/* - * __change_bit - Toggle a bit in memory - * @nr: the bit to change - * @addr: the address to start counting from - * - * Unlike change_bit(), this function is non-atomic and may be reordered. - * If it's called on the same region of memory simultaneously, the effect - * may be that only one operation succeeds. - */ -extern inline void __change_bit(int, volatile unsigned long *); - -/* - * change_bit - Toggle a bit in memory - * @nr: Bit to change - * @addr: Address to start counting from - * - * change_bit() is atomic and may not be reordered. - * Note that @nr may be almost arbitrarily large; this function is not - * restricted to acting on a single-word quantity. - */ -extern inline void change_bit(int, volatile unsigned long *); - /* * test_and_set_bit - Set a bit and return its old value * @nr: Bit to set @@ -138,15 +88,6 @@ extern inline void change_bit(int, volatile unsigned long *); */ extern inline int test_and_set_bit(int, volatile unsigned long *); -/* - * test_and_set_bit_lock - Set a bit and return its old value for lock - * @nr: Bit to set - * @addr: Address to count from - * - * This is the same as test_and_set_bit on x86. - */ -extern inline int test_and_set_bit_lock(int, volatile unsigned long *); - /* * __test_and_set_bit - Set a bit and return its old value * @nr: Bit to set @@ -179,19 +120,6 @@ extern inline int test_and_clear_bit(int, volatile unsigned long *); */ extern inline int __test_and_clear_bit(int, volatile unsigned long *); -/* WARNING: non atomic and it can be reordered! */ -extern inline int __test_and_change_bit(int, volatile unsigned long *); - -/* - * test_and_change_bit - Change a bit and return its old value - * @nr: Bit to change - * @addr: Address to count from - * - * This operation is atomic and cannot be reordered. - * It also implies a memory barrier. - */ -extern inline int test_and_change_bit(int, volatile unsigned long *); - extern inline int constant_test_bit(unsigned int, const volatile unsigned long *); extern inline int variable_test_bit(int, volatile const unsigned long *); -- cgit v1.2.3