Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp4897074ima; Tue, 5 Feb 2019 03:09:39 -0800 (PST) X-Google-Smtp-Source: AHgI3IZ2sEyQt3Hh77J4gut/DCzG49EVz2h/kPP+Rz1YP42V7jhNKMBxx6oceprjFem6kBedwMlJ X-Received: by 2002:a63:e74e:: with SMTP id j14mr4039419pgk.449.1549364978974; Tue, 05 Feb 2019 03:09:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549364978; cv=none; d=google.com; s=arc-20160816; b=IeuIk8fkRVsulxVVTLMf+twOoQ1VsyGwt6IssIpiRCZOLjYJ/li7S8H3+zQLM2QVtM 8P79BDs+hR9523gKOYH4cC8WLr50mQ89uMod3XKJGG/10j/2MB5+f+5vmEtHlw0Y6QXt PHnxkO6WreiEwrtYwiuG9XlzgBoNjBy9mHIvvdMceaXfnS+ZNQj7Gw4OzXCJ9iKJN6x2 UjzubKvuB1GZM92pHVX7UaaI6DA0sAH1WuVkS9o5QHQM4smwg4TF/ZOh2nc9k/XnOGvR Irfi9I0+A1K28ZkR8EBU4/qpPhRaxEs64Ut8S+oSQPyRiJ5yHZ7hhChl+naFHiD/7RU+ Kglw== 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 :message-id:date:subject:cc:to:from; bh=Hw0dXjTA1GmYKcf3AmKybqhUqSVWFoetY/F9Z8S5kC0=; b=X4Estt4X4YbwbvfmSWrDjkwfZnL5LnYmb4d/VU3Pj56zYJg6LpchYwFyx7cAJM4oiJ RdurZCenUmWyItrtTgfdb9vuJ0UfvE1A2y0b1D+4sjl+cGN22YHhrqsBMYNNXgjxhXWC wOpNKQtcojTQbQJTJPnWA40dtR4LHbzk1i0lqhKpZLlFO1NbuyABvGdaTwO8OQHlb24n 0E7GWEmElvPMswS4pujm1sd+9vAIpgK2hiBa4+jcOl9ScdofwfCPYYaKxZuOBq8is33K vqW6trIvtPbTZ1X5/Tj8OE5DD6XA3cJMR6Sqz9MJt9/oWlbg3G++ct3BaT/pjoMuqz/0 BUMQ== ARC-Authentication-Results: i=1; mx.google.com; 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 x191si1656791pfd.220.2019.02.05.03.09.22; Tue, 05 Feb 2019 03:09:38 -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; 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 S1728674AbfBELHf (ORCPT + 99 others); Tue, 5 Feb 2019 06:07:35 -0500 Received: from relay2-d.mail.gandi.net ([217.70.183.194]:59851 "EHLO relay2-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728419AbfBELHe (ORCPT ); Tue, 5 Feb 2019 06:07:34 -0500 X-Originating-IP: 90.88.147.226 Received: from localhost.localdomain (aaubervilliers-681-1-27-226.w90-88.abo.wanadoo.fr [90.88.147.226]) (Authenticated sender: miquel.raynal@bootlin.com) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id D3ECA40003; Tue, 5 Feb 2019 11:07:29 +0000 (UTC) From: Miquel Raynal To: Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" Cc: netdev@vger.kernel.org, , Thomas Petazzoni , Gregory Clement , Antoine Tenart , Maxime Chevallier , Nadav Haklai , Miquel Raynal Subject: [PATCH net-next v3] net: dsa: mv88e6xxx: Prevent suspend to RAM Date: Tue, 5 Feb 2019 12:07:28 +0100 Message-Id: <20190205110728.11451-1-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On one hand, the mv88e6xxx driver has a work queue called in loop which will attempt register accesses after MDIO bus suspension, that entirely freezes the platform during suspend. On the other hand, the DSA core is not ready yet to support suspend to RAM operation because so far there is no way to recover reliably the switch configuration. To avoid the kernel to freeze when suspending with a switch driven by the mv88e6xxx driver, we choose to prevent the driver suspension and in the same way, the whole platform. Signed-off-by: Miquel Raynal --- Changes since v1/v2 =================== * After having discussed with Vivien and Andrew, it seems that preventing the mv88e6xxx driver to suspend is the best option we have as of today. I removed the code saving the switch rules at driver level, I forgot about saving them at DSA level, so here are just two dummy PM hooks that prevent suspension. For people interested in picking-up what has been written and continue working on it, my initial proposal is available there: https://lore.kernel.org/netdev/20190130104606.31639abb@xps13/T/ drivers/net/dsa/mv88e6xxx/chip.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index 8a517d8fb9d1..28764d6d7388 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -4651,6 +4651,21 @@ static const void *pdata_device_get_match_data(struct device *dev) return NULL; } +/* There is no suspend to RAM support at DSA level yet, the switch configuration + * would be lost after a power cycle so prevent it to be suspended. + */ +static int __maybe_unused mv88e6xxx_suspend(struct device *dev) +{ + return -EOPNOTSUPP; +} + +static int __maybe_unused mv88e6xxx_resume(struct device *dev) +{ + return 0; +} + +static SIMPLE_DEV_PM_OPS(mv88e6xxx_pm_ops, mv88e6xxx_suspend, mv88e6xxx_resume); + static int mv88e6xxx_probe(struct mdio_device *mdiodev) { struct dsa_mv88e6xxx_pdata *pdata = mdiodev->dev.platform_data; @@ -4835,6 +4850,7 @@ static struct mdio_driver mv88e6xxx_driver = { .mdiodrv.driver = { .name = "mv88e6085", .of_match_table = mv88e6xxx_of_match, + .pm = &mv88e6xxx_pm_ops, }, }; -- 2.19.1