Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp786878pxj; Thu, 3 Jun 2021 20:49:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzyrtZ9PqbmchG9vDLr5vxeFZO/YSFu6s9wYgu+cRVxqbJrwVUK3zSWw6pa9FeI1RNTVTLC X-Received: by 2002:a05:6402:4cf:: with SMTP id n15mr2676292edw.162.1622778581300; Thu, 03 Jun 2021 20:49:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622778581; cv=none; d=google.com; s=arc-20160816; b=l6hUbytijq9cVG6NQOBANEnPsy97v1GHsolT73JcuPxssTvrG4q4aH02g/VCdV3G9w gZD+/q96TcZrSV5obuiisHr13oqjtJi84DdCsvM96gw/HUB0O+AV1yvaggDue7Hr4KpP I9kKb6/KagkPLqczKZ7E8oVtfCpTpm5C5ZLTlqlsxYl50xOzd7MflEZhqCAj1NQzCGXu DHRkmQ/V70U0rSoiQbQQKJK+M5AjZMOzuyjOzQpaoK7RFCXz7Ey+N9mTpWy5Y4/aEUUy otSj5KiTzVet4QiY2Bu2S9KRXI0F18Pv2ltvgCeDe5VWcNA457iupyMl3LurNeH2YkLd 0Ucg== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=qYVKZDuvt5Qic5U7hRSglNEDW7YcTuvFUNtFxiNT7O8=; b=PzpQ+oow5jKBEHi7n3xRVZJFIJJL9+E6vK6jOKSSFRicd+1RAtA4L7nx0tboB69BIf kih5af69Ma0dl74ltkJXkGvVA22jOyfbqN3KLDbBAppSxrGHIPG6PqkcW/clvb1nupC0 KAMeRuPVIcfNU+hGNKOIsnI2zgopEI9wTyJ3qKqcLgf8lLdz6Im+ibjd5+KbA/Um0vC+ 0X7g+k/8E0kTdOJxZFinle7xXxmErAazpfPHl4wwAEKJ77y9oWCAtTa1Zk4URtC0/kPI PcbUPzFqRCXnP+Z5qR35xcGvywp0R/qHMwcocSDbJMQfYYXejmoasdsSMSkJ8FLWYffg oYHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="AZ/Y54Hv"; 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 o7si3781182edq.367.2021.06.03.20.49.17; Thu, 03 Jun 2021 20:49:41 -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="AZ/Y54Hv"; 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 S229818AbhFDDtW (ORCPT + 99 others); Thu, 3 Jun 2021 23:49:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:22785 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229775AbhFDDtV (ORCPT ); Thu, 3 Jun 2021 23:49:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622778456; 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=qYVKZDuvt5Qic5U7hRSglNEDW7YcTuvFUNtFxiNT7O8=; b=AZ/Y54HvkpKqAG3KwZEZoyWKVhYffiS+2s8wSYi48rDrWlS9ZH2W11E0vXkZfQ3XoNPesD 3G5jXFszrhz5lwTHMcFxUGdOuzswtqtAH17BKm/NqK5fDDXmqaoq2gMgk/JR7G1bBJEgY2 RMOKDCo5+iFnfCQLTTw8KAjOKqzOYAc= Received: from mail-ot1-f71.google.com (mail-ot1-f71.google.com [209.85.210.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-159-DoPgn5hRNHiUoJ-7G1PNQg-1; Thu, 03 Jun 2021 23:47:34 -0400 X-MC-Unique: DoPgn5hRNHiUoJ-7G1PNQg-1 Received: by mail-ot1-f71.google.com with SMTP id 19-20020a9d04130000b02903cb28b38d0aso2953824otc.19 for ; Thu, 03 Jun 2021 20:47:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qYVKZDuvt5Qic5U7hRSglNEDW7YcTuvFUNtFxiNT7O8=; b=cPhmBGrDJyfazD6vtmyyq4VPceellMyfZplFwPSo4bqRLMqF1AuCtw7IGO0B1Hl0Q4 ZJVwNtrYt2l+18BiPK+o+RgpjtyOOqqpZ2yJRdxfmy9wCH9Ur+4IJKLKihuZWtWSmm43 05CGlRPmcodSyV796a6o6mkRUg7V8jyHIi0NtVIeKGcsnDVVTNGZE61jbWUpdwgtjKzt GTbIyqf/fkZsaA7zHByKBJF1NyF2FOROUi/8SMO1muAVMSd1K/qhoq2lOeBGJvyzDCaT 0ACHi1sKKs+PnhBw+6nYi+uI5FZ3ejVXAm8VrufpBcBtxal0XmrD+RrSbgjcycNUj85W 1unw== X-Gm-Message-State: AOAM530+KU8YkzlXQJ/Ot40sYOtQFjI2Tqv899lO4m3v4XpqPhez2u2A eOjwYmq+gQ7fTMI5s62o9GLTpQDt45lSuaQSgcinHdbNaV9pRR+R/Y0Vro8oTc6uRoYbPdyrLli B4AxlT5okDgS9BFX2bcBFW0OA X-Received: by 2002:aca:42c6:: with SMTP id p189mr9377788oia.36.1622778454090; Thu, 03 Jun 2021 20:47:34 -0700 (PDT) X-Received: by 2002:aca:42c6:: with SMTP id p189mr9377780oia.36.1622778453943; Thu, 03 Jun 2021 20:47:33 -0700 (PDT) Received: from redhat.com ([198.99.80.109]) by smtp.gmail.com with ESMTPSA id n11sm214881oom.1.2021.06.03.20.47.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Jun 2021 20:47:33 -0700 (PDT) Date: Thu, 3 Jun 2021 21:47:31 -0600 From: Alex Williamson To: Dave Jiang Cc: kwankhede@nvidia.com, tglx@linutronix.de, vkoul@kernel.org, jgg@mellanox.com, 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 Subject: Re: [PATCH v6 12/20] vfio: move VFIO PCI macros to common header Message-ID: <20210603214731.1631a480.alex.williamson@redhat.com> In-Reply-To: <162164281969.261970.17759783730654052269.stgit@djiang5-desk3.ch.intel.com> References: <162164243591.261970.3439987543338120797.stgit@djiang5-desk3.ch.intel.com> <162164281969.261970.17759783730654052269.stgit@djiang5-desk3.ch.intel.com> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 21 May 2021 17:20:19 -0700 Dave Jiang wrote: > Move some VFIO_PCI macros to a common header as they will be shared between > mdev and vfio_pci. No, this is the current implementation of vfio-pci, it's specifically not meant to be a standard. Each vfio device driver is free to expose regions on the device file descriptor as they wish. If you want to use a 40-bit implementation as well, great, but it should not be imposed as a standard. Thanks, Alex > 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; > >