From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id CD7A0941E58 for ; Wed, 6 Mar 2024 22:45:35 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=1aagWeXZM8cCOlmxTzPfGmVdOL7XrSXzw1atEhh7mTI=; c=relaxed/simple; d=groups.io; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:To:Cc:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type:Content-Transfer-Encoding; s=20240206; t=1709765134; v=1; b=qXPcUmpmTnfZV3kIIZ/YVFnOT/17sPFtxxQMM11RmSAZ5iO39gjnXyG+fiJkn59HpUcKn7wv VBFBddj0Q5rlBL1RFwOXD58U9CNKFKYtlQyvbRzWzwt8QGKNtd/ztWrq2ShbShrR87crtxYvyFy 02mmja2ImqZAraHNuAQY/4nfo/g/mELfNL9C7ynVaODi5i2dqdeImd66TW2dGh/yXuK2+MgvO5F m6ik3/RMgm9aHV8iKd2pqgY0OUvNl9W+r9aACcM/7UlIFyH5BbVa104ncnUqse8b9tyBlhMMNEY DsWL31PFlB/IvtZlUK2E7UxO9blem2pBtHBzkU5klWBFg== X-Received: by 127.0.0.2 with SMTP id OSJvYY7687511xfxFMGHG1vw; Wed, 06 Mar 2024 14:45:34 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web11.9707.1709765133625482113 for ; Wed, 06 Mar 2024 14:45:33 -0800 X-Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-126-_VX1w1XaMleY7waq4hFiMQ-1; Wed, 06 Mar 2024 17:45:31 -0500 X-MC-Unique: _VX1w1XaMleY7waq4hFiMQ-1 X-Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-412db0e24aeso1460615e9.1 for ; Wed, 06 Mar 2024 14:45:31 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCXN1+w5krIP2Y+jKxt3+XK/oKBMwTWHoAQemYeIr/rc7T79jdadPh9gbjpefCPutdvS3bXYiWelhx/zB3mVxfL1TqgwCg== X-Gm-Message-State: Df08rEb8YlgvGCcG5qMGB01Fx7686176AA= X-Received: by 2002:adf:f249:0:b0:33b:87fb:7106 with SMTP id b9-20020adff249000000b0033b87fb7106mr11226536wrp.55.1709765130236; Wed, 06 Mar 2024 14:45:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IGb+cguYXFea27FstJu4ZmDv3fSSLMStSnn8W3qAhuEAUR4wOfR7aSvqf9WXLw/mPzCkhrnfKwCM2TZWIrh22E= X-Received: by 2002:adf:f249:0:b0:33b:87fb:7106 with SMTP id b9-20020adff249000000b0033b87fb7106mr11226523wrp.55.1709765129842; Wed, 06 Mar 2024 14:45:29 -0800 (PST) MIME-Version: 1.0 References: <20240222105407.75735-1-kraxel@redhat.com> <20240222105407.75735-4-kraxel@redhat.com> <32oty4asp3xrecjruatwm77fbevcaizswovjc5jqct5bdofwiq@sgff2gzgau7o> <9e7e617c-d398-81b4-2c92-6b3a092e354c@amd.com> In-Reply-To: <9e7e617c-d398-81b4-2c92-6b3a092e354c@amd.com> From: "Paolo Bonzini" Date: Wed, 06 Mar 2024 14:45:33 -0800 Message-ID: Subject: Re: [edk2-devel] GuestPhysAddrSize questions To: Tom Lendacky Cc: Gerd Hoffmann , devel@edk2.groups.io, Michael Roth , Jiewen Yao , Liming Gao , Laszlo Ersek , Ard Biesheuvel , Min Xu , Erdem Aktas , Oliver Steffen , Ard Biesheuvel X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,pbonzini@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=qXPcUmpm; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=redhat.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io On Mon, Mar 4, 2024 at 6:24=E2=80=AFPM Tom Lendacky wrote: > > On 3/4/24 07:09, Gerd Hoffmann wrote: > > Hi, > > > >>> 23:16 GuestPhysAddrSize Maximum guest physical address size in bi= ts. > >>> This number applies only to guests using = nested > >>> paging. When this field is zero, refer to= the > >>> PhysAddrSize field for the maximum guest > >>> physical address size. See =E2=80=9CSecur= e Virtual > >>> Machine=E2=80=9D in APM Volume 2. > > > >> I believe the main purpose of GuestPhysAddrSize was for software use (= for > >> nested virtualization) and that the hardware itself has always returne= d zero > >> for that value. So you should be able to use that field. Adding @Paolo= for > >> his thoughts. > > > > Reviewers mentioned this is meant for nested guests, i.e. (if I > > understand this correctly) the l0 hypervisor can use that to tell > > the l1 hypervisor what the l2 guest phys-bits should be. > > > > Is this nested virtualization use documented somewhere? Tried to > > search for GuestPhysAddrSize or Fn8000_0008_EAX in APM Volume 2, > > found nothing. > > Right, and I don't think you'll see anything added to the APM that will > state how it can be used by software. The APM is an architectural > definition and won't talk about hypervisors and using nested paging, etc. I don't think that's a problem. The problem is that the definition in the APM is ambiguous and can mean one of three things: 1) it can be a suggested value for PhysAddrSize (bits 7:0) of guests that use nested paging. This would imply that in a nested page guest, with GuestPhysAddrSize=3D48, setting bits 51:48 would cause a #PF(reserved) exception. 2) it can be equivalent to LinAddrSize (bits 15:8) but for nested page tables. This would imply that, with GuestPhysAddrSize=3D48, VMRUN would fail if hCR4.LA57=3D1. 3) it can be what I propose above: the architecture defined a situation that can only happen when using nested paging (on AMD: host_CR4.LA57=3D0, PhysAddrSize=3D52), and GuestPhysAddrSize is an architectural way to explain the situation to guests. The message above suggests that the intended meaning is (1). That is because "the l0 hypervisor can use that to tell the l1 hypervisor what the l2 guest phys-bits should be" is exactly the same as "the processor can use that to tell the hypervisor what the guest phys-bits should be" (just shifted one level down). However, there are no processors that implement (1) or (2), so my suggestion is to clarify that the intended meaning is (3). Do you agree that the above proposal is a plausible interpretation of what is already in the APM, but clearer? And do you think there is a way for the clarification to make it into the APM? Paolo -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#116465): https://edk2.groups.io/g/devel/message/116465 Mute This Topic: https://groups.io/mt/104510523/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-