Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp1459420rwo; Wed, 2 Aug 2023 14:39:46 -0700 (PDT) X-Google-Smtp-Source: APBJJlE/2gPYRF/auMDFC8qd0V0nQURSCXhix2h1GItOVVuG1rVhmXCeRG5gDW5jbwOECWUO5F3w X-Received: by 2002:a05:6a00:1586:b0:687:61f9:c4ef with SMTP id u6-20020a056a00158600b0068761f9c4efmr4224057pfk.15.1691012386232; Wed, 02 Aug 2023 14:39:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691012386; cv=none; d=google.com; s=arc-20160816; b=DMTinrdwjkVUe3TeYIYqdGWSRSNR42YoduM+HPrIvD7ki9okagDzYJxbgyp2LKaBWv Msf41+JzCQCtilXpbCDvp30DXTOt5+zirK9jDH5Ufc8deWR0J1QZ3ao+gCmqYaBREU4A /RkgMQKLdxFpjQh8KKALa1bboMIPw7TcVahnI8+pGP9UvaE9oW/XaJxcyMEy7UzPekn/ ifVRhmvhsvwnlnhjQ1SwKPZJa6mWOqtJSbLhd4CvB3kWpheaWzg+CzcK0kMeqRfYKD8X uyT4YbgK+/DCIjPCKBs+NuVd8C3u0na1oVp02pyYD6bmZ9ZmI36fVZFE7s1lJQWLdJ94 ysHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=id4MgahcFpgdur8i27uK7yBpIcWlcDTTbE8/BqdbZd8=; fh=uZcNSOcfj8eWFAf92h2U4ZiVIrA+jFLCx6GEQo1q5gA=; b=BbeUj6w+st+V6EOfZmbWL7rQcZ51X7ZqOiUhV5W0uooCAX+lAN2L+rsYFdfUtM38xz YsD3bH5ajM0ey4zsOZDelfT8yIXSHHokKTnjkGTvdGUj7dbbyEKgyi2KUL2ggXx7zZo6 0VAvBx62E9DV/ZvbH0OM2XXDhPXajaywflJHwOxg+lfN5qPQqltTSnex0/3XtP+R9YZA WuZ1pQ3oNXKEyFTg0CJfQsCBp51D1uLcOzG1Wgj4KGdccgyB9CzMIrlyq5TLbAQ81xG/ ECfcXo5bPE+Rgc9xBV93ussP66eNn9orRFgVbTZwO0tb8qHKPkp+FZsA2xTY6oQTt7b+ o1BA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Fbe01a2w; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c5-20020a6566c5000000b0055c95ab2367si75417pgw.247.2023.08.02.14.39.34; Wed, 02 Aug 2023 14:39:46 -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=@kernel.org header.s=k20201202 header.b=Fbe01a2w; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229606AbjHBUZn (ORCPT + 99 others); Wed, 2 Aug 2023 16:25:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230432AbjHBUZk (ORCPT ); Wed, 2 Aug 2023 16:25:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FB8126A0 for ; Wed, 2 Aug 2023 13:25:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CF5B361AFE for ; Wed, 2 Aug 2023 20:25:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 437F4C433C7; Wed, 2 Aug 2023 20:25:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691007921; bh=+O8qluPv0JxAbf7ZatxXqZjsT+TjZ01Aqc8qllKD3Z8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Fbe01a2wiD0NKAGOOQ+Z/Aldho4ww1deCdZHhsXr7nJ30qKpP8ue9MzYguW3mi0B3 ccDZtPKQA4X3XAuW/073Bia42VRCrERZCNh3sPbH42uqmNylg2NtaJLpkUHP/9ARO4 Klxc4MNqHl73nfnxDkySvLRoPAIueWO5qxYOQjOuAhHqyZkOjZRdsJ6j24aSmQ2+Cs +EfevmIhMQUsnionoYY/PSvSXO5ySKTPUU1Qpgt7YOGdW/MCAp0vVrfIAWyEcE05x1 RG60J7zMgS5JxN9PKkL1yxG1ss6JNVZMPABtI+aXCw1RHha1TR/zqTXw4juf9gST4x pQeQdORSZr7dw== Date: Wed, 2 Aug 2023 21:25:15 +0100 From: Conor Dooley To: Tomasz Jeznach Cc: Zong Li , Joerg Roedel , Will Deacon , Robin Murphy , Paul Walmsley , Anup Patel , 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 Subject: Re: [PATCH 01/11] RISC-V: drivers/iommu: Add RISC-V IOMMU - Ziommu support. Message-ID: <20230802-maimed-spotted-5fa1fe4be386@spud> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ma68l5vGJ6Lc1SF4" Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,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 --ma68l5vGJ6Lc1SF4 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Aug 02, 2023 at 01:15:22PM -0700, Tomasz Jeznach wrote: > On Thu, Jul 27, 2023 at 7:42=E2=80=AFPM Zong Li wrot= e: > > > > On Thu, Jul 20, 2023 at 3:34=E2=80=AFAM Tomasz Jeznach wrote: > > > > > > +static int riscv_iommu_platform_probe(struct platform_device *pdev) > > > +{ > > > + struct device *dev =3D &pdev->dev; > > > + struct riscv_iommu_device *iommu =3D NULL; > > > + struct resource *res =3D NULL; > > > + int ret =3D 0; > > > + > > > + iommu =3D devm_kzalloc(dev, sizeof(*iommu), GFP_KERNEL); > > > + if (!iommu) > > > + return -ENOMEM; > > > + > > > + iommu->dev =3D dev; > > > + dev_set_drvdata(dev, iommu); > > > + > > > + res =3D platform_get_resource(pdev, IORESOURCE_MEM, 0); > > > + if (!res) { > > > + dev_err(dev, "could not find resource for register re= gion\n"); > > > + return -EINVAL; > > > + } > > > + > > > + iommu->reg =3D devm_platform_get_and_ioremap_resource(pdev, 0= , &res); > > > + if (IS_ERR(iommu->reg)) { > > > + ret =3D dev_err_probe(dev, PTR_ERR(iommu->reg), > > > + "could not map register region\n"= ); > > > + goto fail; > > > + }; > > > + > > > + iommu->reg_phys =3D res->start; > > > + > > > + ret =3D -ENODEV; > > > + > > > + /* Sanity check: Did we get the whole register space ? */ > > > + if ((res->end - res->start + 1) < RISCV_IOMMU_REG_SIZE) { > > > + dev_err(dev, "device region smaller than register fil= e (0x%llx)\n", > > > + res->end - res->start); > > > + goto fail; > > > + } > > > > Could we assume that DT should be responsible for specifying the right = size? > > >=20 > This only to validate DT provided info and driver expected register > file size. Expectation is that DT will provide right size. FWIW this check seems needless to me, it's not the kernels job to validate the devicetree. --ma68l5vGJ6Lc1SF4 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZMq7qwAKCRB4tDGHoIJi 0tRtAP9nGZaGgIQrAaYTLppahmjpJ+B4A4f+5TIiS3irhCOhSgD+IoyNLqVkVsKP MLzN0x3g4i4TUarzD0mHByZ86FQ9eAQ= =fGg5 -----END PGP SIGNATURE----- --ma68l5vGJ6Lc1SF4--