Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp4886952rwr; Mon, 8 May 2023 14:20:53 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4HcOkPfbFgnnD+GMNKZGtg46GIpjMXcQ65sBpy2FQESNwVmGXcH0fsPrT8QcVFSOb1egUx X-Received: by 2002:a17:90a:608f:b0:24e:3b69:a87f with SMTP id z15-20020a17090a608f00b0024e3b69a87fmr11365992pji.25.1683580853331; Mon, 08 May 2023 14:20:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683580853; cv=none; d=google.com; s=arc-20160816; b=bj0zwg6ndpz8/LDOjCj/BPcCzTwUJ1fEBuAP/al92lnJRltHeNgnyM1203Uc7zXzUn fVJ9QgKAAVAs13YGR/meu00qC7AQHuHeyPXiNjt1TRjtictRAnNML2+Zogt1DZpLfWqI GO0GbYMXBmJZ3favdSNvg+Vw6DramLlQVWvXY0s7q+Ly9OeTxl8CyAsJCWlECeGuW6jA kWQ49bImWIfIecdpOxdwZS82BYngZu4kOtPeLu0LDDkyKFe9q/AE5R4E9D8xC0B59ZoG RnpVn2X0KFBN9cS2idEV0el7PualSRoRKC6VktZtFvi6418Z3euucU0+fId8Vrub+dyw ZQOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=Z9LwMl3SaVI5b8sezFDQVcUBEvYrPsuHk5i8fgGhI70=; b=cQV6iZI33fylOvvr/vaZGvW9I3MEAr0/o5Z4AbmNOnxK8X4aBmNoamac5obLUMqllW UNJ+YHGrdpKLq7Wsn2EhsY8kPX+3j/BEwLeBLFXYYx8eU4FLGgwEk2VwfzoEh4eAMhOQ axY8JQ7yrbVOHyITx+UPoyLMacJ0JfRInJU2xRvKe9Tiu8Jpmp5IC5Y1j46BevwwjawV SoLF5FMhRwCmYLlHXce79hDeas/PEkSZSL2v4IUSYDv1kIr6FiJqhYEPaDY/Hw6ZkshB w2JM0+yTXJvw1hYjhvSdGfjwSG5zWMsl6oxCyOdXy3fNnm1hiTXTy0e3hauj9J6xY9q7 +yuQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o8-20020a17090a4b4800b0024eab334011si12256919pjl.175.2023.05.08.14.20.39; Mon, 08 May 2023 14:20:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233238AbjEHVSe (ORCPT + 99 others); Mon, 8 May 2023 17:18:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229690AbjEHVSd (ORCPT ); Mon, 8 May 2023 17:18:33 -0400 Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.179]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A927CC; Mon, 8 May 2023 14:18:32 -0700 (PDT) Received: by mail-pg1-f179.google.com with SMTP id 41be03b00d2f7-517ab9a4a13so4593047a12.1; Mon, 08 May 2023 14:18:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683580712; x=1686172712; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Z9LwMl3SaVI5b8sezFDQVcUBEvYrPsuHk5i8fgGhI70=; b=VnZpj7UtLLQN1MVZaO2CuRaY3odcXC+WBgYW9KWN/w9/VXk6wLeA7D1NEdYk6jV+HX DWf8qshGPFNZj941PGYl3HMs7BsglKDubIHyB2cu6JX9aJHWSmWkd04ZZQCoeJ1+e7oF ar01CAoLFDbyQSUwF2CM7kSJAOquacbgm0yu/q/b+BBOBFmWy3UX4pAvScPcp4CgcosN iZ+a7aQaAOewg2e8HZYUy5EFOwapCajY+WAuuu6x7lgeBas+blLC3BoKJ+cO4ao+hj7m rZw3/QyeMFZnXwmVso3KjgETAhuYfsE9n44XEhP7V21lESmh8csZDADslV51SUPOJRVM zbQg== X-Gm-Message-State: AC+VfDwwnbqC5lX+qH4e9narT1TMVQPXk9bKH3hfJC9ISFE0TafuuGpa 0ObwRReKIcCPRfvgN/HeX/o= X-Received: by 2002:a05:6a20:1591:b0:f0:ec64:f3de with SMTP id h17-20020a056a20159100b000f0ec64f3demr15058351pzj.25.1683580711711; Mon, 08 May 2023 14:18:31 -0700 (PDT) Received: from liuwe-devbox-debian-v2 ([20.69.120.36]) by smtp.gmail.com with ESMTPSA id c35-20020a631c23000000b00513ec871c01sm6699252pgc.16.2023.05.08.14.18.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 May 2023 14:18:31 -0700 (PDT) Date: Mon, 8 May 2023 21:18:29 +0000 From: Wei Liu To: =?iso-8859-1?Q?Micka=EBl_Sala=FCn?= 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 , Mihai =?utf-8?B?RG9uyJt1?= , =?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, Wei Liu Subject: Re: [PATCH v1 6/9] KVM: x86: Add Heki hypervisor support Message-ID: References: <20230505152046.6575-1-mic@digikod.net> <20230505152046.6575-7-mic@digikod.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230505152046.6575-7-mic@digikod.net> X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? Thanks, Wei.