Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp1761228lqo; Sun, 12 May 2024 18:13:14 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVuHAWz0Xhu3npFVLU3iIIYD7WYT8TAEdddVdQ8bMmLcOhTIAdF6+j/K7wRf4QQzkhua5cpXpr4eZ+vmLfeMlzHftdGXG8Jyin0XF9XGQ== X-Google-Smtp-Source: AGHT+IFwmdedXkrd2/st/4RZu9KuPhDX6dfob64pAOY17FAwRPRlZszS0iiSSmov8dcA+LBDl1Qi X-Received: by 2002:a17:906:2846:b0:a59:a85d:31c6 with SMTP id a640c23a62f3a-a5a2d6736b4mr550626866b.66.1715562794300; Sun, 12 May 2024 18:13:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715562794; cv=pass; d=google.com; s=arc-20160816; b=BVff34wnXlqA0RU3Peyd1r21k8YdK1Xmsd49YKoyuuNBSXvzHbyKOycyHUYHsnHV9s KDQW4hE5VskMAabY0QOOpFpeJXBZLdPpLVOAL3RyogwbgaXdD9KMAZpOupMeSqjiCN7M zlPa0XOPmyZPYIWbxEldzzN9BZlFhPM96x7kncuk2iUBTWcLF2CtO9jukKUaSKBpJYwK 6+RbI0MA0SX0ivUVDbOhD2DeP318DExOCYL5sUeUwwJ4YsZvMQesq5DsuDmE1L1xfCsw v/QgFKXU7suyuN+SxHiga3zxXh6ZgR+nPConj6ve67j9yBvDZ27MQlI6GJVOZZtASQ9w LZdg== 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:message-id:date:subject:cc:to :from; bh=2rSWb1Pvss1YtPugZ3LIntW/erVupxkmdb5Zv3PAhS4=; fh=JOrDXAv7dX9lqUsWenmIinruxsV5NNS7FV+l4Q4onAY=; b=TLegLMZAgjQM7aaoQTroWlDCJy+6GmPL/gzkt8gj4E2i9Vr5P6/E7SSzWg8MAFfyEa Ue84jF5VPaTE4wTy9JhrjgO8VfktKKn3QpK9T0eQgddUKD89uJECdxVLTrEBjraCSJxF mOCtd1LcDRPgH+wqYTcayjlHRVTA8e9FuBzQfnJJItrjahAbqj5V4QOint4oQFuzJOeb 5uEvtqz2l7qr6BPey1fL4wxtE2qvo/U/bdevE830soPjzTcai9j+o1hXnyyQC+XIkycW EDs8VrgQaO6Wv+ZRvVGs8vyLbqmma2ie6qkP3Ycr0u1a/HL3Pf6ZaU0++Vye9uX0YswP qvMA==; 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-177074-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-177074-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a1b602bcbsi435249466b.489.2024.05.12.18.13.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 May 2024 18:13:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-177074-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=loongson.cn); spf=pass (google.com: domain of linux-kernel+bounces-177074-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-177074-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 am.mirrors.kernel.org (Postfix) with ESMTPS id D63D31F2121A for ; Mon, 13 May 2024 01:13:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6FDD012B7F; Mon, 13 May 2024 01:12:48 +0000 (UTC) Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1E365A935; Mon, 13 May 2024 01:12:43 +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=Vuwq8g1WxH7ym236Fg4N7d2KX+t+2EMx5mBdbTxCRSrZKUd0wjpwmQ2hxNlIDgLzVeDLi4SAtu/u3EZEWwpdwar6zePrrWxMXn+zfvZpjWrMkCVsWt+cHLSe+zEKZ8lQINPq6eJGnNnkY/7ljixcA6VGAhy57H6BeTMezI3WGJA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715562767; c=relaxed/simple; bh=3BUffUtk+rpz0Bi8pK17Oy853PU6iqE64lDci9jr/Hw=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=aV/nS5EZ9bX/jU/HADFKt4re7Iz8oCtn8D9Be5QIXpqZpy0ZP9xIbSaCradtEnXF9fBznQT8hMurn7bs16x8LWxGeyge31Ch+z5sYC9t1v9zI6TlArm79s3gKs0S2fPPp+zjntwkzSbOlIVvwWb+CTQFo9pafhQfwoLEZLtReBY= 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 _____8AxR_AEaUFmhP0LAA--.29633S3; Mon, 13 May 2024 09:12:36 +0800 (CST) Received: from localhost.localdomain (unknown [10.2.5.213]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Ax690DaUFmV1gcAA--.51334S2; Mon, 13 May 2024 09:12:35 +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 0/3] LoongArch: KVM: Add Binary Translation extension support Date: Mon, 13 May 2024 09:12:32 +0800 Message-Id: <20240513011235.3233776-1-maobibo@loongson.cn> X-Mailer: git-send-email 2.39.3 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--.51334S2 X-CM-SenderInfo: xpdruxter6z05rqj20fqof0/ X-Coremail-Antispam: 1Uk129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7KY7 ZEXasCq-sGcSsGvfJ3UbIjqfuFe4nvWSU5nxnvy29KBjDU0xBIdaVrnUUvcSsGvfC2Kfnx nUUI43ZEXa7xR_UUUUUUUUU== Loongson Binary Translation (LBT) is used to accelerate binary translation, which contains 4 scratch registers (scr0 to scr3), x86/ARM eflags (eflags) and x87 fpu stack pointer (ftop). Like FPU extension, here late enabling method is used for LBT. LBT context is saved/restored on vcpu context switch path. Also this patch set BT capability detection, and BT register get/set interface for userspace vmm, so that vm supports migration with BT extension. Bibo Mao (3): LoongArch: KVM: Add HW Binary Translation extension support LoongArch: KVM: Add LBT feature detection with cpucfg LoongArch: KVM: Add vm migration support for LBT feature arch/loongarch/include/asm/kvm_host.h | 8 ++ arch/loongarch/include/asm/kvm_vcpu.h | 10 ++ arch/loongarch/include/uapi/asm/kvm.h | 7 ++ arch/loongarch/kvm/exit.c | 9 ++ arch/loongarch/kvm/vcpu.c | 168 +++++++++++++++++++++++++- 5 files changed, 201 insertions(+), 1 deletion(-) base-commit: f4345f05c0dfc73c617e66f3b809edb8ddd41075 -- 2.39.3