Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2704316rdb; Fri, 22 Sep 2023 06:24:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHdJiHpU1a0WlwtCsetIbTlsjcvc4ZPXkm69LLuIbVX3MzCYuQ8ZFX2z/0x5O8s0RjFod6Q X-Received: by 2002:a05:6358:2910:b0:132:ce36:ee31 with SMTP id y16-20020a056358291000b00132ce36ee31mr9796363rwb.6.1695389081065; Fri, 22 Sep 2023 06:24:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695389081; cv=none; d=google.com; s=arc-20160816; b=y2214hb1130E60qrmsO2pfI2hYAbJ+pZbTHvbHVIOFZawcZA/Q+7t2a4b4pw/KOyVB s7wOZAJRRolM6x6MRbbLvWQLJ2wi6C7ovOzZIWsWxskOZVX6d2UfK45nhh03JS6SvsRX tNFX5LWflqABih+YW+1QaOS4ULQO9Bb7cXVSBN591tx0P8NDiihDRiqQsHlwg2/ry8HN 0uv7dIvJbxxeldxDIW57RR9ZK3WXFmB6Q7svKYVYuDGHkC4x9n8Px+zSrJyhnxyh7PEw uw/hjc5RzgPEdIRzcbXmo+UlJYdTFYj9xNVX3rULFwgs6v8t+GCKjE3OoX8Xf9bwiRbC KhEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=+UcJJnCKGd/M3hBZqIqRLV8jJyZnrG+icMYPBWov6f0=; fh=JNlX7Pv/TiCXYApLjx0F9G+f/soXMz1OLapluLnzhzA=; b=wD6xtb7DBauYslRpk1L9my04kp52aiGmu9CAW7odym8AzZuARhX8sp2yqLOEy2rPm6 wKjtXiJju97DVBQJDG/ZKKs+J98XKf/cRlEqJpgzVIXAv8ijN1sBtHmy5JjTLXEsqZur JOvVZOJll7vtcZFM5cxtqbNvmN+E0nvN5II5Jb6hCLwbrvKPA0HB1w654Qh+9kVZADaV lReVPMEP0PdmD+IOE4mYfJ94/1SPufvcezqW0TM09hxMFQ/VKDs/pcDsO68B4/zNlO60 wP8hJEuDjvmZaN7hpv2a5nTr8Tnv6CJBsZe+tMk3ObbcgiktWZ1g13vqN2Q5Gbl2jJht E8aQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id ca37-20020a056a0206a500b00578a43e3b0bsi4375711pgb.655.2023.09.22.06.24.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 06:24:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id BDD778317E97; Fri, 22 Sep 2023 06:13:31 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233306AbjIVNNc (ORCPT + 99 others); Fri, 22 Sep 2023 09:13:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233551AbjIVNNa (ORCPT ); Fri, 22 Sep 2023 09:13:30 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7BE62196 for ; Fri, 22 Sep 2023 06:13:24 -0700 (PDT) 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 1BF12DA7; Fri, 22 Sep 2023 06:14:01 -0700 (PDT) Received: from [10.1.196.40] (e121345-lin.cambridge.arm.com [10.1.196.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id EDA5F3F5A1; Fri, 22 Sep 2023 06:13:22 -0700 (PDT) Message-ID: <900b644e-6e21-1038-2252-3dc86cbf0a32@arm.com> Date: Fri, 22 Sep 2023 14:13:18 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Subject: Re: [PATCH v2 1/2] iommu/virtio: Make use of ops->iotlb_sync_map Content-Language: en-GB To: Jason Gunthorpe , Jean-Philippe Brucker Cc: Niklas Schnelle , Joerg Roedel , Will Deacon , virtualization@lists.linux-foundation.org, iommu@lists.linux.dev, linux-kernel@vger.kernel.org References: <20230918-viommu-sync-map-v2-0-f33767f6cf7a@linux.ibm.com> <20230918-viommu-sync-map-v2-1-f33767f6cf7a@linux.ibm.com> <20230919081519.GA3860249@myrica> <20230919144649.GT13795@ziepe.ca> <20230922075719.GB1361815@myrica> <20230922124130.GD13795@ziepe.ca> From: Robin Murphy In-Reply-To: <20230922124130.GD13795@ziepe.ca> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Fri, 22 Sep 2023 06:13:31 -0700 (PDT) On 22/09/2023 1:41 pm, Jason Gunthorpe wrote: > On Fri, Sep 22, 2023 at 08:57:19AM +0100, Jean-Philippe Brucker wrote: >>>> They're not strictly equivalent: this check works around a temporary issue >>>> with the IOMMU core, which calls map/unmap before the domain is >>>> finalized. >>> >>> Where? The above points to iommu_create_device_direct_mappings() but >>> it doesn't because the pgsize_bitmap == 0: >> >> __iommu_domain_alloc() sets pgsize_bitmap in this case: >> >> /* >> * If not already set, assume all sizes by default; the driver >> * may override this later >> */ >> if (!domain->pgsize_bitmap) >> domain->pgsize_bitmap = bus->iommu_ops->pgsize_bitmap; > > Dirver's shouldn't do that. > > The core code was fixed to try again with mapping reserved regions to > support these kinds of drivers. This is still the "normal" code path, really; I think it's only AMD that started initialising the domain bitmap "early" and warranted making it conditional. However we *do* ultimately want all the drivers to do the same, so we can get rid of ops->pgsize_bitmap, because it's already pretty redundant and meaningless in the face of per-domain pagetable formats. Thanks, Robin.