From patchwork Thu Apr 21 17:39:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evan Green X-Patchwork-Id: 564755 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B2B9C433EF for ; Thu, 21 Apr 2022 17:40:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1390838AbiDURnC (ORCPT ); Thu, 21 Apr 2022 13:43:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1390878AbiDURmn (ORCPT ); Thu, 21 Apr 2022 13:42:43 -0400 Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC8F0CD3 for ; Thu, 21 Apr 2022 10:39:52 -0700 (PDT) Received: by mail-pf1-x42a.google.com with SMTP id h1so5628034pfv.12 for ; Thu, 21 Apr 2022 10:39:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=aKecDjOh5Hsplgo3DwsxBvjIajRQbWHRMhevzw1bna0=; b=V1hn+scp77WcFmcQyhATr12t5sJq4J1DqwAVjnLg2GNWFaQ3UqKuxkSvEbEuYa3hT1 zwWEQeajgdxjNLgebPYSy3rcnmBWGCJW582DzbymfSaPKVf7POKOqMcPOxOiBoeZP+/5 yto7g2zpFJqGNlDImmXh37tO7Fycv1DC2LAS4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aKecDjOh5Hsplgo3DwsxBvjIajRQbWHRMhevzw1bna0=; b=lRoCH95bn45m6n0K1M+vncMYj9fKgZ237jfuUzVPnSGz66vtnHzpAIdozlUS+4/gTv wx3Y8p86ea9bLsHgcw1hkgbzjFff/MxhmubLvZNlRdmUn7FYsmv+zhQY8/2Xh0UHqXA4 SnlFeB5KLhNDuB4sAbuMOq367XG8O3nQK4IyZfF2SXIB94HFHl/dy6To8baDe35Nnr7p T7nuhP3jx7xh8EFHhqRbwKjJvsbZqOdIf7tWf+LCyc3JaqmlzuLkXrfg6KpeTne4VVH8 ts6pn2PYamWfvm5vq7jseyAFdim5Xe2ygCekxemdwp4n7AdA2Lf9xsdSrLveZMdDTjND hLTQ== X-Gm-Message-State: AOAM530IGedzMknOhaeAjscDcikNqoQmI+l6Ppx6PtWrdcHLqH7oIuAs YnVQW6woiWqzjQo7k1wVENAQaA== X-Google-Smtp-Source: ABdhPJwL9UaE6eRPcDU5xb21DeZNmyYxJSDhh/o1itNcLlstR4zRSUJ8oF7krQ403Wz/UTPLZOlAjw== X-Received: by 2002:a05:6a00:856:b0:50a:431b:c298 with SMTP id q22-20020a056a00085600b0050a431bc298mr694589pfk.75.1650562792542; Thu, 21 Apr 2022 10:39:52 -0700 (PDT) Received: from evgreen-glaptop.lan ([98.47.98.87]) by smtp.gmail.com with ESMTPSA id j6-20020a63b606000000b003808b0ea96fsm23237023pgf.66.2022.04.21.10.39.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 10:39:52 -0700 (PDT) From: Evan Green To: Greg Kroah-Hartman Cc: Mathias Nyman , Alan Stern , Rajat Jain , Oliver Neukum , Thomas Gleixner , Evan Green , Bjorn Helgaas , "Rafael J. Wysocki" , Youngjin Jang , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Subject: [PATCH v3 2/2] USB: hcd-pci: Fully suspend across freeze/thaw cycle Date: Thu, 21 Apr 2022 10:39:27 -0700 Message-Id: <20220421103751.v3.2.I8226c7fdae88329ef70957b96a39b346c69a914e@changeid> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20220421173927.2845967-1-evgreen@chromium.org> References: <20220421173927.2845967-1-evgreen@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org The documentation for the freeze() method says that it "should quiesce the device so that it doesn't generate IRQs or DMA". The unspoken consequence of not doing this is that MSIs aimed at non-boot CPUs may get fully lost if they're sent during the period where the target CPU is offline. The current callbacks for USB HCD do not fully quiesce interrupts, specifically on XHCI. Change to use the full suspend/resume flow for freeze/thaw to ensure interrupts are fully quiesced. This fixes issues where USB devices fail to thaw during hibernation because XHCI misses its interrupt and cannot recover. Signed-off-by: Evan Green Acked-by: Alan Stern --- (no changes since v2) Changes in v2: - Removed the change to freeze_noirq/thaw_noirq drivers/usb/core/hcd-pci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c index 8176bc81a635d6..ae5e6d572376be 100644 --- a/drivers/usb/core/hcd-pci.c +++ b/drivers/usb/core/hcd-pci.c @@ -616,10 +616,10 @@ const struct dev_pm_ops usb_hcd_pci_pm_ops = { .suspend_noirq = hcd_pci_suspend_noirq, .resume_noirq = hcd_pci_resume_noirq, .resume = hcd_pci_resume, - .freeze = check_root_hub_suspended, + .freeze = hcd_pci_suspend, .freeze_noirq = check_root_hub_suspended, .thaw_noirq = NULL, - .thaw = NULL, + .thaw = hcd_pci_resume, .poweroff = hcd_pci_suspend, .poweroff_noirq = hcd_pci_suspend_noirq, .restore_noirq = hcd_pci_resume_noirq,