Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2467588yba; Mon, 15 Apr 2019 12:15:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqycCdaCxB1FYtpwuU5dgRIypXqLM3UU6hFvspfCkIwcOhM8XPxlbn6wNf1warG7xvjJVz0o X-Received: by 2002:a63:4241:: with SMTP id p62mr72134901pga.379.1555355722534; Mon, 15 Apr 2019 12:15:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555355722; cv=none; d=google.com; s=arc-20160816; b=mncpMLLLBdhRxC4QN/r9dov+/zL4xJq4rRz/26xGtlLFVW76s5MUfV5ai6IStT4X0L Rr1wz9X9xcxckFbTDg6UMeV8PKDOMN88nk/Z6z1LYpDVBQTCvZE355EMi14LoqbzEN/t gHVVO6QQGLYd8zXWBlTk4Og319v2zlzvAmSOy5FxNfx53MuzPOEUqXAV4FunPrLY7FLf acDntvSLGzr4ZHlFWj2xrK3jslBqKUHnhm/f4CSRp1yDCxGhp9EoyXIB9diwomn0RVKS Jgb0lqEi9rMv9F09yLMA0ubv1IawS/PIHchYHGTw9jzjLYdGib19zC6fjQ/aNmlDK9vj 0o9w== 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=so49pnyTgrXkR/RfbaylH/vdaS0eNM88xkK89Rwh2Xg=; b=zAcLsWy+CBrKMuz0LcObFreC5TNyDhkalQeX8Qja/NvkFoxdk3yiLrkz4VzfAvRqRA mqV6NvaHVKiZzL3O4GB4m2uUH7JUMiEe1byfik0sDXGpL3JwDu7l0uvXeXzOQDUJyuG9 WXRsoq1Zd4XmP0kRurfI8HarK+YozrYDt4VCbpwa4wfzswVdHC2sqtcsV5+WeXn51lj1 580amBhIJRZgB5B+tJzu7OMRUPXOLyYxU4aN5W7j2+eVQJyOyx3f9H7Y9hcAcNRYd6Iq aOKsUMh6mWdTZ5TUpJrMeU1haJLkiAel+alPieci8Sur/tbnf/2qXbDvPlIXkz9t/dm3 /cnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=v3neYJCS; 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 a17si25187325pfn.95.2019.04.15.12.15.05; Mon, 15 Apr 2019 12:15:22 -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=v3neYJCS; 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 S1731636AbfDOTNt (ORCPT + 99 others); Mon, 15 Apr 2019 15:13:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:51796 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730478AbfDOTNr (ORCPT ); Mon, 15 Apr 2019 15:13:47 -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 CB29721906; Mon, 15 Apr 2019 19:13:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555355627; bh=4q2dI5ZE8EpVbnWlxW/BPlgtj+tnDTeQnfqI5mML2Pk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v3neYJCSD7dX//LBwG7X1IORyaMmbSZgGLOQTPBtZuj647j5DiXMJNdqty8qL3AyC 6r6nMZ1DDeA6sFVNpT5sFHuOcNXSrjOPml7qzvpoSwliVdPXRqBGvwrMXWrzNx2hcY dcoHrxDcPQuaa9VVijkFid4/b/0lMECr23CswQD4= 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 5.0 107/117] PCI: pciehp: Ignore Link State Changes after powering off a slot Date: Mon, 15 Apr 2019 21:01:17 +0200 Message-Id: <20190415183750.195796084@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190415183744.887851196@linuxfoundation.org> References: <20190415183744.887851196@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 @@ -115,6 +115,10 @@ static void remove_board(struct controll * 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 */