From patchwork Sat Jul 29 00:36:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 13332805 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6CC5CEB64DD for ; Sat, 29 Jul 2023 00:38:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Reply-To:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:Message-ID :References:Mime-Version:In-Reply-To:Date:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/fAREbNOnwqyBbZf0g1P8reSROWoG8vI4FRyjidJ5J0=; b=w18pxQzIU8kA5u uSiKQtDySUlISVFcWWGWoxxY+8yLZIANGYT34GU716/FzpKAbYZPheHzK7+yipyacvOaO8Jcpzp4s zH3dwYlocCxhsTPptpG+rhj2vtb3eIhfprYTcOhcjm4VtxGW5rNzhag2QD1qsVK9Ga0Bw5wrmoxoi rCfiPqliszKd2h1lXQWz6f63ftD3T0buH70xxlh3r30uh74rJIceBZvHi1tuhRT5PMnpRiKiqg1T8 PNosjdgMsA32B7Wbi3f7yyvjK6Fs4dSd7EYF4w+mw1fbFtH188aeS9SXF1DN6LvjRBB31P9Bk9/qa 6+DdCFQUDJyTdXKifdIA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qPXyM-005dJ3-3D; Sat, 29 Jul 2023 00:38:19 +0000 Received: from mail-yw1-x114a.google.com ([2607:f8b0:4864:20::114a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qPXxE-005cgM-2Q for linux-arm-kernel@lists.infradead.org; Sat, 29 Jul 2023 00:37:10 +0000 Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-5847479b559so21521437b3.1 for ; Fri, 28 Jul 2023 17:37:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1690591027; x=1691195827; 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=qOSidrRp2LZHBdun0W7JYB5cE5pjjFCNvb+AcO0kpgo=; b=IeguEOY0s9ia4LSqz0PgZnKqVW1fP0z9QG/oINDmIWG6CyC3ATWOXcPU8daBe6CfLx EbQ+o0l0XWCtodFbjFJ1lBYl8zQ9lI/HK1IBed/hhqLzu7yFojnkVmJ5Yc2zwNnTDATA PExKr3IXJDvazDfzsaLC2WMEfRgTgridif3o+lN8QltCrJCx75svpURWl+JX3rfL6VEC 3I/IQlUXZ5bIz7Ak78S5iG2A5Q194P91ty6X2ufPMUJBcnfkbk60TGWdsf0zLtGZHLwv khBr1DTEcFb4P1GyQshYSHcICbfkfAmADqNs7y7pi05FdJndMa+XA5kZAm/Fjpmrk/DX KMnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690591027; x=1691195827; 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=qOSidrRp2LZHBdun0W7JYB5cE5pjjFCNvb+AcO0kpgo=; b=erbsnpWMx+rmX8wlunGTEv5+fBXpXbkvf6jYlmUcRdNQElFzuzUx4/IoseTaoQl5ea 8RUuynCvLyVzTWqD5Czz0gA/KbDgkGTYItLl0dfx53XKB7SAc/lm89Ji+mtyh6S0lBKL l5CEzqJURcU4SH6gufsH3s3h5EZDfJhA+yOV2TiGiFgOLtV+mqB1B3vxNC76HX7mTjSt BEswvX/9ncyr1taPvuvXkjBRdEKnM3PcQLW3NJT2MvGAb6OTauHltZPmVOif7qKa+4Km MwvPiAKH8QSdkn7J6TQqgW90HgnLdmVi0/bpXa1icfdxp0/pd3WVh5iBiM34ArQPDVH2 HkHw== X-Gm-Message-State: ABy/qLZkYFXEW/LH7vGWfljLTdlOtMXvBNNAeWGzUR8nkQhhRfN+a1td urUWp/OrjqFAfjASBaIk2tBiBgKp1go= X-Google-Smtp-Source: APBJJlFoZbKPiG4qr8ZwiXvM3nPYLxinTgJuk9sccrmvpGopOc0ujixNDWPL7G8kTRHnTG9EjYmYrn1AOZ4= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a81:ac1a:0:b0:565:9bee:22e0 with SMTP id k26-20020a81ac1a000000b005659bee22e0mr24550ywh.0.1690591027421; Fri, 28 Jul 2023 17:37:07 -0700 (PDT) Date: Fri, 28 Jul 2023 17:36:20 -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-12-seanjc@google.com> Subject: [PATCH v4 11/34] KVM: selftests: Convert debug-exceptions 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_Mathieu-Daud=C3=A9?= " , Aaron Lewis X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230728_173708_796096_B4E4D7CC X-CRM114-Status: GOOD ( 10.46 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Sean Christopherson Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Convert ARM's debug exceptions test to use printf-based GUEST_ASSERT(). Opportunistically Use GUEST_ASSERT_EQ() in guest_code_ss() so that the expected vs. actual values get printed out. Signed-off-by: Sean Christopherson --- tools/testing/selftests/kvm/aarch64/debug-exceptions.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/kvm/aarch64/debug-exceptions.c b/tools/testing/selftests/kvm/aarch64/debug-exceptions.c index 637be796086f..fdd5b05e1b0e 100644 --- a/tools/testing/selftests/kvm/aarch64/debug-exceptions.c +++ b/tools/testing/selftests/kvm/aarch64/debug-exceptions.c @@ -1,4 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 +#define USE_GUEST_ASSERT_PRINTF 1 + #include #include #include @@ -365,7 +367,7 @@ static void guest_wp_handler(struct ex_regs *regs) static void guest_ss_handler(struct ex_regs *regs) { - GUEST_ASSERT_1(ss_idx < 4, ss_idx); + __GUEST_ASSERT(ss_idx < 4, "Expected index < 4, got '%u'", ss_idx); ss_addr[ss_idx++] = regs->pc; regs->pstate |= SPSR_SS; } @@ -410,8 +412,8 @@ static void guest_code_ss(int test_cnt) /* Userspace disables Single Step when the end is nigh. */ asm volatile("iter_ss_end:\n"); - GUEST_ASSERT(bvr == w_bvr); - GUEST_ASSERT(wvr == w_wvr); + GUEST_ASSERT_EQ(bvr, w_bvr); + GUEST_ASSERT_EQ(wvr, w_wvr); } GUEST_DONE(); } @@ -450,7 +452,7 @@ static void test_guest_debug_exceptions(uint8_t bpn, uint8_t wpn, uint8_t ctx_bp vcpu_run(vcpu); switch (get_ucall(vcpu, &uc)) { case UCALL_ABORT: - REPORT_GUEST_ASSERT_2(uc, "values: %#lx, %#lx"); + REPORT_GUEST_ASSERT(uc); break; case UCALL_DONE: goto done;