Date: Tue, 12 Nov 2019 15:50:30 +0000 (UTC) From: D Scott Phillips <scottph@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354645 - head/sys/dev/nvdimm Message-ID: <201911121550.xACFoUix004074@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: scottph Date: Tue Nov 12 15:50:30 2019 New Revision: 354645 URL: https://svnweb.freebsd.org/changeset/base/354645 Log: 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 Modified: head/sys/dev/nvdimm/nvdimm_acpi.c head/sys/dev/nvdimm/nvdimm_spa.c head/sys/dev/nvdimm/nvdimm_var.h Modified: head/sys/dev/nvdimm/nvdimm_acpi.c ============================================================================== --- head/sys/dev/nvdimm/nvdimm_acpi.c Tue Nov 12 15:47:46 2019 (r354644) +++ head/sys/dev/nvdimm/nvdimm_acpi.c Tue Nov 12 15:50:30 2019 (r354645) @@ -144,7 +144,9 @@ nvdimm_root_create_spas(struct nvdimm_root_dev *dev, A 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); Modified: head/sys/dev/nvdimm/nvdimm_spa.c ============================================================================== --- head/sys/dev/nvdimm/nvdimm_spa.c Tue Nov 12 15:47:46 2019 (r354644) +++ head/sys/dev/nvdimm/nvdimm_spa.c Tue Nov 12 15:50:30 2019 (r354645) @@ -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) { Modified: head/sys/dev/nvdimm/nvdimm_var.h ============================================================================== --- head/sys/dev/nvdimm/nvdimm_var.h Tue Nov 12 15:47:46 2019 (r354644) +++ head/sys/dev/nvdimm/nvdimm_var.h Tue Nov 12 15:50:30 2019 (r354645) @@ -166,6 +166,7 @@ void acpi_nfit_get_flush_addrs(ACPI_TABLE_NFIT *nfitbl 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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201911121550.xACFoUix004074>