Pull libnvdimm fixes from Dan Williams: "A crash fix, a build warning fix, a miscellaneous small cleanups. In case anyone is looking for them, there was a regression caught by testing that caused two patches to be dropped from this update. Those patches have been reworked and will soak for another week / re-target 5.0-rc4. - Fix driver initialization crash due to the inability to report an 'error' state for a DIMM's security capability. - Build warning fix for little-endian ARM64 builds - Fix a potential race between the EDAC driver's usage of the NFIT SMBIOS id for a DIMM and the driver shutdown path. - A small collection of one-line benign cleanups for duplicate variable assignments, a duplicate header include and a mis-typed function argument" * tag 'libnvdimm-fixes-5.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm: libnvdimm/security: Fix nvdimm_security_state() state request selection acpi/nfit: Remove duplicate set nd_set in acpi_nfit_init_interleave_set() acpi/nfit: Fix race accessing memdev in nfit_get_smbios_id() libnvdimm/dimm: Fix security capability detection for non-Intel NVDIMMs nfit: Mark some functions as __maybe_unused ACPI/nfit: delete the function to_acpi_nfit_desc ACPI/nfit: delete the redundant header file
Unified · Split
| @@ -26,7 +26,6 @@ · 25 unmodified lines | ||
| 26 | 26 | #include <acpi/nfit.h> |
| 27 | 27 | #include "intel.h" |
| 28 | 28 | #include "nfit.h" |
| 29 | −#include "intel.h" | |
| 30 | 29 | |
| 31 | 30 | /* |
| 32 | 31 | * For readq() and writeq() on 32-bit builds, the hi-lo, lo-hi order is |
| @@ -78,12 +77,6 @@ const guid_t *to_nfit_uuid(enum nfit_uuids id) · 45 unmodified lines | ||
| 78 | 77 | } |
| 79 | 78 | EXPORT_SYMBOL(to_nfit_uuid); |
| 80 | 79 | |
| 81 | −static struct acpi_nfit_desc *to_acpi_nfit_desc( | |
| 82 | − struct nvdimm_bus_descriptor *nd_desc) | |
| 83 | −{ | |
| 84 | − return container_of(nd_desc, struct acpi_nfit_desc, nd_desc); | |
| 85 | −} | |
| 86 | − | |
| 87 | 80 | static struct acpi_device *to_acpi_dev(struct acpi_nfit_desc *acpi_desc) |
| 88 | 81 | { |
| 89 | 82 | struct nvdimm_bus_descriptor *nd_desc = &acpi_desc->nd_desc; |
| @@ -419,7 +412,7 @@ static bool payload_dumpable(struct nvdimm *nvdimm, unsigned int func) · 329 unmodified lines | ||
| 419 | 412 | int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm, |
| 420 | 413 | unsigned int cmd, void *buf, unsigned int buf_len, int *cmd_rc) |
| 421 | 414 | { |
| 422 | − struct acpi_nfit_desc *acpi_desc = to_acpi_nfit_desc(nd_desc); | |
| 415 | + struct acpi_nfit_desc *acpi_desc = to_acpi_desc(nd_desc); | |
| 423 | 416 | struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm); |
| 424 | 417 | union acpi_object in_obj, in_buf, *out_obj; |
| 425 | 418 | const struct nd_cmd_desc *desc = NULL; |
| @@ -721,6 +714,7 @@ int nfit_get_smbios_id(u32 device_handle, u16 *flags) · 295 unmodified lines | ||
| 721 | 714 | struct acpi_nfit_memory_map *memdev; |
| 722 | 715 | struct acpi_nfit_desc *acpi_desc; |
| 723 | 716 | struct nfit_mem *nfit_mem; |
| 717 | + u16 physical_id; | |
| 724 | 718 | |
| 725 | 719 | mutex_lock(&acpi_desc_lock); |
| 726 | 720 | list_for_each_entry(acpi_desc, &acpi_descs, list) { |
| @@ -728,10 +722,11 @@ int nfit_get_smbios_id(u32 device_handle, u16 *flags) · 1 unmodified line | ||
| 728 | 722 | list_for_each_entry(nfit_mem, &acpi_desc->dimms, list) { |
| 729 | 723 | memdev = __to_nfit_memdev(nfit_mem); |
| 730 | 724 | if (memdev->device_handle == device_handle) { |
| 725 | + *flags = memdev->flags; | |
| 726 | + physical_id = memdev->physical_id; | |
| 731 | 727 | mutex_unlock(&acpi_desc->init_mutex); |
| 732 | 728 | mutex_unlock(&acpi_desc_lock); |
| 733 | − *flags = memdev->flags; | |
| 734 | − return memdev->physical_id; | |
| 729 | + return physical_id; | |
| 735 | 730 | } |
| 736 | 731 | } |
| 737 | 732 | mutex_unlock(&acpi_desc->init_mutex); |
| @@ -2231,7 +2226,6 @@ static int acpi_nfit_init_interleave_set(struct acpi_nfit_desc *acpi_desc, · 1493 unmodified lines | ||
| 2231 | 2226 | nd_set = devm_kzalloc(dev, sizeof(*nd_set), GFP_KERNEL); |
| 2232 | 2227 | if (!nd_set) |
| 2233 | 2228 | return -ENOMEM; |
| 2234 | − ndr_desc->nd_set = nd_set; | |
| 2235 | 2229 | guid_copy(&nd_set->type_guid, (guid_t *) spa->range_guid); |
| 2236 | 2230 | |
| 2237 | 2231 | info = devm_kzalloc(dev, sizeof_nfit_set_info(nr), GFP_KERNEL); |
| @@ -3367,7 +3361,7 @@ EXPORT_SYMBOL_GPL(acpi_nfit_init); · 1129 unmodified lines | ||
| 3367 | 3361 | |
| 3368 | 3362 | static int acpi_nfit_flush_probe(struct nvdimm_bus_descriptor *nd_desc) |
| 3369 | 3363 | { |
| 3370 | − struct acpi_nfit_desc *acpi_desc = to_acpi_nfit_desc(nd_desc); | |
| 3364 | + struct acpi_nfit_desc *acpi_desc = to_acpi_desc(nd_desc); | |
| 3371 | 3365 | struct device *dev = acpi_desc->dev; |
| 3372 | 3366 | |
| 3373 | 3367 | /* Bounce the device lock to flush acpi_nfit_add / acpi_nfit_notify */ |
| @@ -3384,7 +3378,7 @@ static int acpi_nfit_flush_probe(struct nvdimm_bus_descriptor *nd_desc) · 10 unmodified lines | ||
| 3384 | 3378 | static int __acpi_nfit_clear_to_send(struct nvdimm_bus_descriptor *nd_desc, |
| 3385 | 3379 | struct nvdimm *nvdimm, unsigned int cmd) |
| 3386 | 3380 | { |
| 3387 | − struct acpi_nfit_desc *acpi_desc = to_acpi_nfit_desc(nd_desc); | |
| 3381 | + struct acpi_nfit_desc *acpi_desc = to_acpi_desc(nd_desc); | |
| 3388 | 3382 | |
| 3389 | 3383 | if (nvdimm) |
| 3390 | 3384 | return 0; |
| @@ -146,7 +146,7 @@ static int intel_security_change_key(struct nvdimm *nvdimm, · 145 unmodified lines | ||
| 146 | 146 | |
| 147 | 147 | static void nvdimm_invalidate_cache(void); |
| 148 | 148 | |
| 149 | −static int intel_security_unlock(struct nvdimm *nvdimm, | |
| 149 | +static int __maybe_unused intel_security_unlock(struct nvdimm *nvdimm, | |
| 150 | 150 | const struct nvdimm_key_data *key_data) |
| 151 | 151 | { |
| 152 | 152 | struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm); |
| @@ -227,7 +227,7 @@ static int intel_security_disable(struct nvdimm *nvdimm, · 74 unmodified lines | ||
| 227 | 227 | return 0; |
| 228 | 228 | } |
| 229 | 229 | |
| 230 | −static int intel_security_erase(struct nvdimm *nvdimm, | |
| 230 | +static int __maybe_unused intel_security_erase(struct nvdimm *nvdimm, | |
| 231 | 231 | const struct nvdimm_key_data *key, |
| 232 | 232 | enum nvdimm_passphrase_type ptype) |
| 233 | 233 | { |
| @@ -276,7 +276,7 @@ static int intel_security_erase(struct nvdimm *nvdimm, · 42 unmodified lines | ||
| 276 | 276 | return 0; |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | −static int intel_security_query_overwrite(struct nvdimm *nvdimm) | |
| 279 | +static int __maybe_unused intel_security_query_overwrite(struct nvdimm *nvdimm) | |
| 280 | 280 | { |
| 281 | 281 | int rc; |
| 282 | 282 | struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm); |
| @@ -313,7 +313,7 @@ static int intel_security_query_overwrite(struct nvdimm *nvdimm) · 30 unmodified lines | ||
| 313 | 313 | return 0; |
| 314 | 314 | } |
| 315 | 315 | |
| 316 | −static int intel_security_overwrite(struct nvdimm *nvdimm, | |
| 316 | +static int __maybe_unused intel_security_overwrite(struct nvdimm *nvdimm, | |
| 317 | 317 | const struct nvdimm_key_data *nkey) |
| 318 | 318 | { |
| 319 | 319 | int rc; |
| @@ -54,12 +54,12 @@ struct nvdimm { · 53 unmodified lines | ||
| 54 | 54 | }; |
| 55 | 55 | |
| 56 | 56 | static inline enum nvdimm_security_state nvdimm_security_state( |
| 57 | − struct nvdimm *nvdimm, bool master) | |
| 57 | + struct nvdimm *nvdimm, enum nvdimm_passphrase_type ptype) | |
| 58 | 58 | { |
| 59 | 59 | if (!nvdimm->sec.ops) |
| 60 | 60 | return -ENXIO; |
| 61 | 61 | |
| 62 | − return nvdimm->sec.ops->state(nvdimm, master); | |
| 62 | + return nvdimm->sec.ops->state(nvdimm, ptype); | |
| 63 | 63 | } |
| 64 | 64 | int nvdimm_security_freeze(struct nvdimm *nvdimm); |
| 65 | 65 | #if IS_ENABLED(CONFIG_NVDIMM_KEYS) |
| @@ -160,6 +160,7 @@ static inline struct nd_blk_region_desc *to_blk_region_desc( · 159 unmodified lines | ||
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | enum nvdimm_security_state { |
| 163 | + NVDIMM_SECURITY_ERROR = -1, | |
| 163 | 164 | NVDIMM_SECURITY_DISABLED, |
| 164 | 165 | NVDIMM_SECURITY_UNLOCKED, |
| 165 | 166 | NVDIMM_SECURITY_LOCKED, |