[kvm-unit-tests PATCH v5 12/29] powerpc/sprs: Avoid taking async interrupts caused by register fuzzing

Nicholas Piggin npiggin at gmail.com
Sun Dec 17 00:42:39 AEDT 2023


Storing certain values in some registers can cause asynchronous
interrupts that can crash the test case, for example decrementer
or PMU interrupts.

Change the msleep to mdelay which does not enable MSR[EE] and so
avoids the problem. This allows removing some of the SPR special
casing.

Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
---
 powerpc/sprs.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/powerpc/sprs.c b/powerpc/sprs.c
index 01041912..313698e0 100644
--- a/powerpc/sprs.c
+++ b/powerpc/sprs.c
@@ -481,12 +481,7 @@ static void set_sprs(uint64_t val)
 			continue;
 		if (sprs[i].type & SPR_HARNESS)
 			continue;
-		if (!strcmp(sprs[i].name, "MMCR0")) {
-			/* XXX: could use a comment or better abstraction! */
-			__mtspr(i, (val & 0xfffffffffbab3fffULL) | 0xfa0b2070);
-		} else {
-			__mtspr(i, val);
-		}
+		__mtspr(i, val);
 	}
 }
 
@@ -536,12 +531,7 @@ int main(int argc, char **argv)
 	if (pause) {
 		migrate_once();
 	} else {
-		msleep(2000);
-
-		/* Taking a dec updates SRR0, SRR1, SPRG1, so don't fail. */
-		sprs[26].type |= SPR_ASYNC;
-		sprs[27].type |= SPR_ASYNC;
-		sprs[273].type |= SPR_ASYNC;
+		mdelay(2000);
 	}
 
 	get_sprs(after);
-- 
2.42.0



More information about the Linuxppc-dev mailing list