From patchwork Tue Feb 21 16:36:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mingwei Zhang X-Patchwork-Id: 60164 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp106547wrd; Tue, 21 Feb 2023 08:38:27 -0800 (PST) X-Google-Smtp-Source: AK7set8uS9d0lRO02gvpTfu0s+UirD8qZyUTtWDFEy9Md1NkPZFk9g5ngdkAN1sMd96K/bjCpRhG X-Received: by 2002:a05:6402:60d:b0:4ad:7c30:259a with SMTP id n13-20020a056402060d00b004ad7c30259amr5757448edv.2.1676997507126; Tue, 21 Feb 2023 08:38:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676997507; cv=none; d=google.com; s=arc-20160816; b=FcOcWZNhX0hxtNNO5KKUjJZz2iY500kpo0VvMET0iIn4hSiL8jA2UIlGPz7GVKAi78 Uq0k3ORWLfyMcn9rmMAx7UuHX7v5bqErSuh2EvJGKPltXsAfsXW60p6v9RTBN1wtHnzS GgqeQFptsuRdT6EgoeIC5hjofF/ZEHsQG2SYVJMsacHKnyG+ekfPWuDG4N+whaKjer1Q GEjvZzjcrxsNHv2+FpTdUk+zcf6jojZBEHhdKeEJVCSafLQm40aTR5fkkc//nxJSTdXR oleqy/1GSO4NMZ7J43QcmbE1bETdBAsQAyyCLDUUoK2GUTo4610kp6A5krsjP9OpGdj5 OQGA== 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=b5cXkH41Dpz3xl6Z7o6kxBjd79dMhYH0BWx6BfiSfBo=; b=wn7cnupYz8fpSpSQBbhjFmJCKeu17m/BJc5Wycrtp7lQxiw7xfz6c5bIuRKMvg30XQ tMQmB/OzQL8ESTC/jmx1RFGGGtY48GV5UIX6huuzs5k3T+8AJU/TGicoGXabIMC0RVzh mymqSoyBwscVeDbIqX4QhQyxEcRWtbQAAwqu1vzjwlgUi9xjrXB9nkdBstQFu5wNTXf1 TGu9U5RdOQIvvOfQHNe/pILX9owlhvDRCEmPWZaTYQpMDvXBN/iHJiCKxD0Bp384cKQp 008nFtdCrsnm1OFK574ccRqzQA7N5+8tr+okJHB4MseQwzjj5ZtCD8lXRZ6K6bIFstek GrxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=CZqHake4; 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 j24-20020aa7c418000000b004acc6cdc950si650143edq.123.2023.02.21.08.38.04; Tue, 21 Feb 2023 08:38:27 -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=CZqHake4; 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 S234815AbjBUQhf (ORCPT + 99 others); Tue, 21 Feb 2023 11:37:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234678AbjBUQha (ORCPT ); Tue, 21 Feb 2023 11:37:30 -0500 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E8A42B29F for ; Tue, 21 Feb 2023 08:37:25 -0800 (PST) Received: by mail-yb1-xb4a.google.com with SMTP id d62-20020a251d41000000b009802c10698cso4894571ybd.22 for ; Tue, 21 Feb 2023 08:37:25 -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=b5cXkH41Dpz3xl6Z7o6kxBjd79dMhYH0BWx6BfiSfBo=; b=CZqHake47gq3cd03ZUsZh+xOkan8dZo2tmN+vrMtOJQriJNPTqmfglWH2l9ManWKVJ ze1EbMlWwtI2gznNO6XbtWUxOWwDC4cTM7CUf6WrRBL5FWgdYDu3fcCNnA9+BWCDiMYp i4GHjTBuI9ijI9LjZWNWantpodnjMqpS1kNGyrFtoSUd8vz1GJdeEtRhXpqBq3D8DSC8 5cUNM3sbtaxkSj2cJvJ4tDH9/kZlZ075/b2Lh7toAGX7RwWHeFQe/XA0pO7iCSbCjtIo A7C2ltL8CxMbBRvN3g61e/lXrHTT0bZJG3OAKapt8gRsAB8tv0bxsF/81Gp26/Tfmo4+ D9cQ== 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=b5cXkH41Dpz3xl6Z7o6kxBjd79dMhYH0BWx6BfiSfBo=; b=3JnkRojRVqTpuGpb9vITfr5Nw8JTR/fNoNtSga4RiHmPhDFR0zKJFJimjizn3GZ3o4 AZ/CbNm1ccHkFggbj2/sy6MTtsGstUZ7hAgUWlDO1syt50M87CKxvJ5RZMIcIRlnElgt yNgN8Lo7xO6VgPKFTYP/Alwsf01XBVVQLwCFf+3NpbR1wziqTd/qaL1vbeHyxscMSHaO GAv+rr55tB31uKbxqRAogCVBR755GujsafkjiIVn7jMVZedbwnun5+5FERtHRxAtiiBU 25N/XVoqETxdTr/i3n98vmWdVC5Un6rMjEH9Op8ZBpH6835tJpiVDCBi+dC9xs4OZAfy xD5A== X-Gm-Message-State: AO0yUKUHf5ucf3QkIP5Yd+BDqEzh1bkdFRXIr6GfTR61nWJDbujkJu6J sIp7XrSvvy+mOAUf2P2yeJ7c/Gx6gHWo X-Received: from mizhang-super.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:1071]) (user=mizhang job=sendgmr) by 2002:a25:828a:0:b0:959:9937:49ce with SMTP id r10-20020a25828a000000b00959993749cemr1788344ybk.188.1676997444339; Tue, 21 Feb 2023 08:37:24 -0800 (PST) Reply-To: Mingwei Zhang Date: Tue, 21 Feb 2023 16:36:46 +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-5-mizhang@google.com> Subject: [PATCH v3 04/13] KVM: selftests: x86: Enable checking on xcomp_bv in amx_test 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?1758459338238504649?= X-GMAIL-MSGID: =?utf-8?q?1758459338238504649?= After tilerelease instruction, AMX tiles are in INIT state. According to Intel SDM vol 1. 13.10: "If RFBM[i] = 1, XSTATE_BV[i] is set to the value of XINUSE[i].", XSTATE_BV[18] should be cleared after xsavec. On the other hand, according to Intel SDM vol 1. 13.4.3: "If XCOMP_BV[i] = 1, state component i is located at a byte offset locationI from the base address of the XSAVE area". Since at the time of xsavec, XCR0[18] is set indicating AMX tile data component is still enabled, xcomp_bv[18] should be set. Complete the checks by adding the assert to xcomp_bv[18] after xsavec. Signed-off-by: Mingwei Zhang --- tools/testing/selftests/kvm/x86_64/amx_test.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/kvm/x86_64/amx_test.c b/tools/testing/selftests/kvm/x86_64/amx_test.c index 16c857c1052e..ba8c0afdbac8 100644 --- a/tools/testing/selftests/kvm/x86_64/amx_test.c +++ b/tools/testing/selftests/kvm/x86_64/amx_test.c @@ -197,6 +197,7 @@ static void __attribute__((__flatten__)) guest_code(struct tile_config *amx_cfg, xstate->header.xstate_bv = XFEATURE_MASK_XTILEDATA; __xsavec(xstate, XFEATURE_MASK_XTILEDATA); GUEST_ASSERT(!(xstate->header.xstate_bv & XFEATURE_MASK_XTILEDATA)); + GUEST_ASSERT((xstate->header.xcomp_bv & XFEATURE_MASK_XTILEDATA)); /* xfd=0x40000, disable amx tiledata */ wrmsr(MSR_IA32_XFD, XFEATURE_MASK_XTILEDATA);