Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp2060230rdf; Mon, 6 Nov 2023 03:46:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IHq2o3iv5u+ue76OtkItZr39ICM0wkeIq6ld4E3ey/QpfQAGO6jRRW00LZjGi1J/9bgc+gF X-Received: by 2002:a05:6e02:308d:b0:359:3b36:9abf with SMTP id bf13-20020a056e02308d00b003593b369abfmr20739568ilb.4.1699271164146; Mon, 06 Nov 2023 03:46:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699271164; cv=none; d=google.com; s=arc-20160816; b=Sv7ZEi0vQ0oxwezmuw5W+HEAQMLwIOFSA4ROL2PPNjq0Ns5zRGJFqzkQZ3V+/9yRLP YnA4zzP5TlgbHgYXCQTNck/RNOvxoK5akY9yboo4J0R41ypDH9F2HFPnysCFe5UjHrdL 1draDvGxnE2zUavc/IZ8KLJHwIsPbge9E387IoHeafzTryqxJGqLUXARgzR9gTdhwbJ1 MCuPmlwSC1b1XMvwfTS1R8fYPrDaL3OgTv9VxwqVRSJno8iobSe/Uq3+3AOhL6e08PAH cqnUQEo19j92VcmMTgVLHwUPpBQ76/aJR99epO4jK0bpqDls1iDiFb+Aos29DQsMLNA2 v6xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=DX7ek6JbnQBP3kmz+KR8GNUYI0kM1PtX+UUHfn3vax8=; fh=6NDLbPegWN39ihzRI+XD38qv7OUBTPlYZUUvtWMZU2Q=; b=Zgcg1+y27dX9renjazWRt/wjgReO7rNW8bc+WpxyqZC42XbDjDsFpIGEBY04nhzjA8 CcDhqQMvcJUwFzBP5dZ5f5DT7MOCsw6UPrTwLSgof5uVjhH0fY4U+ujuUdigiZ9IspGd IHXE0oVRRcNGnbJHVQFxVyE0z+I+ZQKgfgweHrNmyMDTsW2OwklKEOYlqxW5JnfLhDG8 EKsf7Ef05yXZZj0FBxKXWgDEqEnskw95rcrs7e5ppbeuNjgtpQYuTzxnOogP/w0160+w OjbluM0XZYuPhGInHhvy0v+po9TkaF9+bIxzdkGxBaC1E+VeY+btZKwsw5v+1Kgf1jwh 96dA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=VNbdkXhi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id i67-20020a639d46000000b005b9a149e61esi7305073pgd.649.2023.11.06.03.46.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 03:46:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=VNbdkXhi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id DA002807C6F1; Mon, 6 Nov 2023 03:45:05 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229799AbjKFLo5 (ORCPT + 99 others); Mon, 6 Nov 2023 06:44:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229583AbjKFLo4 (ORCPT ); Mon, 6 Nov 2023 06:44:56 -0500 Received: from mail-yw1-x1129.google.com (mail-yw1-x1129.google.com [IPv6:2607:f8b0:4864:20::1129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6850B90 for ; Mon, 6 Nov 2023 03:44:53 -0800 (PST) Received: by mail-yw1-x1129.google.com with SMTP id 00721157ae682-5a822f96aedso52096927b3.2 for ; Mon, 06 Nov 2023 03:44:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1699271092; x=1699875892; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=DX7ek6JbnQBP3kmz+KR8GNUYI0kM1PtX+UUHfn3vax8=; b=VNbdkXhidZPy2jyspbi+mWrdtQTAWbWJMGSXLu11+BoTws5mX97/h8fnfNA2YHtR5S pnSp6VIcooBGySQ96XECwJsRn8RkrAcwbf3JvjIjxo64IBBjH/0Zu9xnHEBEONaYyOLj vYNm4iuT6bI/bFTiOGU7PSeQbSxO6+teJD5HvjyRtsnE8XVrbM/dzsrEr3Wpj8dvrZJk xFnBnhx+hcTEr4GABAKg8/+16QKYDcjnPmmWrFTXhEpt52YBY12duJbTG+Fve8R7qKlr cLgqhf062bF0xiH5sfOKCGAkieIs5cLBUFyjGkEBC/yUPlx0auzSTpJa1FXbpwwTqgB9 pbyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699271092; x=1699875892; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DX7ek6JbnQBP3kmz+KR8GNUYI0kM1PtX+UUHfn3vax8=; b=Lt2KLFrAZ62kLNuZlI0uqaHYr8ehC0aRPbeXlnh5Bxbtl1M8mwPixE9Am7uJAfOLGG P7HPpoKjb35mFg6vKUfPbwMkOut9FlQSHn3SFhBAnH7u2y0d2E8WSdyoTDAia8PPT9jO A+jaxUb0EUfZmLFYQKYBsQAYTCeVKw2njYu/8lUP0kHv5AVxv9iEuddte5NGNA7M5OHl dYp8gEDAKB8WMvQnFsLJ6lAZ/aPiNRYrLNWJB7Z95ViVAaSySpf5GtUIwu2IPNXYgohi u3/Wvfkrof3rstVhJyzb679ediJCySh9poE5OOCo0f92ze6db/lHVMNpOHFx+HJ2mvfD Hm+A== X-Gm-Message-State: AOJu0YxAElcO56imleBUvkp7nb1CCwnMD8HqakFHLOlv0DH5RgXeX2B3 lWkKoPoZkFWmB87cwcYA9Om/HQJgYsuw7pX7Ax7N3g== X-Received: by 2002:a0d:ccc5:0:b0:5a7:e4fe:ea3 with SMTP id o188-20020a0dccc5000000b005a7e4fe0ea3mr10768851ywd.22.1699271092440; Mon, 06 Nov 2023 03:44:52 -0800 (PST) MIME-Version: 1.0 References: <20231105163040.14904-1-pbonzini@redhat.com> <20231105163040.14904-27-pbonzini@redhat.com> In-Reply-To: <20231105163040.14904-27-pbonzini@redhat.com> From: Fuad Tabba Date: Mon, 6 Nov 2023 11:44:16 +0000 Message-ID: Subject: Re: [PATCH 26/34] KVM: selftests: Add helpers to do KVM_HC_MAP_GPA_RANGE hypercalls (x86) To: Paolo Bonzini Cc: Marc Zyngier , Oliver Upton , Huacai Chen , Michael Ellerman , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Sean Christopherson , Alexander Viro , Christian Brauner , "Matthew Wilcox (Oracle)" , Andrew Morton , 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 , Xu Yilun , Chao Peng , Jarkko Sakkinen , Anish Moorthy , David Matlack , Yu Zhang , Isaku Yamahata , =?UTF-8?B?TWlja2HDq2wgU2FsYcO8bg==?= , Vlastimil Babka , Vishal Annapurve , Ackerley Tng , Maciej Szmigiero , David Hildenbrand , Quentin Perret , Michael Roth , Wang , Liam Merwick , Isaku Yamahata , "Kirill A. Shutemov" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Mon, 06 Nov 2023 03:45:07 -0800 (PST) On Sun, Nov 5, 2023 at 4:34=E2=80=AFPM Paolo Bonzini = wrote: > > From: Vishal Annapurve > > Add helpers for x86 guests to invoke the KVM_HC_MAP_GPA_RANGE hypercall, > which KVM will forward to userspace and thus can be used by tests to > coordinate private<=3D>shared conversions between host userspace code and > guest code. > > Signed-off-by: Vishal Annapurve > [sean: drop shared/private helpers (let tests specify flags)] > Signed-off-by: Sean Christopherson > Message-Id: <20231027182217.3615211-29-seanjc@google.com> > Signed-off-by: Paolo Bonzini > --- Reviewed-by: Fuad Tabba Tested-by: Fuad Tabba Cheers, /fuad > .../selftests/kvm/include/x86_64/processor.h | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > > diff --git a/tools/testing/selftests/kvm/include/x86_64/processor.h b/too= ls/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 > #include > > +#include > #include > > #include "../kvm_util.h" > @@ -1194,6 +1195,20 @@ uint64_t kvm_hypercall(uint64_t nr, uint64_t a0, u= int64_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, uint6= 4_t flags) > +{ > + return kvm_hypercall(KVM_HC_MAP_GPA_RANGE, gpa, size >> PAGE_SHIF= T, flags, 0); > +} > + > +static inline void kvm_hypercall_map_gpa_range(uint64_t gpa, uint64_t si= ze, > + uint64_t flags) > +{ > + uint64_t ret =3D __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) \ > -- > 2.39.1 > >