Message ID | 20230718234512.1690985-23-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 58CFAC001DC for <linux-mm@archiver.kernel.org>; Tue, 18 Jul 2023 23:49:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 25FC7280014; Tue, 18 Jul 2023 19:49:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2362E8D0012; Tue, 18 Jul 2023 19:49:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 10064280014; Tue, 18 Jul 2023 19:49:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id F19638D0012 for <linux-mm@kvack.org>; Tue, 18 Jul 2023 19:49:16 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id CC7371C8E75 for <linux-mm@kvack.org>; Tue, 18 Jul 2023 23:49:16 +0000 (UTC) X-FDA: 81026376312.28.B1DB8C9 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) by imf27.hostedemail.com (Postfix) with ESMTP id 041414000B for <linux-mm@kvack.org>; Tue, 18 Jul 2023 23:49:14 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=xEjga5Lw; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf27.hostedemail.com: domain of 3-iS3ZAYKCE07tp2yrv33v0t.r310x29C-11zAprz.36v@flex--seanjc.bounces.google.com designates 209.85.219.201 as permitted sender) smtp.mailfrom=3-iS3ZAYKCE07tp2yrv33v0t.r310x29C-11zAprz.36v@flex--seanjc.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689724155; 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=JHyOFUOJNrHCsG8hxo3NWWS2w8rJ24DtuKIoDCRGyag=; b=l7NWKQ64cfq4VsuYg6Y/DynO2k78JZdH7fg2rORtKRtk85glPg5409y2fWkyS87+qFk37O ype8buISjMikh5WanVRg0B8o5U+3AXnCeXo9nTSgLvOGvbgFnZ899SJf76LwU+0hPJxdhg FgSCa+6hwYjAQkORtc9Re8eYC4+IGfA= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=xEjga5Lw; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf27.hostedemail.com: domain of 3-iS3ZAYKCE07tp2yrv33v0t.r310x29C-11zAprz.36v@flex--seanjc.bounces.google.com designates 209.85.219.201 as permitted sender) smtp.mailfrom=3-iS3ZAYKCE07tp2yrv33v0t.r310x29C-11zAprz.36v@flex--seanjc.bounces.google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689724155; a=rsa-sha256; cv=none; b=dKsyt4xeYOZUrb3zT682kKkUqbYhKCkAw6xIl8n0q8jVY4H3Tx+CQcJl1Z6iyHmWC0w68r OoRM2yBhUJ1bQuUDmPPVf9LiqMSSwWFmLJpgVKbD+/+lO/7WOrN1i06FzWAv+4R7LkT0bv Opjz7wwAIutZWZF1O9T0CJrDT65yESI= Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-c64521ac8d6so5471096276.1 for <linux-mm@kvack.org>; Tue, 18 Jul 2023 16:49:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1689724154; x=1692316154; 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=JHyOFUOJNrHCsG8hxo3NWWS2w8rJ24DtuKIoDCRGyag=; b=xEjga5LwPPSSdY8SIx3jyoncD3GGf3WPGooyrkM0KnahhnaL4mCb4YwQt0GO0HS22c NEcfXNGBndDk4nsku/Y91YS1hHA5MX/cUUC80CuRLM1bK9lLy4VQpDRd1Xi2xWiJI6o1 9/UCIe7gQuFQ2+gvKJ9C6ii8/xbm2jFSze0SQ3v0PRjd1NOqJPDidQ7wUtuL19wRUrTE yGaIkqqRPEKiBe0hyG7ZRrXgE8SEXgjc2KYKv831pMLCu06jrX+LffHvzIu5EPSPB+OK JqyI7fhSc4r9xeqc00aXehzDSyLGCvqUsUwXUuUYEMMNJQvdcAepZR51lMeVVKDz3MhJ Gd2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689724154; x=1692316154; 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=JHyOFUOJNrHCsG8hxo3NWWS2w8rJ24DtuKIoDCRGyag=; b=j2ImxIFTdV3fEMW/CFaWNqYOQqBYIweu4ie/rovPD3iRZxJZyO+ZvQKM6HpSd4q67f 3rEHqeJM8pUlZlZjPkg+upfZjdtwotnB4ctGIRRFTaSR9lLXzbvqV2taK/AzJo3tus7i jmlUDNSaiDAeuBlsPqBYf2zq5ne4ZH/wQX4tZzMnrNVg/50xoTrpIeZ2VmA4LlyfPA+c EDbayWSaXBJInGg6znLbRDvwIYtD79XDxRPamVaIlRfnM7Z0uTdG7GYj1J42OmJMMHRp qtjM/+xif2b1tM6r+7TAWL3SzgNzVmvnyUEb+AjPxGInI+OXyCOyDh/5v/GgomnvCM5c x7YA== X-Gm-Message-State: ABy/qLYSwsIhizJlNAjDaKbcBrkOVS9+JmSN86+xt/+ShHTUrfMlAQV3 hQV6R8NMySsbvfTRN3pjIHQMdLtOMEU= X-Google-Smtp-Source: APBJJlG18o++4c+4o8gvKjis+x9wRH2pDI/AJGKQKbbl3lcmVj0vggAD6gv2GfLwBQuIOlyc9qDjI+M6sT4= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a25:a021:0:b0:cf2:9e82:a5b5 with SMTP id x30-20020a25a021000000b00cf29e82a5b5mr7746ybh.8.1689724154115; Tue, 18 Jul 2023 16:49:14 -0700 (PDT) Reply-To: Sean Christopherson <seanjc@google.com> Date: Tue, 18 Jul 2023 16:45:05 -0700 In-Reply-To: <20230718234512.1690985-1-seanjc@google.com> Mime-Version: 1.0 References: <20230718234512.1690985-1-seanjc@google.com> X-Mailer: git-send-email 2.41.0.255.g8b1d071c50-goog Message-ID: <20230718234512.1690985-23-seanjc@google.com> Subject: [RFC PATCH v11 22/29] 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>, "Matthew Wilcox (Oracle)" <willy@infradead.org>, Andrew Morton <akpm@linux-foundation.org>, Paul Moore <paul@paul-moore.com>, James Morris <jmorris@namei.org>, "Serge E. Hallyn" <serge@hallyn.com> 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-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, Chao Peng <chao.p.peng@linux.intel.com>, Fuad Tabba <tabba@google.com>, Jarkko Sakkinen <jarkko@kernel.org>, Yu Zhang <yu.c.zhang@linux.intel.com>, Vishal Annapurve <vannapurve@google.com>, Ackerley Tng <ackerleytng@google.com>, Maciej Szmigiero <mail@maciej.szmigiero.name>, Vlastimil Babka <vbabka@suse.cz>, 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: 041414000B X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: cpfb1ozfeomhwtms65dheirk1t8epgka X-HE-Tag: 1689724154-406404 X-HE-Meta: U2FsdGVkX1+0ZhbfyTnG6NLMX/FkU4W1EAMllQLIxU11r9YXgJWYzCnfvfxFoAWxF3aXjJiPe8mH7vINc1iLjQ8J10WpkI3GBV4yOcWpQ+yWsg/JVIzjO0BpjszYTELYFKmkCh2U1oq2bT1YTArQKgXz6PzUS370TXVWUBt6q+9bXngD20QMYaFCUqrC1CnBU2e6HFCm+RCIJRuszQoPfTMEenFrFnWqhytjztLpUR7Qyx3mI0ncYlrfWEUYKoyYfJL4lMjvQlT+Ucuu0G+taKezlNV7r95hduh/xp2qQWT8vtFATNEonwSH+gr2NGKy+UeTbAjWyhKfzB3Xyw/dS7vv7fzys3E4BHoVDNUVvpkOgDlrwNrHyL6RGniCK4dV9l9Y3OxF7EYIzkODHq+1XE7ehVSThm9BfFt/2cYBJSMSGQngtcZuagT9yGCmcnyWF8Ae7gXKV69E8SpyCDZaGfgtRhu7NkzvveBuSM+d/DlMv9iFs2ruTklLz8TShFnt2xQb68pkmo0fjN7vfELSoF+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8g4+ylgKhFsfhc8XwL4cWV0LT5xaM8ThO0YneXM2t9+2FvMHLppPdgmNkaZaxkLsahPOx9MbiAyVyAT6Mn+fQ5CQl4Ol3aOXKXiC3icEaMT9U1kER0PwLp8muaSoPY2fzKi6nPqMvZVkg5jNImnehHTkOAOaesmGsGqgXJ5xGut5QBGpj7KaD6UUMLE6MCVfocNAJGhDiGHsLCkShr4aAy4DpEZz5SBd9KCwV3XHtNYl3x 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> |
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 aa434c8f19c5..8857143d400a 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" @@ -1166,6 +1167,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_1(!ret, ret); +} + void __vm_xsave_require_permission(uint64_t xfeature, const char *name); #define vm_xsave_require_permission(xfeature) \