17 Nov, 2020

1 commit

  • From commit 6915564dc5a8 ("ACPI: OSL: Change the type of
    acpi_os_map_generic_address() return value"),
    acpi_os_map_generic_address() will return logical address or NULL
    for error, but for ACPI_ADR_SPACE_SYSTEM_IO case, it should be also
    return 0 as it's a normal case, but now it will return -ENXIO.

    So check it out for such case to avoid einj module initialization
    fail.

    Fixes: 6915564dc5a8 ("ACPI: OSL: Change the type of acpi_os_map_generic_address() return value")
    Cc:
    Reviewed-by: James Morse
    Tested-by: Tony Luck
    Signed-off-by: Aili Yao
    Signed-off-by: Rafael J. Wysocki

    Aili Yao
     

24 Oct, 2020

1 commit

  • Pull arch task_work cleanups from Jens Axboe:
    "Two cleanups that don't fit other categories:

    - Finally get the task_work_add() cleanup done properly, so we don't
    have random 0/1/false/true/TWA_SIGNAL confusing use cases. Updates
    all callers, and also fixes up the documentation for
    task_work_add().

    - While working on some TIF related changes for 5.11, this
    TIF_NOTIFY_RESUME cleanup fell out of that. Remove some arch
    duplication for how that is handled"

    * tag 'arch-cleanup-2020-10-22' of git://git.kernel.dk/linux-block:
    task_work: cleanup notification modes
    tracehook: clear TIF_NOTIFY_RESUME in tracehook_notify_resume()

    Linus Torvalds
     

23 Oct, 2020

1 commit

  • 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
    ...

    Linus Torvalds
     

18 Oct, 2020

1 commit

  • A previous commit changed the notification mode from true/false to an
    int, allowing notify-no, notify-yes, or signal-notify. This was
    backwards compatible in the sense that any existing true/false user
    would translate to either 0 (on notification sent) or 1, the latter
    which mapped to TWA_RESUME. TWA_SIGNAL was assigned a value of 2.

    Clean this up properly, and define a proper enum for the notification
    mode. Now we have:

    - TWA_NONE. This is 0, same as before the original change, meaning no
    notification requested.
    - TWA_RESUME. This is 1, same as before the original change, meaning
    that we use TIF_NOTIFY_RESUME.
    - TWA_SIGNAL. This uses TIF_SIGPENDING/JOBCTL_TASK_WORK for the
    notification.

    Clean up all the callers, switching their 0/1/false/true to using the
    appropriate TWA_* mode for notifications.

    Fixes: e91b48162332 ("task_work: teach task_work_add() to do signal_wake_up()")
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Jens Axboe

    Jens Axboe
     

16 Sep, 2020

1 commit

  • CPER records describing a firmware-first error are identified by GUID.
    The ghes driver currently logs, but ignores any unknown CPER records.
    This prevents describing errors that can't be represented by a standard
    entry, that would otherwise allow a driver to recover from an error.
    The UEFI spec calls these 'Non-standard Section Body' (N.2.3 of
    version 2.8).

    Add a notifier chain for these non-standard/vendor-records. Callers
    must identify their type of records by GUID.

    Record data is copied to memory from the ghes_estatus_pool to allow
    us to keep it until after the notifier has run.

    Co-developed-by: James Morse
    Link: https://lore.kernel.org/r/20200903123456.1823-2-shiju.jose@huawei.com
    Signed-off-by: James Morse
    Signed-off-by: Shiju Jose
    Signed-off-by: Lorenzo Pieralisi
    Acked-by: "Rafael J. Wysocki"

    Shiju Jose
     

11 Sep, 2020

1 commit

  • Modify acpi_os_map_generic_address() to return the pointer returned
    by acpi_os_map_iomem() which represents the logical address
    corresponding to the struct acpi_generic_address argument passed to
    it or NULL if that address cannot be obtained (for example, the
    argument does not represent an address in system memory or it could
    not be mapped by the OS).

    Among other things, that will allow the ACPI OS layer to pass the
    logical addresses of the FADT GPE blocks 0 and 1 to ACPICA going
    forward.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     

27 Jul, 2020

1 commit


03 Jun, 2020

2 commits

  • Pull ACPI updates from Rafael Wysocki:
    "These update the ACPICA code in the kernel to upstream revision
    20200430, fix several reference counting errors related to ACPI
    tables, add _Exx / _Lxx support to the GED driver, add a new
    acpi_evaluate_reg() helper, add new DPTF battery participant driver
    and extend the DPFT power participant driver, improve the handling of
    memory failures in the APEI code, add a blacklist entry to the
    backlight driver, update the PMIC driver and the processor idle
    driver, fix two kobject reference count leaks, and make a few janitory
    changes.

    Specifics:

    - Update the ACPICA code in the kernel to upstream revision 20200430:

    - Move acpi_gbl_next_cmd_num definition (Erik Kaneda).

    - Ignore AE_ALREADY_EXISTS status in the disassembler when parsing
    create operators (Erik Kaneda).

    - Add status checks to the dispatcher (Erik Kaneda).

    - Fix required parameters for _NIG and _NIH (Erik Kaneda).

    - Make acpi_protocol_lengths static (Yue Haibing).

    - Fix ACPI table reference counting errors in several places, mostly
    in error code paths (Hanjun Guo).

    - Extend the Generic Event Device (GED) driver to support _Exx and
    _Lxx handler methods (Ard Biesheuvel).

    - Add new acpi_evaluate_reg() helper and modify the ACPI PCI hotplug
    code to use it (Hans de Goede).

    - Add new DPTF battery participant driver and make the DPFT power
    participant driver create more sysfs device attributes (Srinivas
    Pandruvada).

    - Improve the handling of memory failures in APEI (James Morse).

    - Add new blacklist entry for Acer TravelMate 5735Z to the backlight
    driver (Paul Menzel).

    - Add i2c address for thermal control to the PMIC driver (Mauro
    Carvalho Chehab).

    - Allow the ACPI processor idle driver to work on platforms with only
    one ACPI C-state present (Zhang Rui).

    - Fix kobject reference count leaks in error code paths in two places
    (Qiushi Wu).

    - Delete unused proc filename macros and make some symbols static
    (Pascal Terjan, Zheng Zengkai, Zou Wei)"

    * tag 'acpi-5.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (32 commits)
    ACPI: CPPC: Fix reference count leak in acpi_cppc_processor_probe()
    ACPI: sysfs: Fix reference count leak in acpi_sysfs_add_hotplug_profile()
    ACPI: GED: use correct trigger type field in _Exx / _Lxx handling
    ACPI: DPTF: Add battery participant driver
    ACPI: DPTF: Additional sysfs attributes for power participant driver
    ACPI: video: Use native backlight on Acer TravelMate 5735Z
    arm64: acpi: Make apei_claim_sea() synchronise with APEI's irq work
    ACPI: APEI: Kick the memory_failure() queue for synchronous errors
    mm/memory-failure: Add memory_failure_queue_kick()
    ACPI / PMIC: Add i2c address for thermal control
    ACPI: GED: add support for _Exx / _Lxx handler methods
    ACPI: Delete unused proc filename macros
    ACPI: hotplug: PCI: Use the new acpi_evaluate_reg() helper
    ACPI: utils: Add acpi_evaluate_reg() helper
    ACPI: debug: Make two functions static
    ACPI: sleep: Put the FACS table after using it
    ACPI: scan: Put SPCR and STAO table after using it
    ACPI: EC: Put the ACPI table after using it
    ACPI: APEI: Put the HEST table for error path
    ACPI: APEI: Put the error record serialization table for error path
    ...

    Linus Torvalds
     
  • These functions are not needed anymore because the vmalloc and ioremap
    mappings are now synchronized when they are created or torn down.

    Remove all callers and function definitions.

    Signed-off-by: Joerg Roedel
    Signed-off-by: Andrew Morton
    Tested-by: Steven Rostedt (VMware)
    Acked-by: Andy Lutomirski
    Acked-by: Peter Zijlstra (Intel)
    Cc: Arnd Bergmann
    Cc: Christoph Hellwig
    Cc: Dave Hansen
    Cc: "H . Peter Anvin"
    Cc: Ingo Molnar
    Cc: Matthew Wilcox (Oracle)
    Cc: Michal Hocko
    Cc: "Rafael J. Wysocki"
    Cc: Thomas Gleixner
    Cc: Vlastimil Babka
    Link: http://lkml.kernel.org/r/20200515140023.25469-7-joro@8bytes.org
    Signed-off-by: Linus Torvalds

    Joerg Roedel
     

01 Jun, 2020

1 commit

  • * acpi-apei:
    arm64: acpi: Make apei_claim_sea() synchronise with APEI's irq work
    ACPI: APEI: Kick the memory_failure() queue for synchronous errors
    mm/memory-failure: Add memory_failure_queue_kick()

    * acpi-pmic:
    ACPI / PMIC: Add i2c address for thermal control

    * acpi-video:
    ACPI: video: Use native backlight on Acer TravelMate 5735Z

    * acpi-dptf:
    ACPI: DPTF: Add battery participant driver
    ACPI: DPTF: Additional sysfs attributes for power participant driver

    Rafael J. Wysocki
     

20 May, 2020

1 commit

  • memory_failure() offlines or repairs pages of memory that have been
    discovered to be corrupt. These may be detected by an external
    component, (e.g. the memory controller), and notified via an IRQ.
    In this case the work is queued as not all of memory_failure()s work
    can happen in IRQ context.

    If the error was detected as a result of user-space accessing a
    corrupt memory location the CPU may take an abort instead. On arm64
    this is a 'synchronous external abort', and on a firmware first
    system it is replayed using NOTIFY_SEA.

    This notification has NMI like properties, (it can interrupt
    IRQ-masked code), so the memory_failure() work is queued. If we
    return to user-space before the queued memory_failure() work is
    processed, we will take the fault again. This loop may cause platform
    firmware to exceed some threshold and reboot when Linux could have
    recovered from this error.

    For NMIlike notifications keep track of whether memory_failure() work
    was queued, and make task_work pending to flush out the queue.
    To save memory allocations, the task_work is allocated as part of
    the ghes_estatus_node, and free()ing it back to the pool is deferred.

    Signed-off-by: James Morse
    Tested-by: Tyler Baicar
    Signed-off-by: Rafael J. Wysocki

    James Morse
     

09 May, 2020

4 commits


22 Mar, 2020

1 commit

  • Commit 3f8fd02b1bf1 ("mm/vmalloc: Sync unmappings in
    __purge_vmap_area_lazy()") introduced a call to vmalloc_sync_all() in
    the vunmap() code-path. While this change was necessary to maintain
    correctness on x86-32-pae kernels, it also adds additional cycles for
    architectures that don't need it.

    Specifically on x86-64 with CONFIG_VMAP_STACK=y some people reported
    severe performance regressions in micro-benchmarks because it now also
    calls the x86-64 implementation of vmalloc_sync_all() on vunmap(). But
    the vmalloc_sync_all() implementation on x86-64 is only needed for newly
    created mappings.

    To avoid the unnecessary work on x86-64 and to gain the performance
    back, split up vmalloc_sync_all() into two functions:

    * vmalloc_sync_mappings(), and
    * vmalloc_sync_unmappings()

    Most call-sites to vmalloc_sync_all() only care about new mappings being
    synchronized. The only exception is the new call-site added in the
    above mentioned commit.

    Shile Zhang directed us to a report of an 80% regression in reaim
    throughput.

    Fixes: 3f8fd02b1bf1 ("mm/vmalloc: Sync unmappings in __purge_vmap_area_lazy()")
    Reported-by: kernel test robot
    Reported-by: Shile Zhang
    Signed-off-by: Joerg Roedel
    Signed-off-by: Andrew Morton
    Tested-by: Borislav Petkov
    Acked-by: Rafael J. Wysocki [GHES]
    Cc: Dave Hansen
    Cc: Andy Lutomirski
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc:
    Link: http://lkml.kernel.org/r/20191009124418.8286-1-joro@8bytes.org
    Link: https://lists.01.org/hyperkitty/list/lkp@lists.01.org/thread/4D3JPPHBNOSPFK2KEPC6KGKS6J25AIDB/
    Link: http://lkml.kernel.org/r/20191113095530.228959-1-shile.zhang@linux.alibaba.com
    Signed-off-by: Linus Torvalds

    Joerg Roedel
     

13 Jan, 2020

1 commit

  • Currently, the ghes_poll_func() timer callback is registered with the
    TIMER_DEFERRABLE flag. Thus, it is run when the CPU eventually wakes
    up together with a subsequent non-deferrable timer and not at the precisely
    configured polling interval.

    For polling mode, the polling interval configured by firmware should not
    be exceeded according to the ACPI spec 6.3, Table 18-394. The definition
    of the polling interval is:

    "Indicates the poll interval in milliseconds OSPM should use to
    periodically check the error source for the presence of an error
    condition."

    If this interval is extended due to the timer callback deferring, error
    records can get lost. Which we are observing on our ThunderX2 platforms.

    Therefore, remove the TIMER_DEFERRABLE flag so that the timer callback
    executes at the precise interval.

    Signed-off-by: Bhaskar Upadhaya
    [ bp: Subject & changelog ]
    Acked-by: Borislav Petkov
    Signed-off-by: Rafael J. Wysocki

    Bhaskar Upadhaya
     

26 Nov, 2019

1 commit

  • Pull printk updates from Petr Mladek:

    - Allow to print symbolic error names via new %pe modifier.

    - Use pr_warn() instead of the remaining pr_warning() calls. Fix
    formatting of the related lines.

    - Add VSPRINTF entry to MAINTAINERS.

    * tag 'printk-for-5.5' of git://git.kernel.org/pub/scm/linux/kernel/git/pmladek/printk: (32 commits)
    checkpatch: don't warn about new vsprintf pointer extension '%pe'
    MAINTAINERS: Add VSPRINTF
    tools lib api: Renaming pr_warning to pr_warn
    ASoC: samsung: Use pr_warn instead of pr_warning
    lib: cpu_rmap: Use pr_warn instead of pr_warning
    trace: Use pr_warn instead of pr_warning
    dma-debug: Use pr_warn instead of pr_warning
    vgacon: Use pr_warn instead of pr_warning
    fs: afs: Use pr_warn instead of pr_warning
    sh/intc: Use pr_warn instead of pr_warning
    scsi: Use pr_warn instead of pr_warning
    platform/x86: intel_oaktrail: Use pr_warn instead of pr_warning
    platform/x86: asus-laptop: Use pr_warn instead of pr_warning
    platform/x86: eeepc-laptop: Use pr_warn instead of pr_warning
    oprofile: Use pr_warn instead of pr_warning
    of: Use pr_warn instead of pr_warning
    macintosh: Use pr_warn instead of pr_warning
    idsn: Use pr_warn instead of pr_warning
    ide: Use pr_warn instead of pr_warning
    crypto: n2: Use pr_warn instead of pr_warning
    ...

    Linus Torvalds
     

18 Oct, 2019

1 commit

  • As said in commit f2c2cbcc35d4 ("powerpc: Use pr_warn instead of
    pr_warning"), removing pr_warning so all logging messages use a
    consistent _warn style. Let's do it.

    Link: http://lkml.kernel.org/r/20191018031850.48498-8-wangkefeng.wang@huawei.com
    To: linux-kernel@vger.kernel.org
    Cc: "Rafael J. Wysocki"
    Cc: Len Brown
    Cc: James Morse
    Signed-off-by: Kefeng Wang
    Reviewed-by: Sergey Senozhatsky
    [pmladek@suse.com: two more indentation fixes]
    Signed-off-by: Petr Mladek

    Kefeng Wang
     

21 Aug, 2019

1 commit

  • Destroy ghes_estatus_pool and release memory allocated via vmalloc() on
    errors in ghes_estatus_pool_init() in order to avoid memory leaks.

    [ bp: do the labels properly and with descriptive names and massage. ]

    Signed-off-by: Liguang Zhang
    Signed-off-by: Borislav Petkov
    Link: https://lkml.kernel.org/r/1563173924-47479-1-git-send-email-zhangliguang@linux.alibaba.com
    Signed-off-by: Rafael J. Wysocki

    Liguang Zhang
     

05 Aug, 2019

1 commit


05 Jul, 2019

1 commit


05 Jun, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this file is licensed under gplv2

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 22 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Armijn Hemel
    Reviewed-by: Allison Randal
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190531190115.129548190@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

31 May, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license version 2 as
    published by the free software foundation this program is
    distributed in the hope that it will be useful but without any
    warranty without even the implied warranty of merchantability or
    fitness for a particular purpose see the gnu general public license
    for more details

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 655 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Allison Randal
    Reviewed-by: Kate Stewart
    Reviewed-by: Richard Fontana
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190527070034.575739538@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

04 Mar, 2019

1 commit

  • * acpi-apei: (29 commits)
    efi: cper: Fix possible out-of-bounds access
    ACPI: APEI: Fix possible out-of-bounds access to BERT region
    MAINTAINERS: Add James Morse to the list of APEI reviewers
    ACPI / APEI: Add support for the SDEI GHES Notification type
    firmware: arm_sdei: Add ACPI GHES registration helper
    ACPI / APEI: Use separate fixmap pages for arm64 NMI-like notifications
    ACPI / APEI: Only use queued estatus entry during in_nmi_queue_one_entry()
    ACPI / APEI: Split ghes_read_estatus() to allow a peek at the CPER length
    ACPI / APEI: Make GHES estatus header validation more user friendly
    ACPI / APEI: Pass ghes and estatus separately to avoid a later copy
    ACPI / APEI: Let the notification helper specify the fixmap slot
    ACPI / APEI: Move locking to the notification helper
    arm64: KVM/mm: Move SEA handling behind a single 'claim' interface
    KVM: arm/arm64: Add kvm_ras.h to collect kvm specific RAS plumbing
    ACPI / APEI: Switch NOTIFY_SEA to use the estatus queue
    ACPI / APEI: Move NOTIFY_SEA between the estatus-queue and NOTIFY_NMI
    ACPI / APEI: Don't allow ghes_ack_error() to mask earlier errors
    ACPI / APEI: Generalise the estatus queue's notify code
    ACPI / APEI: Don't update struct ghes' flags in read/clear estatus
    ACPI / APEI: Remove spurious GHES_TO_CLEAR check
    ...

    Rafael J. Wysocki
     

20 Feb, 2019

1 commit

  • Check that the length recorded in the generic error status block is
    within the region before checking the contents of the region itself.

    Otherwise it may result in an out-of-bounds access if the system
    firmware has generated a status block with an invalid length (larger
    than the mapped region). Also move the block_status check so that it
    only happens after the block has been verified to be within the mapped
    region.

    Signed-off-by: Ross Lagerwall
    Acked-by: Borislav Petkov
    Tested-by: Tyler Baicar
    Signed-off-by: Rafael J. Wysocki

    Ross Lagerwall
     

11 Feb, 2019

1 commit

  • If the GHES notification type is SDEI, register the provided event
    using the SDEI-GHES helper.

    SDEI may be one of two types of event, normal and critical. Critical
    events can interrupt normal events, so these must have separate
    fixmap slots and locks in case both event types are in use.

    Signed-off-by: James Morse
    Signed-off-by: Rafael J. Wysocki

    James Morse
     

08 Feb, 2019

13 commits

  • Now that ghes notification helpers provide the fixmap slots and
    take the lock themselves, multiple NMI-like notifications can
    be used on arm64.

    These should be named after their notification method as they can't
    all be called 'NMI'. x86's NOTIFY_NMI already is, change the SEA
    fixmap entry to be called FIX_APEI_GHES_SEA.

    Future patches can add support for FIX_APEI_GHES_SEI and
    FIX_APEI_GHES_SDEI_{NORMAL,CRITICAL}.

    Because all of ghes.c builds on both architectures, provide a
    constant for each fixmap entry that the architecture will never
    use.

    Signed-off-by: James Morse
    Signed-off-by: Rafael J. Wysocki

    James Morse
     
  • Each struct ghes has an worst-case sized buffer for storing the
    estatus. If an error is being processed by ghes_proc() in process
    context this buffer will be in use. If the error source then triggers
    an NMI-like notification, the same buffer will be used by
    in_nmi_queue_one_entry() to stage the estatus data, before
    __process_error() copys it into a queued estatus entry.

    Merge __process_error()s work into in_nmi_queue_one_entry() so that
    the queued estatus entry is used from the beginning. Use the new
    ghes_peek_estatus() to know how much memory to allocate from
    the ghes_estatus_pool before reading the records.

    Reported-by: Borislav Petkov
    Signed-off-by: James Morse
    Reviewed-by: Borislav Petkov

    Change since v6:
    * Added a comment explaining the 'ack-error, then goto no_work'.
    * Added missing esatus-clearing, which is necessary after reading the GAS,
    Signed-off-by: Rafael J. Wysocki

    James Morse
     
  • ghes_read_estatus() reads the record address, then the record's
    header, then performs some sanity checks before reading the
    records into the provided estatus buffer.

    To provide this estatus buffer the caller must know the size of the
    records in advance, or always provide a worst-case sized buffer as
    happens today for the non-NMI notifications.

    Add a function to peek at the record's header to find the size. This
    will let the NMI path allocate the right amount of memory before reading
    the records, instead of using the worst-case size, and having to copy
    the records.

    Split ghes_read_estatus() to create __ghes_peek_estatus() which
    returns the address and size of the CPER records.

    Signed-off-by: James Morse

    Changes since v7:
    * Grammar
    * concistent argument ordering

    Changes since v6:
    * Additional buf_addr = 0 error handling
    * Moved checking out of peek-estatus
    * Reworded an error message so we can tell them apart
    Signed-off-by: Rafael J. Wysocki

    James Morse
     
  • ghes_read_estatus() checks various lengths in the top-level header to
    ensure the CPER records to be read aren't obviously corrupt.

    Take the opportunity to make this more user-friendly, printing a
    (ratelimited) message about the nature of the header format error.

    Suggested-by: Borislav Petkov
    Signed-off-by: James Morse
    [ rjw: Add missing 'static' ]
    Signed-off-by: Rafael J. Wysocki

    James Morse
     
  • The NMI-like notifications scribble over ghes->estatus, before
    copying it somewhere else. If this interrupts the ghes_probe() code
    calling ghes_proc() on each struct ghes, the data is corrupted.

    All the NMI-like notifications should use a queued estatus entry
    from the beginning, instead of the ghes version, then copying it.
    To do this, break up any use of "ghes->estatus" so that all
    functions take the estatus as an argument.

    This patch just moves these ghes->estatus dereferences into separate
    arguments, no change in behaviour. struct ghes becomes unused in
    ghes_clear_estatus() as it only wanted ghes->estatus, which we now
    pass directly. This is removed.

    Signed-off-by: James Morse
    Signed-off-by: Rafael J. Wysocki

    James Morse
     
  • ghes_copy_tofrom_phys() uses a different fixmap slot depending on in_nmi().
    This doesn't work when there are multiple NMI-like notifications, that
    could interrupt each other.

    As with the locking, move the chosen fixmap_idx to the notification helper.
    This only matters for NMI-like notifications, anything calling
    ghes_proc() can use the IRQ fixmap slot as its already holding an irqsave
    spinlock.

    This lets us collapse the ghes_ioremap_pfn_*() helpers.

    Signed-off-by: James Morse
    Reviewed-by: Borislav Petkov
    Signed-off-by: Rafael J. Wysocki

    James Morse
     
  • ghes_copy_tofrom_phys() takes different locks depending on in_nmi().
    This doesn't work if there are multiple NMI-like notifications, that
    can interrupt each other.

    Now that NOTIFY_SEA is always called in the same context, move the
    lock-taking to the notification helper. The helper will always know
    which lock to take. This avoids ghes_copy_tofrom_phys() taking a guess
    based on in_nmi().

    This splits NOTIFY_NMI and NOTIFY_SEA to use different locks. All
    the other notifications use ghes_proc(), and are called in process
    or IRQ context. Move the spin_lock_irqsave() around their ghes_proc()
    calls.

    Signed-off-by: James Morse
    Reviewed-by: Borislav Petkov
    Signed-off-by: Rafael J. Wysocki

    James Morse
     
  • Now that the estatus queue can be used by more than one notification
    method, we can move notifications that have NMI-like behaviour over.

    Switch NOTIFY_SEA over to use the estatus queue. This makes it behave
    in the same way as x86's NOTIFY_NMI.

    Remove Kconfig's ability to turn ACPI_APEI_SEA off if ACPI_APEI_GHES
    is selected. This roughly matches the x86 NOTIFY_NMI behaviour, and means
    each architecture has at least one user of the estatus-queue, meaning it
    doesn't need guarding with ifdef.

    Signed-off-by: James Morse
    Signed-off-by: Rafael J. Wysocki

    James Morse
     
  • The estatus-queue code is currently hidden by the NOTIFY_NMI #ifdefs.
    Once NOTIFY_SEA starts using the estatus-queue we can stop hiding
    it as each architecture has a user that can't be turned off.

    Split the existing CONFIG_HAVE_ACPI_APEI_NMI block in two, and move
    the SEA code into the gap.

    Move the code around ... and changes the stale comment describing
    why the status queue is necessary: printk() is no longer the issue,
    its the helpers like memory_failure_queue() that aren't nmi safe.

    Signed-off-by: James Morse
    Signed-off-by: Rafael J. Wysocki

    James Morse
     
  • During ghes_proc() we use ghes_ack_error() to tell an external agent
    we are done with these records and it can re-use the memory.

    rc may hold an error returned by ghes_read_estatus(), ENOENT causes
    us to skip ghes_ack_error() (as there is nothing to ack), but rc may
    also by EIO, which gets supressed.

    ghes_clear_estatus() is where we mark the records as processed for
    non GHESv2 error sources, and already spots the ENOENT case as
    buf_paddr is set to 0 by ghes_read_estatus().

    Move the ghes_ack_error() call in here to avoid extra logic with
    the return code in ghes_proc().

    This enables GHESv2 acking for NMI-like error sources. This is safe
    as the buffer is pre-mapped by map_gen_v2() before the GHES is added
    to any NMI handler lists.

    This same pre-mapping step means we can't receive an error from
    apei_read()/write() here as apei_check_gar() succeeded when it
    was mapped, and the mapping was cached, so the address can't be
    rejected at runtime. Remove the error-returns as this is now
    called from a function with no return.

    Signed-off-by: James Morse
    Signed-off-by: Rafael J. Wysocki

    James Morse
     
  • Refactor the estatus queue's pool notification routine from
    NOTIFY_NMI's handlers. This will allow another notification
    method to use the estatus queue without duplicating this code.

    Add rcu_read_lock()/rcu_read_unlock() around the list
    list_for_each_entry_rcu() walker. These aren't strictly necessary as
    the whole nmi_enter/nmi_exit() window is a spooky RCU read-side
    critical section.

    in_nmi_queue_one_entry() is separate from the rcu-list walker for a
    later caller that doesn't need to walk a list.

    Signed-off-by: James Morse
    Reviewed-by: Punit Agrawal
    Tested-by: Tyler Baicar
    [ rjw: Drop unnecessary err variable in two places ]
    Signed-off-by: Rafael J. Wysocki

    James Morse
     
  • ghes_read_estatus() sets a flag in struct ghes if the buffer of
    CPER records needs to be cleared once the records have been
    processed. This flag value is a problem if a struct ghes can be
    processed concurrently, as happens at probe time if an NMI arrives
    for the same error source. The NMI clears the flag, meaning the
    interrupted handler may never do the ghes_estatus_clear() work.

    The GHES_TO_CLEAR flags is only set at the same time as
    buffer_paddr, which is now owned by the caller and passed to
    ghes_clear_estatus(). Use this value as the flag.

    A non-zero buf_paddr returned by ghes_read_estatus() means
    ghes_clear_estatus() should clear this address. ghes_read_estatus()
    already checks for a read of error_status_address being zero,
    so CPER records cannot be written here.

    Signed-off-by: James Morse
    Reviewed-by: Borislav Petkov
    Signed-off-by: Rafael J. Wysocki

    James Morse
     
  • ghes_notify_nmi() checks ghes->flags for GHES_TO_CLEAR before going
    on to __process_error(). This is pointless as ghes_read_estatus()
    will always set this flag if it returns success, which was checked
    earlier in the loop. Remove it.

    Signed-off-by: James Morse
    Reviewed-by: Borislav Petkov
    Signed-off-by: Rafael J. Wysocki

    James Morse