aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-x86/paravirt.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-x86/paravirt.h')
-rw-r--r--include/asm-x86/paravirt.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/include/asm-x86/paravirt.h b/include/asm-x86/paravirt.h
index eef8095a09dc..feb6bb66c5e2 100644
--- a/include/asm-x86/paravirt.h
+++ b/include/asm-x86/paravirt.h
@@ -326,6 +326,15 @@ struct pv_mmu_ops {
326 unsigned long phys, pgprot_t flags); 326 unsigned long phys, pgprot_t flags);
327}; 327};
328 328
329struct raw_spinlock;
330struct pv_lock_ops {
331 int (*spin_is_locked)(struct raw_spinlock *lock);
332 int (*spin_is_contended)(struct raw_spinlock *lock);
333 void (*spin_lock)(struct raw_spinlock *lock);
334 int (*spin_trylock)(struct raw_spinlock *lock);
335 void (*spin_unlock)(struct raw_spinlock *lock);
336};
337
329/* This contains all the paravirt structures: we get a convenient 338/* This contains all the paravirt structures: we get a convenient
330 * number for each function using the offset which we use to indicate 339 * number for each function using the offset which we use to indicate
331 * what to patch. */ 340 * what to patch. */
@@ -336,6 +345,7 @@ struct paravirt_patch_template {
336 struct pv_irq_ops pv_irq_ops; 345 struct pv_irq_ops pv_irq_ops;
337 struct pv_apic_ops pv_apic_ops; 346 struct pv_apic_ops pv_apic_ops;
338 struct pv_mmu_ops pv_mmu_ops; 347 struct pv_mmu_ops pv_mmu_ops;
348 struct pv_lock_ops pv_lock_ops;
339}; 349};
340 350
341extern struct pv_info pv_info; 351extern struct pv_info pv_info;
@@ -345,6 +355,7 @@ extern struct pv_cpu_ops pv_cpu_ops;
345extern struct pv_irq_ops pv_irq_ops; 355extern struct pv_irq_ops pv_irq_ops;
346extern struct pv_apic_ops pv_apic_ops; 356extern struct pv_apic_ops pv_apic_ops;
347extern struct pv_mmu_ops pv_mmu_ops; 357extern struct pv_mmu_ops pv_mmu_ops;
358extern struct pv_lock_ops pv_lock_ops;
348 359
349#define PARAVIRT_PATCH(x) \ 360#define PARAVIRT_PATCH(x) \
350 (offsetof(struct paravirt_patch_template, x) / sizeof(void *)) 361 (offsetof(struct paravirt_patch_template, x) / sizeof(void *))
@@ -1374,6 +1385,31 @@ static inline void __set_fixmap(unsigned /* enum fixed_addresses */ idx,
1374void _paravirt_nop(void); 1385void _paravirt_nop(void);
1375#define paravirt_nop ((void *)_paravirt_nop) 1386#define paravirt_nop ((void *)_paravirt_nop)
1376 1387
1388static inline int __raw_spin_is_locked(struct raw_spinlock *lock)
1389{
1390 return PVOP_CALL1(int, pv_lock_ops.spin_is_locked, lock);
1391}
1392
1393static inline int __raw_spin_is_contended(struct raw_spinlock *lock)
1394{
1395 return PVOP_CALL1(int, pv_lock_ops.spin_is_contended, lock);
1396}
1397
1398static __always_inline void __raw_spin_lock(struct raw_spinlock *lock)
1399{
1400 return PVOP_VCALL1(pv_lock_ops.spin_lock, lock);
1401}
1402
1403static __always_inline int __raw_spin_trylock(struct raw_spinlock *lock)
1404{
1405 return PVOP_CALL1(int, pv_lock_ops.spin_trylock, lock);
1406}
1407
1408static __always_inline void __raw_spin_unlock(struct raw_spinlock *lock)
1409{
1410 return PVOP_VCALL1(pv_lock_ops.spin_unlock, lock);
1411}
1412
1377/* 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. */
1378struct paravirt_patch_site { 1414struct paravirt_patch_site {
1379 u8 *instr; /* original instructions */ 1415 u8 *instr; /* original instructions */
@@ -1458,6 +1494,7 @@ static inline unsigned long __raw_local_irq_save(void)
1458 return f; 1494 return f;
1459} 1495}
1460 1496
1497
1461/* Make sure as little as possible of this mess escapes. */ 1498/* Make sure as little as possible of this mess escapes. */
1462#undef PARAVIRT_CALL 1499#undef PARAVIRT_CALL
1463#undef __PVOP_CALL 1500#undef __PVOP_CALL