Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1311409ybh; Thu, 16 Jul 2020 08:43:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxG1QMDZO1etqW1lA7eHlBUFOJLicxF1tzA6OJQe79Ry4ERBtYTT7OWjn2w2aJ9NEoEs2pU X-Received: by 2002:a17:906:c096:: with SMTP id f22mr4140174ejz.159.1594914223625; Thu, 16 Jul 2020 08:43:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594914223; cv=none; d=google.com; s=arc-20160816; b=ffLYy+2XKEvAGZDlceFMNs008/NdyzpncnjeeQUKVSFs6eZAbBY6EnbtNSgi9LXk9F 3wc4Dk26iuB3bG7szGdpPUDoZsFwPYOSlgvWWPZjVtzSu0IQkdpxbLHvor7CmramVAT2 jZnPnBfBpUN39VoUwgFxOTFFbZzYfP+/bTEZMOP0gWlt7prAaSrpVCnEFwL4cr4IarE6 8wmwLDyvORGkK9Ugc+mXA0H7QpOcWeAaz2Hot5VrEYgqjZfdAxLzuhQS9BYxC/EFahu6 ZCbAcDYGPOfVUvPMhED3auKQXJEGxJw8Q/0YnBLFZpIrGk101ecLFhGzLtUrIFE+ZnPR XCjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=R0hixZr2FmuyDxkOlsaDyB/rdEVS5zH7ZB3SMwB7SjA=; b=UUUcBVOTVC+tSUUbtoD4z5AeHYHIuqnlNuJUp7ZPYhYEYeFlfh51Mi0vN+G4CdwFoh ecnqYvnVH+XbyinOcf+XqvpH81kCaSlzY10ttB8CB9oiZLKTe4x+nrjDJnSdTbHvtqOh Cy4CEdybXbU5Rv+lU+3+nhUv5oncmpavuuKecdL2X2P59zLFXqYkZYHvnN1ydKPkxAQC z3Ezq/Miwx8ehp7icAjdAtjBmmyVKUwytPmgS7vM8iHcu5z4xWr/EAk8SbANFQXefmJK LckMwSAQKpfUkaW3ZsLA+O+0X2brov+abzQCu7eyjFDCibQoz/2laYvLMu8+5u7PRiMf 1oGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hD6l8n5t; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lu24si3188596ejb.477.2020.07.16.08.43.20; Thu, 16 Jul 2020 08:43:43 -0700 (PDT) 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=@linaro.org header.s=google header.b=hD6l8n5t; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729559AbgGPPkV (ORCPT + 99 others); Thu, 16 Jul 2020 11:40:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729533AbgGPPkO (ORCPT ); Thu, 16 Jul 2020 11:40:14 -0400 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C836C08C5C0 for ; Thu, 16 Jul 2020 08:40:14 -0700 (PDT) Received: by mail-ej1-x643.google.com with SMTP id lx13so7050640ejb.4 for ; Thu, 16 Jul 2020 08:40:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=R0hixZr2FmuyDxkOlsaDyB/rdEVS5zH7ZB3SMwB7SjA=; b=hD6l8n5tJJDWItbmnePOZqH87rq9e8eH4kwTJjei+YlKoq+eZA6TxVUrekVxY7d3Wr sq4TgU+k4PJIOwlPET6TC8b7a9T4l6guHNgOwJ7s8lXuIodZrVm/mBol4m6qXC6pQ0ke jeORpF49hRiPTmT1zhAXpBOAXLldbfNj5a9MlouXOr6XopKltk2mbMZsdGW9QZMY0gRu 7xKMEt2jKEN1zJWRtNGVQkRz3m785A0bjhgt91N4O1BYoxq8DN37CVavlMU9yBvS2V4w YVfk76wli+I2fBBGwyHwxH+LsW0iXasq9FkxBsWT+Rgjw6oevIZko/T6J7+ORXQl53Yg SKYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=R0hixZr2FmuyDxkOlsaDyB/rdEVS5zH7ZB3SMwB7SjA=; b=ecdcK0VR7+TevxWCSBNoAtpcZ39Wi7YhNBC1VGReSjsU3o4vDDrMgEZsV793yPsVHX rYLKGlC6nLG6mtEyrA2tKguVNTZox64BaT+Br2EYLuRg2fO5yq7+4JaWD4mknDzDUWem +S3cEms0/TD7tOfni0nj6t1ZBExj9xCo5kRwc8xPAlUnoswhLxYr+eaUZIhVwKKqTwm2 wigD7jhbwiC45wPPihiP4/SDEVllOzYlxIja0dNTMdfRA6vaxtzzqNM7NmkG7QEPSsLK d68nE50jvLU3gja0/2ibVAINoY0i8GGjUwjxGOuGabfPMJMpppFV7P/JPh1jcHNMO3oY kRMA== X-Gm-Message-State: AOAM531r7NWZeLnSpdQcz1g9xxvjENaAKbcUpc8pAzaW4dwkbQeF2Tje eXmoH/TPguKQ9VwyDd3PaxRZKg== X-Received: by 2002:a17:906:3c42:: with SMTP id i2mr4628994ejg.14.1594914012974; Thu, 16 Jul 2020 08:40:12 -0700 (PDT) Received: from myrica ([2001:1715:4e26:a7e0:116c:c27a:3e7f:5eaf]) by smtp.gmail.com with ESMTPSA id gu15sm5285033ejb.111.2020.07.16.08.40.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jul 2020 08:40:12 -0700 (PDT) Date: Thu, 16 Jul 2020 17:39:59 +0200 From: Jean-Philippe Brucker To: "Liu, Yi L" Cc: Will Deacon , "alex.williamson@redhat.com" , "eric.auger@redhat.com" , "baolu.lu@linux.intel.com" , "joro@8bytes.org" , "Tian, Kevin" , "jacob.jun.pan@linux.intel.com" , "Raj, Ashok" , "Tian, Jun J" , "Sun, Yi Y" , "peterx@redhat.com" , "Wu, Hao" , "stefanha@gmail.com" , "iommu@lists.linux-foundation.org" , "kvm@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Robin Murphy Subject: Re: [PATCH v5 03/15] iommu/smmu: Report empty domain nesting info Message-ID: <20200716153959.GA447208@myrica> References: <1594552870-55687-1-git-send-email-yi.l.liu@intel.com> <1594552870-55687-4-git-send-email-yi.l.liu@intel.com> <20200713131454.GA2739@willie-the-truck> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 14, 2020 at 10:12:49AM +0000, Liu, Yi L wrote: > > Have you verified that this doesn't break the existing usage of > > DOMAIN_ATTR_NESTING in drivers/vfio/vfio_iommu_type1.c? > > I didn't have ARM machine on my hand. But I contacted with Jean > Philippe, he confirmed no compiling issue. I didn't see any code > getting DOMAIN_ATTR_NESTING attr in current drivers/vfio/vfio_iommu_type1.c. > What I'm adding is to call iommu_domai_get_attr(, DOMAIN_ATTR_NESTIN) > and won't fail if the iommu_domai_get_attr() returns 0. This patch > returns an empty nesting info for DOMAIN_ATTR_NESTIN and return > value is 0 if no error. So I guess it won't fail nesting for ARM. I confirm that this series doesn't break the current support for VFIO_IOMMU_TYPE1_NESTING with an SMMUv3. That said... If the SMMU does not support stage-2 then there is a change in behavior (untested): after the domain is silently switched to stage-1 by the SMMU driver, VFIO will now query nesting info and obtain -ENODEV. Instead of succeding as before, the VFIO ioctl will now fail. I believe that's a fix rather than a regression, it should have been like this since the beginning. No known userspace has been using VFIO_IOMMU_TYPE1_NESTING so far, so I don't think it should be a concern. And if userspace queries the nesting properties using the new ABI introduced in this patchset, it will obtain an empty struct. I think that's acceptable, but it may be better to avoid adding the nesting cap if @format is 0? Thanks, Jean > > @Eric, how about your opinion? your dual-stage vSMMU support may > also share the vfio_iommu_type1.c code. > > Regards, > Yi Liu > > > Will