Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp738323lqp; Wed, 22 May 2024 20:11:28 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXjorSkakdlkAUMYARmm2Avshc4Jj2v+zFivNd5OXPJ+3MWG3s9QICjcEvidyR37dpRbhdJ8D1jJq9NpeyHgCX/itWYjqhgSkprHEpcWg== X-Google-Smtp-Source: AGHT+IGsohcRirMKgLmzrE4o/j0wsFxF48dzIgGkS2Z3equ8zX/me04LldQLOwczZRhE+bMkWOgy X-Received: by 2002:aca:913:0:b0:3c9:6e47:2edb with SMTP id 5614622812f47-3cdb67a632amr4414199b6e.34.1716433887849; Wed, 22 May 2024 20:11:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716433887; cv=pass; d=google.com; s=arc-20160816; b=JxlYy1vwXmWi7cQwps+/AqdAVoymNz+KkDWo1Xok+IzHxQ9nq7WLRmP33lGGMXBzac mFplto1M4ozMiXfWLXbNk886ZMo6nL4P49Ews3SpZI5OyC+7B2K9h8eTCOQywQ4LfC7n ty+vUAO4+lG3ctKdmiZ8icWdZyh2DU9dylZvwgAPhiNMd0Z28h1/aha1siLl0so22VVM qNeiMCKPbHvA4zWd6+5FFBPhvkxgqGhd+/eEmH4kSh7eOltcrXe8BGvoeckmOzobXWkF 0YoOkBgrMwhgWMm6OLn7vdG0Gl8LjdKajzCKuNae91T6rv/tfGfhq2MR4YBQj/3v8AyL 72IQ== 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=WyQtsu0VMHJTbkufM33JtyIMfZjVN/ir3KCt7s7A5Jl7xI5u18z5IgrvaGfEkC8qiq Y8VAFHe7Ibn/MRfG3mzOA6BivrPyCqQe2BAFhjv6BzSKk67TowqgOKS26eguYH71KQPy dWUpnyUQdd0k9wOj4tUeXkWFKxogSTAol81cGQl5fUqcemjcgVPvKLl6X4uRjfaan5iq apbrfyzS7kNBv1QLYt4ijV8Jh9TMED4ZkRT5ngXm+okiHnw3RjOqX3EEvuPxBtIRvWKg R8/wmIdz5fJJmrAzEq9AS9EHACsUMK4oPJEG9/1E2JBEpCZwdj/FFtbuzYde0rKh1y+V 7e1Q==; 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-186941-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-186941-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-792bf29728esi593646685a.190.2024.05.22.20.11.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 20:11:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-186941-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-186941-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-186941-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 8D03E1C211E6 for ; Thu, 23 May 2024 03:11:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 592A513B78F; Thu, 23 May 2024 03:10:35 +0000 (UTC) Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8155D13A879; Thu, 23 May 2024 03:10:32 +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=1716433834; cv=none; b=qaMggitN20Gy4m0qYB+vXk4CvlwCF8LV1c25xEZ4PTXDFCdnUaQxzz2ALwAKHAOH4YiS930DwtXaz3he2G9fQrCHYtb1AsvwQvmWV+RlxTJgA2HfUJ+5ZnqcQzQZtAPm350k8N2KGGsOu7ECN5sjzsftv1m9Ok4rOCvughVzENE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716433834; c=relaxed/simple; bh=EBDVXOmgMgfl8zYiYQw+LxzSeEjy1MIY+uBc1KG6b70=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=NA9BwWeXQRZMBAFKAXI/NrjDZaIqq7ZyRqLNIFrrFv+kvfzQfGu9LPoH2hJb6i+0Ig1ES7uicBlpz2fvX7ZeBVsm7e2R1PrnIA4VxDfiFI/+T7U9D+QWQck05q0KdOkI1jaczmqQUnfLc67XikwvvpHMYsU/XJpg54c/LaL/+L8= 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 _____8DxOOqgs05mWeQCAA--.2761S3; Thu, 23 May 2024 11:10:24 +0800 (CST) Received: from localhost.localdomain (unknown [10.2.5.213]) by localhost.localdomain (Coremail) with SMTP id AQAAf8DxNMWfs05mCEQGAA--.6973S4; Thu, 23 May 2024 11:10:23 +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 v2 2/4] LoongArch: KVM: Add LBT feature detection with cpucfg Date: Thu, 23 May 2024 11:10:21 +0800 Message-Id: <20240523031023.709347-3-maobibo@loongson.cn> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240523031023.709347-1-maobibo@loongson.cn> References: <20240523031023.709347-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:AQAAf8DxNMWfs05mCEQGAA--.6973S4 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