Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp542255ybv; Wed, 19 Feb 2020 04:38:31 -0800 (PST) X-Google-Smtp-Source: APXvYqynRTcmAUXFv8wI65sbNA9qdkrVc9suyZK75hwvg0yIQkgrrjIeeWrGQ/2G3lHQpu1WaZeW X-Received: by 2002:a9d:6415:: with SMTP id h21mr20319686otl.152.1582115911762; Wed, 19 Feb 2020 04:38:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582115911; cv=none; d=google.com; s=arc-20160816; b=KU77IZKW97tusvBxBywOVLbCrCnJiRT68fVoL/cVROKvc2RSuxPpUCb7qSRJnz1u8/ 0EDT9xTOpxeNTDYQ4XtsXYeQr2guIlcsd6H199557s3nMFkrFcLim4LqRvqxFc69cMHq fVSKg66zmirgWVVjIV9fRK0WiJpk47N36e3hcAW7LGGLWr7vd/P4y4qFqYLD1Q1gauUp YA+7XKwXquSw4h86m4/N4b3NLV9vDPvQlgq5/IMEbPPOLIZvF2rFf+qcjynaXCpb+V9Z gH1MhkyDKa5Xnl058BApGOtqROg2oKE/r2JMkRaNvMn3SLfXnHL8ui2WK4mkzbLgjZh8 kGSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:ironport-sdr:dkim-signature; bh=3J0RXEDb2tkW1/Hk7Xf6P+EM9BZ5QX0HNFhhR5F8K5M=; b=pPvGUWBR9bN4cnJP0fzY7QyCc4UOI202jqDUQGjvnv9mb16K0/ky+uOGMGtkHbvnHG duV9jqG2z3VUYQk5P0VD5WtGjOesXfqVREpbT+BdDBI8JhojGcB5+xWn+2EffKV0Mxij x35MZC0fGtBTh1yjiRDQLMJrmOc25V5d636MFHjppYHN9Bgzt2/TCEJSoJm+zlyDAgZq jndx/yGmxIJ9xyvg7Ri3LMG+rfo38ovIYaBqwy4VyAYBM++Dv5u9qPieW7zXvAyE23fv Sw5hGEd2Ett6d5+/+wykx00cg/qVUBrugUkYhrNy8POopP4Xc8GibgUoghBAIZu4KTYh p6HQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@citrix.com header.s=securemail header.b=CEu3mgWB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=citrix.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b25si937732otp.212.2020.02.19.04.38.19; Wed, 19 Feb 2020 04:38:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@citrix.com header.s=securemail header.b=CEu3mgWB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=citrix.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727515AbgBSMg6 (ORCPT + 99 others); Wed, 19 Feb 2020 07:36:58 -0500 Received: from esa6.hc3370-68.iphmx.com ([216.71.155.175]:32890 "EHLO esa6.hc3370-68.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726491AbgBSMg6 (ORCPT ); Wed, 19 Feb 2020 07:36:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1582115817; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=ZFzrsgGEDLdDHsaAdA2qnmA/Otq0a3WgQ/LpC+0goKw=; b=CEu3mgWBAQy0Giz5hI5aTtYNh9FyN2Qtp0kcXKp0zosPD/ufeyidrGlY m1CCDyc9gq9yCKR6lrzQtmsCnT/uOlbNnPPghfoo28WVg5dPsn9zHOPCQ M/7yinDqaF/OieGvdyWOWhze2tpkZke7aIp5VCV6tLaGw4CusXoCNMs8j 0=; Authentication-Results: esa6.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 (esa6.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=esa6.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="roger.pau@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa6.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=esa6.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 ip4:168.245.78.127 ~all" Received-SPF: None (esa6.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=esa6.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: tnUfDhP4e2p7Q2n1elIja5IhdwOoGnF1wvHIpSp95jBsQFp8pLeuLw4Vyw6/MHNUJlhhBnM01d rkwZlrL525giRJuGaPYUIT4YGOWk3cFXL5njZfn0rptQR9VNV+QW9RiPSYLPrdHv9UA7uO6+Hl 5IWQBSVeF9KOtMwTu1ASeWCTgWoPdJVC+EwQryBGMqZQ4YIEoYvZ5MgBpynhCBiRBq60wni0cC m3iNnE3OrkrjrNHbN2B4hPop7HYcNQAX5Psd2rMm10wUeCwx6XvRjr2dVOyfofMb4NbfJoo+33 wDk= X-SBRS: 2.7 X-MesageID: 13116697 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.70,459,1574139600"; d="scan'208";a="13116697" Date: Wed, 19 Feb 2020 13:36:50 +0100 From: Roger Pau =?utf-8?B?TW9ubsOp?= To: CC: Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , , Peter Zijlstra , Tony Luck , Jacob Pan , Kefeng Wang , Jan Beulich , "Sean Christopherson" Subject: Re: [PATCH] x86/apic: simplify disconnect_bsp_APIC setup of LVT{0/1} Message-ID: <20200219123650.GL3886@Air-de-Roger> References: <20200127175758.82410-1-roger.pau@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200127175758.82410-1-roger.pau@citrix.com> X-ClientProxiedBy: AMSPEX02CAS02.citrite.net (10.69.22.113) To AMSPEX02CL01.citrite.net (10.69.22.125) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Ping? On Mon, Jan 27, 2020 at 06:57:58PM +0100, Roger Pau Monne wrote: > There's no need to read the current values of LVT{0/1} for the > purposes of the function, which seem to be to save the currently > selected vector: in the destination modes used (ExtINT and NMI) the > vector field is ignored and hence can be set to 0. > > Note that clear_local_APIC as called by init_bsp_APIC would have > already wiped those registers by writing APIC_LVT_MASKED, and hence > there's nothing useful to preserve if that was the intent. Also note > that there are other places where LVT{0/1} is written to without doing > a read-modify-write (init_bsp_APIC and clear_local_APIC), so if > writing 0s to the reserved parts would cause issues they would be also > triggered by writes elsewhere. > > Signed-off-by: Roger Pau Monné > --- > Cc: Thomas Gleixner > Cc: Ingo Molnar > Cc: Borislav Petkov > Cc: "H. Peter Anvin" > Cc: x86@kernel.org > Cc: Peter Zijlstra > Cc: Tony Luck > Cc: Jacob Pan > Cc: Kefeng Wang > Cc: Jan Beulich > Cc: Sean Christopherson > --- > arch/x86/kernel/apic/apic.c | 14 ++------------ > 1 file changed, 2 insertions(+), 12 deletions(-) > > diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c > index 28446fa6bf18..ce0c65340b4c 100644 > --- a/arch/x86/kernel/apic/apic.c > +++ b/arch/x86/kernel/apic/apic.c > @@ -2292,12 +2292,7 @@ void disconnect_bsp_APIC(int virt_wire_setup) > * For LVT0 make it edge triggered, active high, > * external and enabled > */ > - value = apic_read(APIC_LVT0); > - value &= ~(APIC_MODE_MASK | APIC_SEND_PENDING | > - APIC_INPUT_POLARITY | APIC_LVT_REMOTE_IRR | > - APIC_LVT_LEVEL_TRIGGER | APIC_LVT_MASKED); > - value |= APIC_LVT_REMOTE_IRR | APIC_SEND_PENDING; > - value = SET_APIC_DELIVERY_MODE(value, APIC_MODE_EXTINT); > + value = APIC_LVT_REMOTE_IRR | APIC_SEND_PENDING | APIC_DM_EXTINT; > apic_write(APIC_LVT0, value); > } else { > /* Disable LVT0 */ > @@ -2308,12 +2303,7 @@ void disconnect_bsp_APIC(int virt_wire_setup) > * For LVT1 make it edge triggered, active high, > * nmi and enabled > */ > - value = apic_read(APIC_LVT1); > - value &= ~(APIC_MODE_MASK | APIC_SEND_PENDING | > - APIC_INPUT_POLARITY | APIC_LVT_REMOTE_IRR | > - APIC_LVT_LEVEL_TRIGGER | APIC_LVT_MASKED); > - value |= APIC_LVT_REMOTE_IRR | APIC_SEND_PENDING; > - value = SET_APIC_DELIVERY_MODE(value, APIC_MODE_NMI); > + value = APIC_LVT_REMOTE_IRR | APIC_SEND_PENDING | APIC_DM_NMI; > apic_write(APIC_LVT1, value); > } > > -- > 2.25.0 >