Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp2068812rwn; Fri, 9 Sep 2022 08:06:33 -0700 (PDT) X-Google-Smtp-Source: AA6agR7X1aVXtlgcRA1aKsYRuQ2qw6VlBW3ByK1/TVk/RFgVQAMFW5N0BSzPUcyt6Zc0zZNTShi2 X-Received: by 2002:a17:907:9495:b0:734:e049:3d15 with SMTP id dm21-20020a170907949500b00734e0493d15mr10544807ejc.187.1662735992760; Fri, 09 Sep 2022 08:06:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662735992; cv=none; d=google.com; s=arc-20160816; b=TrGUhJbdi5G7GchV1LZsiwABRnq8QXfwaiZhLfj0e4+TD5wDLvG9P6ifE7UZLP21LM xuYbcsNJNRTBpg8wAgm3TG9dKAISUi/JMT4jY/aQCGf0FiEoNk7QgGS7uKpo4QSKumJE wsYgrBLVtusADrLiQoN8sNQ2EynV/exQiAh2hoRWwjm9XWNgI5VJ0hDC3aFe4OvTgbYx XYus/h1we4wk5FgHC7hZ8AjYNqZShIkSf9dV1/vTmbeMabtKmlW1ZyseEiUrMUpjIjPe c+SmZTp1UmnYc7njNp7QpuFZcoheNEPVEhyaWwx56UL5KEbeSsQZb35og5AyezSUWSv0 yeoA== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=+yOg8NsIzlPWzR+/oLmBAIEj5goviaZHylN0pyWXIpg=; b=tIgMfSNzhbSOrGSPSPAlfky1lPlsPk0d6KM+Ins275AdF9CrYgqg5LJvDboBJsr9J7 LaeWzttVFOs/ZSjGT7Ndvsx3OWbdMLLAU60vvDKl3ZRaVp0mJ807fo3aDCNvK+Cht39A 62Dm4Coaao+Bc99BBwMEWCLXgA8MhPfDi6j67KnP3PR6701LBl+EaxU7IOC765ldAu44 2WeXzQ6TM8UVeITOxx4XWqb1J6b+IM/HYZW+Y9bhf+I9jLwJTeYhBPgd8mcvSE3UqgNx k8Q0QH7Jh6/bRtipMm8pd/sjmAibVAj6URt9Ed44GvGCC75zeYWHxwEXwAeX8KVkRHnw OtNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=YZN7pjUq; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fj4-20020a1709069c8400b0073d8659db5csi534280ejc.966.2022.09.09.08.06.06; Fri, 09 Sep 2022 08:06:32 -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; dkim=pass header.i=@google.com header.s=20210112 header.b=YZN7pjUq; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232154AbiIIOyA (ORCPT + 99 others); Fri, 9 Sep 2022 10:54:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232078AbiIIOx5 (ORCPT ); Fri, 9 Sep 2022 10:53:57 -0400 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 451CA130D04 for ; Fri, 9 Sep 2022 07:53:55 -0700 (PDT) Received: by mail-pj1-x102b.google.com with SMTP id p1-20020a17090a2d8100b0020040a3f75eso1812696pjd.4 for ; Fri, 09 Sep 2022 07:53:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date; bh=+yOg8NsIzlPWzR+/oLmBAIEj5goviaZHylN0pyWXIpg=; b=YZN7pjUqrQkZISU8YG6JdiBjt1ZLo44dsYe1HlvNSTTXS8pI536yOP/aHVByS1Q2l4 r+zNinmWULcg3HY+KirQOwL1EjOXNdZiyAk6Xp/ybgdY6up99xylVtdi22+Lv1MGNKPb IjZNsnCW4p9sG7ll4jgk1ye7g85cQOVvwebdKX9fDLAZ4YPDqjZF7wP/jiuxgdlYO/mZ UtWgzHRWp1FGuhjciPbIsuzRRz17mZxWUbKOwkzHKAwZF1S4ICcIX9h6lKfwHdinGkXp hkVKjnFBdOmYr7pLD6VuToX5tBvm9lQZd4K8hrpFh3tONaje5NKBs74A+KRaJCZlzg/B 5VSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date; bh=+yOg8NsIzlPWzR+/oLmBAIEj5goviaZHylN0pyWXIpg=; b=zR/cbvJra8nAGM8hXIXcMSZkHJaWJ603t9R6975fZn50+NFctCvEdud3FWOdS/Rfkd lp0er/hqgBEjTGq+Roo+W1RV95bWBkHyirMyjzowJRBQaM8CrlBpVwjShCJA1GmEF3Jk jDlTkyPDSSPLUvar4KnJ/PkUYk8odCanUBHm25cadaiwB0GyEFOlNk6Y+kiFXzqd0FfC unJTYQP2ZVdBCnLPy5kjYSjPR39o+XqQIokAz4T0NCvdmkQz1tvzCSKz8g+icnaMV68i gkcD1NwYy63pmpScsT0DqLPbV3ZIzRxXL9Zj0o0aHJ0fSbCGP/oaJl3i1C3hagSYYi9s UjnQ== X-Gm-Message-State: ACgBeo34gvEk16C3sy0JBkLqqibuj4v+hLZYXZPMpYUVpL1P/1vXGeeT ofMoueDygP74UJAd6RGBuuIcKQ== X-Received: by 2002:a17:902:904b:b0:172:cd04:a3d3 with SMTP id w11-20020a170902904b00b00172cd04a3d3mr14169355plz.173.1662735234670; Fri, 09 Sep 2022 07:53:54 -0700 (PDT) Received: from google.com (7.104.168.34.bc.googleusercontent.com. [34.168.104.7]) by smtp.gmail.com with ESMTPSA id b7-20020a170903228700b0017509940418sm618020plh.79.2022.09.09.07.53.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Sep 2022 07:53:54 -0700 (PDT) Date: Fri, 9 Sep 2022 14:53:50 +0000 From: Sean Christopherson To: Vitaly Kuznetsov Cc: Gerd Hoffmann , kvm@vger.kernel.org, Paolo Bonzini , Wanpeng Li , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "H. Peter Anvin" , "open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" Subject: Re: [PATCH] kvm/x86: reserve bit KVM_HINTS_PHYS_ADDRESS_SIZE_DATA_VALID Message-ID: References: <20220908114146.473630-1-kraxel@redhat.com> <20220909050224.rzlt4x7tjrespw3k@sirius.home.kraxel.org> <87tu5grkcm.fsf@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87tu5grkcm.fsf@redhat.com> X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham 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, Sep 09, 2022, Vitaly Kuznetsov wrote: > Gerd Hoffmann writes: > > > On Thu, Sep 08, 2022 at 02:52:36PM +0000, Sean Christopherson wrote: > >> On Thu, Sep 08, 2022, Gerd Hoffmann wrote: > > ... > > >> > arch/x86/include/uapi/asm/kvm_para.h | 3 ++- > >> > 1 file changed, 2 insertions(+), 1 deletion(-) > >> > > >> > diff --git a/arch/x86/include/uapi/asm/kvm_para.h b/arch/x86/include/uapi/asm/kvm_para.h > >> > index 6e64b27b2c1e..115bb34413cf 100644 > >> > --- a/arch/x86/include/uapi/asm/kvm_para.h > >> > +++ b/arch/x86/include/uapi/asm/kvm_para.h > >> > @@ -37,7 +37,8 @@ > >> > #define KVM_FEATURE_HC_MAP_GPA_RANGE 16 > >> > #define KVM_FEATURE_MIGRATION_CONTROL 17 > >> > > >> > -#define KVM_HINTS_REALTIME 0 > >> > +#define KVM_HINTS_REALTIME 0 > >> > +#define KVM_HINTS_PHYS_ADDRESS_SIZE_DATA_VALID 1 > >> > >> Why does KVM need to get involved? This is purely a userspace problem. > > > > It doesn't. I only need reserve a hints bit, and the canonical source > > for that happens to live in the kernel. That's why this patch doesn't > > touch any actual code ;) > > > >> E.g. why not use QEMU's fw_cfg to communicate this information to the > >> guest? > > > > That is indeed the other obvious way to implement this. Given this > > information will be needed in code paths which already do CPUID queries > > using CPUID to transport that information looked like the better option > > to me. > > While this certainly looks like an overkill here, we could probably add > new, VMM-spefific CPUID leaves to KVM, e.g. > > 0x4000000A: VMM signature > 0x4000000B: VMM features > 0x4000000C: VMM quirks > ... > > this way VMMs (like QEMU) could identify themselves and suggest VMM > specific things to guests without KVM's involvement. Just if 'fw_cfg' is > not enough) I don't think KVM needs to get involved in that either. The de facto hypervisor CPUID standard already allows for multiple hypervisors/VMMs to announce themselves to the guest, e.g. QEMU could add itself as another VMM using 0x40000100 (shifted as necessary to accomodate KVM+Hyper-V).