From 4dd9fe04e1399e8629ab2a98b54db6a7dcdb0076 Mon Sep 17 00:00:00 2001 From: Louis Burda Date: Sun, 5 Feb 2023 16:02:54 -0600 Subject: Fix stepping inconsistency by moving oneshot after primee --- test/kvm-step.c | 19 +++++++++++-------- test/kvm-step_guest.S | 4 ++++ test/kvm-targetstep_guest | 2 +- test/kvm-targetstep_guest.S | 10 ++++++++-- 4 files changed, 24 insertions(+), 11 deletions(-) (limited to 'test') diff --git a/test/kvm-step.c b/test/kvm-step.c index 4cae764..4c1b6b5 100644 --- a/test/kvm-step.c +++ b/test/kvm-step.c @@ -66,14 +66,17 @@ main(int argc, const char **argv) struct cpc_track_cfg cfg; uint64_t eventcnt; uint32_t arg; + bool with_data; int ret; - vmtype = "kvm"; - if (argc > 1) vmtype = argv[1]; - if (strcmp(vmtype, "kvm") && strcmp(vmtype, "sev") - && strcmp(vmtype, "sev-es") - && strcmp(vmtype, "sev-snp")) - errx(1, "invalid vm mode: %s", vmtype); + with_data = true; + if (argc > 1 && !strcmp(argv[1], "--exec-only")) { + with_data = false; + argc--; + argv++; + } + + parse_vmtype(argc, argv); setvbuf(stdout, NULL, _IONBF, 0); @@ -122,7 +125,7 @@ main(int argc, const char **argv) memset(&cfg, 0, sizeof(cfg)); cfg.mode = CPC_TRACK_STEPS; - cfg.steps.with_data = true; + cfg.steps.with_data = with_data; ret = ioctl(kvm_dev, KVM_CPC_TRACK_MODE, &cfg); if (ret) err(1, "KVM_CPC_TRACK_MODE"); @@ -173,7 +176,7 @@ main(int argc, const char **argv) if (ret) err(1, "KVM_CPC_ACK_EVENT"); eventcnt = 0; - while (eventcnt < 50) { + while (eventcnt < 110) { eventcnt += monitor(&kvm, false); } diff --git a/test/kvm-step_guest.S b/test/kvm-step_guest.S index dcc8ff3..4c154d5 100644 --- a/test/kvm-step_guest.S +++ b/test/kvm-step_guest.S @@ -7,6 +7,10 @@ .code16gcc guest: +.rept 100 + nop +.endr + mov $(L1_LINESIZE * (L1_SETS + 11)), %bx movb (%bx), %bl hlt diff --git a/test/kvm-targetstep_guest b/test/kvm-targetstep_guest index 2dab495..22d2dc7 100755 --- a/test/kvm-targetstep_guest +++ b/test/kvm-targetstep_guest @@ -1 +1 @@ -Ή»ΈξΩ»ΐŠ»@Š»ΐАΉ»ΈξΩιΦΏ \ No newline at end of file +Ή»ΈξΩ»ΐŠ»@Š»ΐŠιΉ»ΈξΩιΣ― \ No newline at end of file diff --git a/test/kvm-targetstep_guest.S b/test/kvm-targetstep_guest.S index 6625c54..f8ef6d8 100644 --- a/test/kvm-targetstep_guest.S +++ b/test/kvm-targetstep_guest.S @@ -25,8 +25,14 @@ guest: mov $(L1_LINESIZE * (L1_SETS + 15)), %bx movb (%bx), %bl - # this should only be partially single-stepped if - # single-stepping is limited to the first page + jmp skip +.rept L1_LINESIZE * L1_SETS + nop +.endr +skip: + + # these nops should not be single-stepped + # since they are outside the target gfn .rept L1_LINESIZE * L1_SETS * 2 nop .endr -- cgit v1.2.3-71-gd317