From owner-svn-src-all@freebsd.org Tue Nov 12 15:50:31 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6D7E51B14AF; Tue, 12 Nov 2019 15:50:31 +0000 (UTC) (envelope-from scottph@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47CBzC2FPZz3DNt; Tue, 12 Nov 2019 15:50:31 +0000 (UTC) (envelope-from scottph@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 305481EC5; Tue, 12 Nov 2019 15:50:31 +0000 (UTC) (envelope-from scottph@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xACFoVng004079; Tue, 12 Nov 2019 15:50:31 GMT (envelope-from scottph@FreeBSD.org) Received: (from scottph@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xACFoUix004074; Tue, 12 Nov 2019 15:50:30 GMT (envelope-from scottph@FreeBSD.org) Message-Id: <201911121550.xACFoUix004074@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottph set sender to scottph@FreeBSD.org using -f From: D Scott Phillips Date: Tue, 12 Nov 2019 15:50:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354645 - head/sys/dev/nvdimm X-SVN-Group: head X-SVN-Commit-Author: scottph X-SVN-Commit-Paths: head/sys/dev/nvdimm X-SVN-Commit-Revision: 354645 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Nov 2019 15:50:31 -0000 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);