nvdimm(4): Only expose namespaces for accessible data SPAs

Apply the same user accessible filter to namespaces as is applied
to full-SPA devices. Also, explicitly filter out control region
SPAs which don't expose the nvdimm data area.

Reviewed by:	cem
Approved by:	scottl (mentor)
MFC after:	1 week
Sponsored by:	Intel Corporation
Differential Revision:	https://reviews.freebsd.org/D21987
This commit is contained in:
D Scott Phillips 2019-11-12 15:50:30 +00:00
parent de6f295446
commit cf8b104f04
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=354645
3 changed files with 13 additions and 1 deletions

View File

@ -144,7 +144,9 @@ nvdimm_root_create_spas(struct nvdimm_root_dev *dev, ACPI_TABLE_NFIT *nfitbl)
free(spa_mapping, M_NVDIMM_ACPI);
break;
}
nvdimm_create_namespaces(spa_mapping, nfitbl);
if (nvdimm_spa_type_user_accessible(spa_type) &&
spa_type != SPA_TYPE_CONTROL_REGION)
nvdimm_create_namespaces(spa_mapping, nfitbl);
SLIST_INSERT_HEAD(&dev->spas, spa_mapping, link);
}
free(spas, M_NVDIMM_ACPI);

View File

@ -155,6 +155,15 @@ nvdimm_spa_type_from_uuid(struct uuid *uuid)
return (SPA_TYPE_UNKNOWN);
}
bool
nvdimm_spa_type_user_accessible(enum SPA_mapping_type spa_type)
{
if ((int)spa_type < 0 || spa_type >= nitems(nvdimm_SPA_uuid_list))
return (false);
return (nvdimm_SPA_uuid_list[spa_type].u_usr_acc);
}
static vm_memattr_t
nvdimm_spa_memattr(uint64_t efi_mem_flags)
{

View File

@ -166,6 +166,7 @@ void acpi_nfit_get_flush_addrs(ACPI_TABLE_NFIT *nfitbl, nfit_handle_t dimm,
uint64_t ***listp, int *countp);
enum SPA_mapping_type nvdimm_spa_type_from_name(const char *);
enum SPA_mapping_type nvdimm_spa_type_from_uuid(struct uuid *);
bool nvdimm_spa_type_user_accessible(enum SPA_mapping_type);
struct nvdimm_dev *nvdimm_find_by_handle(nfit_handle_t nv_handle);
int nvdimm_spa_init(struct SPA_mapping *spa, ACPI_NFIT_SYSTEM_ADDRESS *nfitaddr,
enum SPA_mapping_type spa_type);