Skip to content

Commit

Permalink
Merge tag 'please-pull-einj-mmcfg' of git://git.kernel.org/pub/scm/li…
Browse files Browse the repository at this point in the history
…nux/kernel/git/ras/ras into x86/ras

Pull RAS update from Tony Luck:

  "When checking addresses in APEI action entries for validity, allow
   access to the mmcfg space - some error injection functions need to do
   this."

Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
Ingo Molnar committed Jan 15, 2015
2 parents 37e4d3b + d91525e commit 93d76c8
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 6 deletions.
28 changes: 28 additions & 0 deletions arch/x86/pci/mmconfig-shared.c
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,32 @@ static int __init pci_parse_mcfg(struct acpi_table_header *header)
return 0;
}

#ifdef CONFIG_ACPI_APEI
extern int (*arch_apei_filter_addr)(int (*func)(__u64 start, __u64 size,
void *data), void *data);

static int pci_mmcfg_for_each_region(int (*func)(__u64 start, __u64 size,
void *data), void *data)
{
struct pci_mmcfg_region *cfg;
int rc;

if (list_empty(&pci_mmcfg_list))
return 0;

list_for_each_entry(cfg, &pci_mmcfg_list, list) {
rc = func(cfg->res.start, resource_size(&cfg->res), data);
if (rc)
return rc;
}

return 0;
}
#define set_apei_filter() (arch_apei_filter_addr = pci_mmcfg_for_each_region)
#else
#define set_apei_filter()
#endif

static void __init __pci_mmcfg_init(int early)
{
pci_mmcfg_reject_broken(early);
Expand Down Expand Up @@ -644,6 +670,8 @@ void __init pci_mmcfg_early_init(void)
else
acpi_sfi_table_parse(ACPI_SIG_MCFG, pci_parse_mcfg);
__pci_mmcfg_init(1);

set_apei_filter();
}
}

Expand Down
32 changes: 26 additions & 6 deletions drivers/acpi/apei/apei-base.c
Original file line number Diff line number Diff line change
Expand Up @@ -449,15 +449,23 @@ int apei_resources_sub(struct apei_resources *resources1,
}
EXPORT_SYMBOL_GPL(apei_resources_sub);

static int apei_get_nvs_callback(__u64 start, __u64 size, void *data)
static int apei_get_res_callback(__u64 start, __u64 size, void *data)
{
struct apei_resources *resources = data;
return apei_res_add(&resources->iomem, start, size);
}

static int apei_get_nvs_resources(struct apei_resources *resources)
{
return acpi_nvs_for_each_region(apei_get_nvs_callback, resources);
return acpi_nvs_for_each_region(apei_get_res_callback, resources);
}

int (*arch_apei_filter_addr)(int (*func)(__u64 start, __u64 size,
void *data), void *data);
static int apei_get_arch_resources(struct apei_resources *resources)

{
return arch_apei_filter_addr(apei_get_res_callback, resources);
}

/*
Expand All @@ -470,7 +478,7 @@ int apei_resources_request(struct apei_resources *resources,
{
struct apei_res *res, *res_bak = NULL;
struct resource *r;
struct apei_resources nvs_resources;
struct apei_resources nvs_resources, arch_res;
int rc;

rc = apei_resources_sub(resources, &apei_resources_all);
Expand All @@ -485,10 +493,20 @@ int apei_resources_request(struct apei_resources *resources,
apei_resources_init(&nvs_resources);
rc = apei_get_nvs_resources(&nvs_resources);
if (rc)
goto res_fini;
goto nvs_res_fini;
rc = apei_resources_sub(resources, &nvs_resources);
if (rc)
goto res_fini;
goto nvs_res_fini;

if (arch_apei_filter_addr) {
apei_resources_init(&arch_res);
rc = apei_get_arch_resources(&arch_res);
if (rc)
goto arch_res_fini;
rc = apei_resources_sub(resources, &arch_res);
if (rc)
goto arch_res_fini;
}

rc = -EINVAL;
list_for_each_entry(res, &resources->iomem, list) {
Expand Down Expand Up @@ -536,7 +554,9 @@ int apei_resources_request(struct apei_resources *resources,
break;
release_mem_region(res->start, res->end - res->start);
}
res_fini:
arch_res_fini:
apei_resources_fini(&arch_res);
nvs_res_fini:
apei_resources_fini(&nvs_resources);
return rc;
}
Expand Down

0 comments on commit 93d76c8

Please sign in to comment.