From nobody Fri Apr 19 07:20:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=1565097322; cv=none; d=zoho.com; s=zohoarc; b=DMpHNYGgsko8/QXpr8hzqKiyrNB+bCPgEAfdbJ8K8ZRzOQiBWL0FSFky9HA26gbxoQRzLr12yJ5PP7TjUtqemPt/dhHq/61ikXmsvF5sXnD5pem54XsF6XOB0yIjec13MN8xSvSzQ+iSrjMLhWDIhkZonFJ4D+Mtd/zynRhOWqk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565097322; 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=L2Uinc/G0+thGTgq7ChzOb099Q1WVWPWNd28fqWNOpo=; b=nU1H6Z1dF52hsMVUksNfepmS6p9JHYljpwRrEVbGVZUkPlue3KCd4wOP22Iab9wPNxm1l7HH1RsCCMmedXS0ShTwjGLhXBKCwEOzXSHhg4UdylkwTsSMXrXmVS9sVeiFM0FEplcn5Vl78Us0zAh9NprU8av036ZQhAw6kesz8TM= ARC-Authentication-Results: i=1; mx.zoho.com; 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 1565097322024615.1144965757278; Tue, 6 Aug 2019 06:15:22 -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 1huzI6-00057Y-Ru; Tue, 06 Aug 2019 13:14:14 +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 1huzI5-00057S-3q for xen-devel@lists.xenproject.org; Tue, 06 Aug 2019 13:14:13 +0000 Received: from esa4.hc3370-68.iphmx.com (unknown [216.71.155.144]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 134184aa-b84c-11e9-b7c9-9710ebf7bdda; Tue, 06 Aug 2019 13:14:09 +0000 (UTC) X-Inumbo-ID: 134184aa-b84c-11e9-b7c9-9710ebf7bdda Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=roger.pau@citrix.com; spf=Pass smtp.mailfrom=roger.pau@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 (esa4.hc3370-68.iphmx.com: no sender authenticity information available from domain of roger.pau@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="roger.pau@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa4.hc3370-68.iphmx.com: domain of roger.pau@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="roger.pau@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 (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: hkI9n7x6IVE0lGqJ7xtXQ0h/ZOC1cD9MmTK/OCDeGbOTgXjYIB/5+5BqwjUapgVxPyQlMxnrQJ mr5xPWMIbaZRJb00UEcbZbmy/zyEas3Yqv/kuWK33uMgJw62/fZup3i4Cj41YmXHJheB3zTytW fVk8n2hO11AFwEOHmg45dM7KovDIkn2zQedKKx83+1qCqEl6SUvG6lrH0ZYi9Rco9zoF9T1A+X v0jq4VJG61owFI2frToB/57w7RlrML6QOkML0I6iqGMd+64YwUrDnhaeO7cluPlHzHZMmvSQtb iRA= X-SBRS: 2.7 X-MesageID: 4087361 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.64,353,1559534400"; d="scan'208";a="4087361" From: Roger Pau Monne To: Date: Tue, 6 Aug 2019 15:13:46 +0200 Message-ID: <20190806131346.50881-1-roger.pau@citrix.com> X-Mailer: git-send-email 2.20.1 (Apple Git-117) MIME-Version: 1.0 Subject: [Xen-devel] [PATCH] x86/apic: enable x2APIC mode before doing any setup 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 , Roger Pau Monne Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Current code calls apic_x2apic_probe which does some initialization and setup before having enabled x2APIC mode (if it's not already enabled by the firmware). This can lead to issues if the APIC ID doesn't match the x2APIC ID, as apic_x2apic_probe calls init_apic_ldr_x2apic_cluster which depending on the APIC mode might set cpu_2_logical_apicid using the APIC ID instead of the x2APIC ID (because x2APIC might not be enabled yet). Fix this by enabling x2APIC before calling apic_x2apic_probe. As a remark, this was discovered while I was trying to figure out why one of my test boxes didn't report any iommu faults. The root cause was that the iommu MSI address field was set using the stale value in cpu_2_logical_apicid, and thus the iommu fault interrupt would get lost. Even if the MSI address field gets sets to a correct value afterwards as soon as a single iommu fault is pending no further interrupts would get injected, so losing a single iommu fault interrupt is fatal. Signed-off-by: Roger Pau Monn=C3=A9 Reviewed-by: Jan Beulich --- Cc: Jan Beulich Cc: Andrew Cooper Cc: Wei Liu --- xen/arch/x86/apic.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c index 9c3c998d34..bd69299a27 100644 --- a/xen/arch/x86/apic.c +++ b/xen/arch/x86/apic.c @@ -952,17 +952,17 @@ void __init x2apic_bsp_setup(void) =20 force_iommu =3D 1; =20 - orig_name =3D genapic.name; - genapic =3D *apic_x2apic_probe(); - if ( genapic.name !=3D orig_name ) - printk("Switched to APIC driver %s\n", genapic.name); - if ( !x2apic_enabled ) { x2apic_enabled =3D true; __enable_x2apic(); } =20 + orig_name =3D genapic.name; + genapic =3D *apic_x2apic_probe(); + if ( genapic.name !=3D orig_name ) + printk("Switched to APIC driver %s\n", genapic.name); + restore_out: restore_IO_APIC_setup(ioapic_entries); unmask_8259A(); --=20 2.20.1 (Apple Git-117) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel