lkml.org 
[lkml]   [2022]   [Mar]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    Subject[RFC PATCH 074/105] KVM: selftests: Convert debug-exceptions away from VCPU_ID
    From
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    ---
    .../selftests/kvm/aarch64/debug-exceptions.c | 17 ++++++++---------
    1 file changed, 8 insertions(+), 9 deletions(-)

    diff --git a/tools/testing/selftests/kvm/aarch64/debug-exceptions.c b/tools/testing/selftests/kvm/aarch64/debug-exceptions.c
    index ea189d83abf7..d27f30dc57b6 100644
    --- a/tools/testing/selftests/kvm/aarch64/debug-exceptions.c
    +++ b/tools/testing/selftests/kvm/aarch64/debug-exceptions.c
    @@ -3,8 +3,6 @@
    #include <kvm_util.h>
    #include <processor.h>

    -#define VCPU_ID 0
    -
    #define MDSCR_KDE (1 << 13)
    #define MDSCR_MDE (1 << 15)
    #define MDSCR_SS (1 << 0)
    @@ -186,27 +184,28 @@ static void guest_svc_handler(struct ex_regs *regs)
    svc_addr = regs->pc;
    }

    -static int debug_version(struct kvm_vm *vm)
    +static int debug_version(struct kvm_vcpu *vcpu)
    {
    uint64_t id_aa64dfr0;

    - get_reg(vm, VCPU_ID, KVM_ARM64_SYS_REG(SYS_ID_AA64DFR0_EL1), &id_aa64dfr0);
    + get_reg(vcpu->vm, vcpu->id, KVM_ARM64_SYS_REG(SYS_ID_AA64DFR0_EL1), &id_aa64dfr0);
    return id_aa64dfr0 & 0xf;
    }

    int main(int argc, char *argv[])
    {
    + struct kvm_vcpu *vcpu;
    struct kvm_vm *vm;
    struct ucall uc;
    int stage;

    - vm = vm_create_default(VCPU_ID, 0, guest_code);
    + vm = vm_create_with_one_vcpu(&vcpu, guest_code);
    ucall_init(vm, NULL);

    vm_init_descriptor_tables(vm);
    - vcpu_init_descriptor_tables(vm, VCPU_ID);
    + vcpu_init_descriptor_tables(vm, vcpu->id);

    - if (debug_version(vm) < 6) {
    + if (debug_version(vcpu) < 6) {
    print_skip("Armv8 debug architecture not supported.");
    kvm_vm_free(vm);
    exit(KSFT_SKIP);
    @@ -224,9 +223,9 @@ int main(int argc, char *argv[])
    ESR_EC_SVC64, guest_svc_handler);

    for (stage = 0; stage < 7; stage++) {
    - vcpu_run(vm, VCPU_ID);
    + vcpu_run(vm, vcpu->id);

    - switch (get_ucall(vm, VCPU_ID, &uc)) {
    + switch (get_ucall(vm, vcpu->id, &uc)) {
    case UCALL_SYNC:
    TEST_ASSERT(uc.args[1] == stage,
    "Stage %d: Unexpected sync ucall, got %lx",
    --
    2.35.1.723.g4982287a31-goog
    \
     
     \ /
      Last update: 2022-03-11 07:01    [W:4.818 / U:0.088 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site