aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-x86/paravirt.h
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-07-21 10:45:56 -0400
committerIngo Molnar <mingo@elte.hu>2008-07-21 10:45:56 -0400
commit2e2dcc7631e331cf2e8396ce452e7f01e35f1182 (patch)
tree5a02c9602db66bc8c8db9660899c0c4455d7464f /include/asm-x86/paravirt.h
parentacee709cab689ec7703770e8b8cb5cc3a4abcb31 (diff)
parent1c29dd9a9e2f83ffb02e50bb3619c3b9db8fd526 (diff)
Merge branch 'x86/paravirt-spinlocks' into x86/for-linus
Diffstat (limited to 'include/asm-x86/paravirt.h')
-rw-r--r--include/asm-x86/paravirt.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/include/asm-x86/paravirt.h b/include/asm-x86/paravirt.h
index 695ce9383f52..aec9767836b6 100644
--- a/include/asm-x86/paravirt.h
+++ b/include/asm-x86/paravirt.h
@@ -325,6 +325,15 @@ struct pv_mmu_ops {
325 unsigned long phys, pgprot_t flags); 325 unsigned long phys, pgprot_t flags);
326}; 326};
327 327
328struct raw_spinlock;
329struct pv_lock_ops {
330 int (*spin_is_locked)(struct raw_spinlock *lock);
331 int (*spin_is_contended)(struct raw_spinlock *lock);
332 void (*spin_lock)(struct raw_spinlock *lock);
333 int (*spin_trylock)(struct raw_spinlock *lock);
334 void (*spin_unlock)(struct raw_spinlock *lock);
335};
336
328/* This contains all the paravirt structures: we get a convenient 337/* This contains all the paravirt structures: we get a convenient
329 * number for each function using the offset which we use to indicate 338 * number for each function using the offset which we use to indicate
330 * what to patch. */ 339 * what to patch. */
@@ -335,6 +344,7 @@ struct paravirt_patch_template {
335 struct pv_irq_ops pv_irq_ops; 344 struct pv_irq_ops pv_irq_ops;
336 struct pv_apic_ops pv_apic_ops; 345 struct pv_apic_ops pv_apic_ops;
337 struct pv_mmu_ops pv_mmu_ops; 346 struct pv_mmu_ops pv_mmu_ops;
347 struct pv_lock_ops pv_lock_ops;
338}; 348};
339 349
340extern struct pv_info pv_info; 350extern struct pv_info pv_info;
@@ -344,6 +354,7 @@ extern struct pv_cpu_ops pv_cpu_ops;
344extern struct pv_irq_ops pv_irq_ops; 354extern struct pv_irq_ops pv_irq_ops;
345extern struct pv_apic_ops pv_apic_ops; 355extern struct pv_apic_ops pv_apic_ops;
346extern struct pv_mmu_ops pv_mmu_ops; 356extern struct pv_mmu_ops pv_mmu_ops;
357extern struct pv_lock_ops pv_lock_ops;
347 358
348#define PARAVIRT_PATCH(x) \ 359#define PARAVIRT_PATCH(x) \
349 (offsetof(struct paravirt_patch_template, x) / sizeof(void *)) 360 (offsetof(struct paravirt_patch_template, x) / sizeof(void *))
@@ -1368,6 +1379,37 @@ static inline void __set_fixmap(unsigned /* enum fixed_addresses */ idx,
1368void _paravirt_nop(void); 1379void _paravirt_nop(void);
1369#define paravirt_nop ((void *)_paravirt_nop) 1380#define paravirt_nop ((void *)_paravirt_nop)
1370 1381
1382void paravirt_use_bytelocks(void);
1383
1384#ifdef CONFIG_SMP
1385
1386static inline int __raw_spin_is_locked(struct raw_spinlock *lock)
1387{
1388 return PVOP_CALL1(int, pv_lock_ops.spin_is_locked, lock);
1389}
1390
1391static inline int __raw_spin_is_contended(struct raw_spinlock *lock)
1392{
1393 return PVOP_CALL1(int, pv_lock_ops.spin_is_contended, lock);
1394}
1395
1396static __always_inline void __raw_spin_lock(struct raw_spinlock *lock)
1397{
1398 PVOP_VCALL1(pv_lock_ops.spin_lock, lock);
1399}
1400
1401static __always_inline int __raw_spin_trylock(struct raw_spinlock *lock)
1402{
1403 return PVOP_CALL1(int, pv_lock_ops.spin_trylock, lock);
1404}
1405
1406static __always_inline void __raw_spin_unlock(struct raw_spinlock *lock)
1407{
1408 PVOP_VCALL1(pv_lock_ops.spin_unlock, lock);
1409}
1410
1411#endif
1412
1371/* These all sit in the .parainstructions section to tell us what to patch. */ 1413/* These all sit in the .parainstructions section to tell us what to patch. */
1372struct paravirt_patch_site { 1414struct paravirt_patch_site {
1373 u8 *instr; /* original instructions */ 1415 u8 *instr; /* original instructions */
@@ -1452,6 +1494,7 @@ static inline unsigned long __raw_local_irq_save(void)
1452 return f; 1494 return f;
1453} 1495}
1454 1496
1497
1455/* Make sure as little as possible of this mess escapes. */ 1498/* Make sure as little as possible of this mess escapes. */
1456#undef PARAVIRT_CALL 1499#undef PARAVIRT_CALL
1457#undef __PVOP_CALL 1500#undef __PVOP_CALL