Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1892661pxk; Tue, 1 Sep 2020 10:10:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4gi4CDKcrZM9sLRC0XxGdKnkTLc4r+pL+lMBmgjt1N4h3wDNkywLsDRX0L3kV92mJ6Tug X-Received: by 2002:a17:906:9443:: with SMTP id z3mr2584525ejx.156.1598980208165; Tue, 01 Sep 2020 10:10:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598980208; cv=none; d=google.com; s=arc-20160816; b=IYdgUjz7FuGmN6gApVYSJjzd/wuJaRDtvX4FUvdgjMqdChy+d+kccWNxVAf2MB6Y2E R+GnnQ/3geQFHC5tI/be1hm+Nz8fOSMddLR77lRXD2Ra2e332o/k+bulkw7TEEL6iKLC lsXvqbA2fysJfaGIaBFN+iT4LoRa0ZjTVmZXGQrqJix7/Eglk5iMiPEtNkOlMel/M8gy aBnIqu1ONtr5e8b8QBI6KdgT7SwjIjM+3K1LGvF3xBcLu3mjjXIy96ajGmoxLYctDrvZ HIdWlaVdtj8/0qgPVPYDOWBQOrd8YbV4M7n6EH9MgbWdtvLND26eV0wYNm+GdocfVFWA PbbA== 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:cc:to:subject:dkim-signature; bh=W/K3itRNGDBjecxllh4C4p9hfEhx4LxfXXlrS6JO9Q0=; b=IrZjbPQ8b9ugiIdkzOfrV4FgN9h9H7BuKWfIf/KgA83jw9s8rD7Mqfh+t6R5itCSgI coEd3e0LG4Okic4hBUpL+J+B2UjtHky1rS8tCdnYbSNSptib0U4IFQy6y+NfFsq7RXwB lj3YvPkcPnlY46yprpMYGWfS9QK2reFxUdRLxEMLgwAYjy1Lxnn6GlWZq5WLWI5GLlOU uGn74HmzgT2KkyCWHBuZ46n6t2UVpWb81qUImY2qqNRuePLl1lzLXFifAdeKD8fqxJJu uAVZzKDgur5knH4ux2nVmTg2blCrB6daNqjbBDc6f/Vr/qNgr2t3qHTVGG5b60G1iBz+ 7RLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Lqe9meLt; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y22si901853edo.147.2020.09.01.10.09.44; Tue, 01 Sep 2020 10:10:08 -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=@redhat.com header.s=mimecast20190719 header.b=Lqe9meLt; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728379AbgIARI7 (ORCPT + 99 others); Tue, 1 Sep 2020 13:08:59 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:22184 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732470AbgIARIz (ORCPT ); Tue, 1 Sep 2020 13:08:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598980133; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=W/K3itRNGDBjecxllh4C4p9hfEhx4LxfXXlrS6JO9Q0=; b=Lqe9meLtYn98xnr0romEpt0VPzO+wU58W6MLWaas32rlMpT7UH72Z6eqBX92CWElgbSBnN ttRoQ4SectMV4hVGbX24f1ljKAb765UeyOtOCd4anWwOwPYi0zISz0eUUi9ecABDmlamKg lWgLz94weGZrLTL2U2M5pXYwRHNY7OA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-549-4-MR4TRsOMu058QrcOsSYQ-1; Tue, 01 Sep 2020 13:08:52 -0400 X-MC-Unique: 4-MR4TRsOMu058QrcOsSYQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3B2E7107B26B; Tue, 1 Sep 2020 17:08:50 +0000 (UTC) Received: from [10.36.112.51] (ovpn-112-51.ams2.redhat.com [10.36.112.51]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B26EF7B931; Tue, 1 Sep 2020 17:08:46 +0000 (UTC) Subject: Re: [PATCH v2 9/9] iommu/vt-d: Store guest PASID during bind To: Jacob Pan , iommu@lists.linux-foundation.org, LKML , Jean-Philippe Brucker , Lu Baolu , Joerg Roedel , David Woodhouse Cc: Yi Liu , "Tian, Kevin" , Raj Ashok , Wu Hao References: <1598070918-21321-1-git-send-email-jacob.jun.pan@linux.intel.com> <1598070918-21321-10-git-send-email-jacob.jun.pan@linux.intel.com> From: Auger Eric Message-ID: <60feda75-5862-c898-97b1-1f5eafdb8d8c@redhat.com> Date: Tue, 1 Sep 2020 19:08:44 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <1598070918-21321-10-git-send-email-jacob.jun.pan@linux.intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jacob, On 8/22/20 6:35 AM, Jacob Pan wrote: > IOASID core maintains the guest-host mapping in the form of SPID and > IOASID. This patch assigns the guest PASID (if valid) as SPID while > binding guest page table with a host PASID. This mapping will be used > for lookup and notifications. > > Signed-off-by: Jacob Pan > --- > drivers/iommu/intel/svm.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/iommu/intel/svm.c b/drivers/iommu/intel/svm.c > index d8a5efa75095..4c958b1aec4c 100644 > --- a/drivers/iommu/intel/svm.c > +++ b/drivers/iommu/intel/svm.c > @@ -406,6 +406,7 @@ int intel_svm_bind_gpasid(struct iommu_domain *domain, struct device *dev, > if (data->flags & IOMMU_SVA_GPASID_VAL) { > svm->gpasid = data->gpasid; > svm->flags |= SVM_FLAG_GUEST_PASID; > + ioasid_attach_spid(data->hpasid, data->gpasid); don't you want to handle the returned value? > } > svm->iommu = iommu; > /* > @@ -517,6 +518,7 @@ int intel_svm_unbind_gpasid(struct device *dev, int pasid) > ioasid_attach_data(pasid, NULL); > ioasid_notify(pasid, IOASID_UNBIND, > IOASID_NOTIFY_SET); > + ioasid_attach_spid(pasid, INVALID_IOASID); So this answers my previous question ;-) but won't it enter the if (!ioasid_data) path and fail to reset the spid? Eric > kfree(svm); > } > } >