From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756245AbdJJNVY (ORCPT ); Tue, 10 Oct 2017 09:21:24 -0400 Received: from 8bytes.org ([81.169.241.247]:58062 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755866AbdJJNVW (ORCPT ); Tue, 10 Oct 2017 09:21:22 -0400 Date: Tue, 10 Oct 2017 15:21:20 +0200 From: Joerg Roedel To: Jacob Pan Cc: iommu@lists.linux-foundation.org, LKML , David Woodhouse , Greg Kroah-Hartman , Rafael Wysocki , Jean-Philippe Brucker , "Liu, Yi L" , Lan Tianyu , "Tian, Kevin" , Raj Ashok , Alex Williamson , Liu@8bytes.org, Yi L Subject: Re: [PATCH v2 02/16] iommu/vt-d: add bind_pasid_table function Message-ID: <20171010132119.jwtayeordrvvnlen@8bytes.org> References: <1507244624-39189-1-git-send-email-jacob.jun.pan@linux.intel.com> <1507244624-39189-3-git-send-email-jacob.jun.pan@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1507244624-39189-3-git-send-email-jacob.jun.pan@linux.intel.com> User-Agent: NeoMutt/20170421 (1.8.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 05, 2017 at 04:03:30PM -0700, Jacob Pan wrote: > + pdev = to_pci_dev(dev); > + if (!pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_PRI)) > + return -EINVAL; > + sid = PCI_DEVID(bus, devfn); Okay, you search for the PRI capability ... > + > + info = dev->archdata.iommu; > + if (!info || !info->pasid_supported) { > + dev_err(dev, "No PASID support\n"); > + ret = -EINVAL; > + goto out; > + } > + if (!info->pasid_enabled) { > + ret = pci_enable_pasid(pdev, info->pasid_supported & ~1); > + if (ret) > + goto out; ... and you enable PASID in bind_pasid_table() ... > + /* > + * REVISIT: we might want to clear the PASID table pointer > + * as part of context clear operation. Currently, it leaves > + * stale data but should be ignored by hardware since PASIDE > + * is clear. > + */ > + /* ATS will be reenabled when remapping is restored */ > + pci_disable_ats(to_pci_dev(dev)); .. while you disable ATS in unbind_pasid_table(). Where does this asymmetry come from? > #define CONTEXT_DINVE (1ULL << 8) > #define CONTEXT_PRS (1ULL << 9) > +#define CONTEXT_NESTE (1ULL << 10) Missing 'D' at the end?