From: Alexey Kardashevskiy Subject: Re: [PATCH kernel v4 4/6] iommu: Set PCI_BUS_FLAGS_MSI_REMAP on iommu driver initialization Date: Wed, 12 Jul 2017 17:28:26 +1000 Message-ID: References: <20170630052436.15212-1-aik@ozlabs.ru> <20170630052436.15212-5-aik@ozlabs.ru> <5965CA09.7050801@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, David Gibson , Alex Williamson , Bjorn Helgaas , Yongji Xie , Eric Auger , "Tian, Kevin" To: Jike Song Return-path: Received: from mail-io0-f195.google.com ([209.85.223.195]:36374 "EHLO mail-io0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933178AbdGLH2e (ORCPT ); Wed, 12 Jul 2017 03:28:34 -0400 Received: by mail-io0-f195.google.com with SMTP id h134so1329186iof.3 for ; Wed, 12 Jul 2017 00:28:33 -0700 (PDT) In-Reply-To: <5965CA09.7050801@intel.com> Content-Language: en-AU Sender: kvm-owner@vger.kernel.org List-ID: On 12/07/17 17:04, Jike Song wrote: > On 06/30/2017 01:24 PM, Alexey Kardashevskiy wrote: >> From: Yongji Xie >> >> Some iommu drivers would be initialized after PCI device >> enumeration. So PCI_BUS_FLAGS_MSI_REMAP would not be set >> when probing PCI devices although IOMMU enables capability >> of IRQ remapping. This patch tests this capability and >> set the flag when iommu driver is initialized. >> >> Signed-off-by: Yongji Xie >> Signed-off-by: Alexey Kardashevskiy >> --- >> drivers/iommu/iommu.c | 8 ++++++++ >> drivers/pci/probe.c | 1 + >> 2 files changed, 9 insertions(+) >> >> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c >> index cf7ca7e70777..0b5881ddca09 100644 >> --- a/drivers/iommu/iommu.c >> +++ b/drivers/iommu/iommu.c >> @@ -1063,6 +1063,14 @@ static int add_iommu_group(struct device *dev, void *data) >> const struct iommu_ops *ops = cb->ops; >> int ret; >> >> + /* >> + * Set PCI_BUS_FLAGS_MSI_REMAP for all PCI buses when IOMMU >> + * have capability of IRQ remapping. >> + */ >> + if (dev_is_pci(dev) && ops->capable && >> + ops->capable(IOMMU_CAP_INTR_REMAP)) >> + to_pci_dev(dev)->bus->bus_flags |= PCI_BUS_FLAGS_MSI_REMAP; > > [+Kevin] > > > Hi Alexey, > > Just a reminder, you might want to check the proposed patch to intel-iommu > by Alex, at: > > https://patchwork.kernel.org/patch/9092511/ > > Without that being the prerequisite, this patch will probably introduce > security issues on x86. Thanks, noted. Anything like this for AMD/s390? > > -- > Thanks, > Jike > >> + >> if (!ops->add_device) >> return 0; >> >> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c >> index f2393b7d7ebf..14aac9df3d17 100644 >> --- a/drivers/pci/probe.c >> +++ b/drivers/pci/probe.c >> @@ -17,6 +17,7 @@ >> #include >> #include >> #include >> +#include >> #include "pci.h" >> >> #define CARDBUS_LATENCY_TIMER 176 /* secondary latency timer */ >> -- Alexey