hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/arch/powerpc/kvm/book3s_paired_singles.c
....@@ -1,16 +1,5 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
2
- * This program is free software; you can redistribute it and/or modify
3
- * it under the terms of the GNU General Public License, version 2, as
4
- * published by the Free Software Foundation.
5
- *
6
- * This program is distributed in the hope that it will be useful,
7
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
8
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9
- * GNU General Public License for more details.
10
- *
11
- * You should have received a copy of the GNU General Public License
12
- * along with this program; if not, write to the Free Software
13
- * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
143 *
154 * Copyright Novell Inc 2010
165 *
....@@ -180,7 +169,7 @@
180169 kvmppc_book3s_queue_irqprio(vcpu, BOOK3S_INTERRUPT_DATA_STORAGE);
181170 }
182171
183
-static int kvmppc_emulate_fpr_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
172
+static int kvmppc_emulate_fpr_load(struct kvm_vcpu *vcpu,
184173 int rs, ulong addr, int ls_type)
185174 {
186175 int emulated = EMULATE_FAIL;
....@@ -199,7 +188,7 @@
199188 kvmppc_inject_pf(vcpu, addr, false);
200189 goto done_load;
201190 } else if (r == EMULATE_DO_MMIO) {
202
- emulated = kvmppc_handle_load(run, vcpu, KVM_MMIO_REG_FPR | rs,
191
+ emulated = kvmppc_handle_load(vcpu, KVM_MMIO_REG_FPR | rs,
203192 len, 1);
204193 goto done_load;
205194 }
....@@ -224,7 +213,7 @@
224213 return emulated;
225214 }
226215
227
-static int kvmppc_emulate_fpr_store(struct kvm_run *run, struct kvm_vcpu *vcpu,
216
+static int kvmppc_emulate_fpr_store(struct kvm_vcpu *vcpu,
228217 int rs, ulong addr, int ls_type)
229218 {
230219 int emulated = EMULATE_FAIL;
....@@ -259,7 +248,7 @@
259248 if (r < 0) {
260249 kvmppc_inject_pf(vcpu, addr, true);
261250 } else if (r == EMULATE_DO_MMIO) {
262
- emulated = kvmppc_handle_store(run, vcpu, val, len, 1);
251
+ emulated = kvmppc_handle_store(vcpu, val, len, 1);
263252 } else {
264253 emulated = EMULATE_DONE;
265254 }
....@@ -270,7 +259,7 @@
270259 return emulated;
271260 }
272261
273
-static int kvmppc_emulate_psq_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
262
+static int kvmppc_emulate_psq_load(struct kvm_vcpu *vcpu,
274263 int rs, ulong addr, bool w, int i)
275264 {
276265 int emulated = EMULATE_FAIL;
....@@ -290,12 +279,12 @@
290279 kvmppc_inject_pf(vcpu, addr, false);
291280 goto done_load;
292281 } else if ((r == EMULATE_DO_MMIO) && w) {
293
- emulated = kvmppc_handle_load(run, vcpu, KVM_MMIO_REG_FPR | rs,
282
+ emulated = kvmppc_handle_load(vcpu, KVM_MMIO_REG_FPR | rs,
294283 4, 1);
295284 vcpu->arch.qpr[rs] = tmp[1];
296285 goto done_load;
297286 } else if (r == EMULATE_DO_MMIO) {
298
- emulated = kvmppc_handle_load(run, vcpu, KVM_MMIO_REG_FQPR | rs,
287
+ emulated = kvmppc_handle_load(vcpu, KVM_MMIO_REG_FQPR | rs,
299288 8, 1);
300289 goto done_load;
301290 }
....@@ -313,7 +302,7 @@
313302 return emulated;
314303 }
315304
316
-static int kvmppc_emulate_psq_store(struct kvm_run *run, struct kvm_vcpu *vcpu,
305
+static int kvmppc_emulate_psq_store(struct kvm_vcpu *vcpu,
317306 int rs, ulong addr, bool w, int i)
318307 {
319308 int emulated = EMULATE_FAIL;
....@@ -329,10 +318,10 @@
329318 if (r < 0) {
330319 kvmppc_inject_pf(vcpu, addr, true);
331320 } else if ((r == EMULATE_DO_MMIO) && w) {
332
- emulated = kvmppc_handle_store(run, vcpu, tmp[0], 4, 1);
321
+ emulated = kvmppc_handle_store(vcpu, tmp[0], 4, 1);
333322 } else if (r == EMULATE_DO_MMIO) {
334323 u64 val = ((u64)tmp[0] << 32) | tmp[1];
335
- emulated = kvmppc_handle_store(run, vcpu, val, 8, 1);
324
+ emulated = kvmppc_handle_store(vcpu, val, 8, 1);
336325 } else {
337326 emulated = EMULATE_DONE;
338327 }
....@@ -629,7 +618,7 @@
629618 return EMULATE_DONE;
630619 }
631620
632
-int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu)
621
+int kvmppc_emulate_paired_single(struct kvm_vcpu *vcpu)
633622 {
634623 u32 inst;
635624 enum emulation_result emulated = EMULATE_DONE;
....@@ -691,7 +680,7 @@
691680 int i = inst_get_field(inst, 17, 19);
692681
693682 addr += get_d_signext(inst);
694
- emulated = kvmppc_emulate_psq_load(run, vcpu, ax_rd, addr, w, i);
683
+ emulated = kvmppc_emulate_psq_load(vcpu, ax_rd, addr, w, i);
695684 break;
696685 }
697686 case OP_PSQ_LU:
....@@ -701,7 +690,7 @@
701690 int i = inst_get_field(inst, 17, 19);
702691
703692 addr += get_d_signext(inst);
704
- emulated = kvmppc_emulate_psq_load(run, vcpu, ax_rd, addr, w, i);
693
+ emulated = kvmppc_emulate_psq_load(vcpu, ax_rd, addr, w, i);
705694
706695 if (emulated == EMULATE_DONE)
707696 kvmppc_set_gpr(vcpu, ax_ra, addr);
....@@ -714,7 +703,7 @@
714703 int i = inst_get_field(inst, 17, 19);
715704
716705 addr += get_d_signext(inst);
717
- emulated = kvmppc_emulate_psq_store(run, vcpu, ax_rd, addr, w, i);
706
+ emulated = kvmppc_emulate_psq_store(vcpu, ax_rd, addr, w, i);
718707 break;
719708 }
720709 case OP_PSQ_STU:
....@@ -724,7 +713,7 @@
724713 int i = inst_get_field(inst, 17, 19);
725714
726715 addr += get_d_signext(inst);
727
- emulated = kvmppc_emulate_psq_store(run, vcpu, ax_rd, addr, w, i);
716
+ emulated = kvmppc_emulate_psq_store(vcpu, ax_rd, addr, w, i);
728717
729718 if (emulated == EMULATE_DONE)
730719 kvmppc_set_gpr(vcpu, ax_ra, addr);
....@@ -744,7 +733,7 @@
744733 int i = inst_get_field(inst, 22, 24);
745734
746735 addr += kvmppc_get_gpr(vcpu, ax_rb);
747
- emulated = kvmppc_emulate_psq_load(run, vcpu, ax_rd, addr, w, i);
736
+ emulated = kvmppc_emulate_psq_load(vcpu, ax_rd, addr, w, i);
748737 break;
749738 }
750739 case OP_4X_PS_CMPO0:
....@@ -758,7 +747,7 @@
758747 int i = inst_get_field(inst, 22, 24);
759748
760749 addr += kvmppc_get_gpr(vcpu, ax_rb);
761
- emulated = kvmppc_emulate_psq_load(run, vcpu, ax_rd, addr, w, i);
750
+ emulated = kvmppc_emulate_psq_load(vcpu, ax_rd, addr, w, i);
762751
763752 if (emulated == EMULATE_DONE)
764753 kvmppc_set_gpr(vcpu, ax_ra, addr);
....@@ -835,7 +824,7 @@
835824 int i = inst_get_field(inst, 22, 24);
836825
837826 addr += kvmppc_get_gpr(vcpu, ax_rb);
838
- emulated = kvmppc_emulate_psq_store(run, vcpu, ax_rd, addr, w, i);
827
+ emulated = kvmppc_emulate_psq_store(vcpu, ax_rd, addr, w, i);
839828 break;
840829 }
841830 case OP_4XW_PSQ_STUX:
....@@ -845,7 +834,7 @@
845834 int i = inst_get_field(inst, 22, 24);
846835
847836 addr += kvmppc_get_gpr(vcpu, ax_rb);
848
- emulated = kvmppc_emulate_psq_store(run, vcpu, ax_rd, addr, w, i);
837
+ emulated = kvmppc_emulate_psq_store(vcpu, ax_rd, addr, w, i);
849838
850839 if (emulated == EMULATE_DONE)
851840 kvmppc_set_gpr(vcpu, ax_ra, addr);
....@@ -933,7 +922,7 @@
933922 {
934923 ulong addr = (ax_ra ? kvmppc_get_gpr(vcpu, ax_ra) : 0) + full_d;
935924
936
- emulated = kvmppc_emulate_fpr_load(run, vcpu, ax_rd, addr,
925
+ emulated = kvmppc_emulate_fpr_load(vcpu, ax_rd, addr,
937926 FPU_LS_SINGLE);
938927 break;
939928 }
....@@ -941,7 +930,7 @@
941930 {
942931 ulong addr = kvmppc_get_gpr(vcpu, ax_ra) + full_d;
943932
944
- emulated = kvmppc_emulate_fpr_load(run, vcpu, ax_rd, addr,
933
+ emulated = kvmppc_emulate_fpr_load(vcpu, ax_rd, addr,
945934 FPU_LS_SINGLE);
946935
947936 if (emulated == EMULATE_DONE)
....@@ -952,7 +941,7 @@
952941 {
953942 ulong addr = (ax_ra ? kvmppc_get_gpr(vcpu, ax_ra) : 0) + full_d;
954943
955
- emulated = kvmppc_emulate_fpr_load(run, vcpu, ax_rd, addr,
944
+ emulated = kvmppc_emulate_fpr_load(vcpu, ax_rd, addr,
956945 FPU_LS_DOUBLE);
957946 break;
958947 }
....@@ -960,7 +949,7 @@
960949 {
961950 ulong addr = kvmppc_get_gpr(vcpu, ax_ra) + full_d;
962951
963
- emulated = kvmppc_emulate_fpr_load(run, vcpu, ax_rd, addr,
952
+ emulated = kvmppc_emulate_fpr_load(vcpu, ax_rd, addr,
964953 FPU_LS_DOUBLE);
965954
966955 if (emulated == EMULATE_DONE)
....@@ -971,7 +960,7 @@
971960 {
972961 ulong addr = (ax_ra ? kvmppc_get_gpr(vcpu, ax_ra) : 0) + full_d;
973962
974
- emulated = kvmppc_emulate_fpr_store(run, vcpu, ax_rd, addr,
963
+ emulated = kvmppc_emulate_fpr_store(vcpu, ax_rd, addr,
975964 FPU_LS_SINGLE);
976965 break;
977966 }
....@@ -979,7 +968,7 @@
979968 {
980969 ulong addr = kvmppc_get_gpr(vcpu, ax_ra) + full_d;
981970
982
- emulated = kvmppc_emulate_fpr_store(run, vcpu, ax_rd, addr,
971
+ emulated = kvmppc_emulate_fpr_store(vcpu, ax_rd, addr,
983972 FPU_LS_SINGLE);
984973
985974 if (emulated == EMULATE_DONE)
....@@ -990,7 +979,7 @@
990979 {
991980 ulong addr = (ax_ra ? kvmppc_get_gpr(vcpu, ax_ra) : 0) + full_d;
992981
993
- emulated = kvmppc_emulate_fpr_store(run, vcpu, ax_rd, addr,
982
+ emulated = kvmppc_emulate_fpr_store(vcpu, ax_rd, addr,
994983 FPU_LS_DOUBLE);
995984 break;
996985 }
....@@ -998,7 +987,7 @@
998987 {
999988 ulong addr = kvmppc_get_gpr(vcpu, ax_ra) + full_d;
1000989
1001
- emulated = kvmppc_emulate_fpr_store(run, vcpu, ax_rd, addr,
990
+ emulated = kvmppc_emulate_fpr_store(vcpu, ax_rd, addr,
1002991 FPU_LS_DOUBLE);
1003992
1004993 if (emulated == EMULATE_DONE)
....@@ -1012,7 +1001,7 @@
10121001 ulong addr = ax_ra ? kvmppc_get_gpr(vcpu, ax_ra) : 0;
10131002
10141003 addr += kvmppc_get_gpr(vcpu, ax_rb);
1015
- emulated = kvmppc_emulate_fpr_load(run, vcpu, ax_rd,
1004
+ emulated = kvmppc_emulate_fpr_load(vcpu, ax_rd,
10161005 addr, FPU_LS_SINGLE);
10171006 break;
10181007 }
....@@ -1021,7 +1010,7 @@
10211010 ulong addr = kvmppc_get_gpr(vcpu, ax_ra) +
10221011 kvmppc_get_gpr(vcpu, ax_rb);
10231012
1024
- emulated = kvmppc_emulate_fpr_load(run, vcpu, ax_rd,
1013
+ emulated = kvmppc_emulate_fpr_load(vcpu, ax_rd,
10251014 addr, FPU_LS_SINGLE);
10261015
10271016 if (emulated == EMULATE_DONE)
....@@ -1033,7 +1022,7 @@
10331022 ulong addr = (ax_ra ? kvmppc_get_gpr(vcpu, ax_ra) : 0) +
10341023 kvmppc_get_gpr(vcpu, ax_rb);
10351024
1036
- emulated = kvmppc_emulate_fpr_load(run, vcpu, ax_rd,
1025
+ emulated = kvmppc_emulate_fpr_load(vcpu, ax_rd,
10371026 addr, FPU_LS_DOUBLE);
10381027 break;
10391028 }
....@@ -1042,7 +1031,7 @@
10421031 ulong addr = kvmppc_get_gpr(vcpu, ax_ra) +
10431032 kvmppc_get_gpr(vcpu, ax_rb);
10441033
1045
- emulated = kvmppc_emulate_fpr_load(run, vcpu, ax_rd,
1034
+ emulated = kvmppc_emulate_fpr_load(vcpu, ax_rd,
10461035 addr, FPU_LS_DOUBLE);
10471036
10481037 if (emulated == EMULATE_DONE)
....@@ -1054,7 +1043,7 @@
10541043 ulong addr = (ax_ra ? kvmppc_get_gpr(vcpu, ax_ra) : 0) +
10551044 kvmppc_get_gpr(vcpu, ax_rb);
10561045
1057
- emulated = kvmppc_emulate_fpr_store(run, vcpu, ax_rd,
1046
+ emulated = kvmppc_emulate_fpr_store(vcpu, ax_rd,
10581047 addr, FPU_LS_SINGLE);
10591048 break;
10601049 }
....@@ -1063,7 +1052,7 @@
10631052 ulong addr = kvmppc_get_gpr(vcpu, ax_ra) +
10641053 kvmppc_get_gpr(vcpu, ax_rb);
10651054
1066
- emulated = kvmppc_emulate_fpr_store(run, vcpu, ax_rd,
1055
+ emulated = kvmppc_emulate_fpr_store(vcpu, ax_rd,
10671056 addr, FPU_LS_SINGLE);
10681057
10691058 if (emulated == EMULATE_DONE)
....@@ -1075,7 +1064,7 @@
10751064 ulong addr = (ax_ra ? kvmppc_get_gpr(vcpu, ax_ra) : 0) +
10761065 kvmppc_get_gpr(vcpu, ax_rb);
10771066
1078
- emulated = kvmppc_emulate_fpr_store(run, vcpu, ax_rd,
1067
+ emulated = kvmppc_emulate_fpr_store(vcpu, ax_rd,
10791068 addr, FPU_LS_DOUBLE);
10801069 break;
10811070 }
....@@ -1084,7 +1073,7 @@
10841073 ulong addr = kvmppc_get_gpr(vcpu, ax_ra) +
10851074 kvmppc_get_gpr(vcpu, ax_rb);
10861075
1087
- emulated = kvmppc_emulate_fpr_store(run, vcpu, ax_rd,
1076
+ emulated = kvmppc_emulate_fpr_store(vcpu, ax_rd,
10881077 addr, FPU_LS_DOUBLE);
10891078
10901079 if (emulated == EMULATE_DONE)
....@@ -1096,7 +1085,7 @@
10961085 ulong addr = (ax_ra ? kvmppc_get_gpr(vcpu, ax_ra) : 0) +
10971086 kvmppc_get_gpr(vcpu, ax_rb);
10981087
1099
- emulated = kvmppc_emulate_fpr_store(run, vcpu, ax_rd,
1088
+ emulated = kvmppc_emulate_fpr_store(vcpu, ax_rd,
11001089 addr,
11011090 FPU_LS_SINGLE_LOW);
11021091 break;