Message ID | 20231027182217.3615211-29-seanjc@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 A8ABEC25B47 for <linux-mm@archiver.kernel.org>; Fri, 27 Oct 2023 18:23:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2EBA080023; Fri, 27 Oct 2023 14:23:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 250DC80018; Fri, 27 Oct 2023 14:23:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0795980023; Fri, 27 Oct 2023 14:23:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id E0B0280018 for <linux-mm@kvack.org>; Fri, 27 Oct 2023 14:23:23 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id BA3DCC0429 for <linux-mm@kvack.org>; Fri, 27 Oct 2023 18:23:23 +0000 (UTC) X-FDA: 81392063886.25.43D0308 Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) by imf12.hostedemail.com (Postfix) with ESMTP id E2BB64001D for <linux-mm@kvack.org>; Fri, 27 Oct 2023 18:23:21 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=LgEqtRhf; spf=pass (imf12.hostedemail.com: domain of 3GQA8ZQYKCDooaWjfYckkcha.Ykihejqt-iigrWYg.knc@flex--seanjc.bounces.google.com designates 209.85.128.202 as permitted sender) smtp.mailfrom=3GQA8ZQYKCDooaWjfYckkcha.Ykihejqt-iigrWYg.knc@flex--seanjc.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=1698431001; h=from:from:sender:reply-to: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=Xz8kt0PqFUxEdWsVGTpKhvh/0bAOqOlDGpUeOhSMn4Y=; b=2dli0WSbw3Ki6j+qe2tT4SujtWczRu+NtymM3uFADrnKok1zAiuLNLAh7ouzyoES5D6zGD 8kALH+XHCp8bWjwoRe36d+GNZK5ACsB+zIBeGtIhjXE2tiHCxmqBUFQjzLMK68/W80hfQk z5LmTzrp6Zsk7ECkJm48mztFhivbdo8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1698431001; a=rsa-sha256; cv=none; b=lJ8WYkV/29CkZkJ7Fm21rBof9oesY6ZfA3FvVoYNjJg4iUhkLBMqisslqg0RJlaQEyzrPG hAqU+D7vh8eVFKUecRilRGua4GKqPmsMr2tTxyfxlkOFWsr/Q8AkDFK51rsnAWiUvlNe44 jm/idadopSrXGhO+dJOYWkS8t+R0euw= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=LgEqtRhf; spf=pass (imf12.hostedemail.com: domain of 3GQA8ZQYKCDooaWjfYckkcha.Ykihejqt-iigrWYg.knc@flex--seanjc.bounces.google.com designates 209.85.128.202 as permitted sender) smtp.mailfrom=3GQA8ZQYKCDooaWjfYckkcha.Ykihejqt-iigrWYg.knc@flex--seanjc.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-5afe220cadeso6523367b3.3 for <linux-mm@kvack.org>; Fri, 27 Oct 2023 11:23:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1698431001; x=1699035801; darn=kvack.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=Xz8kt0PqFUxEdWsVGTpKhvh/0bAOqOlDGpUeOhSMn4Y=; b=LgEqtRhfFh2v8AezhEyjkB34j8mVVLpr2M7g1DxLSSfZ7fskSvzy7Ekb1s3yO4/SEz NoQi+TO0fJddYitlVLx5Ol3Xb7nSa93TbF+iUG3GJc+fFDCVW/RANI1uQzKy4ax7T4FQ B5JFQV+kG+40s9/VR3Q/aU8i0MQuZYb5mx9CSOE5qRmMMlD6ppvBAmqG+v9nK25Fn76C 63yZnTwfLsRdJd0HrHVEWqSADuxOftrcpS9s0HqAzts21RRa8wzi7g773uB/YfjnuZea ti4dmFnwBYUEvzmVG0FvedoWR66UEhU1H4mnZnU1oAFEPG7tszDDMbFxANTsElTxYOPC nPhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698431001; x=1699035801; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Xz8kt0PqFUxEdWsVGTpKhvh/0bAOqOlDGpUeOhSMn4Y=; b=lY6vpq1M7LZqDW4ZBZKNaGAziATrUcExIXP57q5PH6LasXq5Oy7aaKlQ4iuSVV69Nb RH5nv8eiw8sH/9cIw0h6BaiW8ovy02mEMZYmgAVMRSqG0vXq+gTGEQ552WrBGna1Lrro tp5Dr3QMPP/b1DcvrKQ6chRZirjNn9AOTT1XQB1TSEaOqPoLP9ShY8+al9yv+my1cOQM BTVEX8IwjcnJ+W/Ky1R6YjnmTW5aspkEddkDi1kV2t62i86LPXfa0CwJnXqtvBMFv/mM 7qVuyv+01g2jiQEeuXPQzq/uxjonzLxZekk0YLgBdZvhfaoVJgGEXLRGX0j9T0qxCiqZ IYEw== X-Gm-Message-State: AOJu0YzTJ5pLrul6CL53DX1YHDTJAJgymeEjM4fh7Ov7l4WyLkKftL5x c+ahZlAKj/1jAHz/oeKePp45NMy2cMw= X-Google-Smtp-Source: AGHT+IElp9q5EmMXm2ScJmYLrQOoQHqoyljn7k2kapIAuiZd/nyrTEs2J8MXUI1aCi13+9HebXd80A1xuUo= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a0d:e653:0:b0:5a7:be10:461d with SMTP id p80-20020a0de653000000b005a7be10461dmr68754ywe.2.1698431001067; Fri, 27 Oct 2023 11:23:21 -0700 (PDT) Reply-To: Sean Christopherson <seanjc@google.com> Date: Fri, 27 Oct 2023 11:22:10 -0700 In-Reply-To: <20231027182217.3615211-1-seanjc@google.com> Mime-Version: 1.0 References: <20231027182217.3615211-1-seanjc@google.com> X-Mailer: git-send-email 2.42.0.820.g83a721a137-goog Message-ID: <20231027182217.3615211-29-seanjc@google.com> Subject: [PATCH v13 28/35] KVM: selftests: Add helpers to do KVM_HC_MAP_GPA_RANGE hypercalls (x86) From: Sean Christopherson <seanjc@google.com> To: Paolo Bonzini <pbonzini@redhat.com>, Marc Zyngier <maz@kernel.org>, Oliver Upton <oliver.upton@linux.dev>, Huacai Chen <chenhuacai@kernel.org>, Michael Ellerman <mpe@ellerman.id.au>, Anup Patel <anup@brainfault.org>, Paul Walmsley <paul.walmsley@sifive.com>, Palmer Dabbelt <palmer@dabbelt.com>, Albert Ou <aou@eecs.berkeley.edu>, Sean Christopherson <seanjc@google.com>, Alexander Viro <viro@zeniv.linux.org.uk>, Christian Brauner <brauner@kernel.org>, "Matthew Wilcox (Oracle)" <willy@infradead.org>, Andrew Morton <akpm@linux-foundation.org> Cc: kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Xiaoyao Li <xiaoyao.li@intel.com>, Xu Yilun <yilun.xu@intel.com>, Chao Peng <chao.p.peng@linux.intel.com>, Fuad Tabba <tabba@google.com>, Jarkko Sakkinen <jarkko@kernel.org>, Anish Moorthy <amoorthy@google.com>, David Matlack <dmatlack@google.com>, Yu Zhang <yu.c.zhang@linux.intel.com>, Isaku Yamahata <isaku.yamahata@intel.com>, " =?utf-8?q?Micka=C3=ABl_Sala?= =?utf-8?q?=C3=BCn?= " <mic@digikod.net>, Vlastimil Babka <vbabka@suse.cz>, Vishal Annapurve <vannapurve@google.com>, Ackerley Tng <ackerleytng@google.com>, Maciej Szmigiero <mail@maciej.szmigiero.name>, David Hildenbrand <david@redhat.com>, Quentin Perret <qperret@google.com>, Michael Roth <michael.roth@amd.com>, Wang <wei.w.wang@intel.com>, Liam Merwick <liam.merwick@oracle.com>, Isaku Yamahata <isaku.yamahata@gmail.com>, "Kirill A . Shutemov" <kirill.shutemov@linux.intel.com> Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: E2BB64001D X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: nmcgbii85x5dfwzqxfdxfqq7t5bpum5h X-HE-Tag: 1698431001-600096 X-HE-Meta: U2FsdGVkX18OcrEZ+K33yZgMXnUaCKs3yY9z0nIx25O8qJyeJHrbrUGlYfBghjQXmWEX7ibFmI/jLmxt/TvaokI2kabH68l28R1N6Ex4uUSUU8DVR01hTQYL2s4YGDlYkQsaWiQ9Ry+6QNxXtKDUCe6f4I34c7vAx8DSWX73VdN2JMuDD4YSWlWFI1umcxQPUk4ydIMmizcyyh6WbH82gn223NTk0PjL9GaUBkBwWAEK+4iqd0wsWTa2x1WnRNYp8Behwu9hy4hBbx04QGq/O+jC0ydgJqybsQGIVPpMUm6NloN+7pRzzq90Se7fnn6aBlJylgfTJvvvQvq5YPakq7lUUhZ4gexVb0EjPpd7VtzibAd+Dxjwp4OM99OfO3KPg2g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HhsQv2QHyG/nQt1ZCH/mmNCQJnFU8gJwT/5XWdM5can7mPUavoRmGIwwzUfWeCL5tUoH4b0Qed6FROEFbhRbpU8PvlgLFFqa3Is6sDQfzfeg4y+4jLOZs87YJKR+qxU+YGawyoBsO7I0luWIHbiojF2j41jQhV6nBMGxD6u9hIv1nBHyBgt5YtV8by1ghMSAamf8OehGvXKQY8HsVRmdBj0FZFOuh6OIQhqXPgXwPS2scMefcQOrxUmX9CbCTOj6fxK/5Y5GuOrjC7Y26ufcDRTJcOWISzlwwqcH2D7jc6xkopUnAAqkgDwUpx2juAmTYY/DVY5WegwAR/63Nue+mIAdbdjEwOQwlfCKf2y/PLndSfLh+BYv/Xiw+ZHByl88B 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: guest_memfd() and per-page attributes
|
expand
|
diff --git a/tools/testing/selftests/kvm/include/x86_64/processor.h b/tools/testing/selftests/kvm/include/x86_64/processor.h index 25bc61dac5fb..a84863503fcb 100644 --- a/tools/testing/selftests/kvm/include/x86_64/processor.h +++ b/tools/testing/selftests/kvm/include/x86_64/processor.h @@ -15,6 +15,7 @@ #include <asm/msr-index.h> #include <asm/prctl.h> +#include <linux/kvm_para.h> #include <linux/stringify.h> #include "../kvm_util.h" @@ -1194,6 +1195,20 @@ uint64_t kvm_hypercall(uint64_t nr, uint64_t a0, uint64_t a1, uint64_t a2, uint64_t __xen_hypercall(uint64_t nr, uint64_t a0, void *a1); void xen_hypercall(uint64_t nr, uint64_t a0, void *a1); +static inline uint64_t __kvm_hypercall_map_gpa_range(uint64_t gpa, + uint64_t size, uint64_t flags) +{ + return kvm_hypercall(KVM_HC_MAP_GPA_RANGE, gpa, size >> PAGE_SHIFT, flags, 0); +} + +static inline void kvm_hypercall_map_gpa_range(uint64_t gpa, uint64_t size, + uint64_t flags) +{ + uint64_t ret = __kvm_hypercall_map_gpa_range(gpa, size, flags); + + GUEST_ASSERT(!ret); +} + void __vm_xsave_require_permission(uint64_t xfeature, const char *name); #define vm_xsave_require_permission(xfeature) \