mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 13:55:32 +00:00
powerpc/papr_scm: Mark nvdimm as unarmed if needed during probe
In case an nvdimm is found to be unarmed during probe then set its NDD_UNARMED flag before nvdimm_create(). This would enforce a read-only access to the ndimm region. Presently even if an nvdimm is unarmed its not marked as read-only on ppc64 guests. The patch updates papr_scm_nvdimm_init() to force query of nvdimm health via __drc_pmem_query_health() and if nvdimm is found to be unarmed then set the nvdimm flag ND_UNARMED for nvdimm_create(). Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com> Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20210329113103.476760-1-vaibhav@linux.ibm.com
This commit is contained in:
parent
ee1bc694fb
commit
adb68c38d8
1 changed files with 9 additions and 0 deletions
|
@ -947,6 +947,15 @@ static int papr_scm_nvdimm_init(struct papr_scm_priv *p)
|
|||
dimm_flags = 0;
|
||||
set_bit(NDD_LABELING, &dimm_flags);
|
||||
|
||||
/*
|
||||
* Check if the nvdimm is unarmed. No locking needed as we are still
|
||||
* initializing. Ignore error encountered if any.
|
||||
*/
|
||||
__drc_pmem_query_health(p);
|
||||
|
||||
if (p->health_bitmap & PAPR_PMEM_UNARMED_MASK)
|
||||
set_bit(NDD_UNARMED, &dimm_flags);
|
||||
|
||||
p->nvdimm = nvdimm_create(p->bus, p, papr_nd_attr_groups,
|
||||
dimm_flags, PAPR_SCM_DIMM_CMD_MASK, 0, NULL);
|
||||
if (!p->nvdimm) {
|
||||
|
|
Loading…
Reference in a new issue