[PATCH] nfit: fix translation of command status results
by Dan Williams
When transportation of the command completes successfully, it indicates
that the 'status' result is valid. Fix the missed checking and
translation of the status field at the end of acpi_nfit_ctl().
Otherwise, we fail to handle reported errors and assume commands
complete successfully.
Reported-by: Linda Knippers <linda.knippers(a)hpe.com>
Signed-off-by: Dan Williams <dan.j.williams(a)intel.com>
---
drivers/acpi/nfit.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/acpi/nfit.c b/drivers/acpi/nfit.c
index d0f35e63640b..63cc9dbe4f3b 100644
--- a/drivers/acpi/nfit.c
+++ b/drivers/acpi/nfit.c
@@ -287,8 +287,11 @@ static int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc,
offset);
rc = -ENXIO;
}
- } else
+ } else {
rc = 0;
+ if (cmd_rc)
+ *cmd_rc = xlat_status(buf, cmd);
+ }
out:
ACPI_FREE(out_obj);
4 years, 8 months
[PATCH 0/3] Add alignment check for DAX mount
by Toshi Kani
When a partition is not aligned by 4KB, mount -o dax succeeds,
but any read/write access to the filesystem fails, except for
metadata update.
Add alignment check to ext4, ext2, and xfs.
---
Toshi Kani (3):
1/3 ext4: Add alignment check for DAX mount
2/3 ext2: Add alignment check for DAX mount
3/3 xfs: Add alignment check for DAX mount
---
fs/ext2/super.c | 6 ++++++
fs/ext4/super.c | 6 ++++++
fs/xfs/xfs_super.c | 6 ++++++
3 files changed, 18 insertions(+)
4 years, 8 months
acpi_nfit_query_poison() broken on non-ARS systems
by Linda Knippers
I tested Vishal's original ARS patches and they worked correctly on my test
system, which doesn't support ARS. By worked correctly, I mean that they
properly looked at the status of the Query ARS Capabilities function and saw
that it indicated that the function is not supported. The original code
skipped the rest of the ARS processing.
The code I tested has been re-worked a number of times and now it no longer
looks at the status of the Query function. It assumes that if the DSM worked
at all, it must be ok and happily uses fields that is shouldn't be looking at.
If you look here:
> static int acpi_nfit_query_poison(struct acpi_nfit_desc *acpi_desc,
> struct nfit_spa *nfit_spa)
> {
> struct acpi_nfit_system_address *spa = nfit_spa->spa;
> int rc;
>
> if (!nfit_spa->max_ars) {
On a platform that doesn't support ARS, max_ars will always be zero
so you'll keep executing this code when it seems like you're trying
to avoid that.
> struct nd_cmd_ars_cap ars_cap;
>
> memset(&ars_cap, 0, sizeof(ars_cap));
> rc = ars_get_cap(acpi_desc, &ars_cap, nfit_spa);
> if (rc < 0)
> return rc;
The call succeeds so this return isn't taken, but then the code assumes
everything is good. It should check ars_cap.status so see if the function
is supported or if there was an error and return something appropriate.
In previous version of the code, that's what acpi_nfit_find_poison() did.
Instead, this function continues, using data that's not right and making
more calls that also aren't supported.
> nfit_spa->max_ars = ars_cap.max_ars_out;
> nfit_spa->clear_err_unit = ars_cap.clear_err_unit;
Since we don't bail out, the above values are zero but not actually checked
by subsequent users.
> /* check that the supported scrub types match the spa type */
> if (nfit_spa_type(spa) == NFIT_SPA_VOLATILE &&
> ((ars_cap.status >> 16) & ND_ARS_VOLATILE) == 0)
> return -ENOTTY;
> else if (nfit_spa_type(spa) == NFIT_SPA_PM &&
> ((ars_cap.status >> 16) & ND_ARS_PERSISTENT) == 0)
> return -ENOTTY;
> }
>
> if (ars_status_alloc(acpi_desc, nfit_spa->max_ars))
> return -ENOMEM;
>
> rc = ars_get_status(acpi_desc);
> if (rc < 0 && rc != -ENOSPC)
> return rc;
>
> if (ars_status_process_records(acpi_desc->nvdimm_bus,
> acpi_desc->ars_status))
> return -ENOMEM;
>
> return 0;
> }
I don't know if you want to change how this function works or change how
ars_get_cap works but something needs to change. You actually do check the
status in xlat_status() if the call was initiated from user space but you don't
check when it's initiated from within the kernel.
For reference, below is the dmesg output from my system running the latest
upstream kernel.
-- ljk
[ 36.807155] nfit ACPI0012:00: acpi_nfit_ctl:bus cmd: ars_cap input length: 16
[ 36.807159] ars_cap00000000: 80000000 00000004 00000000 00000002
................
[ 36.807336] nfit ACPI0012:00: acpi_nfit_ctl:bus cmd: ars_cap output length: 16
[ 36.807338] ars_cap00000000: 00000001 00000000 00000000 00000000
................
[ 36.807427] nfit ACPI0012:00: acpi_nfit_ctl:bus cmd: ars_start input length: 24
[ 36.807430] ars_start00000000: 80000000 00000004 00000000 00000002
................
[ 36.807431] ars_start00000010: 00000002 00000000 ........
[ 36.807513] nfit ACPI0012:00: acpi_nfit_ctl:bus cmd: ars_start output length: 4
[ 36.807515] ars_start00000000: 00000001 ....
[ 36.807516] nfit ACPI0012:00: acpi_nfit_ctl:bus output object underflow cmd:
ars_start field: 1
[ 36.807518] nfit ACPI0012:00: acpi_nfit_ctl:bus cmd: ars_start input length: 24
[ 36.807520] ars_start00000000: 80000000 00000006 00000000 00000002
................
[ 36.807521] ars_start00000010: 00000002 00000000 ........
[ 36.807593] nfit ACPI0012:00: acpi_nfit_ctl:bus cmd: ars_start output length: 4
[ 36.807594] ars_start00000000: 00000001 ....
[ 36.807596] nfit ACPI0012:00: acpi_nfit_ctl:bus output object underflow cmd:
ars_start field: 1
[ 36.807597] nfit ACPI0012:00: acpi_nfit_ctl:bus cmd: ars_start input length: 24
[ 36.807599] ars_start00000000: 80000000 0000000c 00000000 00000002
................
[ 36.807600] ars_start00000010: 00000002 00000000 ........
[ 36.807670] nfit ACPI0012:00: acpi_nfit_ctl:bus cmd: ars_start output length: 4
[ 36.807671] ars_start00000000: 00000001 ....
[ 36.807673] nfit ACPI0012:00: acpi_nfit_ctl:bus output object underflow cmd:
ars_start field: 1
[ 36.807674] nfit ACPI0012:00: acpi_nfit_ctl:bus cmd: ars_start input length: 24
[ 36.807676] ars_start00000000: 80000000 0000000e 00000000 00000002
................
[ 36.807677] ars_start00000010: 00000002 00000000 ........
[ 36.807747] nfit ACPI0012:00: acpi_nfit_ctl:bus cmd: ars_start output length: 4
[ 36.807748] ars_start00000000: 00000001 ....
[ 36.807749] nfit ACPI0012:00: acpi_nfit_ctl:bus output object underflow cmd:
ars_start field: 1
4 years, 8 months
[PATCH] nfit: export subsystem ids as attributes
by Dan Williams
Similar to pci-sysfs export the subsystem information available in the
NFIT. ACPI 6.1 clarifies that this data is copied as an array of bytes
from the DIMM SPD data.
Reported-by: Ryon Jensen <ryon.jensen(a)intel.com>
Signed-off-by: Dan Williams <dan.j.williams(a)intel.com>
---
drivers/acpi/nfit.c | 33 ++++++++++++++++++++++++++++++++-
1 file changed, 32 insertions(+), 1 deletion(-)
diff --git a/drivers/acpi/nfit.c b/drivers/acpi/nfit.c
index 5a7199db2e06..0a1ba3d2e39a 100644
--- a/drivers/acpi/nfit.c
+++ b/drivers/acpi/nfit.c
@@ -847,6 +847,34 @@ static ssize_t format_show(struct device *dev,
}
static DEVICE_ATTR_RO(format);
+static ssize_t subsystem_vendor_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct acpi_nfit_control_region *dcr = to_nfit_dcr(dev);
+
+ return sprintf(buf, "0x%04x\n", be16_to_cpu(dcr->subsystem_vendor_id));
+}
+static DEVICE_ATTR_RO(subsystem_vendor);
+
+static ssize_t subsystem_rev_id_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct acpi_nfit_control_region *dcr = to_nfit_dcr(dev);
+
+ return sprintf(buf, "0x%04x\n",
+ be16_to_cpu(dcr->subsystem_revision_id));
+}
+static DEVICE_ATTR_RO(subsystem_rev_id);
+
+static ssize_t subsystem_device_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct acpi_nfit_control_region *dcr = to_nfit_dcr(dev);
+
+ return sprintf(buf, "0x%04x\n", be16_to_cpu(dcr->subsystem_device_id));
+}
+static DEVICE_ATTR_RO(subsystem_device);
+
static ssize_t serial_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
@@ -893,9 +921,12 @@ static struct attribute *acpi_nfit_dimm_attributes[] = {
&dev_attr_phys_id.attr,
&dev_attr_vendor.attr,
&dev_attr_device.attr,
+ &dev_attr_rev_id.attr,
+ &dev_attr_subsystem_vendor.attr,
+ &dev_attr_subsystem_device.attr,
+ &dev_attr_subsystem_rev_id.attr,
&dev_attr_format.attr,
&dev_attr_serial.attr,
- &dev_attr_rev_id.attr,
&dev_attr_flags.attr,
&dev_attr_id.attr,
NULL,
4 years, 8 months