Skip to content

Commit

Permalink
Merge tag 'edac_for_4.20' of git://git.kernel.org/pub/scm/linux/kerne…
Browse files Browse the repository at this point in the history
…l/git/bp/bp

Pull EDAC updates from Borislav Petkov:
 "The EDAC tree was busier than usual this cycle as the shortlog below
  shows.

  Also, this pull request is carrying an ACPI DSM driver which is used
  to ask the platform to supply the DIMM location of a reported hardware
  error and thus simplify all the EDAC logic when trying to map the
  error address to the respective DIMM.

  Core EDAC updates:

   - amd64_edac: AMD family 0x17, models 0x10-0x2f support (Michael Jin)
     Hygon Dhyana support (Pu Wen)

   - sb_edac: New maintainer + fixes (Tony Luck) Error reporting
     improvements and fixes (Qiuxu Zhuo)

   - ghes_edac: SMBIOS handle type 17 for DIMM locating and per-DIMM
     error accounting (Fan Wu)

   - altera_edac: Stratix10 support and refactoring (Thor Thayer)

  Out of tree addition:

   - acpi_adxl: Address Translation interface using an ACPI DSM (Tony
     Luck)

   - the usual amount of other misc fixes and cleanups all over"

* tag 'edac_for_4.20' of git://git.kernel.org/pub/scm/linux/kernel/git/bp/bp: (22 commits)
  ACPI/ADXL: Add address translation interface using an ACPI DSM
  EDAC, thunderx: Fix memory leak in thunderx_l2c_threaded_isr()
  EDAC, skx_edac: Fix logical channel intermediate decoding
  EDAC, {i7core,sb,skx}_edac: Fix uncorrected error counting
  EDAC, altera: Work around int-to-pointer-cast warnings
  EDAC, amd64: Add Hygon Dhyana support
  EDAC: Raise the maximum number of memory controllers
  arm64: dts: stratix10: Add peripheral EDAC nodes
  EDAC, altera: Add Stratix10 peripheral support
  EDAC, altera: Merge Stratix10 into the Arria10 SDRAM probe routine
  arm64: dts: stratix10: Add SDRAM node
  EDAC, altera: Combine Stratix10 and Arria10 probe functions
  arm64: dts: stratix10: Additions to EDAC System Manager
  EDAC, i7core: Remove set but not used variable pvt
  EDAC, ghes: Use CPER module handles to locate DIMMs
  EDAC: Correct DIMM capacity unit symbol
  EDAC, sb_edac: Fix signedness bugs in *_get_ha() functions
  EDAC, sb_edac: Fix reporting for patrol scrubber errors
  EDAC, sb_edac: Return early on ADDRV bit and address type test
  MAINTAINERS: Update maintainer for drivers/edac/sb_edac.c
  ...
  • Loading branch information
Linus Torvalds committed Oct 25, 2018
2 parents 6078e07 + 4cf841e commit 36168d7
Show file tree
Hide file tree
Showing 18 changed files with 715 additions and 557 deletions.
3 changes: 2 additions & 1 deletion MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -5364,7 +5364,8 @@ S: Maintained
F: drivers/edac/r82600_edac.c

EDAC-SBRIDGE
M: Mauro Carvalho Chehab <mchehab@kernel.org>
M: Tony Luck <tony.luck@intel.com>
R: Qiuxu Zhuo <qiuxu.zhuo@intel.com>
L: linux-edac@vger.kernel.org
S: Maintained
F: drivers/edac/sb_edac.c
Expand Down
37 changes: 36 additions & 1 deletion arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -473,16 +473,51 @@
status = "disabled";
};

sdr: sdr@f8011100 {
compatible = "altr,sdr-ctl", "syscon";
reg = <0xf8011100 0xc0>;
};

eccmgr {
compatible = "altr,socfpga-s10-ecc-manager";
compatible = "altr,socfpga-a10-ecc-manager";
altr,sysmgr-syscon = <&sysmgr>;
#address-cells = <1>;
#size-cells = <1>;
interrupts = <0 15 4>, <0 95 4>;
interrupt-controller;
#interrupt-cells = <2>;
ranges;

sdramedac {
compatible = "altr,sdram-edac-s10";
altr,sdr-syscon = <&sdr>;
interrupts = <16 4>, <48 4>;
};

usb0-ecc@ff8c4000 {
compatible = "altr,socfpga-usb-ecc";
reg = <0xff8c4000 0x100>;
altr,ecc-parent = <&usb0>;
interrupts = <2 4>,
<34 4>;
};

emac0-rx-ecc@ff8c0000 {
compatible = "altr,socfpga-eth-mac-ecc";
reg = <0xff8c0000 0x100>;
altr,ecc-parent = <&gmac0>;
interrupts = <4 4>,
<36 4>;
};

emac0-tx-ecc@ff8c0400 {
compatible = "altr,socfpga-eth-mac-ecc";
reg = <0xff8c0400 0x100>;
altr,ecc-parent = <&gmac0>;
interrupts = <5 4>,
<37 4>;
};

};

qspi: spi@ff8d2000 {
Expand Down
3 changes: 3 additions & 0 deletions drivers/acpi/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,9 @@ config ACPI_EXTLOG
driver adds support for that functionality with corresponding
tracepoint which carries that information to userspace.

config ACPI_ADXL
bool

menuconfig PMIC_OPREGION
bool "PMIC (Power Management Integrated Circuit) operation region support"
help
Expand Down
3 changes: 3 additions & 0 deletions drivers/acpi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ acpi-$(CONFIG_ACPI_LPIT) += acpi_lpit.o
acpi-$(CONFIG_ACPI_GENERIC_GSI) += irq.o
acpi-$(CONFIG_ACPI_WATCHDOG) += acpi_watchdog.o

# Address translation
acpi-$(CONFIG_ACPI_ADXL) += acpi_adxl.o

# These are (potentially) separate modules

# IPMI may be used by other drivers, so it has to initialise before them
Expand Down
192 changes: 192 additions & 0 deletions drivers/acpi/acpi_adxl.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Address translation interface via ACPI DSM.
* Copyright (C) 2018 Intel Corporation
*
* Specification for this interface is available at:
*
* https://cdrdv2.intel.com/v1/dl/getContent/603354
*/

#include <linux/acpi.h>
#include <linux/adxl.h>

#define ADXL_REVISION 0x1
#define ADXL_IDX_GET_ADDR_PARAMS 0x1
#define ADXL_IDX_FORWARD_TRANSLATE 0x2
#define ACPI_ADXL_PATH "\\_SB.ADXL"

/*
* The specification doesn't provide a limit on how many
* components are in a memory address. But since we allocate
* memory based on the number the BIOS tells us, we should
* defend against insane values.
*/
#define ADXL_MAX_COMPONENTS 500

#undef pr_fmt
#define pr_fmt(fmt) "ADXL: " fmt

static acpi_handle handle;
static union acpi_object *params;
static const guid_t adxl_guid =
GUID_INIT(0xAA3C050A, 0x7EA4, 0x4C1F,
0xAF, 0xDA, 0x12, 0x67, 0xDF, 0xD3, 0xD4, 0x8D);

static int adxl_count;
static char **adxl_component_names;

static union acpi_object *adxl_dsm(int cmd, union acpi_object argv[])
{
union acpi_object *obj, *o;

obj = acpi_evaluate_dsm_typed(handle, &adxl_guid, ADXL_REVISION,
cmd, argv, ACPI_TYPE_PACKAGE);
if (!obj) {
pr_info("DSM call failed for cmd=%d\n", cmd);
return NULL;
}

if (obj->package.count != 2) {
pr_info("Bad pkg count %d\n", obj->package.count);
goto err;
}

o = obj->package.elements;
if (o->type != ACPI_TYPE_INTEGER) {
pr_info("Bad 1st element type %d\n", o->type);
goto err;
}
if (o->integer.value) {
pr_info("Bad ret val %llu\n", o->integer.value);
goto err;
}

o = obj->package.elements + 1;
if (o->type != ACPI_TYPE_PACKAGE) {
pr_info("Bad 2nd element type %d\n", o->type);
goto err;
}
return obj;

err:
ACPI_FREE(obj);
return NULL;
}

/**
* adxl_get_component_names - get list of memory component names
* Returns NULL terminated list of string names
*
* Give the caller a pointer to the list of memory component names
* e.g. { "SystemAddress", "ProcessorSocketId", "ChannelId", ... NULL }
* Caller should count how many strings in order to allocate a buffer
* for the return from adxl_decode().
*/
const char * const *adxl_get_component_names(void)
{
return (const char * const *)adxl_component_names;
}
EXPORT_SYMBOL_GPL(adxl_get_component_names);

/**
* adxl_decode - ask BIOS to decode a system address to memory address
* @addr: the address to decode
* @component_values: pointer to array of values for each component
* Returns 0 on success, negative error code otherwise
*
* The index of each value returned in the array matches the index of
* each component name returned by adxl_get_component_names().
* Components that are not defined for this address translation (e.g.
* mirror channel number for a non-mirrored address) are set to ~0ull.
*/
int adxl_decode(u64 addr, u64 component_values[])
{
union acpi_object argv4[2], *results, *r;
int i, cnt;

if (!adxl_component_names)
return -EOPNOTSUPP;

argv4[0].type = ACPI_TYPE_PACKAGE;
argv4[0].package.count = 1;
argv4[0].package.elements = &argv4[1];
argv4[1].integer.type = ACPI_TYPE_INTEGER;
argv4[1].integer.value = addr;

results = adxl_dsm(ADXL_IDX_FORWARD_TRANSLATE, argv4);
if (!results)
return -EINVAL;

r = results->package.elements + 1;
cnt = r->package.count;
if (cnt != adxl_count) {
ACPI_FREE(results);
return -EINVAL;
}
r = r->package.elements;

for (i = 0; i < cnt; i++)
component_values[i] = r[i].integer.value;

ACPI_FREE(results);

return 0;
}
EXPORT_SYMBOL_GPL(adxl_decode);

static int __init adxl_init(void)
{
char *path = ACPI_ADXL_PATH;
union acpi_object *p;
acpi_status status;
int i;

status = acpi_get_handle(NULL, path, &handle);
if (ACPI_FAILURE(status)) {
pr_debug("No ACPI handle for path %s\n", path);
return -ENODEV;
}

if (!acpi_has_method(handle, "_DSM")) {
pr_info("No DSM method\n");
return -ENODEV;
}

if (!acpi_check_dsm(handle, &adxl_guid, ADXL_REVISION,
ADXL_IDX_GET_ADDR_PARAMS |
ADXL_IDX_FORWARD_TRANSLATE)) {
pr_info("DSM method does not support forward translate\n");
return -ENODEV;
}

params = adxl_dsm(ADXL_IDX_GET_ADDR_PARAMS, NULL);
if (!params) {
pr_info("Failed to get component names\n");
return -ENODEV;
}

p = params->package.elements + 1;
adxl_count = p->package.count;
if (adxl_count > ADXL_MAX_COMPONENTS) {
pr_info("Insane number of address component names %d\n", adxl_count);
ACPI_FREE(params);
return -ENODEV;
}
p = p->package.elements;

/*
* Allocate one extra for NULL termination.
*/
adxl_component_names = kcalloc(adxl_count + 1, sizeof(char *), GFP_KERNEL);
if (!adxl_component_names) {
ACPI_FREE(params);
return -ENOMEM;
}

for (i = 0; i < adxl_count; i++)
adxl_component_names[i] = p[i].string.pointer;

return 0;
}
subsys_initcall(adxl_init);
Loading

0 comments on commit 36168d7

Please sign in to comment.