Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3996254pxb; Tue, 25 Jan 2022 00:59:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJwrHizGgqgOnm2dRwq9ASgS3jBjyUVYSAazoVxv0j4a9lKuCZfh8uAniK89rcPwQa1dVItv X-Received: by 2002:a17:907:dab:: with SMTP id go43mr7147740ejc.400.1643101154575; Tue, 25 Jan 2022 00:59:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643101154; cv=none; d=google.com; s=arc-20160816; b=ZLTGaP2ybFzt2F5wUyr+ln9Mxo4p0ZBbaZjwrd+1jCokvSJqQypGg8vzDOeAvquwGs 3feFVB+g4XsHnE0rt+VcaK5HMHxfiLy4ICoOlB2NhXTajPApQbA9wEVzm+kefGjRGmeo tdtio/t5Tdr+dNlB0S1w+ea2US3jEVu5htScdvjzyD23qZ8Ox8GvL45MTLj8Dj4ETVrn hK8K6f2+gfo5w2/lPtbxV+DaO5YO5NtHaK/SsPgaBjufFUaWWVU3Ic80me8F+vNP8F2F TxoVoXqVRS/GRvihA/YXKamjfemuu+cky+j1bUtCTLJLeOqUcbx3eLTYX3cHkXDkcgnh lAmw== 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 :to:subject:cc:dkim-signature; bh=sLnzSbYScLkEE6GVnNNR4IhBZ6V7IQhXbXOaX8RxNVc=; b=zW2ytx4fK0snBixB++9kVOYBMofiC2A92ZJ/F0LUHYPAMe4wHG0tGYqi07MOeevXiY Y90EmFGcDxMvdzXiowkE0MTSmRJ6HwChXWHW7v98Q33ZmSHIF8PRAkUBE1Wdc1Q8OE9r 7urjz0wVrGEuYGhaKusl11LvdUNCR9OIbWfu5idRi8OtStNieOonsH/uLBJE9jRbT3Nf ATqld2dZW6Sqvg9RW1fvvwnmc5PrwVq9s4Azfb40dn+K+3GdDtwKE1wI/IDeMExXKFh0 shNB9CmNqRge3mXe+HvczZdfA4BowO+PCZymuTks7urpOuy10g/jK4EZ1LtrIkthIYTh 9uVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=KYTkHIe4; 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=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cw3si11988211ejc.762.2022.01.25.00.58.50; Tue, 25 Jan 2022 00:59:14 -0800 (PST) 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; dkim=pass header.i=@intel.com header.s=Intel header.b=KYTkHIe4; 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=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S256170AbiAYFUw (ORCPT + 99 others); Tue, 25 Jan 2022 00:20:52 -0500 Received: from mga02.intel.com ([134.134.136.20]:56374 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1391184AbiAYFD5 (ORCPT ); Tue, 25 Jan 2022 00:03:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643087037; x=1674623037; h=cc:subject:to:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=jvQi+RQyehALY6K5e0Jia9BEKYL9WZi+E3wSrVsSdpc=; b=KYTkHIe4OaXs+LdZ3z3baNpAl0ovDiedY05FA5I7GaU5dZQxn3r8c51N fkqf3c+iTH8O6QcoXzJ1LhkR0Ty/rkLRUPGvieGWL34VrVe2Ai9nSZp1W gsWq0AVFdbZA/xbgcnD4+aRJY1FrARRHl7Z1hjlKbV3U3ebUS6DmicjPH XB1VXm6DUWxdiJFN0E5UWhgYTmsCf4BbBDIRjYbFpJB0YaXAFPze9W0R8 1DWfm2nk+t/muxbrFrO6NbSZhLqJ6GPPV8Z5cSDRYtGYjvx2p8OydLGCS mxuBdpq4Axs+s3arssqkZtUG7wM3z5QE1DfOM/e7ZZ528awUH5T+5xSKX A==; X-IronPort-AV: E=McAfee;i="6200,9189,10237"; a="233587806" X-IronPort-AV: E=Sophos;i="5.88,314,1635231600"; d="scan'208";a="233587806" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jan 2022 21:00:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,314,1635231600"; d="scan'208";a="534563268" Received: from allen-box.sh.intel.com (HELO [10.239.159.118]) ([10.239.159.118]) by orsmga008.jf.intel.com with ESMTP; 24 Jan 2022 21:00:14 -0800 Cc: baolu.lu@linux.intel.com, Alex Williamson , Eric Auger , "Liu, Yi L" , "Pan, Jacob jun" , David Airlie , Daniel Vetter , Thierry Reding , Jonathan Hunter , "iommu@lists.linux-foundation.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 7/7] iommu: Add iommu_domain::domain_ops To: "Tian, Kevin" , Joerg Roedel , Jason Gunthorpe , Christoph Hellwig , Ben Skeggs , "Raj, Ashok" , Will Deacon , Robin Murphy References: <20220124071103.2097118-1-baolu.lu@linux.intel.com> <20220124071103.2097118-8-baolu.lu@linux.intel.com> From: Lu Baolu Message-ID: <33060cd9-9115-013c-7253-52a36aa467e7@linux.intel.com> Date: Tue, 25 Jan 2022 12:59:14 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/24/22 5:58 PM, Tian, Kevin wrote: >> From: Lu Baolu >> Sent: Monday, January 24, 2022 3:11 PM >> +/** >> + * struct domain_ops - per-domain ops >> + * @attach_dev: attach an iommu domain to a device >> + * @detach_dev: detach an iommu domain from a device > > What is the criteria about whether an op should be iommu_ops or domain_ops > when it requires both domain and device pointers like above two (and future > PASID-based attach)? Generally ops belong to iommu_ops if they are only device oriented, and domain_ops if they are only domain oriented. But it's really hard to judge when both device and domain are involved. Good question. :-) Perhaps we should leave the attach/detach interfaces in iommu_ops since they are related to device capabilities. For example, some devices support attach_dev_pasid, while others not. > > Other examples include: > @apply_resv_region This will be deprecated. > @is_attach_deferred Should be at least device centric (domain doesn't play any role here). Further step is to save the is_attach_deferred at a flag in dev_iommu and remove the ops (as Robin suggested). > > Thanks > Kevin > Best regards, baolu