Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp818453rwi; Thu, 13 Oct 2022 05:47:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6KdaSPa6o2nT8pI3kgbTxiM5CpCjxiMrgUFAb62oKk8ssGadc2L/SnpnEvDKJ72+24DbMg X-Received: by 2002:a17:907:2cd8:b0:78d:9c3c:d788 with SMTP id hg24-20020a1709072cd800b0078d9c3cd788mr19755339ejc.327.1665665241987; Thu, 13 Oct 2022 05:47:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665665241; cv=none; d=google.com; s=arc-20160816; b=FtDO6NdeJ71Dig09oDrxhgU5DlGncCTzXOZPlluMHeXTqsXmsX5YTRVKLQSIPi8+2w d+dJbvngZSmyfZ05REjaqoIjWR/8dRCoIQH6uQfwfHiAf/eV8UiDQ39UEQap07rfk0Jc xSoRiyJhOYjCNprSOL9/X7jftDm96C+SICzJ3tNmOKdsb+xvwuw83+m8J3x8DlgLX7f3 DfeNqP1Pp6/4a429q798OfmJp9wYavyGwxgzwdgDb+ZpF0UplqNwBlKRg+5mEHO3i5wG KHjB4hpXXOpJ+O++lIcTa683BfZgaJixYALtiGp+y50C/bu0m/Pz7um48yCNLK+yjXJn w08w== 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=V0aWW8bYZcwHBD680JFtsAetqc8rikFJrjlci3PTsrQ=; b=Ck8RK9f2dPk3ts68z05TVliaqJrgvS6c7YNSTn9JshwZIZPdXCa46xHLA103CsUjSe kVFIJtMuO1QNo01w8uALY0HcKuzpQiTnUrsKMFsiwssdwzB4RR0PST6vS9JRZ4gRy5uS BqSuAgezlJ+YZURyXh27cboHrP/DD91ujmCLX5k1p6qHntxaMCzuVJluKRxGLIDor0EQ eirOWZ1hxEQmHzRIart9QeYcj0hWhYE16nFWOLOy69Eh+CwCNU0bhc5+SkrvYqeCldMW vZLcLEzXd3LWWFlwDBsdGgmyFmLUKk60rtKEZGTon71bZsgXvWjFrzTAC4pweHv0DVXP yOMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=mrImrw9i; 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 ji22-20020a170907981600b0078e06ba4deasi2513691ejc.218.2022.10.13.05.46.55; Thu, 13 Oct 2022 05:47:21 -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=mrImrw9i; 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 S229751AbiJMMOE (ORCPT + 99 others); Thu, 13 Oct 2022 08:14:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229646AbiJMMNx (ORCPT ); Thu, 13 Oct 2022 08:13:53 -0400 Received: from mail-pj1-x104a.google.com (mail-pj1-x104a.google.com [IPv6:2607:f8b0:4864:20::104a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73616FE76F for ; Thu, 13 Oct 2022 05:13:51 -0700 (PDT) Received: by mail-pj1-x104a.google.com with SMTP id il7-20020a17090b164700b0020d1029ceaaso3210873pjb.8 for ; Thu, 13 Oct 2022 05:13:51 -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:message-id:reply-to; bh=V0aWW8bYZcwHBD680JFtsAetqc8rikFJrjlci3PTsrQ=; b=mrImrw9iRdZRmVVn3GynmwX3YCsy4SMTIdW1kb3OWriCm4QyX3xxUKJ3xPaqFRfIDZ jD2YV7LE4SRRpOA/oDGRX2PdPM86tgj0I6I/Gd2KHSV6VyXKfb1VH1tfPDV/1ObiOxet TiQpjp4DdTrfFB1AtaoTh6RO8iz31izgANRCSt+NWPB3PIvTQ4S9IJ2DVmhQ45pSoD8b ZpkIASLfpDCIRPXdLiVljzCkFEHIAA9DInb4VjV9FdQY358XVAd0BFTva7kHYQ3Wl3Xu fYGsJ1Mk6A9zbbD3tkJvTRyB/RDRKC79C/TCecFPpDwNzKXfncJ0UHkbbbRa1j9hhsIj pjkw== 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:message-id:reply-to; bh=V0aWW8bYZcwHBD680JFtsAetqc8rikFJrjlci3PTsrQ=; b=0mv/Gm+uYzE1IIDAWn7vOSzAEAvww1EmGlcVD5zxlnb8Yevqsc8y/SQ8pNw36IvH/s 7xulgQYfK3HTdB9UGkb4ELbDGEFk5K2gTAH8Gn5M/l9SS7sbZk7nVSYLRbjmj0+1K3Ao HB/G+ISspxmzZGPfkmmPaX857AzrXdOXljknOglTtb19YAMwjNbDQgJp00cpzmY9rfWT wTHxjjT2SGpCxyLQbOK+2naII7VMXML0uMt/GT5yHtgYbE57qSs/GyzFyHPjToVHeHlr Ymio8YzwtdLS+ThqR9F0ojkJTqZ/SqsTstmL9sL+TEy+mZBPpBLsJpl2UA1YHUaKI5pR ItEg== X-Gm-Message-State: ACrzQf2ufqwFieoiUIRB+5TZMHm3bkKLJfKKYZzyhWwB8FKCpLPnijI+ nwnedL+llBp19gR2S9Py2cg4P8ORDaoSZhzl X-Received: from vannapurve2.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:41f8]) (user=vannapurve job=sendgmr) by 2002:a17:902:64c2:b0:17b:6546:54be with SMTP id y2-20020a17090264c200b0017b654654bemr35968508pli.60.1665663230813; Thu, 13 Oct 2022 05:13:50 -0700 (PDT) Date: Thu, 13 Oct 2022 12:13:18 +0000 In-Reply-To: <20221013121319.994170-1-vannapurve@google.com> Mime-Version: 1.0 References: <20221013121319.994170-1-vannapurve@google.com> X-Mailer: git-send-email 2.38.0.rc1.362.ged0d419d3c-goog Message-ID: <20221013121319.994170-4-vannapurve@google.com> Subject: [V3 PATCH 3/4] KVM: selftests: Add arch specific post vm creation hook 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,USER_IN_DEF_DKIM_WL autolearn=ham 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_arch_vm_post_create to perform any required setup after VM creation. 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/kvm_util.c | 9 ++++++--- tools/testing/selftests/kvm/lib/x86_64/processor.c | 6 ++++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/kvm/include/kvm_util_base.h b/tools/testing/selftests/kvm/include/kvm_util_base.h index eec0e4898efe..1e7d3eae8c91 100644 --- a/tools/testing/selftests/kvm/include/kvm_util_base.h +++ b/tools/testing/selftests/kvm/include/kvm_util_base.h @@ -843,4 +843,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 creating the VM. + */ +void kvm_arch_vm_post_create(struct kvm_vm *vm); #endif /* SELFTEST_KVM_UTIL_BASE_H */ diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c index deb4c731b9fa..3ed72980c996 100644 --- a/tools/testing/selftests/kvm/lib/kvm_util.c +++ b/tools/testing/selftests/kvm/lib/kvm_util.c @@ -340,9 +340,8 @@ struct kvm_vm *__vm_create(enum vm_guest_mode mode, uint32_t nr_runnable_vcpus, kvm_vm_elf_load(vm, program_invocation_name); -#ifdef __x86_64__ - vm_create_irqchip(vm); -#endif + kvm_arch_vm_post_create(vm); + return vm; } @@ -2022,6 +2021,10 @@ void __vm_get_stat(struct kvm_vm *vm, const char *stat_name, uint64_t *data, } } +__weak void kvm_arch_vm_post_create(struct kvm_vm *vm) +{ +} + __weak void kvm_selftest_arch_init(void) { } diff --git a/tools/testing/selftests/kvm/lib/x86_64/processor.c b/tools/testing/selftests/kvm/lib/x86_64/processor.c index 39c4409ef56a..fa65e8142c16 100644 --- a/tools/testing/selftests/kvm/lib/x86_64/processor.c +++ b/tools/testing/selftests/kvm/lib/x86_64/processor.c @@ -1327,3 +1327,9 @@ bool vm_is_unrestricted_guest(struct kvm_vm *vm) return get_kvm_intel_param_bool("unrestricted_guest"); } + + +void kvm_arch_vm_post_create(struct kvm_vm *vm) +{ + vm_create_irqchip(vm); +} -- 2.38.0.rc1.362.ged0d419d3c-goog