Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp1801568rwb; Wed, 26 Jul 2023 19:51:59 -0700 (PDT) X-Google-Smtp-Source: APBJJlHBQ6dcfR88ZZrafPlTZlyu6tV2qPLzh2jQB9WlU4pcCGr9gICVxY7vEsI4DJnY4j2vrVhm X-Received: by 2002:a17:906:220f:b0:993:d632:2c3 with SMTP id s15-20020a170906220f00b00993d63202c3mr873194ejs.21.1690426319226; Wed, 26 Jul 2023 19:51:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690426319; cv=none; d=google.com; s=arc-20160816; b=hxDPEiI8oNYvrvOWEP8SwLsXjfIobdYSkF2z2kdRplmleD5EJx5WrXXXFiOKALfn+8 +XtzgZoCJJuO8awfV/LROq+GUDAGq6aAOfXImBtK1ZORUehxku2XD5Bh5ZjibcMlz8kX a13T3sJnOSi+ky6bT9J7YlulLYMlotpCpmfBRfpcDCn/unyjWmJK5zUU3zuu7AjZ4abL M3buqDqW48we7oY+r6rbaY7WPvgepVejPKZIbqnOl5iIRUN7w31iJ6wuwu1YLCpxItQc yTRl4tNY/kVi+ie2Gq4nqwky/k8Zjxd5X+R7+WRmKr68MduJ2JTKYR2onNaZMjFjEn74 N1Fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=V8jyIXLWbiaPIfUNQUt/A1abaBSl99TewPn4xIRH3Gk=; fh=/Jap8l98axWLekXrx+nDtM8EkFdhJn4ckS1eaGQHkE0=; b=KpRKg/lb/s6RNcqQzUyXY2VyVq9+/RIOVkUdmIV4gss0jJEkJeq6vLQnP0GYt4gVGc Qo1Eh2EhIVBd9jgP1bueYvRzesJwsLUUEwn4WVIst9IvBZHJa6nPbkV8xRGQJTYXjx7Q yf7KcQLCyJzGexGeJID3h+AJO2OoiIWJEHmVuzL+CSSK3gjlXqcmONU2VhuAYciKKc2A 6ertIKKByZXK/gDFcUw17cxruuCoczl6lftRK8FfbtHzSAIptUBoZbQboJL2VC9ImABN VCRH19p2J2Pu6EbwZWBEo/YBUXPX0+YlPovgOcgxBVH+O9w3l8NSzAwmqEDYKKDY2tzJ 7jWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=dbnUFrMf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rv23-20020a17090710d700b0099bcc342fc3si275147ejb.677.2023.07.26.19.51.35; Wed, 26 Jul 2023 19:51:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=dbnUFrMf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229989AbjG0CnB (ORCPT + 99 others); Wed, 26 Jul 2023 22:43:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229910AbjG0CnA (ORCPT ); Wed, 26 Jul 2023 22:43:00 -0400 Received: from mail-io1-xd2a.google.com (mail-io1-xd2a.google.com [IPv6:2607:f8b0:4864:20::d2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38F4A1724 for ; Wed, 26 Jul 2023 19:42:59 -0700 (PDT) Received: by mail-io1-xd2a.google.com with SMTP id ca18e2360f4ac-78372b895d6so16659939f.2 for ; Wed, 26 Jul 2023 19:42:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1690425778; x=1691030578; 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=V8jyIXLWbiaPIfUNQUt/A1abaBSl99TewPn4xIRH3Gk=; b=dbnUFrMfJLqrJt66x+t87Cn30gCM4ssUP+qYJSr9zH+PptsSMCURpkLnIQbFBiFdWF UwmkDC+uzYwwo/JAe24bt9XBAXX5jibXHISDLWDE2RgZOu8QMSfQlEsLF+Xmi7TYK4vd 3dm99tWY34wEeITB0N/MMMztVoxiOEyoYkyGXMl1fwYHaEB2EvDw/Tls3xlGbl86xO0o mN4FZMO+uTeKfCQD4mhLMrhm+InZmxPaxOWq7Ur1mTCqxH7JktdjtxDEvTZnlH8c1eDq fPvFX7HmSYvywfjg9RyMITrlL5aTIhpe7L+smnYu0PFl4Ir9Hyz9HlkgQleRn8QkxPrw izJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690425778; x=1691030578; 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=V8jyIXLWbiaPIfUNQUt/A1abaBSl99TewPn4xIRH3Gk=; b=I9LQkkekd6V1RFxyK8HAytobP8hirHv1V1P5ismU2BQZIwiNp90D4WdHI2zOI8aVoY +hoCKD1gwafKsaH6HA0nCuKm5xwC16ifrxc9x/jm5HOt2xr1LGVUS1G7ilxqRIRj8l5B JRL3vL3ZpJpC0L/YgcMEpFcMM15Eww8U3eHzHHIoE2Lwr4J50P+F14fQ2IkvCc35vl53 VBpcoBjj5LMz+ektIlIBS9mV7RYXc/MALiwvFJa7xIqfbVHx2uO5v2i/bKZLzYHPALae jRMdjUZpoPojvIIk7QwMk4SYhYYLifMqk4bvyztX/DOe39Sz+CtZ+QaYYygHGYgnWAyO fQow== X-Gm-Message-State: ABy/qLZD8BnhVKknuZ8kiPZLXpTCQa/Bh7HvJBL9gdm9X5iyATROWScd j6R8hhHZKrZlTFQlTFGnUl5NNbfEYjEcpG1m8HJzmw== X-Received: by 2002:a6b:6014:0:b0:783:572c:9caa with SMTP id r20-20020a6b6014000000b00783572c9caamr3688832iog.0.1690425778618; Wed, 26 Jul 2023 19:42:58 -0700 (PDT) MIME-Version: 1.0 References: <592edb17-7fa4-3b5b-2803-e8c50c322eee@linux.intel.com> In-Reply-To: From: Zong Li Date: Thu, 27 Jul 2023 10:42:47 +0800 Message-ID: Subject: Re: [PATCH 03/11] dt-bindings: Add RISC-V IOMMU bindings To: Jason Gunthorpe Cc: Baolu Lu , Anup Patel , Tomasz Jeznach , Joerg Roedel , Will Deacon , Robin Murphy , Paul Walmsley , Albert Ou , linux@rivosinc.com, linux-kernel@vger.kernel.org, Sebastien Boeuf , iommu@lists.linux.dev, Palmer Dabbelt , Nick Kossifidis , linux-riscv@lists.infradead.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 26, 2023 at 8:17=E2=80=AFPM Jason Gunthorpe wrot= e: > > On Wed, Jul 26, 2023 at 12:26:14PM +0800, Zong Li wrote: > > On Wed, Jul 26, 2023 at 11:21=E2=80=AFAM Baolu Lu wrote: > > > > > > On 2023/7/24 21:23, Zong Li wrote: > > > >>>>> In RISC-V IOMMU, certain devices can be set to bypass mode when= the > > > >>>>> IOMMU is in translation mode. To identify the devices that requ= ire > > > >>>>> bypass mode by default, does it be sensible to add a property t= o > > > >>>>> indicate this behavior? > > > >>>> Bypass mode for a device is a property of that device (similar t= o dma-coherent) > > > >>>> and not of the IOMMU. Other architectures (ARM and x86) never ad= ded such > > > >>>> a device property for bypass mode so I guess it is NOT ADVISABLE= to do it. > > > >>>> > > > >>>> If this is REALLY required then we can do something similar to t= he QCOM > > > >>>> SMMU driver where they have a whitelist of devices which are all= owed to > > > >>>> be in bypass mode (i.e. IOMMU_DOMAIN_IDENTITY) based their devic= e > > > >>>> compatible string and any device outside this whitelist is > > > >>>> blocked by default. > > I have a draft patch someplace that consolidated all this quirk > checking into the core code. Generally the expectation is that any > device behind an iommu is fully functional in all modes. The existing > quirks are for HW defects that make some devices not work properly. In > this case the right outcome seems to be effectively blocking them from > using the iommu. > > So, you should explain a lot more what "require bypass mode" means in > the RISCV world and why any device would need it. Perhaps this question could be related to the scenarios in which devices wish to be in bypass mode when the IOMMU is in translation mode, and why IOMMU defines/supports this case. Currently, I could envision a scenario where a device is already connected to the IOMMU in hardware, but it is not functioning correctly, or there are performance impacts. If modifying the hardware is not feasible, a default configuration that allows bypass mode could be provided as a solution. There might be other scenarios that I might have overlooked. It seems to me since IOMMU supports this configuration, it would be advantageous to have an approach to achieve it, and DT might be a flexible way. > > Jason