linux-s390.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Baolu Lu <baolu.lu@linux.intel.com>
To: Jason Gunthorpe <jgg@nvidia.com>,
	Alexander Gordeev <agordeev@linux.ibm.com>,
	Alex Williamson <alex.williamson@redhat.com>,
	Christian Borntraeger <borntraeger@linux.ibm.com>,
	Cornelia Huck <cohuck@redhat.com>,
	David Woodhouse <dwmw2@infradead.org>,
	Gerald Schaefer <gerald.schaefer@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Heiko Carstens <hca@linux.ibm.com>,
	iommu@lists.linux.dev, Joerg Roedel <joro@8bytes.org>,
	kvm@vger.kernel.org, linux-s390@vger.kernel.org,
	Marc Zyngier <maz@kernel.org>,
	Robin Murphy <robin.murphy@arm.com>,
	Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>,
	Sven Schnelle <svens@linux.ibm.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Will Deacon <will@kernel.org>
Cc: Bharat Bhushan <bharat.bhushan@nxp.com>,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	Eric Auger <eric.auger@redhat.com>,
	Eric Farman <farman@linux.ibm.com>,
	Kevin Tian <kevin.tian@intel.com>,
	Marc Zyngier <marc.zyngier@arm.com>,
	Matthew Rosato <mjrosato@linux.ibm.com>,
	Tomasz Nowicki <tomasz.nowicki@caviumnetworks.com>,
	Will Deacon <will.deacon@arm.com>
Subject: Re: [PATCH iommufd v3 7/9] iommu/x86: Replace IOMMU_CAP_INTR_REMAP with IRQ_DOMAIN_FLAG_ISOLATED_MSI
Date: Fri, 6 Jan 2023 19:42:10 +0800	[thread overview]
Message-ID: <1fe05b9a-3d1e-e1b7-8c5e-dd8da0966950@linux.intel.com> (raw)
In-Reply-To: <7-v3-3313bb5dd3a3+10f11-secure_msi_jgg@nvidia.com>

On 1/6/2023 3:33 AM, Jason Gunthorpe wrote:
> On x86 platforms when the HW can support interrupt remapping the iommu
> driver creates an irq_domain for the IR hardware and creates a child MSI
> irq_domain.
> 
> When the global irq_remapping_enabled is set, the IR MSI domain is
> assigned to the PCI devices (by intel_irq_remap_add_device(), or
> amd_iommu_set_pci_msi_domain()) making those devices have the isolated MSI
> property.
> 
> Due to how interrupt domains work, setting IRQ_DOMAIN_FLAG_ISOLATED_MSI on
> the parent IR domain will cause all struct devices attached to it to
> return true from msi_device_has_isolated_msi(). This replaces the
> IOMMU_CAP_INTR_REMAP flag as all places using IOMMU_CAP_INTR_REMAP also
> call msi_device_has_isolated_msi()
> 
> Set the flag and delete the cap.
> 
> Tested-by: Matthew Rosato <mjrosato@linux.ibm.com>
> Reviewed-by: Kevin Tian <kevin.tian@intel.com>
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> ---
>   drivers/iommu/amd/iommu.c           | 5 ++---
>   drivers/iommu/intel/iommu.c         | 2 --
>   drivers/iommu/intel/irq_remapping.c | 3 ++-
>   3 files changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
> index cbeaab55c0dbcc..321d50e9df5b4a 100644
> --- a/drivers/iommu/amd/iommu.c
> +++ b/drivers/iommu/amd/iommu.c
> @@ -2271,8 +2271,6 @@ static bool amd_iommu_capable(struct device *dev, enum iommu_cap cap)
>   	switch (cap) {
>   	case IOMMU_CAP_CACHE_COHERENCY:
>   		return true;
> -	case IOMMU_CAP_INTR_REMAP:
> -		return (irq_remapping_enabled == 1);
>   	case IOMMU_CAP_NOEXEC:
>   		return false;
>   	case IOMMU_CAP_PRE_BOOT_PROTECTION:
> @@ -3671,7 +3669,8 @@ int amd_iommu_create_irq_domain(struct amd_iommu *iommu)
>   	}
>   
>   	irq_domain_update_bus_token(iommu->ir_domain,  DOMAIN_BUS_AMDVI);
> -	iommu->ir_domain->flags |= IRQ_DOMAIN_FLAG_MSI_PARENT;
> +	iommu->ir_domain->flags |= IRQ_DOMAIN_FLAG_MSI_PARENT |
> +				   IRQ_DOMAIN_FLAG_ISOLATED_MSI;
>   
>   	if (amd_iommu_np_cache)
>   		iommu->ir_domain->msi_parent_ops = &virt_amdvi_msi_parent_ops;
> diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
> index 59df7e42fd533c..7cfab5fd5e5964 100644
> --- a/drivers/iommu/intel/iommu.c
> +++ b/drivers/iommu/intel/iommu.c
> @@ -4464,8 +4464,6 @@ static bool intel_iommu_capable(struct device *dev, enum iommu_cap cap)
>   	switch (cap) {
>   	case IOMMU_CAP_CACHE_COHERENCY:
>   		return true;
> -	case IOMMU_CAP_INTR_REMAP:
> -		return irq_remapping_enabled == 1;
>   	case IOMMU_CAP_PRE_BOOT_PROTECTION:
>   		return dmar_platform_optin();
>   	case IOMMU_CAP_ENFORCE_CACHE_COHERENCY:
> diff --git a/drivers/iommu/intel/irq_remapping.c b/drivers/iommu/intel/irq_remapping.c
> index f58f5f57af782b..6d01fa078c36fc 100644
> --- a/drivers/iommu/intel/irq_remapping.c
> +++ b/drivers/iommu/intel/irq_remapping.c
> @@ -573,7 +573,8 @@ static int intel_setup_irq_remapping(struct intel_iommu *iommu)
>   	}
>   
>   	irq_domain_update_bus_token(iommu->ir_domain,  DOMAIN_BUS_DMAR);
> -	iommu->ir_domain->flags |= IRQ_DOMAIN_FLAG_MSI_PARENT;
> +	iommu->ir_domain->flags |= IRQ_DOMAIN_FLAG_MSI_PARENT |
> +				   IRQ_DOMAIN_FLAG_ISOLATED_MSI;
>   
>   	if (cap_caching_mode(iommu->cap))
>   		iommu->ir_domain->msi_parent_ops = &virt_dmar_msi_parent_ops;

Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>

--
Best regards,
baolu

  reply	other threads:[~2023-01-06 11:42 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-05 19:33 [PATCH iommufd v3 0/9] Remove IOMMU_CAP_INTR_REMAP Jason Gunthorpe
2023-01-05 19:33 ` [PATCH iommufd v3 1/9] irq: Add msi_device_has_isolated_msi() Jason Gunthorpe
2023-01-11 18:14   ` Thomas Gleixner
2023-01-05 19:33 ` [PATCH iommufd v3 2/9] iommu: Add iommu_group_has_isolated_msi() Jason Gunthorpe
2023-01-06 11:28   ` Baolu Lu
2023-01-06 13:12     ` Jason Gunthorpe
2023-01-07  2:19       ` Baolu Lu
2023-01-11 18:19   ` Thomas Gleixner
2023-01-11 20:19     ` Jason Gunthorpe
2023-01-05 19:33 ` [PATCH iommufd v3 3/9] vfio/type1: Convert to iommu_group_has_isolated_msi() Jason Gunthorpe
2023-01-06 11:34   ` Baolu Lu
2023-01-05 19:33 ` [PATCH iommufd v3 4/9] iommufd: Convert to msi_device_has_isolated_msi() Jason Gunthorpe
2023-01-06 11:36   ` Baolu Lu
2023-01-05 19:33 ` [PATCH iommufd v3 5/9] irq: Remove unused irq_domain_check_msi_remap() code Jason Gunthorpe
2023-01-11 18:22   ` Thomas Gleixner
2023-01-05 19:33 ` [PATCH iommufd v3 6/9] irq: Rename IRQ_DOMAIN_MSI_REMAP to IRQ_DOMAIN_ISOLATED_MSI Jason Gunthorpe
2023-01-11 18:23   ` Thomas Gleixner
2023-01-05 19:33 ` [PATCH iommufd v3 7/9] iommu/x86: Replace IOMMU_CAP_INTR_REMAP with IRQ_DOMAIN_FLAG_ISOLATED_MSI Jason Gunthorpe
2023-01-06 11:42   ` Baolu Lu [this message]
2023-01-11 18:23   ` Thomas Gleixner
2023-01-05 19:33 ` [PATCH iommufd v3 8/9] irq/s390: Add arch_is_isolated_msi() for s390 Jason Gunthorpe
2023-01-05 19:33 ` [PATCH iommufd v3 9/9] iommu: Remove IOMMU_CAP_INTR_REMAP Jason Gunthorpe
2023-01-06 11:45   ` Baolu Lu

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=1fe05b9a-3d1e-e1b7-8c5e-dd8da0966950@linux.intel.com \
    --to=baolu.lu@linux.intel.com \
    --cc=agordeev@linux.ibm.com \
    --cc=alex.williamson@redhat.com \
    --cc=bharat.bhushan@nxp.com \
    --cc=borntraeger@de.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=dwmw2@infradead.org \
    --cc=eric.auger@redhat.com \
    --cc=farman@linux.ibm.com \
    --cc=gerald.schaefer@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=iommu@lists.linux.dev \
    --cc=jgg@nvidia.com \
    --cc=joro@8bytes.org \
    --cc=kevin.tian@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=maz@kernel.org \
    --cc=mjrosato@linux.ibm.com \
    --cc=robin.murphy@arm.com \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=svens@linux.ibm.com \
    --cc=tglx@linutronix.de \
    --cc=tomasz.nowicki@caviumnetworks.com \
    --cc=will.deacon@arm.com \
    --cc=will@kernel.org \
    /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).