Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp1899299lqb; Mon, 27 May 2024 00:47:38 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUS7L0MbSFvafPQDHli8XNWzPKfy24nyZXkcZiypu4dpXtFfxzXJhNgT0XKaxr0fHN7We7Mf+ceeCUBW0oNMXdKF+zM2wiefdOrEEaUig== X-Google-Smtp-Source: AGHT+IEAzZdZ/kepoPYa02eULczBWzxd1EvUdh3P66UI5Bni0SlPey4BmyNGjpRxgl4uycol0qXn X-Received: by 2002:a05:6358:2489:b0:194:9edd:966c with SMTP id e5c5f4694b2df-197e511403dmr1084508155d.18.1716796058058; Mon, 27 May 2024 00:47:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716796058; cv=pass; d=google.com; s=arc-20160816; b=t0kkxISserPoQF6Lj3SjqiYxmqn9Ukel2QBRRdWQoy4VFM03BcFQneLEnIBY0kBwjQ WsPLEaO3IzZGCCub3kWy2dmrtUWFJBaqhwpb8yLKsu/1XyIjm85Lds5NpeAkI8Sl78AJ Wzi8oqQge+SJFJr2iFB4SiwUmsU/2qOC7rjaxAhr6Gf4BiMXs5CuyRY4leV860Oqgm0v JNUUbi3ANkTxPhpXWb7NGSrYWsRwzcvbMn2w09FDiRCLhPWar3UxiXrzrqfX1t9D+NXr fwtBcq7dBo8QMLJZGhET7dActo4klXVnBb15+PYrmR4ToxglS6E0R6UutNnaS9ry9n6A SSvQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=Im6NMYQQYzILX3FGjmW+hh9qwk1Pxu/FnvrFnWvYIlM=; fh=JOrDXAv7dX9lqUsWenmIinruxsV5NNS7FV+l4Q4onAY=; b=LMoBXTB8x2jIgb/0odq3uSCUv5EvCl+f8aijUIMy0FHvQf+H3uyW5NCzFelEXYGWER a53C4h9mCwW9YCjDdwpZjvSZ1MveTyYjNShtZx1gTEX2lkTA51r8ylPAojuzvhDqskEl xPFvkYxHwa6Q68IynDCV+xx50pbb1iBx84RGCYVWRyQV44jFh0GXGlsMqmIV6m9o42nP TxXW0gnAo1kSw8ww4bZZZaEGbt6XTeTnra2KHuNDft5VUKpewIP5XIKJSVLwveB23SH0 DVOB48pZjQHDKA/BExMdVKWXYFLkaooe0t16JW2Duxea2gE9VZPPretmdi3NA1zcXkxN /P6w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=loongson.cn); spf=pass (google.com: domain of linux-kernel+bounces-190159-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-190159-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 41be03b00d2f7-68d2228a5bdsi4319021a12.480.2024.05.27.00.47.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 00:47:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-190159-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=loongson.cn); spf=pass (google.com: domain of linux-kernel+bounces-190159-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-190159-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 37154B20AA6 for ; Mon, 27 May 2024 07:47:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D46243B298; Mon, 27 May 2024 07:46:55 +0000 (UTC) Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 582802207A; Mon, 27 May 2024 07:46:53 +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=1716796015; cv=none; b=RAKKG9aYdi2d00WREqXP4U4k4+qCGX15mixyCJy+CHgjei0Fa+/69I512Dy5zjRIqx/+4e+b+k3OsqFIR4+X45jkxI4HEcDyH1Pe3Ps65oOftCh9B59GjtqFlEP9q11GZ45FgnqJgqO2zpZJPoLf5HhhCx6oyWeLHLYKB19/qnU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716796015; c=relaxed/simple; bh=EBDVXOmgMgfl8zYiYQw+LxzSeEjy1MIY+uBc1KG6b70=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=kUIYoa0reDNOcUqLZSTX7DJDQFL9TjcnSLoP2CVcwjalg4e60woDVX7B/7Hn0FdJ190C2FX0sQTXyI6ZkWCdRATn9OqUKMlx6+7ie6NbB4oiIQtBo/0iuOuIyAkJQHfrnYu+gPYqZprZD/wfG4jyeGBh9FvwPaUWirudTbFF6KA= 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 _____8AxX+tmOlRmtB4AAA--.492S3; Mon, 27 May 2024 15:46:46 +0800 (CST) Received: from localhost.localdomain (unknown [10.2.5.213]) by localhost.localdomain (Coremail) with SMTP id AQAAf8AxTcdlOlRmHuIKAA--.28594S4; Mon, 27 May 2024 15:46:45 +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 v3 2/4] LoongArch: KVM: Add LBT feature detection with cpucfg Date: Mon, 27 May 2024 15:46:42 +0800 Message-Id: <20240527074644.836699-3-maobibo@loongson.cn> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240527074644.836699-1-maobibo@loongson.cn> References: <20240527074644.836699-1-maobibo@loongson.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID:AQAAf8AxTcdlOlRmHuIKAA--.28594S4 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 8f80d1a2dcbb..c32aff8e261e 100644 --- a/arch/loongarch/kvm/vcpu.c +++ b/arch/loongarch/kvm/vcpu.c @@ -537,6 +537,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: -- 2.39.3