Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp1761146lqo; Sun, 12 May 2024 18:12:56 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW2ITsY7hRqgEEC490sjoY2tkL//yc7K2d6SXl9n9gohGf3hXkZd7lfAf/kJ1C5R8c+qNIX66zO+e5k8LyzKBjotN5jf9RqgZVwMkSqzg== X-Google-Smtp-Source: AGHT+IG2MnwFWX1YkBZSG8otkcLSFHeRCyCSjZThH5dSnuP0Q9E2BIX8BDZ+XvBYcMqx0Drl4L0T X-Received: by 2002:a05:620a:1a99:b0:792:bf2f:8b2f with SMTP id af79cd13be357-792c7577a13mr1166298185a.2.1715562776248; Sun, 12 May 2024 18:12:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715562776; cv=pass; d=google.com; s=arc-20160816; b=ko7lTcwKlgnta4aXoU5fWTxmdOZdJ0InHEtv47yVOP0xZydZXujTMP6A3e/iC1ttD0 SdfGmb+IKtJpfic0WUW7jQlWc7hK0H7O6sm5p9mrYElpw4BPU+s419BnALhjI/A4NM+8 XL8R5EneBiiJkV6QZ5Ayq2fZHsKc2/Nu5yAWQJpxeqwI9zltej25RuKA6kcuC/4o/wUY 1A5qpJmngpHyiU8E/DoMEK47fpxaiiiTyCweezzwm7KRrpaX6IPd9rw8HDJLOcuuE6Re C/xwPPM5hLiJ0zn8dTK7a/l+m2Vmy4A6KnLXegmggfliuGyIqS5nKx9fFw5pue/nD2iB YK2w== 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=039VcnxEZITkBMvTeJMd9L0nSCBIz7Cn7/SORN+wlJI=; fh=JOrDXAv7dX9lqUsWenmIinruxsV5NNS7FV+l4Q4onAY=; b=sZRaK6U4ruws+xXim7//+ALsCgsd61RbNO7+LmUQGnLGDzAc59mOWOnK94mJq/Yy/Z 9EVwWymDI8bpJLPkDvleB+gKCIp5nyrwBxdxa937cjgFwiXs//oAIKSVW0H9hx//NOIX HCTBaBMxhCPpT8sxtIWBaCHhs8zk5voDaRfJexnaMI/tXEX2UIyyfV1o/8qHMHSWKAN5 xkdVsb36d+SABbBjZXlZJ6m1bKr8ox1vhhuqdK5W6hcIMqJu0hRLzW2Ku0PHPYWJ53FP f6VgC0OZR2Me6a5QlSvJ+sY+ZH96VFrwfo+GGqizuvmo9VhzzsBeos+C3e0k1ePY0PdR 9nxw==; 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-177072-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-177072-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-792bf2971b9si842379585a.160.2024.05.12.18.12.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 May 2024 18:12:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-177072-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=loongson.cn); spf=pass (google.com: domain of linux-kernel+bounces-177072-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-177072-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id F1CFA1C20D93 for ; Mon, 13 May 2024 01:12:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C0471DF5B; Mon, 13 May 2024 01:12:47 +0000 (UTC) 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: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: -- 2.39.3