Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp1706972lqg; Mon, 4 Mar 2024 00:48:37 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUsrPhQwEO79Tp9YSLpW5kffmz6GSIQa0rB8WG5z9UKpMfzPwFBL76nAoH8irFvAjHdsDFVzsnlWXZ4AJJc782yMRv5/MQndAdy8i/3VA== X-Google-Smtp-Source: AGHT+IEFkjPYh5XGyXGTyIwlYX1IqITkMHCrPsqileXU8zqvqBfYJdDpXCDpt9kY2hCl530BcMan X-Received: by 2002:a05:6870:9448:b0:220:dd3f:b227 with SMTP id e8-20020a056870944800b00220dd3fb227mr5327077oal.1.1709542117204; Mon, 04 Mar 2024 00:48:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709542117; cv=pass; d=google.com; s=arc-20160816; b=H69vKbhUtDkgvXM8KlXsUuWvkb6D9Xkq/t+at6QN49ler8mCUPwDf5AA17sxhSLXLQ lam5OZSIn7HGqk3ZtN0RKTgIkdpVKmITMHUJp6sGWTUxHvyucXmpWDHvVREmMTNI5xU/ L40+CMJ4NkUxpiCOyhm90VLR+0S69dy8CA6W0CqSlwEfVUz0F5iLqNaQo7nDvLBWOh1Z ZLHmkOyVZ3C7jo6jv+Bz7ClyJNaNXughLI7dDw3NMqQNk5oUpuTNJZfiG3Oz8Hldd8Eo U2SeizOlUEX8Tbbr/RJG2nl8Ys2bLkv2UDh9XZ7pZlcuKi7U6wE/xfKKt+6+/QTzBeqs ABsA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=3LdMeXg6oYzzaQwNcQtAfoUHshalR516v8C8QWlVtXs=; fh=qEq6e5+8B+Gwkg34JvILlRSpg/wRAAWG5imw1F/XrPg=; b=hXc+8xcbUi6gs3UMldswWJeDFcCQ5DTSP/FdLCghtP6/7hgX2LEhf1JJ5od/+a822r KK/fqhS7W85vtVa6yp0n/jfLL8NL35K8EMaNUOwae0rf4vKRkQliqRw1RP1rjpj2JAXP heLL8P3ZGf5gUz+VYb06MnCn+cWHsBnvXdwEb2TNI5kBV0Os7/IWmTw4A5M5dsS4CLT9 5UGVUhoDdTcZAsVDCczPs2RqvK0N2vLXsPYb8LTWUsApmAJxVScnu8mA57LpW3RYiVyH 4iUmQ1jt0lgftqEKfxRygYc+gLkLscNrkuWkpS0QlfhNbyQN9DkOI5qaG7LSrEP43T3l 4a5Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Z4dWYz3O; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-90231-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90231-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id a22-20020a631a56000000b005ced4fbeb75si8078901pgm.581.2024.03.04.00.48.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 00:48:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90231-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Z4dWYz3O; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-90231-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90231-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 7ED102822DA for ; Mon, 4 Mar 2024 08:48:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BA46F1B7FE; Mon, 4 Mar 2024 08:44:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Z4dWYz3O" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7BA2C38F8F for ; Mon, 4 Mar 2024 08:44:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709541842; cv=none; b=mgRHTGwwLwpkb4PBf7rkfjyv0au3L6kp7Ma0d65mykbEc/RoOIrA6BHA8PqFXu6A2/4QHcYVLV2Dcj2Fx1MXDCep5XdrlywjJsXB+HzqQlCh89aWQvZ4fMlsu1usAmX00RUmecNtctkkqBXo6fUyJE6BrZLimuKOESDBbDCo9QQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709541842; c=relaxed/simple; bh=I29VTBmWsXgiB8EffcLS3EPaMYqXfAHUkxD9L3kQnkQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=pzBxjKs+m9GU9gGwle3/Ys3iXn+4h7hFcmyTKOsf8uqydxNgui5fbByVpquq1nOF1sKyLoWO9enNfqrB4hiPJnm+KGWJ+y0Csyw9lvHV7WXZC8Q9WzNFSPlc6bmB09Ok5S4izbJYK7/2TdWJH7wt+Al3IqZ2/ZL/mwYTT0g+6xY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Z4dWYz3O; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709541839; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=3LdMeXg6oYzzaQwNcQtAfoUHshalR516v8C8QWlVtXs=; b=Z4dWYz3O1CS38A+Z4ehIn0rIWKOtb/gNJQ5GOzMFyYJOytq0LMqStvRrHugKFl5y8TQiX5 ji7yPStq5RS0OVrlN1O3XTulKY71i5FaJb2UkTHsazjX/TAz1cB6JOMpN/bHGPNhwAw89T fi21NWjx0ua3QcYf7G6dwfyjj66lB+A= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-584-RAUvfw0xNwWztwDrstr7uA-1; Mon, 04 Mar 2024 03:43:56 -0500 X-MC-Unique: RAUvfw0xNwWztwDrstr7uA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 967FD811E79; Mon, 4 Mar 2024 08:43:55 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.193.36]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 205332166B31; Mon, 4 Mar 2024 08:43:55 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id BD16218009DB; Mon, 4 Mar 2024 09:43:53 +0100 (CET) Date: Mon, 4 Mar 2024 09:43:53 +0100 From: Gerd Hoffmann To: Tao Su Cc: kvm@vger.kernel.org, Sean Christopherson , Paolo Bonzini , 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 1/3] kvm: wire up KVM_CAP_VM_GPA_BITS for x86 Message-ID: References: <20240301101410.356007-1-kraxel@redhat.com> <20240301101410.356007-2-kraxel@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 > > + kvm_caps.guest_phys_bits = boot_cpu_data.x86_phys_bits; > > When KeyID_bits is non-zero, MAXPHYADDR != boot_cpu_data.x86_phys_bits > here, you can check in detect_tme(). from detect_tme(): /* * KeyID bits effectively lower the number of physical address * bits. Update cpuinfo_x86::x86_phys_bits accordingly. */ c->x86_phys_bits -= keyid_bits; This looks like x86_phys_bits gets adjusted if needed. take care, Gerd