From patchwork Tue Feb 21 16:36:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mingwei Zhang X-Patchwork-Id: 60169 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp106794wrd; Tue, 21 Feb 2023 08:39:00 -0800 (PST) X-Google-Smtp-Source: AK7set+nOMDt+rjyjuNLLrH3nZC3Fwpkjz3/I14McdNPoOL0eJyehl5gnMYriSBy46+R7f+w2WLS X-Received: by 2002:a17:907:7ea9:b0:8e4:dc2b:4550 with SMTP id qb41-20020a1709077ea900b008e4dc2b4550mr526093ejc.64.1676997540138; Tue, 21 Feb 2023 08:39:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676997540; cv=none; d=google.com; s=arc-20160816; b=SrhRgeA8/Hkn6MTVVw3xbVMyIQ3m9J5I9Gqh7HXjEoYcdJP7ThstUdPoxiFipnHnAU sNgg0Yd6sIvSLmgqJ2VcWmJtyao8y8NjVO/ybcYKVCiUyYpiYqf8LWaGq1J20D0Elfqy SJOIASSo/LJOUZiCiVXBRfZp5PPS6wI5rF8sXYdrP6f+zI7sIHoNxXrkgXfEnYNhbuuJ Jb+VVbcSYzVtZsa5obq0TFM66HcC7CwjhkwQYbo+yZByJ7Qcke4OF+OZEfxFrSJ4IKTq bzSIciYmKojTZPRY8AeWWImiQ+4Gk9xUJRX70PWpzzPGCssugVFX65B+Xlq7oHeuj+Is IrLg== 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=iiRrB1La2XaBQ8X9jljAYPafLfxRlgHLwbfoJQq6vJc=; b=FkXy2RKidDLTCazPmx2b8k9v5ixh4JNZClomyluGGdk893h+OrU3WKBnLO0zXYUNDp aWJx/rUlgD9172mfEI+s+rLnePJ1oHsQQPTfaJKuPXHB936MG5FyfzCmf97IgyXZiA2i bskqauEtT90IJ8GnHA3USFh8v49GZVZfNin2CU5AX6g2reYYBiJicepHwWM1diGJ6/1V TNc1YSSDGNYydBKKx0Z3NAqX1V5V2YYgVjsh9jdwOqcyrCZxhu/w/2fT6DA6rJKObWFf 8NA0wRJS4GLHqwGuhYZssB5Yyv3Zo0XUgpFnTue9372Prd5MXxL3nmd7oW9lyykpDEVZ kx+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=fAH3hCUl; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bf8-20020a0564021a4800b004ad12d1ffc4si8080268edb.236.2023.02.21.08.38.37; Tue, 21 Feb 2023 08:39:00 -0800 (PST) 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=fAH3hCUl; 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 S234916AbjBUQiI (ORCPT + 99 others); Tue, 21 Feb 2023 11:38:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234862AbjBUQht (ORCPT ); Tue, 21 Feb 2023 11:37:49 -0500 Received: from mail-pg1-x549.google.com (mail-pg1-x549.google.com [IPv6:2607:f8b0:4864:20::549]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7DF12D14E for ; Tue, 21 Feb 2023 08:37:33 -0800 (PST) Received: by mail-pg1-x549.google.com with SMTP id q15-20020a63d60f000000b00502e1c551aaso265915pgg.21 for ; Tue, 21 Feb 2023 08:37:33 -0800 (PST) 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:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=iiRrB1La2XaBQ8X9jljAYPafLfxRlgHLwbfoJQq6vJc=; b=fAH3hCUl7uqbwUtd34iFW4FxURELK93IK/02Vx0KEZ+6k0X581BSlqbabdxNOqoBgo meEl6t2ZiDTIdhAK579ZxSCzIGixUue+EXZ/tFu3HlVbvdHU3QCq9IeS3SSra0MJxJ7i nbq8TQ51m3339oT33ydPu9XaJMCzD1QjV689OxEdbjY4FRc7QacllNDSkJuhhi5eFXoL TcOKXj4ubRAQ5sUHN9Y8qlxN5G8h5tss7+dpwoJDOirM9qLKmpDmS1YaqKN3XDYNUPCz zOiltEGWXv2rsSRM7wh4fzWdgxRKe5qA04L0Htv1bI7O/TZF70MfnASoGoq6SDuVhfq9 FSxg== 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:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=iiRrB1La2XaBQ8X9jljAYPafLfxRlgHLwbfoJQq6vJc=; b=DSXuOjbfRV4OxrVl5bY5NRiWWXx7/ZIRJEi0Ck7ThUP8EAuLs8Ytyxbj1NiJF83Hj2 qiBYJZO3ws/a/CpS1dU71SorTWi4j7IEDP530diLCCY5VNV89uFIkFwCHX1BG53P9ibg 77gwWtWMDEW7UgrynPJZiMflqVNn+FMAHRePvE0rLCU0q1jfPx62UI30WIvJNk9rMu4N 8xubFRAce5oFsZjte0KH/GGdzEpaH2BGNqIAIPAEXDjtZUwIxQWOMO2VxKLC9sDQaQYZ 4O1ADnIXoyKYpomQGsJQ58wljpnkH/Z++6Qrx4mRAaJKgJ1SyyvD5gTbQvS1oFj9lbVT onYA== X-Gm-Message-State: AO0yUKXLSMpA/9cjxsjY7tSHhwmsq5f2tPA3Q4glp4Oiajk2imEqQlk8 qre3lJ0tPZVFrwZAxUcg4UBZ8EgilVfy X-Received: from mizhang-super.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:1071]) (user=mizhang job=sendgmr) by 2002:a63:7a56:0:b0:4fb:b88f:e98a with SMTP id j22-20020a637a56000000b004fbb88fe98amr733518pgn.7.1676997453182; Tue, 21 Feb 2023 08:37:33 -0800 (PST) Reply-To: Mingwei Zhang Date: Tue, 21 Feb 2023 16:36:51 +0000 In-Reply-To: <20230221163655.920289-1-mizhang@google.com> Mime-Version: 1.0 References: <20230221163655.920289-1-mizhang@google.com> X-Mailer: git-send-email 2.39.2.637.g21b0678d19-goog Message-ID: <20230221163655.920289-10-mizhang@google.com> Subject: [PATCH v3 09/13] KVM: selftests: x86: Assert that XTILE is XSAVE-enabled From: Mingwei Zhang To: Sean Christopherson , Paolo Bonzini , Thomas Gleixner Cc: "H. Peter Anvin" , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, Mingwei Zhang , Jim Mattson , Venkatesh Srinivas , Aaron Lewis , "Chang S. Bae" , Chao Gao 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=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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758459372615402281?= X-GMAIL-MSGID: =?utf-8?q?1758459372615402281?= From: Aaron Lewis Assert that XTILE is XSAVE-enabled. check_xsave_supports_xtile() doesn't actually check anything since its return value is not used. Add the intended assert. Opportunistically, move the assert to a more appropriate location: immediately after XSETBV and remove check_xsave_supports_xtile(). Fixes: 5dc19f1c7dd3 ("KVM: selftests: Convert AMX test to use X86_PROPRETY_XXX") Signed-off-by: Aaron Lewis Signed-off-by: Mingwei Zhang --- tools/testing/selftests/kvm/x86_64/amx_test.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/tools/testing/selftests/kvm/x86_64/amx_test.c b/tools/testing/selftests/kvm/x86_64/amx_test.c index 724e991ba814..d1fbf8936192 100644 --- a/tools/testing/selftests/kvm/x86_64/amx_test.c +++ b/tools/testing/selftests/kvm/x86_64/amx_test.c @@ -115,11 +115,6 @@ static inline void check_cpuid_xsave(void) GUEST_ASSERT(this_cpu_has(X86_FEATURE_OSXSAVE)); } -static bool check_xsave_supports_xtile(void) -{ - return __xgetbv(0) & XFEATURE_MASK_XTILE; -} - static void check_xtile_info(void) { GUEST_ASSERT(this_cpu_has_p(X86_PROPERTY_XSTATE_MAX_SIZE_XCR0)); @@ -166,6 +161,7 @@ static void init_regs(void) xcr0 = __xgetbv(0); xcr0 |= XFEATURE_MASK_XTILE; __xsetbv(0x0, xcr0); + GUEST_ASSERT(__xgetbv(0) & XFEATURE_MASK_XTILE); } static void __attribute__((__flatten__)) guest_code(struct tile_config *amx_cfg, @@ -174,7 +170,6 @@ static void __attribute__((__flatten__)) guest_code(struct tile_config *amx_cfg, { init_regs(); check_cpuid_xsave(); - check_xsave_supports_xtile(); check_xtile_info(); GUEST_SYNC(1);