Skip to content

Commit a2e7f0e

Browse files
Andi KleenH. Peter Anvin
authored andcommitted
x86, asmlinkage, paravirt: Make paravirt thunks global
The paravirt thunks use a hack of using a static reference to a static function to reference that function from the top level statement. This assumes that gcc always generates static function names in a specific format, which is not necessarily true. Simply make these functions global and asmlinkage or __visible. This way the static __used variables are not needed and everything works. Functions with arguments are __visible to keep the register calling convention on 32bit. Changed in paravirt and in all users (Xen and vsmp) v2: Use __visible for functions with arguments Cc: Jeremy Fitzhardinge <jeremy@goop.org> Cc: Ido Yariv <ido@wizery.com> Signed-off-by: Andi Kleen <ak@linux.intel.com> Link: http://lkml.kernel.org/r/1382458079-24450-5-git-send-email-andi@firstfloor.org Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
1 parent 824a287 commit a2e7f0e

4 files changed

Lines changed: 17 additions & 17 deletions

File tree

‎arch/x86/include/asm/paravirt.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -781,9 +781,9 @@ static __always_inline void __ticket_unlock_kick(struct arch_spinlock *lock,
781781
*/
782782
#define PV_CALLEE_SAVE_REGS_THUNK(func) \
783783
extern typeof(func) __raw_callee_save_##func; \
784-
static void *__##func##__ __used = func; \
785784
\
786785
asm(".pushsection .text;" \
786+
".globl __raw_callee_save_" #func " ; " \
787787
"__raw_callee_save_" #func ": " \
788788
PV_SAVE_ALL_CALLER_REGS \
789789
"call " #func ";" \

‎arch/x86/kernel/vsmp_64.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
* and vice versa.
3434
*/
3535

36-
static unsigned long vsmp_save_fl(void)
36+
asmlinkage unsigned long vsmp_save_fl(void)
3737
{
3838
unsigned long flags = native_save_fl();
3939

@@ -43,7 +43,7 @@ static unsigned long vsmp_save_fl(void)
4343
}
4444
PV_CALLEE_SAVE_REGS_THUNK(vsmp_save_fl);
4545

46-
static void vsmp_restore_fl(unsigned long flags)
46+
__visible void vsmp_restore_fl(unsigned long flags)
4747
{
4848
if (flags & X86_EFLAGS_IF)
4949
flags &= ~X86_EFLAGS_AC;
@@ -53,15 +53,15 @@ static void vsmp_restore_fl(unsigned long flags)
5353
}
5454
PV_CALLEE_SAVE_REGS_THUNK(vsmp_restore_fl);
5555

56-
static void vsmp_irq_disable(void)
56+
asmlinkage void vsmp_irq_disable(void)
5757
{
5858
unsigned long flags = native_save_fl();
5959

6060
native_restore_fl((flags & ~X86_EFLAGS_IF) | X86_EFLAGS_AC);
6161
}
6262
PV_CALLEE_SAVE_REGS_THUNK(vsmp_irq_disable);
6363

64-
static void vsmp_irq_enable(void)
64+
asmlinkage void vsmp_irq_enable(void)
6565
{
6666
unsigned long flags = native_save_fl();
6767

‎arch/x86/xen/irq.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ void xen_force_evtchn_callback(void)
2222
(void)HYPERVISOR_xen_version(0, NULL);
2323
}
2424

25-
static unsigned long xen_save_fl(void)
25+
asmlinkage unsigned long xen_save_fl(void)
2626
{
2727
struct vcpu_info *vcpu;
2828
unsigned long flags;
@@ -40,7 +40,7 @@ static unsigned long xen_save_fl(void)
4040
}
4141
PV_CALLEE_SAVE_REGS_THUNK(xen_save_fl);
4242

43-
static void xen_restore_fl(unsigned long flags)
43+
__visible void xen_restore_fl(unsigned long flags)
4444
{
4545
struct vcpu_info *vcpu;
4646

@@ -62,7 +62,7 @@ static void xen_restore_fl(unsigned long flags)
6262
}
6363
PV_CALLEE_SAVE_REGS_THUNK(xen_restore_fl);
6464

65-
static void xen_irq_disable(void)
65+
asmlinkage void xen_irq_disable(void)
6666
{
6767
/* There's a one instruction preempt window here. We need to
6868
make sure we're don't switch CPUs between getting the vcpu
@@ -73,7 +73,7 @@ static void xen_irq_disable(void)
7373
}
7474
PV_CALLEE_SAVE_REGS_THUNK(xen_irq_disable);
7575

76-
static void xen_irq_enable(void)
76+
asmlinkage void xen_irq_enable(void)
7777
{
7878
struct vcpu_info *vcpu;
7979

‎arch/x86/xen/mmu.c‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ static pteval_t iomap_pte(pteval_t val)
431431
return val;
432432
}
433433

434-
static pteval_t xen_pte_val(pte_t pte)
434+
__visible pteval_t xen_pte_val(pte_t pte)
435435
{
436436
pteval_t pteval = pte.pte;
437437
#if 0
@@ -448,7 +448,7 @@ static pteval_t xen_pte_val(pte_t pte)
448448
}
449449
PV_CALLEE_SAVE_REGS_THUNK(xen_pte_val);
450450

451-
static pgdval_t xen_pgd_val(pgd_t pgd)
451+
__visible pgdval_t xen_pgd_val(pgd_t pgd)
452452
{
453453
return pte_mfn_to_pfn(pgd.pgd);
454454
}
@@ -479,7 +479,7 @@ void xen_set_pat(u64 pat)
479479
WARN_ON(pat != 0x0007010600070106ull);
480480
}
481481

482-
static pte_t xen_make_pte(pteval_t pte)
482+
__visible pte_t xen_make_pte(pteval_t pte)
483483
{
484484
phys_addr_t addr = (pte & PTE_PFN_MASK);
485485
#if 0
@@ -514,14 +514,14 @@ static pte_t xen_make_pte(pteval_t pte)
514514
}
515515
PV_CALLEE_SAVE_REGS_THUNK(xen_make_pte);
516516

517-
static pgd_t xen_make_pgd(pgdval_t pgd)
517+
__visible pgd_t xen_make_pgd(pgdval_t pgd)
518518
{
519519
pgd = pte_pfn_to_mfn(pgd);
520520
return native_make_pgd(pgd);
521521
}
522522
PV_CALLEE_SAVE_REGS_THUNK(xen_make_pgd);
523523

524-
static pmdval_t xen_pmd_val(pmd_t pmd)
524+
__visible pmdval_t xen_pmd_val(pmd_t pmd)
525525
{
526526
return pte_mfn_to_pfn(pmd.pmd);
527527
}
@@ -580,21 +580,21 @@ static void xen_pmd_clear(pmd_t *pmdp)
580580
}
581581
#endif /* CONFIG_X86_PAE */
582582

583-
static pmd_t xen_make_pmd(pmdval_t pmd)
583+
__visible pmd_t xen_make_pmd(pmdval_t pmd)
584584
{
585585
pmd = pte_pfn_to_mfn(pmd);
586586
return native_make_pmd(pmd);
587587
}
588588
PV_CALLEE_SAVE_REGS_THUNK(xen_make_pmd);
589589

590590
#if PAGETABLE_LEVELS == 4
591-
static pudval_t xen_pud_val(pud_t pud)
591+
__visible pudval_t xen_pud_val(pud_t pud)
592592
{
593593
return pte_mfn_to_pfn(pud.pud);
594594
}
595595
PV_CALLEE_SAVE_REGS_THUNK(xen_pud_val);
596596

597-
static pud_t xen_make_pud(pudval_t pud)
597+
__visible pud_t xen_make_pud(pudval_t pud)
598598
{
599599
pud = pte_pfn_to_mfn(pud);
600600

0 commit comments

Comments
 (0)