Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7012404rdb; Wed, 3 Jan 2024 01:13:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IGkp/XsXfqKxshjP3gl0YcQt/kvse3OiDNBtbAO278mxAgA6oGznc+vVpSxAc5vLSmsFTYB X-Received: by 2002:a50:c291:0:b0:556:4d06:6b6b with SMTP id o17-20020a50c291000000b005564d066b6bmr2426501edf.30.1704273196442; Wed, 03 Jan 2024 01:13:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704273196; cv=none; d=google.com; s=arc-20160816; b=IwbilVX+x7JcppqX44w/jVCc0GffmzEZKMo5av4YRO59zIogiecRDN8BqJuavNZLW0 WYBgaox/qDzB+AG/8NmhN4zkkl43cJRdr8gbIo1fafGPbswbigedds5c/m9PlrpEsGut SB9ThW7TdHoz5SsTV240RrOWKgu1YUlrO5u/kNfWhcboc/foScqDPTyW3dez/814aACu r6dLZ36Di4dXZF80y4JI2r8A43O8MWOrhJfnQJd8LiCNUKPrwzePmQ23JM64RKCcba7A MG+VB5U1eOUxM2NjFNcVPyAUKZAnkOGCEk/MHrOQ1z+sMcEHOZQrSFGkrmijBUsFyuso k2MQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:message-id:date :subject:cc:to:from:dkim-signature; bh=PQ03vxn9DsVx+3hwFil7+V2M/O+QIG13nnHLdj3jUIU=; fh=Vx93WHraSNwAtImeuZXYuwSlSJ9uZLtDICdtmXdGBhg=; b=XcKMpF30B7DIxB7dEWExD/56zfvMDfvZ1VM7xJXoqfGvl44So6Y7mwl5PMMcRJjIai GP4bhK3+dmp0Q3n2Euz7b9TYdnl0stnrsmxn9pfk/AyLQc4iT5V/uLNck/Pz0j7Pc9jb RNEyGdyTq/VEsls2dBEJKERQB69nZ055ECNkuAmgN6Bjc52kaU1XSFPUGciIPDy+KEJX ZrX2yrr7voQww9n5zYJvZcBuKC8V5jZl5rv0LyYTIw5tOBStk08eOGH0QD5OdraPGNih tzlGCjC6bZZX6Xbb4lK5F3MfgMezhNxSD+dHmlZdhxTXfQ7VJxd2iCELcw1QCRX6IhNo o1Yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=RgmJcQaY; spf=pass (google.com: domain of linux-kernel+bounces-15308-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15308-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id z29-20020a50cd1d000000b0055482a62cb4si9829403edi.161.2024.01.03.01.13.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 01:13:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-15308-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; dkim=pass header.i=@intel.com header.s=Intel header.b=RgmJcQaY; spf=pass (google.com: domain of linux-kernel+bounces-15308-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15308-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 307371F223A0 for ; Wed, 3 Jan 2024 09:13:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D97FB18636; Wed, 3 Jan 2024 09:12:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="RgmJcQaY" X-Original-To: linux-kernel@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DCB0F182AF; Wed, 3 Jan 2024 09:12:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1704273168; x=1735809168; h=from:to:cc:subject:date:message-id; bh=gPf7rfKmzwzlXV8d5iHJVEkj1nA/mwcPl3PJ7L7K2SY=; b=RgmJcQaYTdhtkAMWmVasSkGa3nwp9fdwGMzftKwiXfqQFi4oCdQotMp/ 990xE/ePj+O2oY0hST05KlA+j6sRrzXS+hUNloz9YrdRFxCF2y/fbj3kr cCvfBGRv79raVpmfNNcvo0u3EJ67tCJ5E8MD+42iU11/yEDhrTEw6fE7B 35zjStJQgtwxjY00MRPDVVzyx8sEy5rc4wQ13aln8YDhUl/4/yaVKw1Nj NW6uafhp/pmwjK51rDMpMzayaSnGdfjNxRcpjf/yp/UCruEQth7BseTJX OkZuIQf5cwhV42Hlx0TIANcBG2vD3/GY1KHocJF/cd4HqCbvb7rKK7K11 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10941"; a="463386609" X-IronPort-AV: E=Sophos;i="6.04,327,1695711600"; d="scan'208";a="463386609" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jan 2024 01:12:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10941"; a="783445220" X-IronPort-AV: E=Sophos;i="6.04,327,1695711600"; d="scan'208";a="783445220" Received: from yzhao56-desk.sh.intel.com ([10.239.159.62]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jan 2024 01:12:45 -0800 From: Yan Zhao To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Cc: pbonzini@redhat.com, seanjc@google.com, shuah@kernel.org, stevensd@chromium.org, Yan Zhao Subject: [RFC PATCH v2 0/3] KVM: allow mapping of compound tail pages for IO or PFNMAP mapping Date: Wed, 3 Jan 2024 16:43:27 +0800 Message-Id: <20240103084327.19955-1-yan.y.zhao@intel.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: This is a v2 for previous series [1] to allow mapping for compound tail pages for IO or PFNMAP mapping. Compared to v1, this version provides selftest to check functionality in KVM to map memslots for MMIO BARs (VMAs with flag VM_IO | VM_PFNMAP), as requested by Sean in [1]. The selftest can also be used to test series "allow mapping non-refcounted pages" [2]. Tag RFC is added because a test driver is introduced in patch 2, which is new to KVM selftest, and test "set_memory_region_io" in patch 3 depends on that the test driver is compiled and loaded in kernel. Besides, patch 3 calls vm_set_user_memory_region() directly without modifying vm_mem_add(). So, this series is sent to ensure the main direction is right. Thanks Yan [1] https://lore.kernel.org/all/20230719083332.4584-1-yan.y.zhao@intel.com/ [2] https://lore.kernel.org/all/20230911021637.1941096-1-stevensd@google.com/ v2: added patch 2 and 3 to do selftest for patch 1 (Sean). Yan Zhao (3): KVM: allow mapping of compound tail pages for IO or PFNMAP mapping KVM: selftests: add selftest driver for KVM to test memory slots for MMIO BARs KVM: selftests: Add set_memory_region_io to test memslots for MMIO BARs lib/Kconfig.debug | 14 + lib/Makefile | 1 + lib/test_kvm_mock_device.c | 281 ++++++++++++++++++ lib/test_kvm_mock_device_uapi.h | 16 + tools/testing/selftests/kvm/Makefile | 1 + .../selftests/kvm/set_memory_region_io.c | 188 ++++++++++++ virt/kvm/kvm_main.c | 2 +- 7 files changed, 502 insertions(+), 1 deletion(-) create mode 100644 lib/test_kvm_mock_device.c create mode 100644 lib/test_kvm_mock_device_uapi.h create mode 100644 tools/testing/selftests/kvm/set_memory_region_io.c base-commit: 8ed26ab8d59111c2f7b86d200d1eb97d2a458fd1 -- 2.17.1