[v3, 7/9] fsl/fman: Add FMan SP support
From: Igal Liberman igal.liber...@freescale.com Add Storage Profiles support. The Storage Profiles contain parameters that are used by the FMan in order to store frames being received on the Rx ports, or to determine the parameters that affect writing the Internal Context in the frame margin on Tx. Signed-off-by: Igal Liberman igal.liber...@freescale.com --- drivers/net/ethernet/freescale/fman/Makefile |2 + drivers/net/ethernet/freescale/fman/fm_sp_common.h | 105 ++ drivers/net/ethernet/freescale/fman/sp/Makefile|3 + drivers/net/ethernet/freescale/fman/sp/fm_sp.c | 371 4 files changed, 481 insertions(+) create mode 100644 drivers/net/ethernet/freescale/fman/fm_sp_common.h create mode 100644 drivers/net/ethernet/freescale/fman/sp/Makefile create mode 100644 drivers/net/ethernet/freescale/fman/sp/fm_sp.c diff --git a/drivers/net/ethernet/freescale/fman/Makefile b/drivers/net/ethernet/freescale/fman/Makefile index f61d3a6..c6c3e24 100644 --- a/drivers/net/ethernet/freescale/fman/Makefile +++ b/drivers/net/ethernet/freescale/fman/Makefile @@ -8,3 +8,5 @@ fsl_fman-objs := fman.o fm_muram.o fm.o fm_drv.o obj-y += port/ obj-y += mac/ +obj-y += sp/ + diff --git a/drivers/net/ethernet/freescale/fman/fm_sp_common.h b/drivers/net/ethernet/freescale/fman/fm_sp_common.h new file mode 100644 index 000..56bd749 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/fm_sp_common.h @@ -0,0 +1,105 @@ +/* + * Copyright 2008-2015 Freescale Semiconductor Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Freescale Semiconductor nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License (GPL) as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* FM SP ... */ +#ifndef __FM_SP_COMMON_H +#define __FM_SP_COMMON_H + +#include fm_ext.h +#include fsl_fman.h + +#define ILLEGAL_BASE(~0) + +/* defaults */ +#define DEFAULT_FM_SP_BUFFER_PREFIX_CONTENT_PRIV_DATA_SIZE 0 +#define DEFAULT_FM_SP_BUFFER_PREFIX_CONTENT_PRIV_PASS_PRS_RESULT false +#define DEFAULT_FM_SP_BUFFER_PREFIX_CONTEXT_PASS_TIME_STAMP false +#define DEFAULT_FM_SP_BUFFER_PREFIX_CONTEXT_DATA_ALIGN 64 + +/* structure for defining internal context copying */ +struct fm_sp_int_context_data_copy_t { + /* Offset in External buffer to which internal +* context is copied to (Rx) or taken from (Tx, Op). +*/ + u16 ext_buf_offset; + /* Offset within internal context to copy from +* (Rx) or to copy to (Tx, Op). +*/ + u8 int_context_offset; + /* Internal offset size to be copied */ + u16 size; +}; + +/* struct for defining external buffer margins */ +struct fm_sp_buf_margins_t { + /* Number of bytes to be left at the beginning +* of the external buffer (must be divisible by 16) +*/ + u16 start_margins; + /* number of bytes to be left at the end +* of the external buffer(must be divisible by 16) +*/ + u16 end_margins; +}; + +struct fm_sp_buffer_offsets_t { + u32 data_offset; + u32 prs_result_offset; + u32 time_stamp_offset; + u32 hash_result_offset; +}; + +int fm_sp_build_buffer_structure(struct fm_sp_int_context_data_copy_t +*fm_port_int_context_data_copy, +struct fm_buffer_prefix_content_t +
Re: [PATCH V4 5/6] mm: mmap: Add mmap flag to request VM_LOCKONFAULT
On Wed, Jul 22, 2015 at 10:32:20AM -0400, Eric B Munson wrote: On Wed, 22 Jul 2015, Kirill A. Shutemov wrote: On Tue, Jul 21, 2015 at 03:59:40PM -0400, Eric B Munson wrote: The cost of faulting in all memory to be locked can be very high when working with large mappings. If only portions of the mapping will be used this can incur a high penalty for locking. Now that we have the new VMA flag for the locked but not present state, expose it as an mmap option like MAP_LOCKED - VM_LOCKED. What is advantage over mmap() + mlock(MLOCK_ONFAULT)? There isn't one, it was added to maintain parity with the mlock(MLOCK_LOCK) - mmap(MAP_LOCKED) set. I think not having will lead to confusion because we have MAP_LOCKED so why don't we support LOCKONFAULT from mmap as well. I don't think it's ia good idea to spend bits in flags unless we have a reason for that. BTW, you have typo on sparc: s/0x8000/0x8/. -- Kirill A. Shutemov ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 01/10] devres: add devm_alloc_percpu()
Introduce managed counterparts for alloc_percpu() and free_percpu(). Add devm_alloc_percpu() and devm_free_percpu() into the managed interfaces list. Signed-off-by: Madalin Bucur madalin.bu...@freescale.com --- Documentation/driver-model/devres.txt | 4 +++ drivers/base/devres.c | 64 +++ include/linux/device.h| 19 +++ 3 files changed, 87 insertions(+) diff --git a/Documentation/driver-model/devres.txt b/Documentation/driver-model/devres.txt index 831a536..595fd1b 100644 --- a/Documentation/driver-model/devres.txt +++ b/Documentation/driver-model/devres.txt @@ -312,6 +312,10 @@ MEM devm_kvasprintf() devm_kzalloc() +PER-CPU MEM + devm_alloc_percpu() + devm_free_percpu() + PCI pcim_enable_device() : after success, all PCI ops become managed pcim_pin_device(): keep PCI device enabled after release diff --git a/drivers/base/devres.c b/drivers/base/devres.c index c8a53d1..deb2ea0 100644 --- a/drivers/base/devres.c +++ b/drivers/base/devres.c @@ -10,6 +10,7 @@ #include linux/device.h #include linux/module.h #include linux/slab.h +#include linux/percpu.h #include base.h @@ -984,3 +985,66 @@ void devm_free_pages(struct device *dev, unsigned long addr) devres)); } EXPORT_SYMBOL_GPL(devm_free_pages); + +static void devm_percpu_release(struct device *dev, void *pdata) +{ + void __percpu *p; + + p = *(void __percpu **)pdata; + free_percpu(p); +} + +static int devm_percpu_match(struct device *dev, void *data, void *p) +{ + struct devres *devr = container_of(data, struct devres, data); + + return *(void **)devr-data == p; +} + +/** + * __devm_alloc_percpu - Resource-managed alloc_percpu + * @dev: Device to allocate per-cpu memory for + * @size: Size of per-cpu memory to allocate + * @align: Alignement of per-cpu memory to allocate + * + * Managed alloc_percpu. Per-cpu memory allocated with this function is + * automatically freed on driver detach. + * + * RETURNS: + * Pointer to allocated memory on success, NULL on failure. + */ +void __percpu *__devm_alloc_percpu(struct device *dev, size_t size, + size_t align) +{ + void *p; + void __percpu *pcpu; + + pcpu = __alloc_percpu(size, align); + if (!pcpu) + return NULL; + + p = devres_alloc(devm_percpu_release, sizeof(void *), GFP_KERNEL); + if (!p) + return NULL; + + *(void __percpu **)p = pcpu; + + devres_add(dev, p); + + return pcpu; +} +EXPORT_SYMBOL_GPL(__devm_alloc_percpu); + +/** + * devm_free_percpu - Resource-managed free_percpu + * @dev: Device this memory belongs to + * @pdata: Per-cpu memory to free + * + * Free memory allocated with devm_alloc_percpu(). + */ +void devm_free_percpu(struct device *dev, void __percpu *pdata) +{ + WARN_ON(devres_destroy(dev, devm_percpu_release, devm_percpu_match, + (void *)pdata)); +} +EXPORT_SYMBOL_GPL(devm_free_percpu); diff --git a/include/linux/device.h b/include/linux/device.h index 5a31bf3..f623b55 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -672,6 +672,25 @@ void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res); int devm_add_action(struct device *dev, void (*action)(void *), void *data); void devm_remove_action(struct device *dev, void (*action)(void *), void *data); +/** + * devm_alloc_percpu - Resource-managed alloc_percpu + * @dev: Device to allocate per-cpu memory for + * @type: Type to allocate per-cpu memory for + * + * Managed alloc_percpu. Per-cpu memory allocated with this function is + * automatically freed on driver detach. + * + * RETURNS: + * Pointer to allocated memory on success, NULL on failure. + */ +#define devm_alloc_percpu(dev, type) \ + (typeof(type) __percpu *)__devm_alloc_percpu(dev, sizeof(type), \ +__alignof__(type)) + +void __percpu *__devm_alloc_percpu(struct device *dev, size_t size, + size_t align); +void devm_free_percpu(struct device *dev, void __percpu *pdata); + struct device_dma_parameters { /* * a low level driver may set these to teach IOMMU code about -- 1.7.11.7 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 07/10] dpaa_eth: add sysfs exports
Export Frame Queue and Buffer Pool IDs through sysfs. Signed-off-by: Madalin Bucur madalin.bu...@freescale.com --- drivers/net/ethernet/freescale/dpaa/Makefile | 2 +- drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 2 + drivers/net/ethernet/freescale/dpaa/dpaa_eth.h | 3 + .../net/ethernet/freescale/dpaa/dpaa_eth_common.c | 2 + .../net/ethernet/freescale/dpaa/dpaa_eth_sysfs.c | 167 + 5 files changed, 175 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ethernet/freescale/dpaa/dpaa_eth_sysfs.c diff --git a/drivers/net/ethernet/freescale/dpaa/Makefile b/drivers/net/ethernet/freescale/dpaa/Makefile index e137146..3a276d5 100644 --- a/drivers/net/ethernet/freescale/dpaa/Makefile +++ b/drivers/net/ethernet/freescale/dpaa/Makefile @@ -10,4 +10,4 @@ ccflags-y += -I$(FMAN)/flib obj-$(CONFIG_FSL_DPAA_ETH) += fsl_dpa.o -fsl_dpa-objs += dpaa_eth.o dpaa_eth_sg.o dpaa_eth_common.o dpaa_ethtool.o +fsl_dpa-objs += dpaa_eth.o dpaa_eth_sg.o dpaa_eth_common.o dpaa_ethtool.o dpaa_eth_sysfs.o diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c index 3fbd114..dbd8a70 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c @@ -740,6 +740,8 @@ dpaa_eth_priv_probe(struct platform_device *pdev) if (err 0) goto netdev_init_failed; + dpaa_eth_sysfs_init(net_dev-dev); + pr_info(Probed interface %s\n, net_dev-name); return 0; diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h index cbe9626..7160eda 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h @@ -346,6 +346,9 @@ static inline u16 dpa_get_headroom(struct dpa_buffer_layout_s *bl) return bl-data_align ? ALIGN(headroom, bl-data_align) : headroom; } +void dpaa_eth_sysfs_remove(struct device *dev); +void dpaa_eth_sysfs_init(struct device *dev); + void dpa_private_napi_del(struct net_device *net_dev); static inline void clear_fd(struct qm_fd *fd) diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.c index aeb2baf..bcd4c4f 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.c @@ -285,6 +285,8 @@ int dpa_remove(struct platform_device *pdev) priv = netdev_priv(net_dev); + dpaa_eth_sysfs_remove(dev); + dev_set_drvdata(dev, NULL); unregister_netdev(net_dev); diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_sysfs.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_sysfs.c new file mode 100644 index 000..a6c71b1 --- /dev/null +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_sysfs.c @@ -0,0 +1,167 @@ +/* Copyright 2008-2015 Freescale Semiconductor Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Freescale Semiconductor nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License (GPL) as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include linux/init.h +#include linux/module.h +#include linux/kthread.h +#include linux/io.h +#include linux/of_net.h +#include dpaa_eth.h +#include mac.h + +static ssize_t dpaa_eth_show_addr(struct device *dev, +
[PATCH 10/10] dpaa_eth: add trace points
Add trace points on the hot processing path. Signed-off-by: Ruxandra Ioana Radulescu ruxandra.radule...@freescale.com --- drivers/net/ethernet/freescale/dpaa/Makefile | 1 + drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 12 ++ drivers/net/ethernet/freescale/dpaa/dpaa_eth.h | 4 + .../net/ethernet/freescale/dpaa/dpaa_eth_trace.h | 141 + 4 files changed, 158 insertions(+) create mode 100644 drivers/net/ethernet/freescale/dpaa/dpaa_eth_trace.h diff --git a/drivers/net/ethernet/freescale/dpaa/Makefile b/drivers/net/ethernet/freescale/dpaa/Makefile index 3427de4..bf7248a 100644 --- a/drivers/net/ethernet/freescale/dpaa/Makefile +++ b/drivers/net/ethernet/freescale/dpaa/Makefile @@ -11,6 +11,7 @@ ccflags-y += -I$(FMAN)/flib obj-$(CONFIG_FSL_DPAA_ETH) += fsl_dpa.o fsl_dpa-objs += dpaa_eth.o dpaa_eth_sg.o dpaa_eth_common.o dpaa_ethtool.o dpaa_eth_sysfs.o +CFLAGS_dpaa_eth.o := -I$(src) ifeq ($(CONFIG_FSL_DPAA_ETH_DEBUGFS),y) fsl_dpa-objs += dpaa_debugfs.o endif diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c index 59c8edc..f88e636 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c @@ -61,6 +61,12 @@ #include dpaa_debugfs.h #endif /* CONFIG_FSL_DPAA_ETH_DEBUGFS */ +/* CREATE_TRACE_POINTS only needs to be defined once. Other dpa files + * using trace events only need to #include trace/events/sched.h + */ +#define CREATE_TRACE_POINTS +#include dpaa_eth_trace.h + #define DPA_NAPI_WEIGHT64 /* Valid checksum indication */ @@ -226,6 +232,9 @@ priv_rx_default_dqrr(struct qman_portal *portal, priv = netdev_priv(net_dev); dpa_bp = priv-dpa_bp; + /* Trace the Rx fd */ + trace_dpa_rx_fd(net_dev, fq, dq-fd); + /* IRQ handler, non-migratable; safe to use raw_cpu_ptr here */ percpu_priv = raw_cpu_ptr(priv-percpu_priv); count_ptr = raw_cpu_ptr(dpa_bp-percpu_count); @@ -282,6 +291,9 @@ priv_tx_conf_default_dqrr(struct qman_portal *portal, net_dev = ((struct dpa_fq *)fq)-net_dev; priv = netdev_priv(net_dev); + /* Trace the fd */ + trace_dpa_tx_conf_fd(net_dev, fq, dq-fd); + /* Non-migratable context, safe to use raw_cpu_ptr */ percpu_priv = raw_cpu_ptr(priv-percpu_priv); diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h index 18dadf6..29ee23a 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h @@ -36,6 +36,7 @@ #include fm_ext.h #include mac.h +#include dpaa_eth_trace.h extern int dpa_rx_extra_headroom; extern int dpa_max_frm; @@ -424,6 +425,9 @@ static inline int __hot dpa_xmit(struct dpa_priv_s *priv, _dpa_get_tx_conf_queue(priv, egress_fq) ); + /* Trace this Tx fd */ + trace_dpa_tx_fd(priv-net_dev, egress_fq, fd); + for (i = 0; i 10; i++) { err = qman_enqueue(egress_fq, fd, 0); if (err != -EBUSY) diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_trace.h b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_trace.h new file mode 100644 index 000..3b67477 --- /dev/null +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_trace.h @@ -0,0 +1,141 @@ +/* Copyright 2013-2015 Freescale Semiconductor Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Freescale Semiconductor nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License (GPL) as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE,
[v3, 9/9] fsl/fman: Add FMan MAC driver
From: Igal Liberman igal.liber...@freescale.com This patch adds the Ethernet MAC driver support. Signed-off-by: Igal Liberman igal.liber...@freescale.com Signed-off-by: Madalin Bucur madalin.bu...@freescale.com --- drivers/net/ethernet/freescale/fman/inc/mac.h | 134 drivers/net/ethernet/freescale/fman/mac/Makefile |3 +- drivers/net/ethernet/freescale/fman/mac/mac-api.c | 698 + drivers/net/ethernet/freescale/fman/mac/mac.c | 482 ++ 4 files changed, 1316 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ethernet/freescale/fman/inc/mac.h create mode 100644 drivers/net/ethernet/freescale/fman/mac/mac-api.c create mode 100644 drivers/net/ethernet/freescale/fman/mac/mac.c diff --git a/drivers/net/ethernet/freescale/fman/inc/mac.h b/drivers/net/ethernet/freescale/fman/inc/mac.h new file mode 100644 index 000..7e6caa3 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/inc/mac.h @@ -0,0 +1,134 @@ +/* Copyright 2008-2015 Freescale Semiconductor, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Freescale Semiconductor nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License (GPL) as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __MAC_H +#define __MAC_H + +#include linux/device.h /* struct device, BUS_ID_SIZE */ +#include linux/if_ether.h/* ETH_ALEN */ +#include linux/phy.h /* phy_interface_t, struct phy_device */ +#include linux/list.h + +#include enet_ext.h + +#include fsl_fman_drv.h /* struct port_device */ +#include fm_port_ext.h + +struct fm_mac_dev; +enum fm_mac_exceptions; + +enum {DTSEC, XGMAC, MEMAC}; + +struct mac_device { + struct device *dev; + void*priv; + u8 cell_index; + struct resource *res; + void __iomem*vaddr; + u8 addr[ETH_ALEN]; + bool promisc; + + struct fm *fm_dev; + struct fm_port_drv_t*port_dev[2]; + + phy_interface_t phy_if; + u32 if_support; + bool link; + u16 speed; + u16 max_speed; + struct device_node *phy_node; + struct device_node *tbi_node; + struct phy_device *phy_dev; + void*fm; + /* List of multicast addresses */ + struct list_head mc_addr_list; + struct platform_device *eth_dev; + + bool autoneg_pause; + bool rx_pause_req; + bool tx_pause_req; + bool rx_pause_active; + bool tx_pause_active; + + int (*init_phy)(struct net_device *net_dev, struct mac_device *mac_dev); + int (*init)(struct mac_device *mac_dev); + int (*start)(struct mac_device *mac_dev); + int (*stop)(struct mac_device *mac_dev); + int (*set_promisc)(struct fm_mac_dev *fm_mac_dev, bool enable); + int (*change_addr)(struct fm_mac_dev *fm_mac_dev, + enet_addr_t *p_enet_addr); + int (*set_multi)(struct net_device *net_dev, +struct mac_device *mac_dev); + int (*set_rx_pause)(struct fm_mac_dev *fm_mac_dev, bool en); + int (*set_tx_pause)(struct fm_mac_dev *fm_mac_dev, u8 priority, + u16 pause_time, u16 thresh_time);
[PATCH 05/10] dpaa_eth: add driver's Tx queue selection mechanism
Allow the selection of the transmission queue based on the CPU id. Signed-off-by: Madalin Bucur madalin.bu...@freescale.com --- drivers/net/ethernet/freescale/dpaa/Kconfig | 10 ++ drivers/net/ethernet/freescale/dpaa/dpaa_eth.c| 3 +++ drivers/net/ethernet/freescale/dpaa/dpaa_eth.h| 6 ++ drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.c | 8 drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.h | 4 5 files changed, 31 insertions(+) diff --git a/drivers/net/ethernet/freescale/dpaa/Kconfig b/drivers/net/ethernet/freescale/dpaa/Kconfig index 9e6a39f..3fa7925 100644 --- a/drivers/net/ethernet/freescale/dpaa/Kconfig +++ b/drivers/net/ethernet/freescale/dpaa/Kconfig @@ -11,6 +11,16 @@ menuconfig FSL_DPAA_ETH if FSL_DPAA_ETH +config FSL_DPAA_ETH_USE_NDO_SELECT_QUEUE + bool Use driver's Tx queue selection mechanism + default y + ---help--- + The DPAA-Ethernet driver defines a ndo_select_queue() callback for optimal selection + of the egress FQ. That will override the XPS support for this netdevice. + If for whatever reason you want to be in control of the egress FQ-to-CPU selection and mapping, + or simply don't want to use the driver's ndo_select_queue() callback, then unselect this + and use the standard XPS support instead. + config FSL_DPAA_ETH_MAX_BUF_COUNT int Maximum number of buffers in private bpool range 64 2048 diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c index edf468b..3fbd114 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c @@ -387,6 +387,9 @@ static const struct net_device_ops dpa_private_ops = { .ndo_get_stats64 = dpa_get_stats64, .ndo_set_mac_address = dpa_set_mac_address, .ndo_validate_addr = eth_validate_addr, +#ifdef CONFIG_FSL_DPAA_ETH_USE_NDO_SELECT_QUEUE + .ndo_select_queue = dpa_select_queue, +#endif .ndo_change_mtu = dpa_change_mtu, .ndo_set_rx_mode = dpa_set_rx_mode, .ndo_init = dpa_ndo_init, diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h index fc6c5dc..cbe9626 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h @@ -432,9 +432,15 @@ static inline void _dpa_assign_wq(struct dpa_fq *fq) } } +#ifdef CONFIG_FSL_DPAA_ETH_USE_NDO_SELECT_QUEUE +/* Use in lieu of skb_get_queue_mapping() */ +#define dpa_get_queue_mapping(skb) \ + raw_smp_processor_id() +#else /* Use the queue selected by XPS */ #define dpa_get_queue_mapping(skb) \ skb_get_queue_mapping(skb) +#endif static inline void _dpa_bp_free_pf(void *addr) { diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.c index da146f0..b571635 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.c @@ -593,6 +593,14 @@ bool dpa_bpid2pool_use(int bpid) return false; } +#ifdef CONFIG_FSL_DPAA_ETH_USE_NDO_SELECT_QUEUE +u16 dpa_select_queue(struct net_device *net_dev, struct sk_buff *skb, +void *accel_priv, select_queue_fallback_t fallback) +{ + return dpa_get_queue_mapping(skb); +} +#endif + struct dpa_fq *dpa_fq_alloc(struct device *dev, const struct fqid_cell *fqids, struct list_head *list, diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.h b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.h index 1090045..75d0ac9 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.h +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.h @@ -89,6 +89,10 @@ struct dpa_bp *dpa_bpid2pool(int bpid); void dpa_bpid2pool_map(int bpid, struct dpa_bp *dpa_bp); bool dpa_bpid2pool_use(int bpid); void dpa_bp_drain(struct dpa_bp *bp); +#ifdef CONFIG_FSL_DPAA_ETH_USE_NDO_SELECT_QUEUE +u16 dpa_select_queue(struct net_device *net_dev, struct sk_buff *skb, +void *accel_priv, select_queue_fallback_t fallback); +#endif struct dpa_fq *dpa_fq_alloc(struct device *dev, const struct fqid_cell *fqids, struct list_head *list, -- 1.7.11.7 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 08/10] dpaa_eth: add debugfs counters
Add a series of counters to be exported through debugfs: - add detailed counters for reception errors; - add detailed counters for QMan enqueue reject events; - count the number of fragmented skbs received from the stack; - count all frames received on the Tx confirmation path; - add congestion group statistics; - count the number of interrupts for each CPU. Signed-off-by: Madalin Bucur madalin.bu...@freescale.com --- drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 12 +++ drivers/net/ethernet/freescale/dpaa/dpaa_eth.h | 35 +++ .../net/ethernet/freescale/dpaa/dpaa_eth_common.c | 40 -- .../net/ethernet/freescale/dpaa/dpaa_eth_common.h | 2 ++ drivers/net/ethernet/freescale/dpaa/dpaa_eth_sg.c | 1 + 5 files changed, 88 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c index dbd8a70..926a740 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c @@ -98,6 +98,15 @@ static void _dpa_rx_error(struct net_device *net_dev, percpu_priv-stats.rx_errors++; + if (fd-status FM_PORT_FRM_ERR_DMA) + percpu_priv-rx_errors.dme++; + if (fd-status FM_PORT_FRM_ERR_PHYSICAL) + percpu_priv-rx_errors.fpe++; + if (fd-status FM_PORT_FRM_ERR_SIZE) + percpu_priv-rx_errors.fse++; + if (fd-status FM_PORT_FRM_ERR_PRS_HDR_ERR) + percpu_priv-rx_errors.phe++; + dpa_fd_release(net_dev, fd); } @@ -161,6 +170,8 @@ static void __hot _dpa_tx_conf(struct net_device *net_dev, percpu_priv-stats.tx_errors++; } + percpu_priv-tx_confirm++; + skb = _dpa_cleanup_tx_fd(priv, fd); dev_kfree_skb(skb); @@ -296,6 +307,7 @@ static void priv_ern(struct qman_portal *portal, percpu_priv-stats.tx_dropped++; percpu_priv-stats.tx_fifo_errors++; + count_ern(percpu_priv, msg); /* If we intended this buffer to go into the pool * when the FM was done, we need to put it in diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h index 7160eda..0fab7240 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h @@ -199,6 +199,25 @@ struct dpa_bp { void (*free_buf_cb)(void *addr); }; +struct dpa_rx_errors { + u64 dme;/* DMA Error */ + u64 fpe;/* Frame Physical Error */ + u64 fse;/* Frame Size Error */ + u64 phe;/* Header Error */ +}; + +/* Counters for QMan ERN frames - one counter per rejection code */ +struct dpa_ern_cnt { + u64 cg_tdrop; /* Congestion group taildrop */ + u64 wred; /* WRED congestion */ + u64 err_cond; /* Error condition */ + u64 early_window; /* Order restoration, frame too early */ + u64 late_window;/* Order restoration, frame too late */ + u64 fq_tdrop; /* FQ taildrop */ + u64 fq_retired; /* FQ is retired */ + u64 orp_zero; /* ORP disabled */ +}; + struct dpa_napi_portal { struct napi_struct napi; struct qman_portal *p; @@ -207,7 +226,13 @@ struct dpa_napi_portal { struct dpa_percpu_priv_s { struct net_device *net_dev; struct dpa_napi_portal *np; + u64 in_interrupt; + u64 tx_confirm; + /* fragmented (non-linear) skbuffs received from the stack */ + u64 tx_frag_skbuffs; struct rtnl_link_stats64 stats; + struct dpa_rx_errors rx_errors; + struct dpa_ern_cnt ern_cnt; }; struct dpa_priv_s { @@ -235,6 +260,15 @@ struct dpa_priv_s { * (and the same) congestion group. */ struct qman_cgr cgr; + /* If congested, when it began. Used for performance stats. */ + u32 congestion_start_jiffies; + /* Number of jiffies the Tx port was congested. */ + u32 congested_jiffies; + /** +* Counter for the number of times the CGR +* entered congestion state +*/ + u32 cgr_congested_count; } cgr_data; /* Use a per-port CGR for ingress traffic. */ bool use_ingress_cgr; @@ -296,6 +330,7 @@ static inline int dpaa_eth_napi_schedule(struct dpa_percpu_priv_s *percpu_priv, np-p = portal; napi_schedule(np-napi); + percpu_priv-in_interrupt++; return 1; } } diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.c index bcd4c4f..4085f14 100644 ---
[v3, 0/9] Freescale DPAA FMan
From: Igal Liberman igal.liber...@freescale.com The Freescale Data Path Acceleration Architecture (DPAA) is a set of hardware components on specific QorIQ multicore processors. This architecture provides the infrastructure to support simplified sharing of networking interfaces and accelerators by multiple CPU cores and the accelerators. One of the DPAA accelerators is the Frame Manager (FMan) which contains a series of hardware blocks: ports, Ethernet MACs, a multi user RAM (MURAM) and Storage Profile (SP). This patch set introduce the FMan drivers. Each driver configures and initializes the corresponding FMan hardware module (described above). The MAC driver offers support for three different types of MACs (eTSEC, TGEC, MEMAC). The driver structure and a hint on file naming: -- | FMan driver/MAC driver | fm_drv*, mac* files -- | FMan | Port | MAC | MURAM | SP | fm_* files -- | FLib | fman_*.c, fsl_fman_.*h files -- The first 3 patches present the FMan Foundation Libraries (FLIBs). The FLIBs provide basic internal API for the FMan hardware configuration and control. Header files are located in fman/flib directory. Source files are located in each module directory. The upper layer of the FMan driver makes use of the basic API which is provided by the Flibs. The remaining patches present the required FMan hardware module drivers. v2 -- v3: - Addressed feedback from Scott: - Remove typedefs - Remove unnecessary memory barriers - Remove unnecessary casting - Remove KConfig options - Remove early_params - Remove Hungarian notation - Remove __packed__ attribute and padding from structures - Remove unlikely attribute (where it's not needed) - Use proper error codes and remove unnecessary prints - Use proper values for sleep routines - Replace complex Macros with functions - Improve device tree processing code - Use symbolic defines - Add time-out in busy-wait loops - Removed exit code (loadable module support will be added later) - Fixed fixed-link issue raised by Joakim Tjernlund v1 -- v2: - Addressed feedback from Paul Bolle: - General feedback of FMan Driver layer - Remove Errata defines - Aligned comments to Kernel Doc - Remove Loadable Module support (not yet supported) - Removed not needed KConfig dependencies - Addressed feedback from Scott Wood - Use Kernel ioread/iowrite services - Squash FLIB source and header patches together This submission is based on the prior Freescale DPAA FMan V3,RFC submission. Several issues addresses in this submission: - Reduced MAC layering and complexity - Reduced code base - T1024/T2080 10G best effort support Igal Liberman (9): fsl/fman: Add the FMan FLIB fsl/fman: Add the FMan port FLIB fsl/fman: Add the FMan MAC FLIB fsl/fman: Add FMan MURAM support fsl/fman: Add Frame Manager support fsl/fman: Add FMan MAC support fsl/fman: Add FMan SP support fsl/fman: Add FMan Port Support fsl/fman: Add FMan MAC driver drivers/net/ethernet/freescale/Kconfig |1 + drivers/net/ethernet/freescale/Makefile|2 + drivers/net/ethernet/freescale/fman/Kconfig|8 + drivers/net/ethernet/freescale/fman/Makefile | 12 + .../net/ethernet/freescale/fman/flib/fsl_enet.h| 135 ++ .../net/ethernet/freescale/fman/flib/fsl_fman.h| 590 + .../ethernet/freescale/fman/flib/fsl_fman_dtsec.h | 809 .../freescale/fman/flib/fsl_fman_dtsec_mii_acc.h | 89 ++ .../ethernet/freescale/fman/flib/fsl_fman_memac.h | 428 ++ .../freescale/fman/flib/fsl_fman_memac_mii_acc.h | 72 ++ .../ethernet/freescale/fman/flib/fsl_fman_port.h | 409 ++ .../net/ethernet/freescale/fman/flib/fsl_fman_sp.h | 53 + .../ethernet/freescale/fman/flib/fsl_fman_tgec.h | 393 ++ drivers/net/ethernet/freescale/fman/fm.c | 1366 drivers/net/ethernet/freescale/fman/fm.h | 279 drivers/net/ethernet/freescale/fman/fm_common.h| 178 +++ drivers/net/ethernet/freescale/fman/fm_drv.c | 642 + drivers/net/ethernet/freescale/fman/fm_drv.h | 111 ++ drivers/net/ethernet/freescale/fman/fm_muram.c | 115 ++ drivers/net/ethernet/freescale/fman/fm_port_drv.c | 386 ++ drivers/net/ethernet/freescale/fman/fm_sp_common.h | 105 ++ drivers/net/ethernet/freescale/fman/fman.c | 911 + .../ethernet/freescale/fman/inc/crc_mac_addr_ext.h |
[v3, 8/9] fsl/fman: Add FMan Port Support
From: Igal Liberman igal.liber...@freescale.com This patch adds The FMan Port configuration, initialization and runtime control routines. Signed-off-by: Igal Liberman igal.liber...@freescale.com --- drivers/net/ethernet/freescale/fman/Makefile |2 +- drivers/net/ethernet/freescale/fman/fm.c | 251 - drivers/net/ethernet/freescale/fman/fm_common.h| 35 + drivers/net/ethernet/freescale/fman/fm_drv.c | 72 +- drivers/net/ethernet/freescale/fman/fm_drv.h |2 + drivers/net/ethernet/freescale/fman/fm_port_drv.c | 386 +++ .../net/ethernet/freescale/fman/inc/fm_port_ext.h | 340 ++ .../net/ethernet/freescale/fman/inc/fsl_fman_drv.h | 104 ++ drivers/net/ethernet/freescale/fman/port/Makefile |2 +- drivers/net/ethernet/freescale/fman/port/fm_port.c | 1081 drivers/net/ethernet/freescale/fman/port/fm_port.h | 502 + 11 files changed, 2773 insertions(+), 4 deletions(-) create mode 100644 drivers/net/ethernet/freescale/fman/fm_port_drv.c create mode 100644 drivers/net/ethernet/freescale/fman/inc/fm_port_ext.h create mode 100644 drivers/net/ethernet/freescale/fman/port/fm_port.c create mode 100644 drivers/net/ethernet/freescale/fman/port/fm_port.h diff --git a/drivers/net/ethernet/freescale/fman/Makefile b/drivers/net/ethernet/freescale/fman/Makefile index c6c3e24..8d637e2 100644 --- a/drivers/net/ethernet/freescale/fman/Makefile +++ b/drivers/net/ethernet/freescale/fman/Makefile @@ -4,7 +4,7 @@ subdir-ccflags-y += -I$(srctree)/drivers/net/ethernet/freescale/fman/flib \ obj-y += fsl_fman.o -fsl_fman-objs := fman.o fm_muram.o fm.o fm_drv.o +fsl_fman-objs := fman.o fm_muram.o fm.o fm_drv.o fm_port_drv.o obj-y += port/ obj-y += mac/ diff --git a/drivers/net/ethernet/freescale/fman/fm.c b/drivers/net/ethernet/freescale/fman/fm.c index 450ee6b..a8ecf0b 100644 --- a/drivers/net/ethernet/freescale/fman/fm.c +++ b/drivers/net/ethernet/freescale/fman/fm.c @@ -376,11 +376,29 @@ static void qmi_err_event(struct fm_t *fm) static void dma_err_event(struct fm_t *fm) { - u32 status; + u32 status, com_id; + u8 tnum, port_id, relative_port_id; + u16 liodn; struct fman_dma_regs __iomem *dma_rg = fm-dma_regs; status = fman_get_dma_err_event(dma_rg); + if (status DMA_STATUS_BUS_ERR) { + com_id = fman_get_dma_com_id(dma_rg); + port_id = (u8)(((com_id DMA_TRANSFER_PORTID_MASK) + DMA_TRANSFER_PORTID_SHIFT)); + relative_port_id = + hw_port_id_to_sw_port_id(fm-fm_state-rev_info.major_rev, +port_id); + tnum = (u8)((com_id DMA_TRANSFER_TNUM_MASK) + DMA_TRANSFER_TNUM_SHIFT); + liodn = (u16)(com_id DMA_TRANSFER_LIODN_MASK); + WARN_ON(fm-fm_state-ports_types[port_id] == + FM_PORT_TYPE_DUMMY); + fm-bus_error_cb(fm-dev_id, fm-fm_state-ports_types[port_id], +relative_port_id, +fman_get_dma_addr(dma_rg), tnum, liodn); + } if (status DMA_STATUS_FM_SPDAT_ECC) fm-exception_cb(fm-dev_id, FM_EX_DMA_SINGLE_PORT_ECC); if (status DMA_STATUS_READ_ECC) @@ -587,6 +605,233 @@ u8 fm_get_id(struct fm_t *fm) return fm-fm_state-fm_id; } +int fm_get_set_port_params(struct fm_t *fm, + struct fm_inter_module_port_init_params_t + *port_params) +{ + int err; + unsigned long int_flags; + u8 port_id = port_params-port_id, mac_id; + struct fman_rg fman_rg; + + fman_rg.bmi_rg = fm-bmi_regs; + fman_rg.qmi_rg = fm-qmi_regs; + fman_rg.fpm_rg = fm-fpm_regs; + fman_rg.dma_rg = fm-dma_regs; + + spin_lock_irqsave(fm-spinlock, int_flags); + + fm-fm_state-ports_types[port_id] = port_params-port_type; + + err = fm_set_num_of_tasks(fm, port_params-port_id, + port_params-num_of_tasks, + port_params-num_of_extra_tasks); + if (err) { + spin_unlock_irqrestore(fm-spinlock, int_flags); + return err; + } + + /* TX Ports */ + if (port_params-port_type != FM_PORT_TYPE_RX) { + u32 enq_th; + u32 deq_th; + + /* update qmi ENQ/DEQ threshold */ + fm-fm_state-accumulated_num_of_deq_tnums += + port_params-deq_pipeline_depth; + enq_th = fman_get_qmi_enq_th(fman_rg.qmi_rg); + /* if enq_th is too big, we reduce it to the max value +* that is still 0 +*/ + if (enq_th = (fm-intg-qmi_max_num_of_tnums - + fm-fm_state-accumulated_num_of_deq_tnums)) { + enq_th = +
[PATCH 06/10] dpaa_eth: add ethtool functionality
Add support for basic ethtool operations. Signed-off-by: Madalin Bucur madalin.bu...@freescale.com --- drivers/net/ethernet/freescale/dpaa/Makefile | 2 +- .../net/ethernet/freescale/dpaa/dpaa_eth_common.c | 2 + .../net/ethernet/freescale/dpaa/dpaa_eth_common.h | 3 + drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c | 230 + 4 files changed, 236 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c diff --git a/drivers/net/ethernet/freescale/dpaa/Makefile b/drivers/net/ethernet/freescale/dpaa/Makefile index cf126dd..e137146 100644 --- a/drivers/net/ethernet/freescale/dpaa/Makefile +++ b/drivers/net/ethernet/freescale/dpaa/Makefile @@ -10,4 +10,4 @@ ccflags-y += -I$(FMAN)/flib obj-$(CONFIG_FSL_DPAA_ETH) += fsl_dpa.o -fsl_dpa-objs += dpaa_eth.o dpaa_eth_sg.o dpaa_eth_common.o +fsl_dpa-objs += dpaa_eth.o dpaa_eth_sg.o dpaa_eth_common.o dpaa_ethtool.o diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.c index b571635..aeb2baf 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.c @@ -81,6 +81,8 @@ int dpa_netdev_init(struct net_device *net_dev, memcpy(net_dev-perm_addr, mac_addr, net_dev-addr_len); memcpy(net_dev-dev_addr, mac_addr, net_dev-addr_len); + net_dev-ethtool_ops = dpa_ethtool_ops; + net_dev-needed_headroom = priv-tx_headroom; net_dev-watchdog_timeo = msecs_to_jiffies(tx_timeout); diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.h b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.h index 75d0ac9..49dc8d4 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.h +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.h @@ -58,6 +58,9 @@ /* used in napi related functions */ extern u16 qman_portal_max; +/* from dpa_ethtool.c */ +extern const struct ethtool_ops dpa_ethtool_ops; + int dpa_netdev_init(struct net_device *net_dev, const u8 *mac_addr, u16 tx_timeout); diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c b/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c new file mode 100644 index 000..cabd5f8 --- /dev/null +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c @@ -0,0 +1,230 @@ +/* Copyright 2008-2015 Freescale Semiconductor, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Freescale Semiconductor nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License (GPL) as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#define pr_fmt(fmt) KBUILD_MODNAME : fmt + +#include linux/string.h + +#include dpaa_eth.h +#include mac.h +#include dpaa_eth_common.h + +static int dpa_get_settings(struct net_device *net_dev, + struct ethtool_cmd *et_cmd) +{ + int err; + struct dpa_priv_s *priv; + + priv = netdev_priv(net_dev); + + if (unlikely(!priv-mac_dev-phy_dev)) { + netdev_dbg(net_dev, phy device not initialized\n); + return 0; + } + + err = phy_ethtool_gset(priv-mac_dev-phy_dev, et_cmd); + + return err; +} + +static int dpa_set_settings(struct net_device *net_dev, + struct ethtool_cmd *et_cmd) +{ + int
[PATCH 04/10] dpaa_eth: add support for S/G frames
Add support for Scater/Gather (S/G) frames. The FMan can place the frame content into multiple buffers and provide a S/G Table (SGT) into one first buffer with references to the others. Signed-off-by: Madalin Bucur madalin.bu...@freescale.com --- drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 6 + .../net/ethernet/freescale/dpaa/dpaa_eth_common.c | 54 +++- .../net/ethernet/freescale/dpaa/dpaa_eth_common.h | 2 + drivers/net/ethernet/freescale/dpaa/dpaa_eth_sg.c | 335 +++-- 4 files changed, 375 insertions(+), 22 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c index fc2071e..edf468b 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c @@ -460,6 +460,12 @@ static int dpa_private_netdev_init(struct net_device *net_dev) net_dev-hw_features |= (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_LLTX); + /* Advertise S/G and HIGHDMA support for private interfaces */ + net_dev-hw_features |= NETIF_F_SG | NETIF_F_HIGHDMA; + /* Recent kernels enable GSO automatically, if +* we declare NETIF_F_SG. For conformity, we'll +* still declare GSO explicitly. +*/ net_dev-features |= NETIF_F_GSO; return dpa_netdev_init(net_dev, mac_addr, tx_timeout); diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.c index be69afb..da146f0 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.c @@ -1130,11 +1130,43 @@ void dpaa_eth_init_ports(struct mac_device *mac_dev, port_fqs-rx_defq, buf_layout[RX]); } +void dpa_release_sgt(struct qm_sg_entry *sgt) +{ + struct dpa_bp *dpa_bp; + struct bm_buffer bmb[DPA_BUFF_RELEASE_MAX]; + u8 i = 0, j; + + memset(bmb, 0, sizeof(bmb)); + + do { + dpa_bp = dpa_bpid2pool(sgt[i].bpid); + DPA_ERR_ON(!dpa_bp); + + j = 0; + do { + DPA_ERR_ON(sgt[i].extension); + + bmb[j].hi = sgt[i].addr_hi; + bmb[j].lo = sgt[i].addr_lo; + + j++; i++; + } while (j ARRAY_SIZE(bmb) + !sgt[i - 1].final + sgt[i - 1].bpid == sgt[i].bpid); + + while (bman_release(dpa_bp-pool, bmb, j, 0)) + cpu_relax(); + } while (!sgt[i - 1].final); +} + void __attribute__((nonnull)) dpa_fd_release(const struct net_device *net_dev, const struct qm_fd *fd) { - struct dpa_bp *dpa_bp; - struct bm_buffer bmb; + struct qm_sg_entry *sgt; + struct dpa_bp *dpa_bp; + struct bm_buffer bmb; + dma_addr_t addr; + void*vaddr; memset(bmb, 0, sizeof(bmb)); bm_buffer_set64(bmb, fd-addr); @@ -1142,7 +1174,23 @@ dpa_fd_release(const struct net_device *net_dev, const struct qm_fd *fd) dpa_bp = dpa_bpid2pool(fd-bpid); DPA_ERR_ON(!dpa_bp); - DPA_ERR_ON(fd-format == qm_fd_sg); + if (fd-format == qm_fd_sg) { + vaddr = phys_to_virt(fd-addr); + sgt = vaddr + dpa_fd_offset(fd); + + dma_unmap_single(dpa_bp-dev, qm_fd_addr(fd), dpa_bp-size, +DMA_BIDIRECTIONAL); + + dpa_release_sgt(sgt); + + addr = dma_map_single(dpa_bp-dev, vaddr, dpa_bp-size, + DMA_BIDIRECTIONAL); + if (unlikely(dma_mapping_error(dpa_bp-dev, addr))) { + dev_err(dpa_bp-dev, DMA mapping failed); + return; + } + bm_buffer_set64(bmb, addr); + } while (bman_release(dpa_bp-pool, bmb, 1, 0)) cpu_relax(); diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.h b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.h index c48eb37..1090045 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.h +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.h @@ -52,6 +52,7 @@ fm_set_##type##_port_params(port, param); \ } +#define DPA_SGT_MAX_ENTRIES 16 /* maximum number of entries in SG Table */ #define DPA_BUFF_RELEASE_MAX 8 /* maximum number of buffers released at once */ /* used in napi related functions */ @@ -110,6 +111,7 @@ void dpaa_eth_init_ports(struct mac_device *mac_dev, struct fm_port_fqs *port_fqs, struct dpa_buffer_layout_s *buf_layout, struct device *dev); +void dpa_release_sgt(struct qm_sg_entry *sgt); void __attribute__((nonnull)) dpa_fd_release(const
[v3, 5/9] fsl/fman: Add Frame Manager support
From: Igal Liberman igal.liber...@freescale.com Add Frame Manger Driver support. This patch adds The FMan configuration, initialization and runtime control routines. Signed-off-by: Igal Liberman igal.liber...@freescale.com --- drivers/net/ethernet/freescale/fman/Kconfig|1 - drivers/net/ethernet/freescale/fman/Makefile |2 +- drivers/net/ethernet/freescale/fman/fm.c | 1076 drivers/net/ethernet/freescale/fman/fm.h | 276 + drivers/net/ethernet/freescale/fman/fm_common.h| 114 +++ drivers/net/ethernet/freescale/fman/fm_drv.c | 572 +++ drivers/net/ethernet/freescale/fman/fm_drv.h | 109 ++ drivers/net/ethernet/freescale/fman/inc/enet_ext.h | 199 drivers/net/ethernet/freescale/fman/inc/fm_ext.h | 446 .../net/ethernet/freescale/fman/inc/fsl_fman_drv.h | 99 ++ 10 files changed, 2892 insertions(+), 2 deletions(-) create mode 100644 drivers/net/ethernet/freescale/fman/fm.c create mode 100644 drivers/net/ethernet/freescale/fman/fm.h create mode 100644 drivers/net/ethernet/freescale/fman/fm_common.h create mode 100644 drivers/net/ethernet/freescale/fman/fm_drv.c create mode 100644 drivers/net/ethernet/freescale/fman/fm_drv.h create mode 100644 drivers/net/ethernet/freescale/fman/inc/enet_ext.h create mode 100644 drivers/net/ethernet/freescale/fman/inc/fm_ext.h create mode 100644 drivers/net/ethernet/freescale/fman/inc/fsl_fman_drv.h diff --git a/drivers/net/ethernet/freescale/fman/Kconfig b/drivers/net/ethernet/freescale/fman/Kconfig index 825a0d5..66b7296 100644 --- a/drivers/net/ethernet/freescale/fman/Kconfig +++ b/drivers/net/ethernet/freescale/fman/Kconfig @@ -6,4 +6,3 @@ config FSL_FMAN help Freescale Data-Path Acceleration Architecture Frame Manager (FMan) support - diff --git a/drivers/net/ethernet/freescale/fman/Makefile b/drivers/net/ethernet/freescale/fman/Makefile index 55c91bd..f61d3a6 100644 --- a/drivers/net/ethernet/freescale/fman/Makefile +++ b/drivers/net/ethernet/freescale/fman/Makefile @@ -4,7 +4,7 @@ subdir-ccflags-y += -I$(srctree)/drivers/net/ethernet/freescale/fman/flib \ obj-y += fsl_fman.o -fsl_fman-objs := fman.o fm_muram.o +fsl_fman-objs := fman.o fm_muram.o fm.o fm_drv.o obj-y += port/ obj-y += mac/ diff --git a/drivers/net/ethernet/freescale/fman/fm.c b/drivers/net/ethernet/freescale/fman/fm.c new file mode 100644 index 000..7e5fa53 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/fm.c @@ -0,0 +1,1076 @@ +/* + * Copyright 2008-2015 Freescale Semiconductor Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Freescale Semiconductor nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License (GPL) as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#define pr_fmt(fmt) KBUILD_MODNAME : fmt + +#include fm_common.h +#include fm.h +#include fm_muram_ext.h +#include asm/mpc85xx.h +#include fsl_fman.h + +#include linux/string.h +#include linux/slab.h + +static struct fm_intg_t *fill_intg_params(u8 major, u8 minor) +{ + struct fm_intg_t *intg; + + intg = kzalloc(sizeof(*intg), GFP_KERNEL); + if (!intg) + return NULL; + + /* P1023 - Major 4 +* P4080 - Major 2 +* P2041/P3041/P5020/P5040 - Major 3 +* Tx/Bx - Major 6 +*/ + + switch (major) { + case
[v3, 2/9] fsl/fman: Add the FMan port FLIB
From: Igal Liberman igal.liber...@freescale.com The FMan Port FLib provides basic API used by the drivers to configure and control the FMan Port hardware. Signed-off-by: Igal Liberman igal.liber...@freescale.com --- drivers/net/ethernet/freescale/fman/Kconfig|1 + drivers/net/ethernet/freescale/fman/Makefile |2 + .../ethernet/freescale/fman/flib/fsl_fman_port.h | 409 .../net/ethernet/freescale/fman/flib/fsl_fman_sp.h | 53 ++ drivers/net/ethernet/freescale/fman/port/Makefile |3 + .../net/ethernet/freescale/fman/port/fman_port.c | 510 6 files changed, 978 insertions(+) create mode 100644 drivers/net/ethernet/freescale/fman/flib/fsl_fman_port.h create mode 100644 drivers/net/ethernet/freescale/fman/flib/fsl_fman_sp.h create mode 100644 drivers/net/ethernet/freescale/fman/port/Makefile create mode 100644 drivers/net/ethernet/freescale/fman/port/fman_port.c diff --git a/drivers/net/ethernet/freescale/fman/Kconfig b/drivers/net/ethernet/freescale/fman/Kconfig index 8aeae29..af42c3a 100644 --- a/drivers/net/ethernet/freescale/fman/Kconfig +++ b/drivers/net/ethernet/freescale/fman/Kconfig @@ -5,3 +5,4 @@ config FSL_FMAN help Freescale Data-Path Acceleration Architecture Frame Manager (FMan) support + diff --git a/drivers/net/ethernet/freescale/fman/Makefile b/drivers/net/ethernet/freescale/fman/Makefile index 2799c6f..50a4de2 100644 --- a/drivers/net/ethernet/freescale/fman/Makefile +++ b/drivers/net/ethernet/freescale/fman/Makefile @@ -3,3 +3,5 @@ subdir-ccflags-y += -I$(srctree)/drivers/net/ethernet/freescale/fman/flib obj-y += fsl_fman.o fsl_fman-objs := fman.o + +obj-y += port/ diff --git a/drivers/net/ethernet/freescale/fman/flib/fsl_fman_port.h b/drivers/net/ethernet/freescale/fman/flib/fsl_fman_port.h new file mode 100644 index 000..6de0719 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/flib/fsl_fman_port.h @@ -0,0 +1,409 @@ +/* + * Copyright 2008 - 2015 Freescale Semiconductor Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Freescale Semiconductor nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License (GPL) as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __FSL_FMAN_PORT_H +#define __FSL_FMAN_PORT_H + +#include linux/io.h + +#include fsl_fman_sp.h + +/* Registers bit fields */ + +/* BMI defines */ +#define BMI_EBD_EN 0x8000 + +#define BMI_PORT_CFG_EN0x8000 +#define BMI_PORT_CFG_FDOVR 0x0200 + +#define BMI_PORT_STATUS_BSY0x8000 + +#define BMI_DMA_ATTR_SWP_SHIFT FMAN_SP_DMA_ATTR_SWP_SHIFT +#define BMI_DMA_ATTR_IC_STASH_ON 0x1000 +#define BMI_DMA_ATTR_HDR_STASH_ON 0x0400 +#define BMI_DMA_ATTR_SG_STASH_ON 0x0100 +#define BMI_DMA_ATTR_WRITE_OPTIMIZEFMAN_SP_DMA_ATTR_WRITE_OPTIMIZE + +#define BMI_RX_FIFO_PRI_ELEVATION_SHIFT16 +#define BMI_RX_FIFO_THRESHOLD_ETHE 0x8000 + +#define BMI_FRAME_END_CS_IGNORE_SHIFT 24 +#define BMI_FRAME_END_CS_IGNORE_MASK 0x001f + +#define BMI_RX_FRAME_END_CUT_SHIFT 16 +#define BMI_RX_FRAME_END_CUT_MASK 0x001f + +#define BMI_IC_TO_EXT_SHIFTFMAN_SP_IC_TO_EXT_SHIFT
[PATCH 02/10] dpaa_eth: add support for DPAA Ethernet
This introduces the Freescale Data Path Acceleration Architecture (DPAA) Ethernet driver (dpaa_eth) that builds upon the DPAA QMan, BMan, PAMU and FMan drivers to deliver Ethernet connectivity on the Freescale DPAA QorIQ platforms. Signed-off-by: Madalin Bucur madalin.bu...@freescale.com --- drivers/net/ethernet/freescale/Kconfig |2 + drivers/net/ethernet/freescale/Makefile|1 + drivers/net/ethernet/freescale/dpaa/Kconfig| 46 + drivers/net/ethernet/freescale/dpaa/Makefile | 13 + drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 827 + drivers/net/ethernet/freescale/dpaa/dpaa_eth.h | 447 +++ .../net/ethernet/freescale/dpaa/dpaa_eth_common.c | 1254 .../net/ethernet/freescale/dpaa/dpaa_eth_common.h | 119 ++ drivers/net/ethernet/freescale/dpaa/dpaa_eth_sg.c | 406 +++ 9 files changed, 3115 insertions(+) create mode 100644 drivers/net/ethernet/freescale/dpaa/Kconfig create mode 100644 drivers/net/ethernet/freescale/dpaa/Makefile create mode 100644 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c create mode 100644 drivers/net/ethernet/freescale/dpaa/dpaa_eth.h create mode 100644 drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.c create mode 100644 drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.h create mode 100644 drivers/net/ethernet/freescale/dpaa/dpaa_eth_sg.c diff --git a/drivers/net/ethernet/freescale/Kconfig b/drivers/net/ethernet/freescale/Kconfig index f3f89cc..92198be 100644 --- a/drivers/net/ethernet/freescale/Kconfig +++ b/drivers/net/ethernet/freescale/Kconfig @@ -92,4 +92,6 @@ config GIANFAR and MPC86xx family of chips, the eTSEC on LS1021A and the FEC on the 8540. +source drivers/net/ethernet/freescale/dpaa/Kconfig + endif # NET_VENDOR_FREESCALE diff --git a/drivers/net/ethernet/freescale/Makefile b/drivers/net/ethernet/freescale/Makefile index 4097c58..ae13dc5 100644 --- a/drivers/net/ethernet/freescale/Makefile +++ b/drivers/net/ethernet/freescale/Makefile @@ -12,6 +12,7 @@ obj-$(CONFIG_FS_ENET) += fs_enet/ obj-$(CONFIG_FSL_PQ_MDIO) += fsl_pq_mdio.o obj-$(CONFIG_FSL_XGMAC_MDIO) += xgmac_mdio.o obj-$(CONFIG_GIANFAR) += gianfar_driver.o +obj-$(CONFIG_FSL_DPAA_ETH) += dpaa/ obj-$(CONFIG_PTP_1588_CLOCK_GIANFAR) += gianfar_ptp.o gianfar_driver-objs := gianfar.o \ gianfar_ethtool.o diff --git a/drivers/net/ethernet/freescale/dpaa/Kconfig b/drivers/net/ethernet/freescale/dpaa/Kconfig new file mode 100644 index 000..1f3a203 --- /dev/null +++ b/drivers/net/ethernet/freescale/dpaa/Kconfig @@ -0,0 +1,46 @@ +menuconfig FSL_DPAA_ETH + tristate DPAA Ethernet + depends on FSL_SOC FSL_BMAN FSL_QMAN FSL_FMAN + select PHYLIB + select FSL_FMAN_MAC + ---help--- + Data Path Acceleration Architecture Ethernet driver, + supporting the Freescale QorIQ chips. + Depends on Freescale Buffer Manager and Queue Manager + driver and Frame Manager Driver. + +if FSL_DPAA_ETH + +config FSL_DPAA_CS_THRESHOLD_1G + hex Egress congestion threshold on 1G ports + range 0x1000 0x1000 + default 0x0600 + ---help--- + The size in bytes of the egress Congestion State notification threshold on 1G ports. + The 1G dTSECs can quite easily be flooded by cores doing Tx in a tight loop + (e.g. by sending UDP datagrams at while(1) speed), + and the larger the frame size, the more acute the problem. + So we have to find a balance between these factors: + - avoiding the device staying congested for a prolonged time (risking + the netdev watchdog to fire - see also the tx_timeout module param); + - affecting performance of protocols such as TCP, which otherwise +behave well under the congestion notification mechanism; + - preventing the Tx cores from tightly-looping (as if the congestion +threshold was too low to be effective); + - running out of memory if the CS threshold is set too high. + +config FSL_DPAA_CS_THRESHOLD_10G + hex Egress congestion threshold on 10G ports + range 0x1000 0x2000 + default 0x1000 + ---help --- + The size in bytes of the egress Congestion State notification threshold on 10G ports. + +config FSL_DPAA_INGRESS_CS_THRESHOLD + hex Ingress congestion threshold on FMan ports + default 0x1000 + ---help--- + The size in bytes of the ingress tail-drop threshold on FMan ports. + Traffic piling up above this value will be rejected by QMan and discarded by FMan. + +endif # FSL_DPAA_ETH diff --git a/drivers/net/ethernet/freescale/dpaa/Makefile b/drivers/net/ethernet/freescale/dpaa/Makefile new file mode 100644 index 000..cf126dd --- /dev/null +++ b/drivers/net/ethernet/freescale/dpaa/Makefile @@ -0,0 +1,13 @@ +# +# Makefile for the
Re: [4/6] pseries: Add CPU dlpar remove functionality
On 07/21/2015 08:11 PM, Michael Ellerman wrote: On Tue, 2015-07-21 at 16:34 -0500, Nathan Fontenot wrote: On 07/21/2015 04:27 AM, Michael Ellerman wrote: On Mon, 2015-22-06 at 21:00:49 UTC, Nathan Fontenot wrote: +static int dlpar_cpu_remove_by_count(struct device_node *parent, + u32 cpus_to_remove) +{ + struct dr_cpu *dr_cpus; + int dr_cpus_removed = 0; + int dr_cpus_present = 0; + int dr_cpus_possible; + int i, rc; + + pr_info(Attempting to hot-remove %d CPUs\n, cpus_to_remove); + + dr_cpus = get_dlpar_cpus(parent); So I think this should be: + dr_cpus = get_dlpar_cpus(parent, cpus_to_remove); + if (!dr_cpus) { + pr_info(Could not gather dr CPU info\n); + return -EINVAL; + } And get_dlpar_cpus() should return cpus_to_remove worth of present cpus, or it should error, meaning the below then won't be needed: When adding cpus by count we may need more than just cpus_to_remove worth of present cpus. The goal was to provide all possibilities so we could continue trying to satisfy the request even if one or more cpus fails to remove. From this comment and comments below I think your approach is that we should bail if any error occurs during cpu remove. Is this what we should be doing? I think so. But you can convince me otherwise if you like :) It seems to me that we don't expect failures in the general case, so a failure genuinely indicates something has gone wrong. In which case it's best to stop and back out the request, rather than trying to continue and possibly making things worse. There's also the dilemma that if you get an error offlining one cpu, but then continue and manage to offline enough cpus, should you report an error to the caller (userspace)? So I think it's better to bail on the first error, undo what's been done, and then report the error to the caller. Thinking through this and I cannot come up with a reason good enough to justify not bailing on the first error. I'll re-work the patch for this and resend. Though looking closer I don't see where we ever pass or receive a pseries_hp_errorlog to or from firmware? So I'm a bit confused why we're bothering with the __be32 shenanigans. Hopefully I've just missed a detail somewhere. That patch is coming. For hotplug in KVM guests the pseries_hp_errorlog is received when we call rtas_check_exception(). Currently these are sent up to rtas_errd in userspace, When this partchset goes in I planned on sending a patch to have cpu and memory hotplug requests handled entirely in the kernel instead of going to userspace. OK that makes sense. I'll wait to see that patch, but when it comes I'll probably tell you to do the endian swaps once when we receive the error log, rather than at each usage. I'll make a note to look into this. The issue I find is that it gets ugly because we need to use some of these values (such as drc_index) in cpu format at times and in BE at different times (such as comparing to device tree values or making rtas calls). My goal was to pass around the values in cpu format and do the endian swaps when needed. -Nathan ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 03/10] dpaa_eth: add configurable bpool thresholds
Allow the user to tweak the refill threshold and the total number of buffers in the buffer pool. The provided values are for one CPU. Signed-off-by: Madalin Bucur madalin.bu...@freescale.com --- drivers/net/ethernet/freescale/dpaa/Kconfig | 18 ++ drivers/net/ethernet/freescale/dpaa/dpaa_eth.c| 2 +- drivers/net/ethernet/freescale/dpaa/dpaa_eth.h| 3 --- drivers/net/ethernet/freescale/dpaa/dpaa_eth_sg.c | 6 +++--- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa/Kconfig b/drivers/net/ethernet/freescale/dpaa/Kconfig index 1f3a203..9e6a39f 100644 --- a/drivers/net/ethernet/freescale/dpaa/Kconfig +++ b/drivers/net/ethernet/freescale/dpaa/Kconfig @@ -11,6 +11,24 @@ menuconfig FSL_DPAA_ETH if FSL_DPAA_ETH +config FSL_DPAA_ETH_MAX_BUF_COUNT + int Maximum number of buffers in private bpool + range 64 2048 + default 128 + ---help--- + The maximum number of buffers to be by default allocated in the DPAA-Ethernet private port's + buffer pool. One needn't normally modify this, as it has probably been tuned for performance + already. This cannot be lower than DPAA_ETH_REFILL_THRESHOLD. + +config FSL_DPAA_ETH_REFILL_THRESHOLD + int Private bpool refill threshold + range 32 FSL_DPAA_ETH_MAX_BUF_COUNT + default 80 + ---help--- + The DPAA-Ethernet driver will start replenishing buffer pools whose count + falls below this threshold. This must be related to DPAA_ETH_MAX_BUF_COUNT. One needn't normally + modify this value unless one has very specific performance reasons. + config FSL_DPAA_CS_THRESHOLD_1G hex Egress congestion threshold on 1G ports range 0x1000 0x1000 diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c index 500d0e3..fc2071e 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c @@ -475,7 +475,7 @@ dpa_priv_bp_probe(struct device *dev) return ERR_PTR(-ENOMEM); dpa_bp-percpu_count = devm_alloc_percpu(dev, *dpa_bp-percpu_count); - dpa_bp-target_count = FSL_DPAA_ETH_MAX_BUF_COUNT; + dpa_bp-target_count = CONFIG_FSL_DPAA_ETH_MAX_BUF_COUNT; dpa_bp-seed_cb = dpa_bp_priv_seed; dpa_bp-free_buf_cb = _dpa_bp_free_pf; diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h index 08c1b01..fc6c5dc 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h @@ -126,9 +126,6 @@ struct dpa_buffer_layout_s { #define DPAA_ETH_RX_QUEUES 128 -#define FSL_DPAA_ETH_MAX_BUF_COUNT 128 -#define FSL_DPAA_ETH_REFILL_THRESHOLD 80 - /* More detailed FQ types - used for fine-grained WQ assignments */ enum dpa_fq_type { FQ_TYPE_RX_DEFAULT = 1, /* Rx Default FQs */ diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_sg.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_sg.c index b865d2a..d781219 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_sg.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_sg.c @@ -151,7 +151,7 @@ int dpaa_eth_refill_bpools(struct dpa_bp *dpa_bp, int *countptr) int count = *countptr; int new_bufs; - if (unlikely(count FSL_DPAA_ETH_REFILL_THRESHOLD)) { + if (unlikely(count CONFIG_FSL_DPAA_ETH_REFILL_THRESHOLD)) { do { new_bufs = _dpa_bp_add_8_bufs(dpa_bp); if (unlikely(!new_bufs)) { @@ -162,10 +162,10 @@ int dpaa_eth_refill_bpools(struct dpa_bp *dpa_bp, int *countptr) break; } count += new_bufs; - } while (count FSL_DPAA_ETH_MAX_BUF_COUNT); + } while (count CONFIG_FSL_DPAA_ETH_MAX_BUF_COUNT); *countptr = count; - if (unlikely(count FSL_DPAA_ETH_MAX_BUF_COUNT)) + if (unlikely(count CONFIG_FSL_DPAA_ETH_MAX_BUF_COUNT)) return -ENOMEM; } -- 1.7.11.7 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[v3, 6/9] fsl/fman: Add FMan MAC support
From: Igal Liberman igal.liber...@freescale.com Add Frame Manger MAC Driver support. This patch adds The FMan MAC configuration, initialization and runtime control routines. This patch contains support for these types of MACs: tGEC, dTSEC and mEMAC Signed-off-by: Igal Liberman igal.liber...@freescale.com --- drivers/net/ethernet/freescale/fman/fm.c | 41 + drivers/net/ethernet/freescale/fman/fm.h |3 + drivers/net/ethernet/freescale/fman/fm_common.h| 29 + .../ethernet/freescale/fman/inc/crc_mac_addr_ext.h | 314 ++ drivers/net/ethernet/freescale/fman/mac/Makefile |4 +- drivers/net/ethernet/freescale/fman/mac/fm_dtsec.c | 1012 drivers/net/ethernet/freescale/fman/mac/fm_dtsec.h | 207 drivers/net/ethernet/freescale/fman/mac/fm_mac.h | 259 + drivers/net/ethernet/freescale/fman/mac/fm_memac.c | 673 + drivers/net/ethernet/freescale/fman/mac/fm_memac.h | 115 +++ drivers/net/ethernet/freescale/fman/mac/fm_tgec.c | 552 +++ drivers/net/ethernet/freescale/fman/mac/fm_tgec.h | 124 +++ 12 files changed, 3332 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ethernet/freescale/fman/inc/crc_mac_addr_ext.h create mode 100644 drivers/net/ethernet/freescale/fman/mac/fm_dtsec.c create mode 100644 drivers/net/ethernet/freescale/fman/mac/fm_dtsec.h create mode 100644 drivers/net/ethernet/freescale/fman/mac/fm_mac.h create mode 100644 drivers/net/ethernet/freescale/fman/mac/fm_memac.c create mode 100644 drivers/net/ethernet/freescale/fman/mac/fm_memac.h create mode 100644 drivers/net/ethernet/freescale/fman/mac/fm_tgec.c create mode 100644 drivers/net/ethernet/freescale/fman/mac/fm_tgec.h diff --git a/drivers/net/ethernet/freescale/fman/fm.c b/drivers/net/ethernet/freescale/fman/fm.c index 7e5fa53..450ee6b 100644 --- a/drivers/net/ethernet/freescale/fman/fm.c +++ b/drivers/net/ethernet/freescale/fman/fm.c @@ -587,6 +587,47 @@ u8 fm_get_id(struct fm_t *fm) return fm-fm_state-fm_id; } +int fm_reset_mac(struct fm_t *fm, u8 mac_id) +{ + int err; + struct fman_fpm_regs __iomem *fpm_rg = fm-fpm_regs; + + if (fm-fm_state-rev_info.major_rev = 6) { + pr_warn(FMan MAC reset!\n); + return -EINVAL; + } + if (!fm-base_addr) { + pr_warn('base_address' is required!\n); + return -EINVAL; + } + err = fman_reset_mac(fpm_rg, mac_id); + + if (err == -EINVAL) { + pr_warn(Illegal MAC Id\n); + return -EINVAL; + } else if (err == EINVAL) { + return -EINVAL; + } + return 0; +} + +int fm_set_mac_max_frame(struct fm_t *fm, enum fm_mac_type type, +u8 mac_id, u16 mtu) +{ + /* if port is already initialized, check that MaxFrameLength is smaller +* or equal to the port's max +*/ + if ((!fm-fm_state-port_mfl[mac_id]) || + (fm-fm_state-port_mfl[mac_id] + (mtu = fm-fm_state-port_mfl[mac_id]))) { + fm-fm_state-mac_mfl[mac_id] = mtu; + } else { + pr_warn(MAC max_frame_length is larger than Port max_frame_length\n); + return -EINVAL; + } + return 0; +} + u16 fm_get_clock_freq(struct fm_t *fm) { return fm-fm_state-fm_clk_freq; diff --git a/drivers/net/ethernet/freescale/fman/fm.h b/drivers/net/ethernet/freescale/fman/fm.h index d7eca90..c205357 100644 --- a/drivers/net/ethernet/freescale/fman/fm.h +++ b/drivers/net/ethernet/freescale/fman/fm.h @@ -164,6 +164,7 @@ struct fm_iram_regs_t { struct fm_state_struct_t { u8 fm_id; + enum fm_port_type ports_types[FM_MAX_NUM_OF_HW_PORT_IDS]; u16 fm_clk_freq; struct fm_revision_info_t rev_info; bool enabled_time_stamp; @@ -183,6 +184,8 @@ struct fm_state_struct_t { u32 extra_fifo_pool_size; u8 extra_tasks_pool_size; u8 extra_open_dmas_pool_size; + u16 port_mfl[FM_MAX_NUM_OF_MACS]; + u16 mac_mfl[FM_MAX_NUM_OF_MACS]; }; struct fm_intg_t { diff --git a/drivers/net/ethernet/freescale/fman/fm_common.h b/drivers/net/ethernet/freescale/fman/fm_common.h index 1cde270..abe89a7 100644 --- a/drivers/net/ethernet/freescale/fman/fm_common.h +++ b/drivers/net/ethernet/freescale/fman/fm_common.h @@ -86,6 +86,26 @@ enum fm_inter_module_event { #define FM_LIODN_OFFSET_MASK0x3FF +/* Port Id defines */ +#define BASE_RX_PORTID 0x08 +#define BASE_TX_PORTID 0x28 + +static inline u8 hw_port_id_to_sw_port_id(u8 major, u8 hw_port_id) +{ + u8 sw_port_id = 0; + + if (hw_port_id = BASE_TX_PORTID) { + sw_port_id = hw_port_id - BASE_TX_PORTID; + } else if (hw_port_id = BASE_RX_PORTID) { + sw_port_id = hw_port_id - BASE_RX_PORTID; + } else { + sw_port_id = DUMMY_PORT_ID; + BUG_ON(false); + } + +
[v3, 1/9] fsl/fman: Add the FMan FLIB
From: Igal Liberman igal.liber...@freescale.com The FMan FLib provides the basic API used by the FMan drivers to configure and control the FMan hardware. Signed-off-by: Igal Liberman igal.liber...@freescale.com --- drivers/net/ethernet/freescale/Kconfig |1 + drivers/net/ethernet/freescale/Makefile|2 + drivers/net/ethernet/freescale/fman/Kconfig|7 + drivers/net/ethernet/freescale/fman/Makefile |5 + .../net/ethernet/freescale/fman/flib/fsl_fman.h| 590 + drivers/net/ethernet/freescale/fman/fman.c | 911 6 files changed, 1516 insertions(+) create mode 100644 drivers/net/ethernet/freescale/fman/Kconfig create mode 100644 drivers/net/ethernet/freescale/fman/Makefile create mode 100644 drivers/net/ethernet/freescale/fman/flib/fsl_fman.h create mode 100644 drivers/net/ethernet/freescale/fman/fman.c diff --git a/drivers/net/ethernet/freescale/Kconfig b/drivers/net/ethernet/freescale/Kconfig index ff76d4e..f3f89cc 100644 --- a/drivers/net/ethernet/freescale/Kconfig +++ b/drivers/net/ethernet/freescale/Kconfig @@ -53,6 +53,7 @@ config FEC_MPC52xx_MDIO If compiled as module, it will be called fec_mpc52xx_phy. source drivers/net/ethernet/freescale/fs_enet/Kconfig +source drivers/net/ethernet/freescale/fman/Kconfig config FSL_PQ_MDIO tristate Freescale PQ MDIO diff --git a/drivers/net/ethernet/freescale/Makefile b/drivers/net/ethernet/freescale/Makefile index 71debd1..4097c58 100644 --- a/drivers/net/ethernet/freescale/Makefile +++ b/drivers/net/ethernet/freescale/Makefile @@ -17,3 +17,5 @@ gianfar_driver-objs := gianfar.o \ gianfar_ethtool.o obj-$(CONFIG_UCC_GETH) += ucc_geth_driver.o ucc_geth_driver-objs := ucc_geth.o ucc_geth_ethtool.o + +obj-$(CONFIG_FSL_FMAN) += fman/ diff --git a/drivers/net/ethernet/freescale/fman/Kconfig b/drivers/net/ethernet/freescale/fman/Kconfig new file mode 100644 index 000..8aeae29 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/Kconfig @@ -0,0 +1,7 @@ +config FSL_FMAN + bool FMan support + depends on FSL_SOC || COMPILE_TEST + default n + help + Freescale Data-Path Acceleration Architecture Frame Manager + (FMan) support diff --git a/drivers/net/ethernet/freescale/fman/Makefile b/drivers/net/ethernet/freescale/fman/Makefile new file mode 100644 index 000..2799c6f --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/Makefile @@ -0,0 +1,5 @@ +subdir-ccflags-y += -I$(srctree)/drivers/net/ethernet/freescale/fman/flib + +obj-y += fsl_fman.o + +fsl_fman-objs := fman.o diff --git a/drivers/net/ethernet/freescale/fman/flib/fsl_fman.h b/drivers/net/ethernet/freescale/fman/flib/fsl_fman.h new file mode 100644 index 000..7bd5ca6 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/flib/fsl_fman.h @@ -0,0 +1,590 @@ +/* + * Copyright 2008 - 2015 Freescale Semiconductor Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Freescale Semiconductor nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License (GPL) as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __FSL_FMAN_H +#define __FSL_FMAN_H + +#include linux/delay.h + +struct fman_revision_info { + u8 major_rev; /* Major revision */ + u8 minor_rev; /* Minor revision */ +}; + +/* sizes */
[v3, 4/9] fsl/fman: Add FMan MURAM support
From: Igal Liberman igal.liber...@freescale.com Add Frame Manager Multi-User RAM support. Signed-off-by: Igal Liberman igal.liber...@freescale.com --- drivers/net/ethernet/freescale/fman/Kconfig|1 + drivers/net/ethernet/freescale/fman/Makefile |6 +- drivers/net/ethernet/freescale/fman/fm_muram.c | 115 .../net/ethernet/freescale/fman/inc/fm_muram_ext.h | 102 + 4 files changed, 222 insertions(+), 2 deletions(-) create mode 100644 drivers/net/ethernet/freescale/fman/fm_muram.c create mode 100644 drivers/net/ethernet/freescale/fman/inc/fm_muram_ext.h diff --git a/drivers/net/ethernet/freescale/fman/Kconfig b/drivers/net/ethernet/freescale/fman/Kconfig index af42c3a..825a0d5 100644 --- a/drivers/net/ethernet/freescale/fman/Kconfig +++ b/drivers/net/ethernet/freescale/fman/Kconfig @@ -1,6 +1,7 @@ config FSL_FMAN bool FMan support depends on FSL_SOC || COMPILE_TEST + select GENERIC_ALLOCATOR default n help Freescale Data-Path Acceleration Architecture Frame Manager diff --git a/drivers/net/ethernet/freescale/fman/Makefile b/drivers/net/ethernet/freescale/fman/Makefile index 1841b03..55c91bd 100644 --- a/drivers/net/ethernet/freescale/fman/Makefile +++ b/drivers/net/ethernet/freescale/fman/Makefile @@ -1,8 +1,10 @@ -subdir-ccflags-y += -I$(srctree)/drivers/net/ethernet/freescale/fman/flib +subdir-ccflags-y += -I$(srctree)/drivers/net/ethernet/freescale/fman/flib \ + -I$(srctree)/drivers/net/ethernet/freescale/fman/inc \ + -I$(srctree)/drivers/net/ethernet/freescale/fman obj-y += fsl_fman.o -fsl_fman-objs := fman.o +fsl_fman-objs := fman.o fm_muram.o obj-y += port/ obj-y += mac/ diff --git a/drivers/net/ethernet/freescale/fman/fm_muram.c b/drivers/net/ethernet/freescale/fman/fm_muram.c new file mode 100644 index 000..9d74bd9 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/fm_muram.c @@ -0,0 +1,115 @@ +/* + * Copyright 2008-2015 Freescale Semiconductor Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Freescale Semiconductor nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License (GPL) as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include fm_muram_ext.h + +#include linux/io.h +#include linux/string.h +#include linux/slab.h +#include linux/genalloc.h + +struct muram_info { + struct gen_pool *pool; + void __iomem *vbase; + size_t size; + phys_addr_t pbase; +}; + +struct muram_info *fm_muram_init(phys_addr_t base, size_t size) +{ + struct muram_info *muram; + void __iomem *vaddr; + int ret; + + muram = kzalloc(sizeof(*muram), GFP_KERNEL); + if (!muram) + return NULL; + + muram-pool = gen_pool_create(ilog2(64), -1); + if (!muram-pool) { + pr_err(%s(): MURAM pool create failed\n, __func__); + return NULL; + } + + vaddr = ioremap(base, size); + if (!vaddr) { + pr_err(%s(): MURAM ioremap failed\n, __func__); + return NULL; + } + + ret = gen_pool_add_virt(muram-pool, (unsigned long)vaddr, + base, size, -1); + if (ret 0) { + pr_err(%s(): MURAM pool add failed\n, __func__); +
[PATCH 00/10] dpaa_eth: Add the Freescale DPAA Ethernet driver
This patch series adds the Ethernet driver for the Freescale QorIQ Data Path Acceleration Architecture (DPAA). This version includes changes following the feedback received on previous RFC versions from Eric Dumazet, Bob Cochran, Joe Perches, Paul Bolle, Joakim Tjernlund, Scott Wood - thank you for your support. Together with the driver a managed version of alloc_percpu is provided that simplifies the release of percpu memory. The Freescale DPAA architecture consists in a series of hardware blocks that support the Ethernet connectivity. The Ethernet driver depends upon the following drivers that are currently in the Linux kernel or in review: - Peripheral Access Memory Unit (PAMU) drivers/iommu/fsl_* - Frame Manager (FMan) drivers/net/ethernet/freescale/fman - Queue Manager (QMan), Buffer Manager (BMan) drivers/soc/fsl/qbman The latest FMan driver patches were submitted by Igal Liberman: https://patchwork.ozlabs.org/project/netdev/list/?submitter=64715state=*q=[v3, The latest Q/BMan drivers were submitted by Roy Pledge: https://patchwork.ozlabs.org/project/linuxppc-dev/list/?submitter=66331state=*q=11 Madalin Bucur (10): devres: add devm_alloc_percpu() dpaa_eth: add support for DPAA Ethernet dpaa_eth: add configurable bpool thresholds dpaa_eth: add support for S/G frames dpaa_eth: add driver's Tx queue selection mechanism dpaa_eth: add ethtool functionality dpaa_eth: add sysfs exports dpaa_eth: add debugfs counters dpaa_eth: add debugfs entries dpaa_eth: add trace points Documentation/driver-model/devres.txt |4 + drivers/base/devres.c | 64 + drivers/net/ethernet/freescale/Kconfig |2 + drivers/net/ethernet/freescale/Makefile|1 + drivers/net/ethernet/freescale/dpaa/Kconfig| 81 ++ drivers/net/ethernet/freescale/dpaa/Makefile | 17 + drivers/net/ethernet/freescale/dpaa/dpaa_debugfs.c | 273 drivers/net/ethernet/freescale/dpaa/dpaa_debugfs.h | 43 + drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 873 + drivers/net/ethernet/freescale/dpaa/dpaa_eth.h | 496 +++ .../net/ethernet/freescale/dpaa/dpaa_eth_common.c | 1367 .../net/ethernet/freescale/dpaa/dpaa_eth_common.h | 130 ++ drivers/net/ethernet/freescale/dpaa/dpaa_eth_sg.c | 704 ++ .../net/ethernet/freescale/dpaa/dpaa_eth_sysfs.c | 167 +++ .../net/ethernet/freescale/dpaa/dpaa_eth_trace.h | 141 ++ drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c | 230 include/linux/device.h | 19 + 17 files changed, 4612 insertions(+) create mode 100644 drivers/net/ethernet/freescale/dpaa/Kconfig create mode 100644 drivers/net/ethernet/freescale/dpaa/Makefile create mode 100644 drivers/net/ethernet/freescale/dpaa/dpaa_debugfs.c create mode 100644 drivers/net/ethernet/freescale/dpaa/dpaa_debugfs.h create mode 100644 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c create mode 100644 drivers/net/ethernet/freescale/dpaa/dpaa_eth.h create mode 100644 drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.c create mode 100644 drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.h create mode 100644 drivers/net/ethernet/freescale/dpaa/dpaa_eth_sg.c create mode 100644 drivers/net/ethernet/freescale/dpaa/dpaa_eth_sysfs.c create mode 100644 drivers/net/ethernet/freescale/dpaa/dpaa_eth_trace.h create mode 100644 drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c -- 1.7.11.7 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 09/10] dpaa_eth: add debugfs entries
Export per CPU counters through debugfs. Signed-off-by: Madalin Bucur madalin.bu...@freescale.com --- drivers/net/ethernet/freescale/dpaa/Kconfig| 7 + drivers/net/ethernet/freescale/dpaa/Makefile | 3 + drivers/net/ethernet/freescale/dpaa/dpaa_debugfs.c | 273 + drivers/net/ethernet/freescale/dpaa/dpaa_debugfs.h | 43 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 11 + drivers/net/ethernet/freescale/dpaa/dpaa_eth.h | 4 + .../net/ethernet/freescale/dpaa/dpaa_eth_common.c | 17 ++ 7 files changed, 358 insertions(+) create mode 100644 drivers/net/ethernet/freescale/dpaa/dpaa_debugfs.c create mode 100644 drivers/net/ethernet/freescale/dpaa/dpaa_debugfs.h diff --git a/drivers/net/ethernet/freescale/dpaa/Kconfig b/drivers/net/ethernet/freescale/dpaa/Kconfig index 3fa7925..ddc9d9b 100644 --- a/drivers/net/ethernet/freescale/dpaa/Kconfig +++ b/drivers/net/ethernet/freescale/dpaa/Kconfig @@ -71,4 +71,11 @@ config FSL_DPAA_INGRESS_CS_THRESHOLD The size in bytes of the ingress tail-drop threshold on FMan ports. Traffic piling up above this value will be rejected by QMan and discarded by FMan. +config FSL_DPAA_ETH_DEBUGFS + bool DPAA Ethernet debugfs interface + depends on DEBUG_FS + default y + ---help--- + This option compiles debugfs code for the DPAA Ethernet driver. + endif # FSL_DPAA_ETH diff --git a/drivers/net/ethernet/freescale/dpaa/Makefile b/drivers/net/ethernet/freescale/dpaa/Makefile index 3a276d5..3427de4 100644 --- a/drivers/net/ethernet/freescale/dpaa/Makefile +++ b/drivers/net/ethernet/freescale/dpaa/Makefile @@ -11,3 +11,6 @@ ccflags-y += -I$(FMAN)/flib obj-$(CONFIG_FSL_DPAA_ETH) += fsl_dpa.o fsl_dpa-objs += dpaa_eth.o dpaa_eth_sg.o dpaa_eth_common.o dpaa_ethtool.o dpaa_eth_sysfs.o +ifeq ($(CONFIG_FSL_DPAA_ETH_DEBUGFS),y) +fsl_dpa-objs += dpaa_debugfs.o +endif diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_debugfs.c b/drivers/net/ethernet/freescale/dpaa/dpaa_debugfs.c new file mode 100644 index 000..2687980 --- /dev/null +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_debugfs.c @@ -0,0 +1,273 @@ +/* Copyright 2008 - 2015 Freescale Semiconductor Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Freescale Semiconductor nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License (GPL) as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include linux/module.h +#include soc/fsl/qman.h +#include linux/debugfs.h +#include asm/debug.h +#include dpaa_debugfs.h +#include dpaa_eth.h + +#define DPA_DEBUGFS_DESCRIPTION FSL DPAA Ethernet debugfs entries +#define DPA_ETH_DEBUGFS_ROOT fsl_dpa + +static int dpa_debugfs_open(struct inode *inode, struct file *file); + +static struct dentry *dpa_debugfs_root; +static const struct file_operations dpa_debugfs_fops = { + .open = dpa_debugfs_open, + .read = seq_read, + .llseek = seq_lseek, + .release= single_release, +}; + +static int dpa_debugfs_show(struct seq_file *file, void *offset) +{ + int i; + struct dpa_priv_s *priv; + struct dpa_percpu_priv_s*percpu_priv, total; + struct dpa_bp *dpa_bp; + unsigned int dpa_bp_count = 0; + unsigned int count_total = 0; + struct qm_mcr_querycgr query_cgr; + + BUG_ON(!offset); + +
Re: [v3, 2/9] fsl/fman: Add the FMan port FLIB
On Wed, 22 Jul 2015 14:21:48 +0300 igal.liber...@freescale.com wrote: diff --git a/drivers/net/ethernet/freescale/fman/Kconfig b/drivers/net/ethernet/freescale/fman/Kconfig index 8aeae29..af42c3a 100644 --- a/drivers/net/ethernet/freescale/fman/Kconfig +++ b/drivers/net/ethernet/freescale/fman/Kconfig @@ -5,3 +5,4 @@ config FSL_FMAN help Freescale Data-Path Acceleration Architecture Frame Manager (FMan) support + Bogus blank line introduced at end of file? Why was this not in patch 1? ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 03/10] dpaa_eth: add configurable bpool thresholds
On Wed, 2015-07-22 at 19:16 +0300, Madalin Bucur wrote: Allow the user to tweak the refill threshold and the total number of buffers in the buffer pool. The provided values are for one CPU. Any value in making these module parameters instead? +config FSL_DPAA_ETH_MAX_BUF_COUNT + int Maximum number of buffers in private bpool + range 64 2048 + default 128 + ---help--- + The maximum number of buffers to be by default allocated in the DPAA-Ethernet private port's + buffer pool. One needn't normally modify this, as it has probably been tuned for performance + already. This cannot be lower than DPAA_ETH_REFILL_THRESHOLD. + +config FSL_DPAA_ETH_REFILL_THRESHOLD + int Private bpool refill threshold + range 32 FSL_DPAA_ETH_MAX_BUF_COUNT + default 80 + ---help--- + The DPAA-Ethernet driver will start replenishing buffer pools whose count + falls below this threshold. This must be related to DPAA_ETH_MAX_BUF_COUNT. One needn't normally + modify this value unless one has very specific performance reasons. + config FSL_DPAA_CS_THRESHOLD_1G hex Egress congestion threshold on 1G ports range 0x1000 0x1000 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 02/10] dpaa_eth: add support for DPAA Ethernet
On Wed, 2015-07-22 at 19:16 +0300, Madalin Bucur wrote: This introduces the Freescale Data Path Acceleration Architecture (DPAA) Ethernet driver (dpaa_eth) that builds upon the DPAA QMan, BMan, PAMU and FMan drivers to deliver Ethernet connectivity on the Freescale DPAA QorIQ platforms. trivia: +static void __hot _dpa_tx_conf(struct net_device *net_dev, +const struct dpa_priv_s *priv, +struct dpa_percpu_priv_s *percpu_priv, +const struct qm_fd *fd, +u32 fqid) +{ [] +static struct dpa_bp * __cold +dpa_priv_bp_probe(struct device *dev) Do the __hot and __cold markings really matter? Some of them may be questionable. +static int __init dpa_load(void) +{ [] + err = platform_driver_register(dpa_driver); + if (unlikely(err 0)) { + pr_err(KBUILD_MODNAME + : %s:%hu:%s(): platform_driver_register() = %d\n, + KBUILD_BASENAME .c, __LINE__, __func__, err); + } + + pr_debug(KBUILD_MODNAME : %s:%s() -\n, + KBUILD_BASENAME .c, __func__); Perhaps these should use pr_fmt +static void __exit dpa_unload(void) +{ + pr_debug(KBUILD_MODNAME : - %s:%s()\n, + KBUILD_BASENAME .c, __func__); dynamic debug has __func__ available and perhaps the function tracer might be used instead. diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h [] +#define __hot curious. Maybe it'd be good to add a real __hot to compiler.h +struct dpa_buffer_layout_s { + u16 priv_data_size; + boolparse_results; + booltime_stamp; + boolhash_results; + u16 data_align; +}; +struct dpa_fq { + struct qman_fq fq_base; + struct list_head list; + struct net_device *net_dev; some inconsistent indentation here and there +struct dpa_bp { + struct bman_pool*pool; + u8 bpid; + struct device *dev; + union { + /* The buffer pools used for the private ports are initialized + * with target_count buffers for each CPU; at runtime the + * number of buffers per CPU is constantly brought back to this + * level + */ + int target_count; + /* The configured value for the number of buffers in the pool, + * used for shared port buffer pools + */ + int config_count; + }; Anonymous unions are relatively rare + struct { + /** Maybe the /** style should be avoided + * All egress queues to a given net device belong to one + * (and the same) congestion group. + */ + struct qman_cgr cgr; + } cgr_data; [] +int dpa_stop(struct net_device *net_dev) +{ [] + err = mac_dev-stop(mac_dev); + if (unlikely(err 0)) + netif_err(priv, ifdown, net_dev, mac_dev-stop() = %d\n, + err); Some of the likely/unlikely uses may not be useful/necessary. + + for_each_port_device(i, mac_dev-port_dev) { + error = fm_port_disable( + fm_port_drv_handle(mac_dev-port_dev[i])); + err = error ? error : err; if (error) err = error; is more obvious to me. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] powerpc/rtas: Replace magic values with defines
rtas.h already has some nice #defines for RTAS return status codes - let's use them instead of hard-coded magic values! Signed-off-by: Thomas Huth th...@redhat.com --- arch/powerpc/kernel/rtas.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c index 7a488c1..10fb402 100644 --- a/arch/powerpc/kernel/rtas.c +++ b/arch/powerpc/kernel/rtas.c @@ -478,8 +478,9 @@ unsigned int rtas_busy_delay_time(int status) if (status == RTAS_BUSY) { ms = 1; - } else if (status = 9900 status = 9905) { - order = status - 9900; + } else if (status = RTAS_EXTENDED_DELAY_MIN + status = RTAS_EXTENDED_DELAY_MAX) { + order = status - RTAS_EXTENDED_DELAY_MIN; for (ms = 1; order 0; order--) ms *= 10; } @@ -641,7 +642,8 @@ int rtas_set_indicator_fast(int indicator, int index, int new_value) rc = rtas_call(token, 3, 1, NULL, indicator, index, new_value); - WARN_ON(rc == -2 || (rc = 9900 rc = 9905)); + WARN_ON(rc == RTAS_BUSY || (rc = RTAS_EXTENDED_DELAY_MIN + rc = RTAS_EXTENDED_DELAY_MAX)); if (rc 0) return rtas_error_rc(rc); -- 1.8.3.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH V4 4/6] mm: mlock: Introduce VM_LOCKONFAULT and add mlock flags to enable it
On Wed, 22 Jul 2015, Vlastimil Babka wrote: On 07/21/2015 09:59 PM, Eric B Munson wrote: The cost of faulting in all memory to be locked can be very high when working with large mappings. If only portions of the mapping will be used this can incur a high penalty for locking. For the example of a large file, this is the usage pattern for a large statical language model (probably applies to other statical or graphical models as well). For the security example, any application transacting in data that cannot be swapped out (credit card data, medical records, etc). This patch introduces the ability to request that pages are not pre-faulted, but are placed on the unevictable LRU when they are finally faulted in. This can be done area at a time via the mlock2(MLOCK_ONFAULT) or the mlockall(MCL_ONFAULT) system calls. These calls can be undone via munlock2(MLOCK_ONFAULT) or munlockall2(MCL_ONFAULT). Applying the VM_LOCKONFAULT flag to a mapping with pages that are already present required the addition of a function in gup.c to pin all pages which are present in an address range. It borrows heavily from __mm_populate(). To keep accounting checks out of the page fault path, users are billed for the entire mapping lock as if MLOCK_LOCKED was used. Hi, I think you should include a complete description of which transitions for vma states and mlock2/munlock2 flags applied on them are valid and what they do. It will also help with the manpages. You explained some to Jon in the last thread, but I think there should be a canonical description in changelog (if not also Documentation, if mlock is covered there). For example the scenario Jon asked, what happens after a mlock2(MLOCK_ONFAULT) followed by mlock2(MLOCK_LOCKED), and that the answer is nothing. Your promised code comment for apply_vma_flags() doesn't suffice IMHO (and I'm not sure it's there, anyway?). I missed adding that comment to the code, will be there in V5 along with the description in the changelog. But the more I think about the scenario and your new VM_LOCKONFAULT vma flag, it seems awkward to me. Why should munlocking at all care if the vma was mlocked with MLOCK_LOCKED or MLOCK_ONFAULT? In either case the result is that all pages currently populated are munlocked. So the flags for munlock2 should be unnecessary. Say a user has a large area of interleaved MLOCK_LOCK and MLOCK_ONFAULT mappings and they want to unlock only the ones with MLOCK_LOCK. With the current implementation, this is possible in a single system call that spans the entire region. With your suggestion, the user would have to know what regions where locked with MLOCK_LOCK and call munlock() on each of them. IMO, the way munlock2() works better mirrors the way munlock() currently works when called on a large area of interleaved locked and unlocked areas. I also think VM_LOCKONFAULT is unnecessary. VM_LOCKED should be enough - see how you had to handle the new flag in all places that had to handle the old flag? I think the information whether mlock was supposed to fault the whole vma is obsolete at the moment mlock returns. VM_LOCKED should be enough for both modes, and the flag to mlock2 could just control whether the pre-faulting is done. So what should be IMHO enough: - munlock can stay without flags - mlock2 has only one new flag MLOCK_ONFAULT. If specified, pre-faulting is not done, just set VM_LOCKED and mlock pages already present. - same with mmap(MAP_LOCKONFAULT) (need to define what happens when both MAP_LOCKED and MAP_LOCKONFAULT are specified). Now mlockall(MCL_FUTURE) muddles the situation in that it stores the information for future VMA's in current-mm-def_flags, and this def_flags would need to distinguish VM_LOCKED with population and without. But that could be still solvable without introducing a new vma flag everywhere. With you right up until that last paragraph. I have been staring at this a while and I cannot come up a way to handle the mlockall(MCL_ONFAULT) without introducing a new vm flag. It doesn't have to be VM_LOCKONFAULT, we could use the model that Michal Hocko suggested with something like VM_FAULTPOPULATE. However, we can't really use this flag anywhere except the mlock code becuase we have to be able to distinguish a caller that wants to use MLOCK_LOCK with whatever control VM_FAULTPOPULATE might grant outside of mlock and a caller that wants MLOCK_ONFAULT. That was a long way of saying we need an extra vma flag regardless. However, if that flag only controls if mlock pre-populates it would work and it would do away with most of the places I had to touch to handle VM_LOCKONFAULT properly. I picked VM_LOCKONFAULT because it is explicit about what it is for and there is little risk of someone coming along in 5 years and saying why not overload this flag to do this other thing completely unrelated to mlock?. A flag for controling speculative population is more
Re: [RFC 5/8] powerpc/slb: Add documentation to runtime patching of SLB encoding
On Wed, Jul 22, 2015 at 03:51:03PM +1000, Michael Ellerman wrote: On Tue, 2015-07-21 at 12:28 +0530, Anshuman Khandual wrote: From: khand...@linux.vnet.ibm.com khand...@linux.vnet.ibm.com This patch adds some documentation to 'patch_slb_encoding' function explaining about how it clears the existing immediate value in the given instruction and inserts a new one there. diff --git a/arch/powerpc/mm/slb.c b/arch/powerpc/mm/slb.c index dcba4c2..8083a9e 100644 --- a/arch/powerpc/mm/slb.c +++ b/arch/powerpc/mm/slb.c @@ -278,7 +278,13 @@ void switch_slb(struct task_struct *tsk, struct mm_struct *mm) static inline void patch_slb_encoding(unsigned int *insn_addr, unsigned int immed) { - int insn = (*insn_addr 0x) | immed; + /* +* Currently this patches only li and cmpldi +* instructions with an immediate value. Here it +* just clears the existing immediate value from +* the instruction and inserts a new one there. +*/ + unsigned int insn = (*insn_addr 0x) | immed; patch_instruction(insn_addr, insn); } How about: /* * This function patches either an li or a cmpldi instruction with * a new immediate value. This relies on the fact that both li * (which is actually ori) and cmpldi both take a 16-bit immediate Hmm, li is actually encoded as addi with r0 as source register... * value, and it is situated in the same location in the instruction, * ie. bits 0-15. In PPC documentation, it's rather bits 16-31 (big endian bit order). Or say lower half which is endian agnostic. Cheers, Gabriel ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [RFC 5/8] powerpc/slb: Add documentation to runtime patching of SLB encoding
On Wed, 2015-07-22 at 07:57 +0200, Gabriel Paubert wrote: On Wed, Jul 22, 2015 at 03:51:03PM +1000, Michael Ellerman wrote: On Tue, 2015-07-21 at 12:28 +0530, Anshuman Khandual wrote: From: khand...@linux.vnet.ibm.com khand...@linux.vnet.ibm.com This patch adds some documentation to 'patch_slb_encoding' function explaining about how it clears the existing immediate value in the given instruction and inserts a new one there. diff --git a/arch/powerpc/mm/slb.c b/arch/powerpc/mm/slb.c index dcba4c2..8083a9e 100644 --- a/arch/powerpc/mm/slb.c +++ b/arch/powerpc/mm/slb.c @@ -278,7 +278,13 @@ void switch_slb(struct task_struct *tsk, struct mm_struct *mm) static inline void patch_slb_encoding(unsigned int *insn_addr, unsigned int immed) { - int insn = (*insn_addr 0x) | immed; + /* + * Currently this patches only li and cmpldi + * instructions with an immediate value. Here it + * just clears the existing immediate value from + * the instruction and inserts a new one there. + */ + unsigned int insn = (*insn_addr 0x) | immed; patch_instruction(insn_addr, insn); } How about: /* * This function patches either an li or a cmpldi instruction with * a new immediate value. This relies on the fact that both li * (which is actually ori) and cmpldi both take a 16-bit immediate Hmm, li is actually encoded as addi with r0 as source register... Correct. * value, and it is situated in the same location in the instruction, * ie. bits 0-15. In PPC documentation, it's rather bits 16-31 (big endian bit order). Or say lower half which is endian agnostic. Yeah, but who reads the PPC documentation ;) In the kernel we almost always use the sane bit numbering, so I'd use that, but maybe low 16-bits will avoid confusion. cheers ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: powerpc/tm: Drop tm_orig_msr from thread_struct
On Mon, 2015-06-07 at 10:54:10 UTC, Anshuman Khandual wrote: Currently tm_orig_msr is getting used during process context switch only. Then there is ckpt_regs which saves the checkpointed userspace context The MSR slot contained in ckpt_regs structure can be used during process context switch instead of tm_orig_msr, thus allowing us to drop it from thread_struct structure. This patch does that change. Acked-by: Michael Neuling mi...@neuling.org Signed-off-by: Anshuman Khandual khand...@linux.vnet.ibm.com Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/829023df86d4ec39b110 cheers ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] mm: rename and document alloc_pages_exact_node
On 07/21/2015 11:31 PM, David Rientjes wrote: On Tue, 21 Jul 2015, Vlastimil Babka wrote: The function alloc_pages_exact_node() was introduced in 6484eb3e2a81 (page allocator: do not check NUMA node ID when the caller knows the node is valid) as an optimized variant of alloc_pages_node(), that doesn't allow the node id to be -1. Unfortunately the name of the function can easily suggest that the allocation is restricted to the given node. In truth, the node is only preferred, unless __GFP_THISNODE is among the gfp flags. The misleading name has lead to mistakes in the past, see 5265047ac301 (mm, thp: really limit transparent hugepage allocation to local node) and b360edb43f8e (mm, mempolicy: migrate_to_node should only migrate to node). To prevent further mistakes, this patch renames the function to alloc_pages_prefer_node() and documents it together with alloc_pages_node(). alloc_pages_exact_node(), as you said, connotates that the allocation will take place on that node or will fail. So why not go beyond this patch and actually make alloc_pages_exact_node() set __GFP_THISNODE and then call into a new alloc_pages_prefer_node(), which would be the current alloc_pages_exact_node() implementation, and then fix up the callers? OK, but then we have alloc_pages_node(), alloc_pages_prefer_node() and alloc_pages_exact_node(). Isn't that a bit too much? The first two differ only in tiny bit: static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask, unsigned int order) { /* Unknown node is current node */ if (nid 0) nid = numa_node_id(); return __alloc_pages(gfp_mask, order, node_zonelist(nid, gfp_mask)); } static inline struct page *alloc_pages_prefer_node(int nid, gfp_t gfp_mask, unsigned int order) { VM_BUG_ON(nid 0 || nid = MAX_NUMNODES || !node_online(nid)); return __alloc_pages(gfp_mask, order, node_zonelist(nid, gfp_mask)); } So _prefer_node is just a tiny optimization over the other one. It should be maybe called __alloc_pages_node() then? This would perhaps discourage users outside of mm/arch code (where it may matter). The savings of a skipped branch is likely dubious anyway... It would be also nice if alloc_pages_node() could use __alloc_pages_node() internally, but I'm not sure if all callers are safe wrt the VM_BUG_ON(!node_online(nid)) part. So when the alloc_pages_prefer_node is diminished as __alloc_pages_node or outright removed, then maybe alloc_pages_exact_node() which adds __GFP_THISNODE on its own, might be a useful wrapper. But I agree with Christoph it's a duplication of the gfp_flags functionality and I don't think there would be many users left anyway. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] mm: rename and document alloc_pages_exact_node
On 21/07/2015 15:55, Vlastimil Babka wrote: diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 2d73807..a8723a8 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -3158,7 +3158,7 @@ static struct vmcs *alloc_vmcs_cpu(int cpu) struct page *pages; struct vmcs *vmcs; - pages = alloc_pages_exact_node(node, GFP_KERNEL, vmcs_config.order); + pages = alloc_pages_prefer_node(node, GFP_KERNEL, vmcs_config.order); if (!pages) return NULL; vmcs = page_address(pages); Even though there's a pretty strong preference for the right node, things can work if the node is the wrong one. The order is always zero in practice, so the allocation should succeed. Paolo ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH V4 2/6] mm: mlock: Add new mlock, munlock, and munlockall system calls
On 07/21/2015 09:59 PM, Eric B Munson wrote: With the refactored mlock code, introduce new system calls for mlock, munlock, and munlockall. The new calls will allow the user to specify what lock states are being added or cleared. mlock2 and munlock2 are trivial at the moment, but a follow on patch will add a new mlock state making them useful. munlock2 addresses a limitation of the current implementation. If a ^ munlockall2? user calls mlockall(MCL_CURRENT | MCL_FUTURE) and then later decides that MCL_FUTURE should be removed, they would have to call munlockall() followed by mlockall(MCL_CURRENT) which could potentially be very expensive. The new munlockall2 system call allows a user to simply clear the MCL_FUTURE flag. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [V2] powerpc/signal: Add helper function to fetch quad word aligned pointer
On Mon, 2015-20-07 at 02:58:43 UTC, Anshuman Khandual wrote: This patch adds one helper function 'sigcontext_vmx_regs' which computes quad word aligned pointer for 'vmx_reserve' array element in sigcontext structure making the code more readable. Signed-off-by: Anshuman Khandual khand...@linux.vnet.ibm.com Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/2476c09f391eddb546a7 cheers ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: powerpc/eeh: Dump PHB diag-data for non-existing PE
On Tue, 2015-12-05 at 07:05:32 UTC, Gavin Shan wrote: When detecting EEH error on non-existing PE, including the reserved one, the PE is simply unfrozen without dumping the PHB diag-data, which is useful for locating the root cause of the EEH error. The patch dumps the PHB diag-data when non-existing PE reports error. Signed-off-by: Gavin Shan gws...@linux.vnet.ibm.com Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/79cd95200035fb4b39b0 cheers ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
RE: [PATCH][v2] powerpc/fsl-booke: Add T1040D4RDB/T1042D4RDB board support
-Original Message- From: Wood Scott-B07421 Sent: Friday, July 17, 2015 10:37 PM To: Jain Priyanka-B32167 Cc: linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH][v2] powerpc/fsl-booke: Add T1040D4RDB/T1042D4RDB board support On Fri, 2015-07-17 at 01:17 -0500, Jain Priyanka-B32167 wrote: -Original Message- From: Wood Scott-B07421 Sent: Friday, July 17, 2015 1:06 AM To: Jain Priyanka-B32167 Cc: linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH][v2] powerpc/fsl-booke: Add T1040D4RDB/T1042D4RDB board support +i2c@118100{ + mux@77{ + compatible = nxp,pca9546; + reg = 0x77; + #address-cells = 1; + #size-cells = 0; + }; + }; A mux with no nodes under it (and yet it has #address-cells/#size- cells)? What is it multiplexing? [Priyanka]: PCA9546 is i2c mux device , to which other i2c devices (up-to 8 ) can be further connected on output channels On T104xD4RDB, channel 0, 1, 3 line are connected to PEX device, Channel 2 to hdmi interface (initialization is done in u-boot only), other channels are grounded. So, as such Linux is not using the second level I2C devices connected on this MUX device. So, I have not shown next level hierarchy. Should I replace 'mux' with some other name? . Please suggest. The device tree describes the hardware, not just what Linux uses... but what I don't understand is why you describe the mux at all if you're not going to describe what goes underneath it. [Jain Priyanka-B32167] : Is below looks OK? i2c@118100{ + i2c@77{ + compatible = nxp,pca9546; + reg = 0x77; + #address-cells = 1; + #size-cells = 0; + }; + }; Where in my above comment did it appear that I was complaining about the node name? [Jain Priyanka-B32167] From what I understand: PCA9546 is a mux device and it would be good if we were able to present the I2C devices on output lines as subnodes like in case of B4qds board and then 'mux' name would have make more sense. But in case of T1040D4RDB board, output i2c lines are going to PEX slots, PCI connector. I am not aware of how to represents them as sub-nodes in dts. -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: powerpc/rtas: Introduce rtas_get_sensor_fast() for IRQ handlers
On Fri, 2015-17-07 at 10:46:58 UTC, Thomas Huth wrote: The EPOW interrupt handler uses rtas_get_sensor(), which in turn uses rtas_busy_delay() to wait for RTAS becoming ready in case it is necessary. But rtas_busy_delay() is annotated with might_sleep() and thus may not be used by interrupts handlers like the EPOW handler! This leads to the following BUG when CONFIG_DEBUG_ATOMIC_SLEEP is enabled: When did we break this? cheers ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH V4 5/6] mm: mmap: Add mmap flag to request VM_LOCKONFAULT
On Tue, Jul 21, 2015 at 03:59:40PM -0400, Eric B Munson wrote: The cost of faulting in all memory to be locked can be very high when working with large mappings. If only portions of the mapping will be used this can incur a high penalty for locking. Now that we have the new VMA flag for the locked but not present state, expose it as an mmap option like MAP_LOCKED - VM_LOCKED. What is advantage over mmap() + mlock(MLOCK_ONFAULT)? -- Kirill A. Shutemov ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: powerpc/eeh: Fix wrong printed PE number
On Tue, 2015-12-05 at 07:05:22 UTC, Gavin Shan wrote: On LE kernel, the non-existing PE number in BE format derived from skiboot firmware isn't converted to LE format properly as following kernel log indicates: EEH: Clear non-existing PHB#4-PE#200 Signed-off-by: Gavin Shan gws...@linux.vnet.ibm.com Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/0f36db77643b6fb57331 cheers ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [RFC 4/8] powerpc/slb: Add some helper functions to improve modularization
On Tue, 2015-07-21 at 12:28 +0530, Anshuman Khandual wrote: From: khand...@linux.vnet.ibm.com khand...@linux.vnet.ibm.com This patch adds the following helper functions to improve modularization and readability of the code. (1) slb_invalid_all: Invalidates entire SLB This reads badly. Although invalid can be a verb, the meaning of invalid as a verb is not correct here. You want invalidate. (2) slb_invalid_paca_slots: Invalidate SLB entries present in PACA Ditto. But, I think that's the wrong abstraction. We should just have one routine, slb_invalidate(), which deals with all the mess. ie. checking the MMU_FTR and the offset etc. So basically the whole if/else. (3) kernel_linear_vsid_flags: VSID flags for kernel linear mapping (4) kernel_virtual_vsid_flags:VSID flags for kernel virtual mapping I don't like these names either. diff --git a/arch/powerpc/mm/slb.c b/arch/powerpc/mm/slb.c index cbeaaa2..dcba4c2 100644 --- a/arch/powerpc/mm/slb.c +++ b/arch/powerpc/mm/slb.c @@ -94,18 +94,37 @@ static inline void new_shadowed_slbe(unsigned long ea, int ssize, : memory ); } +static inline unsigned long kernel_linear_vsid_flags(void) +{ + return SLB_VSID_KERNEL | mmu_psize_defs[mmu_linear_psize].sllp; +} mmu_linear_vsid_flags() ? + +static inline unsigned long kernel_virtual_vsid_flags(void) +{ + return SLB_VSID_KERNEL | mmu_psize_defs[mmu_vmalloc_psize].sllp; +} mmu_vmalloc_vsid_flags() ? etc. ie. have the function names match the mmu psize names. I don't think we need kernel in the name, I think that's implied. cheers ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [RFC 3/8] powerpc/slb: Define macros for the bolted slots
On Tue, 2015-07-21 at 12:28 +0530, Anshuman Khandual wrote: From: khand...@linux.vnet.ibm.com khand...@linux.vnet.ibm.com This patch defines macros for all the three bolted SLB slots. This also renames the 'create_shadowed_slb' function as 'new_shadowed_slb'. Signed-off-by: Anshuman Khandual khand...@linux.vnet.ibm.com --- arch/powerpc/mm/slb.c | 27 +++ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/arch/powerpc/mm/slb.c b/arch/powerpc/mm/slb.c index 3842a54..cbeaaa2 100644 --- a/arch/powerpc/mm/slb.c +++ b/arch/powerpc/mm/slb.c @@ -25,6 +25,9 @@ #include asm/udbg.h #include asm/code-patching.h +#define SLOT_KLINR 0/* kernel linear map (0xc) */ Call it LINEAR_SLOT ? +#define SLOT_KVIRT 1/* kernel virtual map (0xd) */ VMALLOC_SLOT +#define SLOT_KSTACK 2/* kernel stack map (0xf) */ KSTACK_SLOT And the comment is wrong, it's not 0xf00.., that's the vmemmap. I know we're inconsistent about FOO_SLOT vs SLOT_FOO at times, but I think in this case it reads better as FOO_SLOT. Actually even better, make it an enum? cheers ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] powerpc/fsl-pci: fix pcie range issue for some P1/P2 boards
From: Hou Zhiqiang b48...@freescale.com Impact board list: P1020MBG-PC. P1022DS, P2020RDB All above boards have its PCIE memory range less than 0xbfff_, but in dts its boundary value was 0xe000. Both of them was maped to the same boundary 0xe000 which was Overlapped and crossed. Cpu will access the illicit memery addr and detect error then lead to cpu stall. So update dts for these boards. error log: PCI host bridge /pcie@ffe09000 (primary) ranges: MEM 0xa000..0xbfff - 0xe000 IO 0xffc1..0xffc1 - 0x /pcie@ffe09000: PCICSRBAR @ 0xdff0 Found FSL PCI host bridge at 0xffe0a000. Firmware bus number: 0-0 PCI host bridge /pcie@ffe0a000 ranges: MEM 0x8000..0x9fff - 0xe000 IO 0xffc0..0xffc0 - 0x /pcie@ffe0a000: PCICSRBAR @ 0xdff0 . ata2: SATA link down (SStatus 0 SControl 300) INFO: rcu_sched self-detected stall on CPU { 1} INFO: rcu_sched detected stalls on CPUs/tasks: { 1} (detected by 0, t=5252 jiffies, g=4294967053, c=4294967052, q=76) Task dump for CPU 1: swapper/0 R running 0 1 0 0x0804 Call Trace: [ee049c30] [c00091c8] timer_interrupt+0x180/0x1a0 (unreliable) [ee049c60] [c000e7ec] ret_from_except+0x0/0x18 Signed-off-by: Hou Zhiqiang b48...@freescale.com --- arch/powerpc/boot/dts/p1020mbg-pc_32b.dts | 14 +++--- arch/powerpc/boot/dts/p1022ds_32b.dts | 18 +- arch/powerpc/boot/dts/p2020rdb-pc_32b.dts | 12 ++-- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/arch/powerpc/boot/dts/p1020mbg-pc_32b.dts b/arch/powerpc/boot/dts/p1020mbg-pc_32b.dts index ab8f076..4dfbd30 100644 --- a/arch/powerpc/boot/dts/p1020mbg-pc_32b.dts +++ b/arch/powerpc/boot/dts/p1020mbg-pc_32b.dts @@ -55,12 +55,12 @@ }; pci0: pcie@ffe09000 { - reg = 0x0 0xffe09000 0x0 0x1000; - ranges = 0x200 0x0 0xe000 0x0 0xa000 0x0 0x2000 + ranges = 0x200 0x0 0xa000 0x0 0xa000 0x0 0x2000 0x100 0x0 0x 0x0 0xffc1 0x0 0x1; + reg = 0x0 0xffe09000 0x0 0x1000; pcie@0 { - ranges = 0x200 0x0 0xe000 - 0x200 0x0 0xe000 + ranges = 0x200 0x0 0xa000 + 0x200 0x0 0xa000 0x0 0x2000 0x100 0x0 0x0 @@ -71,11 +71,11 @@ pci1: pcie@ffe0a000 { reg = 0x0 0xffe0a000 0x0 0x1000; - ranges = 0x200 0x0 0xe000 0x0 0x8000 0x0 0x2000 + ranges = 0x200 0x0 0x8000 0x0 0x8000 0x0 0x2000 0x100 0x0 0x 0x0 0xffc0 0x0 0x1; pcie@0 { - ranges = 0x200 0x0 0xe000 - 0x200 0x0 0xe000 + ranges = 0x200 0x0 0x8000 + 0x200 0x0 0x8000 0x0 0x2000 0x100 0x0 0x0 diff --git a/arch/powerpc/boot/dts/p1022ds_32b.dts b/arch/powerpc/boot/dts/p1022ds_32b.dts index d96cae0..803e0db 100644 --- a/arch/powerpc/boot/dts/p1022ds_32b.dts +++ b/arch/powerpc/boot/dts/p1022ds_32b.dts @@ -54,12 +54,12 @@ }; pci0: pcie@ffe09000 { - ranges = 0x200 0x0 0xe000 0 0xa000 0x0 0x2000 + ranges = 0x200 0x0 0xa000 0 0xa000 0x0 0x2000 0x100 0x0 0x 0 0xffc1 0x0 0x1; reg = 0x0 0xffe09000 0 0x1000; pcie@0 { - ranges = 0x200 0x0 0xe000 - 0x200 0x0 0xe000 + ranges = 0x200 0x0 0xa000 + 0x200 0x0 0xa000 0x0 0x2000 0x100 0x0 0x0 @@ -69,12 +69,12 @@ }; pci1: pcie@ffe0a000 { - ranges = 0x200 0x0 0xe000 0 0xc000 0x0 0x2000 + ranges = 0x200 0x0 0xc000 0 0xc000 0x0 0x2000 0x100 0x0 0x 0 0xffc2 0x0 0x1; reg = 0 0xffe0a000 0 0x1000; pcie@0 { - ranges = 0x200 0x0 0xe000 - 0x200 0x0 0xe000 + ranges = 0x200 0x0 0xc000 + 0x200 0x0 0xc000 0x0 0x2000 0x100 0x0 0x0 @@ -84,12 +84,12 @@ }; pci2: pcie@ffe0b000 {
Re: powerpc/rtas: Introduce rtas_get_sensor_fast() for IRQ handlers
On 22/07/15 13:25, Michael Ellerman wrote: On Fri, 2015-17-07 at 10:46:58 UTC, Thomas Huth wrote: The EPOW interrupt handler uses rtas_get_sensor(), which in turn uses rtas_busy_delay() to wait for RTAS becoming ready in case it is necessary. But rtas_busy_delay() is annotated with might_sleep() and thus may not be used by interrupts handlers like the EPOW handler! This leads to the following BUG when CONFIG_DEBUG_ATOMIC_SLEEP is enabled: When did we break this? Hi Michael, the bug has been introduced by commit 587f83e8dd50d22bc0c62e32ec49fd31 (powerpc/pseries: Use rtas_get_sensor in RAS code) which switched the EPOW handler to use rtas_get_sensor() instead of using rtas_call directly. Also have a look at this thread here: http://www.spinics.net/lists/kvm-ppc/msg10768.html Thomas ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH V4 4/6] mm: mlock: Introduce VM_LOCKONFAULT and add mlock flags to enable it
On 07/21/2015 09:59 PM, Eric B Munson wrote: The cost of faulting in all memory to be locked can be very high when working with large mappings. If only portions of the mapping will be used this can incur a high penalty for locking. For the example of a large file, this is the usage pattern for a large statical language model (probably applies to other statical or graphical models as well). For the security example, any application transacting in data that cannot be swapped out (credit card data, medical records, etc). This patch introduces the ability to request that pages are not pre-faulted, but are placed on the unevictable LRU when they are finally faulted in. This can be done area at a time via the mlock2(MLOCK_ONFAULT) or the mlockall(MCL_ONFAULT) system calls. These calls can be undone via munlock2(MLOCK_ONFAULT) or munlockall2(MCL_ONFAULT). Applying the VM_LOCKONFAULT flag to a mapping with pages that are already present required the addition of a function in gup.c to pin all pages which are present in an address range. It borrows heavily from __mm_populate(). To keep accounting checks out of the page fault path, users are billed for the entire mapping lock as if MLOCK_LOCKED was used. Hi, I think you should include a complete description of which transitions for vma states and mlock2/munlock2 flags applied on them are valid and what they do. It will also help with the manpages. You explained some to Jon in the last thread, but I think there should be a canonical description in changelog (if not also Documentation, if mlock is covered there). For example the scenario Jon asked, what happens after a mlock2(MLOCK_ONFAULT) followed by mlock2(MLOCK_LOCKED), and that the answer is nothing. Your promised code comment for apply_vma_flags() doesn't suffice IMHO (and I'm not sure it's there, anyway?). But the more I think about the scenario and your new VM_LOCKONFAULT vma flag, it seems awkward to me. Why should munlocking at all care if the vma was mlocked with MLOCK_LOCKED or MLOCK_ONFAULT? In either case the result is that all pages currently populated are munlocked. So the flags for munlock2 should be unnecessary. I also think VM_LOCKONFAULT is unnecessary. VM_LOCKED should be enough - see how you had to handle the new flag in all places that had to handle the old flag? I think the information whether mlock was supposed to fault the whole vma is obsolete at the moment mlock returns. VM_LOCKED should be enough for both modes, and the flag to mlock2 could just control whether the pre-faulting is done. So what should be IMHO enough: - munlock can stay without flags - mlock2 has only one new flag MLOCK_ONFAULT. If specified, pre-faulting is not done, just set VM_LOCKED and mlock pages already present. - same with mmap(MAP_LOCKONFAULT) (need to define what happens when both MAP_LOCKED and MAP_LOCKONFAULT are specified). Now mlockall(MCL_FUTURE) muddles the situation in that it stores the information for future VMA's in current-mm-def_flags, and this def_flags would need to distinguish VM_LOCKED with population and without. But that could be still solvable without introducing a new vma flag everywhere. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [RFC 5/8] powerpc/slb: Add documentation to runtime patching of SLB encoding
On Wed, Jul 22, 2015 at 03:51:03PM +1000, Michael Ellerman wrote: How about: /* * This function patches either an li or a cmpldi instruction with * a new immediate value. This relies on the fact that both li * (which is actually ori) and cmpldi both take a 16-bit immediate * value, and it is situated in the same location in the instruction, * ie. bits 0-15. * To patch the value we read the existing instruction, clear the * immediate value, and or in our new value, then write the instruction * back. */ As Gabriel says, li is addi. It takes a 16-bit sign-extended immediate, while cmpldi takes a 16-bit zero-extended immediate. This function doesn't deal with that difference, it probably should (I didn't check if the callers take care; there should be an assertion somewhere). Segher ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 1/2] Move the pt_regs_offset struct definition from arch to common include file
On 07/22/15 01:11, Michael Ellerman wrote: On Wed, 2015-07-22 at 00:46 -0400, David Long wrote: On 06/29/15 23:29, Michael Ellerman wrote: On Wed, 2015-06-17 at 14:30 -0400, David Long wrote: On 06/16/15 09:17, Rob Herring wrote: On Mon, Jun 15, 2015 at 11:42 AM, David Long dave.l...@linaro.org wrote: #define REG_OFFSET_NAME(r) \ {.name = #r, .offset = offsetof(struct pt_regs, ARM_##r)} #define REG_OFFSET_END {.name = NULL, .offset = 0} Can't you also move these? ARM is complicated with the ARM_ prefixing, but the others appear to be the same. Maybe you can remove the prefix or redefine the macro for ARM. That would mandate that all the architecture-specific pt_regs structures would have to use a top-level named field for each named register. Why does it mandate that? See eg. powerpc where we use REG_OFFSET_NAME for the top-level named fields and then a different macro for the array elements: #define REG_OFFSET_NAME(r) {.name = #r, .offset = offsetof(struct pt_regs, r)} #define GPR_OFFSET_NAME(num)\ {.name = STR(gpr##num), .offset = offsetof(struct pt_regs, gpr[num])} static const struct pt_regs_offset regoffset_table[] = { GPR_OFFSET_NAME(0), GPR_OFFSET_NAME(1), GPR_OFFSET_NAME(2), GPR_OFFSET_NAME(3), ... REG_OFFSET_NAME(nip), REG_OFFSET_NAME(msr), So I don't see why REG_OFFSET_NAME couldn't be common. Sorry for the delay in responding to this. OK, so you're saying architectures that don't want this constraint can make their own macro. Seems to make this whole exercise slightly less useful, but whatever. Well yeah. In fact of the 4 arches that use REG_OFFSET_NAME, 2 already have another macro for specially named registers (powerpc sh). I see three ways to go here: 1) Leave it as is. 2) Force all architectures to use a common definition. 3) Provide a common definition that all architectures (except arm) currently using this functionality will use. I have a v2 patch to implement #3, ready to post. Do we think this is the way to go? Yeah I think it is. How are you making it conditional? Just #ifndef REG_OFFSET_NAME? I'm just defining a new macro for arm. The macro is only invoked in one arm file. Then the REG_OFFSET_NAME macro goes unused for this architecture. I don't like #2 because I really don't want to rename all uses of the current register fields for arm since this is architecture-specific code to begin with and since it affects code in 39 arm source files. I guess you're talking about renaming all the ARM_x regs to x. That would likely cause problems because they're implemented as #defines, eg. #define r0 uregs[0] would probably confuse your assembler. Yeah, and I had not looked further to the implications of doing that but I see you've found where it is a genuine problem. The clean thing to do would be to have the in-kernel struct pt_regs have actual named members, but that would still be an intrusive change. cheers Thanks, -dl ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] powerpc/corenet32: enable DMA in defconfig
By default we enable DMA(CONFIG_FSL_DMA) support which are needed on P2041RDB, P3041DS, P4080DS, B4860QDS, etc. Signed-off-by: Yuan Yao yao.y...@freescale.com --- arch/powerpc/configs/corenet32_smp_defconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerpc/configs/corenet32_smp_defconfig b/arch/powerpc/configs/corenet32_smp_defconfig index 3765993..0c175cc 100644 --- a/arch/powerpc/configs/corenet32_smp_defconfig +++ b/arch/powerpc/configs/corenet32_smp_defconfig @@ -143,6 +143,8 @@ CONFIG_RTC_DRV_DS1307=y CONFIG_RTC_DRV_DS1374=y CONFIG_RTC_DRV_DS3232=y CONFIG_UIO=y +CONFIG_DMADEVICES=y +CONFIG_FSL_DMA=y CONFIG_VIRT_DRIVERS=y CONFIG_FSL_HV_MANAGER=y CONFIG_STAGING=y -- 2.1.0.27.g96db324 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v5 3/7] powerpc/powernv: Nest PMU detection and device tree parser
On Wednesday 22 July 2015 09:19 AM, Daniel Axtens wrote: Hi, +static struct perchip_nest_info p8_nest_perchip_info[P8_NEST_MAX_CHIPS]; + +static int nest_ima_dt_parser(void) +{ +const __be32 *gcid; +const __be64 *chip_ima_reg; +const __be64 *chip_ima_size; +struct device_node *dev; +struct perchip_nest_info *p8ni; +int idx; + +/* + * nest-ima folder contains two things, + * a) per-chip reserved memory region for Nest PMU Counter data + * b) Support Nest PMU units and their event files + */ +for_each_node_with_property(dev, ibm,ima-chip) { +gcid = of_get_property(dev, ibm,chip-id, NULL); +chip_ima_reg = of_get_property(dev, reg, NULL); +chip_ima_size = of_get_property(dev, size, NULL); + +if ((!gcid) || (!chip_ima_reg) || (!chip_ima_size)) { +pr_err(Nest_PMU: device %s missing property\n, +dev-full_name); +return -ENODEV; +} + +/* chip id to save reserve memory region */ +idx = (uint32_t)be32_to_cpup(gcid); So be32_to_cpup returns a __u32. You're casting to a uint32_t and then assigning to an int. - Do you need the intermediate cast? - Should idx be an unsigned type? my bad, sorry abt type case of uint to int. And your are right, idx can be __u32 (__u32 and uint32_t are same i guess). + +/* + * Using a local variable to make it compact and + * easier to read + */ We probably don't need this comment. But a better variable name would be helpful! I dont want a long name since i end up with 80 char limit warning. but let me see. +p8ni = p8_nest_perchip_info[idx]; +p8ni-pbase = be64_to_cpup(chip_ima_reg); +p8ni-size = be64_to_cpup(chip_ima_size); +p8ni-vbase = (uint64_t) phys_to_virt(p8ni-pbase); +} + +return 0; +} + +static int __init nest_pmu_init(void) +{ +int ret = -ENODEV; + +/* + * Lets do this only if we are hypervisor + */ +if (!cur_cpu_spec-oprofile_cpu_type || +!(strcmp(cur_cpu_spec-oprofile_cpu_type, ppc64/power8) == 0) || +!cpu_has_feature(CPU_FTR_HVMODE)) +return ret; + I'm still really uncomfortable with doing this via oprofile_cpu_type. If the kernel is compiled without oprofile support, will that get populated? I checked the per thread pmu register code and it all does the name. But that should not stop nest pmu to enable. So probability, I can carry only the HV mode check and drop the oprofile check. I'm also curious about why we need checking for power8 at all. We already know we're not going to run on hardware without a nest PMU because of the device tree check below. What happens if there's a future generation of chip that supports nest PMUs? If it's really important to check versions in this function, maybe you could put a version property in the ibm,ima-chip node? True. I should not checkout power8 now, since we enable based on device tree entries for Nest pmu. +/* + * Nest PMU information is grouped under nest-ima node + * of the top-level device-tree directory. Detect Nest PMU + * by the ibm,ima-chip property. + */ +if (!of_find_node_with_property(NULL, ibm,ima-chip)) +return ret; + +/* + * Parse device-tree for Nest PMU information + */ +ret = nest_ima_dt_parser(); +if (ret) +return ret; + +return 0; +} +device_initcall(nest_pmu_init); ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] powerpc/corenet: use the mixed mode of MPIC when enabling CPU hotplug
Core reset may cause issue if using the proxy mode of MPIC. Use the mixed mode of MPIC if enabling CPU hotplug. Signed-off-by: Chenhui Zhao chenhui.z...@freescale.com --- arch/powerpc/platforms/85xx/corenet_generic.c | 8 1 file changed, 8 insertions(+) diff --git a/arch/powerpc/platforms/85xx/corenet_generic.c b/arch/powerpc/platforms/85xx/corenet_generic.c index bd839dc..0119224 100644 --- a/arch/powerpc/platforms/85xx/corenet_generic.c +++ b/arch/powerpc/platforms/85xx/corenet_generic.c @@ -212,7 +212,15 @@ define_machine(corenet_generic) { .pcibios_fixup_bus = fsl_pcibios_fixup_bus, .pcibios_fixup_phb = fsl_pcibios_fixup_phb, #endif +/* + * Core reset may cause issue if using the proxy mode of MPIC. + * So, use the mixed mode of MPIC if enabling CPU hotplug. + */ +#ifdef CONFIG_HOTPLUG_CPU + .get_irq= mpic_get_irq, +#else .get_irq= mpic_get_coreint_irq, +#endif .restart= fsl_rstcr_restart, .calibrate_decr = generic_calibrate_decr, .progress = udbg_progress, -- 1.9.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] mm: rename and document alloc_pages_exact_node
On Wed, 22 Jul 2015, Paolo Bonzini wrote: diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 2d73807..a8723a8 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -3158,7 +3158,7 @@ static struct vmcs *alloc_vmcs_cpu(int cpu) struct page *pages; struct vmcs *vmcs; - pages = alloc_pages_exact_node(node, GFP_KERNEL, vmcs_config.order); + pages = alloc_pages_prefer_node(node, GFP_KERNEL, vmcs_config.order); if (!pages) return NULL; vmcs = page_address(pages); Even though there's a pretty strong preference for the right node, things can work if the node is the wrong one. The order is always zero in practice, so the allocation should succeed. You're code is fine both before and after the patch since __GFP_THISNODE isn't set. The allocation will eventually succeed but, as you said, may be from remote memory (and the success of allocating on node may be influenced by the global setting of zone_reclaim_mode). ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] mm: rename and document alloc_pages_exact_node
On Wed, 22 Jul 2015, Vlastimil Babka wrote: alloc_pages_exact_node(), as you said, connotates that the allocation will take place on that node or will fail. So why not go beyond this patch and actually make alloc_pages_exact_node() set __GFP_THISNODE and then call into a new alloc_pages_prefer_node(), which would be the current alloc_pages_exact_node() implementation, and then fix up the callers? OK, but then we have alloc_pages_node(), alloc_pages_prefer_node() and alloc_pages_exact_node(). Isn't that a bit too much? The first two differ only in tiny bit: static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask, unsigned int order) { /* Unknown node is current node */ if (nid 0) nid = numa_node_id(); return __alloc_pages(gfp_mask, order, node_zonelist(nid, gfp_mask)); } static inline struct page *alloc_pages_prefer_node(int nid, gfp_t gfp_mask, unsigned int order) { VM_BUG_ON(nid 0 || nid = MAX_NUMNODES || !node_online(nid)); return __alloc_pages(gfp_mask, order, node_zonelist(nid, gfp_mask)); } Eek, yeah, that does look bad. I'm not even sure the if (nid 0) nid = numa_node_id(); is correct; I think this should be comparing to NUMA_NO_NODE rather than all negative numbers, otherwise we silently ignore overflow and nobody ever knows. So _prefer_node is just a tiny optimization over the other one. It should be maybe called __alloc_pages_node() then? This would perhaps discourage users outside of mm/arch code (where it may matter). The savings of a skipped branch is likely dubious anyway... It would be also nice if alloc_pages_node() could use __alloc_pages_node() internally, but I'm not sure if all callers are safe wrt the VM_BUG_ON(!node_online(nid)) part. I'm not sure how large you want to make your patch :) In a perfect world I would think that we wouldn't have an alloc_pages_prefer_node() at all and everything would be converted to alloc_pages_node() which would do if (nid == NUMA_NO_NODE) nid = numa_mem_id(); VM_BUG_ON(nid 0 || nid = MAX_NUMNODES || !node_online(nid)); return __alloc_pages(gfp_mask, order, node_zonelist(nid, gfp_mask)); and then alloc_pages_exact_node() would do return alloc_pages_node(nid, gfp_mask | __GFP_THISNODE, order); and existing alloc_pages_exact_node() callers fixed up depending on whether they set the bit or not. The only possible downside would be existing users of alloc_pages_node() that are calling it with an offline node. Since it's a VM_BUG_ON() that would catch that, I think it should be changed to a VM_WARN_ON() and eventually fixed up because it's nonsensical. VM_BUG_ON() here should be avoided. Or just go with a single alloc_pages_node() and rename __GFP_THISNODE to __GFP_EXACT_NODE which may accomplish the same thing :) ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [RFC v4 03/25] m68k/atari: Move Atari-specific code out of drivers/char/nvram.c
On Wed, Jul 22, 2015 at 02:22:21PM +1000, Finn Thain wrote: On Wed, 22 Jul 2015, Michael Schmitz wrote: Hi Finn, I'm afraid I cannot test anything on Atari hardware at present - my Falcon ate it's IDE disk partition table with all the fun that entails. That doesn't sound good. Haven't even begun to try and recover that yet. If you send a patch I could build a kernel and send that to Christian for testing (if he's got his Falcon up and running - might be a tad warm in the attic for that, in fact). Anyone with a suitable Atari, i.e. ATARIHW_PRESENT(TT_CLK), who can boot both TOS and Linux could resolve the question. (Perhaps with an emulator?) The Falcon is not powered on currently but it should still work. What should I test? Any old kernel binary would do, since atari_scsi should print either HOSTID=n or this_id n at startup. If n doesn't agree with what TOS says about the host's SCSI ID, then I think a trivial patch is safe enough. Especially if cat /proc/driver/nvram produces a SCSI host ID : m that does agree with TOS. Christian ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] rtc/rtc-opal: Enable alarms only when opal supports tpo
On 14/07/2015 at 13:28:28 +0530, Vaibhav Jain wrote : rtc-opal driver provides support for rtc alarms via timed-power-on(tpo). However some Power platforms like BML use a fake rtc clock and don't support tpo. Such platforms are indicated by the missing 'has-tpo' property in the device tree. Current implementation however enables callback for rtc_class_ops.read/set alarm irrespective of the tpo support from the platform. This results in a failed opal call when kernel tries to read an existing alarms via opal_get_tpo_time during rtc device registration. This patch fixes this issue by setting opal_rtc_ops.read/set_alarm callback pointers only when tpo is supported. Acked-by: Michael Neuling mi...@neuling.org Acked-by: Neelesh Gupta neele...@linux.vnet.ibm.com Signed-off-by: Vaibhav Jain vaib...@linux.vnet.ibm.com --- drivers/rtc/rtc-opal.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) Applied, thanks. -- Alexandre Belloni, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v3 7/8] perf: Define PMU_TXN_READ interface
Peter Zijlstra [pet...@infradead.org] wrote: | I've not woken up yet, and not actually fully read the email, but can | you stuff the entire above chunk inside the IPI? | | I think you could then actually optimize __perf_event_read() as well, | because all these events should be on the same context, so no point in | calling update_*time*() for every event or so. | Do you mean something like this (will move the rename to a separate patch before posting): -- From e8eddb5d3877ebdb3b71213a00aaa980f4010dd0 Mon Sep 17 00:00:00 2001 From: Sukadev Bhattiprolu suka...@linux.vnet.ibm.com Date: Tue, 7 Jul 2015 21:45:23 -0400 Subject: [PATCH 1/1] perf: Define PMU_TXN_READ interface Define a new PERF_PMU_TXN_READ interface to read a group of counters at once. Note that we use this interface with all PMUs. PMUs that implement this interface use the -read() operation to _queue_ the counters to be read and use -commit_txn() to actually read all the queued counters at once. PMUs that don't implement PERF_PMU_TXN_READ ignore -start_txn() and -commit_txn() and continue to read counters one at a time. Thanks to input from Peter Zijlstra. Signed-off-by: Sukadev Bhattiprolu suka...@linux.vnet.ibm.com --- Changelog[v5] [Peter Zijlstra] Ensure the entire transaction happens on the same CPU. Changelog[v4] [Peter Zijlstra] Add lockdep_assert_held() in perf_event_read_group() --- include/linux/perf_event.h |1 + kernel/events/core.c | 72 +--- 2 files changed, 62 insertions(+), 11 deletions(-) diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 44bf05f..da307ad 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h @@ -169,6 +169,7 @@ struct perf_event; #define PERF_EVENT_TXN 0x1 #define PERF_PMU_TXN_ADD 0x1 /* txn to add/schedule event on PMU */ +#define PERF_PMU_TXN_READ 0x2 /* txn to read event group from PMU */ /** * pmu::capabilities flags diff --git a/kernel/events/core.c b/kernel/events/core.c index a6bd09d..7177dd8 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -3174,12 +3174,8 @@ void perf_event_exec(void) rcu_read_unlock(); } -/* - * Cross CPU call to read the hardware event - */ -static void __perf_event_read(void *info) +static void __perf_event_read(struct perf_event *event, int update_ctx) { - struct perf_event *event = info; struct perf_event_context *ctx = event-ctx; struct perf_cpu_context *cpuctx = __get_cpu_context(ctx); @@ -3194,7 +3190,7 @@ static void __perf_event_read(void *info) return; raw_spin_lock(ctx-lock); - if (ctx-is_active) { + if (ctx-is_active update_ctx) { update_context_time(ctx); update_cgrp_time_from_event(event); } @@ -3204,6 +3200,16 @@ static void __perf_event_read(void *info) raw_spin_unlock(ctx-lock); } +/* + * Cross CPU call to read the hardware event + */ +static void __perf_event_read_ipi(void *info) +{ + struct perf_event *event = info; + + __perf_event_read(event, 1); +} + static inline u64 perf_event_count(struct perf_event *event) { if (event-pmu-count) @@ -3220,7 +3226,7 @@ static void perf_event_read(struct perf_event *event) */ if (event-state == PERF_EVENT_STATE_ACTIVE) { smp_call_function_single(event-oncpu, -__perf_event_read, event, 1); +__perf_event_read_ipi, event, 1); } else if (event-state == PERF_EVENT_STATE_INACTIVE) { struct perf_event_context *ctx = event-ctx; unsigned long flags; @@ -3765,6 +3771,36 @@ static void orphans_remove_work(struct work_struct *work) put_ctx(ctx); } +/* + * Use the transaction interface to read the group of events in @leader. + * PMUs like the 24x7 counters in Power, can use this to queue the events + * in the -read() operation and perform the actual read in -commit_txn. + * + * Other PMUs can ignore the -start_txn and -commit_txn and read each + * PMU directly in the -read() operation. + */ +static int perf_event_read_group(struct perf_event *leader) +{ + int ret; + struct perf_event *sub; + struct pmu *pmu; + struct perf_event_context *ctx = leader-ctx; + + lockdep_assert_held(ctx-mutex); + + pmu = leader-pmu; + + pmu-start_txn(pmu, PERF_PMU_TXN_READ); + + __perf_event_read(leader, 1); + list_for_each_entry(sub, leader-sibling_list, group_entry) + __perf_event_read(sub, 0); + + ret = pmu-commit_txn(pmu); + + return ret; +} + u64 perf_event_read_value(struct perf_event *event, u64 *enabled, u64 *running) { u64 total = 0; @@ -3794,7 +3830,17 @@ static int perf_read_group(struct perf_event *event, lockdep_assert_held(ctx-mutex); - count = perf_event_read_value(leader,
Re: [RFC v4 03/25] m68k/atari: Move Atari-specific code out of drivers/char/nvram.c
On Thu, 23 Jul 2015, Michael Schmitz wrote: Hi Christian, if I understand Finn right, he needs the SCSI host ID reported for the Falcon SCSI chip, as found in this kernel log line: What I'd really like is a regression test for this patch series. The SCSI host ID issue is a separate one; these patches won't fix that bug. scsi host0: Atari native SCSI, io_port 0x0, n_io_port 0, base 0x0, irq 15, can_queue 8, cmd_per_lun 1, sg_tablesize 0, this_id 7, flags { }, options { REAL_DMA SUPPORT_TAGS } (see this_id; output from one of my ARAnyM instances, kernel 3.19rc6). Also, the SCSI host ID reported by cat /proc/drivers/nvram (also 7, in my case) This seems inconclusive to me. Perhaps if you were to change a setting in TOS such that the two values became unequal... TOS reports the SCSI host ID during boot (when scannig for bootable disks) IIRC. There may be some control panel to view the NVRAM settings as well (stuff like default video mode was accessible from the CT60 control panel so the SCSI host ID might be there as well). Can that be done in Aranym also? -- Cheers, Michael On Thu, Jul 23, 2015 at 2:32 AM, Christian T. Steigies c...@debian.org wrote: On Wed, Jul 22, 2015 at 02:22:21PM +1000, Finn Thain wrote: On Wed, 22 Jul 2015, Michael Schmitz wrote: Hi Finn, I'm afraid I cannot test anything on Atari hardware at present - my Falcon ate it's IDE disk partition table with all the fun that entails. That doesn't sound good. Haven't even begun to try and recover that yet. If you send a patch I could build a kernel and send that to Christian for testing (if he's got his Falcon up and running - might be a tad warm in the attic for that, in fact). Anyone with a suitable Atari, i.e. ATARIHW_PRESENT(TT_CLK), who can boot both TOS and Linux could resolve the question. (Perhaps with an emulator?) The Falcon is not powered on currently but it should still work. What should I test? Any old kernel binary would do, since atari_scsi should print either HOSTID=n or this_id n at startup. If n doesn't agree with what TOS says about the host's SCSI ID, then I think a trivial patch is safe enough. Especially if cat /proc/driver/nvram produces a SCSI host ID : m that does agree with TOS. Christian -- To unsubscribe from this list: send the line unsubscribe linux-m68k in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [RFC v4 03/25] m68k/atari: Move Atari-specific code out of drivers/char/nvram.c
Hi Christian, if I understand Finn right, he needs the SCSI host ID reported for the Falcon SCSI chip, as found in this kernel log line: scsi host0: Atari native SCSI, io_port 0x0, n_io_port 0, base 0x0, irq 15, can_queue 8, cmd_per_lun 1, sg_tablesize 0, this_id 7, flags { }, options { REAL_DMA SUPPORT_TAGS } (see this_id; output from one of my ARAnyM instances, kernel 3.19rc6). Also, the SCSI host ID reported by cat /proc/drivers/nvram (also 7, in my case) TOS reports the SCSI host ID during boot (when scannig for bootable disks) IIRC. There may be some control panel to view the NVRAM settings as well (stuff like default video mode was accessible from the CT60 control panel so the SCSI host ID might be there as well). Cheers, Michael On Thu, Jul 23, 2015 at 2:32 AM, Christian T. Steigies c...@debian.org wrote: On Wed, Jul 22, 2015 at 02:22:21PM +1000, Finn Thain wrote: On Wed, 22 Jul 2015, Michael Schmitz wrote: Hi Finn, I'm afraid I cannot test anything on Atari hardware at present - my Falcon ate it's IDE disk partition table with all the fun that entails. That doesn't sound good. Haven't even begun to try and recover that yet. If you send a patch I could build a kernel and send that to Christian for testing (if he's got his Falcon up and running - might be a tad warm in the attic for that, in fact). Anyone with a suitable Atari, i.e. ATARIHW_PRESENT(TT_CLK), who can boot both TOS and Linux could resolve the question. (Perhaps with an emulator?) The Falcon is not powered on currently but it should still work. What should I test? Any old kernel binary would do, since atari_scsi should print either HOSTID=n or this_id n at startup. If n doesn't agree with what TOS says about the host's SCSI ID, then I think a trivial patch is safe enough. Especially if cat /proc/driver/nvram produces a SCSI host ID : m that does agree with TOS. Christian ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] powerpc/rtas: Replace magic values with defines
On 07/22/2015 09:56 AM, Thomas Huth wrote: rtas.h already has some nice #defines for RTAS return status codes - let's use them instead of hard-coded magic values! Signed-off-by: Thomas Huth th...@redhat.com Reviewed-by: Tyrel Datwyler tyr...@linux.vnet.ibm.com --- arch/powerpc/kernel/rtas.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c index 7a488c1..10fb402 100644 --- a/arch/powerpc/kernel/rtas.c +++ b/arch/powerpc/kernel/rtas.c @@ -478,8 +478,9 @@ unsigned int rtas_busy_delay_time(int status) if (status == RTAS_BUSY) { ms = 1; - } else if (status = 9900 status = 9905) { - order = status - 9900; + } else if (status = RTAS_EXTENDED_DELAY_MIN +status = RTAS_EXTENDED_DELAY_MAX) { + order = status - RTAS_EXTENDED_DELAY_MIN; for (ms = 1; order 0; order--) ms *= 10; } @@ -641,7 +642,8 @@ int rtas_set_indicator_fast(int indicator, int index, int new_value) rc = rtas_call(token, 3, 1, NULL, indicator, index, new_value); - WARN_ON(rc == -2 || (rc = 9900 rc = 9905)); + WARN_ON(rc == RTAS_BUSY || (rc = RTAS_EXTENDED_DELAY_MIN + rc = RTAS_EXTENDED_DELAY_MAX)); if (rc 0) return rtas_error_rc(rc); ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v7 0/3] LED driver for PowerNV platform
The following series implements LED driver for PowerNV platform. PowerNV platform has below type of LEDs: - System attention Indicates there is a problem with the system that needs attention. - Identify Helps the user locate/identify a particular FRU or resource in the system. - Fault Indicates there is a problem with the FRU or resource at the location with which the indicator is associated. On PowerNV (Non Virtualized) platform OPAL firmware provides LED information to host via device tree (location code and LED type). During init we check for 'ibm,opal/leds' node in device tree to enable LED driver. And we use OPAL API's to get/set LEDs. Note that on PowerNV platform firmware can activate fault LED, if it can isolate the problem. Also one can modify the LEDs using service processor interface. None of these involes kernel. Hence we retain LED state in unload path. Sample LED device tree output: -- leds { compatible = ibm,opal-v3-led; led-mode = lightpath; U78C9.001.RST0027-P1-C1 { led-types = identify, fault; }; ... ... } Sample sysfs output: . ├── U78CB.001.WZS008R-A1:fault │ ├── brightness │ ├── device - ../../../opal_leds │ ├── max_brightness │ ├── power │ │ ├── async │ │ ├── autosuspend_delay_ms │ │ ├── control │ │ ├── runtime_active_kids │ │ ├── runtime_active_time │ │ ├── runtime_enabled │ │ ├── runtime_status │ │ ├── runtime_suspended_time │ │ └── runtime_usage │ ├── subsystem - ../../../../../class/leds │ ├── trigger │ └── uevent ├── U78CB.001.WZS008R-A1:identify │ ├── brightness │ ├── device - ../../../opal_leds │ ├── max_brightness │ ├── power │ │ ├── async │ │ ├── autosuspend_delay_ms │ │ ├── control │ │ ├── runtime_active_kids │ │ ├── runtime_active_time │ │ ├── runtime_enabled │ │ ├── runtime_status │ │ ├── runtime_suspended_time │ │ └── runtime_usage │ ├── subsystem - ../../../../../class/leds │ ├── trigger │ └── uevent patch 1/2: PowerNV architecture specific code. This adds necessary OPAL APIs. patch 2/2: Create LED platform device and export OPAL symbols patch 3/3: Actual LED driver implemenation for PowerNV platform. Note: - This patchset depends on Jacek's patchset https://lkml.org/lkml/2015/7/17/151 (Remove work queues from LED class drivers) - This version of patchset is based on top of v4.2-rc2. @Jacek, Let me know if you want me to rebase this patchset on top of LED tree. Previous patchset: v6: https://lists.ozlabs.org/pipermail/linuxppc-dev/2015-July/131328.html v5: https://lists.ozlabs.org/pipermail/linuxppc-dev/2015-July/130602.html v4: https://lists.ozlabs.org/pipermail/linuxppc-dev/2015-April/128028.html v3: https://lists.ozlabs.org/pipermail/linuxppc-dev/2015-April/127702.html v2: https://lists.ozlabs.org/pipermail/linuxppc-dev/2015-March/126301.html v1: https://lists.ozlabs.org/pipermail/linuxppc-dev/2015-March/125705.html Changes in v7: - Club powernv_led_data powernv_leds_priv into single structure - Removed num_leds powernv_leds_count() - Replaced per LED mutex with global mutex - Removed driver specific workqueue. Instead this version uses new global workqueue. Changes in v6: - Added loc_code and type to powernv_led_data structure instead of parsing them from led classdev name. - Fixed documentation issues. - Fixed mutex_destry issue - Replaced led_classdev_register with devm_led_classdev_register Changes in v5: - Rebased on top of Linus tree - Renamed led as leds and updated documentation - As Ben and Arnd suggested, removed phandle from documenation - As Ben suggested removed led-loc device tree property - As Jacek suggested, added back compatible property to documentation Changes in v4: - Updated macros to reflect platform. - s/u64/__be64/g for big endian data we get from firmware - Addressed review comments from Jacek. Major once are: Removed list in powernv_led_data structure s/kzalloc/devm_kzalloc/ Removed compatible property from documentation s/powernv_led_set_queue/powernv_brightness_set/ - Removed LED specific brightness_set/get function. Instead this version uses single function to queue all LED set/get requests. Later we use LED name to detect LED type and value. - Removed hardcoded LED type used in previous version. Instead we use led-types property to form LED classdev. Changes in v3: - Addressed review comments from Jacek. Major once are: Replaced spin lock and mutex and removed redundant structures Replaced pr_* with dev_* Moved OPAL platform sepcific part to separate patch Moved repteated code to common function Added device tree documentation for LEDs Changes in v2: - Rebased patches on top of mpe's next branch
[PATCH v7 3/3] leds/powernv: Add driver for PowerNV platform
This patch implements LED driver for PowerNV platform using the existing generic LED class framework. PowerNV platform has below type of LEDs: - System attention Indicates there is a problem with the system that needs attention. - Identify Helps the user locate/identify a particular FRU or resource in the system. - Fault Indicates there is a problem with the FRU or resource at the location with which the indicator is associated. We register classdev structures for all individual LEDs detected on the system through LED specific device tree nodes. Device tree nodes specify what all kind of LEDs present on the same location code. It registers LED classdev structure for each of them. All the system LEDs can be found in the same regular path /sys/class/leds/. We don't use LED colors. We use LED node and led-types property to form LED classdev. Our LEDs have names in this format. location_code:attention|identify|fault Any positive brightness value would turn on the LED and a zero value would turn off the LED. The driver will return LED_FULL (255) for any turned on LED and LED_OFF (0) for any turned off LED. As per the LED class framework, the 'brightness_set' function should not sleep. Hence these functions have been implemented through global work queue tasks which might sleep on OPAL async call completion. The platform level implementation of LED get and set state has been achieved through OPAL calls. These calls are made available for the driver by exporting from architecture specific codes. Signed-off-by: Vasant Hegde hegdevas...@linux.vnet.ibm.com Signed-off-by: Anshuman Khandual khand...@linux.vnet.ibm.com Acked-by: Stewart Smith stew...@linux.vnet.ibm.com Tested-by: Stewart Smith stew...@linux.vnet.ibm.com --- .../devicetree/bindings/leds/leds-powernv.txt | 26 ++ drivers/leds/Kconfig | 11 + drivers/leds/Makefile | 1 + drivers/leds/leds-powernv.c| 342 + 4 files changed, 380 insertions(+) create mode 100644 Documentation/devicetree/bindings/leds/leds-powernv.txt create mode 100644 drivers/leds/leds-powernv.c diff --git a/Documentation/devicetree/bindings/leds/leds-powernv.txt b/Documentation/devicetree/bindings/leds/leds-powernv.txt new file mode 100644 index 000..6665569 --- /dev/null +++ b/Documentation/devicetree/bindings/leds/leds-powernv.txt @@ -0,0 +1,26 @@ +Device Tree binding for LEDs on IBM Power Systems +- + +Required properties: +- compatible : Should be ibm,opal-v3-led. +- led-mode : Should be lightpath or guidinglight. + +Each location code of FRU/Enclosure must be expressed in the +form of a sub-node. + +Required properties for the sub nodes: +- led-types : Supported LED types (attention/identify/fault) provided + in the form of string array. + +Example: + +leds { + compatible = ibm,opal-v3-led; + led-mode = lightpath; + + U78C9.001.RST0027-P1-C1 { + led-types = identify, fault; + }; + ... + ... +}; diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index 9ad35f7..f218cc3a 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig @@ -560,6 +560,17 @@ config LEDS_BLINKM This option enables support for the BlinkM RGB LED connected through I2C. Say Y to enable support for the BlinkM LED. +config LEDS_POWERNV + tristate LED support for PowerNV Platform + depends on LEDS_CLASS + depends on PPC_POWERNV + depends on OF + help + This option enables support for the system LEDs present on + PowerNV platforms. Say 'y' to enable this support in kernel. + To compile this driver as a module, choose 'm' here: the module + will be called leds-powernv. + config LEDS_SYSCON bool LED support for LEDs on system controllers depends on LEDS_CLASS=y diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile index 8d6a24a..6a943d1 100644 --- a/drivers/leds/Makefile +++ b/drivers/leds/Makefile @@ -65,6 +65,7 @@ obj-$(CONFIG_LEDS_VERSATILE) += leds-versatile.o obj-$(CONFIG_LEDS_MENF21BMC) += leds-menf21bmc.o obj-$(CONFIG_LEDS_PM8941_WLED) += leds-pm8941-wled.o obj-$(CONFIG_LEDS_KTD2692) += leds-ktd2692.o +obj-$(CONFIG_LEDS_POWERNV) += leds-powernv.o # LED SPI Drivers obj-$(CONFIG_LEDS_DAC124S085) += leds-dac124s085.o diff --git a/drivers/leds/leds-powernv.c b/drivers/leds/leds-powernv.c new file mode 100644 index 000..9e70291 --- /dev/null +++ b/drivers/leds/leds-powernv.c @@ -0,0 +1,342 @@ +/* + * PowerNV LED Driver + * + * Copyright IBM Corp. 2015 + * + * Author: Vasant Hegde hegdevas...@linux.vnet.ibm.com + * Author: Anshuman Khandual khand...@linux.vnet.ibm.com + * + * This program is free software; you can redistribute it and/or + * modify it under
[PATCH v7 2/3] powerpc/powernv: Create LED platform device
This patch adds platform devices for leds. Also export LED related OPAL API's so that led driver can use these APIs. Signed-off-by: Vasant Hegde hegdevas...@linux.vnet.ibm.com Acked-by: Benjamin Herrenschmidt b...@kernel.crashing.org --- arch/powerpc/platforms/powernv/opal.c | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c index f084afa..6839358 100644 --- a/arch/powerpc/platforms/powernv/opal.c +++ b/arch/powerpc/platforms/powernv/opal.c @@ -648,7 +648,7 @@ static void opal_init_heartbeat(void) static int __init opal_init(void) { - struct device_node *np, *consoles; + struct device_node *np, *consoles, *leds; int rc; opal_node = of_find_node_by_path(/ibm,opal); @@ -689,6 +689,13 @@ static int __init opal_init(void) /* Setup a heatbeat thread if requested by OPAL */ opal_init_heartbeat(); + /* Create leds platform devices */ + leds = of_find_node_by_path(/ibm,opal/leds); + if (leds) { + of_platform_device_create(leds, opal_leds, NULL); + of_node_put(leds); + } + /* Create opal kobject under /sys/firmware */ rc = opal_sysfs_init(); if (rc == 0) { @@ -841,3 +848,6 @@ EXPORT_SYMBOL_GPL(opal_rtc_write); EXPORT_SYMBOL_GPL(opal_tpo_read); EXPORT_SYMBOL_GPL(opal_tpo_write); EXPORT_SYMBOL_GPL(opal_i2c_request); +/* Export these symbols for PowerNV LED class driver */ +EXPORT_SYMBOL_GPL(opal_leds_get_ind); +EXPORT_SYMBOL_GPL(opal_leds_set_ind); -- 2.1.0 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v7 1/3] powerpc/powernv: Add OPAL interfaces for accessing and modifying system LED states
From: Anshuman Khandual khand...@linux.vnet.ibm.com This patch registers the following two new OPAL interfaces calls for the platform LED subsystem. With the help of these new OPAL calls, the kernel will be able to get or set the state of various individual LEDs on the system at any given location code which is passed through the LED specific device tree nodes. (1) OPAL_LEDS_GET_INDICATOR opal_leds_get_ind (2) OPAL_LEDS_SET_INDICATOR opal_leds_set_ind Signed-off-by: Anshuman Khandual khand...@linux.vnet.ibm.com Signed-off-by: Vasant Hegde hegdevas...@linux.vnet.ibm.com Acked-by: Stewart Smith stew...@linux.vnet.ibm.com Tested-by: Stewart Smith stew...@linux.vnet.ibm.com Acked-by: Benjamin Herrenschmidt b...@kernel.crashing.org --- arch/powerpc/include/asm/opal-api.h| 25 - arch/powerpc/include/asm/opal.h| 4 arch/powerpc/platforms/powernv/opal-wrappers.S | 2 ++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/opal-api.h b/arch/powerpc/include/asm/opal-api.h index e9e4c52..8f8c45f 100644 --- a/arch/powerpc/include/asm/opal-api.h +++ b/arch/powerpc/include/asm/opal-api.h @@ -154,7 +154,9 @@ #define OPAL_FLASH_WRITE 111 #define OPAL_FLASH_ERASE 112 #define OPAL_PRD_MSG 113 -#define OPAL_LAST 113 +#define OPAL_LEDS_GET_INDICATOR114 +#define OPAL_LEDS_SET_INDICATOR115 +#define OPAL_LAST 115 /* Device tree flags */ @@ -756,6 +758,27 @@ struct opal_i2c_request { __be64 buffer_ra; /* Buffer real address */ }; +/* LED Mode */ +#define POWERNV_LED_MODE_LIGHT_PATHlightpath +#define POWERNV_LED_MODE_GUIDING_LIGHT guidinglight + +/* LED type */ +#define POWERNV_LED_TYPE_IDENTIFY identify +#define POWERNV_LED_TYPE_FAULT fault +#define POWERNV_LED_TYPE_ATTENTION attention + +enum OpalSlotLedType { + OPAL_SLOT_LED_TYPE_ID = 0, /* IDENTIFY LED */ + OPAL_SLOT_LED_TYPE_FAULT = 1, /* FAULT LED */ + OPAL_SLOT_LED_TYPE_ATTN = 2,/* System Attention LED */ + OPAL_SLOT_LED_TYPE_MAX = 3 +}; + +enum OpalSlotLedState { + OPAL_SLOT_LED_STATE_OFF = 0,/* LED is OFF */ + OPAL_SLOT_LED_STATE_ON = 1 /* LED is ON */ +}; + #endif /* __ASSEMBLY__ */ #endif /* __OPAL_API_H */ diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h index 958e941..3233e6d 100644 --- a/arch/powerpc/include/asm/opal.h +++ b/arch/powerpc/include/asm/opal.h @@ -195,6 +195,10 @@ int64_t opal_ipmi_recv(uint64_t interface, struct opal_ipmi_msg *msg, int64_t opal_i2c_request(uint64_t async_token, uint32_t bus_id, struct opal_i2c_request *oreq); int64_t opal_prd_msg(struct opal_prd_msg *msg); +int64_t opal_leds_get_ind(char *loc_code, __be64 *led_mask, + __be64 *led_value, __be64 *max_led_type); +int64_t opal_leds_set_ind(uint64_t token, char *loc_code, const u64 led_mask, + const u64 led_value, __be64 *max_led_type); int64_t opal_flash_read(uint64_t id, uint64_t offset, uint64_t buf, uint64_t size, uint64_t token); diff --git a/arch/powerpc/platforms/powernv/opal-wrappers.S b/arch/powerpc/platforms/powernv/opal-wrappers.S index d6a7b82..34c2734 100644 --- a/arch/powerpc/platforms/powernv/opal-wrappers.S +++ b/arch/powerpc/platforms/powernv/opal-wrappers.S @@ -297,3 +297,5 @@ OPAL_CALL(opal_flash_read, OPAL_FLASH_READ); OPAL_CALL(opal_flash_write,OPAL_FLASH_WRITE); OPAL_CALL(opal_flash_erase,OPAL_FLASH_ERASE); OPAL_CALL(opal_prd_msg,OPAL_PRD_MSG); +OPAL_CALL(opal_leds_get_ind, OPAL_LEDS_GET_INDICATOR); +OPAL_CALL(opal_leds_set_ind, OPAL_LEDS_SET_INDICATOR); -- 2.1.0 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH V4 2/6] mm: mlock: Add new mlock, munlock, and munlockall system calls
On Wed, 22 Jul 2015, Michael Ellerman wrote: On Tue, 2015-07-21 at 13:44 -0700, Andrew Morton wrote: On Tue, 21 Jul 2015 15:59:37 -0400 Eric B Munson emun...@akamai.com wrote: With the refactored mlock code, introduce new system calls for mlock, munlock, and munlockall. The new calls will allow the user to specify what lock states are being added or cleared. mlock2 and munlock2 are trivial at the moment, but a follow on patch will add a new mlock state making them useful. munlock2 addresses a limitation of the current implementation. If a user calls mlockall(MCL_CURRENT | MCL_FUTURE) and then later decides that MCL_FUTURE should be removed, they would have to call munlockall() followed by mlockall(MCL_CURRENT) which could potentially be very expensive. The new munlockall2 system call allows a user to simply clear the MCL_FUTURE flag. This is hard. Maybe we shouldn't have wired up anything other than x86. That's what we usually do with new syscalls. Yeah I think so. You haven't wired it up properly on powerpc, but I haven't mentioned it because I'd rather we did it. cheers It looks like I will be spinning a V5, so I will drop all but the x86 system calls additions in that version. signature.asc Description: Digital signature ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH V4 5/6] mm: mmap: Add mmap flag to request VM_LOCKONFAULT
On Wed, 22 Jul 2015, Kirill A. Shutemov wrote: On Tue, Jul 21, 2015 at 03:59:40PM -0400, Eric B Munson wrote: The cost of faulting in all memory to be locked can be very high when working with large mappings. If only portions of the mapping will be used this can incur a high penalty for locking. Now that we have the new VMA flag for the locked but not present state, expose it as an mmap option like MAP_LOCKED - VM_LOCKED. What is advantage over mmap() + mlock(MLOCK_ONFAULT)? There isn't one, it was added to maintain parity with the mlock(MLOCK_LOCK) - mmap(MAP_LOCKED) set. I think not having will lead to confusion because we have MAP_LOCKED so why don't we support LOCKONFAULT from mmap as well. signature.asc Description: Digital signature ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH V4 2/6] mm: mlock: Add new mlock, munlock, and munlockall system calls
On Wed, 22 Jul 2015, Vlastimil Babka wrote: On 07/21/2015 09:59 PM, Eric B Munson wrote: With the refactored mlock code, introduce new system calls for mlock, munlock, and munlockall. The new calls will allow the user to specify what lock states are being added or cleared. mlock2 and munlock2 are trivial at the moment, but a follow on patch will add a new mlock state making them useful. munlock2 addresses a limitation of the current implementation. If a ^ munlockall2? Fixed, thanks. signature.asc Description: Digital signature ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev