Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp216754ybi; Wed, 29 May 2019 19:58:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqyBHpc0D6ZDJy2sn3+17CLOph34BQ/aKtiB0L8GYZIlUAsk74dVa98sJUiE4CApC5U0JK5v X-Received: by 2002:a17:902:a9cc:: with SMTP id b12mr1482145plr.96.1559185086089; Wed, 29 May 2019 19:58:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559185086; cv=none; d=google.com; s=arc-20160816; b=HTpVpZDGlcny066EXpqzSk5e3bg0/6hCnRts5igILZSdOyfn7+vX9q7QhYewCKfXOe dLG8tEFLilgc+yW/VTqZql/E6qx9dOmrQ0na/GIVI2HCdvgiKfS4KO1/o/fywnPS9P8d 3lMxGTjSGm5M2LwRZqaAm6AWkYDvDTFNWOs+UIo99xcm5qqDR5OOp11YBKFqDLz7sANa moJPz3xfseL4QIo3FMkyRgQgpF7FmsP60VzxbqlPE18UJZlpmFusDvtApnfgXv3LrlwV EVWumLCx5FKANQieXDsPg8SCQy+VVYvYP+2eKkdxQ1g7fGp/WJDxmXxVjYxt/CWw7eV3 WmHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=I9CS1/59zsF4YqnOBQRoTcxKLbTITiMxOVggaUTT04o=; b=aRdr4kd4uoc3zkWJu0bJ4mXOVlRYoqBXE8F5S9PJoCP9I65cMusSThOw1u2uWGXrTV N/q9qtGeNBeEeUlk0q2ZvBtHc/mzhvK87hMCXmhSQACjSretQhRwWCLNaeEw+DZoSl2z x0qowCJDMaj5BcQrF5ouCOvU/oWnNlcSeMPpEsHvAbraB05QWYuHPI9UqQs0EvMPNPxB ISYw+Q/+BbwcMBMqkMKm65irXLdmIYhUW9TNvabK1lN+WONUdac95/XQ8/JlvkAfyD0V yS/dHr0W104c0emz0RYbQjJ/u/tU2QkLAQshvpUQI/pPvdaFI2XRP7CagREthMN+GY9q j48Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CT7nsMzk; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z10si1778774plk.235.2019.05.29.19.57.36; Wed, 29 May 2019 19:58:06 -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; dkim=pass header.i=@kernel.org header.s=default header.b=CT7nsMzk; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726498AbfE3Cxr (ORCPT + 99 others); Wed, 29 May 2019 22:53:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:38110 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725821AbfE3Cxr (ORCPT ); Wed, 29 May 2019 22:53:47 -0400 Received: from localhost (15.sub-174-234-174.myvzw.com [174.234.174.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DD91824436; Thu, 30 May 2019 02:53:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559184826; bh=dJjuutwlsJWuUYPVvoDzC466oY9mTX65HsTocKaKpX8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=CT7nsMzkVlj7qrxFjlzjbuNUsiSynp6AbLR2KteSpLjoX4qaJJ6QiSMnK26RocgwC eH322GNECCspD6RXNH5ZHrS5zx/kAFMB+ochp++NjmDE/hYzWsRxNA1oJ1guY7HjBd XEL5uMqI3v/6yPyST67OkEHjBAcw7cfyYUkH03Lg= Date: Wed, 29 May 2019 21:53:44 -0500 From: Bjorn Helgaas To: sathyanarayanan.kuppuswamy@linux.intel.com Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, ashok.raj@intel.com, keith.busch@intel.com Subject: Re: [PATCH v2 3/5] PCI/ATS: Skip VF ATS initialization if PF does not implement it Message-ID: <20190530025344.GG28250@google.com> References: <21d93b3312418c1e28aeec238ef855c72efeb96a.1557162861.git.sathyanarayanan.kuppuswamy@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <21d93b3312418c1e28aeec238ef855c72efeb96a.1557162861.git.sathyanarayanan.kuppuswamy@linux.intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 06, 2019 at 10:20:05AM -0700, sathyanarayanan.kuppuswamy@linux.intel.com wrote: > From: Kuppuswamy Sathyanarayanan > > If PF does not implement ATS and VF implements/uses it, it might lead to > runtime issues. Also, as per spec r4.0, sec 9.3.7.8, PF should implement > ATS if VF implements it. So add additional check to confirm given device > aligns with the spec. "might lead to runtime issues" is pretty wishy-washy. I really don't want to prevent some device from working merely because it has something in config space that doesn't follow the spec exactly but we never touch. > Cc: Ashok Raj > Cc: Keith Busch > Suggested-by: Ashok Raj > Reviewed-by: Keith Busch > Signed-off-by: Kuppuswamy Sathyanarayanan > --- > drivers/pci/ats.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/drivers/pci/ats.c b/drivers/pci/ats.c > index e7a904e347c3..718e6f414680 100644 > --- a/drivers/pci/ats.c > +++ b/drivers/pci/ats.c > @@ -19,6 +19,7 @@ > void pci_ats_init(struct pci_dev *dev) > { > int pos; > + struct pci_dev *pdev; > > if (pci_ats_disabled()) > return; > @@ -27,6 +28,17 @@ void pci_ats_init(struct pci_dev *dev) > if (!pos) > return; > > + /* > + * Per PCIe r4.0, sec 9.3.7.8, if VF implements Address Translation > + * Services (ATS) Extended Capability then corresponding PF should > + * also implement it. > + */ > + if (dev->is_virtfn) { > + pdev = pci_physfn(dev); > + if (!pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_ATS)) > + return; > + } > + > dev->ats_cap = pos; > } > > -- > 2.20.1 >