Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1058681pxb; Wed, 1 Sep 2021 16:30:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwDsPQy+KOli7KF4Gv2R9IRHN5Zjl+Wu7FbI0NMQMOWutQM/wtqa/SzbE1ace/NpFgzv7Pv X-Received: by 2002:a05:6402:40ce:: with SMTP id z14mr444808edb.28.1630539049869; Wed, 01 Sep 2021 16:30:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630539049; cv=none; d=google.com; s=arc-20160816; b=puskliq/acWHBOL5nRxx4dBZ1VThTNw3NGqu+PsG7iT70vrdTsjmEy+nURqh/zYujj LNrKtP7hhQkoRzqXWLPIkAMOO6yngJ1xeCzRIvvv6dmJP/IF22hJwuIEfnU+aQWDAXZ0 N2jPczcHC+xa3TH5plfrOpT4F9L2fRUTr/eRMS3TfTKscWKq2jFnD3cXEhd5GmMr3Ksl rEJHx8y9cCy1053Ct5GKyKvF228x0Aa2ceDdhRjDD2iYukNPVMNAxx+e6oWW32tMx6xP 0W/HyE3UdyyOTSyyKgd3ZoKhBleLnNBc14TraY3cY7qwqpfT/9BU9WKA6/4Agy565XpR 1A0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=dZo0kodqIB/Wl9e0S2Hf0DCEcYGJWzWzUyOtMoG6+XY=; b=pG0tRSwxxRd1+C3x5hAbqpSMaVPxiJAtjaeD96vanYUl36g2VqOmaNIRWMRZOOu4xn saotBT2INc5pOoQDVFWMoMlc4NIJ3+bpA9F58U89pACPSP70+IRscBNNrP/A8XLPdwIT B+lebr2SKhHvGTutty+qHYEzCxb3PUdcPu0DLzrQVfbg3ZJuvwdvnx2CU4nEwb5huBYp swp1c2DclvhLGwzaNqFB7qT6pDsnmlOkPr9xb+NquMsLtzpXc35o/Vh7tPgoZVoW5HSc rzoDpTU1ZRjsPmDMTBjb2ImG2VJ50P5aYGOyXHApT5jurHC0gcc1IkLkwOolGOi4s7XT NAKQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t14si240070edq.353.2021.09.01.16.30.22; Wed, 01 Sep 2021 16:30:49 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244796AbhIAS4I (ORCPT + 99 others); Wed, 1 Sep 2021 14:56:08 -0400 Received: from foss.arm.com ([217.140.110.172]:40728 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347104AbhIASy2 (ORCPT ); Wed, 1 Sep 2021 14:54:28 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E847F1063; Wed, 1 Sep 2021 11:53:30 -0700 (PDT) Received: from [10.57.15.112] (unknown [10.57.15.112]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 623C13F694; Wed, 1 Sep 2021 11:53:29 -0700 (PDT) Subject: Re: [PATCH v2 6/8] iommu: Move IOMMU pagesize check to attach_device To: Sven Peter , Alyssa Rosenzweig Cc: iommu@lists.linux-foundation.org, Joerg Roedel , Will Deacon , Arnd Bergmann , Mohamed Mediouni , Alexander Graf , Hector Martin , linux-kernel@vger.kernel.org References: <20210828153642.19396-1-sven@svenpeter.dev> <20210828153642.19396-7-sven@svenpeter.dev> From: Robin Murphy Message-ID: Date: Wed, 1 Sep 2021 19:53:23 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021-09-01 18:14, Sven Peter wrote: > > > On Tue, Aug 31, 2021, at 23:39, Alyssa Rosenzweig wrote: >>> + if ((1 << __ffs(domain->pgsize_bitmap)) > PAGE_SIZE) { >> >> Not a fan of this construction. Could you assign `(1 << >> __ffs(domain->pgsize_bitmap))` to an appropriately named temporary (e.g >> min_io_pgsize) so it's clearer what's going on? > > Good point, will do that for the next version. Or maybe just test "__ffs(domain->pgsize_bitmap) > PAGE_SHIFT", or perhaps even avoid shifts altogether with something like "domain->pgsize_bitmap & (PAGE_SIZE | PAGE_SIZE - 1)". Robin. > >> >>> + pr_warn("IOMMU page size cannot represent CPU pages.\n"); >> >> "Represent" how? >> > > Looks like I dropped an "exactly" there when taking this line from iova.c :) > > > > Thanks, > > > Sven >