Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3583681ybi; Sun, 2 Jun 2019 18:25:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqyeyXHLd9YMqONVvQUHiuLWtSPM1Kz++/M1K5oOqeWtm3kCgiW0DRwMEBzvG/Hhd8UhAnew X-Received: by 2002:a65:64d5:: with SMTP id t21mr25979650pgv.310.1559525102322; Sun, 02 Jun 2019 18:25:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559525102; cv=none; d=google.com; s=arc-20160816; b=i84r0nF3xhVhcaMvIh4OdpbGgOcx+7fGEbE/PpgEF0NHrvzROX1WbiabHXhd/r50i+ qHOdPe+F/IJk/w1oCe0YFCbsrVk9X+NyQoQuchITjCHnZ0HLS49TIlUR78zDjicDxrY4 kJuR7aYcxcTZGiVwN8cMnkDuYTaL74AMpdyZv1hYBUMn/y3Bw5AyWJPAqjgBMC3kVriJ 47TQlZtIx6CZCeawCUkPaogm77coQz0+NvvOMjhi78PHWqaLEXhBA2AvV2ylJOFlkkMt IzaiIob42Z+KkXbr+DTvCx8We/8tK15SstNhnf28DO9Szkr1LnoBktMSrUXYzOgynM4r hOeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=aCuU9dKSaUs4yeage5DyvwOxFBPInaputV6hD7HlYho=; b=TfhvZdXow9WCDjkOHsnU0wmoV8EjVzwQj8J2ubgSfXDuByJokjuNkutX/QLyKG1IWQ DayTBZN2OosV+1eTp99ytuejfxtB9cBusW7T7ydhoXi9GFrWdo1MZQZTeTGwEhFuTFr9 KsEuNBiSBr92ZP/CjW0vdSJPFprDHDyjjx6RH9nn80vpYp9uKcp9JmHhKMKJtw5izn1V 4fP4uND9Su4O+mpNmv+NWZJUdbK6LFlnUqNs3peDTyghxxHQhE5Yt5k9R13fHa0zP8A1 VbdQKg6zMgciJEMwtroWNmbZ5BEgU9rVi00lSzquGEDA56RYTn8byWCXaQWWY0vKRuob cLtQ== 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 16si8977380pfu.100.2019.06.02.18.24.47; Sun, 02 Jun 2019 18:25:02 -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 S1726807AbfFCBXm (ORCPT + 99 others); Sun, 2 Jun 2019 21:23:42 -0400 Received: from mga17.intel.com ([192.55.52.151]:20792 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726270AbfFCBXl (ORCPT ); Sun, 2 Jun 2019 21:23:41 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Jun 2019 18:23:41 -0700 X-ExtLoop1: 1 Received: from allen-box.sh.intel.com ([10.239.159.136]) by FMSMGA003.fm.intel.com with ESMTP; 02 Jun 2019 18:23:37 -0700 From: Lu Baolu To: David Woodhouse , Joerg Roedel , Bjorn Helgaas , Christoph Hellwig Cc: ashok.raj@intel.com, jacob.jun.pan@intel.com, alan.cox@intel.com, kevin.tian@intel.com, mika.westerberg@linux.intel.com, Ingo Molnar , Greg Kroah-Hartman , pengfei.xu@intel.com, Konrad Rzeszutek Wilk , Marek Szyprowski , Robin Murphy , Jonathan Corbet , Boris Ostrovsky , Juergen Gross , Stefano Stabellini , Steven Rostedt , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Lu Baolu Subject: [PATCH v4 1/9] PCI: Add dev_is_untrusted helper Date: Mon, 3 Jun 2019 09:16:12 +0800 Message-Id: <20190603011620.31999-2-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190603011620.31999-1-baolu.lu@linux.intel.com> References: <20190603011620.31999-1-baolu.lu@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There are several places in the kernel where it is necessary to check whether a device is a pci untrusted device. Add a helper to simplify the callers. Signed-off-by: Lu Baolu --- include/linux/pci.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/pci.h b/include/linux/pci.h index 4a5a84d7bdd4..0582d869923d 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -979,6 +979,7 @@ void pcibios_setup_bridge(struct pci_bus *bus, unsigned long type); void pci_sort_breadthfirst(void); #define dev_is_pci(d) ((d)->bus == &pci_bus_type) #define dev_is_pf(d) ((dev_is_pci(d) ? to_pci_dev(d)->is_physfn : false)) +#define dev_is_untrusted(d) ((dev_is_pci(d) ? to_pci_dev(d)->untrusted : false)) /* Generic PCI functions exported to card drivers */ @@ -1707,6 +1708,7 @@ static inline struct pci_dev *pci_dev_get(struct pci_dev *dev) { return NULL; } #define dev_is_pci(d) (false) #define dev_is_pf(d) (false) +#define dev_is_untrusted(d) (false) static inline bool pci_acs_enabled(struct pci_dev *pdev, u16 acs_flags) { return false; } static inline int pci_irqd_intx_xlate(struct irq_domain *d, -- 2.17.1