Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp247523imm; Thu, 13 Sep 2018 20:04:29 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaMHXa2Eceu4yRJdhto0E/Tn9HwiCGeW7jrMxTVSNZsz6sat1hRsGT6jGpOMtK5UnNy9uIb X-Received: by 2002:a17:902:4d46:: with SMTP id o6-v6mr1761108plh.59.1536894269386; Thu, 13 Sep 2018 20:04:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536894269; cv=none; d=google.com; s=arc-20160816; b=qjItdL/IYyXb6DlLrbqezrmxIvQpyizWZ74y1ol+/xtlZjzrpIhtb3GsOPSaz31OlH vKoZZKalI8ZEY36IxbJ0ifcXFbeVaI1w6JuTTYDaUK4IWk1aE6cfq8yl26Bpo24I+zHt O2gmTd/CVHWUMcS1InIAOYWAw/O2I91WbBHSLwjim3iCgJ77bd61p3rxsvdqGRtOAbki ksC/q52Q6RLRQBo2pHMiXhqOD9f/77XoaadrZXHnsiIsglcb0qaTDem3zUINAGPx29J1 trd1BIyAL0XwowaCt3DJaiBj4Guw2WAxzUAodx0PVBw2XJVHcQOS4ROpTjQpvLYVbGU7 Q8Sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject:cc; bh=tWwwTihEiTDULBwgbsCVotBgcZI4BAfuvjnoBO3SSRU=; b=AGt2Qh10Ax6JQnabblvcQleS3/vn+0hqixuz/cSmLv5E6Jxu92XLLiZ5S+AfusP7/7 a7TJscAe/Wgf5lum7vqivlCU6fjG9mP0TyJnBsgR9C0H19MDbypQVCEeSEDbNJt3O+7I q+htVIo+NMWYOAGHoNXlkX9uFoMQ3wFT2P0EEPLbn/4IDtoLVhG/SjWHrHIDR5nLis6R P4tJZt9+lb7ZqNKJQ/r/WQQH0uGmTxWh4H276v007FkZIUHPAGK5Q7HD1O5dNyIQ/OIA vyXlVMH8quulrb3agTc8cAC2oldubDwP1O1BPTrnmXzEyjSalMo2kIbiJC4QxKrUx7e9 oBIQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d32-v6si5494328pla.93.2018.09.13.20.04.01; Thu, 13 Sep 2018 20:04:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728444AbeINIAE (ORCPT + 99 others); Fri, 14 Sep 2018 04:00:04 -0400 Received: from mga17.intel.com ([192.55.52.151]:30601 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726905AbeINIAE (ORCPT ); Fri, 14 Sep 2018 04:00:04 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Sep 2018 19:47:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,371,1531810800"; d="scan'208";a="69874531" Received: from allen-box.sh.intel.com (HELO [10.239.161.122]) ([10.239.161.122]) by fmsmga007.fm.intel.com with ESMTP; 13 Sep 2018 19:47:46 -0700 Cc: baolu.lu@linux.intel.com, "kevin.tian@intel.com" , "ashok.raj@intel.com" , "tiwei.bie@intel.com" , "sanjay.k.kumar@intel.com" , "iommu@lists.linux-foundation.org" , "linux-kernel@vger.kernel.org" , "yi.y.sun@intel.com" , "jacob.jun.pan@intel.com" , "kvm@vger.kernel.org" Subject: Re: [RFC PATCH v2 00/10] vfio/mdev: IOMMU aware mediated device To: Jean-Philippe Brucker , Joerg Roedel , David Woodhouse , Alex Williamson , Kirti Wankhede References: <20180830040922.30426-1-baolu.lu@linux.intel.com> <380dc154-5d72-0085-2056-fa466789e1ab@arm.com> <3602f8c1-df17-4894-1bcc-4d779f9aa7fd@arm.com> From: Lu Baolu Message-ID: <4b24f0c6-5985-efbc-f842-8bde239dfc2a@linux.intel.com> Date: Fri, 14 Sep 2018 10:46:32 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <3602f8c1-df17-4894-1bcc-4d779f9aa7fd@arm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 09/13/2018 01:54 AM, Jean-Philippe Brucker wrote: > On 12/09/2018 03:42, Lu Baolu wrote: >> Hi, >> >> On 09/11/2018 12:22 AM, Jean-Philippe Brucker wrote: >>> Hi, >>> >>> On 30/08/2018 05:09, Lu Baolu wrote: >>>> Below APIs are introduced in the IOMMU glue for device drivers to use >>>> the finer granularity translation. >>>> >>>> * iommu_capable(IOMMU_CAP_AUX_DOMAIN) >>>> - Represents the ability for supporting multiple domains per device >>>> (a.k.a. finer granularity translations) of the IOMMU hardware. >>> iommu_capable() cannot represent hardware capabilities, we need >>> something else for systems with multiple IOMMUs that have different >>> caps. How about iommu_domain_get_attr on the device's domain instead? >> Domain is not a good choice for per iommu cap query. A domain might be >> attached to devices belonging to different iommu's. >> >> How about an API with device structure as parameter? A device always >> belongs to a specific iommu. This API is supposed to be used the >> device driver. > Ah right, domain attributes won't work. Your suggestion seems more > suitable, but maybe users can simply try to enable auxiliary domains > first, and conclude that the IOMMU doesn't support it if it returns an error > Some driver might want to check whether hardware supports AUX_DOMAIN during the driver probe stage, but doesn't want to enable AUX_DOMAIN at that time. One reasonable use case is driver check AUX_DOMAIN cap during driver probe and expose different sysfs nodes according to whether AUX_DOMAIN is support or not, then AUX_DOMAIN is enabled or disabled during run time through a sysfs node. With this consideration, we still need a API to check cap. How about * iommu_check_aux_domain(struct device *dev) - Check whether the iommu driver supports multiple domains on @dev. Best regards, Lu Baolu