Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp129450rwn; Wed, 14 Sep 2022 17:24:16 -0700 (PDT) X-Google-Smtp-Source: AA6agR71MhCEcVnqBeCALNfv0uZTkiqi1Zs7JO8xezUUmpT/CM7aodxkc1nU+m5RIJARtJzl/7Uf X-Received: by 2002:a17:906:dac3:b0:748:8cbf:3c50 with SMTP id xi3-20020a170906dac300b007488cbf3c50mr27413638ejb.136.1663201456645; Wed, 14 Sep 2022 17:24:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663201456; cv=none; d=google.com; s=arc-20160816; b=s9wYqPgkyEl+MoA4TJkmn8hPTvWb7bdQ/r/EL4uQbzOZGvcV1QGT+SpLyc5ECT49vC UL0r3/eF4cT25TsQmREaz54H9j2pBvNCyqH9ejoYhwUUo3GZAIeQHRYx03OsylIVP3Ay Go4FvuXgzRlTZkoPLouyyxUh9WMu/Zd3Ucoo9d45j6g527+/dnlrQI6lcmQAJ44sIVMt pI4fDTR0xhfWY0HsX1a65dsEuYLgF2o78NOf1Y62uxyDEyq5e04NyZjH0JlAciOzdiPG 8QU8sWoaEuX4ULXciqSF3uoOmCjPQvARtPml8Aq9du1epveSpGstAT3cIAn+1ArE6TEj XZGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=M8kjUtGppue3sjuZ1ccxnaotzaKgHdRhRoDLnPEs3wQ=; b=D7KZbpEArPuuF1ipvWG21wg2HJ3i7G7Ysuqkj5k0yUvm02gWBVd+pmja4hSgdsdzb+ Ycm9Z/OfnhfruWt+6UQmaOn1EvN5rkIydcovbNv1zK5IEh67LfTtJsboFb5K03EVCsZt wGa+ruFkFQivWAvTtJHRXpkjgPRBSLsLrBKoBeZznyN1HL6swpgnNaIQtlV8YJ5+JSvb E1yO4C3xs5BES7PNKFuBSDOdtrVw6hD2w61teqmlNT5olyNen1aWFRAIBpOjgrxaEuqd tFKKTe48sa+srQ3VmK9JWu6tFP9CGf9TU+e9TbM7nYzIkkM7rXPPRvBJaGhgsZfa+3Bh 3PrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=QYYv9pYm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cr11-20020a170906d54b00b0077b17197047si11992437ejc.437.2022.09.14.17.23.37; Wed, 14 Sep 2022 17:24:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=QYYv9pYm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229954AbiIOAFO (ORCPT + 99 others); Wed, 14 Sep 2022 20:05:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229831AbiIOAFB (ORCPT ); Wed, 14 Sep 2022 20:05:01 -0400 Received: from mail-pl1-x649.google.com (mail-pl1-x649.google.com [IPv6:2607:f8b0:4864:20::649]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 216FA11159 for ; Wed, 14 Sep 2022 17:04:59 -0700 (PDT) Received: by mail-pl1-x649.google.com with SMTP id b11-20020a170902d50b00b0017828988079so8385325plg.21 for ; Wed, 14 Sep 2022 17:04:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date; bh=M8kjUtGppue3sjuZ1ccxnaotzaKgHdRhRoDLnPEs3wQ=; b=QYYv9pYmzjZ/GZ3xfR1ckqaEiTUNUkkDbO5nicDoIofbwRX6en04HfwXpqyQTrendu UFRuKwNh9pZTFaQ9FdJQnxKwa/ciSv27IWRy+I20b/qulZ9ESDP6+38Z4GA3ulqiOitj +Vn6QVqxEnGGf58xvRPpvEp9bp5hJA5uEaL1Jvw/w0hFGShyI+YpVKP4EGEmpNOCAC5+ XeMgGo3aC3gGy/SZp2yl5KAQfUWgMHbKXmXWv/xS4hNC9rFLrJvfkmocTj6E+L/wKFvn LN70iu2ioUthiueAD6BNs8/oPDM066Rk9klz3yaVKSJP5jO+6ewEMmrmr8ym6eYDOmKm 8Knw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date; bh=M8kjUtGppue3sjuZ1ccxnaotzaKgHdRhRoDLnPEs3wQ=; b=2HGnRiw/MjQX6hpdEgt96perQfqDVoMwlu/HH0B+MoUXfegX7ddTUPfkxmtEdEf/KQ 1TO+DqlerDXKy4mJL0aLJ6sZSuPFO2eHxS6Jr7PNED92xn9dAGvZQZng0GhIPDQ1Lqpt ikOAJ21IYOATs7kzTvTzu4wqOrq31iG0CLQE+Y7TDFWqY6uDnwEvSUXmv7RlCkc2mmlA SexqiHoz0ilet1/wz3eg3gs3TPFZhEtGd8Iti5p8W2l0Brl07D9a1+nuj+WpCGLL6EEM Igbl/s/RYVNg3JceeKPmApEQ9JaEX9Sq/OhuXpdjbVgidqg42kZ7Ijgk9dyJX2ePxQdK ftZg== X-Gm-Message-State: ACrzQf0JjZKFfo9XSH4hBPhTxNl9jG5NNNdf8ruJZG4vd1cfWxknILyr 9285CnSVo3Wma/SpxYEw6lHDUlEUBLxakpfP X-Received: from vannapurve2.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:41f8]) (user=vannapurve job=sendgmr) by 2002:a17:90a:64c8:b0:202:6d4a:90f8 with SMTP id i8-20020a17090a64c800b002026d4a90f8mr7698135pjm.11.1663200298705; Wed, 14 Sep 2022 17:04:58 -0700 (PDT) Date: Thu, 15 Sep 2022 00:04:43 +0000 In-Reply-To: <20220915000448.1674802-1-vannapurve@google.com> Mime-Version: 1.0 References: <20220915000448.1674802-1-vannapurve@google.com> X-Mailer: git-send-email 2.37.2.789.g6183377224-goog Message-ID: <20220915000448.1674802-4-vannapurve@google.com> Subject: [V2 PATCH 3/8] KVM: selftests: Add arch specific post vm load setup From: Vishal Annapurve To: x86@kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Cc: pbonzini@redhat.com, shuah@kernel.org, bgardon@google.com, seanjc@google.com, oupton@google.com, peterx@redhat.com, vkuznets@redhat.com, dmatlack@google.com, Vishal Annapurve Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add arch specific API kvm_selftest_post_vm_elf_load to possibly communicate information to VM that is already known to selftest VMM logic. This API will be used in followup commit to convey cpu vendor type to the guest vm. Suggested-by: Sean Christopherson Signed-off-by: Vishal Annapurve --- tools/testing/selftests/kvm/include/kvm_util_base.h | 4 ++++ tools/testing/selftests/kvm/lib/aarch64/processor.c | 4 ++++ tools/testing/selftests/kvm/lib/elf.c | 2 ++ tools/testing/selftests/kvm/lib/riscv/processor.c | 4 ++++ tools/testing/selftests/kvm/lib/s390x/processor.c | 4 ++++ tools/testing/selftests/kvm/lib/x86_64/processor.c | 4 ++++ 6 files changed, 22 insertions(+) diff --git a/tools/testing/selftests/kvm/include/kvm_util_base.h b/tools/testing/selftests/kvm/include/kvm_util_base.h index 98edbbda9f97..73cfee3ebd76 100644 --- a/tools/testing/selftests/kvm/include/kvm_util_base.h +++ b/tools/testing/selftests/kvm/include/kvm_util_base.h @@ -839,4 +839,8 @@ static inline int __vm_disable_nx_huge_pages(struct kvm_vm *vm) */ void kvm_selftest_arch_init(void); +/* + * API to execute architecture specific setup after loading the vm elf. + */ +void kvm_arch_post_vm_elf_load(struct kvm_vm *vm); #endif /* SELFTEST_KVM_UTIL_BASE_H */ diff --git a/tools/testing/selftests/kvm/lib/aarch64/processor.c b/tools/testing/selftests/kvm/lib/aarch64/processor.c index 2281d6c5d02f..12627c560f66 100644 --- a/tools/testing/selftests/kvm/lib/aarch64/processor.c +++ b/tools/testing/selftests/kvm/lib/aarch64/processor.c @@ -528,3 +528,7 @@ void kvm_selftest_arch_init(void) { guest_modes_append_default(); } + +void kvm_arch_post_vm_elf_load(struct kvm_vm *vm) +{ +} diff --git a/tools/testing/selftests/kvm/lib/elf.c b/tools/testing/selftests/kvm/lib/elf.c index 9f54c098d9d0..b8963a7146ce 100644 --- a/tools/testing/selftests/kvm/lib/elf.c +++ b/tools/testing/selftests/kvm/lib/elf.c @@ -189,4 +189,6 @@ void kvm_vm_elf_load(struct kvm_vm *vm, const char *filename) phdr.p_filesz); } } + + kvm_arch_post_vm_elf_load(vm); } diff --git a/tools/testing/selftests/kvm/lib/riscv/processor.c b/tools/testing/selftests/kvm/lib/riscv/processor.c index 26660dd2ba78..4491c0d4be45 100644 --- a/tools/testing/selftests/kvm/lib/riscv/processor.c +++ b/tools/testing/selftests/kvm/lib/riscv/processor.c @@ -366,3 +366,7 @@ void assert_on_unhandled_exception(struct kvm_vcpu *vcpu) void kvm_selftest_arch_init(void) { } + +void kvm_arch_post_vm_elf_load(struct kvm_vm *vm) +{ +} diff --git a/tools/testing/selftests/kvm/lib/s390x/processor.c b/tools/testing/selftests/kvm/lib/s390x/processor.c index 8654ec74009a..332501b3693f 100644 --- a/tools/testing/selftests/kvm/lib/s390x/processor.c +++ b/tools/testing/selftests/kvm/lib/s390x/processor.c @@ -222,3 +222,7 @@ void assert_on_unhandled_exception(struct kvm_vcpu *vcpu) void kvm_selftest_arch_init(void) { } + +void kvm_arch_post_vm_elf_load(struct kvm_vm *vm) +{ +} diff --git a/tools/testing/selftests/kvm/lib/x86_64/processor.c b/tools/testing/selftests/kvm/lib/x86_64/processor.c index 20bf125f9363..25ae972f5c71 100644 --- a/tools/testing/selftests/kvm/lib/x86_64/processor.c +++ b/tools/testing/selftests/kvm/lib/x86_64/processor.c @@ -1315,3 +1315,7 @@ bool vm_is_unrestricted_guest(struct kvm_vm *vm) void kvm_selftest_arch_init(void) { } + +void kvm_arch_post_vm_elf_load(struct kvm_vm *vm) +{ +} -- 2.37.2.789.g6183377224-goog