Message ID | 20250117163001.2326672-10-tabba@google.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99114C02183 for <linux-mm@archiver.kernel.org>; Fri, 17 Jan 2025 16:30:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2EF6C6B009E; Fri, 17 Jan 2025 11:30:27 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 29D676B009F; Fri, 17 Jan 2025 11:30:27 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0C9B56B00A0; Fri, 17 Jan 2025 11:30:27 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id E05586B009E for <linux-mm@kvack.org>; Fri, 17 Jan 2025 11:30:26 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 962C51405D2 for <linux-mm@kvack.org>; Fri, 17 Jan 2025 16:30:26 +0000 (UTC) X-FDA: 83017481652.10.047E019 Received: from mail-wm1-f73.google.com (mail-wm1-f73.google.com [209.85.128.73]) by imf05.hostedemail.com (Postfix) with ESMTP id 6376F100017 for <linux-mm@kvack.org>; Fri, 17 Jan 2025 16:30:24 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=pYVqleML; spf=pass (imf05.hostedemail.com: domain of 3noWKZwUKCBcGxyyx3BB381.zB985AHK-997Ixz7.BE3@flex--tabba.bounces.google.com designates 209.85.128.73 as permitted sender) smtp.mailfrom=3noWKZwUKCBcGxyyx3BB381.zB985AHK-997Ixz7.BE3@flex--tabba.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1737131424; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=BW49JWG2Px+0iema5hxnfEbJmT8jYzYvP3ZBCGvznBQ=; b=5x+wJusWK5w3gF8h6087ErHfHzn0i1PQLyVMLhdf4q32KqFUyd1h5f7Gxey/kSRDR7oup+ ENC+NnSVp9BIXzSZawdOsOBXaj7D2ujHmFsGfkVoWo/A0dAaaFKG8oROG9vOPOEmhguYly h1AdcPSvvQ0m9p0euiDINhwRK5EokRc= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=pYVqleML; spf=pass (imf05.hostedemail.com: domain of 3noWKZwUKCBcGxyyx3BB381.zB985AHK-997Ixz7.BE3@flex--tabba.bounces.google.com designates 209.85.128.73 as permitted sender) smtp.mailfrom=3noWKZwUKCBcGxyyx3BB381.zB985AHK-997Ixz7.BE3@flex--tabba.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1737131424; a=rsa-sha256; cv=none; b=7m1fj43POSi/3eaRWYdcmH0VqoJbQ4Z4MhcfaD3/bdfpOAOUcgID93PP8Z5qCu9WSeOtYD /2rwu2Hoh7GkA0ZGF3imwruD9qFXyIGIgj+DGNm3imZkevxy+Npj8jTpPsx7cWt7BR2uaq MWSJVu9VixKBI1qXqtuJ9+WSZsNIwzs= Received: by mail-wm1-f73.google.com with SMTP id 5b1f17b1804b1-43619b135bcso11494575e9.1 for <linux-mm@kvack.org>; Fri, 17 Jan 2025 08:30:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1737131423; x=1737736223; darn=kvack.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=BW49JWG2Px+0iema5hxnfEbJmT8jYzYvP3ZBCGvznBQ=; b=pYVqleMLTQJvYsc2Fpltbbt/Y+P85ROTmJxQRKnNUbF5AbESJxDqkORnXBh4LPGK2q W97aejbKIg0mySwCE1pUSCGu36IQW+v4I3BQVVTumxI6Kace8aCEiJ+9W/M6pKuPG5X/ 9AbGRwHsNb83hx1Wom9AGlNBn57ce8WklLMMUEJlKBtpoNsK5c1ymL1/yesWoM1PGHUs IVwNscL0JzwjPsmklmZ0lovCIIVDulwYBy3Opqm0uC5iqWwJ6cU+bcoj90JJpRiF7+p0 sRJdGsDu34nWmS9/1BTsNyeeb8OXaPSRnZIJLrIaLGU4TzEKsPp6lXbKKXpQIUFABzRw zlUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737131423; x=1737736223; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=BW49JWG2Px+0iema5hxnfEbJmT8jYzYvP3ZBCGvznBQ=; b=lqcAx5cvon88PbrDxTpMBUwyH4V6b/HfFj/wS7U3NgqAVOjBU6F2DaiEA5zvHI+eXI GoJJVuKAWGrfj7e90QQBOv+a18RAAWFMFtjkcsquRPCgrcBBVReU/8g2Xrbjchhq1hRm QPygVac4f2po6vxXm9U4VRb3azUNl+GcFYG510Op6C1qdF+m8A6Drbx5l5wHS1eQmPPm JDRWbdrreZ6u6oLRNebiLvhP8MBfOE2r13qBhIZv+6y6yreRQYydw1FOQqT671KLxkBB pv1Q3LDiy45LoP39c3eX/y4tcPWWBqEyo1rMch636PySjMVyQgBL+LQsUDyJrxePHJej MPKA== X-Forwarded-Encrypted: i=1; AJvYcCW5jSM7o8bs8WM6qtv9/zTIItUUtGllDA2QKFiCofyki0UwSS/F0ZIubG3ACv7xRqH2o/zlIO4Img==@kvack.org X-Gm-Message-State: AOJu0Yyi51rvi53VM0TLnSQAEDDuCL0b4zWKyhJYDPMtKxWM1Kgdyrzv 27dIw4s1Uetv3ZquY/KwXwy66znP82hNv81D79stcrnQq0GYXNCkSd7DFQHN4G2OnLKQkG/9Tw= = X-Google-Smtp-Source: AGHT+IFy1wFm+ziznvd4kirGkUVDSDuqUcY6omN8qTjIUTRguG98z5VICWvWS3y2Y1jXpECmR3gNFjH8Yg== X-Received: from wmqe10.prod.google.com ([2002:a05:600c:4e4a:b0:434:a4bc:534f]) (user=tabba job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:1da8:b0:434:a711:ace4 with SMTP id 5b1f17b1804b1-4389eca3ca1mr12533835e9.17.1737131422953; Fri, 17 Jan 2025 08:30:22 -0800 (PST) Date: Fri, 17 Jan 2025 16:29:55 +0000 In-Reply-To: <20250117163001.2326672-1-tabba@google.com> Mime-Version: 1.0 References: <20250117163001.2326672-1-tabba@google.com> X-Mailer: git-send-email 2.48.0.rc2.279.g1de40edade-goog Message-ID: <20250117163001.2326672-10-tabba@google.com> Subject: [RFC PATCH v5 09/15] KVM: guest_memfd: Add KVM capability to check if guest_memfd is host mappable From: Fuad Tabba <tabba@google.com> To: kvm@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-mm@kvack.org Cc: pbonzini@redhat.com, chenhuacai@kernel.org, mpe@ellerman.id.au, anup@brainfault.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, seanjc@google.com, viro@zeniv.linux.org.uk, brauner@kernel.org, willy@infradead.org, akpm@linux-foundation.org, xiaoyao.li@intel.com, yilun.xu@intel.com, chao.p.peng@linux.intel.com, jarkko@kernel.org, amoorthy@google.com, dmatlack@google.com, yu.c.zhang@linux.intel.com, isaku.yamahata@intel.com, mic@digikod.net, vbabka@suse.cz, vannapurve@google.com, ackerleytng@google.com, mail@maciej.szmigiero.name, david@redhat.com, michael.roth@amd.com, wei.w.wang@intel.com, liam.merwick@oracle.com, isaku.yamahata@gmail.com, kirill.shutemov@linux.intel.com, suzuki.poulose@arm.com, steven.price@arm.com, quic_eberman@quicinc.com, quic_mnalajal@quicinc.com, quic_tsoni@quicinc.com, quic_svaddagi@quicinc.com, quic_cvanscha@quicinc.com, quic_pderrin@quicinc.com, quic_pheragu@quicinc.com, catalin.marinas@arm.com, james.morse@arm.com, yuzenghui@huawei.com, oliver.upton@linux.dev, maz@kernel.org, will@kernel.org, qperret@google.com, keirf@google.com, roypat@amazon.co.uk, shuah@kernel.org, hch@infradead.org, jgg@nvidia.com, rientjes@google.com, jhubbard@nvidia.com, fvdl@google.com, hughd@google.com, jthoughton@google.com, tabba@google.com Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 6376F100017 X-Stat-Signature: rjfudrq7fr8qeeyfkqbxx4uba7w9cugf X-Rspam-User: X-HE-Tag: 1737131424-153736 X-HE-Meta: U2FsdGVkX1+rbfGmiCmoL2xaSLWc5mOoX0zDpOEJYxFsourVSyagyZu8DkgePISjcDWfdc6YTT5SqFXx+epcrvMsCODvcwdooOSKQuA/WEzUZ6987NGJ6TUYAA+1o4Ltne7nz3rQvVN5Ke2CVveGe1fs0dTgpDdqPnxHsVca0oxpkvs1VPlP/QHLryR2h4JwvYsxW73jbEvzA0eHYYCHcjYt7GR0PExnzOVb2MgI/N6YrNwxPBSfpzquA7Rp2GyCwOoX6C9S4srMGKVI29IcUhhi8m3jMkbSv1L1Zmn3aUGJoRjPzW6hk2arjk3O4vSjDnmFNGMoFKJOP9prM6wPAdo6mH/HNyOn7nV7MLjXGRIGarGOLnTvE+07sL2J4vvrku1PtB7GwsQzGPONSfXmK3Jfmx7gP3NQzxgJHKeGGLJt2E9lZ+ymDI+2BqkqyUSzCFD8MGotGke7Zo0Zr3Zz6fgselGRuFfb2sLhrj39kdcCKGAO6Zr5Iryukk2yfAJVZCe18LxbpYf+vrOs45RivX513x4bhNtgFGs6hg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/0rxmpiCE9AhQBdUJrQdph6vw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
KVM: Restricted mapping of guest_memfd at the host and arm64 support
|
expand
|
diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h index 502ea63b5d2e..021f8ef9979b 100644 --- a/include/uapi/linux/kvm.h +++ b/include/uapi/linux/kvm.h @@ -933,6 +933,7 @@ struct kvm_enable_cap { #define KVM_CAP_PRE_FAULT_MEMORY 236 #define KVM_CAP_X86_APIC_BUS_CYCLES_NS 237 #define KVM_CAP_X86_GUEST_MODE 238 +#define KVM_CAP_GUEST_MEMFD_MAPPABLE 239 struct kvm_irq_routing_irqchip { __u32 irqchip; diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 53692feb6213..0d1c2e95e771 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -4979,6 +4979,10 @@ static int kvm_vm_ioctl_check_extension_generic(struct kvm *kvm, long arg) #ifdef CONFIG_KVM_PRIVATE_MEM case KVM_CAP_GUEST_MEMFD: return !kvm || kvm_arch_has_private_mem(kvm); +#endif +#ifdef CONFIG_KVM_GMEM_MAPPABLE + case KVM_CAP_GUEST_MEMFD_MAPPABLE: + return !kvm || kvm_arch_has_private_mem(kvm); #endif default: break;
Add the KVM capability KVM_CAP_GUEST_MEMFD_MAPPABLE, which is true if mapping guest memory is supported by the host. Signed-off-by: Fuad Tabba <tabba@google.com> --- include/uapi/linux/kvm.h | 1 + virt/kvm/kvm_main.c | 4 ++++ 2 files changed, 5 insertions(+)