From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4A782C433EF for ; Mon, 29 Nov 2021 03:45:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=HOVOedzimlz3ZDgaIy9+PE4zBPS3GF7K6YmZxB+3f1o=; b=SnbbWOlEHEP5j2 V82g45HS3oo/udpxixxpPYWhTO7rsO/ed/JT96OD0jw8X6KIj76NiNYtQ9UAqMSS0SqVl6yuoESHo JN4vHicNuRgdeGRTZRt++cybpNcedFXAFvC76dr88dUTsuw8IVbYmorBOygQU7GHvDGEgRx18q2le jb9cGavleUTgvvT9RJxhh3MAMjJvvLVxK2vuTgOFAez7Ym+xlJ88b8gM5RqdBGrnylrxJIc2PxCWu mMO58Pj3y5Un/cA663cFzDCcgEcRxdIw+LUqlgk6NerYWOrh9rJT2sLLCq5gsKN3RAi85ItLHeAm2 10KCh0Wrp7XjAKjd1A5g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mrXZz-00HD6q-SJ; Mon, 29 Nov 2021 03:43:48 +0000 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mrXZr-00HD3m-8h for linux-arm-kernel@lists.infradead.org; Mon, 29 Nov 2021 03:43:40 +0000 Received: by mail-pl1-x629.google.com with SMTP id u11so11068881plf.3 for ; Sun, 28 Nov 2021 19:43:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=g1AjNx0u4QsH0ydDfhoNnZaeQc7rEh0mvCty4L4f7eQ=; b=Wt8FaLZ08KUnARUpfZuFUX8/aWHCXUzDWW38X2tieklC/DI06HFADNTel2urdcLghd 6xuwD96bktbINCX1L48Tnqrgt/rnLZX0XjKzef2OqinmBYRmyB92QmVHjIXnsa4D3adc Ewoo7Xso2SY8bIPCIsveHyTJlUKvgLq1OWVdg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=g1AjNx0u4QsH0ydDfhoNnZaeQc7rEh0mvCty4L4f7eQ=; b=j/og29ox+yegGNjmsassioD55rc747esabOAcb9iwV9CHSLDv77UCnBW9lb3jDzjdq YOrNM6kuZ74HMm4jzicrYGksaIDMNsAmT/m6/pNcdPhzWy+2g8L+//6IjeOBsyHtdYM5 UD3L29mML/2pgOwG0M70HaVtuJvIchzsn2a9Wv4frkh/C/ZEj9/TU3LxY53bImpvKZ8i I6D90JIBSUd6bWVhO77duXg/iYpNejBBncpwlK18kXesXZRK3AINoyJa+VfCTLCUNj8L uTgb+Ly22+68ND1druc5hNWCxOe7nK7K8v4gz4bt6PUzHFn6vvJXQ9tuDXIdkYr+2ZgE 9Kmw== X-Gm-Message-State: AOAM5301sYc9hLs8LNJHIG/AzzsA6XR+1Tevon2MkCXeh1kzHS3mO9H5 RUXTbP8Fu7w9VV9GmTqhwD5Vog== X-Google-Smtp-Source: ABdhPJxLhGhNYMx62P8hwpiqGSK0LeOGFyNZHJnZlg3ztGeJOu1G+77rZi203d7zD5d/O00+rTeohw== X-Received: by 2002:a17:902:ee95:b0:141:f28f:7296 with SMTP id a21-20020a170902ee9500b00141f28f7296mr58161089pld.50.1638157417973; Sun, 28 Nov 2021 19:43:37 -0800 (PST) Received: from localhost ([2401:fa00:8f:203:72d1:80f6:e1c9:ed0a]) by smtp.gmail.com with UTF8SMTPSA id r14sm6895238pgj.64.2021.11.28.19.43.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 28 Nov 2021 19:43:37 -0800 (PST) From: David Stevens X-Google-Original-From: David Stevens To: Marc Zyngier , Paolo Bonzini Cc: James Morse , Alexandru Elisei , Suzuki K Poulose , Will Deacon , Sean Christopherson , Wanpeng Li , Jim Mattson , Joerg Roedel , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, David Stevens Subject: [PATCH v5 0/4] KVM: allow mapping non-refcounted pages Date: Mon, 29 Nov 2021 12:43:13 +0900 Message-Id: <20211129034317.2964790-1-stevensd@google.com> X-Mailer: git-send-email 2.34.0.rc2.393.gf8c9666880-goog MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211128_194339_369382_C2712F16 X-CRM114-Status: GOOD ( 17.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: David Stevens This patch series adds support for mapping non-refcount VM_IO and VM_PFNMAP memory into the guest. Currently, the gfn_to_pfn functions require being able to pin the target pfn, so they will fail if the pfn returned by follow_pte isn't a ref-counted page. However, the KVM secondary MMUs do not require that the pfn be pinned, since they are integrated with the mmu notifier API. This series adds a new set of gfn_to_pfn_page functions which parallel the gfn_to_pfn functions but do not pin the pfn. The new functions return the page from gup if it was present, so callers can use it and call put_page when done. The gfn_to_pfn functions should be depreciated, since as they are unsafe due to relying on trying to obtain a struct page from a pfn returned by follow_pte. I added new functions instead of simply adding another optional parameter to the existing functions to make it easier to track down users of the deprecated functions. This series updates x86 and arm64 secondary MMUs to the new API. v4 -> v5: - rebase on kvm next branch again v3 -> v4: - rebase on kvm next branch again - Add some more context to a comment in ensure_pfn_ref v2 -> v3: - rebase on kvm next branch v1 -> v2: - Introduce new gfn_to_pfn_page functions instead of modifying the behavior of existing gfn_to_pfn functions, to make the change less invasive. - Drop changes to mmu_audit.c - Include Nicholas Piggin's patch to avoid corrupting refcount in the follow_pte case, and use it in depreciated gfn_to_pfn functions. - Rebase on kvm/next David Stevens (4): KVM: mmu: introduce new gfn_to_pfn_page functions KVM: x86/mmu: use gfn_to_pfn_page KVM: arm64/mmu: use gfn_to_pfn_page KVM: mmu: remove over-aggressive warnings arch/arm64/kvm/mmu.c | 27 +++-- arch/x86/kvm/mmu.h | 1 + arch/x86/kvm/mmu/mmu.c | 25 ++--- arch/x86/kvm/mmu/paging_tmpl.h | 9 +- arch/x86/kvm/x86.c | 6 +- include/linux/kvm_host.h | 17 +++ virt/kvm/kvm_main.c | 198 ++++++++++++++++++++++++--------- 7 files changed, 202 insertions(+), 81 deletions(-) -- 2.34.0.rc2.393.gf8c9666880-goog _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel