From nobody Thu Dec 18 22:16:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 82448C83F0C for ; Sat, 26 Aug 2023 01:25:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231651AbjHZBYo (ORCPT ); Fri, 25 Aug 2023 21:24:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231644AbjHZBYP (ORCPT ); Fri, 25 Aug 2023 21:24:15 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A87A1E77 for ; Fri, 25 Aug 2023 18:24:12 -0700 (PDT) Received: from kwepemm600016.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4RXfDZ5JXJzVkJP; Sat, 26 Aug 2023 09:21:50 +0800 (CST) Received: from linux-hNCriV.Euler.HZ (10.175.124.27) by kwepemm600016.china.huawei.com (7.193.23.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Sat, 26 Aug 2023 09:24:09 +0800 From: Jiang Dongxu To: , CC: jiangdongxu , , , , Subject: [PATCH 1/2] vdpa: add log operations Date: Sat, 26 Aug 2023 09:23:31 +0800 Message-ID: <5b93796745b277ab8a8b8981ce04456763a9bcaa.1693012755.git.jiangdongxu1@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemm600016.china.huawei.com (7.193.23.20) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: jiangdongxu Several new interfaces are introduced to allow vdpa device logging guest memory during live migration and return to the VMM. The set_log_base interface is used to set the base address for buffer storing bitmaps. The set_log_size interface is used to set the size of buffer used for storing bitmaps. The log_sync interface is used to copy the bitmaps from kernel space to user space of VMM. These operations are optional. If they are not implemented, these operations will return EOPNOTSUPP. Signed-off-by: jiangdongxu --- include/linux/vdpa.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/linux/vdpa.h b/include/linux/vdpa.h index db1b0eaef4eb..985eed4f05b3 100644 --- a/include/linux/vdpa.h +++ b/include/linux/vdpa.h @@ -327,6 +327,15 @@ struct vdpa_map_file { * @unbind_mm: Unbind the device from the address space * bound using the bind_mm callback. (optional) * @vdev: vdpa device + * @set_log_base Set base address for logging. (optional) + * @vdev: vdpa device + * @base: base address + * @set_log_size Set buffer size for logging. (optional) + * @vdev: vdpa device + * @size: logging buffer size + * @log_sync Synchronize logging buffer from kernel space to + * user space. (optional) + * @vdev: vdpa device * @free: Free resources that belongs to vDPA (optional) * @vdev: vdpa device */ @@ -396,6 +405,11 @@ struct vdpa_config_ops { int (*bind_mm)(struct vdpa_device *vdev, struct mm_struct *mm); void (*unbind_mm)(struct vdpa_device *vdev); =20 + /* Log ops */ + int (*set_log_base)(struct vdpa_device *vdev, uint64_t base); + int (*set_log_size)(struct vdpa_device *vdev, uint64_t size); + int (*log_sync)(struct vdpa_device *vdev); + /* Free device resources */ void (*free)(struct vdpa_device *vdev); }; --=20 2.27.0