Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2463093yba; Mon, 15 Apr 2019 12:10:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqwpi/hbRuLgKzwH3RHiO78036qA9XMvYkEer9MNXBDpnLDF10LxnLI1g17mtbuFZVnU+djQ X-Received: by 2002:a63:6907:: with SMTP id e7mr62439479pgc.209.1555355413758; Mon, 15 Apr 2019 12:10:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555355413; cv=none; d=google.com; s=arc-20160816; b=R+xBKUz5LqrU9yBByR5oQnREP3XGoa5xpDcdMRBHyyaZMpK31Ysw/VEYdlZVljq0J7 RwGMcp0zcpmoWJ5rdXPLHILOMRykuBpW8MKk2KOTUMK2YcQYSOmQ8AEZiYhbrUlElbA1 yQp0fQ2qjkkJ3pudEihARdhb/0cLYRTF1IUDaZ7RDP3KPABIbTdYLx2j45yxLYDig5cO 8jAdD0H5r+iuKSnv6E980XZcPKCDpGsp2BOS3phOIkHcbygA4OnjtIyrE28jI+lgC9P5 44nzl/6Edg+0P5TGfsAlfqPzhrDRVFpWtfs6Ktx3iGgxE04mNzw1sHgyiW4Fg/lN+oDf Cj/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=U5EiIVjAQy0PHizGoKPVWUqfRRKauz4ynhqJlxf7XZ4=; b=iwgAPhnjDWWDRl0ZfrOzi6bZWQ2tfddquYylfEdWq2kJ57jZD9Uebv6YsUUz2Wan/Q JYzLq0/QFRMEfAClieGyXLKbVn+ScxktHxwDwHmP6iGk4HDQi51MYHqvNtmSDW0MvfKo eU0hJ+zsFgH4wg+cAkET6j0Xf/urYu7GBQh+AfOL8IiyWxmStYsX9+UyOFNotGxKBf5u 1/6d7z95L+JJ7vjdktWz9oz2atArvoKwghjk4zTsk+EMxF4oa6LEy+sjtn+mAMGaz5Ir 2BU2KifkjmbAx8moGxP3uDCHiVZ+JUAQGnWs5VALxpGlLSHzt6WHZuBwArXp/jGa7X9c 4DLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="FRS/6op0"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f191si44615538pgc.570.2019.04.15.12.09.57; Mon, 15 Apr 2019 12:10:13 -0700 (PDT) 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=pass header.i=@kernel.org header.s=default header.b="FRS/6op0"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730517AbfDOTIi (ORCPT + 99 others); Mon, 15 Apr 2019 15:08:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:44090 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730500AbfDOTIf (ORCPT ); Mon, 15 Apr 2019 15:08:35 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AFE6920880; Mon, 15 Apr 2019 19:08:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555355315; bh=zgKO8f0vcTqT5wsVvqDgxtIkRZEZy4VoRLP///CsgQM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FRS/6op0XwwThhBTw8LLx2KFk0DausgSaxQSZIEP5AEl4PB6aktHeFhWFMUxjVBBn p3TEEgPEXZLLVJ2aCCEJhP+oNap5fjCAqqJ7qkUC0+/5hiH+ebRxJ9ByU0Oy1ZW0VA dGBuIuP6a8CN7aPYfMC6VAXnaQpv3x+zOy/NoQQk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Micah Parrish , Sergey Miroshnichenko , Bjorn Helgaas , Lukas Wunner Subject: [PATCH 4.19 092/101] PCI: pciehp: Ignore Link State Changes after powering off a slot Date: Mon, 15 Apr 2019 20:59:30 +0200 Message-Id: <20190415183745.238600302@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190415183740.341577907@linuxfoundation.org> References: <20190415183740.341577907@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sergey Miroshnichenko commit 3943af9d01e94330d0cfac6fccdbc829aad50c92 upstream. During a safe hot remove, the OS powers off the slot, which may cause a Data Link Layer State Changed event. The slot has already been set to OFF_STATE, so that event results in re-enabling the device, making it impossible to safely remove it. Clear out the Presence Detect Changed and Data Link Layer State Changed events when the disabled slot has settled down. It is still possible to re-enable the device if it remains in the slot after pressing the Attention Button by pressing it again. Fixes the problem that Micah reported below: an NVMe drive power button may not actually turn off the drive. Link: https://bugzilla.kernel.org/show_bug.cgi?id=203237 Reported-by: Micah Parrish Tested-by: Micah Parrish Signed-off-by: Sergey Miroshnichenko [bhelgaas: changelog, add bugzilla URL] Signed-off-by: Bjorn Helgaas Reviewed-by: Lukas Wunner Cc: stable@vger.kernel.org # v4.19+ Signed-off-by: Greg Kroah-Hartman --- drivers/pci/hotplug/pciehp_ctrl.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/pci/hotplug/pciehp_ctrl.c +++ b/drivers/pci/hotplug/pciehp_ctrl.c @@ -117,6 +117,10 @@ static void remove_board(struct slot *p_ * removed from the slot/adapter. */ msleep(1000); + + /* Ignore link or presence changes caused by power off */ + atomic_and(~(PCI_EXP_SLTSTA_DLLSC | PCI_EXP_SLTSTA_PDC), + &ctrl->pending_events); } /* turn off Green LED */