Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1531872pxj; Fri, 21 May 2021 17:24:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxzS6BWkTjOtWreYdoAME8IGAbHYJYnUpHUtoCFZjv+aY3hpmPw943mQdD0BY2szg0/6pJJ X-Received: by 2002:a17:906:4806:: with SMTP id w6mr12375543ejq.180.1621643053382; Fri, 21 May 2021 17:24:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621643053; cv=none; d=google.com; s=arc-20160816; b=oSrHZMYeJJG3cC4PGMLnDUdwFFE6W7AAzxfd3j2CLwek7JLe0LxXB1HnDvMeUHiypw 1FISbmCIuP40w25nKQcK4IaSdSdFTJTNzAAc/ec/DR3RvpwDMm7i82awpQiA9/4MIWul zR1VYj4gw8rOu9eJoPisaxooTM/2k8mfUV6l8iHrxx6Y592t14hZ39FEyOeMJtmMG/uZ 1dygzSrRpkR2NaUI9Lg3243rTaIS8kjzAdV3xuzYQ+rgbvMAx3qwBvn8mSFdYAAxazWA 6lUQLJH+61GcbXYMyOrG8cojLAbcZi+XFseCJDajcIwsqTRXu0ZVVgy54hjuFucM83Mc wV5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:ironport-sdr:ironport-sdr; bh=sxVxgQ2qkzxx3dSTobxaMigG6Se84HFy+pLoNMhymPI=; b=P3i1xvebl0IHGB/fF/b/FGbQOK1DK7el15q7fFwyblbuTso1TvM4boNfMrCCinCnRV zrtuf7gZdL8keywVGwrkbrI4DbDiT74YG0wL7fzK501PdihJ1bsLXsabfR9NxIctO4lF 7UCXsDHU5WoUM8huokd0s1TOXV40gh2aBqk2ReAT5fogTrDG9Q24u9Fspy6h3CVXovCU 8VEovOjWiasOYH7nKQlQvo8LhA7TujeT74vA3Uwfl1efH0uwiysZZqtkHfnEmHaTCUp9 pJf+neztzog4469kMX6r5vF1vUKrIn0ORomkiD4ObcQjN/ot6G5SvIFKcRuT0/wcHj3C 8pmg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l1si2193228edq.336.2021.05.21.17.23.50; Fri, 21 May 2021 17:24:13 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230417AbhEVAWK (ORCPT + 99 others); Fri, 21 May 2021 20:22:10 -0400 Received: from mga04.intel.com ([192.55.52.120]:56043 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230429AbhEVAVp (ORCPT ); Fri, 21 May 2021 20:21:45 -0400 IronPort-SDR: K35w6VC0hlQX9d2mettQWPSDGB902fE2ncvqx4YHCnIcuqaxB1vQaAMWrjbCQ8Y3bCWfvR8qLL Y2ASgy9rYUvg== X-IronPort-AV: E=McAfee;i="6200,9189,9991"; a="199661232" X-IronPort-AV: E=Sophos;i="5.82,319,1613462400"; d="scan'208";a="199661232" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 May 2021 17:20:21 -0700 IronPort-SDR: UkWvMMWLQ2DdpdHYUq2/Q0h8ON+Cj0jkwViQ5ds8S1zGJV6+shLzce+s7LHrKRkSnG3p9dtTBF 5ezXbcRifusw== X-IronPort-AV: E=Sophos;i="5.82,319,1613462400"; d="scan'208";a="434500908" Received: from djiang5-desk3.ch.intel.com ([143.182.136.137]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 May 2021 17:20:20 -0700 Subject: [PATCH v6 12/20] vfio: move VFIO PCI macros to common header From: Dave Jiang To: alex.williamson@redhat.com, kwankhede@nvidia.com, tglx@linutronix.de, vkoul@kernel.org, jgg@mellanox.com Cc: megha.dey@intel.com, jacob.jun.pan@intel.com, ashok.raj@intel.com, yi.l.liu@intel.com, baolu.lu@intel.com, kevin.tian@intel.com, sanjay.k.kumar@intel.com, tony.luck@intel.com, dan.j.williams@intel.com, eric.auger@redhat.com, pbonzini@redhat.com, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Date: Fri, 21 May 2021 17:20:19 -0700 Message-ID: <162164281969.261970.17759783730654052269.stgit@djiang5-desk3.ch.intel.com> In-Reply-To: <162164243591.261970.3439987543338120797.stgit@djiang5-desk3.ch.intel.com> References: <162164243591.261970.3439987543338120797.stgit@djiang5-desk3.ch.intel.com> User-Agent: StGit/0.23-29-ga622f1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Move some VFIO_PCI macros to a common header as they will be shared between mdev and vfio_pci. Signed-off-by: Dave Jiang --- drivers/vfio/pci/vfio_pci_private.h | 6 ------ include/linux/vfio.h | 6 ++++++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/vfio/pci/vfio_pci_private.h b/drivers/vfio/pci/vfio_pci_private.h index a17943911fcb..e644f981509c 100644 --- a/drivers/vfio/pci/vfio_pci_private.h +++ b/drivers/vfio/pci/vfio_pci_private.h @@ -18,12 +18,6 @@ #ifndef VFIO_PCI_PRIVATE_H #define VFIO_PCI_PRIVATE_H -#define VFIO_PCI_OFFSET_SHIFT 40 - -#define VFIO_PCI_OFFSET_TO_INDEX(off) (off >> VFIO_PCI_OFFSET_SHIFT) -#define VFIO_PCI_INDEX_TO_OFFSET(index) ((u64)(index) << VFIO_PCI_OFFSET_SHIFT) -#define VFIO_PCI_OFFSET_MASK (((u64)(1) << VFIO_PCI_OFFSET_SHIFT) - 1) - /* Special capability IDs predefined access */ #define PCI_CAP_ID_INVALID 0xFF /* default raw access */ #define PCI_CAP_ID_INVALID_VIRT 0xFE /* default virt access */ diff --git a/include/linux/vfio.h b/include/linux/vfio.h index 3b372fa57ef4..ed5ca027eb49 100644 --- a/include/linux/vfio.h +++ b/include/linux/vfio.h @@ -15,6 +15,12 @@ #include #include +#define VFIO_PCI_OFFSET_SHIFT 40 + +#define VFIO_PCI_OFFSET_TO_INDEX(off) ((off) >> VFIO_PCI_OFFSET_SHIFT) +#define VFIO_PCI_INDEX_TO_OFFSET(index) ((u64)(index) << VFIO_PCI_OFFSET_SHIFT) +#define VFIO_PCI_OFFSET_MASK (((u64)(1) << VFIO_PCI_OFFSET_SHIFT) - 1) + struct vfio_device { struct device *dev; const struct vfio_device_ops *ops;