From nobody Mon May 6 22:31:20 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1580215980269634.4801082883133; Tue, 28 Jan 2020 04:53:00 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iwQLt-0001bx-WB; Tue, 28 Jan 2020 12:52:21 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iwQLs-0001bs-Te for xen-devel@lists.xenproject.org; Tue, 28 Jan 2020 12:52:20 +0000 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 04e710c2-41cd-11ea-86b5-12813bfff9fa; Tue, 28 Jan 2020 12:52:20 +0000 (UTC) X-Inumbo-ID: 04e710c2-41cd-11ea-86b5-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1580215940; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=9e8MGA3QPhlOD4wDtQCnT7xfuSmvzNE6tgP6jdHgSrE=; b=VgDrQyBzHc6SI52wAoHKF4hCuJdARsjjvxqHvIyIBFpC8zUyJrFizFSY C8UmPyltu8tmC7HRtZHeh8Bdx2xuOAVfnKeOWZbwCY9vBdhBH42O7pUTP tP+SQYzqiK3O+pGpsOzA0RwJqEsj0rnV93W5wCOiMVUKv2cM7ucnBM7mP s=; Authentication-Results: esa1.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 (zohomail.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 (esa1.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=esa1.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa1.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=esa1.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 ip4:168.245.78.127 ~all" Received-SPF: None (esa1.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=esa1.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: U1B0b7/uW4NF+labMYCDXNo52JaU+gSIXivxMpUsqYUEOVHhFP1NGFsaJD4CutNcK9PiJGgoOh t+4iG5oeMbXu7v18QxPQjkQNubLbMpHGNaZ5Usz5oVMo7t2RcJBAa4P+DV/AIKiuFxUkIDDqDE SBDNfpvjJN78vr11N0NpG+dHp5FApkd2TvIX4KSOmkIhiIQdEbhRtBXIZNcwUJ4Z6bTME2H705 VMv+9/pcY3E83m4hakKr4ob+rc5NwXwFaNkCTYm1+xIARTJAff3Gm1EjFIBMGF0xFrLWa/IVXl 23w= X-SBRS: 2.7 X-MesageID: 11722675 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.70,373,1574139600"; d="scan'208";a="11722675" From: Andrew Cooper To: Xen-devel Date: Tue, 28 Jan 2020 12:52:16 +0000 Message-ID: <20200128125216.709-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Subject: [Xen-devel] [PATCH] x86/apic: Improve current_local_apic_mode() 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 , =?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) boot_cpu_has(X86_FEATURE_X2APIC) doesn't need checking to interpret APIC_BASE_EXTD. Also take the opportunity to optimise the generated assembly by not using rdmsrl(). GCC isn't clever enough to spot that it can drop the shift and or to put %eax in the higher half of msr_contents. No functional change. Signed-off-by: Andrew Cooper Reviewed-by: Wei Liu --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 What can I say - the numpty who wrote that code was young and naive... --- xen/arch/x86/apic.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c index a6a7754d77..0684c5d9c2 100644 --- a/xen/arch/x86/apic.c +++ b/xen/arch/x86/apic.c @@ -1534,18 +1534,14 @@ void __init record_boot_APIC_mode(void) /* Look at the bits in MSR_APIC_BASE and work out which APIC mode we are i= n */ enum apic_mode current_local_apic_mode(void) { - u64 msr_contents; + uint32_t high, low; =20 - rdmsrl(MSR_APIC_BASE, msr_contents); + rdmsr(MSR_APIC_BASE, low, high); =20 - /* Reading EXTD bit from the MSR is only valid if CPUID - * says so, else reserved */ - if ( boot_cpu_has(X86_FEATURE_X2APIC) && (msr_contents & APIC_BASE_EXT= D) ) + if ( low & APIC_BASE_EXTD ) return APIC_MODE_X2APIC; =20 - /* EN bit should always be valid as long as we can read the MSR - */ - if ( msr_contents & APIC_BASE_ENABLE ) + if ( low & APIC_BASE_ENABLE ) return APIC_MODE_XAPIC; =20 return APIC_MODE_DISABLED; --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel