Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp2825115lqo; Mon, 20 May 2024 19:49:09 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVOIqZNRkENnGXgaXXMRRDyQgO8blKbf6lGgwKWclJEUDpyXkdI0VLM+kXWz7OcbvkZ9UMxk+8XlCalmiwfbuoJ74NYKYVHa/J3Qmm0Dg== X-Google-Smtp-Source: AGHT+IGKWN0+b7Aw1aSKALsoinzm3LRH7pz9bRlcCCMxH5ZDIYjRGicynC0D4UAElhqNyJP7SL3x X-Received: by 2002:a05:6808:2995:b0:3c9:713c:1269 with SMTP id 5614622812f47-3c9970bd1b5mr28172129b6e.38.1716259749605; Mon, 20 May 2024 19:49:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716259749; cv=pass; d=google.com; s=arc-20160816; b=wqgesFuJklJm3vEgRDB5T+gbtKNGzrwNd3io4n0Yl6kETVdCrKOXOkzmvSFJjZc65w bT2X8c6T05Q7Sf+WwIe7DO/4WAlYJcRhEao5f8v+IHWyL4ZpJX8Gz8pnkHfCuK+oXnbt UTF2V1przdecNchCmTa87Al1rab4OXYRllEBfgPC+kapehzTo6UBZOv6+ebCO7e+RhZ8 BFPCFOdmWfysrfI3YbnN+6l7yzmjokXWC+JVkk50VGSCVeA92/a6o3i3vrqcUAnchPFS /FFDzwGQiGgRekvF9CG+Q2acEl1La5n/UdgnpCTOh435IHHau9xc3ST42afKDKKAaCa4 1jDA== 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=1ptHRXcwwq3mQF0yoppZZKwBn2CsXIT/UZil15H+SXg=; fh=qdV62HKG2O0E2jvRwrIfwpeQ+X1zBkVKEmCAXswaWZQ=; b=n4emtuY9mq5QxgvdEoYhtktXGORUFnyHw/kE0dk6GNKkT0LMQRHgoJLlfsXQAAmrjB dGDakUD12b666v4pInS5kQu1bsete9hhl2hNJbD5Dk8mTD3SpXSyubncL7Co1FM89y1B B22YDY74FNFbnN9OnsBtlHiBjXQUSexbLOTV4zF8k37WpID/PrT1gn+C4853K6lZRCjf nU5bfanNZ/wM5MYUc0ZpnBVo/teuhJ/3L1nySF1CFnDikTy4LqsWzmvkjgt4X/33Yekh xvUuU77iXo4nHSbzKBAfc5iFcoliAas0ktIeHn7aaXhj1h6wTEtFaUW9xeOpjZSrwuiG Slcg==; 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-184388-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-184388-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d2e1a72fcca58-6f4d2a7236csi23682139b3a.73.2024.05.20.19.49.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 May 2024 19:49:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-184388-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=loongson.cn); spf=pass (google.com: domain of linux-kernel+bounces-184388-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-184388-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 21A84B2017A for ; Tue, 21 May 2024 02:46:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8FD1017758; Tue, 21 May 2024 02:46:10 +0000 (UTC) Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BF5252CAB; Tue, 21 May 2024 02:46:07 +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=1716259570; cv=none; b=AsIPZoCmxR+rVbSHIRt3v2FjrSilTnAjRMXp7nf3614CKs8OXRfVKRRWWY4ccWJR+42INhiriserHx7J+JbFz6b8cIgx9Q9zogP0dMeAt83ZOXqNvahvE7p5icH/+S2B06mjLn5sg1ZmD2fw2R/tgs/mrO7Y97FeJLV4Hp3hoac= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716259570; c=relaxed/simple; bh=YD4wh2WZRW/jyu8qIATM5gSWoF9yUhPX1JDPYJj10Aw=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=PonCRlqq1mEPwofHfuv3Ef9uR+/b+VFT4bqoPGuyX7KtMvRBV3QJGSkWHdKNhEJKv/sU9eULJUNCI13rb4OD5cUciW5Gu6RZ9PM0nL+Q0RTirkLL3K0SI0vCMxNChkM2JL787gEDgWMo1EcGPH8EdC2pnGPbYIXOGdrVwGq25bQ= 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 _____8DxPOvmCkxmbxoBAA--.2867S3; Tue, 21 May 2024 10:45:58 +0800 (CST) Received: from localhost.localdomain (unknown [10.2.5.213]) by localhost.localdomain (Coremail) with SMTP id AQAAf8BxHMfkCkxm764CAA--.9740S2; Tue, 21 May 2024 10:45:57 +0800 (CST) From: Bibo Mao To: Tianrui Zhao , Huacai Chen Cc: Juergen Gross , kvm@vger.kernel.org, loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, x86@kernel.org, virtualization@lists.linux.dev Subject: [PATCH v3 0/2] LoongArch: Add steal time support Date: Tue, 21 May 2024 10:45:54 +0800 Message-Id: <20240521024556.419436-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:AQAAf8BxHMfkCkxm764CAA--.9740S2 X-CM-SenderInfo: xpdruxter6z05rqj20fqof0/ X-Coremail-Antispam: 1Uk129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7KY7 ZEXasCq-sGcSsGvfJ3UbIjqfuFe4nvWSU5nxnvy29KBjDU0xBIdaVrnUUvcSsGvfC2Kfnx nUUI43ZEXa7xR_UUUUUUUUU== Para-virt feature steal time is added in both kvm and guest kernel side. It is silimar with other architectures, steal time structure comes from guest memory, also pseduo register is used to save/restore base address of steal time structure, so that vm migration is supported also. --- v2 ... v3: 1. Solve code confliction based on the kernel 6.9.0 2. Add kernel parameter no-steal-acc support on LoongArch with file Documentation/admin-guide/kernel-parameters.txt 3. Add strict checking with pv stealtimer gpa address in function kvm_save_notify() and kvm_loongarch_pvtime_set_attr() v1 ... v2: 1. Add PARAVIRT_TIME_ACCOUNTING kconfig option in file arch/loongarch/Kconfig 2. Function name change such as replace pv_register_steal_time with pv_enable_steal_time etc --- Bibo Mao (2): LoongArch: KVM: Add steal time support in kvm side LoongArch: Add steal time support in guest side .../admin-guide/kernel-parameters.txt | 2 +- arch/loongarch/Kconfig | 11 ++ arch/loongarch/include/asm/kvm_host.h | 7 + arch/loongarch/include/asm/kvm_para.h | 10 ++ arch/loongarch/include/asm/kvm_vcpu.h | 4 + arch/loongarch/include/asm/loongarch.h | 1 + arch/loongarch/include/asm/paravirt.h | 5 + arch/loongarch/include/uapi/asm/kvm.h | 4 + arch/loongarch/kernel/paravirt.c | 131 ++++++++++++++++++ arch/loongarch/kernel/time.c | 2 + arch/loongarch/kvm/exit.c | 38 ++++- arch/loongarch/kvm/vcpu.c | 124 +++++++++++++++++ 12 files changed, 336 insertions(+), 3 deletions(-) base-commit: 3c999d1ae3c75991902a1a7dad0cb62c2a3008b4 -- 2.39.3