Commit Graph

72 Commits

Author SHA1 Message Date
Myron Stowe aa818221c0 PCI: vmd: Set devices to D0 before enabling PM L1 Substates
JIRA: https://issues.redhat.com/browse/RHEL-47438
Upstream Status: d66041063192497a4a97d21dbf86b79a03a7f4fb

commit d66041063192497a4a97d21dbf86b79a03a7f4fb
Author: Jian-Hong Pan <jhp@endlessos.org>
Date:   Tue Oct 1 16:34:38 2024 +0800

    PCI: vmd: Set devices to D0 before enabling PM L1 Substates

    The remapped PCIe Root Port and the child device have PM L1 Substates
    capability, but they are disabled originally.

    Here is a failed example on ASUS B1400CEAE:

      Capabilities: [900 v1] L1 PM Substates
            L1SubCap: PCI-PM_L1.2+ PCI-PM_L1.1- ASPM_L1.2+ ASPM_L1.1- L1_PM_Substates+
                      PortCommonModeRestoreTime=32us PortTPowerOnTime=10us
            L1SubCtl1: PCI-PM_L1.2- PCI-PM_L1.1- ASPM_L1.2+ ASPM_L1.1-
                       T_CommonMode=0us LTR1.2_Threshold=101376ns
            L1SubCtl2: T_PwrOn=50us

    Enable PCI-PM L1 PM Substates for devices below VMD while they are in D0
    (see PCIe r6.0, sec 5.5.4).

    Link: https://lore.kernel.org/r/20241001083438.10070-4-jhp@endlessos.org
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=218394
    Signed-off-by: Jian-Hong Pan <jhp@endlessos.org>
    Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2025-03-08 12:08:16 -07:00
Myron Stowe 8633a373d3 PCI: vmd: Add DID 8086:B06F and 8086:B60B for Intel client SKUs
JIRA: https://issues.redhat.com/browse/RHEL-47438
Upstream Status: b727484cace4be22be9321cc0bc9487648ba447b

commit b727484cace4be22be9321cc0bc9487648ba447b
Author: Nirmal Patel <nirmal.patel@linux.ntel.com>
Date:   Fri Oct 11 10:56:57 2024 -0700

    PCI: vmd: Add DID 8086:B06F and 8086:B60B for Intel client SKUs

    Add support for this VMD device which supports the bus restriction mode.
    The feature that turns off vector 0 for MSI-X remapping is also enabled.

    Link: https://lore.kernel.org/r/20241011175657.249948-1-nirmal.patel@linux.intel.com
    Signed-off-by: Nirmal Patel <nirmal.patel@linux.ntel.com>
    Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
    Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2025-03-08 11:45:59 -07:00
Myron Stowe 4f451eea52 PCI: vmd: Fix indentation issue in vmd_shutdown()
JIRA: https://issues.redhat.com/browse/RHEL-67693
Upstream Status: 4654cf52cbd07cb2d6ab6f55bcc5eb2dae8b736a

commit 4654cf52cbd07cb2d6ab6f55bcc5eb2dae8b736a
Author: Riyan Dhiman <riyandhiman14@gmail.com>
Date:   Sun Sep 1 14:56:02 2024 +0530

    PCI: vmd: Fix indentation issue in vmd_shutdown()

    The code in vmd_shutdown() had an indentation issue where spaces were
    used instead of tabs. This commit corrects the indentation to use tabs,
    adhering to the Linux kernel coding style guidelines.

    Issue reported by the checkpatch.pl script:

      ERROR: code indent should use tabs where possible
      #1056: FILE: drivers/pci/controller/vmd.c:1056:
      +        struct vmd_dev *vmd = pci_get_drvdata(dev);$

      WARNING: please, no spaces at the start of a line
      #1056: FILE: drivers/pci/controller/vmd.c:1056:
      +        struct vmd_dev *vmd = pci_get_drvdata(dev);$

      ERROR: code indent should use tabs where possible
      #1058: FILE: drivers/pci/controller/vmd.c:1058:
      +        vmd_remove_irq_domain(vmd);$

      WARNING: please, no spaces at the start of a line
      #1058: FILE: drivers/pci/controller/vmd.c:1058:
      +        vmd_remove_irq_domain(vmd);$

    No functional changes are intended.

    Link: https://lore.kernel.org/linux-pci/20240901092602.17414-1-riyandhiman14@gmail.com
    Signed-off-by: Riyan Dhiman <riyandhiman14@gmail.com>
    [kwilczynski: commit log]
    Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2025-02-18 09:48:10 -07:00
Myron Stowe dce1c5c583 PCI: vmd: Silence 'set affinity failed' warning
JIRA: https://issues.redhat.com/browse/RHEL-67693
Upstream Status: 647e9651a0110fb0ff163ef6bf1318b30f90a08c

commit 647e9651a0110fb0ff163ef6bf1318b30f90a08c
Author: Marek Vasut <marek.vasut+renesas@mailbox.org>
Date:   Tue Jul 23 15:27:12 2024 +0200

    PCI: vmd: Silence 'set affinity failed' warning

    Use MSI_FLAG_NO_AFFINITY, which keeps .irq_set_affinity() unset and allows
    migrate_one_irq() to exit right away, without warnings like this:

      IRQ...: set affinity failed(-22)

    Remove the .irq_set_affinity() implementation that is no longer needed.

    Link: https://lore.kernel.org/r/20240723132958.41320-13-marek.vasut+renesas@mailbox.org
    Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
    [bhelgaas: commit log]
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
    Reviewed-by: Nirmal Patel <nirmal.patel@linux.intel.com>
    Acked-by: Thomas Gleixner <tglx@linutronix.de>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2025-02-18 09:48:09 -07:00
Myron Stowe 807fca8e7a PCI: controller: Add missing MODULE_DESCRIPTION() macros
JIRA: https://issues.redhat.com/browse/RHEL-59033
Upstream Status: 142a41da39d1467b7ff7dad64fc421249d06565d

Conflict(s):
  RHEL does not have the following files, thus their respective patch
  hunk was skipped:
    drivers/pci/controller/pcie-apple.c


commit 142a41da39d1467b7ff7dad64fc421249d06565d
Author: Jeff Johnson <quic_jjohnson@quicinc.com>
Date:   Wed Jun 26 10:07:01 2024 -0700

    PCI: controller: Add missing MODULE_DESCRIPTION() macros

    When ARCH=x86, make allmodconfig && make W=1 C=1 reports:

      WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/pci/controller/dwc/pci-exynos.o
      WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/pci/controller/pci-host-generic.o
      WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/pci/controller/pcie-altera.o
      WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/pci/controller/pcie-altera-msi.o
      WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/pci/controller/pcie-mediatek.o
      WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/pci/controller/pcie-mediatek-gen3.o
      WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/pci/controller/vmd.o
      WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/pci/controller/pcie-apple.o
      WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/pci/controller/pcie-mt7621.o

    Add the missing MODULE_DESCRIPTION() macro.

    [kwilczynski: update MODULE_DESCRIPTION() text, commit log]
    Link: https://lore.kernel.org/linux-pci/20240626-md-drivers-pci-controller-v2-1-94c811db7a51@quicinc.com
    Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com>
    Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
    Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Acked-by: Nirmal Patel <nirmal.patel@linux.intel.com>
    Acked-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> # MT7621

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2024-10-05 10:59:20 -06:00
Myron Stowe 043861a01a PCI: vmd: Create domain symlink before pci_bus_add_devices()
JIRA: https://issues.redhat.com/browse/RHEL-59033
Upstream Status: f24c9bfcd423e2b2bb0d198456412f614ec2030a

commit f24c9bfcd423e2b2bb0d198456412f614ec2030a
Author: Jiwei Sun <sunjw10@lenovo.com>
Date:   Wed Jun 5 20:48:44 2024 +0800

    PCI: vmd: Create domain symlink before pci_bus_add_devices()

    The vmd driver creates a "domain" symlink in sysfs for each VMD bridge.
    Previously this symlink was created after pci_bus_add_devices() added
    devices below the VMD bridge and emitted udev events to announce them to
    userspace.

    This led to a race between userspace consumers of the udev events and the
    kernel creation of the symlink.  One such consumer is mdadm, which
    assembles block devices into a RAID array, and for devices below a VMD
    bridge, mdadm depends on the "domain" symlink.

    If mdadm loses the race, it may be unable to assemble a RAID array, which
    may cause a boot failure or other issues, with complaints like this:

      (udev-worker)[2149]: nvme1n1: '/sbin/mdadm -I /dev/nvme1n1'(err) 'mdadm: Unable to get real path for '/sys/bus/pci/drivers/vmd/0000:c7:00.5/domain/device''
      (udev-worker)[2149]: nvme1n1: '/sbin/mdadm -I /dev/nvme1n1'(err) 'mdadm: /dev/nvme1n1 is not attached to Intel(R) RAID controller.'
      (udev-worker)[2149]: nvme1n1: '/sbin/mdadm -I /dev/nvme1n1'(err) 'mdadm: No OROM/EFI properties for /dev/nvme1n1'
      (udev-worker)[2149]: nvme1n1: '/sbin/mdadm -I /dev/nvme1n1'(err) 'mdadm: no RAID superblock on /dev/nvme1n1.'
      (udev-worker)[2149]: nvme1n1: Process '/sbin/mdadm -I /dev/nvme1n1' failed with exit code 1.

    This symptom prevents the OS from booting successfully.

    After a NVMe disk is probed/added by the nvme driver, udevd invokes mdadm
    to detect if there is a mdraid associated with this NVMe disk, and mdadm
    determines if a NVMe device is connected to a particular VMD domain by
    checking the "domain" symlink. For example:

      Thread A                   Thread B             Thread mdadm
      vmd_enable_domain
        pci_bus_add_devices
          __driver_probe_device
           ...
           work_on_cpu
             schedule_work_on
             : wakeup Thread B
                                 nvme_probe
                                 : wakeup scan_work
                                   to scan nvme disk
                                   and add nvme disk
                                   then wakeup udevd
                                                      : udevd executes
                                                        mdadm command
             flush_work                               main
             : wait for nvme_probe done                ...
          __driver_probe_device                        find_driver_devices
          : probe next nvme device                     : 1) Detect domain symlink
          ...                                            2) Find domain symlink
          ...                                               from vmd sysfs
          ...                                            3) Domain symlink not
          ...                                               created yet; failed
        sysfs_create_link
        : create domain symlink

    Create the VMD "domain" symlink before invoking pci_bus_add_devices() to
    avoid this race.

    Suggested-by: Adrian Huang <ahuang12@lenovo.com>
    Link: https://lore.kernel.org/linux-pci/20240605124844.24293-1-sjiwei@163.com
    Signed-off-by: Jiwei Sun <sunjw10@lenovo.com>
    Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
    [bhelgaas: commit log]
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Reviewed-by: Nirmal Patel <nirmal.patel@linux.intel.com>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2024-10-05 10:59:19 -06:00
Myron Stowe d67611fb1d PCI: vmd: Remove usage of the deprecated ida_simple_xx() API
JIRA: https://issues.redhat.com/browse/RHEL-28627
Upstream Status: 991801bc4722e287035e907a0202954a2ffb2798

commit 991801bc4722e287035e907a0202954a2ffb2798
Author: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Date:   Sun Dec 10 18:50:03 2023 +0100

    PCI: vmd: Remove usage of the deprecated ida_simple_xx() API

    ida_alloc() and ida_free() should be preferred to the deprecated
    ida_simple_get() and ida_simple_remove().

    This is less verbose.

    Link: https://lore.kernel.org/linux-pci/270f25cdc154f3b0309e57b2f6421776752e2170.1702230593.git.christophe.jaillet@wanadoo.fr
    Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
    Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2024-03-30 14:55:37 -06:00
Myron Stowe 249802655a PCI: vmd: Fix potential deadlock when enabling ASPM
JIRA: https://issues.redhat.com/browse/RHEL-26162
Upstream Status: 49de0dc87965079a8e2803ee4b39f9d946259423

commit 49de0dc87965079a8e2803ee4b39f9d946259423
Author: Johan Hovold <johan+linaro@kernel.org>
Date:   Tue Nov 28 09:15:08 2023 +0100

    PCI: vmd: Fix potential deadlock when enabling ASPM

    The vmd_pm_enable_quirk() helper is called from pci_walk_bus() during
    probe to enable ASPM for controllers with VMD_FEAT_BIOS_PM_QUIRK set.

    Since pci_walk_bus() already holds a pci_bus_sem read lock, use
    pci_enable_link_state_locked() to enable link states in order to avoid a
    potential deadlock (e.g. in case someone takes a write lock before
    reacquiring the read lock).

    Fixes: f492edb40b54 ("PCI: vmd: Add quirk to configure PCIe ASPM and LTR")
    Link: https://lore.kernel.org/r/20231128081512.19387-3-johan+linaro@kernel.org
    Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
    [bhelgaas: add "potential" in subject since the deadlock has only been
    reported by lockdep, include helper name in commit log]
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
    Cc: <stable@vger.kernel.org>    # 6.3
    Cc: Michael Bottini <michael.a.bottini@linux.intel.com>
    Cc: David E. Box <david.e.box@linux.intel.com>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2024-02-25 08:39:31 -07:00
Scott Weaver 441c1d05cd Merge: VMD driver updates
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/3497

```
This series updates the Volume Management Device (VMD) driver.

Back-port recent VMD driver updates.  The VMD driver has historically been
laden with issues.  This is an attempt to get the latest fixe(s) in to
circumvent customer issues.  Target fix: upstream commit 5827e17d0555
"PCI: vmd: Correct PCI Header Type Register's multi-function check".

JIRA: https://issues.redhat.com/browse/RHEL-19258
Depends: N/A

Signed-off-by: Myron Stowe <mstowe@redhat.com>

```

Approved-by: John W. Linville <linville@redhat.com>
Approved-by: David Arcari <darcari@redhat.com>

Signed-off-by: Scott Weaver <scweaver@redhat.com>
2024-01-12 13:40:45 -05:00
Myron Stowe 68a56031eb PCI: vmd: Disable bridge window for domain reset
JIRA: https://issues.redhat.com/browse/RHEL-15044
Upstream Status: f73eedc90bf73d48e8368e6b0b4ad76a7fffaef7

commit f73eedc90bf73d48e8368e6b0b4ad76a7fffaef7
Author: Nirmal Patel <nirmal.patel@linux.intel.com>
Date:   Thu Aug 10 17:50:29 2023 -0400

    PCI: vmd: Disable bridge window for domain reset

    During domain reset process vmd_domain_reset() clears PCI
    configuration space of VMD root ports. But certain platform
    has observed following errors and failed to boot.
      ...
      DMAR: VT-d detected Invalidation Queue Error: Reason f
      DMAR: VT-d detected Invalidation Time-out Error: SID ffff
      DMAR: VT-d detected Invalidation Completion Error: SID ffff
      DMAR: QI HEAD: UNKNOWN qw0 = 0x0, qw1 = 0x0
      DMAR: QI PRIOR: UNKNOWN qw0 = 0x0, qw1 = 0x0
      DMAR: Invalidation Time-out Error (ITE) cleared

    The root cause is that memset_io() clears prefetchable memory base/limit
    registers and prefetchable base/limit 32 bits registers sequentially.
    This seems to be enabling prefetchable memory if the device disabled
    prefetchable memory originally.

    Here is an example (before memset_io()):

      PCI configuration space for 10000:00:00.0:
      86 80 30 20 06 00 10 00 04 00 04 06 00 00 01 00
      00 00 00 00 00 00 00 00 00 01 01 00 00 00 00 20
      00 00 00 00 01 00 01 00 ff ff ff ff 75 05 00 00
      ...

    So, prefetchable memory is ffffffff00000000-575000fffff, which is
    disabled. When memset_io() clears prefetchable base 32 bits register,
    the prefetchable memory becomes 0000000000000000-575000fffff, which is
    enabled and incorrect.

    Here is the quote from section 7.5.1.3.9 of PCI Express Base 6.0 spec:

      The Prefetchable Memory Limit register must be programmed to a smaller
      value than the Prefetchable Memory Base register if there is no
      prefetchable memory on the secondary side of the bridge.

    This is believed to be the reason for the failure and in addition the
    sequence of operation in vmd_domain_reset() is not following the PCIe
    specs.

    Disable the bridge window by executing a sequence of operations
    borrowed from pci_disable_bridge_window() and pci_setup_bridge_io(),
    that comply with the PCI specifications.

    Link: https://lore.kernel.org/r/20230810215029.1177379-1-nirmal.patel@linux.intel.com
    Signed-off-by: Nirmal Patel <nirmal.patel@linux.intel.com>
    Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2023-12-15 16:22:27 -07:00
Myron Stowe 66281a206e PCI: Use PCI_HEADER_TYPE_* instead of literals
JIRA: https://issues.redhat.com/browse/RHEL-19258
Upstream Status: 83c088148c8e5c439eec6c7651692f797547e1a8

commit 83c088148c8e5c439eec6c7651692f797547e1a8
Author: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Date:   Tue Oct 3 15:53:00 2023 +0300

    PCI: Use PCI_HEADER_TYPE_* instead of literals

    Replace literals under drivers/pci/ with PCI_HEADER_TYPE_MASK,
    PCI_HEADER_TYPE_NORMAL, and PCI_HEADER_TYPE_MFD.

    Also replace !! boolean conversions with FIELD_GET().

    Link: https://lore.kernel.org/r/20231003125300.5541-4-ilpo.jarvinen@linux.intel.com
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com> # for Renesas R-Car

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2023-12-12 16:16:06 -07:00
Myron Stowe 68ca619132 PCI: vmd: Correct PCI Header Type Register's multi-function check
JIRA: https://issues.redhat.com/browse/RHEL-19258
Upstream Status: 5827e17d0555b566c32044b0632b46f9f95054fa

commit 5827e17d0555b566c32044b0632b46f9f95054fa
Author: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Date:   Tue Oct 3 15:52:58 2023 +0300

    PCI: vmd: Correct PCI Header Type Register's multi-function check

    vmd_domain_reset() attempts to find whether the device may contain multiple
    functions by checking 0x80 (Multi-Function Device), however, the hdr_type
    variable has already been masked with PCI_HEADER_TYPE_MASK so the check can
    never true.

    To fix the issue, don't mask the read with PCI_HEADER_TYPE_MASK.

    Fixes: 6aab5622296b ("PCI: vmd: Clean up domain before enumeration")
    Link: https://lore.kernel.org/r/20231003125300.5541-2-ilpo.jarvinen@linux.intel.com
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Cc: Nirmal Patel <nirmal.patel@linux.intel.com>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2023-12-12 16:16:06 -07:00
Myron Stowe f9d184aaea PCI: vmd: Fix inconsistent indentation in vmd_resume()
JIRA: https://issues.redhat.com/browse/RHEL-19258
Upstream Status: 4c64d708f99378e6719294cc63a77adf8eeb82b4

commit 4c64d708f99378e6719294cc63a77adf8eeb82b4
Author: Xinghui Li <korantli@tencent.com>
Date:   Tue Jun 27 19:38:08 2023 +0800

    PCI: vmd: Fix inconsistent indentation in vmd_resume()

    The if-statement within the vmd_resume() function has an inconsistent
    indentation that leads to a compile time warning.

    Thus, correct the inconsistent indentation.  While at it, remove the
    if-statement completely, which will make the code simpler.

    This was detected by Smatch:

      drivers/pci/controller/vmd.c:1066 vmd_resume() warn: inconsistent indenting

    No functional changes are intended.

    [kwilczynski: use correct tags, commit log]
    Suggested-by: Christoph Hellwig <hch@infradead.org>
    Link: https://lore.kernel.org/linux-pci/20230627113808.269716-1-korantwork@gmail.com
    Reported-by: Dan Carpenter <error27@gmail.com>
    Signed-off-by: Xinghui Li <korantli@tencent.com>
    Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2023-12-12 16:16:06 -07:00
Myron Stowe cdfa9a061f PCI: vmd: Fix uninitialized variable usage in vmd_enable_domain()
JIRA: https://issues.redhat.com/browse/RHEL-2570
Upstream Status: 0c0206dc4f5ba2d18b15e24d2047487d6f73916b

commit 0c0206dc4f5ba2d18b15e24d2047487d6f73916b
Author: Xinghui Li <korantli@tencent.com>
Date:   Thu Apr 20 17:43:31 2023 +0800

    PCI: vmd: Fix uninitialized variable usage in vmd_enable_domain()

    The ret variable in the vmd_enable_domain() function was used
    uninitialized when printing a warning message upon failure of
    the pci_reset_bus() function.

    Thus, fix the issue by assigning ret with the value returned from
    pci_reset_bus() before referencing it in the warning message.

    This was detected by Smatch:

      drivers/pci/controller/vmd.c:931 vmd_enable_domain() error: uninitialized symbol 'ret'.

    [kwilczynski: drop the second patch from the series, add missing reported
    by tag, commit log]
    Fixes: 0a584655ef89 ("PCI: vmd: Fix secondary bus reset for Intel bridges")
    Link: https://lore.kernel.org/all/202305270219.B96IiIfv-lkp@intel.com
    Link: https://lore.kernel.org/linux-pci/20230420094332.1507900-2-korantwork@gmail.com
    Reported-by: kernel test robot <lkp@intel.com>
    Reported-by: Dan Carpenter <error27@gmail.com>
    Signed-off-by: Xinghui Li <korantli@tencent.com>
    Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
    Reviewed-by: Nirmal Patel <nirmal.patel@linux.intel.com>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2023-09-19 09:38:06 -06:00
Myron Stowe 19ca662a07 PCI: vmd: Reset VMD config register between soft reboots
JIRA: https://issues.redhat.com/browse/RHEL-2570
Upstream Status: b61cf04c49c3dfa70a0d6725d3eb40bf9b35cf71

commit b61cf04c49c3dfa70a0d6725d3eb40bf9b35cf71
Author: Nirmal Patel <nirmal.patel@linux.intel.com>
Date:   Fri Feb 24 13:28:11 2023 -0700

    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.

    Link: https://lore.kernel.org/r/20230224202811.644370-1-nirmal.patel@linux.intel.com
    Fixes: ee81ee84f8 ("PCI: vmd: Disable MSI-X remapping when possible")
    Signed-off-by: Nirmal Patel <nirmal.patel@linux.intel.com>
    Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
    Reviewed-by: Jon Derrick <jonathan.derrick@linux.dev>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2023-09-19 09:37:59 -06:00
Myron Stowe be06cc7cc2 PCI: vmd: Add quirk to configure PCIe ASPM and LTR
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2179137
Upstream Status: f492edb40b54862cbd65e6aa5eb39fa40f9949bf

commit f492edb40b54862cbd65e6aa5eb39fa40f9949bf
Author: David E. Box <david.e.box@linux.intel.com>
Date:   Thu Jan 19 19:15:22 2023 -0800

    PCI: vmd: Add quirk to configure PCIe ASPM and LTR

    PCIe ports reserved for VMD use are not visible to BIOS and therefore not
    configured to enable PCIe ASPM or LTR values (which BIOS will configure if
    they are not set). Lack of this programming results in high power
    consumption on laptops as reported in bugzilla.  For affected products use
    pci_enable_link_state to set the allowed link states for devices on the
    root ports. Also set the LTR value to the maximum value needed for the SoC.

    This is a workaround for products from Rocket Lake through Alder Lake.
    Raptor Lake, the latest product at this time, has already implemented LTR
    configuring in BIOS. Future products will move ASPM configuration back to
    BIOS as well.  As this solution is intended for laptops, support is not
    added for hotplug or for devices downstream of a switch on the root port.

    Link: https://bugzilla.kernel.org/show_bug.cgi?id=212355
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=215063
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=213717

    Link: https://lore.kernel.org/r/20230120031522.2304439-5-david.e.box@linux.intel.com
    Signed-off-by: Michael Bottini <michael.a.bottini@linux.intel.com>
    Signed-off-by: David E. Box <david.e.box@linux.intel.com>
    Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
    Reviewed-by: Jon Derrick <jonathan.derrick@linux.dev>
    Reviewed-by: Nirmal Patel <nirmal.patel@linux.intel.com>
    Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2023-03-29 09:01:28 -06:00
Myron Stowe 695a6818ab PCI: vmd: Create feature grouping for client products
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2179137
Upstream Status: 14d2079af64835494fe5c59ed63222d91a38a624

commit 14d2079af64835494fe5c59ed63222d91a38a624
Author: David E. Box <david.e.box@linux.intel.com>
Date:   Thu Jan 19 19:15:21 2023 -0800

    PCI: vmd: Create feature grouping for client products

    Simplify the device ID list by creating a grouping of features shared by
    client products.

    Suggested-by: Jon Derrick <jonathan.derrick@linux.dev>
    Link: https://lore.kernel.org/r/20230120031522.2304439-4-david.e.box@linux.intel.com
    Signed-off-by: David E. Box <david.e.box@linux.intel.com>
    Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
    Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2023-03-29 09:01:28 -06:00
Myron Stowe 6ce79d966a PCI: vmd: Use PCI_VDEVICE in device list
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2179137
Upstream Status: cca0dfecdba3f37c08b7ae99ce07197be84b9281

commit cca0dfecdba3f37c08b7ae99ce07197be84b9281
Author: David E. Box <david.e.box@linux.intel.com>
Date:   Thu Jan 19 19:15:20 2023 -0800

    PCI: vmd: Use PCI_VDEVICE in device list

    Use PCI_VDEVICE to simplify the device table.

    Link: https://lore.kernel.org/r/20230120031522.2304439-3-david.e.box@linux.intel.com
    Signed-off-by: David E. Box <david.e.box@linux.intel.com>
    Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
    Reviewed-by: Jon Derrick <jonathan.derrick@linux.dev>
    Reviewed-by: Nirmal Patel <nirmal.patel@linux.intel.com>
    Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2023-03-29 09:01:28 -06:00
Myron Stowe d9005a8de6 PCI: vmd: Fix secondary bus reset for Intel bridges
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2136299
Upstream Status: https://git.kernel.org/pub/scm/linux/kernel/git/lpieralisi/pci.git/commit/?h=pci/vmd&id=0a584655ef89541dae4d48d2c523b1480ae80284

Note: This patch is in one of Lorenzo's topic branches which is
targeting upstream's v6.2 merge window -
  https://lore.kernel.org/linux-pci/167032357239.59401.2641037185044333102.b4-ty@kernel.org/
  https://git.kernel.org/pub/scm/linux/kernel/git/lpieralisi/pci.git/log/?h=pci/vmd

commit 0a584655ef89541dae4d48d2c523b1480ae80284 (lorenzo/pci/vmd)
Author: Francisco Munoz <francisco.munoz.ruiz@linux.intel.com>
Date:   Mon Dec 5 17:16:37 2022 -0700

    PCI: vmd: Fix secondary bus reset for Intel bridges

    The reset was never applied in the current implementation because Intel
    Bridges owned by VMD are parentless. Internally, pci_reset_bus() 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.

    In more detail, this change allows the VMD driver to enumerate NVMe devices
    in pass-through configurations when guest reboots are performed. There was
    an attempted to fix this, but later we discovered that the code inside
    pci_reset_bus() wasn’t triggering secondary bus resets. Therefore, we
    updated the parameters passed to it, and now NVMe SSDs attached to VMD
    bridges are properly enumerated in VT-d pass-through scenarios.

    Link: https://lore.kernel.org/r/20221206001637.4744-1-francisco.munoz.ruiz@linux.intel.com
    Fixes: 6aab5622296b ("PCI: vmd: Clean up domain before enumeration")
    Signed-off-by: Francisco Munoz <francisco.munoz.ruiz@linux.intel.com>
    Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
    Reviewed-by: Nirmal Patel <nirmal.patel@linux.intel.com>
    Reviewed-by: Jonathan Derrick <jonathan.derrick@linux.dev>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2022-12-07 09:45:35 -07:00
Myron Stowe cf65b61547 PCI: vmd: Disable MSI remapping after suspend
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2136299
Upstream Status: https://git.kernel.org/pub/scm/linux/kernel/git/lpieralisi/pci.git/commit/?h=pci/vmd&id=d899aa668498c07ff217b666ae9712990306e682

Note: This patch is in one of Lorenzo's topic branches which is
targeting upstream's v6.2 merge window -
  https://lore.kernel.org/linux-pci/166816447125.204404.14576437175253719672.b4-ty@kernel.org/
  https://git.kernel.org/pub/scm/linux/kernel/git/lpieralisi/pci.git/log/?h=pci/vmd

commit d899aa668498c07ff217b666ae9712990306e682
Author: Nirmal Patel <nirmal.patel@linux.intel.com>
Date:   Wed Nov 9 07:26:52 2022 -0700

    PCI: vmd: Disable MSI remapping after suspend

    MSI remapping is disabled by VMD driver for Intel's Icelake and
    newer systems in order to improve performance by setting
    VMCONFIG_MSI_REMAP. By design VMCONFIG_MSI_REMAP register is cleared
    by firmware during boot. The same register gets cleared when system
    is put in S3 power state. VMD driver needs to set this register again
    in order to avoid interrupt issues with devices behind VMD if MSI
    remapping was disabled before.

    Link: https://lore.kernel.org/r/20221109142652.450998-1-nirmal.patel@linux.intel.com
    Fixes: ee81ee84f8 ("PCI: vmd: Disable MSI-X remapping when possible")
    Signed-off-by: Nirmal Patel <nirmal.patel@linux.intel.com>
    Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
    Reviewed-by: Francisco Munoz <francisco.munoz.ruiz@linux.intel.com>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2022-12-07 09:45:24 -07:00
Myron Stowe d6b4065e14 PCI: vmd: Add DID 8086:7D0B and 8086:AD0B for Intel MTL SKUs
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2124638
Upstream Status: 57a128acaba023048585233e7dada9972c2a6b4c

commit 57a128acaba023048585233e7dada9972c2a6b4c
Author: Francisco Munoz <francisco.munoz.ruiz@linux.intel.com>
Date:   Tue Jun 28 15:10:23 2022 -0700

    PCI: vmd: Add DID 8086:7D0B and 8086:AD0B for Intel MTL SKUs

    Add support for VMD devices in MTL-H/P/U/S/M with bus restriction mode and
    vector 0 disabled for MSI-X remapping.

    Link: https://lore.kernel.org/r/20220628221023.190547-1-francisco.munoz.ruiz@linux.intel.com
    Signed-off-by: Francisco Munoz <francisco.munoz.ruiz@linux.intel.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Reviewed-by: Nirmal Patel <nirmal.patel@linux.intel.com>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2022-10-02 07:34:11 -06:00
Myron Stowe 988960d2a8 PCI: vmd: Use devm_kasprintf() instead of simple kasprintf()
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2124638
Upstream Status: 46d2398c3bc0afaf736c38ccc87cb0e93aa9f29a

commit 46d2398c3bc0afaf736c38ccc87cb0e93aa9f29a
Author: Subramanian Mohan <subramanian.mohan@intel.com>
Date:   Tue May 31 18:56:17 2022 +0530

    PCI: vmd: Use devm_kasprintf() instead of simple kasprintf()

    Use devm_kasprintf() instead of simple kasprintf() to free allocated memory
    automatically when the device is freed.

    Suggested-by: Srikanth Thokala <srikanth.thokala@intel.com>
    Link: https://lore.kernel.org/r/20220531132617.20517-1-subramanian.mohan@intel.com
    Signed-off-by: Subramanian Mohan <subramanian.mohan@intel.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Acked-by: Nirmal Patel <nirmal.patel@linux.intel.com>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2022-10-02 07:34:09 -06:00
Myron Stowe 0493f283b2 PCI: vmd: Revert 2565e5b69c44 ("PCI: vmd: Do not disable MSI-X remapping if interrupt remapping is enabled by IOMMU.")
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2084146
Upstream Status: https://git.kernel.org/pub/scm/linux/kernel/git/lpieralisi/pci.git/commit/?h=pci/vmd&id=c94f732e8001a860b42aa740b0a178a29907463c

commit c94f732e8001a860b42aa740b0a178a29907463c
Author: Nirmal Patel <nirmal.patel@linux.intel.com>
Date:   11 May 2022 02:57:07 -0700

    PCI: vmd: Revert 2565e5b69c44 ("PCI: vmd: Do not disable MSI-X remapping if interrupt remapping is enabled by IOMMU.")

    The commit 2565e5b69c44 was added as a workaround to keep MSI-X
    remapping enabled if IOMMU enables interrupt remapping. VMD would keep
    running in low performance mode. There is no dependency between MSI-X
    remapping by VMD and interrupt remapping by IOMMU.

    Link: https://lore.kernel.org/r/20220511095707.25403-3-nirmal.patel@linux.intel.com
    Signed-off-by: Nirmal Patel <nirmal.patel@linux.intel.com>
    Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2022-05-21 12:50:46 -06:00
Myron Stowe 50a7a6de34 PCI: vmd: Assign VMD IRQ domain before enumeration
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2084146
Upstream Status: https://git.kernel.org/pub/scm/linux/kernel/git/lpieralisi/pci.git/commit/?h=pci/vmd&id=886e67100b904cb1b106ed1dfa8a60696aff519a

commit 886e67100b904cb1b106ed1dfa8a60696aff519a
Author: Nirmal Patel <nirmal.patel@linux.intel.com>
Date:   Wed, 11 May 2022 02:57:06 -0700

    PCI: vmd: Assign VMD IRQ domain before enumeration

    During the boot process all the PCI devices are assigned default PCI-MSI
    IRQ domain including VMD endpoint devices. If interrupt-remapping is
    enabled by IOMMU, the PCI devices except VMD get new INTEL-IR-MSI IRQ
    domain. And VMD is supposed to create and assign a separate VMD-MSI IRQ
    domain for its child devices in order to support MSI-X remapping
    capabilities.

    Now when MSI-X remapping in VMD is disabled in order to improve
    performance, VMD skips VMD-MSI IRQ domain assignment process to its
    child devices. Thus the devices behind VMD get default PCI-MSI IRQ
    domain instead of INTEL-IR-MSI IRQ domain when VMD creates root bus and
    configures child devices.

    As a result host OS fails to boot and DMAR errors were observed when
    interrupt remapping was enabled on Intel Icelake CPUs. For instance:

      DMAR: DRHD: handling fault status reg 2
      DMAR: [INTR-REMAP] Request device [0xe2:0x00.0] fault index 0xa00 [fault reason 0x25] Blocked a compatibility format interrupt request

    To fix this issue, dev_msi_info struct in dev struct maintains correct
    value of IRQ domain. VMD will use this information to assign proper IRQ
    domain to its child devices when it doesn't create a separate IRQ domain.

    Link: https://lore.kernel.org/r/20220511095707.25403-2-nirmal.patel@linux.intel.com
    Signed-off-by: Nirmal Patel <nirmal.patel@linux.intel.com>
    Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2022-05-21 12:50:34 -06:00
Myron Stowe f68c54da68 PCI: vmd: Prevent recursive locking on interrupt allocation
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2066898
Upstream Status: ba1366f3d039e7c3ca1fc29ed00ce3ed2b8fd32f

commit ba1366f3d039e7c3ca1fc29ed00ce3ed2b8fd32f
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Sun Feb 13 14:54:05 2022 +0100

    PCI: vmd: Prevent recursive locking on interrupt allocation

    Tejas reported the following recursive locking issue:

     swapper/0/1 is trying to acquire lock:
     ffff8881074fd0a0 (&md->mutex){+.+.}-{3:3}, at: msi_get_virq+0x30/0xc0

     but task is already holding lock:
     ffff8881017cd6a0 (&md->mutex){+.+.}-{3:3}, at: __pci_enable_msi_range+0xf2/0x290

     stack backtrace:
      __mutex_lock+0x9d/0x920
      msi_get_virq+0x30/0xc0
      pci_irq_vector+0x26/0x30
      vmd_msi_init+0xcc/0x210
      msi_domain_alloc+0xbf/0x150
      msi_domain_alloc_irqs_descs_locked+0x3e/0xb0
      __pci_enable_msi_range+0x155/0x290
      pci_alloc_irq_vectors_affinity+0xba/0x100
      pcie_port_device_register+0x307/0x550
      pcie_portdrv_probe+0x3c/0xd0
      pci_device_probe+0x95/0x110

    This is caused by the VMD MSI code which does a lookup of the Linux
    interrupt number for an VMD managed MSI[X] vector. The lookup function
    tries to acquire the already held mutex.

    Avoid that by caching the Linux interrupt number at initialization time
    instead of looking it up over and over.

    Fixes: 82ff8e6b78fc ("PCI/MSI: Use msi_get_virq() in pci_get_vector()")
    Reported-by: "Surendrakumar Upadhyay, TejaskumarX" <tejaskumarx.surendrakumar.upadhyay@intel.com>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Tested-by: "Surendrakumar Upadhyay, TejaskumarX" <tejaskumarx.surendrakumar.upadhyay@intel.com>
    Cc: linux-pci@vger.kernel.org
    Link: https://lore.kernel.org/r/87a6euub2a.ffs@tglx

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2022-04-20 11:00:54 -06:00
Myron Stowe 32cd83a0d9 PCI: vmd: Use PCI_POSSIBLE_ERROR() to check config reads
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2066898
Upstream Status: 242f288e82a34b4c10f87e121b0755056675e55d

commit 242f288e82a34b4c10f87e121b0755056675e55d
Author: Naveen Naidu <naveennaidu479@gmail.com>
Date:   Thu Nov 18 19:33:27 2021 +0530

    PCI: vmd: Use PCI_POSSIBLE_ERROR() to check config reads

    When config pci_ops.read() can detect failed PCI transactions, the data
    returned to the CPU is PCI_ERROR_RESPONSE (~0 or 0xffffffff).

    Obviously a successful PCI config read may *also* return that data if a
    config register happens to contain ~0, so it doesn't definitively indicate
    an error unless we know the register cannot contain ~0.

    Use PCI_POSSIBLE_ERROR() to check the response we get when we read data
    from hardware.  This unifies PCI error response checking and makes error
    checks consistent and easier to find.

    Link: https://lore.kernel.org/r/ed01cad87a2e35f3865275b5fb34290817a1ebf8.1637243717.git.naveennaidu479@gmail.com
    Signed-off-by: Naveen Naidu <naveennaidu479@gmail.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Reviewed-by: Jonathan Derrick <jonathan.derrick@linux.dev>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2022-04-20 10:14:06 -06:00
Myron Stowe fec3388df4 PCI: vmd: Add DID 8086:A77F for all Intel Raptor Lake SKU's
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2066898
Upstream Status: 922bfd001d1ac02111ebbe0524aaab6ca7925521

commit 922bfd001d1ac02111ebbe0524aaab6ca7925521
Author: Karthik L Gopalakrishnan <karthik.l.gopalakrishnan@intel.com>
Date:   Fri Dec 17 15:12:11 2021 -0800

    PCI: vmd: Add DID 8086:A77F for all Intel Raptor Lake SKU's

    Add support for this VMD device which supports the bus restriction mode.
    The feature that turns off vector 0 for MSI-X remapping is also enabled.

    Link: https://lore.kernel.org/r/20211217231211.46018-1-francisco.munoz.ruiz@linux.intel.com
    Signed-off-by: Karthik L Gopalakrishnan <karthik.l.gopalakrishnan@intel.com>
    Signed-off-by: Francisco Munoz <francisco.munoz.ruiz@linux.intel.com>
    Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
    Reviewed-by: Jon Derrick <jonathan.derrick@linux.dev>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2022-04-20 10:14:01 -06:00
Myron Stowe a908574e05 PCI: vmd: Honor ACPI _OSC on PCIe features
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2066898
Upstream Status: 04b12ef163d10e348db664900ae7f611b83c7a0e

commit 04b12ef163d10e348db664900ae7f611b83c7a0e
Author: Kai-Heng Feng <kai.heng.feng@canonical.com>
Date:   Fri Dec 3 11:15:41 2021 +0800

    PCI: vmd: Honor ACPI _OSC on PCIe features

    When Samsung PCIe Gen4 NVMe is connected to Intel ADL VMD, the
    combination causes AER message flood and drags the system performance
    down.

    The issue doesn't happen when VMD mode is disabled in BIOS, since AER
    isn't enabled by acpi_pci_root_create() . When VMD mode is enabled, AER
    is enabled regardless of _OSC:
    [    0.410076] acpi PNP0A08:00: _OSC: platform does not support [AER]
    ...
    [    1.486704] pcieport 10000:e0:06.0: AER: enabled with IRQ 146

    Since VMD is an aperture to regular PCIe root ports, honor ACPI _OSC to
    disable PCIe features accordingly to resolve the issue.

    Suggested-by: Rafael J. Wysocki <rafael@kernel.org>
    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=215027
    Link: https://lore.kernel.org/r/20211203031541.1428904-1-kai.heng.feng@canonical.com
    Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
    Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
    Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2022-04-20 10:14:01 -06:00
Myron Stowe 39ab11ac49 PCI: vmd: Clean up domain before enumeration
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2066898
Upstream Status: 6aab5622296b990024ee67dd7efa7d143e7558d0

commit 6aab5622296b990024ee67dd7efa7d143e7558d0
Author: Nirmal Patel <nirmal.patel@linux.intel.com>
Date:   Tue Nov 16 15:11:36 2021 -0700

    PCI: vmd: Clean up domain before enumeration

    During VT-d pass-through, the VMD driver occasionally fails to
    enumerate underlying NVMe devices when repetitive reboots are
    performed in the guest OS. The issue can be resolved by resetting
    VMD root ports for proper enumeration and triggering secondary bus
    reset which will also propagate reset through downstream bridges.

    Link: https://lore.kernel.org/r/20211116221136.85134-1-nirmal.patel@linux.intel.com
    Signed-off-by: Nirmal Patel <nirmal.patel@linux.intel.com>
    Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
    Reviewed-by: Jon Derrick <jonathan.derrick@linux.dev>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2022-04-20 10:14:00 -06:00
Myron Stowe dc430220ac PCI: vmd: Drop redundant includes of <asm/device.h>, <asm/msi.h>
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2052155
Upstream Status: ca25c63779ca966ff3dd4ea20af1401452dbbe75

commit ca25c63779ca966ff3dd4ea20af1401452dbbe75
Author: Krzysztof Wilczyński <kw@linux.com>
Date:   Wed Oct 13 00:31:44 2021 +0000

    PCI: vmd: Drop redundant includes of <asm/device.h>, <asm/msi.h>

    We already include <linux/device.h> and <linux/msi.h>, which
    include <asm/device.h> and <asm/msi.h>.

    Drop the redundant includes of <asm/device.h> and <asm/msi.h>.

    [bhelgaas: squash in fix from Wan Jiabing <wanjiabing@vivo.com>:
    https://lore.kernel.org/r/20211104063720.29375-1-wanjiabing@vivo.com]
    Link: https://lore.kernel.org/r/20211013003145.1107148-1-kw@linux.com
    Signed-off-by: Krzysztof Wilczyński <kw@linux.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Reviewed-by: Jonathan Derrick <jonathan.derrick@linux.dev>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2022-04-12 08:42:38 -06:00
Myron Stowe 91b616056e PCI: vmd: Do not disable MSI-X remapping if interrupt remapping is enabled by IOMMU
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1994932
Upstream Status: 2565e5b69c44b4e42469afea3cc5a97e74d1ed45

commit 2565e5b69c44b4e42469afea3cc5a97e74d1ed45
Author: Adrian Huang <ahuang12@lenovo.com>
Date:   Wed Sep 1 20:40:47 2021 +0800

    PCI: vmd: Do not disable MSI-X remapping if interrupt remapping is enabled by IOMMU

    When enabling VMD in BIOS setup (Ice Lake Processor: Whitley platform),
    the host OS cannot boot successfully with the following error message:

      nvme nvme0: I/O 12 QID 0 timeout, completion polled
      nvme nvme0: Shutdown timeout set to 6 seconds
      DMAR: DRHD: handling fault status reg 2
      DMAR: [INTR-REMAP] Request device [0x00:0x00.5] fault index 0xa00 [fault reason 0x25] Blocked a compatibility format interrupt request

    The request device is the VMD controller:
      # lspci -s 0000:00.5 -nn
      0000:00:00.5 RAID bus controller [0104]: Intel Corporation Volume
      Management Device NVMe RAID Controller [8086:28c0] (rev 04)

    `git bisect` points to this offending commit ee81ee84f8 ("PCI:
    vmd: Disable MSI-X remapping when possible"), which disables VMD MSI
    remapping. The IOMMU hardware blocks the compatibility format
    interrupt request because Interrupt Remapping Enable Status (IRES) and
    Extended Interrupt Mode Enable (EIME) are enabled. Please refer to
    section "5.1.4 Interrupt-Remapping Hardware Operation" in Intel VT-d
    spec.

    To fix the issue, VMD driver still enables the interrupt remapping
    irrespective of VMD_FEAT_CAN_BYPASS_MSI_REMAP if the IOMMU subsystem
    enables the interrupt remapping.

    Test configuration is shown as follows:
      * Two VMD controllers
        1. 8086:28c0 (Whitley's VMD)
        2. 8086:201d (Purley's VMD: The issue does not appear in this
           controller. Just make sure if any side effect occurs.)
      * w/wo intremap=off

    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=214219
    Link: https://lore.kernel.org/r/20210901124047.1615-1-adrianhuang0701@gmail.com
    Signed-off-by: Adrian Huang <ahuang12@lenovo.com>
    Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
    Reviewed-by: Jon Derrick <jonathan.derrick@intel.com>
    Cc: Jon Derrick <jonathan.derrick@intel.com>
    Cc: Nirmal Patel <nirmal.patel@linux.intel.com>
    Cc: Joerg Roedel <jroedel@suse.de>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2021-11-12 07:15:42 -07:00
Myron Stowe da943c136b PCI: vmd: Assign a number to each VMD controller
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1994932
Upstream Status: 42da7911b83a462373c2d093a587d052f02211b0

commit 42da7911b83a462373c2d093a587d052f02211b0
Author: Chunguang Xu <brookxu@tencent.com>
Date:   Fri Sep 17 21:13:24 2021 +0800

    PCI: vmd: Assign a number to each VMD controller

    If the system has multiple VMD controllers, the driver does not assign
    a number to each controller, so when analyzing the interrupt through
    /proc/interrupts, the names of all controllers are the same, which is
    not very convenient for problem analysis. Here, try to assign a number
    to each VMD controller.

    Link: https://lore.kernel.org/r/1631884404-24141-1-git-send-email-brookxu.cn@gmail.com
    Signed-off-by: Chunguang Xu <brookxu@tencent.com>
    Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
    Reviewed-by: Jon Derrick <jonathan.derrick@intel.com>
    Reviewed-by: Krzysztof Wilczyński <kw@linux.com>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2021-11-12 07:15:23 -07:00
Myron Stowe f5ea0de01a PCI: VMD: ACPI: Make ACPI companion lookup work for VMD bus
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1994932
Upstream Status: 59dc33252ee777e02332774fbdf3381b1d5d5f5d

commit 59dc33252ee777e02332774fbdf3381b1d5d5f5d
Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Date:   Tue Aug 24 16:43:55 2021 +0200

    PCI: VMD: ACPI: Make ACPI companion lookup work for VMD bus

    On some systems, in order to get to the deepest low-power state of
    the platform (which may be necessary to save significant enough
    amounts of energy while suspended to idle. for example), devices on
    the PCI bus exposed by the VMD driver need to be power-managed via
    ACPI.  However, the layout of the ACPI namespace below the VMD
    controller device object does not reflect the layout of the PCI bus
    under the VMD host bridge, so in order to identify the ACPI companion
    objects for the devices on that bus, it is necessary to use a special
    _ADR encoding on the ACPI side.  In other words, acpi_pci_find_companion()
    does not work for these devices, so it needs to be amended with a
    special lookup logic specific to the VMD bus.

    Address this issue by allowing the VMD driver to temporarily install
    an ACPI companion lookup hook containing the code matching the devices
    on the VMD PCI bus with the corresponding objects in the ACPI
    namespace.

    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Acked-by: Jon Derrick <jonathan.derrick@intel.com>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2021-11-10 14:38:34 -07:00
Jon Derrick ee81ee84f8 PCI: vmd: Disable MSI-X remapping when possible
VMD will retransmit child device MSI-X using its own MSI-X table and
requester-id. This limits the number of MSI-X available to the whole
child device domain to the number of VMD MSI-X interrupts.

Some VMD devices have a mode where this remapping can be disabled,
allowing child device interrupts to bypass processing with the VMD MSI-X
domain interrupt handler and going straight the child device interrupt
handler, allowing for better performance and scaling. The requester-id
still gets changed to the VMD endpoint's requester-id, and the interrupt
remapping handlers have been updated to properly set IRTE for child
device interrupts to the VMD endpoint's context.

Some VMD platforms have existing production BIOS which rely on MSI-X
remapping and won't explicitly program the MSI-X remapping bit. This
re-enables MSI-X remapping on unload.

Link: https://lore.kernel.org/r/20210210161315.316097-3-jonathan.derrick@intel.com
Signed-off-by: Jon Derrick <jonathan.derrick@intel.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reviewed-by: Krzysztof Wilczyński <kw@linux.com>
Acked-by: Joerg Roedel <jroedel@suse.de>
2021-03-22 14:08:20 +00:00
Linus Torvalds 489e9fea66 pci-v5.11-changes
-----BEGIN PGP SIGNATURE-----
 
 iQJIBAABCgAyFiEEgMe7l+5h9hnxdsnuWYigwDrT+vwFAl/ZJwsUHGJoZWxnYWFz
 QGdvb2dsZS5jb20ACgkQWYigwDrT+vyGGQ//UhNBwb061zUaLWvaDy2RY67tGsED
 kSNucKqrtaJtWaZDL3fmi8e15lwc4J/xWd96X0sd0udddrVto3WBjYd+CfbfhW8M
 rQufCGlaj+VAZEzrwwbo1cTHXGH3g57BZbVlebCxJJ3mycIv716N4bdo0jz5vf9J
 /PotN6yr5bCMWfO9320cmdaFDO2PK5o+AcRxUtkmFD854yJRZvmlxczFhj33pBB1
 LLQlbi+Hr367WpK2uT2E36Z3POXwUqWOxSAs3Q4ql57/3UY1THZPIn5TmgXGqo7F
 Dr3TRlScWxftssFSAmGZat7lBEaDBh9UnHPAsic0cjlUg6+PE7O+2iLZ7XrtPokL
 Z8LVhdVlwLTNTfonsBSlMGFZJjh/zO9u1QtKYQjFhE5tUU3DUDaJz/pdcyjgaGQ1
 RJNMlsHgdg89v7IJeyote+IfIpQs9YcyDxvXbXW8EFf8ft6KprTj1YNcsjRpgmwN
 xhvTX40oDV9HwF3UUzO6xCdvmhmgD0n4m9cRR4kH+KtiImkZJ4tMh50AQnIs2wag
 I1N2XRld7dqVGWLu4TYkmzxVgjJ9n8ylIRpHy9aMAR9TN+Q/ovLYxJvQkR4NYvxX
 hft3YLgpF1ZKlyflvHmmKszLqdlPX5e56UQl3/VSRD3IQGe1+HzWOhrssWkPnNSc
 0P8b7YpJU4WnVzQ=
 =xRTv
 -----END PGP SIGNATURE-----

Merge tag 'pci-v5.11-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci

Pull PCI updates from Bjorn Helgaas:
 "Enumeration:
   - Decode PCIe 64 GT/s link speed (Gustavo Pimentel)
   - Remove unused HAVE_PCI_SET_MWI (Heiner Kallweit)
   - Reduce pci_set_cacheline_size() message to debug level (Heiner
     Kallweit)
   - Fix pci_slot_release() NULL pointer dereference (Jubin Zhong)
   - Unify ECAM constants in native PCI Express drivers (Krzysztof
     Wilczyński)
   - Return u8 from pci_find_capability() and similar (Puranjay Mohan)
   - Return u16 from pci_find_ext_capability() and similar (Bjorn
     Helgaas)
   - Fix ACPI companion lookup for device 0 on the root bus (Rafael J.
     Wysocki)

  Resource management:
   - Keep both device and resource name for config space remaps
     (Alexander Lobakin)
   - Bounds-check command-line resource alignment requests (Bjorn
     Helgaas)
   - Fix overflow in command-line resource alignment requests (Colin Ian
     King)

  Driver binding:
   - Avoid duplicate IDs in driver dynamic IDs list (Zhenzhong Duan)

  Power management:
   - Save/restore Precision Time Measurement Capability for
     suspend/resume (David E. Box)
   - Disable PTM during suspend to save power (David E. Box)
   - Add sysfs attribute for device power state (Maximilian Luz)
   - Rename pci_wakeup_bus() to pci_resume_bus() (Mika Westerberg)
   - Do not generate wakeup event when runtime resuming device (Mika
     Westerberg)
   - Save/restore ASPM L1SS Capability for suspend/resume (Vidya Sagar)

  Virtualization:
   - Mark AMD Raven iGPU ATS as broken in some platforms (Alex Deucher)
   - Add function 1 DMA alias quirk for Marvell 9215 SATA controller
     (Bjorn Helgaas)

  MSI:
   - Disable MSI for Pericom PCIe-USB adapter (Andy Shevchenko)
   - Improve warnings for 32-bit-limited MSI support (Vidya Sagar)

  Error handling:
   - Cache RCEC EA Capability offset in pci_init_capabilities() (Sean V
     Kelley)
   - Rename reset_link() to reset_subordinates() (Sean V Kelley)
   - Write AER Capability only when we control it (Sean V Kelley)
   - Clear AER status only when we control AER (Sean V Kelley)
   - Bind RCEC devices to the Root Port driver (Qiuxu Zhuo)
   - Recover from RCiEP AER errors (Qiuxu Zhuo)
   - Recover from RCEC AER errors (Sean V Kelley)
   - Add pcie_link_rcec() to associate RCiEPs (Sean V Kelley)
   - Add pcie_walk_rcec() to RCEC AER handling (Sean V Kelley)
   - Add pcie_walk_rcec() to RCEC PME handling (Sean V Kelley)
   - Add RCEC AER error injection support (Qiuxu Zhuo)

  Broadcom iProc PCIe controller driver:
   - Fix out-of-bound array accesses (Bharat Gooty)
   - Invalidate correct PAXB inbound windows (Roman Bacik)
   - Enhance PCIe Link information display (Srinath Mannam)

  Cadence PCIe controller driver:
   - Make "cdns,max-outbound-regions" property optional (Kishon Vijay
     Abraham I)

  Intel VMD host bridge driver:
   - Offset client MSI-X vectors (Jon Derrick)
   - Update type of __iomem pointers (Krzysztof Wilczyński)

  NVIDIA Tegra PCIe controller driver:
   - Move "dbi" accesses to post common DWC initialization (Vidya Sagar)
   - Read "dbi" base address to program in application logic (Vidya
     Sagar)
   - Fix ASPM-L1SS advertisement disable code (Vidya Sagar)
   - Set DesignWare IP version (Vidya Sagar)
   - Continue unconfig sequence even if parts fail (Vidya Sagar)
   - Check return value of tegra_pcie_init_controller() (Vidya Sagar)
   - Disable LTSSM during L2 entry (Vidya Sagar)

  Qualcomm PCIe controller driver:
   - Document PCIe bindings for SM8250 SoC (Manivannan Sadhasivam)
   - Add SM8250 SoC support (Manivannan Sadhasivam)
   - Add support for configuring BDF to SID mapping for SM8250
     (Manivannan Sadhasivam)

  Renesas R-Car PCIe controller driver:
   - rcar: Drop unused members from struct rcar_pcie_host (Lad
     Prabhakar)
   - PCI: rcar-pci-host: Document r8a774e1 bindings (Lad Prabhakar)
   - PCI: rcar-pci-host: Convert bindings to json-schema (Yoshihiro
     Shimoda)
   - PCI: rcar-pci-host: Document r8a77965 bindings (Yoshihiro Shimoda)

  Samsung Exynos PCIe controller driver:
   - Rework driver to support Exynos5433 PCIe PHY (Jaehoon Chung)
   - Rework driver to support Exynos5433 variant (Jaehoon Chung)
   - Drop samsung,exynos5440-pcie binding (Marek Szyprowski)
   - Add the samsung,exynos-pcie binding (Marek Szyprowski)
   - Add the samsung,exynos-pcie-phy binding (Marek Szyprowski)

  Synopsys DesignWare PCIe controller driver:
   - Support multiple ATU memory regions (Rob Herring)
   - Move intel-gw ATU offset out of driver match data (Rob Herring)
   - Move "dbi", "dbi2", and "addr_space" resource setup into common
     code (Rob Herring)
   - Remove intel-gw unneeded function wrappers (Rob Herring)
   - Ensure all outbound ATU windows are reset (Rob Herring)
   - Use the common MSI irq_chip in dra7xx (Rob Herring)
   - Drop the .set_num_vectors() host op (Rob Herring)
   - Move MSI interrupt setup into DWC common code (Rob Herring)
   - Rework MSI initialization (Rob Herring)
   - Move link handling into common code (Rob Herring)
   - Move dw_pcie_msi_init() into core (Rob Herring)
   - Move dw_pcie_setup_rc() to DWC common code (Rob Herring)
   - Remove unnecessary wrappers around dw_pcie_host_init() (Rob
     Herring)
   - Drop keystone duplicated 'num-viewport'" (Rob Herring)
   - Move inbound and outbound windows to common struct (Rob Herring)
   - Detect number of iATU windows (Rob Herring)
   - Warn if non-prefetchable memory aperture size is > 32-bit (Vidya
     Sagar)
   - Add support to program ATU for >4GB memory (Vidya Sagar)
   - Set 32-bit DMA mask for MSI target address allocation (Vidya Sagar)

  TI J721E PCIe driver:
   - Fix "ti,syscon-pcie-ctrl" to take argument (Kishon Vijay Abraham I)
   - Add host mode dt-bindings for TI's J7200 SoC (Kishon Vijay Abraham
     I)
   - Add EP mode dt-bindings for TI's J7200 SoC (Kishon Vijay Abraham I)
   - Get offset within "syscon" from "ti,syscon-pcie-ctrl" phandle arg
     (Kishon Vijay Abraham I)

  TI Keystone PCIe controller driver:
   - Enable compile-testing on !ARM (Alex Dewar)"

* tag 'pci-v5.11-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (100 commits)
  PCI: Add function 1 DMA alias quirk for Marvell 9215 SATA controller
  PCI/ACPI: Fix companion lookup for device 0 on the root bus
  PCI: Keep both device and resource name for config space remaps
  PCI: xgene: Removed unused ".bus_shift" initialisers from pci-xgene.c
  PCI: vmd: Update type of the __iomem pointers
  PCI: iproc: Convert to use the new ECAM constants
  PCI: thunder-pem: Add constant for custom ".bus_shift" initialiser
  PCI: Unify ECAM constants in native PCI Express drivers
  PCI: Disable PTM during suspend to save power
  PCI/PTM: Save/restore Precision Time Measurement Capability for suspend/resume
  PCI: Mark AMD Raven iGPU ATS as broken in some platforms
  PCI: j721e: Get offset within "syscon" from "ti,syscon-pcie-ctrl" phandle arg
  dt-bindings: PCI: Add EP mode dt-bindings for TI's J7200 SoC
  dt-bindings: PCI: Add host mode dt-bindings for TI's J7200 SoC
  dt-bindings: pci: ti,j721e: Fix "ti,syscon-pcie-ctrl" to take argument
  PCI: dwc: Set 32-bit DMA mask for MSI target address allocation
  PCI: qcom: Add support for configuring BDF to SID mapping for SM8250
  PCI: Reduce pci_set_cacheline_size() message to debug level
  PCI: Remove unused HAVE_PCI_SET_MWI
  PCI: qcom: Add SM8250 SoC support
  ...
2020-12-15 16:49:59 -08:00
Bjorn Helgaas f7ce683876 Merge branch 'remotes/lorenzo/pci/vmd'
- Offset client VMD MSI-X vectors (Jon Derrick)

* remotes/lorenzo/pci/vmd:
  PCI: vmd: Offset Client VMD MSI-X vectors
2020-12-15 15:11:13 -06:00
Krzysztof Wilczyński ce0602990f PCI: vmd: Update type of the __iomem pointers
Use "void __iomem" instead "char __iomem" pointer type when working with
the accessor functions (with names like readb() or writel(), etc.) to
better match a given accessor function signature where commonly the address
pointing to an I/O memory region would be a "void __iomem" pointer.

Related: https://lwn.net/Articles/102232/

Suggested-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://lore.kernel.org/r/20201129230743.3006978-5-kw@linux.com
Signed-off-by: Krzysztof Wilczyński <kw@linux.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Jon Derrick <jonathan.derrick@intel.com>
2020-12-10 14:56:08 -06:00
Krzysztof Wilczyński e7708f5b10 PCI: Unify ECAM constants in native PCI Express drivers
Add ECAM-related constants to provide a set of standard constants
defining memory address shift values to the byte-level address that can
be used to access the PCI Express Configuration Space, and then move
native PCI Express controller drivers to use the newly introduced
definitions retiring driver-specific ones.

Refactor pci_ecam_map_bus() function to use newly added constants so
that limits to the bus, device function and offset (now limited to 4K as
per the specification) are in place to prevent the defective or
malicious caller from supplying incorrect configuration offset and thus
targeting the wrong device when accessing extended configuration space.

This refactor also allows for the ".bus_shift" initialisers to be
dropped when the user is not using a custom value as a default value
will be used as per the PCI Express Specification.

Thanks to Qian Cai <qcai@redhat.com>, Michael Walle <michael@walle.cc>,
and Vladimir Oltean <olteanv@gmail.com> for reporting a pci_ecam_create()
issue with .bus_shift and to Vladimir for proposing the fix.

[bhelgaas: incorporate Vladimir's fix, update commit log]
Suggested-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://lore.kernel.org/r/20201129230743.3006978-2-kw@linux.com
Tested-by: Michael Walle <michael@walle.cc>
Signed-off-by: Krzysztof Wilczyński <kw@linux.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Jon Derrick <jonathan.derrick@intel.com>
Reviewed-by: Bjorn Helgaas <bhelgaas@google.com>
2020-12-10 14:55:49 -06:00
Jon Derrick f6b7bb847c PCI: vmd: Offset Client VMD MSI-X vectors
Client VMD platforms have a software-triggered MSI-X vector 0 that will
not forward hardware-remapped MSI from the sub-device domain. This
causes an issue with VMD platforms that use AHCI behind VMD and have a
single MSI-X vector remapped to VMD vector 0. Add a VMD MSI-X vector
offset for these platforms.

Link: https://lore.kernel.org/r/20201102222223.92978-1-jonathan.derrick@intel.com
Tested-by: Jian-Hong Pan <jhp@endlessos.org>
Signed-off-by: Jon Derrick <jonathan.derrick@intel.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
2020-11-23 09:43:01 +00:00
Thomas Gleixner e16c8058a1 PCI: vmd: Use msi_msg shadow structs
Use the x86 shadow structs in msi_msg instead of the macros.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20201024213535.443185-16-dwmw2@infradead.org
2020-10-28 20:26:26 +01:00
Linus Torvalds 00937f36b0 pci-v5.10-changes
-----BEGIN PGP SIGNATURE-----
 
 iQJIBAABCgAyFiEEgMe7l+5h9hnxdsnuWYigwDrT+vwFAl+QUFkUHGJoZWxnYWFz
 QGdvb2dsZS5jb20ACgkQWYigwDrT+vw6SQ/9FHiAlHIa48/l5ZweqAuN3XnU8hoO
 sqMoJE8eqTkIYIT0aQdW6b1sDB0YE6b4UVxzg+UL/E0qYeJqgIUakig7QkyyF1qU
 aT5hq2ic+lk88G7AAxK3kgQGPk+JvP1EFIyOu6HBWzzDDzgLme1Iuh/5ulc2/lo+
 E4biy0WOnI8vMfCieXGK4bSpc17Rn0+3N4cuVwZXBlntsvicE90VqeWBzqti1sk5
 R6gkZuW+EIUNHHL7TLlkCeYZq6QNbXWzhfKCiaGW2wW4eJ4Ek1/ncQjyTbCFytKU
 7OIYvrH20XO3L5GEfJ5fdbWErI1dRpoHO4NmhWljyBcVh44VYnM2ixhA7TuJ+TOk
 OtMbtoJAlP+QDlVdAW6rmRYmMPLFK/AQl5Aq7ftY22b2rYXqP20BobPy2MpDT71T
 sGC8z0ABl/ijo23g3I+3/2VzP/RzGhZJ0ZqagrXj8jHtg8SVy2fLcR5nr/dlrgFk
 TG83zML6ui1KViyx5nzElaEtw18aTqP61CNQxijQtNoYwKBTtRKNTrdRr4Qo7Hi6
 6S+No3+4z8Kf8d90y0LkJQqr7JRkG6nI3AhXHO3rxXpXJOD2+QzlpwBZTQnASqq7
 3kC1doUPmN97rFUYPQWWyOs6xSMcGbGIz8Uus3shH6yDtNxgpnIVoctH55hTEh6w
 nSY/4ssIfzJxZCE=
 =RCFo
 -----END PGP SIGNATURE-----

Merge tag 'pci-v5.10-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci

Pull PCI updates from Bjorn Helgaas:
 "Enumeration:
   - Print IRQ number used by PCIe Link Bandwidth Notification (Dongdong
     Liu)
   - Add schedule point in pci_read_config() to reduce max latency
     (Jiang Biao)
   - Add Kconfig options for MPS/MRRS strategy (Jim Quinlan)

  Resource management:
   - Fix pci_iounmap() memory leak when !CONFIG_GENERIC_IOMAP (Lorenzo
     Pieralisi)

  PCIe native device hotplug:
   - Reduce noisiness on hot removal (Lukas Wunner)

  Power management:
   - Revert "PCI/PM: Apply D2 delay as milliseconds, not microseconds"
     that was done on the basis of spec typo (Bjorn Helgaas)
   - Rename pci_dev.d3_delay to d3hot_delay to remove D3hot/D3cold
     ambiguity (Krzysztof Wilczyński)
   - Remove unused pcibios_pm_ops (Vaibhav Gupta)

  IOMMU:
   - Enable Translation Blocking for external devices to harden against
     DMA attacks (Rajat Jain)

  Error handling:
   - Add an ACPI APEI notifier chain for vendor CPER records to enable
     device-specific error handling (Shiju Jose)

  ASPM:
   - Remove struct aspm_register_info to simplify code (Saheed O.
     Bolarinwa)

  Amlogic Meson PCIe controller driver:
   - Build as module by default (Kevin Hilman)

  Ampere Altra PCIe controller driver:
   - Add MCFG quirk to work around non-standard ECAM implementation
     (Tuan Phan)

  Broadcom iProc PCIe controller driver:
   - Set affinity mask on MSI interrupts (Mark Tomlinson)

  Broadcom STB PCIe controller driver:
   - Make PCIE_BRCMSTB depend on ARCH_BRCMSTB (Jim Quinlan)
   - Add DT bindings for more Brcmstb chips (Jim Quinlan)
   - Add bcm7278 register info (Jim Quinlan)
   - Add bcm7278 PERST# support (Jim Quinlan)
   - Add suspend and resume pm_ops (Jim Quinlan)
   - Add control of rescal reset (Jim Quinlan)
   - Set additional internal memory DMA viewport sizes (Jim Quinlan)
   - Accommodate MSI for older chips (Jim Quinlan)
   - Set bus max burst size by chip type (Jim Quinlan)
   - Add support for bcm7211, bcm7216, bcm7445, bcm7278 (Jim Quinlan)

  Freescale i.MX6 PCIe controller driver:
   - Use dev_err_probe() to reduce redundant messages (Anson Huang)

  Freescale Layerscape PCIe controller driver:
   - Enforce 4K DMA buffer alignment in endpoint test (Hou Zhiqiang)
   - Add DT compatible strings for ls1088a, ls2088a (Xiaowei Bao)
   - Add endpoint support for ls1088a, ls2088a (Xiaowei Bao)
   - Add endpoint test support for lS1088a (Xiaowei Bao)
   - Add MSI-X support for ls1088a (Xiaowei Bao)

  HiSilicon HIP PCIe controller driver:
   - Handle HIP-specific errors via ACPI APEI (Yicong Yang)

  HiSilicon Kirin PCIe controller driver:
   - Return -EPROBE_DEFER if the GPIO isn't ready (Bean Huo)

  Intel VMD host bridge driver:
   - Factor out physical offset, bus offset, IRQ domain, IRQ allocation
     (Jon Derrick)
   - Use generic PCI PM correctly (Jon Derrick)

  Marvell Aardvark PCIe controller driver:
   - Fix compilation on s390 (Pali Rohár)
   - Implement driver 'remove' function and allow to build it as module
     (Pali Rohár)
   - Move PCIe reset card code to advk_pcie_train_link() (Pali Rohár)
   - Convert mvebu a3700 internal SMCC firmware return codes to errno
     (Pali Rohár)
   - Fix initialization with old Marvell's Arm Trusted Firmware (Pali
     Rohár)

  Microsoft Hyper-V host bridge driver:
   - Fix hibernation in case interrupts are not re-created (Dexuan Cui)

  NVIDIA Tegra PCIe controller driver:
   - Stop checking return value of debugfs_create() functions (Greg
     Kroah-Hartman)
   - Convert to use DEFINE_SEQ_ATTRIBUTE macro (Liu Shixin)

  Qualcomm PCIe controller driver:
   - Reset PCIe to work around Qsdk U-Boot issue (Ansuel Smith)

  Renesas R-Car PCIe controller driver:
   - Add DT documentation for r8a774a1, r8a774b1, r8a774e1 endpoints
     (Lad Prabhakar)
   - Add RZ/G2M, RZ/G2N, RZ/G2H IDs to endpoint test (Lad Prabhakar)
   - Add DT support for r8a7742 (Lad Prabhakar)

  Socionext UniPhier Pro5 controller driver:
   - Add DT descriptions of iATU register (host and endpoint) (Kunihiko
     Hayashi)

  Synopsys DesignWare PCIe controller driver:
   - Add link up check in dw_child_pcie_ops.map_bus() (racy, but seems
     unavoidable) (Hou Zhiqiang)
   - Fix endpoint Header Type check so multi-function devices work (Hou
     Zhiqiang)
   - Skip PCIE_MSI_INTR0* programming if MSI is disabled (Jisheng Zhang)
   - Stop leaking MSI page in suspend/resume (Jisheng Zhang)
   - Add common iATU register support instead of keystone-specific code
     (Kunihiko Hayashi)
   - Major config space access and other cleanups in dwc core and
     drivers that use it (al, exynos, histb, imx6, intel-gw, keystone,
     kirin, meson, qcom, tegra) (Rob Herring)
   - Add multiple PFs support for endpoint (Xiaowei Bao)
   - Add MSI-X doorbell mode in endpoint mode (Xiaowei Bao)

  Miscellaneous:
   - Use fallthrough pseudo-keyword (Gustavo A. R. Silva)
   - Fix "0 used as NULL pointer" warnings (Gustavo Pimentel)
   - Fix "cast truncates bits from constant value" warnings (Gustavo
     Pimentel)
   - Remove redundant zeroing for sg_init_table() (Julia Lawall)
   - Use scnprintf(), not snprintf(), in sysfs "show" functions
     (Krzysztof Wilczyński)
   - Remove unused assignments (Krzysztof Wilczyński)
   - Fix "0 used as NULL pointer" warning (Krzysztof Wilczyński)
   - Simplify bool comparisons (Krzysztof Wilczyński)
   - Use for_each_child_of_node() and for_each_node_by_name() (Qinglang
     Miao)
   - Simplify return expressions (Qinglang Miao)"

* tag 'pci-v5.10-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (147 commits)
  PCI: vmd: Update VMD PM to correctly use generic PCI PM
  PCI: vmd: Create IRQ allocation helper
  PCI: vmd: Create IRQ Domain configuration helper
  PCI: vmd: Create bus offset configuration helper
  PCI: vmd: Create physical offset helper
  PCI: v3-semi: Remove unneeded break
  PCI: dwc: Add link up check in dw_child_pcie_ops.map_bus()
  PCI/ASPM: Remove struct pcie_link_state.l1ss
  PCI/ASPM: Remove struct aspm_register_info.l1ss_cap
  PCI/ASPM: Pass L1SS Capabilities value, not struct aspm_register_info
  PCI/ASPM: Remove struct aspm_register_info.l1ss_ctl1
  PCI/ASPM: Remove struct aspm_register_info.l1ss_ctl2 (unused)
  PCI/ASPM: Remove struct aspm_register_info.l1ss_cap_ptr
  PCI/ASPM: Remove struct aspm_register_info.latency_encoding
  PCI/ASPM: Remove struct aspm_register_info.enabled
  PCI/ASPM: Remove struct aspm_register_info.support
  PCI/ASPM: Use 'parent' and 'child' for readability
  PCI/ASPM: Move LTR path check to where it's used
  PCI/ASPM: Move pci_clear_and_set_dword() earlier
  PCI: dwc: Fix MSI page leakage in suspend/resume
  ...
2020-10-22 12:41:00 -07:00
Jon Derrick 93c9fce7d5 PCI: vmd: Update VMD PM to correctly use generic PCI PM
The pci_save_state() call in vmd_suspend() can be performed by
pci_pm_suspend_irq(). This also allows VMD to benefit from the call into
pci_prepare_to_sleep().

The pci_restore_state() call in vmd_resume() was restoring state after
pci_pm_resume()::pci_restore_standard_config() had already restored state.
It's also been suspected that the config state should have been restored
before re-requesting IRQs instead of afterwards.

Remove the pci_save_state()/pci_restore_state() calls in
vmd_suspend()/vmd_resume() to allow proper flow through generic PCI core
Power Management code.

Link: https://lore.kernel.org/r/20200806210017.5654-1-jonathan.derrick@intel.com
Signed-off-by: Jon Derrick <jonathan.derrick@intel.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: Kai-Heng Feng <kai.heng.feng@canonical.com>
Cc: You-Sheng Yang <vicamo.yang@canonical.com>
2020-10-21 09:57:42 -05:00
Jon Derrick 875b4e2a93 PCI: vmd: Create IRQ allocation helper
Move the IRQ allocation and SRCU initialization code to a new helper.  No
functional changes.

Link: https://lore.kernel.org/r/20200728194945.14126-5-jonathan.derrick@intel.com
Signed-off-by: Jon Derrick <jonathan.derrick@intel.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
2020-10-20 15:07:05 -05:00
Jon Derrick 1552b11ba1 PCI: vmd: Create IRQ Domain configuration helper
Move the IRQ and MSI Domain configuration code to new helpers. No
functional changes.

Link: https://lore.kernel.org/r/20200728194945.14126-4-jonathan.derrick@intel.com
Signed-off-by: Jon Derrick <jonathan.derrick@intel.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
2020-10-20 15:06:54 -05:00
Jon Derrick 2e1224183b PCI: vmd: Create bus offset configuration helper
Move the bus offset configuration discovery code to a new helper.  Modify
the bus offset 2-bit decode switch to have a 0 case and a default error
case, just in case the field is expanded in future hardware.

Link: https://lore.kernel.org/r/20200728194945.14126-3-jonathan.derrick@intel.com
Signed-off-by: Jon Derrick <jonathan.derrick@intel.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
2020-10-20 15:06:23 -05:00
Jon Derrick 030109c037 PCI: vmd: Create physical offset helper
Move the guest-passthrough physical offset discovery code to a new helper.
No functional changes.

Link: https://lore.kernel.org/r/20200728194945.14126-2-jonathan.derrick@intel.com
Signed-off-by: Jon Derrick <jonathan.derrick@intel.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
2020-10-20 15:06:01 -05:00
Thomas Gleixner d7f954e540 PCI_vmd_Mark_VMD_irqdomain_with_DOMAIN_BUS_VMD_MSI
Devices on the VMD bus use their own MSI irq domain, but it is not
distinguishable from regular PCI/MSI irq domains. This is required
to exclude VMD devices from getting the irq domain pointer set by
interrupt remapping.

Override the default bus token.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Joerg Roedel <jroedel@suse.de>
Link: https://lore.kernel.org/r/20200826112333.047315047@linutronix.de
2020-09-16 16:52:36 +02:00
Thomas Gleixner 585dfe8abc PCI: vmd: Dont abuse vector irqomain as parent
VMD has it's own PCI/MSI interrupt domain which is not in any way depending
on the x86 vector domain. PCI devices behind VMD share the VMD MSIX vector
entries via a VMD specific message translation to the actual VMD MSIX
vector. The VMD device interrupt handler for the VMD MSIX vectors invokes
all interrupt handlers of the devices which share a vector.

Making the x86 vector domain the actual parent of the VMD irq domain is
pointless and actually counterproductive. When a device interrupt is
requested then it will activate the interrupt which traverses down the
hierarchy and consumes an interrupt vector in the vector domain which is
never used.

The domain is self contained and has no parent dependencies, so just hand
in NULL for the parent and be done with it.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20200826112330.928952181@linutronix.de
2020-09-16 16:52:28 +02:00
Linus Torvalds 049eb096da pci-v5.9-changes
-----BEGIN PGP SIGNATURE-----
 
 iQJIBAABCgAyFiEEgMe7l+5h9hnxdsnuWYigwDrT+vwFAl8sdUkUHGJoZWxnYWFz
 QGdvb2dsZS5jb20ACgkQWYigwDrT+vwH2Q/7Brcm1uyLORSzseGsaXSGMncBs2YB
 aKbfhyy4BPsDIZRLnzcfRZzgKo3f4jlLH9dJ6nBukbNXCvS/g7oYCXtNKVuB70MD
 IgBH3OJxLmqsYgDkoQmj1fZBCBhdqMgGbRmeIPLqiIBrWOJkBpGHXKpb0XtyXAas
 CpD0Tvr0JBeHMluZq6Uay09jBDKexeCFrT5HCoVaRMXT/C/iB5K1oMrUczzITsdi
 jB9xesDjh32rYtaePKfuL8itbRT7jtqOwQlk7sCtnMNamaOOaYO/s6hL5v/4GxMh
 rtWa1knOxxA1nOsnEkUEHi0Fj/+9zXDIdb7v6thRDo0ZgWQxl7l3nshvmPcxX421
 tpCm3HqmvHzGqSI85Rtr3p4XKm9e+IjgE2EA/J6Y8Q6Grrb0EGJituhO4meL2Ciq
 6mxdhu7InxDJ2p3TLGas3fB/1hrCO0Fc0pQoBJx7YgqA1ANyld9DYCkDN6IDoZBI
 uUjKgkE1dfbW/pGjotjhBsmz3dycZHkurIFdt1iX/Xtt5KKdPAzu9yM2U03iIS2R
 im1wZ/THiS/YCOlgL/J8+DHTY0ZvXjAdbiSPjTFfwb9XTh8aHVWtFaaZON1jRIjg
 xMpIY0SxfshpLx631ThZdDTDiOwE8D3B+1n/kMwps6HOLpxOoJZeSGTRCt9wGP40
 j58DTtLm5FKpdYc=
 =moI9
 -----END PGP SIGNATURE-----

Merge tag 'pci-v5.9-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci

Pull PCI updates from Bjorn Helgaas:
 "Enumeration:
   - Fix pci_cfg_wait queue locking problem (Bjorn Helgaas)
   - Convert PCIe capability PCIBIOS errors to errno (Bolarinwa Olayemi
     Saheed)
   - Align PCIe capability and PCI accessor return values (Bolarinwa
     Olayemi Saheed)
   - Fix pci_create_slot() reference count leak (Qiushi Wu)
   - Announce device after early fixups (Tiezhu Yang)

  PCI device hotplug:
   - Make rpadlpar functions static (Wei Yongjun)

  Driver binding:
   - Add device even if driver attach failed (Rajat Jain)

  Virtualization:
   - xen: Remove redundant initialization of irq (Colin Ian King)

  IOMMU:
   - Add pci_pri_supported() to check device or associated PF (Ashok Raj)
   - Release IVRS table in AMD ACS quirk (Hanjun Guo)
   - Mark AMD Navi10 GPU rev 0x00 ATS as broken (Kai-Heng Feng)
   - Treat "external-facing" devices themselves as internal (Rajat Jain)

  MSI:
   - Forward MSI-X error code in pci_alloc_irq_vectors_affinity() (Piotr
     Stankiewicz)

  Error handling:
   - Clear PCIe Device Status errors only if OS owns AER (Jonathan
     Cameron)
   - Log correctable errors as warning, not error (Matt Jolly)
   - Use 'pci_channel_state_t' instead of 'enum pci_channel_state' (Luc
     Van Oostenryck)

  Peer-to-peer DMA:
   - Allow P2PDMA on AMD Zen and newer CPUs (Logan Gunthorpe)

  ASPM:
   - Add missing newline in sysfs 'policy' (Xiongfeng Wang)

  Native PCIe controllers:
   - Convert to devm_platform_ioremap_resource_byname() (Dejin Zheng)
   - Convert to devm_platform_ioremap_resource() (Dejin Zheng)
   - Remove duplicate error message from devm_pci_remap_cfg_resource()
     callers (Dejin Zheng)
   - Fix runtime PM imbalance on error (Dinghao Liu)
   - Remove dev_err() when handing an error from platform_get_irq()
     (Krzysztof Wilczyński)
   - Use pci_host_bridge.windows list directly instead of splicing in a
     temporary list for cadence, mvebu, host-common (Rob Herring)
   - Use pci_host_probe() instead of open-coding all the pieces for
     altera, brcmstb, iproc, mobiveil, rcar, rockchip, tegra, v3,
     versatile, xgene, xilinx, xilinx-nwl (Rob Herring)
   - Default host bridge parent device to the platform device (Rob
     Herring)
   - Use pci_is_root_bus() instead of tracking root bus number
     separately in aardvark, designware (imx6, keystone,
     designware-host), mobiveil, xilinx-nwl, xilinx, rockchip, rcar (Rob
     Herring)
   - Set host bridge bus number in pci_scan_root_bus_bridge() instead of
     each driver for aardvark, designware-host, host-common, mediatek,
     rcar, tegra, v3-semi (Rob Herring)
   - Move DT resource setup into devm_pci_alloc_host_bridge() (Rob
     Herring)
   - Set bridge map_irq and swizzle_irq to default functions; drivers
     that don't support legacy IRQs (iproc) need to undo this (Rob
     Herring)

  ARM Versatile PCIe controller driver:
   - Drop flag PCI_ENABLE_PROC_DOMAINS (Rob Herring)

  Cadence PCIe controller driver:
   - Use "dma-ranges" instead of "cdns,no-bar-match-nbits" property
     (Kishon Vijay Abraham I)
   - Remove "mem" from reg binding (Kishon Vijay Abraham I)
   - Fix cdns_pcie_{host|ep}_setup() error path (Kishon Vijay Abraham I)
   - Convert all r/w accessors to perform only 32-bit accesses (Kishon
     Vijay Abraham I)
   - Add support to start link and verify link status (Kishon Vijay
     Abraham I)
   - Allow pci_host_bridge to have custom pci_ops (Kishon Vijay Abraham I)
   - Add new *ops* for CPU addr fixup (Kishon Vijay Abraham I)
   - Fix updating Vendor ID and Subsystem Vendor ID register (Kishon
     Vijay Abraham I)
   - Use bridge resources for outbound window setup (Rob Herring)
   - Remove private bus number and range storage (Rob Herring)

  Cadence PCIe endpoint driver:
   - Add MSI-X support (Alan Douglas)

  HiSilicon PCIe controller driver:
   - Remove non-ECAM HiSilicon hip05/hip06 driver (Rob Herring)

  Intel VMD host bridge driver:
   - Use Shadow MEMBAR registers for QEMU/KVM guests (Jon Derrick)

  Loongson PCIe controller driver:
   - Use DECLARE_PCI_FIXUP_EARLY for bridge_class_quirk() (Tiezhu Yang)

  Marvell Aardvark PCIe controller driver:
   - Indicate error in 'val' when config read fails (Pali Rohár)
   - Don't touch PCIe registers if no card connected (Pali Rohár)

  Marvell MVEBU PCIe controller driver:
   - Setup BAR0 in order to fix MSI (Shmuel Hazan)

  Microsoft Hyper-V host bridge driver:
   - Fix a timing issue which causes kdump to fail occasionally (Wei Hu)
   - Make some functions static (Wei Yongjun)

  NVIDIA Tegra PCIe controller driver:
   - Revert tegra124 raw_violation_fixup (Nicolas Chauvet)
   - Remove PLL power supplies (Thierry Reding)

  Qualcomm PCIe controller driver:
   - Change duplicate PCI reset to phy reset (Abhishek Sahu)
   - Add missing ipq806x clocks in PCIe driver (Ansuel Smith)
   - Add missing reset for ipq806x (Ansuel Smith)
   - Add ext reset (Ansuel Smith)
   - Use bulk clk API and assert on error (Ansuel Smith)
   - Add support for tx term offset for rev 2.1.0 (Ansuel Smith)
   - Define some PARF params needed for ipq8064 SoC (Ansuel Smith)
   - Add ipq8064 rev2 variant (Ansuel Smith)
   - Support PCI speed set for ipq806x (Sham Muthayyan)

  Renesas R-Car PCIe controller driver:
   - Use devm_pci_alloc_host_bridge() (Rob Herring)
   - Use struct pci_host_bridge.windows list directly (Rob Herring)
   - Convert rcar-gen2 to use modern host bridge probe functions (Rob
     Herring)

  TI J721E PCIe driver:
   - Add TI J721E PCIe host and endpoint driver (Kishon Vijay Abraham I)

  Xilinx Versal CPM PCIe controller driver:
   - Add Versal CPM Root Port driver and YAML schema (Bharat Kumar
     Gogada)

  MicroSemi Switchtec management driver:
   - Add missing __iomem and __user tags to fix sparse warnings (Logan
     Gunthorpe)

  Miscellaneous:
   - Replace http:// links with https:// (Alexander A. Klimov)
   - Replace lkml.org, spinics, gmane with lore.kernel.org (Bjorn
     Helgaas)
   - Remove unused pci_lost_interrupt() (Heiner Kallweit)
   - Move PCI_VENDOR_ID_REDHAT definition to pci_ids.h (Huacai Chen)
   - Fix kerneldoc warnings (Krzysztof Kozlowski)"

* tag 'pci-v5.9-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (113 commits)
  PCI: Fix kerneldoc warnings
  PCI: xilinx-cpm: Add Versal CPM Root Port driver
  PCI: xilinx-cpm: Add YAML schemas for Versal CPM Root Port
  PCI: Set bridge map_irq and swizzle_irq to default functions
  PCI: Move DT resource setup into devm_pci_alloc_host_bridge()
  PCI: rcar-gen2: Convert to use modern host bridge probe functions
  PCI: Remove dev_err() when handing an error from platform_get_irq()
  MAINTAINERS: Add Kishon Vijay Abraham I for TI J721E SoC PCIe
  misc: pci_endpoint_test: Add J721E in pci_device_id table
  PCI: j721e: Add TI J721E PCIe driver
  PCI: switchtec: Add missing __iomem tag to fix sparse warnings
  PCI: switchtec: Add missing __iomem and __user tags to fix sparse warnings
  PCI: rpadlpar: Make functions static
  PCI/P2PDMA: Allow P2PDMA on AMD Zen and newer CPUs
  PCI: Release IVRS table in AMD ACS quirk
  PCI: Announce device after early fixups
  PCI: Mark AMD Navi10 GPU rev 0x00 ATS as broken
  PCI: Remove unused pci_lost_interrupt()
  dt-bindings: PCI: Add EP mode dt-bindings for TI's J721E SoC
  dt-bindings: PCI: Add host mode dt-bindings for TI's J721E SoC
  ...
2020-08-07 18:48:15 -07:00
Jon Derrick ec0160891e irqdomain/treewide: Free firmware node after domain removal
Commit 711419e504 ("irqdomain: Add the missing assignment of
domain->fwnode for named fwnode") unintentionally caused a dangling pointer
page fault issue on firmware nodes that were freed after IRQ domain
allocation. Commit e3beca48a4 fixed that dangling pointer issue by only
freeing the firmware node after an IRQ domain allocation failure. That fix
no longer frees the firmware node immediately, but leaves the firmware node
allocated after the domain is removed.

The firmware node must be kept around through irq_domain_remove, but should be
freed it afterwards.

Add the missing free operations after domain removal where where appropriate.

Fixes: e3beca48a4 ("irqdomain/treewide: Keep firmware node unconditionally allocated")
Signed-off-by: Jon Derrick <jonathan.derrick@intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>	# drivers/pci
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/1595363169-7157-1-git-send-email-jonathan.derrick@intel.com
2020-07-23 00:08:52 +02:00