Changes in 4.9.241 ibmveth: Identify ingress large send packets. tipc: fix the skb_unshare() in tipc_buf_append() net/ipv4: always honour route mtu during forwarding r8169: fix data corruption issue on RTL8402 ALSA: bebob: potential info leak in hwdep_read() net: hdlc: In hdlc_rcv, check to make sure dev is an HDLC device net: hdlc_raw_eth: Clear the IFF_TX_SKB_SHARING flag after calling ether_setup nfc: Ensure presence of NFC_ATTR_FIRMWARE_NAME attribute in nfc_genl_fw_download() tcp: fix to update snd_wl1 in bulk receiver fast path icmp: randomize the global rate limiter cifs: remove bogus debug code KVM: x86/mmu: Commit zap of remaining invalid pages when recovering lpages ima: Don't ignore errors from crypto_shash_update() crypto: algif_aead - Do not set MAY_BACKLOG on the async path EDAC/i5100: Fix error handling order in i5100_init_one() crypto: ixp4xx - Fix the size used in a 'dma_free_coherent()' call media: Revert "media: exynos4-is: Add missed check for pinctrl_lookup_state()" media: m5mols: Check function pointer in m5mols_sensor_power media: omap3isp: Fix memleak in isp_probe crypto: omap-sham - fix digcnt register handling with export/import media: tc358743: initialize variable media: platform: fcp: Fix a reference count leak. media: ti-vpe: Fix a missing check and reference count leak regulator: resolve supply after creating regulator ath10k: provide survey info as accumulated data ath6kl: prevent potential array overflow in ath6kl_add_new_sta() ath9k: Fix potential out of bounds in ath9k_htc_txcompletion_cb() wcn36xx: Fix reported 802.11n rx_highest rate wcn3660/wcn3680 ASoC: qcom: lpass-platform: fix memory leak mwifiex: Do not use GFP_KERNEL in atomic context drm/gma500: fix error check scsi: qla4xxx: Fix an error handling path in 'qla4xxx_get_host_stats()' scsi: csiostor: Fix wrong return value in csio_hw_prep_fw() backlight: sky81452-backlight: Fix refcount imbalance on error VMCI: check return value of get_user_pages_fast() for errors tty: serial: earlycon dependency tty: hvcs: Don't NULL tty->driver_data until hvcs_cleanup() pty: do tty_flip_buffer_push without port->lock in pty_write drivers/virt/fsl_hypervisor: Fix error handling path video: fbdev: vga16fb: fix setting of pixclock because a pass-by-value error video: fbdev: sis: fix null ptr dereference HID: roccat: add bounds checking in kone_sysfs_write_settings() ath6kl: wmi: prevent a shift wrapping bug in ath6kl_wmi_delete_pstream_cmd() misc: mic: scif: Fix error handling path ALSA: seq: oss: Avoid mutex lock for a long-time ioctl quota: clear padding in v2r1_mem2diskdqb() net: enic: Cure the enic api locking trainwreck mfd: sm501: Fix leaks in probe() iwlwifi: mvm: split a print to avoid a WARNING in ROC usb: gadget: f_ncm: fix ncm_bitrate for SuperSpeed and above. usb: gadget: u_ether: enable qmult on SuperSpeed Plus as well nl80211: fix non-split wiphy information scsi: be2iscsi: Fix a theoretical leak in beiscsi_create_eqs() mwifiex: fix double free net: korina: fix kfree of rx/tx descriptor array IB/mlx4: Fix starvation in paravirt mux/demux IB/mlx4: Adjust delayed work when a dup is observed powerpc/pseries: Fix missing of_node_put() in rng_init() powerpc/icp-hv: Fix missing of_node_put() in success path mtd: lpddr: fix excessive stack usage with clang mtd: mtdoops: Don't write panic data twice ARM: 9007/1: l2c: fix prefetch bits init in L2X0_AUX_CTRL using DT values RDMA/qedr: Fix use of uninitialized field powerpc/tau: Use appropriate temperature sample interval powerpc/tau: Remove duplicated set_thresholds() call powerpc/tau: Disable TAU between measurements perf intel-pt: Fix "context_switch event has no tid" error RDMA/hns: Set the unsupported wr opcode kdb: Fix pager search for multi-line strings overflow: Include header file with SIZE_MAX declaration powerpc/perf: Exclude pmc5/6 from the irrelevant PMU group constraints powerpc/perf/hv-gpci: Fix starting index value cpufreq: powernv: Fix frame-size-overflow in powernv_cpufreq_reboot_notifier IB/rdmavt: Fix sizeof mismatch lib/crc32.c: fix trivial typo in preprocessor condition rapidio: fix error handling path rapidio: fix the missed put_device() for rio_mport_add_riodev clk: at91: clk-main: update key before writing AT91_CKGR_MOR clk: bcm2835: add missing release if devm_clk_hw_register fails vfio/pci: Clear token on bypass registration failure Input: imx6ul_tsc - clean up some errors in imx6ul_tsc_resume() Input: ep93xx_keypad - fix handling of platform_get_irq() error Input: omap4-keypad - fix handling of platform_get_irq() error Input: twl4030_keypad - fix handling of platform_get_irq() error Input: sun4i-ps2 - fix handling of platform_get_irq() error KVM: x86: emulating RDPID failure shall return #UD rather than #GP memory: omap-gpmc: Fix a couple off by ones memory: fsl-corenet-cf: Fix handling of platform_get_irq() error arm64: dts: qcom: msm8916: Fix MDP/DSI interrupts arm64: dts: zynqmp: Remove additional compatible string for i2c IPs powerpc/powernv/dump: Fix race while processing OPAL dump nvmet: fix uninitialized work for zero kato NTB: hw: amd: fix an issue about leak system resources crypto: ccp - fix error handling media: firewire: fix memory leak media: ati_remote: sanity check for both endpoints media: exynos4-is: Fix several reference count leaks due to pm_runtime_get_sync media: exynos4-is: Fix a reference count leak due to pm_runtime_get_sync media: exynos4-is: Fix a reference count leak media: vsp1: Fix runtime PM imbalance on error media: platform: s3c-camif: Fix runtime PM imbalance on error media: platform: sti: hva: Fix runtime PM imbalance on error media: bdisp: Fix runtime PM imbalance on error media: media/pci: prevent memory leak in bttv_probe media: uvcvideo: Ensure all probed info is returned to v4l2 mmc: sdio: Check for CISTPL_VERS_1 buffer size media: saa7134: avoid a shift overflow fs: dlm: fix configfs memory leak ntfs: add check for mft record size in superblock PM: hibernate: remove the bogus call to get_gendisk() in software_resume() scsi: mvumi: Fix error return in mvumi_io_attach() scsi: target: core: Add CONTROL field for trace events mic: vop: copy data to kernel space then write to io memory misc: vop: add round_up(x,4) for vring_size to avoid kernel panic usb: gadget: function: printer: fix use-after-free in __lock_acquire udf: Limit sparing table size udf: Avoid accessing uninitialized data on failed inode read USB: cdc-acm: handle broken union descriptors ath9k: hif_usb: fix race condition between usb_get_urb() and usb_kill_anchored_urbs() misc: rtsx: Fix memory leak in rtsx_pci_probe reiserfs: only call unlock_new_inode() if I_NEW xfs: make sure the rt allocator doesn't run off the end usb: ohci: Default to per-port over-current protection Bluetooth: Only mark socket zapped after unlocking scsi: ibmvfc: Fix error return in ibmvfc_probe() brcmsmac: fix memory leak in wlc_phy_attach_lcnphy rtl8xxxu: prevent potential memory leak Fix use after free in get_capset_info callback. tty: ipwireless: fix error handling ipvs: Fix uninit-value in do_ip_vs_set_ctl() reiserfs: Fix memory leak in reiserfs_parse_options() brcm80211: fix possible memleak in brcmf_proto_msgbuf_attach usb: core: Solve race condition in anchor cleanup functions ath10k: check idx validity in __ath10k_htt_rx_ring_fill_n() net: korina: cast KSEG0 address to pointer in kfree usb: cdc-acm: add quirk to blacklist ETAS ES58X devices USB: cdc-wdm: Make wdm_flush() interruptible and add wdm_fsync(). eeprom: at25: set minimum read/write access stride to 1 usb: gadget: f_ncm: allow using NCM in SuperSpeed Plus gadgets. Linux 4.9.241 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Change-Id: Ie59605b312e5d0314299cad46ab57df803070564
282 lines
6.7 KiB
C
282 lines
6.7 KiB
C
/*
|
|
* CoreNet Coherency Fabric error reporting
|
|
*
|
|
* Copyright 2014 Freescale Semiconductor Inc.
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
* under the terms of the GNU General Public License as published by the
|
|
* Free Software Foundation; either version 2 of the License, or (at your
|
|
* option) any later version.
|
|
*/
|
|
|
|
#include <linux/interrupt.h>
|
|
#include <linux/io.h>
|
|
#include <linux/irq.h>
|
|
#include <linux/module.h>
|
|
#include <linux/of.h>
|
|
#include <linux/of_address.h>
|
|
#include <linux/of_device.h>
|
|
#include <linux/of_irq.h>
|
|
#include <linux/platform_device.h>
|
|
|
|
enum ccf_version {
|
|
CCF1,
|
|
CCF2,
|
|
};
|
|
|
|
struct ccf_info {
|
|
enum ccf_version version;
|
|
int err_reg_offs;
|
|
bool has_brr;
|
|
};
|
|
|
|
static const struct ccf_info ccf1_info = {
|
|
.version = CCF1,
|
|
.err_reg_offs = 0xa00,
|
|
.has_brr = false,
|
|
};
|
|
|
|
static const struct ccf_info ccf2_info = {
|
|
.version = CCF2,
|
|
.err_reg_offs = 0xe40,
|
|
.has_brr = true,
|
|
};
|
|
|
|
/*
|
|
* This register is present but not documented, with different values for
|
|
* IP_ID, on other chips with fsl,corenet2-cf such as t4240 and b4860.
|
|
*/
|
|
#define CCF_BRR 0xbf8
|
|
#define CCF_BRR_IPID 0xffff0000
|
|
#define CCF_BRR_IPID_T1040 0x09310000
|
|
|
|
static const struct of_device_id ccf_matches[] = {
|
|
{
|
|
.compatible = "fsl,corenet1-cf",
|
|
.data = &ccf1_info,
|
|
},
|
|
{
|
|
.compatible = "fsl,corenet2-cf",
|
|
.data = &ccf2_info,
|
|
},
|
|
{}
|
|
};
|
|
MODULE_DEVICE_TABLE(of, ccf_matches);
|
|
|
|
struct ccf_err_regs {
|
|
u32 errdet; /* 0x00 Error Detect Register */
|
|
/* 0x04 Error Enable (ccf1)/Disable (ccf2) Register */
|
|
u32 errdis;
|
|
/* 0x08 Error Interrupt Enable Register (ccf2 only) */
|
|
u32 errinten;
|
|
u32 cecar; /* 0x0c Error Capture Attribute Register */
|
|
u32 cecaddrh; /* 0x10 Error Capture Address High */
|
|
u32 cecaddrl; /* 0x14 Error Capture Address Low */
|
|
u32 cecar2; /* 0x18 Error Capture Attribute Register 2 */
|
|
};
|
|
|
|
/* LAE/CV also valid for errdis and errinten */
|
|
#define ERRDET_LAE (1 << 0) /* Local Access Error */
|
|
#define ERRDET_CV (1 << 1) /* Coherency Violation */
|
|
#define ERRDET_UTID (1 << 2) /* Unavailable Target ID (t1040) */
|
|
#define ERRDET_MCST (1 << 3) /* Multicast Stash (t1040) */
|
|
#define ERRDET_CTYPE_SHIFT 26 /* Capture Type (ccf2 only) */
|
|
#define ERRDET_CTYPE_MASK (0x1f << ERRDET_CTYPE_SHIFT)
|
|
#define ERRDET_CAP (1 << 31) /* Capture Valid (ccf2 only) */
|
|
|
|
#define CECAR_VAL (1 << 0) /* Valid (ccf1 only) */
|
|
#define CECAR_UVT (1 << 15) /* Unavailable target ID (ccf1) */
|
|
#define CECAR_SRCID_SHIFT_CCF1 24
|
|
#define CECAR_SRCID_MASK_CCF1 (0xff << CECAR_SRCID_SHIFT_CCF1)
|
|
#define CECAR_SRCID_SHIFT_CCF2 18
|
|
#define CECAR_SRCID_MASK_CCF2 (0xff << CECAR_SRCID_SHIFT_CCF2)
|
|
|
|
#define CECADDRH_ADDRH 0xff
|
|
|
|
struct ccf_private {
|
|
const struct ccf_info *info;
|
|
struct device *dev;
|
|
void __iomem *regs;
|
|
struct ccf_err_regs __iomem *err_regs;
|
|
bool t1040;
|
|
};
|
|
|
|
static irqreturn_t ccf_irq(int irq, void *dev_id)
|
|
{
|
|
struct ccf_private *ccf = dev_id;
|
|
static DEFINE_RATELIMIT_STATE(ratelimit, DEFAULT_RATELIMIT_INTERVAL,
|
|
DEFAULT_RATELIMIT_BURST);
|
|
u32 errdet, cecar, cecar2;
|
|
u64 addr;
|
|
u32 src_id;
|
|
bool uvt = false;
|
|
bool cap_valid = false;
|
|
|
|
errdet = ioread32be(&ccf->err_regs->errdet);
|
|
cecar = ioread32be(&ccf->err_regs->cecar);
|
|
cecar2 = ioread32be(&ccf->err_regs->cecar2);
|
|
addr = ioread32be(&ccf->err_regs->cecaddrl);
|
|
addr |= ((u64)(ioread32be(&ccf->err_regs->cecaddrh) &
|
|
CECADDRH_ADDRH)) << 32;
|
|
|
|
if (!__ratelimit(&ratelimit))
|
|
goto out;
|
|
|
|
switch (ccf->info->version) {
|
|
case CCF1:
|
|
if (cecar & CECAR_VAL) {
|
|
if (cecar & CECAR_UVT)
|
|
uvt = true;
|
|
|
|
src_id = (cecar & CECAR_SRCID_MASK_CCF1) >>
|
|
CECAR_SRCID_SHIFT_CCF1;
|
|
cap_valid = true;
|
|
}
|
|
|
|
break;
|
|
case CCF2:
|
|
if (errdet & ERRDET_CAP) {
|
|
src_id = (cecar & CECAR_SRCID_MASK_CCF2) >>
|
|
CECAR_SRCID_SHIFT_CCF2;
|
|
cap_valid = true;
|
|
}
|
|
|
|
break;
|
|
}
|
|
|
|
dev_crit(ccf->dev, "errdet 0x%08x cecar 0x%08x cecar2 0x%08x\n",
|
|
errdet, cecar, cecar2);
|
|
|
|
if (errdet & ERRDET_LAE) {
|
|
if (uvt)
|
|
dev_crit(ccf->dev, "LAW Unavailable Target ID\n");
|
|
else
|
|
dev_crit(ccf->dev, "Local Access Window Error\n");
|
|
}
|
|
|
|
if (errdet & ERRDET_CV)
|
|
dev_crit(ccf->dev, "Coherency Violation\n");
|
|
|
|
if (errdet & ERRDET_UTID)
|
|
dev_crit(ccf->dev, "Unavailable Target ID\n");
|
|
|
|
if (errdet & ERRDET_MCST)
|
|
dev_crit(ccf->dev, "Multicast Stash\n");
|
|
|
|
if (cap_valid) {
|
|
dev_crit(ccf->dev, "address 0x%09llx, src id 0x%x\n",
|
|
addr, src_id);
|
|
}
|
|
|
|
out:
|
|
iowrite32be(errdet, &ccf->err_regs->errdet);
|
|
return errdet ? IRQ_HANDLED : IRQ_NONE;
|
|
}
|
|
|
|
static int ccf_probe(struct platform_device *pdev)
|
|
{
|
|
struct ccf_private *ccf;
|
|
struct resource *r;
|
|
const struct of_device_id *match;
|
|
u32 errinten;
|
|
int ret, irq;
|
|
|
|
match = of_match_device(ccf_matches, &pdev->dev);
|
|
if (WARN_ON(!match))
|
|
return -ENODEV;
|
|
|
|
ccf = devm_kzalloc(&pdev->dev, sizeof(*ccf), GFP_KERNEL);
|
|
if (!ccf)
|
|
return -ENOMEM;
|
|
|
|
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
|
if (!r) {
|
|
dev_err(&pdev->dev, "%s: no mem resource\n", __func__);
|
|
return -ENXIO;
|
|
}
|
|
|
|
ccf->regs = devm_ioremap_resource(&pdev->dev, r);
|
|
if (IS_ERR(ccf->regs)) {
|
|
dev_err(&pdev->dev, "%s: can't map mem resource\n", __func__);
|
|
return PTR_ERR(ccf->regs);
|
|
}
|
|
|
|
ccf->dev = &pdev->dev;
|
|
ccf->info = match->data;
|
|
ccf->err_regs = ccf->regs + ccf->info->err_reg_offs;
|
|
|
|
if (ccf->info->has_brr) {
|
|
u32 brr = ioread32be(ccf->regs + CCF_BRR);
|
|
|
|
if ((brr & CCF_BRR_IPID) == CCF_BRR_IPID_T1040)
|
|
ccf->t1040 = true;
|
|
}
|
|
|
|
dev_set_drvdata(&pdev->dev, ccf);
|
|
|
|
irq = platform_get_irq(pdev, 0);
|
|
if (irq < 0)
|
|
return irq;
|
|
|
|
ret = devm_request_irq(&pdev->dev, irq, ccf_irq, 0, pdev->name, ccf);
|
|
if (ret) {
|
|
dev_err(&pdev->dev, "%s: can't request irq\n", __func__);
|
|
return ret;
|
|
}
|
|
|
|
errinten = ERRDET_LAE | ERRDET_CV;
|
|
if (ccf->t1040)
|
|
errinten |= ERRDET_UTID | ERRDET_MCST;
|
|
|
|
switch (ccf->info->version) {
|
|
case CCF1:
|
|
/* On CCF1 this register enables rather than disables. */
|
|
iowrite32be(errinten, &ccf->err_regs->errdis);
|
|
break;
|
|
|
|
case CCF2:
|
|
iowrite32be(0, &ccf->err_regs->errdis);
|
|
iowrite32be(errinten, &ccf->err_regs->errinten);
|
|
break;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int ccf_remove(struct platform_device *pdev)
|
|
{
|
|
struct ccf_private *ccf = dev_get_drvdata(&pdev->dev);
|
|
|
|
switch (ccf->info->version) {
|
|
case CCF1:
|
|
iowrite32be(0, &ccf->err_regs->errdis);
|
|
break;
|
|
|
|
case CCF2:
|
|
/*
|
|
* We clear errdis on ccf1 because that's the only way to
|
|
* disable interrupts, but on ccf2 there's no need to disable
|
|
* detection.
|
|
*/
|
|
iowrite32be(0, &ccf->err_regs->errinten);
|
|
break;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
static struct platform_driver ccf_driver = {
|
|
.driver = {
|
|
.name = KBUILD_MODNAME,
|
|
.of_match_table = ccf_matches,
|
|
},
|
|
.probe = ccf_probe,
|
|
.remove = ccf_remove,
|
|
};
|
|
|
|
module_platform_driver(ccf_driver);
|
|
|
|
MODULE_LICENSE("GPL");
|
|
MODULE_AUTHOR("Freescale Semiconductor");
|
|
MODULE_DESCRIPTION("Freescale CoreNet Coherency Fabric error reporting");
|