From patchwork Thu Nov 19 22:49:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 328469 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:5ce:0:0:0:0 with SMTP id l14csp817942ils; Thu, 19 Nov 2020 14:51:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJzHw1/OeGWGKAKzpZJDrF26QqKtzvaGo8GeZBulGPWLvJR0atSQxnZ+uc3I8/f1g/qWParZ X-Received: by 2002:aa7:d493:: with SMTP id b19mr31528248edr.279.1605826271372; Thu, 19 Nov 2020 14:51:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605826271; cv=none; d=google.com; s=arc-20160816; b=Xg+iIBs8he7MqrgOv7dYA4I/A9y5XvAsLHo+OM3X9sDoQGOq451KpeDMAg7wUx6nml gdG8311RZxmUHw/6DNWCZJVgXAU+skBSdgJzKGmkXd05eny7V68d1IKuAVULGTYcsNrr sO93wkEYo+11XfkK57oIZUjXuNitf0WTiSkznm7oWK2DhEZPX95bkEPamsoxm4Eq0Yk2 Rc5/XPguf3DX//0eYVMeRj5/hfzVPWMxjdYd5AAxPqT0l1NXBNcuK2qZ8KynhT9zibZI kaUbWfE8kq90//AYroVprHNSsAOio4ZpxCMDn3m9KXX7qDmatZ8y5s6l2DSyiom0YonU RxrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=bo4MSwJ0tFuIkBE6whS0DGZ/BGwfpkBFnKgHt6nK9mc=; b=NW80P96nlKTjMiqj3tCEFVrG/qebLUZsw/WEBtlAKz20UVSlZnQpXVlItiphsxuPtA NbU+P8eDjpFUhs0/2049jA9iXkS/KT5/a1qtsx7ujDVZfiSFFc3EU6uAbkoDIuE3lzVi WksEGWqXyi/lklISU1dEkHwqrGGYTVm9iXg/x2HdWVGv905ojEk9tdIJzmvyXtlQzMcG jtkujcLItscnYssA/Lc9voLyZggrakZu/jZ6gkl6XOjqwUD7jvcuAtAiyUiEZSPbF4VH hzEU/MCiiFv8uGiTr2DVVaGhLawPUck1WUFNsfKKTmbGBJ2C2Q1QtxIK9MlFT9F24O8u QAaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LW7B1p54; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hq14si545910ejc.99.2020.11.19.14.51.11; Thu, 19 Nov 2020 14:51:11 -0800 (PST) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LW7B1p54; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726779AbgKSWto (ORCPT + 8 others); Thu, 19 Nov 2020 17:49:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726449AbgKSWtl (ORCPT ); Thu, 19 Nov 2020 17:49:41 -0500 Received: from mail-io1-xd41.google.com (mail-io1-xd41.google.com [IPv6:2607:f8b0:4864:20::d41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 886E8C0613CF for ; Thu, 19 Nov 2020 14:49:41 -0800 (PST) Received: by mail-io1-xd41.google.com with SMTP id m9so7902614iox.10 for ; Thu, 19 Nov 2020 14:49:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bo4MSwJ0tFuIkBE6whS0DGZ/BGwfpkBFnKgHt6nK9mc=; b=LW7B1p54sQ0R41QAYybP5dn8QpIlUsIfU+oEIC4hgcjr1EPQzjmgAalqONQ3S+2d6B z0z7uwFyxfpX68Wpbk66MqOiVQeW0MWgrEQ8OzyS2dkdtoMOROZoXS1NooiErSFswwT+ 1BRyCT+ifjMv7YFZZWPSD560NpqsESdwamWdHFxL3/GsmbYAqySkxx6RigEr2hn40Z7d BPQzQvBucOvQyofVIuRLeex0KgW/5bMDtOoVZux/QQJ0FCpnhRKvFqsZ+tLI63juI7uU ZC1k7jX4yeuoBPr1FrJuJ3HOO12JzEeAqJ1EdFCtnXYM+t5F90tTFPuzdXc6PxSItTMn Z/rA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bo4MSwJ0tFuIkBE6whS0DGZ/BGwfpkBFnKgHt6nK9mc=; b=Btd34Qa7LDdjbQzwWOutyZMnbNmEx2CArV9izCvEWCTQ+yRmGpLnI8leowsDpsf+Ps Zf+LlgX+9g4uOLVxM/L7kP9h98m6O+dV1QgG+m9ug+ua+vSDeYXzxfiZgENZ8J4pZwcJ yotiokxEu7pV31QdJ0KhvXCZc0xjWs46yBKM9l9IITStzQejqlBZD0MXkM0h5FXXSqQU 5qXdRYGKr5dfJsjkXC4uA8nwrQP0zn7aFVlCK3m0LbjVyzoa14BMsJ740dXt0aPcinrZ jss89sEhzRlKEpmJjqOQSW8NaQ/dkYLBgyY0SLswSjMCB2w8e2TMPpIkZges5SoqoSLL S1Lg== X-Gm-Message-State: AOAM5307IDjsFVdMWjeFSWYJ4kbjr5qe2jvGnqstYZsK79s/zY7EaUPG tYvPv6DLlDXD+rY8c+Cb/TDvbg== X-Received: by 2002:a5d:8d13:: with SMTP id p19mr8920238ioj.37.1605826180967; Thu, 19 Nov 2020 14:49:40 -0800 (PST) Received: from beast.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id i3sm446532iom.8.2020.11.19.14.49.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Nov 2020 14:49:40 -0800 (PST) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: evgreen@chromium.org, subashab@codeaurora.org, cpratapa@codeaurora.org, bjorn.andersson@linaro.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 6/6] net: ipa: add driver shutdown callback Date: Thu, 19 Nov 2020 16:49:29 -0600 Message-Id: <20201119224929.23819-7-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201119224929.23819-1-elder@linaro.org> References: <20201119224929.23819-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org A system shutdown can happen at essentially any time, and it's possible that the IPA driver is busy when a shutdown is underway. IPA hardware accesses IMEM and SMEM memory regions using an IOMMU, and at some point during shutdown, needed I/O mappings could become invalid. This could be disastrous for any "in flight" IPA activity. Avoid this by defining a new driver shutdown callback that stops all IPA activity and cleanly shuts down the driver. It merely calls the driver's existing remove callback, reporting the error if it returns one. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_main.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) -- 2.20.1 diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c index 9f4bd822ac625..bbfc071fa2a60 100644 --- a/drivers/net/ipa/ipa_main.c +++ b/drivers/net/ipa/ipa_main.c @@ -889,6 +889,15 @@ static int ipa_remove(struct platform_device *pdev) return 0; } +static void ipa_shutdown(struct platform_device *pdev) +{ + int ret; + + ret = ipa_remove(pdev); + if (ret) + dev_err(&pdev->dev, "shutdown: remove returned %d\n", ret); +} + /** * ipa_suspend() - Power management system suspend callback * @dev: IPA device structure @@ -946,8 +955,9 @@ static const struct dev_pm_ops ipa_pm_ops = { }; static struct platform_driver ipa_driver = { - .probe = ipa_probe, - .remove = ipa_remove, + .probe = ipa_probe, + .remove = ipa_remove, + .shutdown = ipa_shutdown, .driver = { .name = "ipa", .pm = &ipa_pm_ops,