From: Joerg Roedel <joerg.roedel-5C7GfCeVMHo@public.gmane.org>
To: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
Cc: kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
aik-sLpHqDYs0B2HXe+LvDLADg@public.gmane.org,
benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org,
qemu-devel-qX2TKyscuCcdnm+yROfE0A@public.gmane.org,
iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 1/3] Device isolation group infrastructure (v3)
Date: Wed, 8 Feb 2012 16:27:48 +0100 [thread overview]
Message-ID: <20120208152748.GD22598@amd.com> (raw)
In-Reply-To: <1328071614-8320-2-git-send-email-david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
On Wed, Feb 01, 2012 at 03:46:52PM +1100, David Gibson wrote:
> In order to safely drive a device with a userspace driver, or to pass
> it through to a guest system, we must first make sure that the device
> is isolated in such a way that it cannot interfere with other devices
> on the system. This isolation is only available on some systems and
> will generally require an iommu, and might require other support in
> bridges or other system hardware.
>
> Often, it's not possible to isolate every device from every other
> device in the system. For example, certain PCI/PCIe bridge
> configurations mean that an iommu cannot reliably distinguish which
> device behind the bridge initiated a DMA transaction. Similarly some
> buggy PCI multifunction devices initiate all DMAs as function 0, so
> the functions cannot be isolated from each other, even if the IOMMU
> normally allows this.
>
> Therefore, the user, and code to allow userspace drivers or guest
> passthrough, needs a way to determine which devices can be isolated
> from which others. This patch adds infrastructure to handle this by
> introducing the concept of a "device isolation group" - a group of
> devices which can, as a unit, be safely isolated from the rest of the
> system and therefore can be, as a unit, safely assigned to an
> unprivileged used or guest. That is, the groups represent the minimum
> granularity with which devices may be assigned to untrusted
> components.
>
> This code manages groups, but does not create them or allow use of
> grouped devices by a guest. Creating groups would be done by iommu or
> bridge drivers, using the interface this patch provides. It's
> expected that the groups will be used in future by the in-kernel iommu
> interface, and would also be used by VFIO or other subsystems to allow
> safe passthrough of devices to userspace or guests.
>
> Signed-off-by: Alexey Kardashevskiy <aik-sLpHqDYs0B2HXe+LvDLADg@public.gmane.org>
> Signed-off-by: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
> ---
> drivers/base/Kconfig | 3 +
> drivers/base/Makefile | 1 +
> drivers/base/base.h | 3 +
> drivers/base/core.c | 6 ++
> drivers/base/device_isolation.c | 184 ++++++++++++++++++++++++++++++++++++++
> drivers/base/init.c | 2 +
> include/linux/device.h | 5 +
> include/linux/device_isolation.h | 100 +++++++++++++++++++++
Again, device grouping is done by the IOMMU drivers, so this all belongs
into the generic iommu-code rather than the driver core.
I think it makes sense to introduce a device->iommu pointer which
depends on CONFIG_IOMMU_API and put the group information into it.
This also has the benefit that we can consolidate all the
device->arch.iommu pointers into device->iommu as well.
> 8 files changed, 304 insertions(+), 0 deletions(-)
> create mode 100644 drivers/base/device_isolation.c
> create mode 100644 include/linux/device_isolation.h
>
> diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig
> index 7be9f79..a52f2db 100644
> --- a/drivers/base/Kconfig
> +++ b/drivers/base/Kconfig
> @@ -189,4 +189,7 @@ config DMA_SHARED_BUFFER
> APIs extension; the file's descriptor can then be passed on to other
> driver.
>
> +config DEVICE_ISOLATION
> + bool "Enable isolating devices for safe pass-through to guests or user space."
> +
No need for a config option. When IOMMU drivers are enabled we also want
the group code to be active.
Joerg
--
AMD Operating System Research Center
Advanced Micro Devices GmbH Einsteinring 24 85609 Dornach
General Managers: Alberto Bozzo
Registration: Dornach, Landkr. Muenchen; Registerger. Muenchen, HRB Nr. 43632
WARNING: multiple messages have this Message-ID (diff)
From: Joerg Roedel <joerg.roedel@amd.com>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: <dwmw2@infradead.org>, <iommu@lists.linux-foundation.org>,
<aik@ozlabs.ru>, <benh@kernel.crashing.org>,
<qemu-devel@nongnu.org>, <alex.williamson@redhat.com>,
<kvm@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/3] Device isolation group infrastructure (v3)
Date: Wed, 8 Feb 2012 16:27:48 +0100 [thread overview]
Message-ID: <20120208152748.GD22598@amd.com> (raw)
In-Reply-To: <1328071614-8320-2-git-send-email-david@gibson.dropbear.id.au>
On Wed, Feb 01, 2012 at 03:46:52PM +1100, David Gibson wrote:
> In order to safely drive a device with a userspace driver, or to pass
> it through to a guest system, we must first make sure that the device
> is isolated in such a way that it cannot interfere with other devices
> on the system. This isolation is only available on some systems and
> will generally require an iommu, and might require other support in
> bridges or other system hardware.
>
> Often, it's not possible to isolate every device from every other
> device in the system. For example, certain PCI/PCIe bridge
> configurations mean that an iommu cannot reliably distinguish which
> device behind the bridge initiated a DMA transaction. Similarly some
> buggy PCI multifunction devices initiate all DMAs as function 0, so
> the functions cannot be isolated from each other, even if the IOMMU
> normally allows this.
>
> Therefore, the user, and code to allow userspace drivers or guest
> passthrough, needs a way to determine which devices can be isolated
> from which others. This patch adds infrastructure to handle this by
> introducing the concept of a "device isolation group" - a group of
> devices which can, as a unit, be safely isolated from the rest of the
> system and therefore can be, as a unit, safely assigned to an
> unprivileged used or guest. That is, the groups represent the minimum
> granularity with which devices may be assigned to untrusted
> components.
>
> This code manages groups, but does not create them or allow use of
> grouped devices by a guest. Creating groups would be done by iommu or
> bridge drivers, using the interface this patch provides. It's
> expected that the groups will be used in future by the in-kernel iommu
> interface, and would also be used by VFIO or other subsystems to allow
> safe passthrough of devices to userspace or guests.
>
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> ---
> drivers/base/Kconfig | 3 +
> drivers/base/Makefile | 1 +
> drivers/base/base.h | 3 +
> drivers/base/core.c | 6 ++
> drivers/base/device_isolation.c | 184 ++++++++++++++++++++++++++++++++++++++
> drivers/base/init.c | 2 +
> include/linux/device.h | 5 +
> include/linux/device_isolation.h | 100 +++++++++++++++++++++
Again, device grouping is done by the IOMMU drivers, so this all belongs
into the generic iommu-code rather than the driver core.
I think it makes sense to introduce a device->iommu pointer which
depends on CONFIG_IOMMU_API and put the group information into it.
This also has the benefit that we can consolidate all the
device->arch.iommu pointers into device->iommu as well.
> 8 files changed, 304 insertions(+), 0 deletions(-)
> create mode 100644 drivers/base/device_isolation.c
> create mode 100644 include/linux/device_isolation.h
>
> diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig
> index 7be9f79..a52f2db 100644
> --- a/drivers/base/Kconfig
> +++ b/drivers/base/Kconfig
> @@ -189,4 +189,7 @@ config DMA_SHARED_BUFFER
> APIs extension; the file's descriptor can then be passed on to other
> driver.
>
> +config DEVICE_ISOLATION
> + bool "Enable isolating devices for safe pass-through to guests or user space."
> +
No need for a config option. When IOMMU drivers are enabled we also want
the group code to be active.
Joerg
--
AMD Operating System Research Center
Advanced Micro Devices GmbH Einsteinring 24 85609 Dornach
General Managers: Alberto Bozzo
Registration: Dornach, Landkr. Muenchen; Registerger. Muenchen, HRB Nr. 43632
WARNING: multiple messages have this Message-ID (diff)
From: Joerg Roedel <joerg.roedel@amd.com>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: kvm@vger.kernel.org, aik@ozlabs.ru, alex.williamson@redhat.com,
qemu-devel@nongnu.org, iommu@lists.linux-foundation.org,
dwmw2@infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [Qemu-devel] [PATCH 1/3] Device isolation group infrastructure (v3)
Date: Wed, 8 Feb 2012 16:27:48 +0100 [thread overview]
Message-ID: <20120208152748.GD22598@amd.com> (raw)
In-Reply-To: <1328071614-8320-2-git-send-email-david@gibson.dropbear.id.au>
On Wed, Feb 01, 2012 at 03:46:52PM +1100, David Gibson wrote:
> In order to safely drive a device with a userspace driver, or to pass
> it through to a guest system, we must first make sure that the device
> is isolated in such a way that it cannot interfere with other devices
> on the system. This isolation is only available on some systems and
> will generally require an iommu, and might require other support in
> bridges or other system hardware.
>
> Often, it's not possible to isolate every device from every other
> device in the system. For example, certain PCI/PCIe bridge
> configurations mean that an iommu cannot reliably distinguish which
> device behind the bridge initiated a DMA transaction. Similarly some
> buggy PCI multifunction devices initiate all DMAs as function 0, so
> the functions cannot be isolated from each other, even if the IOMMU
> normally allows this.
>
> Therefore, the user, and code to allow userspace drivers or guest
> passthrough, needs a way to determine which devices can be isolated
> from which others. This patch adds infrastructure to handle this by
> introducing the concept of a "device isolation group" - a group of
> devices which can, as a unit, be safely isolated from the rest of the
> system and therefore can be, as a unit, safely assigned to an
> unprivileged used or guest. That is, the groups represent the minimum
> granularity with which devices may be assigned to untrusted
> components.
>
> This code manages groups, but does not create them or allow use of
> grouped devices by a guest. Creating groups would be done by iommu or
> bridge drivers, using the interface this patch provides. It's
> expected that the groups will be used in future by the in-kernel iommu
> interface, and would also be used by VFIO or other subsystems to allow
> safe passthrough of devices to userspace or guests.
>
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> ---
> drivers/base/Kconfig | 3 +
> drivers/base/Makefile | 1 +
> drivers/base/base.h | 3 +
> drivers/base/core.c | 6 ++
> drivers/base/device_isolation.c | 184 ++++++++++++++++++++++++++++++++++++++
> drivers/base/init.c | 2 +
> include/linux/device.h | 5 +
> include/linux/device_isolation.h | 100 +++++++++++++++++++++
Again, device grouping is done by the IOMMU drivers, so this all belongs
into the generic iommu-code rather than the driver core.
I think it makes sense to introduce a device->iommu pointer which
depends on CONFIG_IOMMU_API and put the group information into it.
This also has the benefit that we can consolidate all the
device->arch.iommu pointers into device->iommu as well.
> 8 files changed, 304 insertions(+), 0 deletions(-)
> create mode 100644 drivers/base/device_isolation.c
> create mode 100644 include/linux/device_isolation.h
>
> diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig
> index 7be9f79..a52f2db 100644
> --- a/drivers/base/Kconfig
> +++ b/drivers/base/Kconfig
> @@ -189,4 +189,7 @@ config DMA_SHARED_BUFFER
> APIs extension; the file's descriptor can then be passed on to other
> driver.
>
> +config DEVICE_ISOLATION
> + bool "Enable isolating devices for safe pass-through to guests or user space."
> +
No need for a config option. When IOMMU drivers are enabled we also want
the group code to be active.
Joerg
--
AMD Operating System Research Center
Advanced Micro Devices GmbH Einsteinring 24 85609 Dornach
General Managers: Alberto Bozzo
Registration: Dornach, Landkr. Muenchen; Registerger. Muenchen, HRB Nr. 43632
next prev parent reply other threads:[~2012-02-08 15:27 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-01 4:46 RFC: Device isolation groups David Gibson
2012-02-01 4:46 ` [Qemu-devel] " David Gibson
2012-02-01 4:46 ` David Gibson
[not found] ` <1328071614-8320-1-git-send-email-david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
2012-02-01 4:46 ` [PATCH 1/3] Device isolation group infrastructure (v3) David Gibson
2012-02-01 4:46 ` [Qemu-devel] " David Gibson
2012-02-01 4:46 ` David Gibson
[not found] ` <1328071614-8320-2-git-send-email-david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
2012-02-08 15:27 ` Joerg Roedel [this message]
2012-02-08 15:27 ` [Qemu-devel] " Joerg Roedel
2012-02-08 15:27 ` Joerg Roedel
[not found] ` <20120208152748.GD22598-5C7GfCeVMHo@public.gmane.org>
2012-02-08 21:39 ` Benjamin Herrenschmidt
2012-02-08 21:39 ` [Qemu-devel] " Benjamin Herrenschmidt
2012-02-08 21:39 ` Benjamin Herrenschmidt
2012-02-09 11:28 ` Joerg Roedel
2012-02-09 11:28 ` [Qemu-devel] " Joerg Roedel
2012-02-09 11:28 ` Joerg Roedel
[not found] ` <20120209112805.GN22598-5C7GfCeVMHo@public.gmane.org>
2012-02-10 0:21 ` David Gibson
2012-02-10 0:21 ` [Qemu-devel] " David Gibson
2012-02-10 0:21 ` David Gibson
2012-02-08 21:43 ` Benjamin Herrenschmidt
2012-02-08 21:43 ` [Qemu-devel] " Benjamin Herrenschmidt
2012-02-08 21:43 ` Benjamin Herrenschmidt
2012-02-09 1:40 ` David Gibson
2012-02-09 1:40 ` [Qemu-devel] " David Gibson
2012-02-09 1:40 ` David Gibson
2012-02-01 4:46 ` [PATCH 2/3] device_isolation: Support isolation on POWER p5ioc2 bridges David Gibson
2012-02-01 4:46 ` [Qemu-devel] " David Gibson
2012-02-01 4:46 ` David Gibson
[not found] ` <1328071614-8320-3-git-send-email-david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
2012-02-01 18:58 ` Alex Williamson
2012-02-01 18:58 ` [Qemu-devel] " Alex Williamson
2012-02-01 18:58 ` Alex Williamson
[not found] ` <1328122724.6937.216.camel-xdHQ/5r00wBBDLzU/O5InQ@public.gmane.org>
2012-02-01 19:15 ` Alex Williamson
2012-02-01 19:15 ` [Qemu-devel] " Alex Williamson
2012-02-01 19:15 ` Alex Williamson
2012-02-01 4:46 ` [PATCH 3/3] device_isolation: Support isolation on POWER p7ioc (IODA) bridges David Gibson
2012-02-01 4:46 ` [Qemu-devel] " David Gibson
2012-02-01 4:46 ` David Gibson
[not found] ` <1328071614-8320-4-git-send-email-david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
2012-02-01 19:17 ` Alex Williamson
2012-02-01 19:17 ` [Qemu-devel] " Alex Williamson
2012-02-01 19:17 ` Alex Williamson
[not found] ` <1328123825.6937.227.camel-xdHQ/5r00wBBDLzU/O5InQ@public.gmane.org>
2012-02-02 0:23 ` David Gibson
2012-02-02 0:23 ` [Qemu-devel] " David Gibson
2012-02-02 0:23 ` David Gibson
2012-02-01 20:08 ` RFC: Device isolation groups Alex Williamson
2012-02-01 20:08 ` [Qemu-devel] " Alex Williamson
2012-02-01 20:08 ` Alex Williamson
[not found] ` <1328126919.6937.254.camel-xdHQ/5r00wBBDLzU/O5InQ@public.gmane.org>
2012-02-02 1:24 ` David Gibson
2012-02-02 1:24 ` [Qemu-devel] " David Gibson
2012-02-02 1:24 ` David Gibson
[not found] ` <20120202012414.GE8700-MK4v0fQdeXQXU02nzanrWNbf9cGiqdzd@public.gmane.org>
2012-02-29 19:30 ` Alex Williamson
2012-02-29 19:30 ` [Qemu-devel] " Alex Williamson
2012-02-29 19:30 ` Alex Williamson
[not found] ` <1330543855.29701.180.camel-xdHQ/5r00wBBDLzU/O5InQ@public.gmane.org>
2012-03-09 3:40 ` David Gibson
2012-03-09 3:40 ` [Qemu-devel] " David Gibson
2012-03-09 3:40 ` David Gibson
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=20120208152748.GD22598@amd.com \
--to=joerg.roedel-5c7gfcevmho@public.gmane.org \
--cc=aik-sLpHqDYs0B2HXe+LvDLADg@public.gmane.org \
--cc=benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org \
--cc=david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org \
--cc=dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
--cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=qemu-devel-qX2TKyscuCcdnm+yROfE0A@public.gmane.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.