All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lu Baolu <baolu.lu@linux.intel.com>
To: Jean-Philippe Brucker <jean-philippe@linaro.org>,
	"Tian, Kevin" <kevin.tian@intel.com>
Cc: baolu.lu@linux.intel.com, "joro@8bytes.org" <joro@8bytes.org>,
	"will@kernel.org" <will@kernel.org>,
	"lorenzo.pieralisi@arm.com" <lorenzo.pieralisi@arm.com>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	"guohanjun@huawei.com" <guohanjun@huawei.com>,
	"sudeep.holla@arm.com" <sudeep.holla@arm.com>,
	"rjw@rjwysocki.net" <rjw@rjwysocki.net>,
	"lenb@kernel.org" <lenb@kernel.org>,
	"robin.murphy@arm.com" <robin.murphy@arm.com>,
	"Jonathan.Cameron@huawei.com" <Jonathan.Cameron@huawei.com>,
	"eric.auger@redhat.com" <eric.auger@redhat.com>,
	"iommu@lists.linux-foundation.org"
	<iommu@lists.linux-foundation.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"linux-accelerators@lists.ozlabs.org" 
	<linux-accelerators@lists.ozlabs.org>,
	"vdumpa@nvidia.com" <vdumpa@nvidia.com>,
	"zhangfei.gao@linaro.org" <zhangfei.gao@linaro.org>,
	"shameerali.kolothum.thodi@huawei.com" 
	<shameerali.kolothum.thodi@huawei.com>,
	"vivek.gautam@arm.com" <vivek.gautam@arm.com>,
	Arnd Bergmann <arnd@arndb.de>,
	David Woodhouse <dwmw2@infradead.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Zhou Wang <wangzhou1@hisilicon.com>
Subject: Re: [PATCH v9 03/10] iommu: Separate IOMMU_DEV_FEAT_IOPF from IOMMU_DEV_FEAT_SVA
Date: Sat, 16 Jan 2021 11:54:00 +0800	[thread overview]
Message-ID: <636814a9-7dea-06f6-03ec-6a98dd30b7e3@linux.intel.com> (raw)
In-Reply-To: <YAB0SHyUZbxprkL3@larix.localdomain>

Hi Jean,

On 2021/1/15 0:41, Jean-Philippe Brucker wrote:
> I guess detailing what's needed for nested IOPF can help the discussion,
> although I haven't seen any concrete plan about implementing it, and it
> still seems a couple of years away. There are two important steps with
> nested IOPF:
> 
> (1) Figuring out whether a fault comes from L1 or L2. A SMMU stall event
>      comes with this information, but a PRI page request doesn't. The IOMMU
>      driver has to first translate the IOVA to a GPA, injecting the fault
>      into the guest if this translation fails by using the usual
>      iommu_report_device_fault().
> 
> (2) Translating the faulting GPA to a HVA that can be fed to
>      handle_mm_fault(). That requires help from KVM, so another interface -
>      either KVM registering GPA->HVA translation tables or IOMMU driver
>      querying each translation. Either way it should be reusable by device
>      drivers that implement IOPF themselves.
> 
> (1) could be enabled with iommu_dev_enable_feature(). (2) requires a more
> complex interface. (2) alone might also be desirable - demand-paging for
> level 2 only, no SVA for level 1.
> 
> Anyway, back to this patch. What I'm trying to convey is "can the IOMMU
> receive incoming I/O page faults for this device and, when SVA is enabled,
> feed them to the mm subsystem?  Enable that or return an error." I'm stuck
> on the name. IOPF alone is too vague. Not IOPF_L1 as Kevin noted, since L1
> is also used in virtualization. IOPF_BIND and IOPF_SVA could also mean (2)
> above. IOMMU_DEV_FEAT_IOPF_FLAT?
> 
> That leaves space for the nested extensions. (1) above could be
> IOMMU_FEAT_IOPF_NESTED, and (2) requires some new interfacing with KVM (or
> just an external fault handler) and could be used with either IOPF_FLAT or
> IOPF_NESTED. We can figure out the details later. What do you think?

I agree that we can define IOPF_ for current usage and leave space for
future extensions.

IOPF_FLAT represents IOPF on first-level translation, currently first
level translation could be used in below cases.

1) FL w/ internal Page Table: Kernel IOVA;
2) FL w/ external Page Table: VFIO passthrough;
3) FL w/ shared CPU page table: SVA

We don't need to support IOPF for case 1). Let's put it aside.

IOPF handling of 2) and 3) are different. Do we need to define different
names to distinguish these two cases?

Best regards,
baolu

WARNING: multiple messages have this Message-ID (diff)
From: Lu Baolu <baolu.lu@linux.intel.com>
To: Jean-Philippe Brucker <jean-philippe@linaro.org>,
	"Tian, Kevin" <kevin.tian@intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"vivek.gautam@arm.com" <vivek.gautam@arm.com>,
	"guohanjun@huawei.com" <guohanjun@huawei.com>,
	"will@kernel.org" <will@kernel.org>,
	"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
	"zhangfei.gao@linaro.org" <zhangfei.gao@linaro.org>,
	"lenb@kernel.org" <lenb@kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	Arnd Bergmann <arnd@arndb.de>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	David Woodhouse <dwmw2@infradead.org>,
	"rjw@rjwysocki.net" <rjw@rjwysocki.net>,
	"iommu@lists.linux-foundation.org"
	<iommu@lists.linux-foundation.org>,
	"sudeep.holla@arm.com" <sudeep.holla@arm.com>,
	"robin.murphy@arm.com" <robin.murphy@arm.com>,
	"linux-accelerators@lists.ozlabs.org"
	<linux-accelerators@lists.ozlabs.org>
Subject: Re: [PATCH v9 03/10] iommu: Separate IOMMU_DEV_FEAT_IOPF from IOMMU_DEV_FEAT_SVA
Date: Sat, 16 Jan 2021 11:54:00 +0800	[thread overview]
Message-ID: <636814a9-7dea-06f6-03ec-6a98dd30b7e3@linux.intel.com> (raw)
In-Reply-To: <YAB0SHyUZbxprkL3@larix.localdomain>

Hi Jean,

On 2021/1/15 0:41, Jean-Philippe Brucker wrote:
> I guess detailing what's needed for nested IOPF can help the discussion,
> although I haven't seen any concrete plan about implementing it, and it
> still seems a couple of years away. There are two important steps with
> nested IOPF:
> 
> (1) Figuring out whether a fault comes from L1 or L2. A SMMU stall event
>      comes with this information, but a PRI page request doesn't. The IOMMU
>      driver has to first translate the IOVA to a GPA, injecting the fault
>      into the guest if this translation fails by using the usual
>      iommu_report_device_fault().
> 
> (2) Translating the faulting GPA to a HVA that can be fed to
>      handle_mm_fault(). That requires help from KVM, so another interface -
>      either KVM registering GPA->HVA translation tables or IOMMU driver
>      querying each translation. Either way it should be reusable by device
>      drivers that implement IOPF themselves.
> 
> (1) could be enabled with iommu_dev_enable_feature(). (2) requires a more
> complex interface. (2) alone might also be desirable - demand-paging for
> level 2 only, no SVA for level 1.
> 
> Anyway, back to this patch. What I'm trying to convey is "can the IOMMU
> receive incoming I/O page faults for this device and, when SVA is enabled,
> feed them to the mm subsystem?  Enable that or return an error." I'm stuck
> on the name. IOPF alone is too vague. Not IOPF_L1 as Kevin noted, since L1
> is also used in virtualization. IOPF_BIND and IOPF_SVA could also mean (2)
> above. IOMMU_DEV_FEAT_IOPF_FLAT?
> 
> That leaves space for the nested extensions. (1) above could be
> IOMMU_FEAT_IOPF_NESTED, and (2) requires some new interfacing with KVM (or
> just an external fault handler) and could be used with either IOPF_FLAT or
> IOPF_NESTED. We can figure out the details later. What do you think?

I agree that we can define IOPF_ for current usage and leave space for
future extensions.

IOPF_FLAT represents IOPF on first-level translation, currently first
level translation could be used in below cases.

1) FL w/ internal Page Table: Kernel IOVA;
2) FL w/ external Page Table: VFIO passthrough;
3) FL w/ shared CPU page table: SVA

We don't need to support IOPF for case 1). Let's put it aside.

IOPF handling of 2) and 3) are different. Do we need to define different
names to distinguish these two cases?

Best regards,
baolu
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

WARNING: multiple messages have this Message-ID (diff)
From: Lu Baolu <baolu.lu@linux.intel.com>
To: Jean-Philippe Brucker <jean-philippe@linaro.org>,
	"Tian, Kevin" <kevin.tian@intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"vivek.gautam@arm.com" <vivek.gautam@arm.com>,
	"guohanjun@huawei.com" <guohanjun@huawei.com>,
	"will@kernel.org" <will@kernel.org>,
	"lorenzo.pieralisi@arm.com" <lorenzo.pieralisi@arm.com>,
	"joro@8bytes.org" <joro@8bytes.org>,
	Zhou Wang <wangzhou1@hisilicon.com>,
	"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
	"zhangfei.gao@linaro.org" <zhangfei.gao@linaro.org>,
	"lenb@kernel.org" <lenb@kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	Arnd Bergmann <arnd@arndb.de>,
	"eric.auger@redhat.com" <eric.auger@redhat.com>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	"Jonathan.Cameron@huawei.com" <Jonathan.Cameron@huawei.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	David Woodhouse <dwmw2@infradead.org>,
	"rjw@rjwysocki.net" <rjw@rjwysocki.net>,
	"shameerali.kolothum.thodi@huawei.com"
	<shameerali.kolothum.thodi@huawei.com>,
	"iommu@lists.linux-foundation.org"
	<iommu@lists.linux-foundation.org>,
	"sudeep.holla@arm.com" <sudeep.holla@arm.com>,
	"robin.murphy@arm.com" <robin.murphy@arm.com>,
	"linux-accelerators@lists.ozlabs.org"
	<linux-accelerators@lists.ozlabs.org>,
	baolu.lu@linux.intel.com
Subject: Re: [PATCH v9 03/10] iommu: Separate IOMMU_DEV_FEAT_IOPF from IOMMU_DEV_FEAT_SVA
Date: Sat, 16 Jan 2021 11:54:00 +0800	[thread overview]
Message-ID: <636814a9-7dea-06f6-03ec-6a98dd30b7e3@linux.intel.com> (raw)
In-Reply-To: <YAB0SHyUZbxprkL3@larix.localdomain>

Hi Jean,

On 2021/1/15 0:41, Jean-Philippe Brucker wrote:
> I guess detailing what's needed for nested IOPF can help the discussion,
> although I haven't seen any concrete plan about implementing it, and it
> still seems a couple of years away. There are two important steps with
> nested IOPF:
> 
> (1) Figuring out whether a fault comes from L1 or L2. A SMMU stall event
>      comes with this information, but a PRI page request doesn't. The IOMMU
>      driver has to first translate the IOVA to a GPA, injecting the fault
>      into the guest if this translation fails by using the usual
>      iommu_report_device_fault().
> 
> (2) Translating the faulting GPA to a HVA that can be fed to
>      handle_mm_fault(). That requires help from KVM, so another interface -
>      either KVM registering GPA->HVA translation tables or IOMMU driver
>      querying each translation. Either way it should be reusable by device
>      drivers that implement IOPF themselves.
> 
> (1) could be enabled with iommu_dev_enable_feature(). (2) requires a more
> complex interface. (2) alone might also be desirable - demand-paging for
> level 2 only, no SVA for level 1.
> 
> Anyway, back to this patch. What I'm trying to convey is "can the IOMMU
> receive incoming I/O page faults for this device and, when SVA is enabled,
> feed them to the mm subsystem?  Enable that or return an error." I'm stuck
> on the name. IOPF alone is too vague. Not IOPF_L1 as Kevin noted, since L1
> is also used in virtualization. IOPF_BIND and IOPF_SVA could also mean (2)
> above. IOMMU_DEV_FEAT_IOPF_FLAT?
> 
> That leaves space for the nested extensions. (1) above could be
> IOMMU_FEAT_IOPF_NESTED, and (2) requires some new interfacing with KVM (or
> just an external fault handler) and could be used with either IOPF_FLAT or
> IOPF_NESTED. We can figure out the details later. What do you think?

I agree that we can define IOPF_ for current usage and leave space for
future extensions.

IOPF_FLAT represents IOPF on first-level translation, currently first
level translation could be used in below cases.

1) FL w/ internal Page Table: Kernel IOVA;
2) FL w/ external Page Table: VFIO passthrough;
3) FL w/ shared CPU page table: SVA

We don't need to support IOPF for case 1). Let's put it aside.

IOPF handling of 2) and 3) are different. Do we need to define different
names to distinguish these two cases?

Best regards,
baolu

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-01-16  3:56 UTC|newest]

Thread overview: 105+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-08 14:52 [PATCH v9 00/10] iommu: I/O page faults for SMMUv3 Jean-Philippe Brucker
2021-01-08 14:52 ` Jean-Philippe Brucker
2021-01-08 14:52 ` Jean-Philippe Brucker
2021-01-08 14:52 ` [PATCH v9 01/10] iommu: Remove obsolete comment Jean-Philippe Brucker
2021-01-08 14:52   ` Jean-Philippe Brucker
2021-01-08 14:52   ` Jean-Philippe Brucker
2021-01-19 11:11   ` Jonathan Cameron
2021-01-19 11:11     ` Jonathan Cameron
2021-01-19 11:11     ` Jonathan Cameron
2021-01-20 17:41     ` Jean-Philippe Brucker
2021-01-20 17:41       ` Jean-Philippe Brucker
2021-01-20 17:41       ` Jean-Philippe Brucker
2021-01-08 14:52 ` [PATCH v9 02/10] iommu/arm-smmu-v3: Use device properties for pasid-num-bits Jean-Philippe Brucker
2021-01-08 14:52   ` Jean-Philippe Brucker
2021-01-08 14:52   ` Jean-Philippe Brucker
2021-01-19 11:22   ` Jonathan Cameron
2021-01-19 11:22     ` Jonathan Cameron
2021-01-19 11:22     ` Jonathan Cameron
2021-01-08 14:52 ` [PATCH v9 03/10] iommu: Separate IOMMU_DEV_FEAT_IOPF from IOMMU_DEV_FEAT_SVA Jean-Philippe Brucker
2021-01-08 14:52   ` Jean-Philippe Brucker
2021-01-08 14:52   ` Jean-Philippe Brucker
2021-01-12  4:31   ` Lu Baolu
2021-01-12  4:31     ` Lu Baolu
2021-01-12  4:31     ` Lu Baolu
2021-01-12  9:16     ` Jean-Philippe Brucker
2021-01-12  9:16       ` Jean-Philippe Brucker
2021-01-12  9:16       ` Jean-Philippe Brucker
2021-01-13  2:49       ` Lu Baolu
2021-01-13  2:49         ` Lu Baolu
2021-01-13  2:49         ` Lu Baolu
2021-01-13  8:10         ` Tian, Kevin
2021-01-13  8:10           ` Tian, Kevin
2021-01-13  8:10           ` Tian, Kevin
2021-01-14 16:41           ` Jean-Philippe Brucker
2021-01-14 16:41             ` Jean-Philippe Brucker
2021-01-14 16:41             ` Jean-Philippe Brucker
2021-01-16  3:54             ` Lu Baolu [this message]
2021-01-16  3:54               ` Lu Baolu
2021-01-16  3:54               ` Lu Baolu
2021-01-18  6:54               ` Tian, Kevin
2021-01-18  6:54                 ` Tian, Kevin
2021-01-18  6:54                 ` Tian, Kevin
2021-01-19 10:16                 ` Jean-Philippe Brucker
2021-01-19 10:16                   ` Jean-Philippe Brucker
2021-01-19 10:16                   ` Jean-Philippe Brucker
2021-01-20  1:57                   ` Lu Baolu
2021-01-20  1:57                     ` Lu Baolu
2021-01-20  1:57                     ` Lu Baolu
2021-01-08 14:52 ` [PATCH v9 04/10] iommu/vt-d: Support IOMMU_DEV_FEAT_IOPF Jean-Philippe Brucker
2021-01-08 14:52   ` Jean-Philippe Brucker
2021-01-08 14:52   ` Jean-Philippe Brucker
2021-01-08 14:52 ` [PATCH v9 05/10] uacce: Enable IOMMU_DEV_FEAT_IOPF Jean-Philippe Brucker
2021-01-08 14:52   ` Jean-Philippe Brucker
2021-01-08 14:52   ` Jean-Philippe Brucker
2021-01-11  3:29   ` Zhangfei Gao
2021-01-11  3:29     ` Zhangfei Gao
2021-01-11  3:29     ` Zhangfei Gao
2021-01-19 12:27   ` Jonathan Cameron
2021-01-19 12:27     ` Jonathan Cameron
2021-01-19 12:27     ` Jonathan Cameron
2021-01-20 17:42     ` Jean-Philippe Brucker
2021-01-20 17:42       ` Jean-Philippe Brucker
2021-01-20 17:42       ` Jean-Philippe Brucker
2021-01-20 20:47   ` Dave Jiang
2021-01-20 20:47     ` Dave Jiang
2021-01-20 20:47     ` Dave Jiang
2021-01-22 11:53     ` Zhou Wang
2021-01-22 11:53       ` Zhou Wang
2021-01-22 11:53       ` Zhou Wang
2021-01-22 15:43       ` Dave Jiang
2021-01-22 15:43         ` Dave Jiang
2021-01-22 15:43         ` Dave Jiang
2021-01-08 14:52 ` [PATCH v9 06/10] iommu: Add a page fault handler Jean-Philippe Brucker
2021-01-08 14:52   ` Jean-Philippe Brucker
2021-01-08 14:52   ` Jean-Philippe Brucker
2021-01-19 13:38   ` Jonathan Cameron
2021-01-19 13:38     ` Jonathan Cameron
2021-01-19 13:38     ` Jonathan Cameron
2021-01-20 17:43     ` Jean-Philippe Brucker
2021-01-20 17:43       ` Jean-Philippe Brucker
2021-01-20 17:43       ` Jean-Philippe Brucker
2021-01-08 14:52 ` [PATCH v9 07/10] iommu/arm-smmu-v3: Maintain a SID->device structure Jean-Philippe Brucker
2021-01-08 14:52   ` Jean-Philippe Brucker
2021-01-08 14:52   ` Jean-Philippe Brucker
2021-01-19 13:51   ` Jonathan Cameron
2021-01-19 13:51     ` Jonathan Cameron
2021-01-19 13:51     ` Jonathan Cameron
2021-01-08 14:52 ` [PATCH v9 08/10] dt-bindings: document stall property for IOMMU masters Jean-Philippe Brucker
2021-01-08 14:52   ` Jean-Philippe Brucker
2021-01-08 14:52   ` Jean-Philippe Brucker
2021-01-08 14:52 ` [PATCH v9 09/10] ACPI/IORT: Enable stall support for platform devices Jean-Philippe Brucker
2021-01-08 14:52   ` Jean-Philippe Brucker
2021-01-08 14:52   ` Jean-Philippe Brucker
2021-01-08 14:52 ` [PATCH v9 10/10] iommu/arm-smmu-v3: Add " Jean-Philippe Brucker
2021-01-08 14:52   ` Jean-Philippe Brucker
2021-01-08 14:52   ` Jean-Philippe Brucker
2021-01-19 17:28   ` Robin Murphy
2021-01-19 17:28     ` Robin Murphy
2021-01-19 17:28     ` Robin Murphy
2021-01-20 17:55     ` Jean-Philippe Brucker
2021-01-20 17:55       ` Jean-Philippe Brucker
2021-01-20 17:55       ` Jean-Philippe Brucker
2021-01-11  3:26 ` [PATCH v9 00/10] iommu: I/O page faults for SMMUv3 Zhangfei Gao
2021-01-11  3:26   ` Zhangfei Gao
2021-01-11  3:26   ` Zhangfei Gao

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=636814a9-7dea-06f6-03ec-6a98dd30b7e3@linux.intel.com \
    --to=baolu.lu@linux.intel.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=arnd@arndb.de \
    --cc=devicetree@vger.kernel.org \
    --cc=dwmw2@infradead.org \
    --cc=eric.auger@redhat.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=guohanjun@huawei.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jean-philippe@linaro.org \
    --cc=joro@8bytes.org \
    --cc=kevin.tian@intel.com \
    --cc=lenb@kernel.org \
    --cc=linux-accelerators@lists.ozlabs.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=rjw@rjwysocki.net \
    --cc=robh+dt@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=shameerali.kolothum.thodi@huawei.com \
    --cc=sudeep.holla@arm.com \
    --cc=vdumpa@nvidia.com \
    --cc=vivek.gautam@arm.com \
    --cc=wangzhou1@hisilicon.com \
    --cc=will@kernel.org \
    --cc=zhangfei.gao@linaro.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.