* [PATCH] intel-iommu: Turn off translations at shutdown
@ 2019-11-07 20:59 ` Deepa Dinamani
0 siblings, 0 replies; 31+ messages in thread
From: Deepa Dinamani @ 2019-11-07 20:59 UTC (permalink / raw)
To: joro, linux-kernel; +Cc: dwmw2, iommu
The intel-iommu driver assumes that the iommu state is
cleaned up at the start of the new kernel.
But, when we try to kexec boot something other than the
Linux kernel, the cleanup cannot be relied upon.
Hence, cleanup before we go down for reboot.
Keeping the cleanup at initialization also, in case BIOS
leaves the IOMMU enabled.
I considered turning off iommu only during kexec reboot,
but a clean shutdown seems always a good idea. But if
someone wants to make it conditional, we can do that.
Tested that before, the info message
'DMAR: Translation was enabled for <iommu> but we are not in kdump mode'
would be reported for each iommu. The message will not appear when the
DMA-remapping is not enabled on entry to the kernel.
Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
---
drivers/iommu/intel-iommu.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index fe8097078669..f0636b263722 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -4764,6 +4764,26 @@ static void intel_disable_iommus(void)
iommu_disable_translation(iommu);
}
+static void intel_iommu_shutdown(void)
+{
+ struct dmar_drhd_unit *drhd;
+ struct intel_iommu *iommu = NULL;
+
+ if (no_iommu || dmar_disabled)
+ return;
+
+ down_write(&dmar_global_lock);
+
+ /* Disable PMRs explicitly here. */
+ for_each_iommu(iommu, drhd)
+ iommu_disable_protect_mem_regions(iommu);
+
+ /* Make sure the IOMMUs are switched off */
+ intel_disable_iommus();
+
+ up_write(&dmar_global_lock);
+}
+
static inline struct intel_iommu *dev_to_intel_iommu(struct device *dev)
{
struct iommu_device *iommu_dev = dev_to_iommu_device(dev);
@@ -5013,6 +5033,8 @@ int __init intel_iommu_init(void)
}
up_write(&dmar_global_lock);
+ x86_platform.iommu_shutdown = intel_iommu_shutdown;
+
#if defined(CONFIG_X86) && defined(CONFIG_SWIOTLB)
/*
* If the system has no untrusted device or the user has decided
--
2.17.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH] intel-iommu: Turn off translations at shutdown
@ 2019-11-07 20:59 ` Deepa Dinamani
0 siblings, 0 replies; 31+ messages in thread
From: Deepa Dinamani @ 2019-11-07 20:59 UTC (permalink / raw)
To: joro, linux-kernel; +Cc: iommu, dwmw2
The intel-iommu driver assumes that the iommu state is
cleaned up at the start of the new kernel.
But, when we try to kexec boot something other than the
Linux kernel, the cleanup cannot be relied upon.
Hence, cleanup before we go down for reboot.
Keeping the cleanup at initialization also, in case BIOS
leaves the IOMMU enabled.
I considered turning off iommu only during kexec reboot,
but a clean shutdown seems always a good idea. But if
someone wants to make it conditional, we can do that.
Tested that before, the info message
'DMAR: Translation was enabled for <iommu> but we are not in kdump mode'
would be reported for each iommu. The message will not appear when the
DMA-remapping is not enabled on entry to the kernel.
Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
---
drivers/iommu/intel-iommu.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index fe8097078669..f0636b263722 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -4764,6 +4764,26 @@ static void intel_disable_iommus(void)
iommu_disable_translation(iommu);
}
+static void intel_iommu_shutdown(void)
+{
+ struct dmar_drhd_unit *drhd;
+ struct intel_iommu *iommu = NULL;
+
+ if (no_iommu || dmar_disabled)
+ return;
+
+ down_write(&dmar_global_lock);
+
+ /* Disable PMRs explicitly here. */
+ for_each_iommu(iommu, drhd)
+ iommu_disable_protect_mem_regions(iommu);
+
+ /* Make sure the IOMMUs are switched off */
+ intel_disable_iommus();
+
+ up_write(&dmar_global_lock);
+}
+
static inline struct intel_iommu *dev_to_intel_iommu(struct device *dev)
{
struct iommu_device *iommu_dev = dev_to_iommu_device(dev);
@@ -5013,6 +5033,8 @@ int __init intel_iommu_init(void)
}
up_write(&dmar_global_lock);
+ x86_platform.iommu_shutdown = intel_iommu_shutdown;
+
#if defined(CONFIG_X86) && defined(CONFIG_SWIOTLB)
/*
* If the system has no untrusted device or the user has decided
--
2.17.1
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply related [flat|nested] 31+ messages in thread
* Re: [PATCH] intel-iommu: Turn off translations at shutdown
2019-11-07 20:59 ` Deepa Dinamani
@ 2019-11-07 21:27 ` Deepa Dinamani
-1 siblings, 0 replies; 31+ messages in thread
From: Deepa Dinamani @ 2019-11-07 21:27 UTC (permalink / raw)
To: joro, Linux Kernel Mailing List; +Cc: David Woodhouse, iommu
On Thu, Nov 7, 2019 at 12:59 PM Deepa Dinamani <deepa.kernel@gmail.com> wrote:
> +static void intel_iommu_shutdown(void)
> + if (no_iommu || dmar_disabled)
> + return;
This check is actually not required here, as the handler is only
installed after these have been checked in intel_iommu_init.
I can remove this in the next version of the patch, but I'll wait a
few days for comments.
-Deepa
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH] intel-iommu: Turn off translations at shutdown
@ 2019-11-07 21:27 ` Deepa Dinamani
0 siblings, 0 replies; 31+ messages in thread
From: Deepa Dinamani @ 2019-11-07 21:27 UTC (permalink / raw)
To: joro, Linux Kernel Mailing List; +Cc: iommu, David Woodhouse
On Thu, Nov 7, 2019 at 12:59 PM Deepa Dinamani <deepa.kernel@gmail.com> wrote:
> +static void intel_iommu_shutdown(void)
> + if (no_iommu || dmar_disabled)
> + return;
This check is actually not required here, as the handler is only
installed after these have been checked in intel_iommu_init.
I can remove this in the next version of the patch, but I'll wait a
few days for comments.
-Deepa
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH] intel-iommu: Turn off translations at shutdown
2019-11-07 20:59 ` Deepa Dinamani
@ 2019-11-08 3:06 ` Lu Baolu
-1 siblings, 0 replies; 31+ messages in thread
From: Lu Baolu @ 2019-11-08 3:06 UTC (permalink / raw)
To: Deepa Dinamani, joro, linux-kernel; +Cc: baolu.lu, iommu, dwmw2
Hi,
On 11/8/19 4:59 AM, Deepa Dinamani wrote:
> The intel-iommu driver assumes that the iommu state is
> cleaned up at the start of the new kernel.
> But, when we try to kexec boot something other than the
> Linux kernel, the cleanup cannot be relied upon.
> Hence, cleanup before we go down for reboot.
>
> Keeping the cleanup at initialization also, in case BIOS
> leaves the IOMMU enabled.
>
> I considered turning off iommu only during kexec reboot,
> but a clean shutdown seems always a good idea. But if
> someone wants to make it conditional, we can do that.
>
> Tested that before, the info message
> 'DMAR: Translation was enabled for <iommu> but we are not in kdump mode'
> would be reported for each iommu. The message will not appear when the
> DMA-remapping is not enabled on entry to the kernel.
>
> Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
> ---
> drivers/iommu/intel-iommu.c | 22 ++++++++++++++++++++++
> 1 file changed, 22 insertions(+)
>
> diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
> index fe8097078669..f0636b263722 100644
> --- a/drivers/iommu/intel-iommu.c
> +++ b/drivers/iommu/intel-iommu.c
> @@ -4764,6 +4764,26 @@ static void intel_disable_iommus(void)
> iommu_disable_translation(iommu);
> }
>
> +static void intel_iommu_shutdown(void)
> +{
> + struct dmar_drhd_unit *drhd;
> + struct intel_iommu *iommu = NULL;
> +
> + if (no_iommu || dmar_disabled)
> + return;
> +
> + down_write(&dmar_global_lock);
> +
> + /* Disable PMRs explicitly here. */
> + for_each_iommu(iommu, drhd)
> + iommu_disable_protect_mem_regions(iommu);
> +
> + /* Make sure the IOMMUs are switched off */
> + intel_disable_iommus();
> +
> + up_write(&dmar_global_lock);
> +}
> +
> static inline struct intel_iommu *dev_to_intel_iommu(struct device *dev)
> {
> struct iommu_device *iommu_dev = dev_to_iommu_device(dev);
> @@ -5013,6 +5033,8 @@ int __init intel_iommu_init(void)
> }
> up_write(&dmar_global_lock);
>
> + x86_platform.iommu_shutdown = intel_iommu_shutdown;
How about moving it to detect_intel_iommu() in drivers/iommu/dmar.c? And
make sure that it's included with CONFIG_X86_64.
Best regards,
baolu
> +
> #if defined(CONFIG_X86) && defined(CONFIG_SWIOTLB)
> /*
> * If the system has no untrusted device or the user has decided
>
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH] intel-iommu: Turn off translations at shutdown
@ 2019-11-08 3:06 ` Lu Baolu
0 siblings, 0 replies; 31+ messages in thread
From: Lu Baolu @ 2019-11-08 3:06 UTC (permalink / raw)
To: Deepa Dinamani, joro, linux-kernel; +Cc: iommu, dwmw2
Hi,
On 11/8/19 4:59 AM, Deepa Dinamani wrote:
> The intel-iommu driver assumes that the iommu state is
> cleaned up at the start of the new kernel.
> But, when we try to kexec boot something other than the
> Linux kernel, the cleanup cannot be relied upon.
> Hence, cleanup before we go down for reboot.
>
> Keeping the cleanup at initialization also, in case BIOS
> leaves the IOMMU enabled.
>
> I considered turning off iommu only during kexec reboot,
> but a clean shutdown seems always a good idea. But if
> someone wants to make it conditional, we can do that.
>
> Tested that before, the info message
> 'DMAR: Translation was enabled for <iommu> but we are not in kdump mode'
> would be reported for each iommu. The message will not appear when the
> DMA-remapping is not enabled on entry to the kernel.
>
> Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
> ---
> drivers/iommu/intel-iommu.c | 22 ++++++++++++++++++++++
> 1 file changed, 22 insertions(+)
>
> diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
> index fe8097078669..f0636b263722 100644
> --- a/drivers/iommu/intel-iommu.c
> +++ b/drivers/iommu/intel-iommu.c
> @@ -4764,6 +4764,26 @@ static void intel_disable_iommus(void)
> iommu_disable_translation(iommu);
> }
>
> +static void intel_iommu_shutdown(void)
> +{
> + struct dmar_drhd_unit *drhd;
> + struct intel_iommu *iommu = NULL;
> +
> + if (no_iommu || dmar_disabled)
> + return;
> +
> + down_write(&dmar_global_lock);
> +
> + /* Disable PMRs explicitly here. */
> + for_each_iommu(iommu, drhd)
> + iommu_disable_protect_mem_regions(iommu);
> +
> + /* Make sure the IOMMUs are switched off */
> + intel_disable_iommus();
> +
> + up_write(&dmar_global_lock);
> +}
> +
> static inline struct intel_iommu *dev_to_intel_iommu(struct device *dev)
> {
> struct iommu_device *iommu_dev = dev_to_iommu_device(dev);
> @@ -5013,6 +5033,8 @@ int __init intel_iommu_init(void)
> }
> up_write(&dmar_global_lock);
>
> + x86_platform.iommu_shutdown = intel_iommu_shutdown;
How about moving it to detect_intel_iommu() in drivers/iommu/dmar.c? And
make sure that it's included with CONFIG_X86_64.
Best regards,
baolu
> +
> #if defined(CONFIG_X86) && defined(CONFIG_SWIOTLB)
> /*
> * If the system has no untrusted device or the user has decided
>
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH] intel-iommu: Turn off translations at shutdown
2019-11-07 21:27 ` Deepa Dinamani
@ 2019-11-08 3:07 ` Lu Baolu
-1 siblings, 0 replies; 31+ messages in thread
From: Lu Baolu @ 2019-11-08 3:07 UTC (permalink / raw)
To: Deepa Dinamani, joro, Linux Kernel Mailing List
Cc: baolu.lu, iommu, David Woodhouse
Hi,
On 11/8/19 5:27 AM, Deepa Dinamani wrote:
> On Thu, Nov 7, 2019 at 12:59 PM Deepa Dinamani <deepa.kernel@gmail.com> wrote:
>> +static void intel_iommu_shutdown(void)
>> + if (no_iommu || dmar_disabled)
>> + return;
>
> This check is actually not required here, as the handler is only
> installed after these have been checked in intel_iommu_init.
> I can remove this in the next version of the patch, but I'll wait a
> few days for comments.
This is probably still necessary if moving to detect_intel_iommu().
Best regards,
baolu
>
> -Deepa
> _______________________________________________
> iommu mailing list
> iommu@lists.linux-foundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/iommu
>
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH] intel-iommu: Turn off translations at shutdown
@ 2019-11-08 3:07 ` Lu Baolu
0 siblings, 0 replies; 31+ messages in thread
From: Lu Baolu @ 2019-11-08 3:07 UTC (permalink / raw)
To: Deepa Dinamani, joro, Linux Kernel Mailing List; +Cc: iommu, David Woodhouse
Hi,
On 11/8/19 5:27 AM, Deepa Dinamani wrote:
> On Thu, Nov 7, 2019 at 12:59 PM Deepa Dinamani <deepa.kernel@gmail.com> wrote:
>> +static void intel_iommu_shutdown(void)
>> + if (no_iommu || dmar_disabled)
>> + return;
>
> This check is actually not required here, as the handler is only
> installed after these have been checked in intel_iommu_init.
> I can remove this in the next version of the patch, but I'll wait a
> few days for comments.
This is probably still necessary if moving to detect_intel_iommu().
Best regards,
baolu
>
> -Deepa
> _______________________________________________
> iommu mailing list
> iommu@lists.linux-foundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/iommu
>
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH] intel-iommu: Turn off translations at shutdown
2019-11-07 20:59 ` Deepa Dinamani
@ 2019-11-08 7:54 ` David Woodhouse
-1 siblings, 0 replies; 31+ messages in thread
From: David Woodhouse @ 2019-11-08 7:54 UTC (permalink / raw)
To: Deepa Dinamani, joro, linux-kernel; +Cc: iommu, Jason.Zeng, Tian, Kevin
[-- Attachment #1: Type: text/plain, Size: 781 bytes --]
On Thu, 2019-11-07 at 12:59 -0800, Deepa Dinamani wrote:
> The intel-iommu driver assumes that the iommu state is
> cleaned up at the start of the new kernel.
> But, when we try to kexec boot something other than the
> Linux kernel, the cleanup cannot be relied upon.
> Hence, cleanup before we go down for reboot.
>
> Keeping the cleanup at initialization also, in case BIOS
> leaves the IOMMU enabled.
>
> I considered turning off iommu only during kexec reboot,
> but a clean shutdown seems always a good idea. But if
> someone wants to make it conditional, we can do that.
This is going to break things for the VMM live update scheme that Jason
presented at KVM Forum, isn't it?
In that case we rely on the IOMMU still operating during the
transition.
[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 5174 bytes --]
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH] intel-iommu: Turn off translations at shutdown
@ 2019-11-08 7:54 ` David Woodhouse
0 siblings, 0 replies; 31+ messages in thread
From: David Woodhouse @ 2019-11-08 7:54 UTC (permalink / raw)
To: Deepa Dinamani, joro, linux-kernel; +Cc: iommu, Tian, Kevin, Jason.Zeng
[-- Attachment #1.1: Type: text/plain, Size: 781 bytes --]
On Thu, 2019-11-07 at 12:59 -0800, Deepa Dinamani wrote:
> The intel-iommu driver assumes that the iommu state is
> cleaned up at the start of the new kernel.
> But, when we try to kexec boot something other than the
> Linux kernel, the cleanup cannot be relied upon.
> Hence, cleanup before we go down for reboot.
>
> Keeping the cleanup at initialization also, in case BIOS
> leaves the IOMMU enabled.
>
> I considered turning off iommu only during kexec reboot,
> but a clean shutdown seems always a good idea. But if
> someone wants to make it conditional, we can do that.
This is going to break things for the VMM live update scheme that Jason
presented at KVM Forum, isn't it?
In that case we rely on the IOMMU still operating during the
transition.
[-- Attachment #1.2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 5174 bytes --]
[-- Attachment #2: Type: text/plain, Size: 156 bytes --]
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply [flat|nested] 31+ messages in thread
* RE: [PATCH] intel-iommu: Turn off translations at shutdown
2019-11-08 7:54 ` David Woodhouse
@ 2019-11-08 8:47 ` Zeng, Jason
-1 siblings, 0 replies; 31+ messages in thread
From: Zeng, Jason @ 2019-11-08 8:47 UTC (permalink / raw)
To: David Woodhouse, Deepa Dinamani, joro, linux-kernel
Cc: iommu, Tian, Kevin, Zeng, Jason
> -----Original Message-----
> From: David Woodhouse <dwmw2@infradead.org>
> Sent: Friday, November 8, 2019 3:54 PM
> To: Deepa Dinamani <deepa.kernel@gmail.com>; joro@8bytes.org; linux-
> kernel@vger.kernel.org
> Cc: iommu@lists.linux-foundation.org; Zeng, Jason <jason.zeng@intel.com>;
> Tian, Kevin <kevin.tian@intel.com>
> Subject: Re: [PATCH] intel-iommu: Turn off translations at shutdown
>
> On Thu, 2019-11-07 at 12:59 -0800, Deepa Dinamani wrote:
> > The intel-iommu driver assumes that the iommu state is
> > cleaned up at the start of the new kernel.
> > But, when we try to kexec boot something other than the
> > Linux kernel, the cleanup cannot be relied upon.
> > Hence, cleanup before we go down for reboot.
> >
> > Keeping the cleanup at initialization also, in case BIOS
> > leaves the IOMMU enabled.
> >
> > I considered turning off iommu only during kexec reboot,
> > but a clean shutdown seems always a good idea. But if
> > someone wants to make it conditional, we can do that.
>
> This is going to break things for the VMM live update scheme that Jason
> presented at KVM Forum, isn't it?
>
> In that case we rely on the IOMMU still operating during the
> transition.
For VMM live update case, we should be able to detect and bypass
the shutdown that Deepa introduced here, so keep IOMMU still operating?
Thanks,
Jason
^ permalink raw reply [flat|nested] 31+ messages in thread
* RE: [PATCH] intel-iommu: Turn off translations at shutdown
@ 2019-11-08 8:47 ` Zeng, Jason
0 siblings, 0 replies; 31+ messages in thread
From: Zeng, Jason @ 2019-11-08 8:47 UTC (permalink / raw)
To: David Woodhouse, Deepa Dinamani, joro, linux-kernel
Cc: iommu, Tian, Kevin, Zeng, Jason
> -----Original Message-----
> From: David Woodhouse <dwmw2@infradead.org>
> Sent: Friday, November 8, 2019 3:54 PM
> To: Deepa Dinamani <deepa.kernel@gmail.com>; joro@8bytes.org; linux-
> kernel@vger.kernel.org
> Cc: iommu@lists.linux-foundation.org; Zeng, Jason <jason.zeng@intel.com>;
> Tian, Kevin <kevin.tian@intel.com>
> Subject: Re: [PATCH] intel-iommu: Turn off translations at shutdown
>
> On Thu, 2019-11-07 at 12:59 -0800, Deepa Dinamani wrote:
> > The intel-iommu driver assumes that the iommu state is
> > cleaned up at the start of the new kernel.
> > But, when we try to kexec boot something other than the
> > Linux kernel, the cleanup cannot be relied upon.
> > Hence, cleanup before we go down for reboot.
> >
> > Keeping the cleanup at initialization also, in case BIOS
> > leaves the IOMMU enabled.
> >
> > I considered turning off iommu only during kexec reboot,
> > but a clean shutdown seems always a good idea. But if
> > someone wants to make it conditional, we can do that.
>
> This is going to break things for the VMM live update scheme that Jason
> presented at KVM Forum, isn't it?
>
> In that case we rely on the IOMMU still operating during the
> transition.
For VMM live update case, we should be able to detect and bypass
the shutdown that Deepa introduced here, so keep IOMMU still operating?
Thanks,
Jason
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH] intel-iommu: Turn off translations at shutdown
2019-11-08 8:47 ` Zeng, Jason
@ 2019-11-08 8:57 ` David Woodhouse
-1 siblings, 0 replies; 31+ messages in thread
From: David Woodhouse @ 2019-11-08 8:57 UTC (permalink / raw)
To: Zeng, Jason, Deepa Dinamani, joro, linux-kernel; +Cc: iommu, Tian, Kevin
[-- Attachment #1: Type: text/plain, Size: 1576 bytes --]
On Fri, 2019-11-08 at 08:47 +0000, Zeng, Jason wrote:
> > -----Original Message-----
> > From: David Woodhouse <dwmw2@infradead.org>
> > Sent: Friday, November 8, 2019 3:54 PM
> > To: Deepa Dinamani <deepa.kernel@gmail.com>; joro@8bytes.org; linux-
> > kernel@vger.kernel.org
> > Cc: iommu@lists.linux-foundation.org; Zeng, Jason <jason.zeng@intel.com>;
> > Tian, Kevin <kevin.tian@intel.com>
> > Subject: Re: [PATCH] intel-iommu: Turn off translations at shutdown
> >
> > On Thu, 2019-11-07 at 12:59 -0800, Deepa Dinamani wrote:
> > > The intel-iommu driver assumes that the iommu state is
> > > cleaned up at the start of the new kernel.
> > > But, when we try to kexec boot something other than the
> > > Linux kernel, the cleanup cannot be relied upon.
> > > Hence, cleanup before we go down for reboot.
> > >
> > > Keeping the cleanup at initialization also, in case BIOS
> > > leaves the IOMMU enabled.
> > >
> > > I considered turning off iommu only during kexec reboot,
> > > but a clean shutdown seems always a good idea. But if
> > > someone wants to make it conditional, we can do that.
> >
> > This is going to break things for the VMM live update scheme that Jason
> > presented at KVM Forum, isn't it?
> >
> > In that case we rely on the IOMMU still operating during the
> > transition.
>
> For VMM live update case, we should be able to detect and bypass
> the shutdown that Deepa introduced here, so keep IOMMU still operating?
Is that a 'yes' to Deepa's "if someone wants to make it conditional, we
can do that" ?
[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 5174 bytes --]
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH] intel-iommu: Turn off translations at shutdown
@ 2019-11-08 8:57 ` David Woodhouse
0 siblings, 0 replies; 31+ messages in thread
From: David Woodhouse @ 2019-11-08 8:57 UTC (permalink / raw)
To: Zeng, Jason, Deepa Dinamani, joro, linux-kernel; +Cc: iommu, Tian, Kevin
[-- Attachment #1.1: Type: text/plain, Size: 1576 bytes --]
On Fri, 2019-11-08 at 08:47 +0000, Zeng, Jason wrote:
> > -----Original Message-----
> > From: David Woodhouse <dwmw2@infradead.org>
> > Sent: Friday, November 8, 2019 3:54 PM
> > To: Deepa Dinamani <deepa.kernel@gmail.com>; joro@8bytes.org; linux-
> > kernel@vger.kernel.org
> > Cc: iommu@lists.linux-foundation.org; Zeng, Jason <jason.zeng@intel.com>;
> > Tian, Kevin <kevin.tian@intel.com>
> > Subject: Re: [PATCH] intel-iommu: Turn off translations at shutdown
> >
> > On Thu, 2019-11-07 at 12:59 -0800, Deepa Dinamani wrote:
> > > The intel-iommu driver assumes that the iommu state is
> > > cleaned up at the start of the new kernel.
> > > But, when we try to kexec boot something other than the
> > > Linux kernel, the cleanup cannot be relied upon.
> > > Hence, cleanup before we go down for reboot.
> > >
> > > Keeping the cleanup at initialization also, in case BIOS
> > > leaves the IOMMU enabled.
> > >
> > > I considered turning off iommu only during kexec reboot,
> > > but a clean shutdown seems always a good idea. But if
> > > someone wants to make it conditional, we can do that.
> >
> > This is going to break things for the VMM live update scheme that Jason
> > presented at KVM Forum, isn't it?
> >
> > In that case we rely on the IOMMU still operating during the
> > transition.
>
> For VMM live update case, we should be able to detect and bypass
> the shutdown that Deepa introduced here, so keep IOMMU still operating?
Is that a 'yes' to Deepa's "if someone wants to make it conditional, we
can do that" ?
[-- Attachment #1.2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 5174 bytes --]
[-- Attachment #2: Type: text/plain, Size: 156 bytes --]
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply [flat|nested] 31+ messages in thread
* RE: [PATCH] intel-iommu: Turn off translations at shutdown
2019-11-08 8:57 ` David Woodhouse
@ 2019-11-08 9:11 ` Zeng, Jason
-1 siblings, 0 replies; 31+ messages in thread
From: Zeng, Jason @ 2019-11-08 9:11 UTC (permalink / raw)
To: David Woodhouse, Deepa Dinamani, joro, linux-kernel
Cc: iommu, Tian, Kevin, Zeng, Jason
> -----Original Message-----
> From: David Woodhouse <dwmw2@infradead.org>
> Sent: Friday, November 8, 2019 4:57 PM
> To: Zeng, Jason <jason.zeng@intel.com>; Deepa Dinamani
> <deepa.kernel@gmail.com>; joro@8bytes.org; linux-kernel@vger.kernel.org
> Cc: iommu@lists.linux-foundation.org; Tian, Kevin <kevin.tian@intel.com>
> Subject: Re: [PATCH] intel-iommu: Turn off translations at shutdown
>
> On Fri, 2019-11-08 at 08:47 +0000, Zeng, Jason wrote:
> > > -----Original Message-----
> > > From: David Woodhouse <dwmw2@infradead.org>
> > > Sent: Friday, November 8, 2019 3:54 PM
> > > To: Deepa Dinamani <deepa.kernel@gmail.com>; joro@8bytes.org;
> linux-
> > > kernel@vger.kernel.org
> > > Cc: iommu@lists.linux-foundation.org; Zeng, Jason
> <jason.zeng@intel.com>;
> > > Tian, Kevin <kevin.tian@intel.com>
> > > Subject: Re: [PATCH] intel-iommu: Turn off translations at shutdown
> > >
> > > On Thu, 2019-11-07 at 12:59 -0800, Deepa Dinamani wrote:
> > > > The intel-iommu driver assumes that the iommu state is
> > > > cleaned up at the start of the new kernel.
> > > > But, when we try to kexec boot something other than the
> > > > Linux kernel, the cleanup cannot be relied upon.
> > > > Hence, cleanup before we go down for reboot.
> > > >
> > > > Keeping the cleanup at initialization also, in case BIOS
> > > > leaves the IOMMU enabled.
> > > >
> > > > I considered turning off iommu only during kexec reboot,
> > > > but a clean shutdown seems always a good idea. But if
> > > > someone wants to make it conditional, we can do that.
> > >
> > > This is going to break things for the VMM live update scheme that Jason
> > > presented at KVM Forum, isn't it?
> > >
> > > In that case we rely on the IOMMU still operating during the
> > > transition.
> >
> > For VMM live update case, we should be able to detect and bypass
> > the shutdown that Deepa introduced here, so keep IOMMU still operating?
>
> Is that a 'yes' to Deepa's "if someone wants to make it conditional, we
> can do that" ?
Yes, I think so. Thanks!
^ permalink raw reply [flat|nested] 31+ messages in thread
* RE: [PATCH] intel-iommu: Turn off translations at shutdown
@ 2019-11-08 9:11 ` Zeng, Jason
0 siblings, 0 replies; 31+ messages in thread
From: Zeng, Jason @ 2019-11-08 9:11 UTC (permalink / raw)
To: David Woodhouse, Deepa Dinamani, joro, linux-kernel
Cc: iommu, Tian, Kevin, Zeng, Jason
> -----Original Message-----
> From: David Woodhouse <dwmw2@infradead.org>
> Sent: Friday, November 8, 2019 4:57 PM
> To: Zeng, Jason <jason.zeng@intel.com>; Deepa Dinamani
> <deepa.kernel@gmail.com>; joro@8bytes.org; linux-kernel@vger.kernel.org
> Cc: iommu@lists.linux-foundation.org; Tian, Kevin <kevin.tian@intel.com>
> Subject: Re: [PATCH] intel-iommu: Turn off translations at shutdown
>
> On Fri, 2019-11-08 at 08:47 +0000, Zeng, Jason wrote:
> > > -----Original Message-----
> > > From: David Woodhouse <dwmw2@infradead.org>
> > > Sent: Friday, November 8, 2019 3:54 PM
> > > To: Deepa Dinamani <deepa.kernel@gmail.com>; joro@8bytes.org;
> linux-
> > > kernel@vger.kernel.org
> > > Cc: iommu@lists.linux-foundation.org; Zeng, Jason
> <jason.zeng@intel.com>;
> > > Tian, Kevin <kevin.tian@intel.com>
> > > Subject: Re: [PATCH] intel-iommu: Turn off translations at shutdown
> > >
> > > On Thu, 2019-11-07 at 12:59 -0800, Deepa Dinamani wrote:
> > > > The intel-iommu driver assumes that the iommu state is
> > > > cleaned up at the start of the new kernel.
> > > > But, when we try to kexec boot something other than the
> > > > Linux kernel, the cleanup cannot be relied upon.
> > > > Hence, cleanup before we go down for reboot.
> > > >
> > > > Keeping the cleanup at initialization also, in case BIOS
> > > > leaves the IOMMU enabled.
> > > >
> > > > I considered turning off iommu only during kexec reboot,
> > > > but a clean shutdown seems always a good idea. But if
> > > > someone wants to make it conditional, we can do that.
> > >
> > > This is going to break things for the VMM live update scheme that Jason
> > > presented at KVM Forum, isn't it?
> > >
> > > In that case we rely on the IOMMU still operating during the
> > > transition.
> >
> > For VMM live update case, we should be able to detect and bypass
> > the shutdown that Deepa introduced here, so keep IOMMU still operating?
>
> Is that a 'yes' to Deepa's "if someone wants to make it conditional, we
> can do that" ?
Yes, I think so. Thanks!
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH] intel-iommu: Turn off translations at shutdown
2019-11-08 3:06 ` Lu Baolu
@ 2019-11-08 22:28 ` Deepa Dinamani
-1 siblings, 0 replies; 31+ messages in thread
From: Deepa Dinamani @ 2019-11-08 22:28 UTC (permalink / raw)
To: Lu Baolu; +Cc: joro, Linux Kernel Mailing List, iommu, David Woodhouse
> > + x86_platform.iommu_shutdown = intel_iommu_shutdown;
>
> How about moving it to detect_intel_iommu() in drivers/iommu/dmar.c? And
Ok, makes sense to move it along with the init handler.
> make sure that it's included with CONFIG_X86_64.
You mean CONFIG_X86 like the init that is already there?
#ifdef CONFIG_X86
if (!ret)
x86_init.iommu.iommu_init = intel_iommu_init;
#endif
Thanks,
-Deepa
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH] intel-iommu: Turn off translations at shutdown
@ 2019-11-08 22:28 ` Deepa Dinamani
0 siblings, 0 replies; 31+ messages in thread
From: Deepa Dinamani @ 2019-11-08 22:28 UTC (permalink / raw)
To: Lu Baolu; +Cc: David Woodhouse, Linux Kernel Mailing List, iommu
> > + x86_platform.iommu_shutdown = intel_iommu_shutdown;
>
> How about moving it to detect_intel_iommu() in drivers/iommu/dmar.c? And
Ok, makes sense to move it along with the init handler.
> make sure that it's included with CONFIG_X86_64.
You mean CONFIG_X86 like the init that is already there?
#ifdef CONFIG_X86
if (!ret)
x86_init.iommu.iommu_init = intel_iommu_init;
#endif
Thanks,
-Deepa
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH] intel-iommu: Turn off translations at shutdown
2019-11-08 9:11 ` Zeng, Jason
@ 2019-11-08 22:48 ` Deepa Dinamani
-1 siblings, 0 replies; 31+ messages in thread
From: Deepa Dinamani @ 2019-11-08 22:48 UTC (permalink / raw)
To: Zeng, Jason; +Cc: David Woodhouse, joro, linux-kernel, iommu, Tian, Kevin
> > > For VMM live update case, we should be able to detect and bypass
> > > the shutdown that Deepa introduced here, so keep IOMMU still operating?
> >
> > Is that a 'yes' to Deepa's "if someone wants to make it conditional, we
> > can do that" ?
>
> Yes, I think so. Thanks!
Are these changes already part of the kernel like avoiding shutdown of
the passthrough devices? device_shutdown() doesn't seem to be doing
anything selectively as of now.
Thanks,
Deepa
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH] intel-iommu: Turn off translations at shutdown
@ 2019-11-08 22:48 ` Deepa Dinamani
0 siblings, 0 replies; 31+ messages in thread
From: Deepa Dinamani @ 2019-11-08 22:48 UTC (permalink / raw)
To: Zeng, Jason; +Cc: Tian, Kevin, David Woodhouse, linux-kernel, iommu
> > > For VMM live update case, we should be able to detect and bypass
> > > the shutdown that Deepa introduced here, so keep IOMMU still operating?
> >
> > Is that a 'yes' to Deepa's "if someone wants to make it conditional, we
> > can do that" ?
>
> Yes, I think so. Thanks!
Are these changes already part of the kernel like avoiding shutdown of
the passthrough devices? device_shutdown() doesn't seem to be doing
anything selectively as of now.
Thanks,
Deepa
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH] intel-iommu: Turn off translations at shutdown
2019-11-08 22:28 ` Deepa Dinamani
@ 2019-11-09 0:35 ` Lu Baolu
-1 siblings, 0 replies; 31+ messages in thread
From: Lu Baolu @ 2019-11-09 0:35 UTC (permalink / raw)
To: Deepa Dinamani
Cc: baolu.lu, joro, Linux Kernel Mailing List, iommu, David Woodhouse
Hi,
On 11/9/19 6:28 AM, Deepa Dinamani wrote:
>>> + x86_platform.iommu_shutdown = intel_iommu_shutdown;
>>
>> How about moving it to detect_intel_iommu() in drivers/iommu/dmar.c? And
>
> Ok, makes sense to move it along with the init handler.
>
>> make sure that it's included with CONFIG_X86_64.
>
> You mean CONFIG_X86 like the init that is already there?
>
> #ifdef CONFIG_X86
> if (!ret)
> x86_init.iommu.iommu_init = intel_iommu_init;
> #endif
>
Yes.
Also, change the title to "iommu/vt-d: Turn off ..."
Best regards,
baolu
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH] intel-iommu: Turn off translations at shutdown
@ 2019-11-09 0:35 ` Lu Baolu
0 siblings, 0 replies; 31+ messages in thread
From: Lu Baolu @ 2019-11-09 0:35 UTC (permalink / raw)
To: Deepa Dinamani; +Cc: David Woodhouse, Linux Kernel Mailing List, iommu
Hi,
On 11/9/19 6:28 AM, Deepa Dinamani wrote:
>>> + x86_platform.iommu_shutdown = intel_iommu_shutdown;
>>
>> How about moving it to detect_intel_iommu() in drivers/iommu/dmar.c? And
>
> Ok, makes sense to move it along with the init handler.
>
>> make sure that it's included with CONFIG_X86_64.
>
> You mean CONFIG_X86 like the init that is already there?
>
> #ifdef CONFIG_X86
> if (!ret)
> x86_init.iommu.iommu_init = intel_iommu_init;
> #endif
>
Yes.
Also, change the title to "iommu/vt-d: Turn off ..."
Best regards,
baolu
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH] intel-iommu: Turn off translations at shutdown
2019-11-08 22:48 ` Deepa Dinamani
@ 2019-11-10 18:24 ` Deepa Dinamani
-1 siblings, 0 replies; 31+ messages in thread
From: Deepa Dinamani @ 2019-11-10 18:24 UTC (permalink / raw)
To: Zeng, Jason
Cc: David Woodhouse, joro, linux-kernel, iommu, Tian, Kevin,
Ron Minnich, Arnd Bergmann
On Fri, Nov 8, 2019 at 2:48 PM Deepa Dinamani <deepa.kernel@gmail.com> wrote:
>
> > > > For VMM live update case, we should be able to detect and bypass
> > > > the shutdown that Deepa introduced here, so keep IOMMU still operating?
> > >
> > > Is that a 'yes' to Deepa's "if someone wants to make it conditional, we
> > > can do that" ?
> >
> > Yes, I think so. Thanks!
>
> Are these changes already part of the kernel like avoiding shutdown of
> the passthrough devices? device_shutdown() doesn't seem to be doing
> anything selectively as of now.
I've posted the v2 without the conditional for now:
https://lore.kernel.org/patchwork/patch/1151225/
As a side topic, I'm trying to support https://www.linuxboot.org/. I
have a couple of more such cleanups coming. The VMM live updates and
linuxboot seem to have contradicting requirements and they both use
kexec. So kexec_in_progress doesn't seem like a sufficient indicator
to distinguish between the two. Do you already have an idea on how to
distiguish between them? Does a separate sys_reboot() command
parameter sound ok? Or, we could use the flags in the sys_kexec_load()
depending on how the live update feature is implemented.
-Deepa
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH] intel-iommu: Turn off translations at shutdown
@ 2019-11-10 18:24 ` Deepa Dinamani
0 siblings, 0 replies; 31+ messages in thread
From: Deepa Dinamani @ 2019-11-10 18:24 UTC (permalink / raw)
To: Zeng, Jason
Cc: Tian, Kevin, Arnd Bergmann, linux-kernel, iommu, Ron Minnich,
David Woodhouse
On Fri, Nov 8, 2019 at 2:48 PM Deepa Dinamani <deepa.kernel@gmail.com> wrote:
>
> > > > For VMM live update case, we should be able to detect and bypass
> > > > the shutdown that Deepa introduced here, so keep IOMMU still operating?
> > >
> > > Is that a 'yes' to Deepa's "if someone wants to make it conditional, we
> > > can do that" ?
> >
> > Yes, I think so. Thanks!
>
> Are these changes already part of the kernel like avoiding shutdown of
> the passthrough devices? device_shutdown() doesn't seem to be doing
> anything selectively as of now.
I've posted the v2 without the conditional for now:
https://lore.kernel.org/patchwork/patch/1151225/
As a side topic, I'm trying to support https://www.linuxboot.org/. I
have a couple of more such cleanups coming. The VMM live updates and
linuxboot seem to have contradicting requirements and they both use
kexec. So kexec_in_progress doesn't seem like a sufficient indicator
to distinguish between the two. Do you already have an idea on how to
distiguish between them? Does a separate sys_reboot() command
parameter sound ok? Or, we could use the flags in the sys_kexec_load()
depending on how the live update feature is implemented.
-Deepa
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH] intel-iommu: Turn off translations at shutdown
2019-11-10 18:24 ` Deepa Dinamani
@ 2019-11-10 20:36 ` Deepa Dinamani
-1 siblings, 0 replies; 31+ messages in thread
From: Deepa Dinamani @ 2019-11-10 20:36 UTC (permalink / raw)
To: Zeng, Jason
Cc: David Woodhouse, joro, linux-kernel, iommu, Tian, Kevin,
Arnd Bergmann, rminnich
On Sun, Nov 10, 2019 at 10:24 AM Deepa Dinamani <deepa.kernel@gmail.com> wrote:
>
> On Fri, Nov 8, 2019 at 2:48 PM Deepa Dinamani <deepa.kernel@gmail.com> wrote:
> >
> > > > > For VMM live update case, we should be able to detect and bypass
> > > > > the shutdown that Deepa introduced here, so keep IOMMU still operating?
> > > >
> > > > Is that a 'yes' to Deepa's "if someone wants to make it conditional, we
> > > > can do that" ?
> > >
> > > Yes, I think so. Thanks!
> >
> > Are these changes already part of the kernel like avoiding shutdown of
> > the passthrough devices? device_shutdown() doesn't seem to be doing
> > anything selectively as of now.
>
> I've posted the v2 without the conditional for now:
> https://lore.kernel.org/patchwork/patch/1151225/
>
> As a side topic, I'm trying to support https://www.linuxboot.org/. I
> have a couple of more such cleanups coming. The VMM live updates and
> linuxboot seem to have contradicting requirements and they both use
> kexec. So kexec_in_progress doesn't seem like a sufficient indicator
> to distinguish between the two. Do you already have an idea on how to
> distiguish between them? Does a separate sys_reboot() command
> parameter sound ok? Or, we could use the flags in the sys_kexec_load()
> depending on how the live update feature is implemented.
Also, the AMD driver disables iommu at shutdown already. So the live
update feature is already broken on AMD.
-Deepa
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH] intel-iommu: Turn off translations at shutdown
@ 2019-11-10 20:36 ` Deepa Dinamani
0 siblings, 0 replies; 31+ messages in thread
From: Deepa Dinamani @ 2019-11-10 20:36 UTC (permalink / raw)
To: Zeng, Jason
Cc: Tian, Kevin, Arnd Bergmann, linux-kernel, iommu, rminnich,
David Woodhouse
On Sun, Nov 10, 2019 at 10:24 AM Deepa Dinamani <deepa.kernel@gmail.com> wrote:
>
> On Fri, Nov 8, 2019 at 2:48 PM Deepa Dinamani <deepa.kernel@gmail.com> wrote:
> >
> > > > > For VMM live update case, we should be able to detect and bypass
> > > > > the shutdown that Deepa introduced here, so keep IOMMU still operating?
> > > >
> > > > Is that a 'yes' to Deepa's "if someone wants to make it conditional, we
> > > > can do that" ?
> > >
> > > Yes, I think so. Thanks!
> >
> > Are these changes already part of the kernel like avoiding shutdown of
> > the passthrough devices? device_shutdown() doesn't seem to be doing
> > anything selectively as of now.
>
> I've posted the v2 without the conditional for now:
> https://lore.kernel.org/patchwork/patch/1151225/
>
> As a side topic, I'm trying to support https://www.linuxboot.org/. I
> have a couple of more such cleanups coming. The VMM live updates and
> linuxboot seem to have contradicting requirements and they both use
> kexec. So kexec_in_progress doesn't seem like a sufficient indicator
> to distinguish between the two. Do you already have an idea on how to
> distiguish between them? Does a separate sys_reboot() command
> parameter sound ok? Or, we could use the flags in the sys_kexec_load()
> depending on how the live update feature is implemented.
Also, the AMD driver disables iommu at shutdown already. So the live
update feature is already broken on AMD.
-Deepa
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply [flat|nested] 31+ messages in thread
* RE: [PATCH] intel-iommu: Turn off translations at shutdown
2019-11-08 22:48 ` Deepa Dinamani
@ 2019-11-11 0:39 ` Zeng, Jason
-1 siblings, 0 replies; 31+ messages in thread
From: Zeng, Jason @ 2019-11-11 0:39 UTC (permalink / raw)
To: Deepa Dinamani
Cc: David Woodhouse, joro, linux-kernel, iommu, Tian, Kevin, Zeng, Jason
> -----Original Message-----
> > > > For VMM live update case, we should be able to detect and bypass
> > > > the shutdown that Deepa introduced here, so keep IOMMU still
> operating?
> > >
> > > Is that a 'yes' to Deepa's "if someone wants to make it conditional,
> > > we can do that" ?
> >
> > Yes, I think so. Thanks!
>
> Are these changes already part of the kernel like avoiding shutdown of the
> passthrough devices? device_shutdown() doesn't seem to be doing anything
> selectively as of now.
>
No, it is not in upstream yet. It is an on-going effort, which tries to kexec reboot
the host while keeping IOMMU still working.
Thanks,
Jason
> Thanks,
> Deepa
^ permalink raw reply [flat|nested] 31+ messages in thread
* RE: [PATCH] intel-iommu: Turn off translations at shutdown
@ 2019-11-11 0:39 ` Zeng, Jason
0 siblings, 0 replies; 31+ messages in thread
From: Zeng, Jason @ 2019-11-11 0:39 UTC (permalink / raw)
To: Deepa Dinamani
Cc: Tian, Kevin, linux-kernel, iommu, Zeng, Jason, David Woodhouse
> -----Original Message-----
> > > > For VMM live update case, we should be able to detect and bypass
> > > > the shutdown that Deepa introduced here, so keep IOMMU still
> operating?
> > >
> > > Is that a 'yes' to Deepa's "if someone wants to make it conditional,
> > > we can do that" ?
> >
> > Yes, I think so. Thanks!
>
> Are these changes already part of the kernel like avoiding shutdown of the
> passthrough devices? device_shutdown() doesn't seem to be doing anything
> selectively as of now.
>
No, it is not in upstream yet. It is an on-going effort, which tries to kexec reboot
the host while keeping IOMMU still working.
Thanks,
Jason
> Thanks,
> Deepa
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply [flat|nested] 31+ messages in thread
* RE: [PATCH] intel-iommu: Turn off translations at shutdown
2019-11-10 20:36 ` Deepa Dinamani
@ 2019-11-11 2:35 ` Zeng, Jason
-1 siblings, 0 replies; 31+ messages in thread
From: Zeng, Jason @ 2019-11-11 2:35 UTC (permalink / raw)
To: Deepa Dinamani
Cc: David Woodhouse, joro, linux-kernel, iommu, Tian, Kevin,
Arnd Bergmann, rminnich, Zeng, Jason
> -----Original Message-----
> On Sun, Nov 10, 2019 at 10:24 AM Deepa Dinamani
> > I've posted the v2 without the conditional for now:
> > https://lore.kernel.org/patchwork/patch/1151225/
> >
> > As a side topic, I'm trying to support https://www.linuxboot.org/. I
> > have a couple of more such cleanups coming. The VMM live updates and
> > linuxboot seem to have contradicting requirements and they both use
> > kexec. So kexec_in_progress doesn't seem like a sufficient indicator
> > to distinguish between the two. Do you already have an idea on how to
> > distiguish between them? Does a separate sys_reboot() command
> > parameter sound ok? Or, we could use the flags in the sys_kexec_load()
> > depending on how the live update feature is implemented.
>
> Also, the AMD driver disables iommu at shutdown already. So the live update
> feature is already broken on AMD.
>
Hi Deepa,
I think you may not need to consider too much VMM live update here (although it
would be good to consider possible future features), after all it is an on-going effort,
we are still not quite sure what exact modifications it needs. The VMM live update
itself will figure out what is the best way to modify the code.
Thanks,
Jason
> -Deepa
^ permalink raw reply [flat|nested] 31+ messages in thread
* RE: [PATCH] intel-iommu: Turn off translations at shutdown
@ 2019-11-11 2:35 ` Zeng, Jason
0 siblings, 0 replies; 31+ messages in thread
From: Zeng, Jason @ 2019-11-11 2:35 UTC (permalink / raw)
To: Deepa Dinamani
Cc: Tian, Kevin, Arnd Bergmann, linux-kernel, iommu, Zeng, Jason,
rminnich, David Woodhouse
> -----Original Message-----
> On Sun, Nov 10, 2019 at 10:24 AM Deepa Dinamani
> > I've posted the v2 without the conditional for now:
> > https://lore.kernel.org/patchwork/patch/1151225/
> >
> > As a side topic, I'm trying to support https://www.linuxboot.org/. I
> > have a couple of more such cleanups coming. The VMM live updates and
> > linuxboot seem to have contradicting requirements and they both use
> > kexec. So kexec_in_progress doesn't seem like a sufficient indicator
> > to distinguish between the two. Do you already have an idea on how to
> > distiguish between them? Does a separate sys_reboot() command
> > parameter sound ok? Or, we could use the flags in the sys_kexec_load()
> > depending on how the live update feature is implemented.
>
> Also, the AMD driver disables iommu at shutdown already. So the live update
> feature is already broken on AMD.
>
Hi Deepa,
I think you may not need to consider too much VMM live update here (although it
would be good to consider possible future features), after all it is an on-going effort,
we are still not quite sure what exact modifications it needs. The VMM live update
itself will figure out what is the best way to modify the code.
Thanks,
Jason
> -Deepa
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH] intel-iommu: Turn off translations at shutdown
2019-11-07 20:59 ` Deepa Dinamani
` (3 preceding siblings ...)
(?)
@ 2019-11-11 13:50 ` kbuild test robot
-1 siblings, 0 replies; 31+ messages in thread
From: kbuild test robot @ 2019-11-11 13:50 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 4738 bytes --]
Hi Deepa,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR on v5.4-rc7 next-20191108]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Deepa-Dinamani/intel-iommu-Turn-off-translations-at-shutdown/20191109-195859
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 0058b0a506e40d9a2c62015fe92eb64a44d78cd9
config: ia64-defconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 7.4.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.4.0 make.cross ARCH=ia64
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
drivers/iommu/intel-iommu.c: In function 'intel_iommu_init':
>> drivers/iommu/intel-iommu.c:5031:2: error: 'x86_platform' undeclared (first use in this function); did you mean 'pci_platform_rom'?
x86_platform.iommu_shutdown = intel_iommu_shutdown;
^~~~~~~~~~~~
pci_platform_rom
drivers/iommu/intel-iommu.c:5031:2: note: each undeclared identifier is reported only once for each function it appears in
vim +5031 drivers/iommu/intel-iommu.c
4940
4941 int __init intel_iommu_init(void)
4942 {
4943 int ret = -ENODEV;
4944 struct dmar_drhd_unit *drhd;
4945 struct intel_iommu *iommu;
4946
4947 /*
4948 * Intel IOMMU is required for a TXT/tboot launch or platform
4949 * opt in, so enforce that.
4950 */
4951 force_on = tboot_force_iommu() || platform_optin_force_iommu();
4952
4953 if (iommu_init_mempool()) {
4954 if (force_on)
4955 panic("tboot: Failed to initialize iommu memory\n");
4956 return -ENOMEM;
4957 }
4958
4959 down_write(&dmar_global_lock);
4960 if (dmar_table_init()) {
4961 if (force_on)
4962 panic("tboot: Failed to initialize DMAR table\n");
4963 goto out_free_dmar;
4964 }
4965
4966 if (dmar_dev_scope_init() < 0) {
4967 if (force_on)
4968 panic("tboot: Failed to initialize DMAR device scope\n");
4969 goto out_free_dmar;
4970 }
4971
4972 up_write(&dmar_global_lock);
4973
4974 /*
4975 * The bus notifier takes the dmar_global_lock, so lockdep will
4976 * complain later when we register it under the lock.
4977 */
4978 dmar_register_bus_notifier();
4979
4980 down_write(&dmar_global_lock);
4981
4982 if (no_iommu || dmar_disabled) {
4983 /*
4984 * We exit the function here to ensure IOMMU's remapping and
4985 * mempool aren't setup, which means that the IOMMU's PMRs
4986 * won't be disabled via the call to init_dmars(). So disable
4987 * it explicitly here. The PMRs were setup by tboot prior to
4988 * calling SENTER, but the kernel is expected to reset/tear
4989 * down the PMRs.
4990 */
4991 if (intel_iommu_tboot_noforce) {
4992 for_each_iommu(iommu, drhd)
4993 iommu_disable_protect_mem_regions(iommu);
4994 }
4995
4996 /*
4997 * Make sure the IOMMUs are switched off, even when we
4998 * boot into a kexec kernel and the previous kernel left
4999 * them enabled
5000 */
5001 intel_disable_iommus();
5002 goto out_free_dmar;
5003 }
5004
5005 if (list_empty(&dmar_rmrr_units))
5006 pr_info("No RMRR found\n");
5007
5008 if (list_empty(&dmar_atsr_units))
5009 pr_info("No ATSR found\n");
5010
5011 if (dmar_init_reserved_ranges()) {
5012 if (force_on)
5013 panic("tboot: Failed to reserve iommu ranges\n");
5014 goto out_free_reserved_range;
5015 }
5016
5017 if (dmar_map_gfx)
5018 intel_iommu_gfx_mapped = 1;
5019
5020 init_no_remapping_devices();
5021
5022 ret = init_dmars();
5023 if (ret) {
5024 if (force_on)
5025 panic("tboot: Failed to initialize DMARs\n");
5026 pr_err("Initialization failed\n");
5027 goto out_free_reserved_range;
5028 }
5029 up_write(&dmar_global_lock);
5030
> 5031 x86_platform.iommu_shutdown = intel_iommu_shutdown;
5032
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel Corporation
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 19083 bytes --]
^ permalink raw reply [flat|nested] 31+ messages in thread
end of thread, other threads:[~2019-11-11 13:50 UTC | newest]
Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-07 20:59 [PATCH] intel-iommu: Turn off translations at shutdown Deepa Dinamani
2019-11-07 20:59 ` Deepa Dinamani
2019-11-07 21:27 ` Deepa Dinamani
2019-11-07 21:27 ` Deepa Dinamani
2019-11-08 3:07 ` Lu Baolu
2019-11-08 3:07 ` Lu Baolu
2019-11-08 3:06 ` Lu Baolu
2019-11-08 3:06 ` Lu Baolu
2019-11-08 22:28 ` Deepa Dinamani
2019-11-08 22:28 ` Deepa Dinamani
2019-11-09 0:35 ` Lu Baolu
2019-11-09 0:35 ` Lu Baolu
2019-11-08 7:54 ` David Woodhouse
2019-11-08 7:54 ` David Woodhouse
2019-11-08 8:47 ` Zeng, Jason
2019-11-08 8:47 ` Zeng, Jason
2019-11-08 8:57 ` David Woodhouse
2019-11-08 8:57 ` David Woodhouse
2019-11-08 9:11 ` Zeng, Jason
2019-11-08 9:11 ` Zeng, Jason
2019-11-08 22:48 ` Deepa Dinamani
2019-11-08 22:48 ` Deepa Dinamani
2019-11-10 18:24 ` Deepa Dinamani
2019-11-10 18:24 ` Deepa Dinamani
2019-11-10 20:36 ` Deepa Dinamani
2019-11-10 20:36 ` Deepa Dinamani
2019-11-11 2:35 ` Zeng, Jason
2019-11-11 2:35 ` Zeng, Jason
2019-11-11 0:39 ` Zeng, Jason
2019-11-11 0:39 ` Zeng, Jason
2019-11-11 13:50 ` kbuild test robot
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.