From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 959A9C433EF for ; Fri, 26 Nov 2021 14:00:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 58CAE6F4BA; Fri, 26 Nov 2021 14:00:43 +0000 (UTC) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by gabe.freedesktop.org (Postfix) with ESMTPS id 15DD06F4BA; Fri, 26 Nov 2021 14:00:42 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6200,9189,10179"; a="215690852" X-IronPort-AV: E=Sophos;i="5.87,266,1631602800"; d="scan'208";a="215690852" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Nov 2021 06:00:41 -0800 X-IronPort-AV: E=Sophos;i="5.87,266,1631602800"; d="scan'208";a="498409003" Received: from slee54-mobl2.amr.corp.intel.com (HELO [10.209.166.109]) ([10.209.166.109]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Nov 2021 06:00:39 -0800 Message-ID: Date: Fri, 26 Nov 2021 14:00:37 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.1 Subject: Re: [PATCH] drm/i915: Use per device iommu check Content-Language: en-US To: Lu Baolu , Robin Murphy , Intel-gfx@lists.freedesktop.org References: <20211125104202.417171-1-tvrtko.ursulin@linux.intel.com> From: Tvrtko Ursulin Organization: Intel Corporation UK Plc In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lucas De Marchi , dri-devel@lists.freedesktop.org, Tvrtko Ursulin Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On 26/11/2021 08:26, Lu Baolu wrote: > On 2021/11/25 19:47, Robin Murphy wrote: >> On 2021-11-25 10:42, Tvrtko Ursulin wrote: >>> From: Tvrtko Ursulin >>> >>> With both integrated and discrete Intel GPUs in a system, the current >>> global check of intel_iommu_gfx_mapped, as done from intel_vtd_active() >>> may not be completely accurate. >>> >>> In this patch we add i915 parameter to intel_vtd_active() in order to >>> prepare it for multiple GPUs and we also change the check away from >>> Intel >>> specific intel_iommu_gfx_mapped (global exported by the Intel IOMMU >>> driver) to probing the presence of IOMMU domain on a specific device >>> using iommu_get_domain_for_dev(). >> >> FWIW the way you have it now is functionally equivalent to using >> device_iommu_mapped(), which I think might be slightly clearer for the >> current intent, but I don't have a significantly strong preference >> (after all, this *was* the de-facto way of checking before >> device_iommu_mapped() was introduced, and there are still other >> examples of it around). So from the IOMMU perspective, >> >> Acked-by: Robin Murphy >> >> Perhaps the AGP driver could also be tweaked and >> intel_iommu_gfx_mapped cleaned away entirely, but I'll leave that for >> Baolu to think about :) > > I fully agreed with Robin. > > I prefer device_iommu_mapped() more than iommu_get_domain_for_dev(). > > "iommu_get_domain_for_dev(dev) == NULL" simply means that the device > does not have any domain attached. Although at present, it is equivalent > to device DMAing without IOMMU translation. But I'm sure it will change > in the future. > > With device_iommu_mapped() replaced, > > Reviewed-by: Lu Baolu I have empirically established device_iommu_mapped() matches 1:1 with intel_iommu_gfx_mapped and a simple non-NULL check against iommu_get_domain_for_dev(), so okay, I will respin with that change. We leave the problem of being able to distinguish between pass-through and address translation from the drivers for later. Thanks both! Regards, Tvrtko From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 207AAC433F5 for ; Fri, 26 Nov 2021 14:00:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 901786F4BB; Fri, 26 Nov 2021 14:00:43 +0000 (UTC) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by gabe.freedesktop.org (Postfix) with ESMTPS id 15DD06F4BA; Fri, 26 Nov 2021 14:00:42 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6200,9189,10179"; a="215690852" X-IronPort-AV: E=Sophos;i="5.87,266,1631602800"; d="scan'208";a="215690852" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Nov 2021 06:00:41 -0800 X-IronPort-AV: E=Sophos;i="5.87,266,1631602800"; d="scan'208";a="498409003" Received: from slee54-mobl2.amr.corp.intel.com (HELO [10.209.166.109]) ([10.209.166.109]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Nov 2021 06:00:39 -0800 Message-ID: Date: Fri, 26 Nov 2021 14:00:37 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.1 Content-Language: en-US To: Lu Baolu , Robin Murphy , Intel-gfx@lists.freedesktop.org References: <20211125104202.417171-1-tvrtko.ursulin@linux.intel.com> From: Tvrtko Ursulin Organization: Intel Corporation UK Plc In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Intel-gfx] [PATCH] drm/i915: Use per device iommu check X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lucas De Marchi , dri-devel@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On 26/11/2021 08:26, Lu Baolu wrote: > On 2021/11/25 19:47, Robin Murphy wrote: >> On 2021-11-25 10:42, Tvrtko Ursulin wrote: >>> From: Tvrtko Ursulin >>> >>> With both integrated and discrete Intel GPUs in a system, the current >>> global check of intel_iommu_gfx_mapped, as done from intel_vtd_active() >>> may not be completely accurate. >>> >>> In this patch we add i915 parameter to intel_vtd_active() in order to >>> prepare it for multiple GPUs and we also change the check away from >>> Intel >>> specific intel_iommu_gfx_mapped (global exported by the Intel IOMMU >>> driver) to probing the presence of IOMMU domain on a specific device >>> using iommu_get_domain_for_dev(). >> >> FWIW the way you have it now is functionally equivalent to using >> device_iommu_mapped(), which I think might be slightly clearer for the >> current intent, but I don't have a significantly strong preference >> (after all, this *was* the de-facto way of checking before >> device_iommu_mapped() was introduced, and there are still other >> examples of it around). So from the IOMMU perspective, >> >> Acked-by: Robin Murphy >> >> Perhaps the AGP driver could also be tweaked and >> intel_iommu_gfx_mapped cleaned away entirely, but I'll leave that for >> Baolu to think about :) > > I fully agreed with Robin. > > I prefer device_iommu_mapped() more than iommu_get_domain_for_dev(). > > "iommu_get_domain_for_dev(dev) == NULL" simply means that the device > does not have any domain attached. Although at present, it is equivalent > to device DMAing without IOMMU translation. But I'm sure it will change > in the future. > > With device_iommu_mapped() replaced, > > Reviewed-by: Lu Baolu I have empirically established device_iommu_mapped() matches 1:1 with intel_iommu_gfx_mapped and a simple non-NULL check against iommu_get_domain_for_dev(), so okay, I will respin with that change. We leave the problem of being able to distinguish between pass-through and address translation from the drivers for later. Thanks both! Regards, Tvrtko