From patchwork Mon May 13 01:12:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: mao bibo X-Patchwork-Id: 13662947 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A4BFFAD31; Mon, 13 May 2024 01:12:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=114.242.206.163 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715562767; cv=none; b=PLOMY2vN4s1JSBhYDGaz7DMQgpg/hINMhfx5djZ/99Te+V1MMFdUwXFF+lWfCpG8tcDuQC83o6JnZ4yIuRLGW7ZK6iRaeiNg6kV841vXsPQMkOK9zxSnn7c8BQRnuI0X3mGIX7lHDRqajaFE5ZyVNbui0qt15n4abguqFu8ILx4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715562767; c=relaxed/simple; bh=ph6pyDJp1Q8793pUOXTnM343FcWHbxA0ThxDlcB6iz0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Eg+gkIsaG+OQbVu4A4agAiQ+4oBPjSEiOuZewpbj9w2t4+GmVdjgvupvX+eF9EBhSZBafYboP8DWGfYP14M3KpODKqgNWGaKNh6uBQd3QwthJZBr6tIBjR6RKtXECHEJWiqaAt75QJrBuixSPc8Y/6aQwmllEzCshRYjuK9OQ4Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn; spf=pass smtp.mailfrom=loongson.cn; arc=none smtp.client-ip=114.242.206.163 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=loongson.cn Received: from loongson.cn (unknown [10.2.5.213]) by gateway (Coremail) with SMTP id _____8BxV_AFaUFmjv0LAA--.29710S3; Mon, 13 May 2024 09:12:37 +0800 (CST) Received: from localhost.localdomain (unknown [10.2.5.213]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Ax690DaUFmV1gcAA--.51334S4; Mon, 13 May 2024 09:12:36 +0800 (CST) From: Bibo Mao To: Tianrui Zhao , Huacai Chen Cc: WANG Xuerui , kvm@vger.kernel.org, loongarch@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] LoongArch: KVM: Add LBT feature detection with cpucfg Date: Mon, 13 May 2024 09:12:34 +0800 Message-Id: <20240513011235.3233776-3-maobibo@loongson.cn> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240513011235.3233776-1-maobibo@loongson.cn> References: <20240513011235.3233776-1-maobibo@loongson.cn> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CM-TRANSID: AQAAf8Ax690DaUFmV1gcAA--.51334S4 X-CM-SenderInfo: xpdruxter6z05rqj20fqof0/ X-Coremail-Antispam: 1Uk129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7KY7 ZEXasCq-sGcSsGvfJ3UbIjqfuFe4nvWSU5nxnvy29KBjDU0xBIdaVrnUUvcSsGvfC2Kfnx nUUI43ZEXa7xR_UUUUUUUUU== Loongson Binary Translation (LBT) feature is defined in register cpucfg2. Here LBT capability detection for VM is added. Signed-off-by: Bibo Mao --- arch/loongarch/kvm/vcpu.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/loongarch/kvm/vcpu.c b/arch/loongarch/kvm/vcpu.c index d93ec21269da..b2856539368a 100644 --- a/arch/loongarch/kvm/vcpu.c +++ b/arch/loongarch/kvm/vcpu.c @@ -532,6 +532,12 @@ static int _kvm_get_cpucfg_mask(int id, u64 *v) *v |= CPUCFG2_LSX; if (cpu_has_lasx) *v |= CPUCFG2_LASX; + if (cpu_has_lbt_x86) + *v |= CPUCFG2_X86BT; + if (cpu_has_lbt_arm) + *v |= CPUCFG2_ARMBT; + if (cpu_has_lbt_mips) + *v |= CPUCFG2_MIPSBT; return 0; case LOONGARCH_CPUCFG3: