Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp2201040rdb; Tue, 20 Feb 2024 23:21:46 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUURmaZhqcZcZ54o1tbGadC57p4BYvKCyaP1ZzzrOodg7OPwp3+VVjI4thDix9BOqAz9ZhHOWw4LkJreshM6FVs5L0IM0n9bL9TdEVxIw== X-Google-Smtp-Source: AGHT+IGMNDPwJrzYHLaoQP3nXl9cItA2slihxKC3LIYZuIUTQmU6HaTd4oQx4FaHMwhAN95kEwZM X-Received: by 2002:a81:b049:0:b0:607:db04:1591 with SMTP id x9-20020a81b049000000b00607db041591mr15551061ywk.14.1708500105839; Tue, 20 Feb 2024 23:21:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708500105; cv=pass; d=google.com; s=arc-20160816; b=RNAbG37tXV6mvX4WZ7NZWAJKNsuT0wNN3fmjdC9cYIkthNxayKcA+Mmci7ZCxMKfXb agVqa63kdUlohxEaj52rPrP3leaSSQZbM7AuVZBbviOTFrgm3J+kLTDChw019I1fIt7S RiytmeNbzkQhJYA2PiivDCxVaPzXubJ52D7KLjx7ZKqy4ph2g7zXjbwz1GTCcot8huWI 352txX21RO+Mxcfy/msBG0kMp2uNPaQRY4l1Af2m01NPUwt13K/r9E4tdbm7dEz6Cktc vtlwfUl2xhfoh38BQXvwPLKDo6wpnkeyJQ5DtR37RX9a+Upt9d7HIfZcUmvWQ2axCxlh Lw7A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:cc:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=9LLuEE9mPlqCzEvk/gwt2M/EtwW7vBsMsrIgCy6LftA=; fh=oj0MC99jJmXr9VOxYru8PCxqsxVpffpkkk/RjcP5DFo=; b=fAUzHrClXzk/hrsM1HAxHk5mFIPmLweCdSf9Y0XFbMy+NMV/v1Dmmgo71LHODa66+u jSFzqxrTSTlA1HJFENP8w4bYBy55ChG29GdIrhJIOd63g6f9FB8PlnvfwARP1Qh9ouku pNHE/uB14dk0iGxDfN3p3Kx9fKwdTzGA3rsEoowjblow6geeaxXy/vwVsdqzxZdiolAw +56S4/fSTAEsPzbEvTkxmps5EkbjpHMaIl0ovLz6NRsDK1gMWtRe0sOtopEomfArha3W lYw5gWZwmUH13XAvf5Ue2AoVD0kfaYIOoIcDr7fuMmY6cMEfBZScN7qH679gpj2PLosM zqWA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=B4sV2ZFF; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-74210-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-74210-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id h5-20020ac85485000000b0042c66cff88asi9929468qtq.407.2024.02.20.23.21.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 23:21:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-74210-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=B4sV2ZFF; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-74210-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-74210-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 8535F1C2291C for ; Wed, 21 Feb 2024 07:21:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0195B3B282; Wed, 21 Feb 2024 07:21:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="B4sV2ZFF" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 995583A8DD for ; Wed, 21 Feb 2024 07:21:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.20 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708500083; cv=none; b=fj44Z2lw99Wjav80Bf5axol973CZJGClBe8hfcRCGXCK28NP7YBp52qaEqNHimkHe/jXqI+n5fa3jHnOL1dlE5m0N6pYuM5ApC47uvAPW2PCRdEYrUhtJq9WQfY/N/KjLBgWPrl/jSm0cCyrR78SilojWQYz9XEDhxdPjRIOPzo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708500083; c=relaxed/simple; bh=IoYu+i7KKnzz4BOoEaK041vDn3DjPnDvaToCAeVuexQ=; h=Message-ID:Date:MIME-Version:Cc:Subject:To:References:From: In-Reply-To:Content-Type; b=mwXupaOFY5NjvW2WWek6n0iiaRZ4Iwnv3N7UrdxHXnjn4ewPgDfSGNEQxEl7tNnaBuzuy79QorAHY4QcxrbdWW66StKWB76H/tck3rLs9UIDOEjhXwMZqFeoXqT0hMZfwpHTVwdXUcppr9dMn4mKFvsNZQWtHWibTuLKTXerMOo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=B4sV2ZFF; arc=none smtp.client-ip=198.175.65.20 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1708500082; x=1740036082; h=message-id:date:mime-version:cc:subject:to:references: from:in-reply-to:content-transfer-encoding; bh=IoYu+i7KKnzz4BOoEaK041vDn3DjPnDvaToCAeVuexQ=; b=B4sV2ZFFU/Dbcz8IntRRE4SYhLQoJFVhxdUnIsgK9aRe0hXBpyT0b7Lx swuJ4q5F5AcguKclETSMxUJnMcrkbTPsOdaRh3gHodmEiGi/0RxVBYf5O vn5kHPX9dzC9Ic8ir1Hf28lh+pRkmlgX14qb+/6/3lsWZmko3nRBM7CSv BX/N3eofHqKUYcxOMq+edX3MB3ryrPWuAnvxBAMRRt1wRY4ZO+yqxZFT5 bj+MARQlU/iRmvEz0qRjjQVtTpIpCrQD7x4jWaua0L1uQgBxW+UluAzde XmLu0ihYEgvVI61/yLa+RhqJjavG2zaT7LH1UBFTZt0kzmGe+f6wl7VW1 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10990"; a="2516570" X-IronPort-AV: E=Sophos;i="6.06,175,1705392000"; d="scan'208";a="2516570" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Feb 2024 23:21:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,175,1705392000"; d="scan'208";a="42523584" Received: from blu2-mobl.ccr.corp.intel.com (HELO [10.249.171.203]) ([10.249.171.203]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Feb 2024 23:21:15 -0800 Message-ID: Date: Wed, 21 Feb 2024 15:21:12 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Cc: baolu.lu@linux.intel.com, "iommu@lists.linux.dev" , "virtualization@lists.linux-foundation.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v3 1/8] iommu: Add iopf domain attach/detach/replace interface Content-Language: en-US To: "Tian, Kevin" , Jason Gunthorpe , Joerg Roedel , Will Deacon , Robin Murphy , Jean-Philippe Brucker , Nicolin Chen , "Liu, Yi L" , Jacob Pan , Joel Granados References: <20240122073903.24406-1-baolu.lu@linux.intel.com> <20240122073903.24406-2-baolu.lu@linux.intel.com> From: Baolu Lu In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2024/2/21 14:49, Tian, Kevin wrote: >>>> +struct iopf_attach_cookie { >>>> + struct iommu_domain *domain; >>>> + struct device *dev; >>>> + unsigned int pasid; >>>> + refcount_t users; >>>> + >>>> + void *private; >>>> + void (*release)(struct iopf_attach_cookie *cookie); >>>> +}; >>> this cookie has nothing specific to iopf. >>> >>> it may makes more sense to build a generic iommu_attach_device_cookie() >>> helper so the same object can be reused in future other usages too. >>> >>> within iommu core it can check domain iopf handler and this generic cookie >>> to update iopf specific data e.g. the pasid_cookie xarray. >> This means attaching an iopf-capable domain follows two steps: >> >> 1) Attaching the domain to the device. >> 2) Setting up the iopf data, necessary for handling iopf data. >> >> This creates a time window during which the iopf is enabled, but the >> software cannot handle it. Or not? >> > why two steps? in attach you can setup the iopf data when recognizing > that the domain is iopf capable... Oh, maybe I misunderstood. So your proposal is to make the new interface generic, not for iopf only? Best regards, baolu