Message ID | 20230914015531.1419405-27-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 4FC7BEE0219 for <linux-mm@archiver.kernel.org>; Thu, 14 Sep 2023 01:56:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3D1A18D0009; Wed, 13 Sep 2023 21:56:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3826F8D0001; Wed, 13 Sep 2023 21:56:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1AA9C8D0009; Wed, 13 Sep 2023 21:56:31 -0400 (EDT) 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 0719A8D0001 for <linux-mm@kvack.org>; Wed, 13 Sep 2023 21:56:31 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id D72ED80ED4 for <linux-mm@kvack.org>; Thu, 14 Sep 2023 01:56:30 +0000 (UTC) X-FDA: 81233538540.01.CD77419 Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) by imf05.hostedemail.com (Postfix) with ESMTP id 1846E100011 for <linux-mm@kvack.org>; Thu, 14 Sep 2023 01:56:28 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b="Yv/9OMEL"; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf05.hostedemail.com: domain of 3TGgCZQYKCFUF1xA6z3BB381.zB985AHK-997Ixz7.BE3@flex--seanjc.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=3TGgCZQYKCFUF1xA6z3BB381.zB985AHK-997Ixz7.BE3@flex--seanjc.bounces.google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1694656589; a=rsa-sha256; cv=none; b=mMt7Gv+b0kzNfd8H6WN4elA/mCBf36y3tV0TSEzp95BlJCEXvOR1qxpKkHn0CFuAf9RmPf ceNhnwO7AQfd+W7ea1RCsDXvsjOY9r/XtalT4Hd3yrfO+Lk9I6FkSK2I+exy9yzLeXGp7u av+DRjCeM9BOUhNBI/RxPgC1GjeOmsw= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b="Yv/9OMEL"; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf05.hostedemail.com: domain of 3TGgCZQYKCFUF1xA6z3BB381.zB985AHK-997Ixz7.BE3@flex--seanjc.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=3TGgCZQYKCFUF1xA6z3BB381.zB985AHK-997Ixz7.BE3@flex--seanjc.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1694656589; 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=UjBddbZXLqwDqs/dRSKLKY4HwUhf6Ai3WxLtYL+KxyQ=; b=TstT270K/VRbTxnWzxf7Y+uSClzvVNSIcAv4aqcs6kiGhipJMUikPYcbqpTLPc3IWQtrEl sZJ1nT5l2ZnAWsxSbpFv1zszGdw47LzRpYeNGQqnlgomppi3FdNpOl0QPi3VRqPkayEMMB V+ydlNWcZdfQk0HFdUc6M4Z1D6x10Ls= Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-594e1154756so6572687b3.2 for <linux-mm@kvack.org>; Wed, 13 Sep 2023 18:56:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1694656588; x=1695261388; 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=UjBddbZXLqwDqs/dRSKLKY4HwUhf6Ai3WxLtYL+KxyQ=; b=Yv/9OMELYO2oatGSAK9VA6gJW2WeBOSQEC1maVexDT1vwiBiAIXS6L59vmsjBVwc2/ Q5e/ho0lWMvl335nV0i0r0Kgm9O3005kb2kHM6ETKsEpwL8bWcrtAtQ2o4r15ey++JPx CvclDNMxoVFBxqLWHBWd8ZdSdkFlPBtS46N6HSRBZwzwoS+nVB0DD8q08V2raPUDOxYo 8j7NvcfVNAau3kqT3ayrj9lFbsgOlMoz3jFHq59MhmTp4WguRUc0I18A0B5wxB+rpc2v FrTzTZpt+C9we1qDLWFjpeAEqGraTqgQRD4dk+DgLCH9utJQISyc4UFv7dFMnVraPvFn 3dUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694656588; x=1695261388; 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=UjBddbZXLqwDqs/dRSKLKY4HwUhf6Ai3WxLtYL+KxyQ=; b=hLl13VwGGJm0jhM8GQGfg7VwCW/Kmr4YILXzDrCzkyK2zxuWTHqYA00auXQpD+SnT2 kExj6H2r53g8dNy79JN/354uyRyy622mnmr5kb6ZfJXXVLRZrUyJbc7kKRb9q6iYnsb3 Zkd6QvlRrlopCmGGbsUzOdQGQP3ZoEUNlu318eEy9PFIThmeUWBasBg9b3rVIWM9pe9R xYKddogjk1Qr6XTG9FWqrgqxz0hbYgu8byI9EyhBPg+0hSPeMzcrulDYG1yLEqCdXeNA DK4W8ZWF2/Q2rgxVOUxSM+dyiNo2/Zap8s4WHL2XKFuFO9hXjMbq69mm5J6qpfCZ/nuV phlQ== X-Gm-Message-State: AOJu0YwBqhwgeMXsnmpSYOEY9OCHCVneeWhcdYaZi5s/2gJhYoui/X37 De1Ibi/THdPgi3n5RktCo+G6vzCNaOQ= X-Google-Smtp-Source: AGHT+IH0gGeX6zOzLjc3uszP5L1cVBy/yaTsK9vfF/9VEoisKrc6F33BJumlmtJCwJ85BnFPZfgq0s7SPdg= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a05:690c:2e05:b0:59b:e1db:5633 with SMTP id et5-20020a05690c2e0500b0059be1db5633mr53066ywb.1.1694656588217; Wed, 13 Sep 2023 18:56:28 -0700 (PDT) Reply-To: Sean Christopherson <seanjc@google.com> Date: Wed, 13 Sep 2023 18:55:24 -0700 In-Reply-To: <20230914015531.1419405-1-seanjc@google.com> Mime-Version: 1.0 References: <20230914015531.1419405-1-seanjc@google.com> X-Mailer: git-send-email 2.42.0.283.g2d96d420d3-goog Message-ID: <20230914015531.1419405-27-seanjc@google.com> Subject: [RFC PATCH v12 26/33] 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>, Anish Moorthy <amoorthy@google.com>, Yu Zhang <yu.c.zhang@linux.intel.com>, Isaku Yamahata <isaku.yamahata@intel.com>, Xu Yilun <yilun.xu@intel.com>, 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-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 1846E100011 X-Stat-Signature: as3e7oiqi1xyn4p5473z6g3jeamp4pd4 X-HE-Tag: 1694656588-425051 X-HE-Meta: U2FsdGVkX1+MXz8xXeqe16MbP1NhrvwmYjt/ruaJaeDkGGYHPC/8NoDwVROSNdXY4l6mGxjv7cqlChcurk4TINiyWjsNrjWcj4Hq1yMZekK6driEl6zBPf2ddDhriXRzukD6GphrejeeE3P3MKSl32zsTC22NIrGHFBtzQEvlAoCCEK+l0bDoyHhFYWJ/vvOcA5glTIarpNT1MempUxNWSIMCdPsbFJkXKG7aGH4a9QsVCGHLqkhv5yktXYgofwVIxSV1/rTKEGCTjqumvUSF7k8I51uaadlZKguCsY9P22XVC+/jpVXKkUB6E6V+njcVPydnmnCRTDJ6utkb9p94iWHi5dUZpUP3QB/c2LxPFL+6h3SHc/qhBa0FbZR63eGD50RgC+6hNJua29oHiLADXol3XMlovh2GUKPWCMXx1gllG/tqMm2z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AXTaqUZc/MGAwGgFmTH823Mgx3k7kktOSuXn8sfVnUu2h0Lup7UqhLBL2ttuMbmQ8LMeJvj0an/neqD1SaSx5LQPeinURLWdQEXWJj+aF5IztF0KvPzM4MWOzZZlQt38oz+/zFGp0xYeyqA81PedmIudjwx7uwvJFpLi3MeIo0dURzFJ/u0JUOujL2dihE+j0eQlQRVvPf09VvNNv1qOKrUO9KxtO8PWc37dJx4InOPA5uPpeSLkL6UQwgat9GpPy+5g6W2BMq0nnkjmHtm2eF1+qSC6WSo4Gr1oNx5/JJe8YhvtNUdHrlUc9O0K/YirEBUEgdcNVwD2rGPvyqCl 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 4fd042112526..1911c12d5bad 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" @@ -1171,6 +1172,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) \