Message ID | 20220923203757.4918-1-francisco.munoz.ruiz@linux.intel.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Lorenzo Pieralisi |
Headers | show |
Series | PCI: vmd: Fix secondary bus reset for Intel bridges | expand |
On 9/23/2022 2:37 PM, francisco.munoz.ruiz@linux.intel.com wrote: > From: Francisco Munoz <francisco.munoz.ruiz@linux.intel.com> > > The reset was never applied in the current implementation because Intel > Bridges owned by VMD are parentless. Internally, the reset API applies > a reset to the parent of the pci device supplied as argument, but in this > case it failed because there wasn't a parent. This change feeds a child > device of an Intel Bridge to the reset API and internally the reset is > applied to its parent. > > Signed-off-by: Francisco Munoz <francisco.munoz.ruiz@linux.intel.com> > Reviewed-by: Nirmal Patel <nirmal.patel@linux.intel.com> Reviewed-by: Jonathan Derrick <jonathan.derrick@linux.dev> > --- > drivers/pci/controller/vmd.c | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > > diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c > index e06e9f4fc50f..34d6ba675440 100644 > --- a/drivers/pci/controller/vmd.c > +++ b/drivers/pci/controller/vmd.c > @@ -859,8 +859,16 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features) > > pci_scan_child_bus(vmd->bus); > vmd_domain_reset(vmd); > - list_for_each_entry(child, &vmd->bus->children, node) > - pci_reset_bus(child->self); > + > + list_for_each_entry(child, &vmd->bus->children, node) { > + if (!list_empty(&child->devices)) { > + pci_reset_bus(list_first_entry(&child->devices, > + struct pci_dev, > + bus_list)); > + break; > + } > + } > + > pci_assign_unassigned_bus_resources(vmd->bus); > > /*
Hi, Please let me know if something else is needed. Thanks, Francisco. On 9/26/2022 2:07 PM, Jonathan Derrick wrote: > > > On 9/23/2022 2:37 PM, francisco.munoz.ruiz@linux.intel.com wrote: >> From: Francisco Munoz <francisco.munoz.ruiz@linux.intel.com> >> >> The reset was never applied in the current implementation because Intel >> Bridges owned by VMD are parentless. Internally, the reset API applies >> a reset to the parent of the pci device supplied as argument, but in this >> case it failed because there wasn't a parent. This change feeds a child >> device of an Intel Bridge to the reset API and internally the reset is >> applied to its parent. >> >> Signed-off-by: Francisco Munoz <francisco.munoz.ruiz@linux.intel.com> >> Reviewed-by: Nirmal Patel <nirmal.patel@linux.intel.com> > Reviewed-by: Jonathan Derrick <jonathan.derrick@linux.dev> > >> --- >> drivers/pci/controller/vmd.c | 12 ++++++++++-- >> 1 file changed, 10 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c >> index e06e9f4fc50f..34d6ba675440 100644 >> --- a/drivers/pci/controller/vmd.c >> +++ b/drivers/pci/controller/vmd.c >> @@ -859,8 +859,16 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features) >> >> pci_scan_child_bus(vmd->bus); >> vmd_domain_reset(vmd); >> - list_for_each_entry(child, &vmd->bus->children, node) >> - pci_reset_bus(child->self); >> + >> + list_for_each_entry(child, &vmd->bus->children, node) { >> + if (!list_empty(&child->devices)) { >> + pci_reset_bus(list_first_entry(&child->devices, >> + struct pci_dev, >> + bus_list)); >> + break; >> + } >> + } >> + >> pci_assign_unassigned_bus_resources(vmd->bus); >> >> /*
On Thu, Oct 06, 2022 at 11:26:08AM -0700, Munoz Ruiz, Francisco wrote: > Hi, > > Please let me know if something else is needed. We're in the merge window now, so it's too late for v6.1, but we'll start merging v6.2 changes about Oct 17. > On 9/26/2022 2:07 PM, Jonathan Derrick wrote: > > On 9/23/2022 2:37 PM, francisco.munoz.ruiz@linux.intel.com wrote: > > > From: Francisco Munoz <francisco.munoz.ruiz@linux.intel.com> > > > > > > The reset was never applied in the current implementation because Intel > > > Bridges owned by VMD are parentless. Internally, the reset API applies > > > a reset to the parent of the pci device supplied as argument, but in this > > > case it failed because there wasn't a parent. This change feeds a child > > > device of an Intel Bridge to the reset API and internally the reset is > > > applied to its parent. > > > > > > Signed-off-by: Francisco Munoz <francisco.munoz.ruiz@linux.intel.com> > > > Reviewed-by: Nirmal Patel <nirmal.patel@linux.intel.com> > > Reviewed-by: Jonathan Derrick <jonathan.derrick@linux.dev> > > > > > --- > > > drivers/pci/controller/vmd.c | 12 ++++++++++-- > > > 1 file changed, 10 insertions(+), 2 deletions(-) > > > > > > diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c > > > index e06e9f4fc50f..34d6ba675440 100644 > > > --- a/drivers/pci/controller/vmd.c > > > +++ b/drivers/pci/controller/vmd.c > > > @@ -859,8 +859,16 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features) > > > pci_scan_child_bus(vmd->bus); > > > vmd_domain_reset(vmd); > > > - list_for_each_entry(child, &vmd->bus->children, node) > > > - pci_reset_bus(child->self); > > > + > > > + list_for_each_entry(child, &vmd->bus->children, node) { > > > + if (!list_empty(&child->devices)) { > > > + pci_reset_bus(list_first_entry(&child->devices, > > > + struct pci_dev, > > > + bus_list)); > > > + break; > > > + } > > > + } > > > + > > > pci_assign_unassigned_bus_resources(vmd->bus); > > > /*
On Fri, Sep 23, 2022 at 01:37:57PM -0700, francisco.munoz.ruiz@linux.intel.com wrote: > From: Francisco Munoz <francisco.munoz.ruiz@linux.intel.com> > > The reset was never applied in the current implementation because Intel > Bridges owned by VMD are parentless. Internally, the reset API applies > a reset to the parent of the pci device supplied as argument, but in this > case it failed because there wasn't a parent. This change feeds a child > device of an Intel Bridge to the reset API and internally the reset is > applied to its parent. What kind of problem does this fix? I guess some devices below a VMD need to be reset before we can use them? As a rule, Linux doesn't reset PCI devices at boot, so I'm just wondering what's different about these. If this fixes a problem, it's also nice if we can include a symptom in the commit log so if people are seeing the problem, they can find the solution, or distros can tell whether they need to include it. > Signed-off-by: Francisco Munoz <francisco.munoz.ruiz@linux.intel.com> > Reviewed-by: Nirmal Patel <nirmal.patel@linux.intel.com> > --- > drivers/pci/controller/vmd.c | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > > diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c > index e06e9f4fc50f..34d6ba675440 100644 > --- a/drivers/pci/controller/vmd.c > +++ b/drivers/pci/controller/vmd.c > @@ -859,8 +859,16 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features) > > pci_scan_child_bus(vmd->bus); > vmd_domain_reset(vmd); > - list_for_each_entry(child, &vmd->bus->children, node) > - pci_reset_bus(child->self); > + > + list_for_each_entry(child, &vmd->bus->children, node) { > + if (!list_empty(&child->devices)) { > + pci_reset_bus(list_first_entry(&child->devices, > + struct pci_dev, > + bus_list)); > + break; > + } > + } > + > pci_assign_unassigned_bus_resources(vmd->bus); > > /* > -- > 2.25.1 >
diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c index e06e9f4fc50f..34d6ba675440 100644 --- a/drivers/pci/controller/vmd.c +++ b/drivers/pci/controller/vmd.c @@ -859,8 +859,16 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features) pci_scan_child_bus(vmd->bus); vmd_domain_reset(vmd); - list_for_each_entry(child, &vmd->bus->children, node) - pci_reset_bus(child->self); + + list_for_each_entry(child, &vmd->bus->children, node) { + if (!list_empty(&child->devices)) { + pci_reset_bus(list_first_entry(&child->devices, + struct pci_dev, + bus_list)); + break; + } + } + pci_assign_unassigned_bus_resources(vmd->bus); /*