Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp2352112iob; Fri, 20 May 2022 07:33:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxWulxDULBOuOtMaH6PXpjStASnlEMO9nH0PdnhBOaQ5bte3W7agsfqxu7Io4jopuzkvX70 X-Received: by 2002:a05:6402:17db:b0:42a:cd7c:c486 with SMTP id s27-20020a05640217db00b0042acd7cc486mr11260640edy.267.1653057209695; Fri, 20 May 2022 07:33:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653057209; cv=none; d=google.com; s=arc-20160816; b=e53wph8ZqtC1IU2PBkaCFIY/R+aDLzitSZ100TKC2vKyjW5/cfkip7AvPxVjzpx5xi 2BFvWs96Df/+oIVGwBbcaxfX0mWcsxQcPi2+owRlaFhB5P5YbQV1tDZWZeoRse9kf/dB B7VGvjmg94gauZkmOPkwrOBa5ZtIiYwOagGtEq8SED1Q/TySgkOHvhApnStsFwWh7Pt6 klNtfPbnzN4pUw3xyA89dAjbujhmG+AKXZ37N996e23yHIfBo+iCvvSqnxKl1Vp5m30a RpVvijQx1chbQLwbxUdq4KaqWpr8B7Hw1XoQq0ZulRNecwVaXD8hmqoYaYZTcTwbo31c 7HbA== 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=P9P3GjTEz9rR1//euFYC7jvn6nEnujpFe5ETnaoOnTc=; b=GuCy0t+t3x0/v5qqsmeur1adtLRPh7xZ/RARF7RahfHYoUKfkeey8R17i8i35en8ax zw+zpKdkM2YjT8IQNiEaLV03V83GurvvXQRx0GDLBbFrVJof3TWhUgEJp/lYHt4LQsK+ yc0HoLAUBlzqPPrArxXyP/iAdaIEmvsxPXMolWjTbE2XaXqMp0s1v8roboBExU/euthg +fobKWVti8KsW1jz7AxCEDCT4W45NLipZLu5tjPhTf0xKq1y7E70clv1duN/3MLbsGl9 F1DuqfFU3auogzRp+UXJYP5ZAmuKRfIeXf3UE+9RkobW8w5mMf2sg1GfGwb9r6KvYa1t cFQQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fq1-20020a1709069d8100b006e877f0ba78si7040157ejc.705.2022.05.20.07.33.02; Fri, 20 May 2022 07:33:29 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233904AbiETJSk (ORCPT + 99 others); Fri, 20 May 2022 05:18:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347700AbiETJSb (ORCPT ); Fri, 20 May 2022 05:18:31 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 201CD149171 for ; Fri, 20 May 2022 02:18:27 -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 CF0A81477; Fri, 20 May 2022 02:18:26 -0700 (PDT) Received: from [10.57.82.55] (unknown [10.57.82.55]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C14D83F66F; Fri, 20 May 2022 02:18:25 -0700 (PDT) Message-ID: Date: Fri, 20 May 2022 10:18:20 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH v2] iommu/amd: Set translation valid bit only when IO page tables are in used Content-Language: en-GB To: Joerg Roedel Cc: Suravee Suthikulpanit , iommu@lists.linux-foundation.org, jon.grimm@amd.com, linux-kernel@vger.kernel.org, vasant.hegde@amd.com References: <20220509074815.11881-1-suravee.suthikulpanit@amd.com> <1dfaf07e-040e-848b-db7c-86a107fd5cb3@amd.com> <794e13dd-8eae-481d-711d-b5462fdbfb18@arm.com> From: Robin Murphy In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_HI,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 2022-05-20 09:58, Joerg Roedel wrote: > On Fri, May 20, 2022 at 09:54:51AM +0100, Robin Murphy wrote: >> The .def_domain type op already allows drivers to do exactly this sort of >> override. You could also conditionally reject IOMMU_DOMAIN_PASSTHROUGH in >> .domain_alloc for good measure, provided that (for now at least*) SNP is a >> global thing rather than per-instance. > > Yeah, that could work. I am just not sure the IOMMU core behaves well in > all situations when allocation IOMMU_DOMAIN_PASSTHROUGH suddenly starts > to fail. I would feel better if this is checked and tested :) Well, iommu_group_alloc_default_domain() has the fallback and is currently the only place that __iommu_domain_alloc() can be called with a type other than IOMMU_DOMAIN_UNMANAGED, so by inspection it should be fine. However if iommu_get_def_domain_type() says the right thing then neither sysfs nor automatic default domains should get as far as even trying to allocate an identity domain anyway - note that that's already what happens for untrusted external devices. But either way should be easy enough to verify with a quick hack, too. Cheers, Robin.