All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien@xen.org>
To: Stewart Hildebrand <stewart.hildebrand@amd.com>,
	xen-devel@lists.xenproject.org
Cc: Stefano Stabellini <sstabellini@kernel.org>,
	Bertrand Marquis <bertrand.marquis@arm.com>,
	Michal Orzel <michal.orzel@amd.com>,
	Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	George Dunlap <george.dunlap@citrix.com>,
	Jan Beulich <jbeulich@suse.com>, Wei Liu <wl@xen.org>
Subject: Re: [PATCH v6 8/9] xen/arm: enable dom0 to use PCI devices with pci-passthrough=no
Date: Tue, 19 Dec 2023 19:36:26 +0000	[thread overview]
Message-ID: <915a8f2c-9e6e-435a-89fe-5966edea88a3@xen.org> (raw)
In-Reply-To: <20231109182716.367119-9-stewart.hildebrand@amd.com>

Hi Stewart,

On 09/11/2023 18:27, Stewart Hildebrand wrote:
> Enable the use of IOMMU + PCI in dom0 without having to specify
> "pci-passthrough=yes". We rely on dom0 to initialize the PCI controller
> and perform a PHYSDEVOP_pci_device_add call to add each device to SMMU.
> 
> Enable pci_init() for initializing Xen's internal PCI subsystem, and
> allow PHYSDEVOP_pci_device_add when pci-passthrough is disabled.
> 
> Signed-off-by: Stewart Hildebrand <stewart.hildebrand@amd.com>
> ---
> v5->v6:
> * new patch - this effectively replaces
>    ("Revert "xen/arm: Add cmdline boot option "pci-passthrough = <boolean>""")
> ---
>   xen/arch/arm/pci/pci.c    | 3 ++-
>   xen/drivers/pci/physdev.c | 6 ------
>   2 files changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/xen/arch/arm/pci/pci.c b/xen/arch/arm/pci/pci.c
> index 78b97beaef12..ba72fbaf1dfc 100644
> --- a/xen/arch/arm/pci/pci.c
> +++ b/xen/arch/arm/pci/pci.c
> @@ -16,6 +16,7 @@
>   #include <xen/device_tree.h>
>   #include <xen/errno.h>
>   #include <xen/init.h>
> +#include <xen/iommu.h>
>   #include <xen/param.h>
>   #include <xen/pci.h>
>   
> @@ -85,7 +86,7 @@ static int __init pci_init(void)
>        * Enable PCI passthrough when has been enabled explicitly
>        * (pci-passthrough=on).
>        */

The comment needs to be updated after ...
> -    if ( !pci_passthrough_enabled )
> +    if ( !is_pci_passthrough_enabled() && !iommu_enabled )

... this change.

>           return 0;
>   
>       pci_segments_init();
> diff --git a/xen/drivers/pci/physdev.c b/xen/drivers/pci/physdev.c
> index 42db3e6d133c..4f3e1a96c0fd 100644
> --- a/xen/drivers/pci/physdev.c
> +++ b/xen/drivers/pci/physdev.c
> @@ -18,9 +18,6 @@ ret_t pci_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
>           struct pci_dev_info pdev_info;
>           nodeid_t node = NUMA_NO_NODE;
>   
> -        if ( !is_pci_passthrough_enabled() )
> -            return -EOPNOTSUPP;
> -

AFAIU, this means that pci_add_device() can now be reached even if 
pci_segments_init() is not called (this can happen when iommu=false). 
What error will now be returned and how dom0 will behave?

Cheers,

-- 
Julien Grall


  parent reply	other threads:[~2023-12-19 19:36 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-09 18:27 [PATCH v6 0/9] SMMU handling for PCIe Passthrough on ARM Stewart Hildebrand
2023-11-09 18:27 ` [PATCH v6 1/9] xen/arm: don't pass iommu properties to hwdom for iommu-map Stewart Hildebrand
2023-12-13 10:46   ` Julien Grall
2023-11-09 18:27 ` [PATCH v6 2/9] iommu/arm: Add iommu_dt_xlate() Stewart Hildebrand
2023-11-10  8:39   ` Jan Beulich
2023-11-09 18:27 ` [PATCH v6 3/9] iommu/arm: Introduce iommu_add_dt_pci_sideband_ids API Stewart Hildebrand
2023-11-10  8:49   ` Jan Beulich
2023-12-15 19:28   ` Julien Grall
2023-11-09 18:27 ` [PATCH v6 4/9] iommu/arm: iommu_add_dt_pci_sideband_ids phantom handling Stewart Hildebrand
2023-11-09 18:27 ` [PATCH v6 5/9] xen/arm: smmuv2: Add PCI devices support for SMMUv2 Stewart Hildebrand
2023-12-19 19:25   ` Julien Grall
2023-11-09 18:27 ` [PATCH v6 6/9] xen/arm: smmuv3: Add PCI devices support for SMMUv3 Stewart Hildebrand
2023-12-19 19:27   ` Julien Grall
2023-11-09 18:27 ` [PATCH v6 7/9] xen/arm: Fix mapping for PCI bridge mmio region Stewart Hildebrand
2023-12-19 19:31   ` Julien Grall
2023-11-09 18:27 ` [PATCH v6 8/9] xen/arm: enable dom0 to use PCI devices with pci-passthrough=no Stewart Hildebrand
2023-11-10  8:53   ` Jan Beulich
2023-12-19 19:36   ` Julien Grall [this message]
2023-11-09 18:27 ` [PATCH v6 9/9] xen/arm: Map ITS doorbell register to IOMMU page tables Stewart Hildebrand
2023-12-19 19:47   ` Julien Grall

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=915a8f2c-9e6e-435a-89fe-5966edea88a3@xen.org \
    --to=julien@xen.org \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=bertrand.marquis@arm.com \
    --cc=george.dunlap@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=michal.orzel@amd.com \
    --cc=sstabellini@kernel.org \
    --cc=stewart.hildebrand@amd.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.