Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp521350lqr; Wed, 5 Jun 2024 12:42:14 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVdtc1yZw0Gsx7Zeep7T63JxlSC8U8Hnk3Zi3kkS7WenrYgQ4ZlxOnOPvxjjoQNnzSU+CmZkBzt/3HcySs1E6bZXtE/ZTzS7io0LHPT6g== X-Google-Smtp-Source: AGHT+IHbWwSUKHMAfpYzmtOfqKaqnw+AOwCrJvdhXSVRPJNBELJwCie9Wf4D767RM3tPKq1KxtS/ X-Received: by 2002:a05:6512:4019:b0:52b:8455:fb1f with SMTP id 2adb3069b0e04-52bab4ce6b5mr3324674e87.10.1717616533996; Wed, 05 Jun 2024 12:42:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717616533; cv=pass; d=google.com; s=arc-20160816; b=MovQxyVfLEC9nPPLqtak3vFQpqjMRc3k6UJOSD2RAVURw3n8h7jYpxQUKuWv0tC5Su PecLbXxbsqqiwxp+sgedo85ps15YECaBpxiLpJiUHa+Yqd+8UKsY6E2PZjM8Hqm9yFkl hekcIgv1SJ4irCMuK2gkN4R4QChcOC78c02S3pCnnTqf2T5ojfI5XRGOiRkduaY7TN9K ADfsZcXmyTjs/GCQrXWegi8TvhM6uflpJGxd/ugBvo/yBKtVc6D6GICXvCFavVu0ZNgs YgeqyAD+ldZNVSJkjKIyuIOj4hH7Dk+5MjkNkUIBrxSEnifISh9Tal+QCVw1VxbbcwRP w7Zg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=0Iqln3pU608Iw9vzO5mExR0F6HHdjBJu68DaW17wMtg=; fh=P/o+hCnEGS9qDYfDWV/jh8L0549XN8Oh8ghvsH2dGVo=; b=Bg6apc8TOicHv5YQIM3YkiRF31sMWZrt17RcGCQmdfzTupvjJNqe8A7aXM4GYai8oB dwK+e+7W/x+deoKdXplJzDwaGVM12N0z6h47FzTX2dUTxyzf76dzjRaV1c7CVilzEjkB SIGSyVpbHXdC3qIzxyCqOOx1Id9ufzFzZUe0D2nHJSj4/oXlZlLI+osOMZJP0RysR2PA /7tsvZkbUnG511Yg2rBkqlqDwyg877qbRpofKl/cmr5lkIb+mQgLXP1hH8XzmXlf4p7L aPi4M5izQ9kvZ/V/WEcw6xI+5SJqCXQc3oO2fEijrPYzUSNVoCOExh6nKYLeyEFVwC4Z 46dQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b="wbHxux/A"; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-203117-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203117-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a68ef5db83esi405300866b.668.2024.06.05.12.42.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 12:42:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-203117-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b="wbHxux/A"; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-203117-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203117-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id B098C1F26F3C for ; Wed, 5 Jun 2024 19:42:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 42B2C152DE3; Wed, 5 Jun 2024 19:42:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b="wbHxux/A" Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0A4CCFBFD for ; Wed, 5 Jun 2024 19:42:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717616527; cv=none; b=F477LYRqQ+2zGkd53hZREXCJG+/QkNqtPqOxfAXZanRTrb6xBklaRHClSxFzjUH8WgGLOnRs29wQjyARzz7A9vEvYyr+eiwYBmKzlNNCuj6x1RwGj8eJDqTil5nIitmEPowzrEEQFhuf1yO8LiH2yOWyhRv7JSDItzqkOKSZ+UY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717616527; c=relaxed/simple; bh=BkLjiawwOQEAVWftagmoBVsL5Q/uu5hCoju8LwKBppo=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=Qw6BfD8SZLF3OwqUdgZ2c8KYafwNAKVRTHg458C4ovWm8b0gMFVZfR8TieSyYKiIbMLgkW/dg/3A1l/0Xu8zKhYgDCSalulwJ8Mm+y7D8h5HeO3Jxv7Ftl+ap87O2oS2scS5dPfxf5NKdRwXwEcm36eYIsWM3hltdmetICK4QTs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com; spf=pass smtp.mailfrom=rivosinc.com; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b=wbHxux/A; arc=none smtp.client-ip=209.85.216.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rivosinc.com Received: by mail-pj1-f50.google.com with SMTP id 98e67ed59e1d1-2c1a5913777so164944a91.2 for ; Wed, 05 Jun 2024 12:42:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1717616525; x=1718221325; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=0Iqln3pU608Iw9vzO5mExR0F6HHdjBJu68DaW17wMtg=; b=wbHxux/A2Fo1mxdnGotFBzhtQVF0ahw58e5TyXIrFmtmdsuRD46ZPr6PU6iWvru6Et Z8kRCPzMnt9HfjoZR1a83mlACEEqdZ5dpHmJPUcKC2+wJe061+sVrioBItQ59uRdfw18 bGC/UaDlc5JlMN7IbgkK1f41FJMuA+S7jmekPLSrmELvinD4khMsTqkQe7a6TOaSflq7 9nhfxJojNQXOVzw7sFKKN0AQ+GbUw93b8xrHazJydFjbYexlpGbmDiMtm1+74NfBMXUW 14i9OL46kuZ0sGH9n3Wqb9s39fNUjDpGWdc4fI2ps/dHIY98vCjLaIPnC76OFvTQEZ4p 82Cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717616525; x=1718221325; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0Iqln3pU608Iw9vzO5mExR0F6HHdjBJu68DaW17wMtg=; b=O0Z95xOOKo1qA9AJUOWllVHgqh2krYZDJ2MO2krbppOyBxf18aUjSbDP9Y2UKJkjKh UcoPAq1GV15BhiZfpsrgG4m6vtaqm1pE6+D7+j455ospweZhvpdw281IWqzIYP1W0sJ7 CxHykNPoK61d702ZYJbUQeByI26FxnHp9pVcKaJ8ZnDFkQKgSvbjVa4Zay5s4JcjGcKX 0QWOTu6v5vWmi3/gQC70/Yu6jGhFnC3Wobadd0EvrYi7MnQOT4WV2QF/nzXOvQKk4L69 XIkF8pLcRPJQpM8Zc7cZtoPPBfu8S///lZkCVZPzbbNNjdXMXkmcabAWkTU/rbqMPa3q iLDg== X-Forwarded-Encrypted: i=1; AJvYcCVhHUGD1I0nd3gB4afBIeWTSfGaF8hGvuv3BRZj0TFqYJhrcbWsE/hOY6x1a5UwX9MlhWX+OYWgHNiQu3HOSuzHcvUMiNBHbHXM7nm+ X-Gm-Message-State: AOJu0Yz5xoEMlR1Signh1Q6cyeb3WLaESEylzpRR452Lq65PJw9iNUgQ fkHyNMb+Fg/6nvhlJO+yHHa2QkavB+tz4Wtf2Z/Mb7BJjyLzcohDWH6Jy3I+rZwCWeQ0udRRLfZ N5HTCmiDSvnoF7WC04ecjq4+UwxeVmbucT5DIIg== X-Received: by 2002:a17:90a:b297:b0:2c1:948b:6f2c with SMTP id 98e67ed59e1d1-2c27db5ce10mr3938026a91.39.1717616525310; Wed, 05 Jun 2024 12:42:05 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <7dcd9a154625704cbf9adc4b4ac07ca0b9753b31.1716578450.git.tjeznach@rivosinc.com> <20240603-d622cdac0016f1f854bf2b4c@orel> In-Reply-To: <20240603-d622cdac0016f1f854bf2b4c@orel> From: Tomasz Jeznach Date: Wed, 5 Jun 2024 12:41:53 -0700 Message-ID: Subject: Re: [PATCH v6 2/7] iommu/riscv: Add RISC-V IOMMU platform device driver To: Andrew Jones Cc: Joerg Roedel , Will Deacon , Robin Murphy , Paul Walmsley , Palmer Dabbelt , Albert Ou , Anup Patel , Sunil V L , Nick Kossifidis , Sebastien Boeuf , Rob Herring , Krzysztof Kozlowski , Conor Dooley , devicetree@vger.kernel.org, iommu@lists.linux.dev, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux@rivosinc.com, Lu Baolu Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Jun 3, 2024 at 5:59=E2=80=AFAM Andrew Jones wrote: > > On Fri, May 24, 2024 at 12:34:42PM GMT, Tomasz Jeznach wrote: > ... > > +static struct platform_driver riscv_iommu_platform_driver =3D { > > + .probe =3D riscv_iommu_platform_probe, > > + .remove_new =3D riscv_iommu_platform_remove, > > Hi Tomasz, > > I think we should also support .shutdown (just turn the IOMMU off?), > otherwise the IOMMU driver reports EBUSY and fails to initialize when > rebooting. > > Same comment for the PCI driver. > I've been testing patches with added shutdown handlers, also looking at reboot notifier hooks. In both cases, devices actively running DMA traffic at system shutdown (eg. storage) might be affected by too-early IOMMU disable call. This topic was already brought up in the discussion [1] about kexec reboot flow. In this series I'd prefer to keep the IOMMU active during shutdown, and prepare the RISC-V IOMMU shutdown sequence implementation as a separate series, as it will involve more risc-v reboot rework to guarantee ordering of the shutdown callbacks. In a normal reboot cycle, firmware/hardware reset should bring IOMMU to known out-of-reset state anyway. [1] https://lore.kernel.org/linux-iommu/059ae516-aed4-4836-a2ca-aff150ff428= d@arm.com/ Best, - Tomasz > Thanks, > drew