Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp202258rwb; Mon, 26 Sep 2022 17:17:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4VNVboNjVDlRgnNe9OBoe9VoXTxFRMQ7q0ugPUKZgK+BCbfE3QHJwMveaT6Hp+PTMUz9Gp X-Received: by 2002:a17:90b:2398:b0:200:a861:2e86 with SMTP id mr24-20020a17090b239800b00200a8612e86mr1394056pjb.233.1664237867711; Mon, 26 Sep 2022 17:17:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664237867; cv=none; d=google.com; s=arc-20160816; b=IXPIC3N8PVuSY+sIWQLSh+lN80ibg3+EkU398S4qxJYYnOeKsL4Wil2EeFDJxGwVzk idR/B8cyJJ1liCgL7D8JaYJmRg8ICerFa08GgG6yG1XHZPUMv5/ia/IrJAnZAZElMXDv kJQZ/le8+met+B+tt08Gx8NoH2f+qXkr4lV7TFiR6YnRijgnRYKi31WkZUYSYeie89Am CIhDesMKaRa+a/MPySFO8lin308knSRppu75GFdMUUJkPifZyB0qZpncA6k72kwJhtGb nGP61ugBZU8l88m7PZW51uzWlCqXrDmHJzKLnpil8Dh3xydD46nGwvNvvSc9oTlT6fy0 XlrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=KTYkoGSnzoJvmcli4WcPkh9mD6LI1jnFnjX4Q4TT2Dw=; b=k58DlrOJvmE0o5AMVl45MrPfhOSvWVdKs5SH/wn7mEeUccHe5YRTOFe3/4lU3K5ZBj 175sHQ5tPmNl3argZl+1YngTYcm4jvI2jLBu2ILKptSFumNndH/NmDLNpDy0pS6i2U9f 9NlKeB1bpsdsqSPJiXo8XdjrIT6r5S2XDtrprO/ozfW8H8kV7dETc7ccjQus+cxepJRi 7QKMZgcHj4G+ahym9agxuHr1HC4aQZXkpOVRmkuW75pDXMThTZYzA48kp1TJM/mPWLXN 1gXRkTy0+NWSy4VMHYOy4p+Hm84sC9tsBKZXcgMdDxBgnFkl2FKhlGAWX8Lkh0jgVl3V 4BSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=bUlA+hIf; 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 q128-20020a634386000000b00439ff01ff99si122869pga.531.2022.09.26.17.17.36; Mon, 26 Sep 2022 17:17:47 -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=bUlA+hIf; 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 S231361AbiIZXUc (ORCPT + 99 others); Mon, 26 Sep 2022 19:20:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230413AbiIZXTM (ORCPT ); Mon, 26 Sep 2022 19:19:12 -0400 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5C5FB2853 for ; Mon, 26 Sep 2022 16:19:10 -0700 (PDT) Received: by mail-pj1-x1035.google.com with SMTP id y11so7659537pjv.4 for ; Mon, 26 Sep 2022 16:19:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=KTYkoGSnzoJvmcli4WcPkh9mD6LI1jnFnjX4Q4TT2Dw=; b=bUlA+hIf6EHrPg6Yjm1RD3TBCBKxD9VZxfMkGFaLz9DAFz2FV7tLQP4nBfEHN7nOja OwKLyjUqKKhJUAzlsz4s1RG32swgnsK9c4oxMKVYlAps2IEpfwejclDTVnpQaI3MUqTu UJfE5mlf3BkYySDs5sWm9/sK4tqpTI+jFjN/qtsmMK5EuJHF5rhR8xYH6Tnq3BKk2V2W 77F91PPAOk5sVGm4o+KQS8KxNJADcBa8X5PPy3XftGUQQ4rxDXg6yHsII94yR34u7eO+ lGmY4q/6ojKglw1GHKCj7VCcsvLO19KRRqfAZxDXmVBbNnWMKnmN5keiQ5Yya/kUI/rn EE7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=KTYkoGSnzoJvmcli4WcPkh9mD6LI1jnFnjX4Q4TT2Dw=; b=rIc9oxQHkxhJCUS38edUCovCJNoP3/U/rtjhRI8O/OCCWSEkJtOPh0Q3uu2TmMwt9N 4/2sjsErv8lti8/XTDl+Etq7tJy5fZB1b23l9rQvHddX173FRDvoFGYA9eg1FdnJdpiv YN+IjN3SkLKUSL+RCzTQeBsvDGKSad+iGuH2PrrE2yzaamq2jhMgCuokpLq34OfdsAhD EKcOdeDEy6nlzdcYWDkHcVTes2qE8lVhItR4rIW8HD5jczBAa0FSZP10iHixy2hLRmic rjoLgBtxvNIFewquMwa9RgH+iMZbJkGe9yqxSxXCb1MpxjN+Uc9vpouzl2Y7iT/nsf5u 8h/A== X-Gm-Message-State: ACrzQf3la6gsUnfK6t//fj7nnfoSAbz+1QKMh5A8GWVA2p9LcT7u404T HTMpTGMDhHLzvWattq93fj+refbnZswi1Nx2SECxeOPVouM= X-Received: by 2002:a17:90b:384b:b0:200:3215:878b with SMTP id nl11-20020a17090b384b00b002003215878bmr1184729pjb.176.1664234350226; Mon, 26 Sep 2022 16:19:10 -0700 (PDT) MIME-Version: 1.0 References: <20220915000448.1674802-1-vannapurve@google.com> <20220915000448.1674802-4-vannapurve@google.com> In-Reply-To: From: Vishal Annapurve Date: Mon, 26 Sep 2022 16:18:59 -0700 Message-ID: Subject: Re: [V2 PATCH 3/8] KVM: selftests: Add arch specific post vm load setup To: David Matlack Cc: x86 , kvm list , LKML , linux-kselftest@vger.kernel.org, Paolo Bonzini , shuah , Ben Gardon , Sean Christopherson , Oliver Upton , peterx@redhat.com, Vitaly Kuznetsov Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_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 On Wed, Sep 21, 2022 at 1:54 PM David Matlack wrote: > > On Thu, Sep 15, 2022 at 12:04:43AM +0000, Vishal Annapurve wrote: > > 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. > > It's not a "vm elf" per-se, it's "loading the elf into the VM". How > about: > > /* > * API to execute arch-specific logic after loading the selftest ELF image > * into the VM. > */ > Ack. Will update this in the next series. > > + */ > > +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); > > } > > Same suggestion here as the previous patch: Use __weak to define a > default no-op implementation of kvm_arch_post_vm_elf_load(). > > > 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 > >