Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4829455pxj; Wed, 9 Jun 2021 02:56:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjMUKpybWa5vSFB7RKLCOdALV1bZKHFdiR5EdW3jIyoz4SxNeGsCMrwrjh7n5Bspx5IjED X-Received: by 2002:a02:9a0e:: with SMTP id b14mr9433048jal.15.1623232600034; Wed, 09 Jun 2021 02:56:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623232600; cv=none; d=google.com; s=arc-20160816; b=PKSKr7SRWhVJUkgGwz2mEbSyZ1U5qxj6NEm9cWezQG9F9ouwbJTzM0tHJ00vP+TIuG G5MY2aJeVpwQFsK6+s5+BGJF8KMCddSo5FNXokFmUFvZ7TvJpl2UBFoOI0bf4gzPwlvc 08zA5BxK2ARLmWbyEVYv83e/dZCrOP7RTXGiGd1CmMTJxk2zgRgQBgngq0BHKtXVhvPI d9Ok90UXe7oSWrmDBBhIvjy+C5bQT/Pzf9JrhVFUYXDj2XBSkhqVDh9boUnrKXbtdNwR J+M15l7ODlSkRQmPkS+hKAstnBTPW26zOdBShKBOW0MhfImmooU1bTKCAaQOhY/pDjfo RWHQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DLKrPbaxICF/GWaP7iyP1eFMawfOD4FEbGJLg1lKFRE=; b=e3r44XYIlY+t5afpDe7S/yDF4xOTOz/dUgxtE46yvS66ZUY5dXAeq2D4qhxuL/6NzT j5DPzrPmsKZUr94MhG+IdsSmrLH7nQUUMcCK4jhokdjLTDRSbOZO+BQXS4HZPaGulzvh tut/jPZYuKrHxh7T+BE7/RRt9fBr1cr5ODPStGOPeoRLlOGPACO/+L7ABmWPZebRnF5t /KdJv++/kJlbnrIoIZSphB/+h2TWEjtFu/WsiQT6gyq6N3aV8Drmk2hosBLTP6BVTQ6x 773tuh6ozMLrS5FX41Jy6s553+zsYjXtKV9E7RNRZ8kkTlsp5jaiVWCPl7HZg+rfSrgN AG4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aBsJiEY7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m17si2678195jap.92.2021.06.09.02.56.28; Wed, 09 Jun 2021 02:56:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@linuxfoundation.org header.s=korg header.b=aBsJiEY7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235108AbhFHStG (ORCPT + 99 others); Tue, 8 Jun 2021 14:49:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:37652 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235093AbhFHSnW (ORCPT ); Tue, 8 Jun 2021 14:43:22 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E8D33613D4; Tue, 8 Jun 2021 18:36:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623177369; bh=k4m1Qu0cmbXUUoIAWVGhZDNM4oVl4172+stX6bPvOqU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aBsJiEY7kKX5kM3j0DIUXhDIZXMdiIR3N7/4j7yNXJmiW7G5T6UeFXI4I2EbiV3NW 6P1PH90PK0YFBlrZFwO/KI3vTll0ePDGYI+tWt4U6ZXdpv8kI5teyytY4y0cdFilVC YsEe53AzD3DIVCFZblzimBvCaox6qmXn0B2z+RqU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Roja Rani Yarubandi , Stephen Boyd , Wolfram Sang , Sasha Levin Subject: [PATCH 5.4 27/78] i2c: qcom-geni: Add shutdown callback for i2c Date: Tue, 8 Jun 2021 20:26:56 +0200 Message-Id: <20210608175936.181214891@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210608175935.254388043@linuxfoundation.org> References: <20210608175935.254388043@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Roja Rani Yarubandi [ Upstream commit 9f78c607600ce4f2a952560de26534715236f612 ] If the hardware is still accessing memory after SMMU translation is disabled (as part of smmu shutdown callback), then the IOVAs (I/O virtual address) which it was using will go on the bus as the physical addresses which will result in unknown crashes like NoC/interconnect errors. So, implement shutdown callback for i2c driver to suspend the bus during system "reboot" or "shutdown". Fixes: 37692de5d523 ("i2c: i2c-qcom-geni: Add bus driver for the Qualcomm GENI I2C controller") Signed-off-by: Roja Rani Yarubandi Reviewed-by: Stephen Boyd Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-qcom-geni.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c index b56a427fb928..d4ca00df6a5e 100644 --- a/drivers/i2c/busses/i2c-qcom-geni.c +++ b/drivers/i2c/busses/i2c-qcom-geni.c @@ -641,6 +641,14 @@ static int geni_i2c_remove(struct platform_device *pdev) return 0; } +static void geni_i2c_shutdown(struct platform_device *pdev) +{ + struct geni_i2c_dev *gi2c = platform_get_drvdata(pdev); + + /* Make client i2c transfers start failing */ + i2c_mark_adapter_suspended(&gi2c->adap); +} + static int __maybe_unused geni_i2c_runtime_suspend(struct device *dev) { int ret; @@ -701,6 +709,7 @@ MODULE_DEVICE_TABLE(of, geni_i2c_dt_match); static struct platform_driver geni_i2c_driver = { .probe = geni_i2c_probe, .remove = geni_i2c_remove, + .shutdown = geni_i2c_shutdown, .driver = { .name = "geni_i2c", .pm = &geni_i2c_pm_ops, -- 2.30.2