Commit 3c201105568388046da448947e8abc8673fedfd9
Committed by
Greg Kroah-Hartman
1 parent
2a806d2757
ppc/kvm: Replace ACCESS_ONCE with READ_ONCE
commit 5ee07612e9e20817bb99256ab6cf1400fd5aa270 upstream. ACCESS_ONCE does not work reliably on non-scalar types. For example gcc 4.6 and 4.7 might remove the volatile tag for such accesses during the SRA (scalar replacement of aggregates) step (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58145) Change the ppc/kvm code to replace ACCESS_ONCE with READ_ONCE. Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Acked-by: Alexander Graf <agraf@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Showing 2 changed files with 12 additions and 12 deletions Side-by-side Diff
arch/powerpc/kvm/book3s_hv_rm_xics.c
... | ... | @@ -152,7 +152,7 @@ |
152 | 152 | * in virtual mode. |
153 | 153 | */ |
154 | 154 | do { |
155 | - old_state = new_state = ACCESS_ONCE(icp->state); | |
155 | + old_state = new_state = READ_ONCE(icp->state); | |
156 | 156 | |
157 | 157 | /* Down_CPPR */ |
158 | 158 | new_state.cppr = new_cppr; |
... | ... | @@ -211,7 +211,7 @@ |
211 | 211 | * pending priority |
212 | 212 | */ |
213 | 213 | do { |
214 | - old_state = new_state = ACCESS_ONCE(icp->state); | |
214 | + old_state = new_state = READ_ONCE(icp->state); | |
215 | 215 | |
216 | 216 | xirr = old_state.xisr | (((u32)old_state.cppr) << 24); |
217 | 217 | if (!old_state.xisr) |
... | ... | @@ -277,7 +277,7 @@ |
277 | 277 | * whenever the MFRR is made less favored. |
278 | 278 | */ |
279 | 279 | do { |
280 | - old_state = new_state = ACCESS_ONCE(icp->state); | |
280 | + old_state = new_state = READ_ONCE(icp->state); | |
281 | 281 | |
282 | 282 | /* Set_MFRR */ |
283 | 283 | new_state.mfrr = mfrr; |
... | ... | @@ -352,7 +352,7 @@ |
352 | 352 | icp_rm_clr_vcpu_irq(icp->vcpu); |
353 | 353 | |
354 | 354 | do { |
355 | - old_state = new_state = ACCESS_ONCE(icp->state); | |
355 | + old_state = new_state = READ_ONCE(icp->state); | |
356 | 356 | |
357 | 357 | reject = 0; |
358 | 358 | new_state.cppr = cppr; |
arch/powerpc/kvm/book3s_xics.c
... | ... | @@ -327,7 +327,7 @@ |
327 | 327 | icp->server_num); |
328 | 328 | |
329 | 329 | do { |
330 | - old_state = new_state = ACCESS_ONCE(icp->state); | |
330 | + old_state = new_state = READ_ONCE(icp->state); | |
331 | 331 | |
332 | 332 | *reject = 0; |
333 | 333 | |
... | ... | @@ -512,7 +512,7 @@ |
512 | 512 | * in virtual mode. |
513 | 513 | */ |
514 | 514 | do { |
515 | - old_state = new_state = ACCESS_ONCE(icp->state); | |
515 | + old_state = new_state = READ_ONCE(icp->state); | |
516 | 516 | |
517 | 517 | /* Down_CPPR */ |
518 | 518 | new_state.cppr = new_cppr; |
... | ... | @@ -567,7 +567,7 @@ |
567 | 567 | * pending priority |
568 | 568 | */ |
569 | 569 | do { |
570 | - old_state = new_state = ACCESS_ONCE(icp->state); | |
570 | + old_state = new_state = READ_ONCE(icp->state); | |
571 | 571 | |
572 | 572 | xirr = old_state.xisr | (((u32)old_state.cppr) << 24); |
573 | 573 | if (!old_state.xisr) |
... | ... | @@ -634,7 +634,7 @@ |
634 | 634 | * whenever the MFRR is made less favored. |
635 | 635 | */ |
636 | 636 | do { |
637 | - old_state = new_state = ACCESS_ONCE(icp->state); | |
637 | + old_state = new_state = READ_ONCE(icp->state); | |
638 | 638 | |
639 | 639 | /* Set_MFRR */ |
640 | 640 | new_state.mfrr = mfrr; |
... | ... | @@ -679,7 +679,7 @@ |
679 | 679 | if (!icp) |
680 | 680 | return H_PARAMETER; |
681 | 681 | } |
682 | - state = ACCESS_ONCE(icp->state); | |
682 | + state = READ_ONCE(icp->state); | |
683 | 683 | kvmppc_set_gpr(vcpu, 4, ((u32)state.cppr << 24) | state.xisr); |
684 | 684 | kvmppc_set_gpr(vcpu, 5, state.mfrr); |
685 | 685 | return H_SUCCESS; |
... | ... | @@ -721,7 +721,7 @@ |
721 | 721 | BOOK3S_INTERRUPT_EXTERNAL_LEVEL); |
722 | 722 | |
723 | 723 | do { |
724 | - old_state = new_state = ACCESS_ONCE(icp->state); | |
724 | + old_state = new_state = READ_ONCE(icp->state); | |
725 | 725 | |
726 | 726 | reject = 0; |
727 | 727 | new_state.cppr = cppr; |
... | ... | @@ -885,7 +885,7 @@ |
885 | 885 | if (!icp) |
886 | 886 | continue; |
887 | 887 | |
888 | - state.raw = ACCESS_ONCE(icp->state.raw); | |
888 | + state.raw = READ_ONCE(icp->state.raw); | |
889 | 889 | seq_printf(m, "cpu server %#lx XIRR:%#x PPRI:%#x CPPR:%#x MFRR:%#x OUT:%d NR:%d\n", |
890 | 890 | icp->server_num, state.xisr, |
891 | 891 | state.pending_pri, state.cppr, state.mfrr, |
... | ... | @@ -1082,7 +1082,7 @@ |
1082 | 1082 | * the ICS states before the ICP states. |
1083 | 1083 | */ |
1084 | 1084 | do { |
1085 | - old_state = ACCESS_ONCE(icp->state); | |
1085 | + old_state = READ_ONCE(icp->state); | |
1086 | 1086 | |
1087 | 1087 | if (new_state.mfrr <= old_state.mfrr) { |
1088 | 1088 | resend = false; |