From nobody Mon Feb 9 07:40:21 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1568044353; cv=none; d=zoho.com; s=zohoarc; b=Ae8EUqhQamBnFZlAHst8bsm4JX7P+XB73qKBbCVwLA8TViWMuM75v62PEJaJqZJsp8bFhxy61Cf1F1li9ZoN3hnMD0bjjymV7CMDSsOrf4SidI9eOFpS8jCxa3BQ3IoBtWf1Q1tY7XlH0eGlIMApPtDrtuG9XIgcDRQAgPfU5ww= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568044353; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=A3Lbb7TzOX28kqJzny3hVuhnqnox1xT/NBCI+pj/hqU=; b=k9z9wcFIQ/fG2ZGmDbhNYi7UDmVwAOWlBz4k01yNhCu4IcGAMkfUXMo7xt8yXsV1K1mxs/o2KQMwLyGMjHkkUknKm5mAVu7NymacFUFq8HbXwqalESeNzBm0igVhcjLmQQ0kYCW5XCZ2SydLakSOIDR9rBnzawAFV1+7DyG1VNk= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1568044353493829.3453625694804; Mon, 9 Sep 2019 08:52:33 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1i7Lww-0001Dg-Jf; Mon, 09 Sep 2019 15:51:30 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1i7Lwv-0001Da-3P for xen-devel@lists.xenproject.org; Mon, 09 Sep 2019 15:51:29 +0000 Received: from esa3.hc3370-68.iphmx.com (unknown [216.71.145.155]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id af377e86-d319-11e9-b299-bc764e2007e4; Mon, 09 Sep 2019 15:51:28 +0000 (UTC) X-Inumbo-ID: af377e86-d319-11e9-b299-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1568044288; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Ycfzqz35S93BaQErjBwP7w2oj9qOE91COvvGMLxul2U=; b=YxAHxczZh3NidZzDBcL1DQrI/cZDu8ywi1Pxdnn27Bt5UbYhQXogShJE 8/QEQtMU7+A5t2cQ+rvM4Hz6S8fVzo4BX0V7UB0nN3xEQfoIJzfMZ/E77 lBQmGB76d00/oWMcHfPXxwdLcWQ4qpkF5BdmKO9Z2lexrnxRsXhXO8aBj g=; Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa3.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa3.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ~all" Received-SPF: None (esa3.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: FxI18Hwn9w4BjhnhANnyPFkNF/UiB9+K9etwq3sDYsBgamVVUE6Q8CwvZdy+hHo5r3Myrqbde2 HCkBAysPKK5IpcXm5wOjhMCeKDoJcWX5pjiL1Eh0E9BTSrhrZQUOpvYt7PkG5bbXxJncJTasHc UeepQvlXkpa9i2h8AzLIZyca74bPySVWlyn5Jfrftz1Z4K40vb2FMzjYmQCgVElgb6+g/UsGIx nZPuI1OBCXICXSZGquut6FjcLISstkhFVPoSug41VZ07l66XtvB/JfYYWjyH97H4WfmGEPTbj4 hPA= X-SBRS: 2.7 X-MesageID: 5329688 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.64,486,1559534400"; d="scan'208";a="5329688" From: Andrew Cooper To: Xen-devel Date: Mon, 9 Sep 2019 16:51:24 +0100 Message-ID: <20190909155124.19942-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Subject: [Xen-devel] [PATCH] x86/cpuid: Fix handling of the CPUID.7[0].eax levelling MSR X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , Wei Liu , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) 7a0 is an integer field, not a mask - taking the logical and of the hardware and policy values results in nonsense. Instead, take the policy value directly. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich Reviewed-by: Roger Pau Monn=C3=A9 --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 Even Rome hardware has 7[0].eax still as 0, and there is no sensible reason= to set max_subleaf higher at this point, so this is only a latent bug for now. --- xen/arch/x86/domctl.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c index 1e98fc8009..35ad8cb51c 100644 --- a/xen/arch/x86/domctl.c +++ b/xen/arch/x86/domctl.c @@ -218,11 +218,16 @@ static int update_domain_cpuid_info(struct domain *d, if ( is_pv_domain(d) && ((levelling_caps & LCAP_7ab0) =3D=3D LCAP_= 7ab0) ) { uint64_t mask =3D cpuidmask_defaults._7ab0; - uint32_t eax =3D ctl->eax; - uint32_t ebx =3D p->feat._7b0; =20 - if ( boot_cpu_data.x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_H= YGON) ) - mask &=3D ((uint64_t)eax << 32) | ebx; + /* + * Leaf 7[0].eax is max_subleaf, not a feature mask. Take it + * wholesale from the policy, but clamp the features in 7[0].e= bx + * per usual. + */ + if ( boot_cpu_data.x86_vendor & + (X86_VENDOR_AMD | X86_VENDOR_HYGON) ) + mask =3D (((uint64_t)p->feat.max_subleaf << 32) | + ((uint32_t)mask | p->feat._7b0)); =20 d->arch.pv.cpuidmasks->_7ab0 =3D mask; } --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel