Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp5419210pxb; Sun, 7 Nov 2021 11:53:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJxfldKOZTLR3NsV+/LulruA0lkZ1wLOslgTdTR9OPzaoAJ52ZJzx+y8ujh84hWo4a8NtTct X-Received: by 2002:a17:906:f856:: with SMTP id ks22mr35376470ejb.367.1636314796080; Sun, 07 Nov 2021 11:53:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636314796; cv=none; d=google.com; s=arc-20160816; b=XCxbPhZTJUs4lCdZceqKxkaYxiZhs1pCA/chqecUvULPF0j73Ulrefxzc221qajFjP xK0WwI6DshbCWtm4syOXfWmb0+VDGP/9GGzS8MtLpM8gT8vw6uA9Xm95++Y8Z+U4gbpC qdy7jG/0mZlYHmWuMxhq0/bQWqs70vr61a7MSNv1KhnU4MmzqZ5unle1sfaQwRVRuGf6 s7uhBBl7FPhHOKBwy0uJyDb5gm5gUT4D+RKuZDS6F5PtvZWc8RSXWkN82fg3bJrRUMx4 gVpJ7wWW5MJbnQYVVY3N/cv9vtpVpJvKAchAiEYf/dr/+h7TEN+7FtmFpHcjYTHflLi2 RuhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=zzQJmiRTdx02jbR4sgAIhITQl1CA9CEcXk+DbcZmUcg=; b=gvsVrNUfJxZxxw6Dz5JOc018HUIEpruTBCy0lDiAkzEW4C/C06+AeI5DgdwMXrGqNK WLvMQyjlYOcVdi2bIBYVVkTWyJQmGvmE4xEFoby/Fg/z/gvTO8XRNCtq08o8G2wb4yUU Pt7QnSA+ICOnhaNsZyn9th96umERCSNGkHrzSdK/ElskdP8kw3RfoPgyKgqhucpYeUt/ ciJJlAQhXQWlRvnY5B5r58YXW87UiBMZt2PYeOOHEVkXEyYxA04a8UIFjE6BAtSX+kfB aw+noyGJUyqCtKpmGOFF+AfEiUQ4X/KQdODTKBFtNC6wV6rFMCYo6A21uwg+iBVxhGGB RyXQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e20si22855056edv.195.2021.11.07.11.52.52; Sun, 07 Nov 2021 11:53:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235452AbhKGOMJ (ORCPT + 99 others); Sun, 7 Nov 2021 09:12:09 -0500 Received: from szxga02-in.huawei.com ([45.249.212.188]:26294 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230308AbhKGOMI (ORCPT ); Sun, 7 Nov 2021 09:12:08 -0500 Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4HnGFt69HRzQj7k; Sun, 7 Nov 2021 22:04:34 +0800 (CST) Received: from dggpeml100016.china.huawei.com (7.185.36.216) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Sun, 7 Nov 2021 22:09:22 +0800 Received: from DESKTOP-27KDQMV.china.huawei.com (10.174.148.223) by dggpeml100016.china.huawei.com (7.185.36.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Sun, 7 Nov 2021 22:09:21 +0800 From: "Longpeng(Mike)" To: , , CC: , , , , , , , , , Longpeng Subject: [PATCH v5 0/4] Merge contiguous physical memory regions Date: Sun, 7 Nov 2021 22:09:13 +0800 Message-ID: <20211107140918.2106-1-longpeng2@huawei.com> X-Mailer: git-send-email 2.25.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.174.148.223] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml100016.china.huawei.com (7.185.36.216) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Longpeng Hi guys, This patchset try to merge the contiguous physical memory regions when set user memory regions, you can see message in PATCH 1 for details. Please review when you free, thank! Changes v4 -> v5: Patch 1: - "Physical contiguous memory regions" -> "Contiguous physical memory regions." [Andra] - fix the warning of aligment that reported by the checkpath.pl [Andra] Patch 4: - fix the warning of aligment that reported by the checkpath.pl [Andra] - remove unnecessary comparison of NULL. [Andra] Changes v3 -> v4: Patch 1: - move "#include " according to the alphabetical order. [Andra] - rename several variables, parameters, structures and functions. [Andra] - add missing "Context" in the comments. [Andra] - some other changes to makes the code much neater. [Andra] Patch 2: - add missing "Context" in the comments. [Andra] - move the comment in ne_merge_phys_contig_memory_regions() before the "if (...)". [Andra] Patch 3: - Nitro enclaves -> Nitro Enclaves [Andra] - check the return code of "ne_misc_dev_test_init()" [Andra] - GPL-2.0-or-later -> GPL-2.0 [Andra] Patch 4: - "int expect_num" -> "unsigned long expect_num" [Andra] - rename several variables and structures [Andra] - invoke "kunit_kfree" to free the "regions" [Andra] Changes v2 -> v3: Patch 1: - update the commit title and commit message. [Andra] - use 'struct range' to instead of 'struct phys_mem_region'. [Andra, Greg KH] - add comments before the function definition. [Andra] - rename several variables, parameters and function. [Andra] Patch 2: - update the commit title and commit message. [Andra] - add comments before the function definition. [Andra] - remove 'inline' attribute of ne_sanity_check_phys_mem_region. [Andra] - leave a blank line before return. [Andra] - move sanity check in ne_merge_phys_contig_memory_regions to the beginning of the function. [Andra] - double sanity checking after the merge of physical contiguous memory regions has been completed. [Andra] Patch 3: - update the commit title and commit message. [Andra] - use "misc_dev"/"misc device"/"MISC_DEV" to be more specific. [Andra] Patch 4: - update the commit title and commit message. [Andra] - align the fileds in 'struct phys_regions_test'. [Andra] - rename 'phys_regions_testcases' to 'phys_regions_test_cases'. [Andra] - add comments before each test cases. [Andra] - initialize the variables in ne_misc_dev_test_merge_phys_contig_memory_regions. [Andra] Changes v1 -> v2: - update the commit message as Andra's suggestion [Andra] - remove TODO completely in ne_set_user_memory_region_ioctl [Andra] - extract the physical memory regions setup into individual function - add kunit tests [Andra] Longpeng (4): nitro_enclaves: Merge contiguous physical memory regions nitro_enclaves: Sanity check physical memory regions during merging nitro_enclaves: Add KUnit tests setup for the misc device functionality nitro_enclaves: Add KUnit tests for contiguous physical memory regions merging drivers/virt/nitro_enclaves/Kconfig | 9 ++ drivers/virt/nitro_enclaves/ne_misc_dev.c | 174 ++++++++++++++++++------- drivers/virt/nitro_enclaves/ne_misc_dev_test.c | 157 ++++++++++++++++++++++ 3 files changed, 296 insertions(+), 44 deletions(-) create mode 100644 drivers/virt/nitro_enclaves/ne_misc_dev_test.c -- 1.8.3.1