Pārlūkot izejas kodu

[hyperv] Use generic set_bit() function

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 8 gadus atpakaļ
vecāks
revīzija
9bab13a772

+ 0
- 23
src/arch/i386/include/bits/hyperv.h Parādīt failu

@@ -46,27 +46,4 @@ hv_call ( struct hv_hypervisor *hv, unsigned int code, const void *in,
46 46
 	return result;
47 47
 }
48 48
 
49
-/**
50
- * Set bit atomically
51
- *
52
- * @v bits		Bit field
53
- * @v bit		Bit to set
54
- */
55
-static inline __attribute__ (( always_inline )) void
56
-hv_set_bit ( void *bits, unsigned int bit ) {
57
-	struct {
58
-		uint32_t dword[ ( bit / 32 ) + 1 ];
59
-	} *dwords = bits;
60
-
61
-	/* Set bit using "lock bts".  Inform compiler that any memory
62
-	 * from the start of the bit field up to and including the
63
-	 * dword containing this bit may be modified.  (This is
64
-	 * overkill but shouldn't matter in practice since we're
65
-	 * unlikely to subsequently read other bits from the same bit
66
-	 * field.)
67
-	 */
68
-	__asm__ __volatile__ ( "lock bts %1, %0"
69
-			       : "+m" ( *dwords ) : "Ir" ( bit ) );
70
-}
71
-
72 49
 #endif /* _BITS_HYPERV_H */

+ 0
- 23
src/arch/x86_64/include/bits/hyperv.h Parādīt failu

@@ -49,27 +49,4 @@ hv_call ( struct hv_hypervisor *hv, unsigned int code, const void *in,
49 49
 	return result;
50 50
 }
51 51
 
52
-/**
53
- * Set bit atomically
54
- *
55
- * @v bits		Bit field
56
- * @v bit		Bit to set
57
- */
58
-static inline __attribute__ (( always_inline )) void
59
-hv_set_bit ( void *bits, unsigned int bit ) {
60
-	struct {
61
-		uint64_t qword[ ( bit / 64 ) + 1 ];
62
-	} *qwords = bits;
63
-
64
-	/* Set bit using "lock bts".  Inform compiler that any memory
65
-	 * from the start of the bit field up to and including the
66
-	 * qword containing this bit may be modified.  (This is
67
-	 * overkill but shouldn't matter in practice since we're
68
-	 * unlikely to subsequently read other bits from the same bit
69
-	 * field.)
70
-	 */
71
-	__asm__ __volatile__ ( "lock bts %1, %0"
72
-			       : "+m" ( *qwords ) : "Ir" ( bit ) );
73
-}
74
-
75 52
 #endif /* _BITS_HYPERV_H */

+ 3
- 2
src/interface/hyperv/vmbus.c Parādīt failu

@@ -39,6 +39,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
39 39
 #include <ipxe/nap.h>
40 40
 #include <ipxe/malloc.h>
41 41
 #include <ipxe/iobuf.h>
42
+#include <ipxe/bitops.h>
42 43
 #include <ipxe/hyperv.h>
43 44
 #include <ipxe/vmbus.h>
44 45
 
@@ -559,7 +560,7 @@ static void vmbus_signal_monitor ( struct vmbus_device *vmdev ) {
559 560
 	group = ( vmdev->monitor / ( 8 * sizeof ( trigger->pending ) ));
560 561
 	bit = ( vmdev->monitor % ( 8 * sizeof ( trigger->pending ) ) );
561 562
 	trigger = &vmbus->monitor_out->trigger[group];
562
-	hv_set_bit ( trigger, bit );
563
+	set_bit ( bit, trigger );
563 564
 }
564 565
 
565 566
 /**
@@ -720,7 +721,7 @@ static int vmbus_send ( struct vmbus_device *vmdev,
720 721
 		return 0;
721 722
 
722 723
 	/* Set channel bit in interrupt page */
723
-	hv_set_bit ( vmbus->intr->out, vmdev->channel );
724
+	set_bit ( vmdev->channel, vmbus->intr->out );
724 725
 
725 726
 	/* Signal the host */
726 727
 	vmdev->signal ( vmdev );

Notiek ielāde…
Atcelt
Saglabāt