Skip to contentSkip to conversation

PCI: vmd: Reset VMD config register between soft reboots

PATCH Applied Nirmal Patel 3 participants 5 messages Feb 24, 2023 – Apr 21, 2023

Subsystems (3)
lore
Share & tools
lore

Nirmal Patel

author maintainer
#0 lore raw

PATCH 1/1 PCI: vmd: Reset VMD config register between soft reboots

VMD driver can disable or enable MSI remapping by changing VMCONFIG_MSI_REMAP register. This register needs to be set to the default value during soft reboots. Drives failed to enumerate when Windows boots after performing a soft reboot from Linux. Windows doesn't support MSI remapping disable feature and stale register value hinders Windows VMD driver initialization process. Adding vmd_shutdown function to make sure to set the VMCONFIG register to the default value.

Fixes ee81ee84f873 ("PCI: vmd: Disable MSI-X remapping when possible")
---
 drivers/pci/controller/vmd.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/pci/controller/vmd.c +8 -0
index 769eedeb8802..50a187a29a1d 100644
@@ -979,6 +979,13 @@ static void vmd_remove(struct pci_dev *dev)
 	ida_simple_remove(&vmd_instance_ida, vmd->instance);
 }
 
+static void vmd_shutdown(struct pci_dev *dev)
+{
+        struct vmd_dev *vmd = pci_get_drvdata(dev);
+
+        vmd_remove_irq_domain(vmd);
+}
+
 #ifdef CONFIG_PM_SLEEP
 static int vmd_suspend(struct device *dev)
 {
@@ -1056,6 +1063,7 @@ static struct pci_driver vmd_drv = {
 	.id_table	= vmd_ids,
 	.probe		= vmd_probe,
 	.remove		= vmd_remove,
+	.shutdown	= vmd_shutdown,
 	.driver		= {
 		.pm	= &vmd_dev_pm_ops,
 	},
Signature · 1 line
2.27.0
author maintainer
#1 lore raw
Quoted 34 lines · Nirmal Patel

VMD driver can disable or enable MSI remapping by changing VMCONFIG_MSI_REMAP register. This register needs to be set to the default value during soft reboots. Drives failed to enumerate when Windows boots after performing a soft reboot from Linux. Windows doesn't support MSI remapping disable feature and stale register value hinders Windows VMD driver initialization process. Adding vmd_shutdown function to make sure to set the VMCONFIG register to the default value.

Fixes ee81ee84f873 ("PCI: vmd: Disable MSI-X remapping when possible")
---
 drivers/pci/controller/vmd.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/pci/controller/vmd.c +7 -0
index 769eedeb8802..50a187a29a1d 100644
@@ -979,6 +979,13 @@ static void vmd_remove(struct pci_dev *dev)
 	ida_simple_remove(&vmd_instance_ida, vmd->instance);
 }
 
+static void vmd_shutdown(struct pci_dev *dev)
+{
+        struct vmd_dev *vmd = pci_get_drvdata(dev);
+
+        vmd_remove_irq_domain(vmd);
+}
+
 #ifdef CONFIG_PM_SLEEP
 static int vmd_suspend(struct device *dev)
 {

drivers/pci/controller/vmd.c static struct pci_driver vmd_drv = { · line 1069

Quoted 7 lines
drivers/pci/controller/vmd.c +1 -0
@@ -1056,6 +1063,7 @@ static struct pci_driver vmd_drv = {
 	.id_table	= vmd_ids,
 	.probe		= vmd_probe,
 	.remove		= vmd_remove,
+	.shutdown	= vmd_shutdown,
 	.driver		= {
 		.pm	= &vmd_dev_pm_ops,
 	},

Gentle ping.

Thanks

reviewer Reviewed-by
#2 lore raw
Quoted 45 lines · Nirmal
Quoted 34 lines · Nirmal Patel

VMD driver can disable or enable MSI remapping by changing VMCONFIG_MSI_REMAP register. This register needs to be set to the default value during soft reboots. Drives failed to enumerate when Windows boots after performing a soft reboot from Linux. Windows doesn't support MSI remapping disable feature and stale register value hinders Windows VMD driver initialization process. Adding vmd_shutdown function to make sure to set the VMCONFIG register to the default value.

Fixes ee81ee84f873 ("PCI: vmd: Disable MSI-X remapping when possible")
---
  drivers/pci/controller/vmd.c | 8 ++++++++
  1 file changed, 8 insertions(+)
drivers/pci/controller/vmd.c +7 -0
index 769eedeb8802..50a187a29a1d 100644
@@ -979,6 +979,13 @@ static void vmd_remove(struct pci_dev *dev)
  	ida_simple_remove(&vmd_instance_ida, vmd->instance);
  }
 
+static void vmd_shutdown(struct pci_dev *dev)
+{
+        struct vmd_dev *vmd = pci_get_drvdata(dev);
+
+        vmd_remove_irq_domain(vmd);
+}
+
  #ifdef CONFIG_PM_SLEEP
  static int vmd_suspend(struct device *dev)
  {

drivers/pci/controller/vmd.c static struct pci_driver vmd_drv = { · line 1069

Quoted 7 lines
drivers/pci/controller/vmd.c +1 -0
@@ -1056,6 +1063,7 @@ static struct pci_driver vmd_drv = {
  	.id_table	= vmd_ids,
  	.probe		= vmd_probe,
  	.remove		= vmd_remove,
+	.shutdown	= vmd_shutdown,
  	.driver		= {
  		.pm	= &vmd_dev_pm_ops,
  	},

Gentle ping.

Quoted 2 lines

Thanks

LGTM

author maintainer
#3 lore raw
Quoted 47 lines · Jonathan Derrick
Quoted 44 lines · Nirmal
Quoted 33 lines · Nirmal Patel

VMD driver can disable or enable MSI remapping by changing VMCONFIG_MSI_REMAP register. This register needs to be set to the default value during soft reboots. Drives failed to enumerate when Windows boots after performing a soft reboot from Linux. Windows doesn't support MSI remapping disable feature and stale register value hinders Windows VMD driver initialization process. Adding vmd_shutdown function to make sure to set the VMCONFIG register to the default value.

Fixes ee81ee84f873 ("PCI: vmd: Disable MSI-X remapping when possible")

---
  drivers/pci/controller/vmd.c | 8 ++++++++

  1 file changed, 8 insertions(+)
drivers/pci/controller/vmd.c +6 -0
index 769eedeb8802..50a187a29a1d 100644
@@ -979,6 +979,13 @@ static void vmd_remove(struct pci_dev *dev)
       ida_simple_remove(&vmd_instance_ida, vmd->instance);
   }
   +static void vmd_shutdown(struct pci_dev *dev)
+{
+        struct vmd_dev *vmd = pci_get_drvdata(dev);
+
+        vmd_remove_irq_domain(vmd);
+}
+
   #ifdef CONFIG_PM_SLEEP
   static int vmd_suspend(struct device *dev)
   {

drivers/pci/controller/vmd.c static struct pci_driver vmd_drv = { · line 1069

Quoted 7 lines
drivers/pci/controller/vmd.c +1 -0
@@ -1056,6 +1063,7 @@ static struct pci_driver vmd_drv = {
       .id_table    = vmd_ids,
       .probe        = vmd_probe,
       .remove        = vmd_remove,
+    .shutdown    = vmd_shutdown,
       .driver        = {
           .pm    = &vmd_dev_pm_ops,
       },

Gentle ping.

Quoted 5 lines
Quoted 2 lines

Thanks

LGTM

Gentle ping.

Thanks

maintainer Applied
#4 lore raw
In reply to Nirmal Patel
Quoted 10 lines · Nirmal Patel

VMD driver can disable or enable MSI remapping by changing VMCONFIG_MSI_REMAP register. This register needs to be set to the default value during soft reboots. Drives failed to enumerate when Windows boots after performing a soft reboot from Linux. Windows doesn't support MSI remapping disable feature and stale register value hinders Windows VMD driver initialization process. Adding vmd_shutdown function to make sure to set the VMCONFIG register to the default value.

[...]

Applied to controller/vmd, thanks!

[1/1] PCI: vmd: Reset VMD config register between soft reboots

      https://git.kernel.org/pci/pci/c/e06720c1d9e1

Thanks,
Lorenzo