From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA922C77B73 for ; Fri, 26 May 2023 16:49:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236964AbjEZQtV (ORCPT ); Fri, 26 May 2023 12:49:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237139AbjEZQtU (ORCPT ); Fri, 26 May 2023 12:49:20 -0400 Received: from smtp-1908.mail.infomaniak.ch (smtp-1908.mail.infomaniak.ch [IPv6:2001:1600:4:17::1908]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D96FD9 for ; Fri, 26 May 2023 09:49:19 -0700 (PDT) Received: from smtp-2-0001.mail.infomaniak.ch (unknown [10.5.36.108]) by smtp-3-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4QSW9963HFzMqBk5; Fri, 26 May 2023 18:49:17 +0200 (CEST) Received: from unknown by smtp-2-0001.mail.infomaniak.ch (Postfix) with ESMTPA id 4QSW954GcnzMpq7x; Fri, 26 May 2023 18:49:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=digikod.net; s=20191114; t=1685119757; bh=aghhZZz/jAHNei4obfycQdpoNYo23x/hMTO/WYvr+D4=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=aNpuEEhr3qfgoQBoABl/c/Soy37k/dWbg29l53qY084NrLE1aBB96NeIw1GJ+t33V pd9trvFbpyUukW/iVPpk0eBX/Jwsza/CoS5PoumlcDlW/vnInB0QV0Wjo7cpI7eeQk 00f3/lqql1UIb9Yq02grk2akHYn3y+PAXnI212IM= Message-ID: <7671b432-569a-d176-315b-d5f66fe205ef@digikod.net> Date: Fri, 26 May 2023 18:49:12 +0200 MIME-Version: 1.0 User-Agent: Subject: Re: [PATCH v1 6/9] KVM: x86: Add Heki hypervisor support Content-Language: en-US To: Wei Liu Cc: Borislav Petkov , Dave Hansen , "H . Peter Anvin" , Ingo Molnar , Kees Cook , Paolo Bonzini , Sean Christopherson , Thomas Gleixner , Vitaly Kuznetsov , Wanpeng Li , Alexander Graf , Forrest Yuan Yu , James Morris , John Andersen , Liran Alon , "Madhavan T . Venkataraman" , Marian Rotariu , =?UTF-8?Q?Mihai_Don=c8=9bu?= , =?UTF-8?B?TmljdciZb3IgQ8OuyJt1?= , Rick Edgecombe , Thara Gopinath , Will Deacon , Zahra Tarkhani , =?UTF-8?Q?=c8=98tefan_=c8=98icleru?= , dev@lists.cloudhypervisor.org, kvm@vger.kernel.org, linux-hardening@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, qemu-devel@nongnu.org, virtualization@lists.linux-foundation.org, x86@kernel.org, xen-devel@lists.xenproject.org References: <20230505152046.6575-1-mic@digikod.net> <20230505152046.6575-7-mic@digikod.net> From: =?UTF-8?Q?Micka=c3=abl_Sala=c3=bcn?= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Infomaniak-Routing: alpha Precedence: bulk List-ID: X-Mailing-List: linux-hyperv@vger.kernel.org On 08/05/2023 23:18, Wei Liu wrote: > On Fri, May 05, 2023 at 05:20:43PM +0200, Mickaël Salaün wrote: >> From: Madhavan T. Venkataraman >> >> Each supported hypervisor in x86 implements a struct x86_hyper_init to >> define the init functions for the hypervisor. Define a new init_heki() >> entry point in struct x86_hyper_init. Hypervisors that support Heki >> must define this init_heki() function. Call init_heki() of the chosen >> hypervisor in init_hypervisor_platform(). >> >> Create a heki_hypervisor structure that each hypervisor can fill >> with its data and functions. This will allow the Heki feature to work >> in a hypervisor agnostic way. >> >> Declare and initialize a "heki_hypervisor" structure for KVM so KVM can >> support Heki. Define the init_heki() function for KVM. In init_heki(), >> set the hypervisor field in the generic "heki" structure to the KVM >> "heki_hypervisor". After this point, generic Heki code can access the >> KVM Heki data and functions. >> > [...] >> +static void kvm_init_heki(void) >> +{ >> + long err; >> + >> + if (!kvm_para_available()) >> + /* Cannot make KVM hypercalls. */ >> + return; >> + >> + err = kvm_hypercall3(KVM_HC_LOCK_MEM_PAGE_RANGES, -1, -1, -1); > > Why not do a proper version check or capability check here? If the ABI > or supported features ever change then we have something to rely on? The attributes will indeed get extended, but I wanted to have a simple proposal for now. Do you mean to get the version of this hypercall e.g., with a dedicated flag, like with the landlock_create_ruleset/LANDLOCK_CREATE_RULESET_VERSION syscall? > > Thanks, > Wei.