diff options
author | Christian Borntraeger <borntraeger@de.ibm.com> | 2015-01-06 16:41:46 -0500 |
---|---|---|
committer | Christian Borntraeger <borntraeger@de.ibm.com> | 2015-01-19 08:14:07 -0500 |
commit | 5ee07612e9e20817bb99256ab6cf1400fd5aa270 (patch) | |
tree | 40ebd74b5149be78c6dca4e384f25709350874a3 | |
parent | b1940cd21c0f4abdce101253e860feff547291b0 (diff) |
ppc/kvm: Replace ACCESS_ONCE with READ_ONCE
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>
-rw-r--r-- | arch/powerpc/kvm/book3s_hv_rm_xics.c | 8 | ||||
-rw-r--r-- | arch/powerpc/kvm/book3s_xics.c | 16 |
2 files changed, 12 insertions, 12 deletions
diff --git a/arch/powerpc/kvm/book3s_hv_rm_xics.c b/arch/powerpc/kvm/book3s_hv_rm_xics.c index 7b066f6b02ad..7c22997de906 100644 --- a/arch/powerpc/kvm/book3s_hv_rm_xics.c +++ b/arch/powerpc/kvm/book3s_hv_rm_xics.c | |||
@@ -152,7 +152,7 @@ static void icp_rm_down_cppr(struct kvmppc_xics *xics, struct kvmppc_icp *icp, | |||
152 | * in virtual mode. | 152 | * in virtual mode. |
153 | */ | 153 | */ |
154 | do { | 154 | do { |
155 | old_state = new_state = ACCESS_ONCE(icp->state); | 155 | old_state = new_state = READ_ONCE(icp->state); |
156 | 156 | ||
157 | /* Down_CPPR */ | 157 | /* Down_CPPR */ |
158 | new_state.cppr = new_cppr; | 158 | new_state.cppr = new_cppr; |
@@ -211,7 +211,7 @@ unsigned long kvmppc_rm_h_xirr(struct kvm_vcpu *vcpu) | |||
211 | * pending priority | 211 | * pending priority |
212 | */ | 212 | */ |
213 | do { | 213 | do { |
214 | old_state = new_state = ACCESS_ONCE(icp->state); | 214 | old_state = new_state = READ_ONCE(icp->state); |
215 | 215 | ||
216 | xirr = old_state.xisr | (((u32)old_state.cppr) << 24); | 216 | xirr = old_state.xisr | (((u32)old_state.cppr) << 24); |
217 | if (!old_state.xisr) | 217 | if (!old_state.xisr) |
@@ -277,7 +277,7 @@ int kvmppc_rm_h_ipi(struct kvm_vcpu *vcpu, unsigned long server, | |||
277 | * whenever the MFRR is made less favored. | 277 | * whenever the MFRR is made less favored. |
278 | */ | 278 | */ |
279 | do { | 279 | do { |
280 | old_state = new_state = ACCESS_ONCE(icp->state); | 280 | old_state = new_state = READ_ONCE(icp->state); |
281 | 281 | ||
282 | /* Set_MFRR */ | 282 | /* Set_MFRR */ |
283 | new_state.mfrr = mfrr; | 283 | new_state.mfrr = mfrr; |
@@ -352,7 +352,7 @@ int kvmppc_rm_h_cppr(struct kvm_vcpu *vcpu, unsigned long cppr) | |||
352 | icp_rm_clr_vcpu_irq(icp->vcpu); | 352 | icp_rm_clr_vcpu_irq(icp->vcpu); |
353 | 353 | ||
354 | do { | 354 | do { |
355 | old_state = new_state = ACCESS_ONCE(icp->state); | 355 | old_state = new_state = READ_ONCE(icp->state); |
356 | 356 | ||
357 | reject = 0; | 357 | reject = 0; |
358 | new_state.cppr = cppr; | 358 | new_state.cppr = cppr; |
diff --git a/arch/powerpc/kvm/book3s_xics.c b/arch/powerpc/kvm/book3s_xics.c index 807351f76f84..a4a8d9f0dcb7 100644 --- a/arch/powerpc/kvm/book3s_xics.c +++ b/arch/powerpc/kvm/book3s_xics.c | |||
@@ -327,7 +327,7 @@ static bool icp_try_to_deliver(struct kvmppc_icp *icp, u32 irq, u8 priority, | |||
327 | icp->server_num); | 327 | icp->server_num); |
328 | 328 | ||
329 | do { | 329 | do { |
330 | old_state = new_state = ACCESS_ONCE(icp->state); | 330 | old_state = new_state = READ_ONCE(icp->state); |
331 | 331 | ||
332 | *reject = 0; | 332 | *reject = 0; |
333 | 333 | ||
@@ -512,7 +512,7 @@ static void icp_down_cppr(struct kvmppc_xics *xics, struct kvmppc_icp *icp, | |||
512 | * in virtual mode. | 512 | * in virtual mode. |
513 | */ | 513 | */ |
514 | do { | 514 | do { |
515 | old_state = new_state = ACCESS_ONCE(icp->state); | 515 | old_state = new_state = READ_ONCE(icp->state); |
516 | 516 | ||
517 | /* Down_CPPR */ | 517 | /* Down_CPPR */ |
518 | new_state.cppr = new_cppr; | 518 | new_state.cppr = new_cppr; |
@@ -567,7 +567,7 @@ static noinline unsigned long kvmppc_h_xirr(struct kvm_vcpu *vcpu) | |||
567 | * pending priority | 567 | * pending priority |
568 | */ | 568 | */ |
569 | do { | 569 | do { |
570 | old_state = new_state = ACCESS_ONCE(icp->state); | 570 | old_state = new_state = READ_ONCE(icp->state); |
571 | 571 | ||
572 | xirr = old_state.xisr | (((u32)old_state.cppr) << 24); | 572 | xirr = old_state.xisr | (((u32)old_state.cppr) << 24); |
573 | if (!old_state.xisr) | 573 | if (!old_state.xisr) |
@@ -634,7 +634,7 @@ static noinline int kvmppc_h_ipi(struct kvm_vcpu *vcpu, unsigned long server, | |||
634 | * whenever the MFRR is made less favored. | 634 | * whenever the MFRR is made less favored. |
635 | */ | 635 | */ |
636 | do { | 636 | do { |
637 | old_state = new_state = ACCESS_ONCE(icp->state); | 637 | old_state = new_state = READ_ONCE(icp->state); |
638 | 638 | ||
639 | /* Set_MFRR */ | 639 | /* Set_MFRR */ |
640 | new_state.mfrr = mfrr; | 640 | new_state.mfrr = mfrr; |
@@ -679,7 +679,7 @@ static int kvmppc_h_ipoll(struct kvm_vcpu *vcpu, unsigned long server) | |||
679 | if (!icp) | 679 | if (!icp) |
680 | return H_PARAMETER; | 680 | return H_PARAMETER; |
681 | } | 681 | } |
682 | state = ACCESS_ONCE(icp->state); | 682 | state = READ_ONCE(icp->state); |
683 | kvmppc_set_gpr(vcpu, 4, ((u32)state.cppr << 24) | state.xisr); | 683 | kvmppc_set_gpr(vcpu, 4, ((u32)state.cppr << 24) | state.xisr); |
684 | kvmppc_set_gpr(vcpu, 5, state.mfrr); | 684 | kvmppc_set_gpr(vcpu, 5, state.mfrr); |
685 | return H_SUCCESS; | 685 | return H_SUCCESS; |
@@ -721,7 +721,7 @@ static noinline void kvmppc_h_cppr(struct kvm_vcpu *vcpu, unsigned long cppr) | |||
721 | BOOK3S_INTERRUPT_EXTERNAL_LEVEL); | 721 | BOOK3S_INTERRUPT_EXTERNAL_LEVEL); |
722 | 722 | ||
723 | do { | 723 | do { |
724 | old_state = new_state = ACCESS_ONCE(icp->state); | 724 | old_state = new_state = READ_ONCE(icp->state); |
725 | 725 | ||
726 | reject = 0; | 726 | reject = 0; |
727 | new_state.cppr = cppr; | 727 | new_state.cppr = cppr; |
@@ -885,7 +885,7 @@ static int xics_debug_show(struct seq_file *m, void *private) | |||
885 | if (!icp) | 885 | if (!icp) |
886 | continue; | 886 | continue; |
887 | 887 | ||
888 | state.raw = ACCESS_ONCE(icp->state.raw); | 888 | state.raw = READ_ONCE(icp->state.raw); |
889 | seq_printf(m, "cpu server %#lx XIRR:%#x PPRI:%#x CPPR:%#x MFRR:%#x OUT:%d NR:%d\n", | 889 | seq_printf(m, "cpu server %#lx XIRR:%#x PPRI:%#x CPPR:%#x MFRR:%#x OUT:%d NR:%d\n", |
890 | icp->server_num, state.xisr, | 890 | icp->server_num, state.xisr, |
891 | state.pending_pri, state.cppr, state.mfrr, | 891 | state.pending_pri, state.cppr, state.mfrr, |
@@ -1082,7 +1082,7 @@ int kvmppc_xics_set_icp(struct kvm_vcpu *vcpu, u64 icpval) | |||
1082 | * the ICS states before the ICP states. | 1082 | * the ICS states before the ICP states. |
1083 | */ | 1083 | */ |
1084 | do { | 1084 | do { |
1085 | old_state = ACCESS_ONCE(icp->state); | 1085 | old_state = READ_ONCE(icp->state); |
1086 | 1086 | ||
1087 | if (new_state.mfrr <= old_state.mfrr) { | 1087 | if (new_state.mfrr <= old_state.mfrr) { |
1088 | resend = false; | 1088 | resend = false; |