linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Alexey Kardashevskiy <aik@ozlabs.ru>,
	Sam Bobroff <sbobroff@linux.ibm.com>,
	Oliver OHalloran <oohall@gmail.com>,
	Shawn Anastasio <shawn@anastas.io>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH 4.19 036/113] powerpc/pci/of: Fix OF flags parsing for 64bit BARs
Date: Mon, 29 Jul 2019 21:22:03 +0200	[thread overview]
Message-ID: <20190729190704.397050441@linuxfoundation.org> (raw)
In-Reply-To: <20190729190655.455345569@linuxfoundation.org>

[ Upstream commit df5be5be8735ef2ae80d5ae1f2453cd81a035c4b ]

When the firmware does PCI BAR resource allocation, it passes the assigned
addresses and flags (prefetch/64bit/...) via the "reg" property of
a PCI device device tree node so the kernel does not need to do
resource allocation.

The flags are stored in resource::flags - the lower byte stores
PCI_BASE_ADDRESS_SPACE/etc bits and the other bytes are IORESOURCE_IO/etc.
Some flags from PCI_BASE_ADDRESS_xxx and IORESOURCE_xxx are duplicated,
such as PCI_BASE_ADDRESS_MEM_PREFETCH/PCI_BASE_ADDRESS_MEM_TYPE_64/etc.
When parsing the "reg" property, we copy the prefetch flag but we skip
on PCI_BASE_ADDRESS_MEM_TYPE_64 which leaves the flags out of sync.

The missing IORESOURCE_MEM_64 flag comes into play under 2 conditions:
1. we remove PCI_PROBE_ONLY for pseries (by hacking pSeries_setup_arch()
or by passing "/chosen/linux,pci-probe-only");
2. we request resource alignment (by passing pci=resource_alignment=
via the kernel cmd line to request PAGE_SIZE alignment or defining
ppc_md.pcibios_default_alignment which returns anything but 0). Note that
the alignment requests are ignored if PCI_PROBE_ONLY is enabled.

With 1) and 2), the generic PCI code in the kernel unconditionally
decides to:
- reassign the BARs in pci_specified_resource_alignment() (works fine)
- write new BARs to the device - this fails for 64bit BARs as the generic
code looks at IORESOURCE_MEM_64 (not set) and writes only lower 32bits
of the BAR and leaves the upper 32bit unmodified which breaks BAR mapping
in the hypervisor.

This fixes the issue by copying the flag. This is useful if we want to
enforce certain BAR alignment per platform as handling subpage sized BARs
is proven to cause problems with hotplug (SLOF already aligns BARs to 64k).

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Sam Bobroff <sbobroff@linux.ibm.com>
Reviewed-by: Oliver O'Halloran <oohall@gmail.com>
Reviewed-by: Shawn Anastasio <shawn@anastas.io>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/powerpc/kernel/pci_of_scan.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/powerpc/kernel/pci_of_scan.c b/arch/powerpc/kernel/pci_of_scan.c
index 98f04725def7..c101b321dece 100644
--- a/arch/powerpc/kernel/pci_of_scan.c
+++ b/arch/powerpc/kernel/pci_of_scan.c
@@ -45,6 +45,8 @@ unsigned int pci_parse_of_flags(u32 addr0, int bridge)
 	if (addr0 & 0x02000000) {
 		flags = IORESOURCE_MEM | PCI_BASE_ADDRESS_SPACE_MEMORY;
 		flags |= (addr0 >> 22) & PCI_BASE_ADDRESS_MEM_TYPE_64;
+		if (flags & PCI_BASE_ADDRESS_MEM_TYPE_64)
+			flags |= IORESOURCE_MEM_64;
 		flags |= (addr0 >> 28) & PCI_BASE_ADDRESS_MEM_TYPE_1M;
 		if (addr0 & 0x40000000)
 			flags |= IORESOURCE_PREFETCH
-- 
2.20.1




  parent reply	other threads:[~2019-07-29 19:42 UTC|newest]

Thread overview: 130+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-29 19:21 [PATCH 4.19 000/113] 4.19.63-stable review Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 001/113] hvsock: fix epollout hang from race condition Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 002/113] drm/panel: simple: Fix panel_simple_dsi_probe Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 003/113] iio: adc: stm32-dfsdm: manage the get_irq error case Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 004/113] iio: adc: stm32-dfsdm: missing error case during probe Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 005/113] staging: vt6656: use meaningful error code during buffer allocation Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 006/113] usb: core: hub: Disable hub-initiated U1/U2 Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 007/113] tty: max310x: Fix invalid baudrate divisors calculator Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 008/113] pinctrl: rockchip: fix leaked of_node references Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 009/113] tty: serial: cpm_uart - fix init when SMC is relocated Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 010/113] drm/amd/display: Fill prescale_params->scale for RGB565 Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 011/113] drm/amdgpu/sriov: Need to initialize the HDP_NONSURFACE_BAStE Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 012/113] drm/amd/display: Disable ABM before destroy ABM struct Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 013/113] drm/amdkfd: Fix a potential memory leak Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 014/113] drm/amdkfd: Fix sdma queue map issue Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 015/113] drm/edid: Fix a missing-check bug in drm_load_edid_firmware() Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 016/113] PCI: Return error if cannot probe VF Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 017/113] drm/bridge: tc358767: read display_props in get_modes() Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 018/113] drm/bridge: sii902x: pixel clock unit is 10kHz instead of 1kHz Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 019/113] gpu: host1x: Increase maximum DMA segment size Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 020/113] drm/crc-debugfs: User irqsafe spinlock in drm_crtc_add_crc_entry Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 021/113] drm/crc-debugfs: Also sprinkle irqrestore over early exits Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 022/113] memstick: Fix error cleanup path of memstick_init Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 023/113] tty/serial: digicolor: Fix digicolor-usart already registered warning Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 024/113] tty: serial: msm_serial: avoid system lockup condition Greg Kroah-Hartman
2019-07-31 19:05   ` Pavel Machek
2019-07-31 20:34     ` Jorge Ramirez
2019-08-15  7:07       ` Pavel Machek
2019-07-29 19:21 ` [PATCH 4.19 025/113] serial: 8250: Fix TX interrupt handling condition Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 026/113] drm/amd/display: Always allocate initial connector state state Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 027/113] drm/virtio: Add memory barriers for capset cache Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 028/113] phy: renesas: rcar-gen2: Fix memory leak at error paths Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 029/113] drm/amd/display: fix compilation error Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 030/113] powerpc/pseries/mobility: prevent cpu hotplug during DT update Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 031/113] drm/rockchip: Properly adjust to a true clock in adjusted_mode Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 032/113] serial: imx: fix locking in set_termios() Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 033/113] tty: serial_core: Set port active bit in uart_port_activate Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 034/113] usb: gadget: Zero ffs_io_data Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 035/113] mmc: sdhci: sdhci-pci-o2micro: Check if controller supports 8-bit width Greg Kroah-Hartman
2019-07-29 19:22 ` Greg Kroah-Hartman [this message]
2019-07-29 19:22 ` [PATCH 4.19 037/113] drm/msm: Depopulate platform on probe failure Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 038/113] serial: mctrl_gpio: Check if GPIO property exisits before requesting it Greg Kroah-Hartman
2019-07-31 18:19   ` Pavel Machek
2019-07-29 19:22 ` [PATCH 4.19 039/113] PCI: sysfs: Ignore lockdep for remove attribute Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 040/113] i2c: stm32f7: fix the get_irq error cases Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 041/113] kbuild: Add -Werror=unknown-warning-option to CLANG_FLAGS Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 042/113] genksyms: Teach parser about 128-bit built-in types Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 043/113] PCI: xilinx-nwl: Fix Multi MSI data programming Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 044/113] iio: iio-utils: Fix possible incorrect mask calculation Greg Kroah-Hartman
2019-07-30 18:51   ` Pavel Machek
2019-07-29 19:22 ` [PATCH 4.19 045/113] powerpc/cacheflush: fix variable set but not used Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 046/113] powerpc/xmon: Fix disabling tracing while in xmon Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 047/113] recordmcount: Fix spurious mcount entries on powerpc Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 048/113] mfd: madera: Add missing of table registration Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 049/113] mfd: core: Set fwnode for created devices Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 050/113] mfd: arizona: Fix undefined behavior Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 051/113] mfd: hi655x-pmic: Fix missing return value check for devm_regmap_init_mmio_clk Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 052/113] mm/swap: fix release_pages() when releasing devmap pages Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 053/113] um: Silence lockdep complaint about mmap_sem Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 054/113] powerpc/4xx/uic: clear pending interrupt after irq type/pol change Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 055/113] RDMA/i40iw: Set queue pair state when being queried Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 056/113] serial: sh-sci: Terminate TX DMA during buffer flushing Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 057/113] serial: sh-sci: Fix TX DMA buffer flushing and workqueue races Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 058/113] IB/mlx5: Fixed reporting counters on 2nd port for Dual port RoCE Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 059/113] powerpc/mm: Handle page table allocation failures Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 060/113] IB/ipoib: Add child to parent list only if device initialized Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 061/113] arm64: assembler: Switch ESB-instruction with a vanilla nop if !ARM64_HAS_RAS Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 062/113] PCI: mobiveil: Fix PCI base address in MEM/IO outbound windows Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 063/113] PCI: mobiveil: Fix the Class Code field Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 064/113] kallsyms: exclude kasan local symbols on s390 Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 065/113] PCI: mobiveil: Initialize Primary/Secondary/Subordinate bus numbers Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 066/113] PCI: mobiveil: Use the 1st inbound window for MEM inbound transactions Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 067/113] perf test mmap-thread-lookup: Initialize variable to suppress memory sanitizer warning Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 068/113] perf stat: Fix use-after-freed pointer detected by the smatch tool Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 069/113] perf top: Fix potential NULL pointer dereference " Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 070/113] perf session: Fix potential NULL pointer dereference found " Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 071/113] perf annotate: Fix dereferencing freed memory " Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 072/113] perf hists browser: Fix potential NULL pointer dereference " Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 073/113] RDMA/rxe: Fill in wc byte_len with IB_WC_RECV_RDMA_WITH_IMM Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 074/113] PCI: dwc: pci-dra7xx: Fix compilation when !CONFIG_GPIOLIB Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 075/113] powerpc/boot: add {get, put}_unaligned_be32 to xz_config.h Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 076/113] block: init flush rq ref count to 1 Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 077/113] f2fs: avoid out-of-range memory access Greg Kroah-Hartman
2019-07-31 19:11   ` Pavel Machek
2019-08-01  1:19     ` Chao Yu
2019-07-29 19:22 ` [PATCH 4.19 078/113] mailbox: handle failed named mailbox channel request Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 079/113] dlm: check if workqueues are NULL before flushing/destroying Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 080/113] powerpc/eeh: Handle hugepages in ioremap space Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 081/113] block/bio-integrity: fix a memory leak bug Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 082/113] sh: prevent warnings when using iounmap Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 083/113] mm/kmemleak.c: fix check for softirq context Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 084/113] 9p: pass the correct prototype to read_cache_page Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 085/113] mm/gup.c: mark undo_dev_pagemap as __maybe_unused Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 086/113] mm/gup.c: remove some BUG_ONs from get_gate_page() Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 087/113] memcg, fsnotify: no oom-kill for remote memcg charging Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 088/113] mm/mmu_notifier: use hlist_add_head_rcu() Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 089/113] proc: use down_read_killable mmap_sem for /proc/pid/smaps_rollup Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 090/113] proc: use down_read_killable mmap_sem for /proc/pid/pagemap Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 091/113] proc: use down_read_killable mmap_sem for /proc/pid/clear_refs Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 092/113] proc: use down_read_killable mmap_sem for /proc/pid/map_files Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 093/113] cxgb4: reduce kernel stack usage in cudbg_collect_mem_region() Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 094/113] proc: use down_read_killable mmap_sem for /proc/pid/maps Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 095/113] locking/lockdep: Fix lock used or unused stats error Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 096/113] mm: use down_read_killable for locking mmap_sem in access_remote_vm Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 097/113] locking/lockdep: Hide unused class variable Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 098/113] usb: wusbcore: fix unbalanced get/put cluster_id Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 099/113] usb: pci-quirks: Correct AMD PLL quirk detection Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 100/113] btrfs: inode: Dont compress if NODATASUM or NODATACOW set Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 101/113] x86/sysfb_efi: Add quirks for some devices with swapped width and height Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 102/113] x86/speculation/mds: Apply more accurate check on hypervisor platform Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 103/113] binder: prevent transactions to context manager from its own process Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 104/113] fpga-manager: altera-ps-spi: Fix build error Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 105/113] mei: me: add mule creek canyon (EHL) device ids Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 106/113] hpet: Fix division by zero in hpet_time_div() Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 107/113] ALSA: ac97: Fix double free of ac97_codec_device Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 108/113] ALSA: line6: Fix wrong altsetting for LINE6_PODHD500_1 Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 109/113] ALSA: hda - Add a conexant codec entry to let mute led work Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 110/113] powerpc/xive: Fix loop exit-condition in xive_find_target_in_mask() Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 111/113] powerpc/tm: Fix oops on sigreturn on systems without TM Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 112/113] libnvdimm/bus: Stop holding nvdimm_bus_list_mutex over __nd_ioctl() Greg Kroah-Hartman
2019-07-31 18:14   ` Pavel Machek
2019-07-31 19:31     ` Dan Williams
2019-08-01  8:47       ` Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 113/113] access: avoid the RCU grace period for the temporary subjective credentials Greg Kroah-Hartman
2019-07-30  2:34 ` [PATCH 4.19 000/113] 4.19.63-stable review kernelci.org bot
2019-07-30  9:11 ` Naresh Kamboju
2019-07-30 14:00 ` shuah
2019-07-30 18:42 ` Guenter Roeck
2019-07-31  5:30 ` Kelsey Skunberg
2019-07-31  9:35 ` Jon Hunter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190729190704.397050441@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=aik@ozlabs.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpe@ellerman.id.au \
    --cc=oohall@gmail.com \
    --cc=sashal@kernel.org \
    --cc=sbobroff@linux.ibm.com \
    --cc=shawn@anastas.io \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).