Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3153344pxb; Sat, 6 Feb 2021 23:03:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJwOQRerfmTQpoMxXwmdQ1jMbgPEEtj4FVQUoXX3Y27K9i2GFZcJVd4PRNCddT7GtHqjUX5Z X-Received: by 2002:aa7:c813:: with SMTP id a19mr11697148edt.136.1612681404406; Sat, 06 Feb 2021 23:03:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612681404; cv=none; d=google.com; s=arc-20160816; b=NE1yhIWjkuttTFqJ8b9qeACxIH1R5ms4duWKhe1kg05wQDU03Hp80FAzob6Pau+nJ9 M4le+2T+6IYjztv/VneOXY6lRsdLX7pbwZHXDVjzPrnzV2jhhjdAlF0XDE6izfekR5JD hrQGQKyPNXxVA+F5JzMz1BTRohzNuVJ0O+Hj1ivsFECwvNobgFuy/q7/gNbN90HldNgL OI17pwkKQvBQvwyaa2p00VJTfvBO91pfuN1zQ/EPvrtdjD3vLkMjIkYQRPrjON/OLZDh KxCxcf2tCtmlWIsY9ym3T2BmJ8tSxlA9XJukQnEfsIzJ9rQAEbKgi2o9zsiNsBQkUrmh d5Zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:ironport-sdr:ironport-sdr; bh=nQXsGaKk0xcNducUOdwIFmjgYfgp+sNLgtEMFzjcmHo=; b=GPopy9+K71Ru7mw4rxPLUxCMyuH7HNqsXCeUyWrGRYanji9CbIYRqgQnKBPJymDSlw IpbBj1+ef5hOr/dfSp6OtbzCiyFqJ5Y6YjQFQY1E+hn/qF/6HIZ+d5PG9pQFPvBBGAYy NJ3Kk9RodDGfS15Ar9HvAX7sdCsFNOi8iLHTFLcLiYoLgFMfft8pslOI/o5h+yV2ui/6 9J6PXV6iDdoxyFgAMJjaWrJkjwl+9RQ3XHMfqIwdh7fN7yCSfVWWmefEmdK37Gk8bNqi DqWYT6hIxgFgulIAxukA3fdKLdUqMpG6SPS5TFvSKoto5e6iQZ0mgZsGQiGKVI8IqJD1 1udA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hr1si8415890ejc.438.2021.02.06.23.03.01; Sat, 06 Feb 2021 23:03:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229864AbhBGG7v (ORCPT + 99 others); Sun, 7 Feb 2021 01:59:51 -0500 Received: from mga07.intel.com ([134.134.136.100]:48431 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229750AbhBGG7Y (ORCPT ); Sun, 7 Feb 2021 01:59:24 -0500 IronPort-SDR: owiwbSODvHCIEE48ChT1qDiPvTebQLTdIcYJAh7GH37hY4pSMVJM3s84lcfKx4tLD+r0DpiKRz WbEmERd7w/sw== X-IronPort-AV: E=McAfee;i="6000,8403,9887"; a="245660862" X-IronPort-AV: E=Sophos;i="5.81,159,1610438400"; d="scan'208";a="245660862" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Feb 2021 22:54:57 -0800 IronPort-SDR: crH5kJ4RDWYlHwRhvDVtcQ6RB/xoxpMJghZcs9+7UDEHO83bFIXvJoWrIPziVcaLAXGvaw3ws4 NibIVxJYcJyQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,159,1610438400"; d="scan'208";a="410376821" Received: from vmmteam.bj.intel.com ([10.240.193.86]) by fmsmga004.fm.intel.com with ESMTP; 06 Feb 2021 22:54:54 -0800 From: Jing Liu To: pbonzini@redhat.com, seanjc@google.com, kvm@vger.kernel.org Cc: linux-kernel@vger.kernel.org, jing2.liu@intel.com Subject: [PATCH RFC 7/7] kvm: x86: AMX XCR0 support for guest Date: Sun, 7 Feb 2021 10:42:56 -0500 Message-Id: <20210207154256.52850-8-jing2.liu@linux.intel.com> X-Mailer: git-send-email 2.18.4 In-Reply-To: <20210207154256.52850-1-jing2.liu@linux.intel.com> References: <20210207154256.52850-1-jing2.liu@linux.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Two XCR0 bits are defined for AMX to support XSAVE mechanism. Bit 17 is for tilecfg and bit 18 is for tiledata. Signed-off-by: Jing Liu --- arch/x86/kvm/x86.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index bfbde877221e..f1c5893dee18 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -189,7 +189,7 @@ static struct kvm_user_return_msrs __percpu *user_return_msrs; #define KVM_SUPPORTED_XCR0 (XFEATURE_MASK_FP | XFEATURE_MASK_SSE \ | XFEATURE_MASK_YMM | XFEATURE_MASK_BNDREGS \ | XFEATURE_MASK_BNDCSR | XFEATURE_MASK_AVX512 \ - | XFEATURE_MASK_PKRU) + | XFEATURE_MASK_PKRU | XFEATURE_MASK_XTILE) u64 __read_mostly host_efer; EXPORT_SYMBOL_GPL(host_efer); @@ -946,6 +946,12 @@ static int __kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr) if ((xcr0 & XFEATURE_MASK_AVX512) != XFEATURE_MASK_AVX512) return 1; } + + if (xcr0 & XFEATURE_MASK_XTILE) { + if ((xcr0 & XFEATURE_MASK_XTILE) != XFEATURE_MASK_XTILE) + return 1; + } + vcpu->arch.xcr0 = xcr0; if ((xcr0 ^ old_xcr0) & XFEATURE_MASK_EXTEND) -- 2.18.4