Re: [PATCH] ASoC: fsl_esai: Add spin lock to protect reset and stop

2019-10-24 Thread S.j. Wang
Hi > > On Wed, Oct 23, 2019 at 03:29:49PM +0800, Shengjiu Wang wrote: > > xrun may happen at the end of stream, the > > trigger->fsl_esai_trigger_stop maybe called in the middle of > > fsl_esai_hw_reset, this may cause esai in wrong state after stop, and > > there may be endless xrun interrupt.

Re: [PATCH V7] mm/debug: Add tests validating architecture page table helpers

2019-10-24 Thread Qian Cai
> On Oct 24, 2019, at 11:45 PM, Anshuman Khandual > wrote: > > Nothing specific. But just tested this with x86 defconfig with relevant > configs > which are required for this test. Not sure if it involved W=1. No, it will not. It needs to run like, make W=1 -j 64 2>/tmp/warns

Re: [PATCH] ASoC: fsl_asrc: refine the setting of internal clock divider

2019-10-24 Thread S.j. Wang
Hi > > On Wed, Oct 23, 2019 at 06:25:20AM +, S.j. Wang wrote: > > > On Thu, Oct 17, 2019 at 02:21:08PM +0800, Shengjiu Wang wrote: > > > > For P2P output, the output divider should align with the output > > > > sample > > > > > > I think we should avoid "P2P" (or "M2M") keyword in the

[PATCH] ASoC: fsl: fsl_dma: fix build failure

2019-10-24 Thread Michael Ellerman
Commit 4ac85de9977e ("ASoC: fsl: fsl_dma: remove snd_pcm_ops") removed fsl_dma_ops but left a usage, leading to a build error for some configs, eg. mpc85xx_defconfig: sound/soc/fsl/fsl_dma.c: In function ‘fsl_soc_dma_probe’: sound/soc/fsl/fsl_dma.c:905:18: error: ‘fsl_dma_ops’ undeclared

[PATCH 10/10] ocxl: Conditionally bind SCM devices to the generic OCXL driver

2019-10-24 Thread Alastair D'Silva
From: Alastair D'Silva This patch allows the user to bind OpenCAPI SCM devices to the generic OCXL driver. Signed-off-by: Alastair D'Silva --- drivers/misc/ocxl/Kconfig | 7 +++ drivers/misc/ocxl/pci.c | 3 +++ 2 files changed, 10 insertions(+) diff --git a/drivers/misc/ocxl/Kconfig

[PATCH 09/10] powerpc: Enable OpenCAPI Storage Class Memory driver on bare metal

2019-10-24 Thread Alastair D'Silva
From: Alastair D'Silva Enable OpenCAPI Storage Class Memory driver on bare metal Signed-off-by: Alastair D'Silva --- arch/powerpc/configs/powernv_defconfig | 4 1 file changed, 4 insertions(+) diff --git a/arch/powerpc/configs/powernv_defconfig b/arch/powerpc/configs/powernv_defconfig

[PATCH 08/10] nvdimm: Add driver for OpenCAPI Storage Class Memory

2019-10-24 Thread Alastair D'Silva
From: Alastair D'Silva This driver exposes LPC memory on OpenCAPI SCM cards as an NVDIMM, allowing the existing nvram infrastructure to be used. Signed-off-by: Alastair D'Silva --- drivers/nvdimm/Kconfig | 17 + drivers/nvdimm/Makefile|3 +

[PATCH 07/10] ocxl: Save the device serial number in ocxl_fn

2019-10-24 Thread Alastair D'Silva
From: Alastair D'Silva This patch retrieves the serial number of the card and makes it available to consumers of the ocxl driver via the ocxl_fn struct. Signed-off-by: Alastair D'Silva --- drivers/misc/ocxl/config.c | 46 ++ include/misc/ocxl.h| 1

[PATCH 06/10] ocxl: Add functions to map/unmap LPC memory

2019-10-24 Thread Alastair D'Silva
From: Alastair D'Silva Add functions to map/unmap LPC memory Signed-off-by: Alastair D'Silva --- drivers/misc/ocxl/config.c| 4 +++ drivers/misc/ocxl/core.c | 50 +++ drivers/misc/ocxl/ocxl_internal.h | 3 ++ include/misc/ocxl.h |

[PATCH 05/10] ocxl: Tally up the LPC memory on a link & allow it to be mapped

2019-10-24 Thread Alastair D'Silva
From: Alastair D'Silva Tally up the LPC memory on an OpenCAPI link & allow it to be mapped Signed-off-by: Alastair D'Silva --- drivers/misc/ocxl/core.c | 10 ++ drivers/misc/ocxl/link.c | 60 +++ drivers/misc/ocxl/ocxl_internal.h | 33

[PATCH 04/10] powerpc: Map & release OpenCAPI LPC memory

2019-10-24 Thread Alastair D'Silva
From: Alastair D'Silva This patch adds platform support to map & release LPC memory. Signed-off-by: Alastair D'Silva --- arch/powerpc/include/asm/pnv-ocxl.h | 2 ++ arch/powerpc/platforms/powernv/ocxl.c | 41 +++ include/linux/memory_hotplug.h| 5

[PATCH 03/10] powerpc: Add OPAL calls for LPC memory alloc/release

2019-10-24 Thread Alastair D'Silva
From: Alastair D'Silva Add OPAL calls for LPC memory alloc/release Signed-off-by: Alastair D'Silva Acked-by: Andrew Donnellan --- arch/powerpc/include/asm/opal-api.h| 2 ++ arch/powerpc/include/asm/opal.h| 3 +++ arch/powerpc/platforms/powernv/opal-call.c | 2 ++ 3 files

[PATCH 02/10] nvdimm: remove prototypes for nonexistent functions

2019-10-24 Thread Alastair D'Silva
From: Alastair D'Silva These functions don't exist, so remove the prototypes for them. Signed-off-by: Alastair D'Silva --- drivers/nvdimm/nd-core.h | 4 1 file changed, 4 deletions(-) diff --git a/drivers/nvdimm/nd-core.h b/drivers/nvdimm/nd-core.h index 25fa121104d0..9f121a6aeb02

[PATCH 01/10] memory_hotplug: Add a bounds check to __add_pages

2019-10-24 Thread Alastair D'Silva
From: Alastair D'Silva On PowerPC, the address ranges allocated to OpenCAPI LPC memory are allocated from firmware. These address ranges may be higher than what older kernels permit, as we increased the maximum permissable address in commit 4ffe713b7587 ("powerpc/mm: Increase the max addressable

[PATCH 00/10] Add support for OpenCAPI SCM devices

2019-10-24 Thread Alastair D'Silva
From: Alastair D'Silva This series adds support for OpenCAPI SCM devices, exposing them as nvdimms so that we can make use of the existing infrastructure. The first patch (in memory_hotplug) has reviews/acks, but has not yet made it upstream. Alastair D'Silva (10): memory_hotplug: Add a

Re: [PATCH V7] mm/debug: Add tests validating architecture page table helpers

2019-10-24 Thread Anshuman Khandual
On 10/24/2019 10:21 PM, Qian Cai wrote: > > >> On Oct 24, 2019, at 10:50 AM, Anshuman Khandual >> wrote: >> >> Changes in V7: >> >> - Memory allocation and free routines for mapped pages have been droped >> - Mapped pfns are derived from standard kernel text symbol per Matthew >> - Moved

RE: [PATCH v7 2/3] Documentation: dt: binding: fsl: Add 'little-endian' and update Chassis define

2019-10-24 Thread Ran Wang
Hi Scott, On Friday, October 25, 2019 02:34, Scott Wood wrote > > On Mon, 2019-10-21 at 11:49 +0800, Ran Wang wrote: > > By default, QorIQ SoC's RCPM register block is Big Endian. But there > > are some exceptions, such as LS1088A and LS2088A, are Little Endian. > > So add this optional property

Re: [PATCH v6 20/30] powerpc/pci: Fix crash with enabled movable BARs

2019-10-24 Thread Alexey Kardashevskiy
On 25/10/2019 04:12, Sergey Miroshnichenko wrote: > Add a check for the UNSET resource flag to skip the released BARs Where/why does it crash exactly? It is not extremely clear from the code. Thanks, > > CC: Alexey Kardashevskiy > CC: Oliver O'Halloran > CC: Sam Bobroff > Signed-off-by:

[PATCH v5 4/4] powerpc: load firmware trusted keys/hashes into kernel keyring

2019-10-24 Thread Nayna Jain
The keys used to verify the Host OS kernel are managed by firmware as secure variables. This patch loads the verification keys into the .platform keyring and revocation hashes into .blacklist keyring. This enables verification and loading of the kernels signed by the boot time keys which are

[PATCH v5 3/4] x86/efi: move common keyring handler functions to new file

2019-10-24 Thread Nayna Jain
The handlers to add the keys to the .platform keyring and blacklisted hashes to the .blacklist keyring is common for both the uefi and powerpc mechanisms of loading the keys/hashes from the firmware. This patch moves the common code from load_uefi.c to keyring_handler.c Signed-off-by: Nayna Jain

[PATCH v5 2/4] powerpc: expose secure variables to userspace via sysfs

2019-10-24 Thread Nayna Jain
PowerNV secure variables, which store the keys used for OS kernel verification, are managed by the firmware. These secure variables need to be accessed by the userspace for addition/deletion of the certificates. This patch adds the sysfs interface to expose secure variables for PowerNV

[PATCH v5 1/4] powerpc/powernv: Add OPAL API interface to access secure variable

2019-10-24 Thread Nayna Jain
The X.509 certificates trusted by the platform and required to secure boot the OS kernel are wrapped in secure variables, which are controlled by OPAL. This patch adds firmware/kernel interface to read and write OPAL secure variables based on the unique key. This support can be enabled using

[PATCH v5 0/4] powerpc: expose secure variables to the kernel and userspace

2019-10-24 Thread Nayna Jain
In order to verify the OS kernel on PowerNV systems, secure boot requires X.509 certificates trusted by the platform. These are stored in secure variables controlled by OPAL, called OPAL secure variables. In order to enable users to manage the keys, the secure variables need to be exposed to

Re: [PATCH] powerpc/boot: Fix the initrd being overwritten under qemu

2019-10-24 Thread Alexey Kardashevskiy
On 25/10/2019 04:45, Segher Boessenkool wrote: > On Thu, Oct 24, 2019 at 12:31:24PM +1100, Alexey Kardashevskiy wrote: >> >> >> On 23/10/2019 22:21, Segher Boessenkool wrote: >>> On Wed, Oct 23, 2019 at 12:36:35PM +1100, Oliver O'Halloran wrote: When booting under OF the zImage expects the

Re: [PATCH 0/7] towards QE support on ARM

2019-10-24 Thread Li Yang
On Tue, Oct 22, 2019 at 9:54 PM Qiang Zhao wrote: > > On 22/10/2019 18:18, Rasmus Villemoes wrote: > > -Original Message- > > From: Rasmus Villemoes > > Sent: 2019年10月22日 18:18 > > To: Qiang Zhao ; Leo Li > > Cc: Timur Tabi ; Greg Kroah-Hartman > > ; linux-ker...@vger.kernel.org; > >

Re: [PATCH v9 7/8] ima: check against blacklisted hashes for files with modsig

2019-10-24 Thread Lakshmi Ramasubramanian
On 10/23/2019 8:47 PM, Nayna Jain wrote: +/* + * ima_check_blacklist - determine if the binary is blacklisted. + * + * Add the hash of the blacklisted binary to the measurement list, based + * on policy. + * + * Returns -EPERM if the hash is blacklisted. + */ +int ima_check_blacklist(struct

Re: [PATCH 1/2] asm-generic: Make msi.h a mandatory include/asm header

2019-10-24 Thread Paul Walmsley
On Thu, 24 Oct 2019, Michal Simek wrote: > msi.h is generic for all architectures expect of x86 which has own version. > Enabling MSI by including msi.h to architecture Kbuild is just additional > step which doesn't need to be done. > The patch was created based on request to enable MSI for

Re: [PATCH RFC v1 00/12] mm: Don't mark hotplugged pages PG_reserved (including ZONE_DEVICE)

2019-10-24 Thread David Hildenbrand
On 23.10.19 09:26, David Hildenbrand wrote: On 22.10.19 23:54, Dan Williams wrote: Hi David, Thanks for tackling this! Thanks for having a look :) [...] I am probably a little bit too careful (but I don't want to break things). In most places (besides KVM and vfio that are nuts), the

[PATCH v1 10/10] mm/usercopy.c: Update comment in check_page_span() regarding ZONE_DEVICE

2019-10-24 Thread David Hildenbrand
ZONE_DEVICE (a.k.a. device memory) is no longer marked PG_reserved. Update the comment. While at it, make it match what the code is acutally doing (reject vs. accept). Cc: Kees Cook Cc: Andrew Morton Cc: "Isaac J. Manjarres" Cc: "Matthew Wilcox (Oracle)" Cc: Qian Cai Cc: Thomas Gleixner

[PATCH v1 09/10] mm/memory_hotplug: Don't mark pages PG_reserved when initializing the memmap

2019-10-24 Thread David Hildenbrand
Everything should be prepared to stop setting pages PG_reserved when initializing the memmap on memory hotplug. Most importantly, we stop marking ZONE_DEVICE pages PG_reserved. a) We made sure that any code that relied on PG_reserved to detect ZONE_DEVICE memory will no longer rely on

[PATCH v1 08/10] x86/mm: Prepare __ioremap_check_ram() for PG_reserved changes

2019-10-24 Thread David Hildenbrand
Right now, ZONE_DEVICE memory is always set PG_reserved. We want to change that. Rewrite __ioremap_check_ram() to make sure the function produces the same result once we stop setting ZONE_DEVICE pages PG_reserved. Cc: Dave Hansen Cc: Andy Lutomirski Cc: Peter Zijlstra Cc: Thomas Gleixner Cc:

[PATCH v1 07/10] powerpc/mm: Prepare maybe_pte_to_page() for PG_reserved changes

2019-10-24 Thread David Hildenbrand
Right now, ZONE_DEVICE memory is always set PG_reserved. We want to change that. Rewrite maybe_pte_to_page() to make sure the function produces the same result once we stop setting ZONE_DEVICE pages PG_reserved. Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: Christophe

[PATCH v1 06/10] powerpc/64s: Prepare hash_page_do_lazy_icache() for PG_reserved changes

2019-10-24 Thread David Hildenbrand
Right now, ZONE_DEVICE memory is always set PG_reserved. We want to change that. Rewrite hash_page_do_lazy_icache() to make sure the function produces the same result once we stop setting ZONE_DEVICE pages PG_reserved. Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc:

[PATCH v1 05/10] powerpc/book3s: Prepare kvmppc_book3s_instantiate_page() for PG_reserved changes

2019-10-24 Thread David Hildenbrand
Right now, ZONE_DEVICE memory is always set PG_reserved. We want to change that. KVM has this weird use case that you can map anything from /dev/mem into the guest. pfn_valid() is not a reliable check whether the memmap was initialized and can be touched. pfn_to_online_page() makes sure that we

[PATCH v1 04/10] vfio/type1: Prepare is_invalid_reserved_pfn() for PG_reserved changes

2019-10-24 Thread David Hildenbrand
Right now, ZONE_DEVICE memory is always set PG_reserved. We want to change that. KVM has this weird use case that you can map anything from /dev/mem into the guest. pfn_valid() is not a reliable check whether the memmap was initialized and can be touched. pfn_to_online_page() makes sure that we

[PATCH v1 03/10] KVM: Prepare kvm_is_reserved_pfn() for PG_reserved changes

2019-10-24 Thread David Hildenbrand
Right now, ZONE_DEVICE memory is always set PG_reserved. We want to change that. KVM has this weird use case that you can map anything from /dev/mem into the guest. pfn_valid() is not a reliable check whether the memmap was initialized and can be touched. pfn_to_online_page() makes sure that we

Re: [PATCH v9 4/8] powerpc/ima: define trusted boot policy

2019-10-24 Thread Lakshmi Ramasubramanian
On 10/23/2019 8:47 PM, Nayna Jain wrote: +/* + * The "secure_and_trusted_rules" contains rules for both the secure boot and + * trusted boot. The "template=ima-modsig" option includes the appended + * signature, when available, in the IMA measurement list. + */ +static const char *const

Re: [PATCH v9 3/8] powerpc: detect the trusted boot state of the system

2019-10-24 Thread Lakshmi Ramasubramanian
On 10/23/2019 8:47 PM, Nayna Jain wrote: +bool is_ppc_trustedboot_enabled(void) +{ + struct device_node *node; + bool enabled = false; + + node = get_ppc_fw_sb_node(); + enabled = of_property_read_bool(node, "trusted-enabled"); Can get_ppc_fw_sb_node return NULL? Would

Re: [PATCH v9 2/8] powerpc/ima: add support to initialize ima policy rules

2019-10-24 Thread Lakshmi Ramasubramanian
On 10/23/2019 8:47 PM, Nayna Jain wrote: +/* + * The "secure_rules" are enabled only on "secureboot" enabled systems. + * These rules verify the file signatures against known good values. + * The "appraise_type=imasig|modsig" option allows the known good signature + * to be stored as an xattr

Re: [PATCH v9 1/8] powerpc: detect the secure boot mode of the system

2019-10-24 Thread Lakshmi Ramasubramanian
On 10/23/2019 8:47 PM, Nayna Jain wrote: This patch defines a function to detect the secure boot state of a PowerNV system. +bool is_ppc_secureboot_enabled(void) +{ + struct device_node *node; + bool enabled = false; + + node = of_find_compatible_node(NULL, NULL,

Re: [PATCH v9 5/8] ima: make process_buffer_measurement() generic

2019-10-24 Thread Lakshmi Ramasubramanian
On 10/23/19 8:47 PM, Nayna Jain wrote: Hi Nayna, +void process_buffer_measurement(const void *buf, int size, + const char *eventname, enum ima_hooks func, + int pcr) { int ret = 0; struct ima_template_entry *entry =

[PATCH v1 02/10] KVM: x86/mmu: Prepare kvm_is_mmio_pfn() for PG_reserved changes

2019-10-24 Thread David Hildenbrand
Right now, ZONE_DEVICE memory is always set PG_reserved. We want to change that. KVM has this weird use case that you can map anything from /dev/mem into the guest. pfn_valid() is not a reliable check whether the memmap was initialized and can be touched. pfn_to_online_page() makes sure that we

[PATCH v1 01/10] mm/memory_hotplug: Don't allow to online/offline memory blocks with holes

2019-10-24 Thread David Hildenbrand
Our onlining/offlining code is unnecessarily complicated. Only memory blocks added during boot can have holes (a range that is not IORESOURCE_SYSTEM_RAM). Hotplugged memory never has holes (e.g., see add_memory_resource()). All boot memory is alread online. Therefore, when we stop allowing to

[PATCH v1 00/10] mm: Don't mark hotplugged pages PG_reserved (including ZONE_DEVICE)

2019-10-24 Thread David Hildenbrand
This is the result of a recent discussion with Michal ([1], [2]). Right now we set all pages PG_reserved when initializing hotplugged memmaps. This includes ZONE_DEVICE memory. In case of system memory, PG_reserved is cleared again when onlining the memory, in case of ZONE_DEVICE memory never. In

Re: [PATCH v7 2/3] Documentation: dt: binding: fsl: Add 'little-endian' and update Chassis define

2019-10-24 Thread Scott Wood
On Mon, 2019-10-21 at 11:49 +0800, Ran Wang wrote: > By default, QorIQ SoC's RCPM register block is Big Endian. But > there are some exceptions, such as LS1088A and LS2088A, are > Little Endian. So add this optional property to help identify > them. > > Actually LS2021A and other Layerscapes

Re: [PATCH] powerpc/boot: Fix the initrd being overwritten under qemu

2019-10-24 Thread Segher Boessenkool
On Thu, Oct 24, 2019 at 12:31:24PM +1100, Alexey Kardashevskiy wrote: > > > On 23/10/2019 22:21, Segher Boessenkool wrote: > > On Wed, Oct 23, 2019 at 12:36:35PM +1100, Oliver O'Halloran wrote: > >> When booting under OF the zImage expects the initrd address and size to be > >> passed to it

Re: [PATCH] powerpc/tools: Don't quote $objdump in scripts

2019-10-24 Thread Segher Boessenkool
On Thu, Oct 24, 2019 at 11:47:30AM +1100, Michael Ellerman wrote: > Some of our scripts are passed $objdump and then call it as > "$objdump". This doesn't work if it contains spaces because we're > using ccache, for example you get errors such as: > > ./arch/powerpc/tools/relocs_check.sh: line

[PATCH RFC 11/11] PCI: hotplug: movable bus numbers: compact the gaps in numbering

2019-10-24 Thread Sergey Miroshnichenko
If bus numbers are distributed sparsely and there are lot of devices in the tree, hotplugging a bridge into the end of the tree may fail even if it has less slots then the total number of unused bus numbers. Thus, the feature of bus renaming relies on the continuity of bus numbers, so if a bridge

[PATCH RFC 10/11] PCI: hotplug: movable bus numbers: rename proc and sysfs entries

2019-10-24 Thread Sergey Miroshnichenko
Changing the number of a bus (therefore changing addresses of this bus, of its children and all the buses next in the tree) invalidates entries in /sys/devices/pci*, /proc/bus/pci/* and symlinks in /sys/bus/pci/devices/* for all the renamed devices and buses. Remove the affected proc and sysfs

[PATCH RFC 09/11] PCI: hotplug: Add initial support for movable bus numbers

2019-10-24 Thread Sergey Miroshnichenko
Currently, hot-adding a bridge requires enough bus numbers to be reserved on the slot. Choosing a favorable number of reserved buses per slot is relatively simple for predictable cases, but it gets trickier when bridges can be hot-plugged into hot-plugged bridges: there may be either not enough

[PATCH RFC 06/11] powerpc/pci: Enable assigning bus numbers instead of reading them from DT

2019-10-24 Thread Sergey Miroshnichenko
If the firmware indicates support of reassigning bus numbers via the PHB's "ibm,supported-movable-bdfs" property in DT, PowerNV will not depend on PCI topology info from DT anymore. This makes possible to re-enumerate the fabric, assign the new bus numbers and switch from the pnv_php module to

[PATCH RFC 08/11] PCI: Allow expanding the bridges

2019-10-24 Thread Sergey Miroshnichenko
When hotplugging a bridge, the parent bus may not have [enough] reserved bus numbers. So before rescanning the bus, set its subordinate number to the maximum possible value: it is 255 when there is only one root bridge in the domain. During the PCI rescan, the subordinate bus number of every bus

[PATCH RFC 05/11] drivers: base: Add bus_disconnect_device()

2019-10-24 Thread Sergey Miroshnichenko
Add bus_disconnect_device(), which is similar to bus_remove_device(), but it doesn't detach the device from its driver, so it can be reconnected to the same or another bus later. This is a yet another preparation to hotplugging large PCIe bridges, which may entail changes in BDF addresses of

[PATCH RFC 07/11] powerpc/pci: Don't reduce the host bridge bus range

2019-10-24 Thread Sergey Miroshnichenko
Currently the last possible bus number of the PHB is set to the last used bus number during the boot. So when hotplugging a bridge later, no new buses can be allocated because they are limited by this value. Let the host bridge contain any number of buses up to 255. Signed-off-by: Sergey

[PATCH RFC 04/11] drivers: base: Make device_{add|remove}_class_symlinks() public

2019-10-24 Thread Sergey Miroshnichenko
When updating the /sys/devices/pci* entries affected by changes in the PCI topology, their symlinks in /sys/bus/pci/devices/* must also be rebuilt. Moving device_add_class_symlinks() and device_remove_class_symlinks() to a public API allows the PCI subsystem to update the sysfs without destroying

[PATCH RFC 03/11] drivers: base: Make bus_add_device() public

2019-10-24 Thread Sergey Miroshnichenko
Move the bus_add_device() to a public API, so it can be applied to devices which are temporarily detached from their buses without being destroyed. This will be used after changes in PCI topology after hotplugging a bridge: buses may get their numbers changed, so their child devices must be

[PATCH RFC 02/11] PCI: proc: Nullify a freed pointer

2019-10-24 Thread Sergey Miroshnichenko
A PCI device may be detached from /proc/bus/pci/devices not only when it is removed, but also when its bus had changed the number - in this case the proc entry must be recreated to reflect the new PCI topology. Nullify freed pointers to mark them as valid for allocating again. Signed-off-by:

[PATCH RFC 01/11] PCI: sysfs: Nullify freed pointers

2019-10-24 Thread Sergey Miroshnichenko
After hotplugging a bridge the PCI topology will be changed: buses may have their numbers changed. In this case all the affected sysfs entries/symlinks must be recreated, because they have BDF address in their names. Set the freed pointers to NULL, so the !NULL checks will be satisfied when its

[PATCH RFC 00/11] PCI: hotplug: Movable bus numbers

2019-10-24 Thread Sergey Miroshnichenko
To allow hotplugging bridges, the kernel or BIOS/bootloader/firmware add extra bus numbers per slot, but this range may be not enough for a large bridge and/or nested bridges when hot-adding a chassis full of devices. This patchset proposes an approach similar to movable BARs: bus numbers are not

[PATCH v6 29/30] PCI: pciehp: movable BARs: Trigger a domain rescan on hp events

2019-10-24 Thread Sergey Miroshnichenko
With movable BARs, adding a hotplugged device is not local to its bridge anymore, but it affects the whole domain: BARs, bridge windows and bus numbers can be substantially rearranged. So instead of trying to fit the new devices into preallocated reserved gaps, initiate a full domain rescan. The

[PATCH v6 30/30] Revert "powerpc/powernv/pci: Work around races in PCI bridge enabling"

2019-10-24 Thread Sergey Miroshnichenko
This reverts commit db2173198b9513f7add8009f225afa1f1c79bcc6. The root cause of this bug is fixed by the following two commits: 1. "PCI: Fix race condition in pci_enable/disable_device()" 2. "PCI: Enable bridge's I/O and MEM access for hotplugged devices" The x86 is also affected by this

[PATCH v6 27/30] nvme-pci: Handle movable BARs

2019-10-24 Thread Sergey Miroshnichenko
Hotplugged devices can affect the existing ones by moving their BARs. The PCI subsystem will inform the NVME driver about this by invoking the .rescan_prepare() and .rescan_done() hooks, so the BARs can by re-mapped. Tested under the "randrw" mode of the fio tool. Before the hotplugging: %

[PATCH v6 28/30] PCI/portdrv: Declare support of movable BARs

2019-10-24 Thread Sergey Miroshnichenko
Switch's BARs are not used by the portdrv driver, but they are still considered as immovable until the .rescan_prepare() and .rescan_done() hooks are added. Add these hooks to increase chances to allocate new BARs. Signed-off-by: Sergey Miroshnichenko --- drivers/pci/pcie/portdrv_pci.c | 11

[PATCH v6 26/30] PCI: hotplug: movable BARs: Enable the feature by default

2019-10-24 Thread Sergey Miroshnichenko
This is the last patch in the series which implements the essentials of the Movable BARs feature, so it is turned by default now. Tested on: - x86_64 with "pci=realloc,pcie_bus_peer2peer" command line argument; - POWER8 PowerNV+PHB3 ppc64le with "pci=realloc,pcie_bus_peer2peer". In case of

[PATCH v6 25/30] PNP: Don't reserve BARs for PCI when enabled movable BARs

2019-10-24 Thread Sergey Miroshnichenko
When the Movable BARs feature is supported, the PCI subsystem is able to distribute existing BARs and allocate the new ones itself, without need to reserve gaps by BIOS. CC: Rafael J. Wysocki Signed-off-by: Sergey Miroshnichenko --- drivers/pnp/system.c | 4 1 file changed, 4

[PATCH v6 23/30] powerpc/pci: hotplug: Add support for movable BARs

2019-10-24 Thread Sergey Miroshnichenko
Add pcibios_root_bus_rescan_prepare()/_done() hooks for the powerpc, so it can reassign the PE numbers (which depend on BAR sizes and locations) and update the EEH address cache during a PCI rescan. New PE numbers are assigned during pci_setup_bridges(root) after the rescan is done. CC: Oliver

[PATCH v6 24/30] powerpc/powernv/pci: Suppress an EEH error when reading an empty slot

2019-10-24 Thread Sergey Miroshnichenko
Reading an empty slot returns all ones, which triggers a false EEH error event on PowerNV. A rescan is performed after all the PEs have been unmapped, so the reserved PE index is used for unfreezing. CC: Oliver O'Halloran CC: Sam Bobroff Signed-off-by: Sergey Miroshnichenko ---

[PATCH v6 22/30] powerpc/pci: Create pci_dn on demand

2019-10-24 Thread Sergey Miroshnichenko
If a struct pci_dn hasn't yet been created for the PCIe device (there was no DT node for it), allocate this structure and fill with info read from the device directly. CC: Oliver O'Halloran CC: Sam Bobroff Signed-off-by: Sergey Miroshnichenko --- arch/powerpc/kernel/pci_dn.c | 88

[PATCH v6 21/30] powerpc/pci: Access PCI config space directly w/o pci_dn

2019-10-24 Thread Sergey Miroshnichenko
To fetch an updated DT for the newly hotplugged device, OS must explicitly request it from the firmware via the pnv_php driver. If pnv_php wasn't triggered/loaded, it is still possible to discover new devices if PCIe I/O will not stop in absence of the pci_dn structure. Reviewed-by: Oliver

[PATCH v6 20/30] powerpc/pci: Fix crash with enabled movable BARs

2019-10-24 Thread Sergey Miroshnichenko
Add a check for the UNSET resource flag to skip the released BARs CC: Alexey Kardashevskiy CC: Oliver O'Halloran CC: Sam Bobroff Signed-off-by: Sergey Miroshnichenko --- arch/powerpc/platforms/powernv/pci-ioda.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git

[PATCH v6 14/30] PCI: Make sure bridge windows include their fixed BARs

2019-10-24 Thread Sergey Miroshnichenko
When the time comes to select a start address for the bridge window during the root bus rescan, it should be not just a lowest possible address: this window must cover all the underlying fixed and immovable BARs. The lowest address that satisfies this requirement is the .realloc_range field of

[PATCH v6 16/30] PCI: hotplug: movable BARs: Assign fixed and immovable BARs before others

2019-10-24 Thread Sergey Miroshnichenko
Reassign resources during rescan in two steps: first the fixed/immovable BARs and bridge windows that have fixed areas, so the movable ones will not steal these reserved areas; then the rest - so the movable BARs will divide the rest of the space. With this change, pci_assign_resource() is now

[PATCH v6 19/30] PCI: hotplug: movable BARs: Ignore the MEM BAR offsets from bootloader

2019-10-24 Thread Sergey Miroshnichenko
BAR allocation by BIOS/UEFI/bootloader/firmware may be non-optimal and it may even clash with the kernel's BAR assignment algorithm. For example, if no space was reserved for SR-IOV BARs, and this bridge window is packed between immovable BARs (so it is unable to extend), and if this window can't

[PATCH v6 18/30] PCI: hotplug: Configure MPS for hot-added bridges during bus rescan

2019-10-24 Thread Sergey Miroshnichenko
Assure that MPS settings are set up for bridges which are discovered during manually triggered rescan via sysfs. This sequence of bridge init (using pci_rescan_bus()) will be used for pciehp hot-add events when BARs are movable. Signed-off-by: Sergey Miroshnichenko --- drivers/pci/probe.c | 5

[PATCH v6 17/30] PCI: hotplug: movable BARs: Don't reserve IO/mem bus space

2019-10-24 Thread Sergey Miroshnichenko
A hotplugged bridge with many hotplug-capable ports may request reserving more IO space than the machine has. This could be overridden with the "hpiosize=" kernel argument though. But when BARs are movable, there are no need to reserve space anymore: new BARs are allocated not from reserved gaps,

[PATCH v6 15/30] PCI: Fix assigning the fixed prefetchable resources

2019-10-24 Thread Sergey Miroshnichenko
Allow matching IORESOURCE_PCI_FIXED prefetchable BARs to non-prefetchable windows, so they follow the same rules as immovable BARs. Signed-off-by: Sergey Miroshnichenko --- drivers/pci/setup-bus.c | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) diff --git

[PATCH v6 13/30] PCI: hotplug: movable BARs: Compute limits for relocated bridge windows

2019-10-24 Thread Sergey Miroshnichenko
With enabled movable BARs, bridge windows are recalculated during each pci rescan. Some of the BARs below the bridge may be fixed/immovable: these areas are represented by the .immovable_range field in struct pci_bus. If a bridge window size is equal to its immovable range, it can only be

[PATCH v6 12/30] PCI: hotplug: movable BARs: Calculate immovable parts of bridge windows

2019-10-24 Thread Sergey Miroshnichenko
When movable BARs are enabled, and if a bridge contains a device with fixed (IORESOURCE_PCI_FIXED) or immovable BARs, the corresponing windows can't be moved too far away from their original positions - they must still contain all the fixed/immovable BARs, like that: 1) Window position before a

[PATCH v6 11/30] PCI: hotplug: movable BARs: Try to assign unassigned resources only once

2019-10-24 Thread Sergey Miroshnichenko
With enabled BAR movement, BARs and bridge windows can only be assigned to their direct parents, so there can be only one variant of resource tree, thus every retry within the pci_assign_unassigned_root_bus_resources() will result in the same tree, and it is enough to try just once. In case of

[PATCH v6 10/30] PCI: Prohibit assigning BARs and bridge windows to non-direct parents

2019-10-24 Thread Sergey Miroshnichenko
When movable BARs are enabled, the feature of resource relocating from commit 2bbc6942273b5 ("PCI : ability to relocate assigned pci-resources") is not used. Instead, inability to assign a resource is used as a signal to retry BAR assignment with other configuration of bridge windows.

[PATCH v6 09/30] PCI: Include fixed and immovable BARs into the bus size calculating

2019-10-24 Thread Sergey Miroshnichenko
The only difference between the fixed/immovable and movable BARs is a size and offset preservation after they are released (the corresponding struct resource* detached from a bridge window for a while during a bus rescan). Include fixed/immovable BARs into result of pbus_size_mem() and prohibit

[PATCH v6 06/30] PCI: hotplug: movable BARs: Recalculate all bridge windows during rescan

2019-10-24 Thread Sergey Miroshnichenko
When the movable BARs feature is enabled and a rescan has been requested, release all the bridge windows and recalculate them from scratch, taking into account all kinds for BARs: fixed, immovable, movable, new. This increases the chances to find a memory space to fit BARs for newly hotplugged

[PATCH v6 08/30] PCI: hotplug: movable BARs: Don't allow added devices to steal resources

2019-10-24 Thread Sergey Miroshnichenko
When movable BARs are enabled, the PCI subsystem at first releases all the bridge windows and then attempts to assign resources both to previously working devices and to the newly hotplugged ones, with the same priority. If a hotplugged device gets its BARs first, this may lead to lack of space

[PATCH v6 05/30] PCI: hotplug: movable BARs: Fix reassigning the released bridge windows

2019-10-24 Thread Sergey Miroshnichenko
When a bridge window is temporarily released during the rescan, its old size is not relevant anymore - it will be recreated from pbus_size_*(), so it's start value should be zero. If such window can't be reassigned, don't apply reset_resource(), so the next retry may succeed. Signed-off-by:

[PATCH v6 07/30] PCI: hotplug: movable BARs: Don't disable the released bridge windows

2019-10-24 Thread Sergey Miroshnichenko
On a hotplug event with enabled BAR movement, calculating the new bridge windows takes some time. During this procedure, the structures that represent these windows are released - marked for recalculation. When new bridge windows are ready, they are written to the registers of every bridge via

[PATCH v6 04/30] PCI: Define PCI-specific version of the release_child_resources()

2019-10-24 Thread Sergey Miroshnichenko
If release the bridge resources with standard release_child_resources(), it drops the .start field of children's BARs to zero, but with the STARTALIGN flag remaining set, which makes the resource invalid for reassignment. Some resources must preserve their offset and size: those marked with the

[PATCH v6 00/30] PCI: Allow BAR movement during hotplug

2019-10-24 Thread Sergey Miroshnichenko
Currently PCI hotplug works on top of resources, which are usually reserved not by the kernel, but by BIOS, bootloader, firmware, etc. These resources are gaps in the address space where BARs of new devices may fit, and extra bus number per port, so bridges can be hot-added. This series aim the

[PATCH v6 03/30] PCI: hotplug: Add a flag for the movable BARs feature

2019-10-24 Thread Sergey Miroshnichenko
When hot-adding a device, the bridge may have windows not big enough (or fragmented too much) for newly requested BARs to fit in. And expanding these bridge windows may be impossible because blocked by "neighboring" BARs and bridge windows. Still, it may be possible to allocate a memory region

[PATCH v6 02/30] PCI: Enable bridge's I/O and MEM access for hotplugged devices

2019-10-24 Thread Sergey Miroshnichenko
The PCI_COMMAND_IO and PCI_COMMAND_MEMORY bits of the bridge must be updated not only when enabling the bridge for the first time, but also if a hotplugged device requests these types of resources. Originally these bits were set by the pci_enable_device_flags() only, which exits early if the

[PATCH v6 01/30] PCI: Fix race condition in pci_enable/disable_device()

2019-10-24 Thread Sergey Miroshnichenko
This is a yet another approach to fix an old [1-2] concurrency issue, when: - two or more devices are being hot-added into a bridge which was initially empty; - a bridge with two or more devices is being hot-added; - during boot, if BIOS/bootloader/firmware doesn't pre-enable bridges. The

Re: [PATCH 0/2] Enabling MSI for Microblaze

2019-10-24 Thread Waiman Long
On 10/24/19 6:13 AM, Michal Simek wrote: > Hi, > > these two patches come from discussion with Christoph, Bjorn, Palmer and > Waiman. The first patch was suggestion by Christoph here > https://lore.kernel.org/linux-riscv/20191008154604.ga7...@infradead.org/ > The second part was discussed >

Re: [PATCH V7] mm/debug: Add tests validating architecture page table helpers

2019-10-24 Thread Qian Cai
> On Oct 24, 2019, at 10:50 AM, Anshuman Khandual > wrote: > > Changes in V7: > > - Memory allocation and free routines for mapped pages have been droped > - Mapped pfns are derived from standard kernel text symbol per Matthew > - Moved debug_vm_pgtaable() after page_alloc_init_late() per

[PATCH 03/34 v3] powerpc: Use CONFIG_PREEMPTION

2019-10-24 Thread Sebastian Andrzej Siewior
From: Thomas Gleixner CONFIG_PREEMPTION is selected by CONFIG_PREEMPT and by CONFIG_PREEMPT_RT. Both PREEMPT and PREEMPT_RT require the same functionality which today depends on CONFIG_PREEMPT. Switch the entry code over to use CONFIG_PREEMPTION. Cc: Benjamin Herrenschmidt Cc: Paul Mackerras

Re: [PATCH 0/2] vfio pci: Add support for OpenCAPI devices

2019-10-24 Thread Greg Kurz
Hi Christophe, Sorry, I didn't have time to look at your other series yet and likely the same for this one with the upcoming KVM Forum... :-\ Anyway, for any VFIO related patch, don't forget to Cc the maintainer, Alex Williamson . Cheers, -- Greg On Thu, 24 Oct 2019 15:28:03 +0200 christophe

Re: [PATCH 1/2] asm-generic: Make msi.h a mandatory include/asm header

2019-10-24 Thread Masahiro Yamada
On Thu, Oct 24, 2019 at 7:13 PM Michal Simek wrote: > > msi.h is generic for all architectures expect of x86 which has own version. Maybe a typo? "except" Anyway, the code looks good to me. Reviewed-by: Masahiro Yamada > Enabling MSI by including msi.h to architecture Kbuild is just

[PATCH 03/34 v2] powerpc: Use CONFIG_PREEMPTION

2019-10-24 Thread Sebastian Andrzej Siewior
From: Thomas Gleixner CONFIG_PREEMPTION is selected by CONFIG_PREEMPT and by CONFIG_PREEMPT_RT. Both PREEMPT and PREEMPT_RT require the same functionality which today depends on CONFIG_PREEMPT. Switch the entry code over to use CONFIG_PREEMPTION. Add PREEMPT_RT output in __die(). Cc: Benjamin

[PATCH 2/2] vfio/pci: Introduce OpenCAPI devices support.

2019-10-24 Thread christophe lombard
This patch adds new IOCTL commands for VFIO PCI driver to support configuration and management for OpenCAPI devices, which have been passed through from host to QEMU VFIO. OpenCAPI (Open Coherent Accelerator Processor Interface) is an interface between processors and accelerators. The main IOCTL

[PATCH 0/2] vfio pci: Add support for OpenCAPI devices

2019-10-24 Thread christophe lombard
This series adds support for the OpenCAPI devices for vfio pci. It builds on top of the existing ocxl driver + http://patchwork.ozlabs.org/patch/1177999/ VFIO is a Linux kernel driver framework used by QEMU to make devices directly assignable to virtual machines. All OpenCAPI devices on the

[PATCH 1/2] powerpc/powernv: Register IOMMU group for OpenCAPI devices

2019-10-24 Thread christophe lombard
This patch adds group registration for the OpenCAPI devices. An unique iommu group is register for multiple PE, ie for a set of multiple devices sharing the same domain, same bus and same slot. This groud registration will be used to assign an OpenCAPI device to a guest to participate in VFIO,

Re: [PATCH] powerpc/fadump: Remove duplicate message.

2019-10-24 Thread Michal Suchánek
On Thu, Oct 24, 2019 at 04:08:08PM +0530, Hari Bathini wrote: > > Michal, thanks for looking into this. > > On 23/10/19 11:26 PM, Michal Suchanek wrote: > > There is duplicate message about lack of support by firmware in > > fadump_reserve_mem and setup_fadump. Due to different capitalization it

  1   2   >