Re: [PATCH V3 2/2] PCI: Prevent LS7A Bus Master clearing on kexec

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, Manivannan,

Sorry for the late reply.

On Fri, Jun 13, 2025 at 3:15 PM Manivannan Sadhasivam <mani@xxxxxxxxxx> wrote:
>
> On Sun, May 11, 2025 at 04:34:13PM +0800, Huacai Chen wrote:
> > This is similar to commit 62b6dee1b44a ("PCI/portdrv: Prevent LS7A Bus
> > Master clearing on shutdown"), which prevents LS7A Bus Master clearing
> > on kexec.
> >
>
> So 62b6dee1b44a never worked as intented because the PCI core still cleared bus
> master bit?
Commit 62b6dee1b44a only solved the poweroff/reboot problem, because
in those cases kexec_in_progress is false and pci_clear_master() is
skipped.


>
> > The key point of this is to work around the LS7A defect that clearing
> > PCI_COMMAND_MASTER prevents MMIO requests from going downstream, and
> > we may need to do that even after .shutdown(), e.g., to print console
> > messages. And in this case we rely on .shutdown() for the downstream
> > devices to disable interrupts and DMA.
> >
> > Only skip Bus Master clearing on bridges because endpoint devices still
> > need it.
> >
> > Cc: <stable@xxxxxxxxxxxxxxx>
> > Signed-off-by: Ming Wang <wangming01@xxxxxxxxxxx>
> > Signed-off-by: Huacai Chen <chenhuacai@xxxxxxxxxxx>
> > ---
> >  drivers/pci/pci-driver.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
> > index 602838416e6a..8a1e32367a06 100644
> > --- a/drivers/pci/pci-driver.c
> > +++ b/drivers/pci/pci-driver.c
> > @@ -517,7 +517,7 @@ static void pci_device_shutdown(struct device *dev)
> >        * If it is not a kexec reboot, firmware will hit the PCI
> >        * devices with big hammer and stop their DMA any way.
> >        */
> > -     if (kexec_in_progress && (pci_dev->current_state <= PCI_D3hot))
> > +     if (kexec_in_progress && !pci_is_bridge(pci_dev) && (pci_dev->current_state <= PCI_D3hot))
>
> I'm not a Kexec expert, but wouldn't not clearing the bus mastering for all PCI
> bridges safe? You are making a generic change for a defect in your hardware, so
> it might not apply to all other hardwares.
I think most DMA comes from endpoint devices rather than bridges so
kexec is probably safe. When I solve the problem in commit
62b6dee1b44a I want to make a special case for Loongson but Bjorn
suggests doing a generic change, so I also do a generic change for
kexec.


Huacai

>
> - Mani
>
> --
> மணிவண்ணன் சதாசிவம்





[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux