@@ -1472,48 +1472,6 @@ int alternatives_text_reserved(void *start, void *end)
14721472}
14731473#endif /* CONFIG_SMP */
14741474
1475- #ifdef CONFIG_PARAVIRT
1476-
1477- /* Use this to add nops to a buffer, then text_poke the whole buffer. */
1478- static void __init_or_module add_nops (void * insns , unsigned int len )
1479- {
1480- while (len > 0 ) {
1481- unsigned int noplen = len ;
1482- if (noplen > ASM_NOP_MAX )
1483- noplen = ASM_NOP_MAX ;
1484- memcpy (insns , x86_nops [noplen ], noplen );
1485- insns += noplen ;
1486- len -= noplen ;
1487- }
1488- }
1489-
1490- void __init_or_module apply_paravirt (struct paravirt_patch_site * start ,
1491- struct paravirt_patch_site * end )
1492- {
1493- struct paravirt_patch_site * p ;
1494- char insn_buff [MAX_PATCH_LEN ];
1495- u8 * instr ;
1496-
1497- for (p = start ; p < end ; p ++ ) {
1498- unsigned int used ;
1499-
1500- instr = (u8 * )& p -> instr_offset + p -> instr_offset ;
1501- BUG_ON (p -> len > MAX_PATCH_LEN );
1502- /* prep the buffer with the original instructions */
1503- memcpy (insn_buff , instr , p -> len );
1504- used = paravirt_patch (p -> type , insn_buff , (unsigned long )instr , p -> len );
1505-
1506- BUG_ON (used > p -> len );
1507-
1508- /* Pad the rest with nops */
1509- add_nops (insn_buff + used , p -> len - used );
1510- text_poke_early (instr , insn_buff , p -> len );
1511- }
1512- }
1513- extern struct paravirt_patch_site __start_parainstructions [],
1514- __stop_parainstructions [];
1515- #endif /* CONFIG_PARAVIRT */
1516-
15171475/*
15181476 * Self-test for the INT3 based CALL emulation code.
15191477 *
@@ -1649,28 +1607,11 @@ void __init alternative_instructions(void)
16491607 */
16501608
16511609 /*
1652- * Paravirt patching and alternative patching can be combined to
1653- * replace a function call with a short direct code sequence (e.g.
1654- * by setting a constant return value instead of doing that in an
1655- * external function).
1656- * In order to make this work the following sequence is required:
1657- * 1. set (artificial) features depending on used paravirt
1658- * functions which can later influence alternative patching
1659- * 2. apply paravirt patching (generally replacing an indirect
1660- * function call with a direct one)
1661- * 3. apply alternative patching (e.g. replacing a direct function
1662- * call with a custom code sequence)
1663- * Doing paravirt patching after alternative patching would clobber
1664- * the optimization of the custom code with a function call again.
1610+ * Make sure to set (artificial) features depending on used paravirt
1611+ * functions which can later influence alternative patching.
16651612 */
16661613 paravirt_set_cap ();
16671614
1668- /*
1669- * First patch paravirt functions, such that we overwrite the indirect
1670- * call with the direct call.
1671- */
1672- apply_paravirt (__parainstructions , __parainstructions_end );
1673-
16741615 __apply_fineibt (__retpoline_sites , __retpoline_sites_end ,
16751616 __cfi_sites , __cfi_sites_end , true);
16761617
@@ -1681,10 +1622,6 @@ void __init alternative_instructions(void)
16811622 apply_retpolines (__retpoline_sites , __retpoline_sites_end );
16821623 apply_returns (__return_sites , __return_sites_end );
16831624
1684- /*
1685- * Then patch alternatives, such that those paravirt calls that are in
1686- * alternatives can be overwritten by their immediate fragments.
1687- */
16881625 apply_alternatives (__alt_instructions , __alt_instructions_end );
16891626
16901627 /*
0 commit comments