Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp1938027rwb; Fri, 28 Jul 2023 18:38:56 -0700 (PDT) X-Google-Smtp-Source: APBJJlHiPddYumQdQGQP2IE1rk3tpTc8yj6J/iz1/oY/i1KZG8O91MiozsuDMgGdBKTfRRuKXXll X-Received: by 2002:a17:906:3185:b0:99b:f4df:dd52 with SMTP id 5-20020a170906318500b0099bf4dfdd52mr696856ejy.72.1690594736735; Fri, 28 Jul 2023 18:38:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690594736; cv=none; d=google.com; s=arc-20160816; b=xkrva3/lhYb9l0ZDMjk/BbzDIc1fAQ+YC464IwhYTLJrSxRvYJ/Lo43PGbpLItXUyv JGKsP0vUqPdNY+lRxgh4DY3tX0usPZQJafnhOyQFIItq1f4RT2M6Z7ECsr1abhDe6Dun tnT8UJpaRgMRh04Ow2/AdLFIhXkLL9Lzg+lPlcNkMoOKYq+Cc8Zm+CmUVtn50/Km4nBf gKriKi+hKDb6q0yUPTFXVxLt228sLFy78U3QPljBDKL91NvbyCNEPRinTFgF2HsI4FHb D+ztuL0ZhdDbwoycaehLeECYHwnCmLA0hNp6D0H8alpua+/bdyWxi6S21fiinnGdcQmb QnHQ== 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:reply-to:dkim-signature; bh=hrn38U8XG/46tZy+we7A1as/nu6Sx8AH5e7Mkf5XcGI=; fh=Ctt0ydInMKwei8YFBFbw7rU4p8H0G/T51ZI/KkO6Md4=; b=vKqi9Sreq8pzADzMVATyKgcHG9/jTvA1wi0Ea4yHranbzR0nEgHtgyojcQ2qO+74ML tB7n77+bTCksRfTq1fgZgvoHN1jSUmCLeIGJaAZodfV3UvfTm55kkf36cqabWY2Rkhsn qjDN81q6EIC9hhwt/42UxtE1ZSk/uvHJpkjeY2MrEW04AKjnBiuxwuoPNudD3Wwl7MY/ 03VIfBga+PReYE+NYDfRlPfJL+OQpMV6wp1ZAUje/ghK444hYmAgzGjb9nLNrD4LPH8m txA2C2xsSPewtdP0SYP6rtA0CA5dVe2SVQg70WlxhPafVsftU/rMj+Nu13X1RaAmHPqh 6skA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=kYyOWNI3; 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 lu20-20020a170906fad400b0099309c64f17si3594626ejb.146.2023.07.28.18.38.32; Fri, 28 Jul 2023 18:38:56 -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=20221208 header.b=kYyOWNI3; 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 S236687AbjG2Aj3 (ORCPT + 99 others); Fri, 28 Jul 2023 20:39:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236549AbjG2Aik (ORCPT ); Fri, 28 Jul 2023 20:38:40 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C468346A0 for ; Fri, 28 Jul 2023 17:37:51 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-d11f35a0d5cso2564696276.1 for ; Fri, 28 Jul 2023 17:37:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1690591044; x=1691195844; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=hrn38U8XG/46tZy+we7A1as/nu6Sx8AH5e7Mkf5XcGI=; b=kYyOWNI3Tn0tKjaJAbKUbe+RATw5K4fjxiUuaXudh6bQsz0nk+rrWkEwGxoeUE8Rdi rXRXsprqtFcJhBkVPM20n/0HtgaEsCoVa8v6/kCKFy7oX2SIHFWg51BkdkmGFEmzSepP 2gAPtNBnJLTWooycD5UVhbOrN4nOcu3008l3Ceyp9g6PnhBXl4EEwwEtEuZLHJfgU/A5 UkgXflZWtB7aJlaJepJStf7zhJU2AjXbqkCBxzCqurBavTp7EKn7rwX8d9x+RFTF5RwE V2ZZUTjWybiOP9xtSUsLs67rNkXjEZ7XhdkUZ4LcC4gsP4I7E7M3kQhVj8JQpnmfVP0o TyHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690591044; x=1691195844; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=hrn38U8XG/46tZy+we7A1as/nu6Sx8AH5e7Mkf5XcGI=; b=aJuoCD8GvTHzqhdDD1woaJVn6a/MZic0rC8aXUhdEhzcYsP9KkKuiRHM2DsJmayyiN JzJKvutCEWTECdic0EotGPfgI2MWD+D5gKd+8zXpy4FW4dIvHMDLl7kT6+Z6fdCUEYKk y+kdxhYRyZ8WRQa8qlw5KBGiHuslYcwDbpj/qYSqt/bv4m4o9oCbPWULPvXvyhSiHfbb tWwV6wNXbTp/FwAl6zAsSybLKeMDR2PT9vOERyb7utS9PwEeSRvEE56vDmnramtWUOmY bnofohCqk6wDCj3joEbeDnJHpJoBUQoEHZ2DXtGfkahpbMD4mT2hA2a7MW1ZD3Ra3xlt qZgQ== X-Gm-Message-State: ABy/qLZfEGSMDwdVhNGvHp/EYxIXN9sUpmJyyu4MfYXHGZqkt7JIn0RY 2l8MRsuCOyFWS+wTUDqrfim99+UskHY= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a05:6902:1611:b0:d0d:587c:e031 with SMTP id bw17-20020a056902161100b00d0d587ce031mr20024ybb.9.1690591044658; Fri, 28 Jul 2023 17:37:24 -0700 (PDT) Reply-To: Sean Christopherson Date: Fri, 28 Jul 2023 17:36:29 -0700 In-Reply-To: <20230729003643.1053367-1-seanjc@google.com> Mime-Version: 1.0 References: <20230729003643.1053367-1-seanjc@google.com> X-Mailer: git-send-email 2.41.0.487.g6d72f3e995-goog Message-ID: <20230729003643.1053367-21-seanjc@google.com> Subject: [PATCH v4 20/34] KVM: selftests: Convert x86's CPUID test to printf style GUEST_ASSERT From: Sean Christopherson To: Paolo Bonzini , Marc Zyngier , Oliver Upton , Christian Borntraeger , Janosch Frank , Claudio Imbrenda Cc: kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, Sean Christopherson , Thomas Huth , "=?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?=" , Aaron Lewis 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 Convert x86's CPUID test to use printf-based GUEST_ASSERT_EQ() so that the test prints out debug information. Note, the test previously used REPORT_GUEST_ASSERT_2(), but that was pointless because none of the guest-side code passed any parameters to the assert. Signed-off-by: Sean Christopherson --- tools/testing/selftests/kvm/x86_64/cpuid_test.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/kvm/x86_64/cpuid_test.c b/tools/testing/selftests/kvm/x86_64/cpuid_test.c index d3c3aa93f090..eb1b65ffc0d5 100644 --- a/tools/testing/selftests/kvm/x86_64/cpuid_test.c +++ b/tools/testing/selftests/kvm/x86_64/cpuid_test.c @@ -4,6 +4,8 @@ * * Generic tests for KVM CPUID set/get ioctls */ +#define USE_GUEST_ASSERT_PRINTF 1 + #include #include #include @@ -35,10 +37,10 @@ static void test_guest_cpuids(struct kvm_cpuid2 *guest_cpuid) guest_cpuid->entries[i].index, &eax, &ebx, &ecx, &edx); - GUEST_ASSERT(eax == guest_cpuid->entries[i].eax && - ebx == guest_cpuid->entries[i].ebx && - ecx == guest_cpuid->entries[i].ecx && - edx == guest_cpuid->entries[i].edx); + GUEST_ASSERT_EQ(eax, guest_cpuid->entries[i].eax); + GUEST_ASSERT_EQ(ebx, guest_cpuid->entries[i].ebx); + GUEST_ASSERT_EQ(ecx, guest_cpuid->entries[i].ecx); + GUEST_ASSERT_EQ(edx, guest_cpuid->entries[i].edx); } } @@ -51,7 +53,7 @@ static void guest_main(struct kvm_cpuid2 *guest_cpuid) GUEST_SYNC(2); - GUEST_ASSERT(this_cpu_property(X86_PROPERTY_MAX_KVM_LEAF) == 0x40000001); + GUEST_ASSERT_EQ(this_cpu_property(X86_PROPERTY_MAX_KVM_LEAF), 0x40000001); GUEST_DONE(); } @@ -116,7 +118,7 @@ static void run_vcpu(struct kvm_vcpu *vcpu, int stage) case UCALL_DONE: return; case UCALL_ABORT: - REPORT_GUEST_ASSERT_2(uc, "values: %#lx, %#lx"); + REPORT_GUEST_ASSERT(uc); default: TEST_ASSERT(false, "Unexpected exit: %s", exit_reason_str(vcpu->run->exit_reason)); -- 2.41.0.487.g6d72f3e995-goog