|
@@ -234,40 +234,50 @@ void __init per_cpu_patch(void)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void __init sun4v_patch(void)
|
|
|
+void sun4v_patch_1insn_range(struct sun4v_1insn_patch_entry *start,
|
|
|
+ struct sun4v_1insn_patch_entry *end)
|
|
|
{
|
|
|
- extern void sun4v_hvapi_init(void);
|
|
|
- struct sun4v_1insn_patch_entry *p1;
|
|
|
- struct sun4v_2insn_patch_entry *p2;
|
|
|
-
|
|
|
- if (tlb_type != hypervisor)
|
|
|
- return;
|
|
|
+ while (start < end) {
|
|
|
+ unsigned long addr = start->addr;
|
|
|
|
|
|
- p1 = &__sun4v_1insn_patch;
|
|
|
- while (p1 < &__sun4v_1insn_patch_end) {
|
|
|
- unsigned long addr = p1->addr;
|
|
|
-
|
|
|
- *(unsigned int *) (addr + 0) = p1->insn;
|
|
|
+ *(unsigned int *) (addr + 0) = start->insn;
|
|
|
wmb();
|
|
|
__asm__ __volatile__("flush %0" : : "r" (addr + 0));
|
|
|
|
|
|
- p1++;
|
|
|
+ start++;
|
|
|
}
|
|
|
+}
|
|
|
|
|
|
- p2 = &__sun4v_2insn_patch;
|
|
|
- while (p2 < &__sun4v_2insn_patch_end) {
|
|
|
- unsigned long addr = p2->addr;
|
|
|
+void sun4v_patch_2insn_range(struct sun4v_2insn_patch_entry *start,
|
|
|
+ struct sun4v_2insn_patch_entry *end)
|
|
|
+{
|
|
|
+ while (start < end) {
|
|
|
+ unsigned long addr = start->addr;
|
|
|
|
|
|
- *(unsigned int *) (addr + 0) = p2->insns[0];
|
|
|
+ *(unsigned int *) (addr + 0) = start->insns[0];
|
|
|
wmb();
|
|
|
__asm__ __volatile__("flush %0" : : "r" (addr + 0));
|
|
|
|
|
|
- *(unsigned int *) (addr + 4) = p2->insns[1];
|
|
|
+ *(unsigned int *) (addr + 4) = start->insns[1];
|
|
|
wmb();
|
|
|
__asm__ __volatile__("flush %0" : : "r" (addr + 4));
|
|
|
|
|
|
- p2++;
|
|
|
+ start++;
|
|
|
}
|
|
|
+}
|
|
|
+
|
|
|
+void __init sun4v_patch(void)
|
|
|
+{
|
|
|
+ extern void sun4v_hvapi_init(void);
|
|
|
+
|
|
|
+ if (tlb_type != hypervisor)
|
|
|
+ return;
|
|
|
+
|
|
|
+ sun4v_patch_1insn_range(&__sun4v_1insn_patch,
|
|
|
+ &__sun4v_1insn_patch_end);
|
|
|
+
|
|
|
+ sun4v_patch_2insn_range(&__sun4v_2insn_patch,
|
|
|
+ &__sun4v_2insn_patch_end);
|
|
|
|
|
|
sun4v_hvapi_init();
|
|
|
}
|