From: Matthew Rosato <mjrosato@linux.ibm.com>
To: Jason Gunthorpe <jgg@nvidia.com>,
Alexander Gordeev <agordeev@linux.ibm.com>,
Alex Williamson <alex.williamson@redhat.com>,
Lu Baolu <baolu.lu@linux.intel.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>,
Kevin Tian <kevin.tian@intel.com>,
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>,
Marc Zyngier <marc.zyngier@arm.com>,
Tomasz Nowicki <tomasz.nowicki@caviumnetworks.com>,
Will Deacon <will.deacon@arm.com>
Subject: Re: [PATCH iommufd v2 8/9] irq/s390: Add arch_is_isolated_msi() for s390
Date: Mon, 19 Dec 2022 11:16:35 -0500 [thread overview]
Message-ID: <8275f4e0-aa73-d4e1-5612-ccf6a369fa07@linux.ibm.com> (raw)
In-Reply-To: <8-v2-10ad79761833+40588-secure_msi_jgg@nvidia.com>
On 12/12/22 1:46 PM, Jason Gunthorpe wrote:
> s390 doesn't use irq_domains, so it has no place to set
> IRQ_DOMAIN_FLAG_ISOLATED_MSI. Instead of continuing to abuse the iommu
> subsystem to convey this information add a simple define which s390 can
> make statically true. The define will cause msi_device_has_isolated() to
> return true.
>
> Remove IOMMU_CAP_INTR_REMAP from the s390 iommu driver.
>
> Cc: Matthew Rosato <mjrosato@linux.ibm.com>
> Cc: Christian Borntraeger <borntraeger@de.ibm.com>
> Cc: Eric Farman <farman@linux.ibm.com>
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
Also sanity-tested on s390 (needed the previously-mentioned #include <linux/msi.h> added to drivers/iommu/iommu.c)
> ---
> arch/s390/include/asm/msi.h | 17 +++++++++++++++++
> drivers/iommu/s390-iommu.c | 2 --
> include/linux/msi.h | 6 +++++-
> kernel/irq/msi.c | 2 +-
> 4 files changed, 23 insertions(+), 4 deletions(-)
> create mode 100644 arch/s390/include/asm/msi.h
>
> diff --git a/arch/s390/include/asm/msi.h b/arch/s390/include/asm/msi.h
> new file mode 100644
> index 00000000000000..399343ed9ffbc6
> --- /dev/null
> +++ b/arch/s390/include/asm/msi.h
> @@ -0,0 +1,17 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef _ASM_S390_MSI_H
> +#define _ASM_S390_MSI_H
> +#include <asm-generic/msi.h>
> +
> +/*
> + * Work around S390 not using irq_domain at all so we can't set
> + * IRQ_DOMAIN_FLAG_ISOLATED_MSI. See for an explanation how it works:
> + *
> + * https://lore.kernel.org/r/31af8174-35e9-ebeb-b9ef-74c90d4bfd93@linux.ibm.com/
> + *
> + * Note this is less isolated than the ARM/x86 versions as userspace can trigger
> + * MSI belonging to kernel devices within the same gisa.
> + */
> +#define arch_is_isolated_msi() true
> +
> +#endif
> diff --git a/drivers/iommu/s390-iommu.c b/drivers/iommu/s390-iommu.c
> index 3c071782f6f16d..c80f4728c0f307 100644
> --- a/drivers/iommu/s390-iommu.c
> +++ b/drivers/iommu/s390-iommu.c
> @@ -44,8 +44,6 @@ static bool s390_iommu_capable(struct device *dev, enum iommu_cap cap)
> switch (cap) {
> case IOMMU_CAP_CACHE_COHERENCY:
> return true;
> - case IOMMU_CAP_INTR_REMAP:
> - return true;
> default:
> return false;
> }
> diff --git a/include/linux/msi.h b/include/linux/msi.h
> index e8a3f3a8a7f427..5cbe6a9d27efd6 100644
> --- a/include/linux/msi.h
> +++ b/include/linux/msi.h
> @@ -48,6 +48,10 @@ typedef struct arch_msi_msg_data {
> } __attribute__ ((packed)) arch_msi_msg_data_t;
> #endif
>
> +#ifndef arch_is_isolated_msi
> +#define arch_is_isolated_msi() false
> +#endif
> +
> /**
> * msi_msg - Representation of a MSI message
> * @address_lo: Low 32 bits of msi message address
> @@ -660,7 +664,7 @@ static inline bool msi_device_has_isolated_msi(struct device *dev)
> * is inherently isolated by our definition. As nobody seems to needs
> * this be conservative and return false anyhow.
> */
> - return false;
> + return arch_is_isolated_msi();
> }
> #endif /* CONFIG_GENERIC_MSI_IRQ */
>
> diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c
> index 7c5579d3ea4f79..3e46420a4f1a9f 100644
> --- a/kernel/irq/msi.c
> +++ b/kernel/irq/msi.c
> @@ -1646,6 +1646,6 @@ bool msi_device_has_isolated_msi(struct device *dev)
> for (; domain; domain = domain->parent)
> if (domain->flags & IRQ_DOMAIN_FLAG_ISOLATED_MSI)
> return true;
> - return false;
> + return arch_is_isolated_msi();
> }
> EXPORT_SYMBOL_GPL(msi_device_has_isolated_msi);
next prev parent reply other threads:[~2022-12-19 16:17 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-12 18:45 [PATCH iommufd v2 0/9] Remove IOMMU_CAP_INTR_REMAP Jason Gunthorpe
2022-12-12 18:45 ` [PATCH iommufd v2 1/9] irq: Add msi_device_has_isolated_msi() Jason Gunthorpe
2022-12-12 18:45 ` [PATCH iommufd v2 2/9] iommu: Add iommu_group_has_isolated_msi() Jason Gunthorpe
2022-12-13 14:37 ` Jason Gunthorpe
2022-12-12 18:45 ` [PATCH iommufd v2 3/9] vfio/type1: Convert to iommu_group_has_isolated_msi() Jason Gunthorpe
2022-12-12 18:45 ` [PATCH iommufd v2 4/9] iommufd: Convert to msi_device_has_isolated_msi() Jason Gunthorpe
2022-12-12 18:45 ` [PATCH iommufd v2 5/9] irq: Remove unused irq_domain_check_msi_remap() code Jason Gunthorpe
2022-12-12 18:46 ` [PATCH iommufd v2 6/9] irq: Rename IRQ_DOMAIN_MSI_REMAP to IRQ_DOMAIN_ISOLATED_MSI Jason Gunthorpe
2022-12-12 18:46 ` [PATCH iommufd v2 7/9] iommu/x86: Replace IOMMU_CAP_INTR_REMAP with IRQ_DOMAIN_FLAG_ISOLATED_MSI Jason Gunthorpe
2022-12-12 18:46 ` [PATCH iommufd v2 8/9] irq/s390: Add arch_is_isolated_msi() for s390 Jason Gunthorpe
2022-12-15 7:39 ` Tian, Kevin
2023-01-05 0:13 ` Jason Gunthorpe
2022-12-19 16:16 ` Matthew Rosato [this message]
2022-12-12 18:46 ` [PATCH iommufd v2 9/9] iommu: Remove IOMMU_CAP_INTR_REMAP Jason Gunthorpe
2022-12-15 7:39 ` [PATCH iommufd v2 0/9] " Tian, Kevin
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=8275f4e0-aa73-d4e1-5612-ccf6a369fa07@linux.ibm.com \
--to=mjrosato@linux.ibm.com \
--cc=agordeev@linux.ibm.com \
--cc=alex.williamson@redhat.com \
--cc=baolu.lu@linux.intel.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=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