From: Yongji Xie <xyjxie@linux.vnet.ibm.com>
To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-pci@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
linux-doc@vger.kernel.org
Cc: bhelgaas@google.com, corbet@lwn.net, aik@ozlabs.ru,
alex.williamson@redhat.com, benh@kernel.crashing.org,
paulus@samba.org, mpe@ellerman.id.au, warrier@linux.vnet.ibm.com,
zhong@linux.vnet.ibm.com, nikunj@linux.vnet.ibm.com,
eric.auger@linaro.org, will.deacon@arm.com,
gwshan@linux.vnet.ibm.com, alistair@popple.id.au,
ruscur@russell.cc, Yongji Xie <xyjxie@linux.vnet.ibm.com>
Subject: [RFC v5 6/7] PCI: Add a new bit to pci_bus_flags to indicate interrupt remapping
Date: Tue, 5 Apr 2016 21:46:43 +0800 [thread overview]
Message-ID: <1459864004-2869-1-git-send-email-xyjxie@linux.vnet.ibm.com> (raw)
I'm trying to find a proper way to indicate
the capability of interrupt remapping on PPC64
because we need this to determine whether it is
safe to mmap MSI-X table in VFIO driver.
There is a existing flag for this in the IOMMU
space:
enum iommu_cap {
IOMMU_CAP_CACHE_COHERENCY,
---> IOMMU_CAP_INTR_REMAP,
IOMMU_CAP_NOEXEC,
};
But it seems to be not a good idea to use
bus_set_iommu() to add this flag on PPC64 which
never set/use iommu_ops.
Eric also posted a patchset [1] to abstract
this capability on MSI controller side for ARM.
But I found we also never use msi_domain_info
on PPC64. We have to rework the MSI code on
PPC64 to support msi_domain_ops if we want to
use msi_domain_info.
Then I noticed that interrupt remapping is
abstracted on PCI host bridge side on PPC64.
So I'm thinking whether we could add a new
bit to pci_bus_flags to indicate this
capability, like this patch does.
Compared with IOMMU_CAP_INTR_REMAP, this
flag is more common. Any arch can set/use this
easily. And it can provide a better granularity
(pci_bus_type -> pci_bus).
[1] http://www.spinics.net/lists/kvm/msg130262.html
Signed-off-by: Yongji Xie <xyjxie@linux.vnet.ibm.com>
---
arch/powerpc/platforms/powernv/pci-ioda.c | 8 ++++++++
include/linux/pci.h | 1 +
2 files changed, 9 insertions(+)
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index f90dc04..9557638 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -3080,6 +3080,12 @@ static void pnv_pci_ioda_fixup(void)
pnv_npu_ioda_fixup();
}
+int pnv_pci_ioda_root_bridge_prepare(struct pci_host_bridge *bridge)
+{
+ bridge->bus->bus_flags |= PCI_BUS_FLAGS_MSI_REMAP;
+ return 0;
+}
+
/*
* Returns the alignment for I/O or memory windows for P2P
* bridges. That actually depends on how PEs are segmented.
@@ -3364,6 +3370,8 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np,
*/
ppc_md.pcibios_fixup = pnv_pci_ioda_fixup;
+ ppc_md.pcibios_root_bridge_prepare = pnv_pci_ioda_root_bridge_prepare;
+
if (phb->type == PNV_PHB_NPU)
hose->controller_ops = pnv_npu_ioda_controller_ops;
else
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 27df4a6..741dcaf 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -193,6 +193,7 @@ typedef unsigned short __bitwise pci_bus_flags_t;
enum pci_bus_flags {
PCI_BUS_FLAGS_NO_MSI = (__force pci_bus_flags_t) 1,
PCI_BUS_FLAGS_NO_MMRBC = (__force pci_bus_flags_t) 2,
+ PCI_BUS_FLAGS_MSI_REMAP = (__force pci_bus_flags_t) 3,
};
/* These values come from the PCI Express Spec */
--
1.7.9.5
next reply other threads:[~2016-04-05 13:48 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-05 13:46 Yongji Xie [this message]
2016-04-05 13:46 ` [RFC v5 7/7] vfio-pci: Allow to mmap MSI-X table if interrupt remapping is supported Yongji Xie
2016-04-06 0:00 ` Gavin Shan
2016-04-06 3:28 ` Yongji Xie
2016-04-06 14:45 ` Alex Williamson
2016-04-07 11:38 ` Yongji Xie
2016-04-07 14:23 ` Eric Auger
2016-04-08 8:14 ` Yongji Xie
2016-04-08 9:10 ` Eric Auger
2016-04-08 10:30 ` Yongji Xie
2016-04-06 0:11 ` [RFC v5 6/7] PCI: Add a new bit to pci_bus_flags to indicate interrupt remapping Gavin Shan
2016-04-06 3:18 ` Yongji Xie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1459864004-2869-1-git-send-email-xyjxie@linux.vnet.ibm.com \
--to=xyjxie@linux.vnet.ibm.com \
--cc=aik@ozlabs.ru \
--cc=alex.williamson@redhat.com \
--cc=alistair@popple.id.au \
--cc=benh@kernel.crashing.org \
--cc=bhelgaas@google.com \
--cc=corbet@lwn.net \
--cc=eric.auger@linaro.org \
--cc=gwshan@linux.vnet.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=nikunj@linux.vnet.ibm.com \
--cc=paulus@samba.org \
--cc=ruscur@russell.cc \
--cc=warrier@linux.vnet.ibm.com \
--cc=will.deacon@arm.com \
--cc=zhong@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).