Message ID | 20241213164811.2006197-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 D21B6E77182 for <linux-mm@archiver.kernel.org>; Fri, 13 Dec 2024 16:48:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 74A026B00A9; Fri, 13 Dec 2024 11:48:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 720986B00AA; Fri, 13 Dec 2024 11:48:36 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5CE486B00AB; Fri, 13 Dec 2024 11:48:36 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 380E96B00A9 for <linux-mm@kvack.org>; Fri, 13 Dec 2024 11:48:36 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id ADD081C7885 for <linux-mm@kvack.org>; Fri, 13 Dec 2024 16:48:35 +0000 (UTC) X-FDA: 82890518844.18.E21F87C Received: from mail-wm1-f73.google.com (mail-wm1-f73.google.com [209.85.128.73]) by imf15.hostedemail.com (Postfix) with ESMTP id E797DA001B for <linux-mm@kvack.org>; Fri, 13 Dec 2024 16:48:01 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=GzvJBX5N; spf=pass (imf15.hostedemail.com: domain of 3YGVcZwUKCN0S9AA9FNNFKD.BNLKHMTW-LLJU9BJ.NQF@flex--tabba.bounces.google.com designates 209.85.128.73 as permitted sender) smtp.mailfrom=3YGVcZwUKCN0S9AA9FNNFKD.BNLKHMTW-LLJU9BJ.NQF@flex--tabba.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734108489; a=rsa-sha256; cv=none; b=TDnlzJulGIKNl7Tt9i1Sm4Bk4a/8qEex6r3C1AhG+pOadUlk9MjKk5rpzoN0osBgHvPSTX P0M37rmuEJpHMtcviPC+/jn0ZpRjhr2Z+kuo5aolgT8to/ZdUyYJFUs3MDZHeUQdMhfXMg acrrHOJnhoCHX2Q8ZsZb8VsRVhCoOvE= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=GzvJBX5N; spf=pass (imf15.hostedemail.com: domain of 3YGVcZwUKCN0S9AA9FNNFKD.BNLKHMTW-LLJU9BJ.NQF@flex--tabba.bounces.google.com designates 209.85.128.73 as permitted sender) smtp.mailfrom=3YGVcZwUKCN0S9AA9FNNFKD.BNLKHMTW-LLJU9BJ.NQF@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=1734108489; 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=ksEVsaSQioDaJqKOOzrRTGd2BPTgCKjKlBLY+w56wZo=; b=VcogB4G+z787bjb6h+7rbhEQO2as3oXc2RMyHNmidBLJlKeNOHJqev7jNg83zrmRUVX+e+ dPNsBQLPhDKlpdChiX8SIySRFmUeHnqK64k19XSuVCV+ITHvxgAZHOit0xfJZwMc7N904J mQq3kxKoYG7W0TUAWmkIFGm6y3Ypk3s= Received: by mail-wm1-f73.google.com with SMTP id 5b1f17b1804b1-436289a570eso12992485e9.0 for <linux-mm@kvack.org>; Fri, 13 Dec 2024 08:48:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1734108512; x=1734713312; 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=ksEVsaSQioDaJqKOOzrRTGd2BPTgCKjKlBLY+w56wZo=; b=GzvJBX5NYySd/v/I+dJHZJcX4loTjNyCBiNelyUB5P6ocYlhDs7aqAUBWPOyrorEz6 G5HzIhSPHvNmuKUsG2SIQkUrTqI/V5SXYqaqORWBuAfsppqi2d0hx0XzL8s6IB/wQS9r YUsoxb7tKu6sMgV6Rq9vx6ipHHQkgEx/1tAIf9qJO9/wi/KKIwwqlodAG48dO6wT/sKK fGOpjmNS1Zu8G8pDGB6F9O9/HcpghduPkQ46QktjxXzrLGpsm7wEINWq3Y05EU3BvKD1 8hgUbFNG/5MyAbCc/+X5r5BcnmYJFkZHIjX7KsBq5fuMlIUxqgje5XGT3zlcoil5aAKC RXeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734108512; x=1734713312; 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=ksEVsaSQioDaJqKOOzrRTGd2BPTgCKjKlBLY+w56wZo=; b=o525SQHl3wJoUCvEgJFDFqmvBs0UPTXYcRUqS52btSqmm+Jp3Dl8y9VeMjaYReXgEY cB0VB5b6NKiPAUZA7d8Jj1XlhbDti0+a3Tp0utjEezz3vho+qFC715FgCEJKeXrfY0K1 P+DdowOuI217FJUHRQIU1jENndPCVOIv6m0j4WzOzkCVgM2hjpOP+3Tz85bc392eEVgQ f2EX18HYBdlU/S0qui6at3Rl5Vqw7r8GJcUb9J9Lba9SRWzlZYGoV37kUom2BYewn3nF GkTXVa9+ir8PCFBXLYlqSa0V/YjZja1N8goMS3TRM8TrWYkJsCZtFDhCEwlbbX0qeTff KVPQ== X-Forwarded-Encrypted: i=1; AJvYcCWJ/xYR3PLTb0tehQgndxIlsLio/HQ5PbHKamrYanOzyfNOlOVqLQEPX4VoC7OmWPddWsueC1efWQ==@kvack.org X-Gm-Message-State: AOJu0YyxgCtJIZcP1itcEMkcXUjelLL7VJ3OIpV6NN2j0quD7OIX4VRD SA3w9UqjxyfRhNZcFGAOqWojUpEFzQbgFJ27jWBF+5Fv7B+KaJUxux3ZVMy3sTvSzwSqGtFzLQ= = X-Google-Smtp-Source: AGHT+IEt4pXQrhABH8gera5DOjDskLThzt7L9I5lJj6Vxwq11yPrteBm6Llct58hlLMQdsD4E964MjHJuQ== X-Received: from wmbg15.prod.google.com ([2002:a05:600c:a40f:b0:436:1534:b059]) (user=tabba job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:6549:b0:434:f0df:9fd with SMTP id 5b1f17b1804b1-4362aa1b061mr38281225e9.2.1734108512506; Fri, 13 Dec 2024 08:48:32 -0800 (PST) Date: Fri, 13 Dec 2024 16:48:05 +0000 In-Reply-To: <20241213164811.2006197-1-tabba@google.com> Mime-Version: 1.0 References: <20241213164811.2006197-1-tabba@google.com> X-Mailer: git-send-email 2.47.1.613.gc27f4b7a9f-goog Message-ID: <20241213164811.2006197-10-tabba@google.com> Subject: [RFC PATCH v4 09/14] 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-Queue-Id: E797DA001B X-Stat-Signature: ge8h7kq4muqr5tygrq95egyqd11yuqtr X-Rspam-User: X-Rspamd-Server: rspam09 X-HE-Tag: 1734108481-778455 X-HE-Meta: U2FsdGVkX1963etl1MZRQSETMs8t/n1zmeZuvhrWA8SuAm1Df2/mlSok13DobWTzECHa8JaWzVJ9iXX8g9Fi9UV5YhSs6stO3uAGYrTrveh4pFZpXigh2S9xeQ4QsGz3HT3+KBLCpX9zyWaGZiQZzcRea5utymsz7iysVCpjv+8L2DjJQ13393Vcty2re2vQfPZVe7gB0Y/Q2Fz5IDVUVE3PoUg0aj1eBzPCrd6/JAqbmLhaG+DzCUYKAUPO05C+RsZGJIB5CdSresjZF90fGgYD6XVhC/tA0ofRrnIeHkaLRLlLGJcdhNefTXEUr4YGNrTtI6eVjqhv8gYJl7bZYEJsX14fQxUMWJHECBzAg8/Q7vptT3G3HI0zQ80yIAIOifEFZFiuwVFSXjuC/JIKgyjtnwXU+A0h0sQLWYDSxt6pjNV8CvRLNs/yEluMw1L2b9OB63x0RgjUaza4mKOHxfdKhORoU9il814Qu7Di/25KyxJgWWismTRJkxNBsvLy6ZBfM1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XEYk57BQjFgiEk4impN65RVF9n3pU+Hd59Zao/ffvXDjpT2OhiRJtbtmrltKHgRw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.010378, 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(+)