This is incremental to Dave's recent "[PATCH v7 00/20] Introduce security commands for CXL pmem device" [1], starting after patch 17 [2]. I.e. I want to drop patch 18, 19, and 20 from that series and replace them with these. It was prompted by Davidlohr's concerns about cxl_invalidate_memregion().
The insight is that now that cpu_cache_invalidate_memregion() has a default implementation for all architectures, the cache management can move from the intel-pmem-specific security operations to the generic NVDIMM core. This relieves the new CXL security ops from needing to open-code their own cache flushing.
Also prompted by Davidlohr's concerns is what do about cache flushing for scenarios outside of the PMEM security operations. For that "[PATCH 5/5] cxl/region: Manage CPU caches relative to DPA invalidation events" proposes to handle that management at region activation time. This does mean that dynamic CXL region provisioning is limited to environments where cpu_cache_has_invalidate_memregion() is true. A new CONFIG_CXL_REGION_INVALIDATION_TEST is added to bypass that data integrity enforcement.
Lastly this includes some fixups, one for the fact that cxl_region_probe() was ignoring some errors, another to enforce that PMEM security operations originate through LIBNVDIMM, and lastly a cleanup to move a string formatting failure condition from runtime to compile-time in cxl_nvdimm_alloc().
[1]: http://lore.kernel.org/r/166983606451.2734609.4050644229630259452.stgit@djia... [2]: https://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl.git/log/?h=for-6.2/c...
---
Dan Williams (4): cxl/region: Fix missing probe failure cxl/pmem: Enforce keyctl ABI for PMEM security nvdimm/region: Move cache management to the region driver cxl/region: Manage CPU caches relative to DPA invalidation events
Dave Jiang (1): cxl: add dimm_id support for __nvdimm_create()
drivers/acpi/nfit/intel.c | 25 --------------------- drivers/cxl/Kconfig | 18 +++++++++++++++ drivers/cxl/core/mbox.c | 10 +++++++++ drivers/cxl/core/pmem.c | 7 ++++++ drivers/cxl/core/region.c | 34 +++++++++++++++++++++++++++++ drivers/cxl/cxl.h | 11 +++++++++ drivers/cxl/pmem.c | 3 ++- drivers/cxl/security.c | 14 ------------ drivers/nvdimm/region.c | 11 +++++++++ drivers/nvdimm/region_devs.c | 49 +++++++++++++++++++++++++++++++++++++++++- drivers/nvdimm/security.c | 6 +++++ include/linux/libnvdimm.h | 5 ++++ 12 files changed, 152 insertions(+), 41 deletions(-)
base-commit: 15a8348707ffd2a37516db9bede88cc0bb467e0b
cxl_region_probe() allows for regions not in the 'commit' state to be enabled. Fail probe when the region is not committed otherwise the kernel may indicate that an address range is active when none of the decoders are active.
Fixes: 8d48817df6ac ("cxl/region: Add region driver boiler plate") Cc: stable@vger.kernel.org Signed-off-by: Dan Williams dan.j.williams@intel.com --- drivers/cxl/core/region.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c index f9ae5ad284ff..1bc2ebefa2a5 100644 --- a/drivers/cxl/core/region.c +++ b/drivers/cxl/core/region.c @@ -1923,6 +1923,9 @@ static int cxl_region_probe(struct device *dev) */ up_read(&cxl_region_rwsem);
+ if (rc) + return rc; + switch (cxlr->mode) { case CXL_DECODER_PMEM: return devm_cxl_add_pmem_region(cxlr);
On 12/1/2022 3:03 PM, Dan Williams wrote:
cxl_region_probe() allows for regions not in the 'commit' state to be enabled. Fail probe when the region is not committed otherwise the kernel may indicate that an address range is active when none of the decoders are active.
Fixes: 8d48817df6ac ("cxl/region: Add region driver boiler plate") Cc: stable@vger.kernel.org Signed-off-by: Dan Williams dan.j.williams@intel.com
Reviewed-by: Dave Jiang dave.jiang@intel.com
drivers/cxl/core/region.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c index f9ae5ad284ff..1bc2ebefa2a5 100644 --- a/drivers/cxl/core/region.c +++ b/drivers/cxl/core/region.c @@ -1923,6 +1923,9 @@ static int cxl_region_probe(struct device *dev) */ up_read(&cxl_region_rwsem);
- if (rc)
return rc;
- switch (cxlr->mode) { case CXL_DECODER_PMEM: return devm_cxl_add_pmem_region(cxlr);
On Thu, 01 Dec 2022, Dan Williams wrote:
cxl_region_probe() allows for regions not in the 'commit' state to be enabled. Fail probe when the region is not committed otherwise the kernel may indicate that an address range is active when none of the decoders are active.
Fixes: 8d48817df6ac ("cxl/region: Add region driver boiler plate") Cc: stable@vger.kernel.org Signed-off-by: Dan Williams dan.j.williams@intel.com
Reviewed-by: Davidlohr Bueso dave@stgolabs.net
drivers/cxl/core/region.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c index f9ae5ad284ff..1bc2ebefa2a5 100644 --- a/drivers/cxl/core/region.c +++ b/drivers/cxl/core/region.c @@ -1923,6 +1923,9 @@ static int cxl_region_probe(struct device *dev) */ up_read(&cxl_region_rwsem);
- if (rc)
return rc;
- switch (cxlr->mode) { case CXL_DECODER_PMEM: return devm_cxl_add_pmem_region(cxlr);
On Thu, 01 Dec 2022 14:03:24 -0800 Dan Williams dan.j.williams@intel.com wrote:
cxl_region_probe() allows for regions not in the 'commit' state to be enabled. Fail probe when the region is not committed otherwise the kernel may indicate that an address range is active when none of the decoders are active.
Fixes: 8d48817df6ac ("cxl/region: Add region driver boiler plate") Cc: stable@vger.kernel.org Signed-off-by: Dan Williams dan.j.williams@intel.com
Huh. I wonder why this wasn't triggering a build warning given rc is assigned but unused.
Ah well, this is clearly the original intent and makes sense.
Reviewed-by: Jonathan Cameron Jonathan.Cameron@huawei.com
drivers/cxl/core/region.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c index f9ae5ad284ff..1bc2ebefa2a5 100644 --- a/drivers/cxl/core/region.c +++ b/drivers/cxl/core/region.c @@ -1923,6 +1923,9 @@ static int cxl_region_probe(struct device *dev) */ up_read(&cxl_region_rwsem);
- if (rc)
return rc;
- switch (cxlr->mode) { case CXL_DECODER_PMEM: return devm_cxl_add_pmem_region(cxlr);
Jonathan Cameron wrote:
On Thu, 01 Dec 2022 14:03:24 -0800 Dan Williams dan.j.williams@intel.com wrote:
cxl_region_probe() allows for regions not in the 'commit' state to be enabled. Fail probe when the region is not committed otherwise the kernel may indicate that an address range is active when none of the decoders are active.
Fixes: 8d48817df6ac ("cxl/region: Add region driver boiler plate") Cc: stable@vger.kernel.org Signed-off-by: Dan Williams dan.j.williams@intel.com
Huh. I wonder why this wasn't triggering a build warning given rc is assigned but unused.
Yes, I thought that was curious too.
Ah well, this is clearly the original intent and makes sense.
Reviewed-by: Jonathan Cameron Jonathan.Cameron@huawei.com
drivers/cxl/core/region.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c index f9ae5ad284ff..1bc2ebefa2a5 100644 --- a/drivers/cxl/core/region.c +++ b/drivers/cxl/core/region.c @@ -1923,6 +1923,9 @@ static int cxl_region_probe(struct device *dev) */ up_read(&cxl_region_rwsem);
- if (rc)
return rc;
- switch (cxlr->mode) { case CXL_DECODER_PMEM: return devm_cxl_add_pmem_region(cxlr);
linux-stable-mirror@lists.linaro.org