From nobody Mon Feb 9 19:07:53 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1610752302; cv=none; d=zohomail.com; s=zohoarc; b=V3Yy7oevt3uDP5jLRFpZDLvj+maOh9DdJ1c+dGt6Nxkimf9RskpSEy3Jz/BRKfJ6yNjJF67kEFGmYy3Fb7DkkIXe5PB4BKuileAEixqSGBhuPAZZxrSl8ZKtYMNyaOXNQ0NsQ2xTE//d1hSjtwq65IZxhHrHtzzNsafLZAEYmWY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610752302; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=+PnXmWUic6OceZumP9NZVspgKxHCKse51XUoaM/mqqg=; b=LcDBgR6ixT7kZAlXzDHx+Il7bfSQobfaUTw2j11tCjR78Rg0rOnZlsulEYJadhHhsaRHQd9FovVYDn96FPchcEWReWEQpt3iSLJot5tGKXd9WmMYk8SKmhAo1YTzF8DuKl7Op+rZx/2NScrQwuYTnjdgJnCUfQ+57ESp4S/+t60= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 16107523024241004.5476921702467; Fri, 15 Jan 2021 15:11:42 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.68829.123332 (Exim 4.92) (envelope-from ) id 1l0YFL-0005vt-PR; Fri, 15 Jan 2021 23:11:11 +0000 Received: by outflank-mailman (output) from mailman id 68829.123332; Fri, 15 Jan 2021 23:11:11 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1l0YFL-0005vm-Kl; Fri, 15 Jan 2021 23:11:11 +0000 Received: by outflank-mailman (input) for mailman id 68829; Fri, 15 Jan 2021 23:11:10 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1l0YFK-0005vh-Gk for xen-devel@lists.xenproject.org; Fri, 15 Jan 2021 23:11:10 +0000 Received: from esa5.hc3370-68.iphmx.com (unknown [216.71.155.168]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 45cce534-f808-470b-90a9-362a30d291b2; Fri, 15 Jan 2021 23:11:09 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 45cce534-f808-470b-90a9-362a30d291b2 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1610752269; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dXS/3Rq9xVyxzLPRXvqV3AmMCV9sf33JIKkKChDLoGg=; b=blccXMiCyvHaDnAQHGK2DTidJzZEjaYtKx+YaMOrouHXMf64tntRSgN1 Pj1J8pX4MVFGWuix2LQlm//8b7ZzBQiLcrIXJWxFAvjnOzIFONLfu5PNU EDnZwrsugVO0S1lsyWDuyMCHXGyvP3BVuWilcqAWvHoD8FY4Kivclg+Cu c=; Authentication-Results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: uqeMXLqjdoNfVtZrUpv2fgraaZMjdZdyYMgYwj/wMu2Iw9OOwcdLIDBgPiwg9nesudjW+R8UR2 iRm7pIBHkGQcB6CY7h+td6xlXiKVrPOZS2/c2c92rBNIMzrAMR0xPSvksUkLUKhx229BrYl3QU w3l1XJZybR7fJX/1ShELp6QMq/ohMW7VyVdPZaZVLXulGszGWz2lzUYZHxrgmnL9CR7F4W+IWI 2uCKE4yy+yEWLVXpJ3E4opkYTvBmVwiZlRFQBJZOr/hBKFLVJsrZ4BHnFcWMfTZPAEtYidCWQh ZyE= X-SBRS: 5.1 X-MesageID: 35207499 X-Ironport-Server: esa5.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.79,350,1602561600"; d="scan'208";a="35207499" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu , Marek Kasiewicz , =?UTF-8?q?Norbert=20Kami=C5=84ski?= , Michal Zygowski , Piotr Krol , Krystian Hebel , "Daniel P . Smith" , Rich Persaud , Christopher Clark Subject: [PATCH 2/3] x86/smpboot: Allow making an INIT IPI conditional Date: Fri, 15 Jan 2021 23:10:45 +0000 Message-ID: <20210115231046.31785-3-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20210115231046.31785-1-andrew.cooper3@citrix.com> References: <20210115231046.31785-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) A subsequent change is going to introduce SKINIT support, wherein the APs w= ill be already be in the wait-for-SIPI state, and an INIT must not be sent. Introduce a send_INIT boolean, so we can control sending an INIT IPI separately from sending SIPIs. No functional change. Signed-off-by: Andrew Cooper Acked-by: Roger Pau Monn=C3=A9 --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Wei Liu CC: Marek Kasiewicz CC: Norbert Kami=C5=84ski CC: Michal Zygowski CC: Piotr Krol CC: Krystian Hebel CC: Daniel P. Smith CC: Rich Persaud CC: Christopher Clark --- xen/arch/x86/smpboot.c | 78 ++++++++++++++++++++++++++--------------------= ---- 1 file changed, 41 insertions(+), 37 deletions(-) diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c index 9eca452ce1..195e3681b4 100644 --- a/xen/arch/x86/smpboot.c +++ b/xen/arch/x86/smpboot.c @@ -424,6 +424,7 @@ static int wakeup_secondary_cpu(int phys_apicid, unsign= ed long start_eip) { unsigned long send_status =3D 0, accept_status =3D 0; int maxlvt, timeout, i; + bool send_INIT =3D true; =20 /* * Some versions of tboot might be able to handle the entire wake sequ= ence @@ -438,49 +439,52 @@ static int wakeup_secondary_cpu(int phys_apicid, unsi= gned long start_eip) apic_write(APIC_ESR, 0); apic_read(APIC_ESR); =20 - Dprintk("Asserting INIT.\n"); + if ( send_INIT ) + { + Dprintk("Asserting INIT.\n"); =20 - /* - * Turn INIT on target chip via IPI - */ - apic_icr_write(APIC_INT_LEVELTRIG | APIC_INT_ASSERT | APIC_DM_INIT, - phys_apicid); + /* + * Turn INIT on target chip via IPI + */ + apic_icr_write(APIC_INT_LEVELTRIG | APIC_INT_ASSERT | APIC_DM_INIT, + phys_apicid); =20 - if ( !x2apic_enabled ) - { - Dprintk("Waiting for send to finish...\n"); - timeout =3D 0; - do { - Dprintk("+"); - udelay(100); - send_status =3D apic_read(APIC_ICR) & APIC_ICR_BUSY; - } while ( send_status && (timeout++ < 1000) ); + if ( !x2apic_enabled ) + { + Dprintk("Waiting for send to finish...\n"); + timeout =3D 0; + do { + Dprintk("+"); + udelay(100); + send_status =3D apic_read(APIC_ICR) & APIC_ICR_BUSY; + } while ( send_status && (timeout++ < 1000) ); =20 - mdelay(10); + mdelay(10); =20 - Dprintk("Deasserting INIT.\n"); + Dprintk("Deasserting INIT.\n"); =20 - apic_icr_write(APIC_INT_LEVELTRIG | APIC_DM_INIT, phys_apicid); + apic_icr_write(APIC_INT_LEVELTRIG | APIC_DM_INIT, phys_apicid); =20 - Dprintk("Waiting for send to finish...\n"); - timeout =3D 0; - do { - Dprintk("+"); - udelay(100); - send_status =3D apic_read(APIC_ICR) & APIC_ICR_BUSY; - } while ( send_status && (timeout++ < 1000) ); - } - else if ( tboot_in_measured_env() ) - { - /* - * With tboot AP is actually spinning in a mini-guest before - * receiving INIT. Upon receiving INIT ipi, AP need time to VMExit, - * update VMCS to tracking SIPIs and VMResume. - * - * While AP is in root mode handling the INIT the CPU will drop - * any SIPIs - */ - udelay(10); + Dprintk("Waiting for send to finish...\n"); + timeout =3D 0; + do { + Dprintk("+"); + udelay(100); + send_status =3D apic_read(APIC_ICR) & APIC_ICR_BUSY; + } while ( send_status && (timeout++ < 1000) ); + } + else if ( tboot_in_measured_env() ) + { + /* + * With tboot AP is actually spinning in a mini-guest before + * receiving INIT. Upon receiving INIT ipi, AP need time to VM= Exit, + * update VMCS to tracking SIPIs and VMResume. + * + * While AP is in root mode handling the INIT the CPU will drop + * any SIPIs + */ + udelay(10); + } } =20 maxlvt =3D get_maxlvt(); --=20 2.11.0