When checking addresses in APEI action entries for validity, allow
access the mmcfg space - some error injection functions need to do this. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJUtWbqAAoJEKurIx+X31iBNjAP/1Yi3zKx87NmYf2juuhKKeo/ 39Pap/qw0BngSYcNh1okMFh7LdpPdQrGc/EN9/kprU9IgafiUeQHRUXyHy1OzMaI Ud6c4BiYBcfvVp81xCvfKiSUjAMB++vIamyt4daoDWqAhn0+MBNTgFoR1Nsyu9Pb bhp39n7kHQjyxTsfPnN5iBN3+fBz1zPJAWWGoPSfnL/MP3tossqlPRDqThF/BY2J lUe2BdASOx++ojE5fDPoeiJhvB/8Hovy4eN543qNvpAitBwBJLGlMcxlMEcYN3QQ skbML9ZQ4ipoLlWZ9i2siiLVF7Y2ME3/NbBGgquTZ8U3Kqi0kgCEePOFVnvxMfhA MFYVyc8lW72X8WyHdJXY0aHCyq6QFWfhiu7j/eu6bCbQnVqHWhMblzk2eEpPWwRV jK9arCHZGik9c9cYZJq+WzIukyrtJR1D+4jAcQyxUjR/wQJ1CLCe5xuDZUfiLDno GVwdarBoD1dtLIA4noc0VXwjVN51lS1MTBR7TL/cu6hj+p2Tq6FXa7QW30a80Udq 3fm2HdzhQEmfUAi2EznwZwtuy0Pt5c2DIAl/Ie4GDMJX19MuvKRRSt6SDCY+YSSQ SJB3iXm0t99MkIJrwycaQEb190DtFbVYk+gT26TtPrIuHbd5Y/5hwv0J+wSEDwom ErFpiJEhK6hnBdV+eHxB =3MwK -----END PGP SIGNATURE----- Merge tag 'please-pull-einj-mmcfg' of git://git.kernel.org/pub/scm/linux/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>
This commit is contained in:
commit
93d76c8026
|
@ -610,6 +610,32 @@ static int __init pci_parse_mcfg(struct acpi_table_header *header)
|
||||||
return 0;
|
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)
|
static void __init __pci_mmcfg_init(int early)
|
||||||
{
|
{
|
||||||
pci_mmcfg_reject_broken(early);
|
pci_mmcfg_reject_broken(early);
|
||||||
|
@ -644,6 +670,8 @@ void __init pci_mmcfg_early_init(void)
|
||||||
else
|
else
|
||||||
acpi_sfi_table_parse(ACPI_SIG_MCFG, pci_parse_mcfg);
|
acpi_sfi_table_parse(ACPI_SIG_MCFG, pci_parse_mcfg);
|
||||||
__pci_mmcfg_init(1);
|
__pci_mmcfg_init(1);
|
||||||
|
|
||||||
|
set_apei_filter();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -449,7 +449,7 @@ int apei_resources_sub(struct apei_resources *resources1,
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(apei_resources_sub);
|
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;
|
struct apei_resources *resources = data;
|
||||||
return apei_res_add(&resources->iomem, start, size);
|
return apei_res_add(&resources->iomem, start, size);
|
||||||
|
@ -457,7 +457,15 @@ static int apei_get_nvs_callback(__u64 start, __u64 size, void *data)
|
||||||
|
|
||||||
static int apei_get_nvs_resources(struct apei_resources *resources)
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -470,7 +478,7 @@ int apei_resources_request(struct apei_resources *resources,
|
||||||
{
|
{
|
||||||
struct apei_res *res, *res_bak = NULL;
|
struct apei_res *res, *res_bak = NULL;
|
||||||
struct resource *r;
|
struct resource *r;
|
||||||
struct apei_resources nvs_resources;
|
struct apei_resources nvs_resources, arch_res;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
rc = apei_resources_sub(resources, &apei_resources_all);
|
rc = apei_resources_sub(resources, &apei_resources_all);
|
||||||
|
@ -485,10 +493,20 @@ int apei_resources_request(struct apei_resources *resources,
|
||||||
apei_resources_init(&nvs_resources);
|
apei_resources_init(&nvs_resources);
|
||||||
rc = apei_get_nvs_resources(&nvs_resources);
|
rc = apei_get_nvs_resources(&nvs_resources);
|
||||||
if (rc)
|
if (rc)
|
||||||
goto res_fini;
|
goto nvs_res_fini;
|
||||||
rc = apei_resources_sub(resources, &nvs_resources);
|
rc = apei_resources_sub(resources, &nvs_resources);
|
||||||
if (rc)
|
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;
|
rc = -EINVAL;
|
||||||
list_for_each_entry(res, &resources->iomem, list) {
|
list_for_each_entry(res, &resources->iomem, list) {
|
||||||
|
@ -536,7 +554,9 @@ err_unmap_iomem:
|
||||||
break;
|
break;
|
||||||
release_mem_region(res->start, res->end - res->start);
|
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);
|
apei_resources_fini(&nvs_resources);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue