get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/813764/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 813764,
    "url": "http://patchwork.ozlabs.org/api/patches/813764/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linux-ide/patch/20170914103536.7650-2-hdegoede@redhat.com/",
    "project": {
        "id": 13,
        "url": "http://patchwork.ozlabs.org/api/projects/13/?format=api",
        "name": "Linux IDE development",
        "link_name": "linux-ide",
        "list_id": "linux-ide.vger.kernel.org",
        "list_email": "linux-ide@vger.kernel.org",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20170914103536.7650-2-hdegoede@redhat.com>",
    "list_archive_url": null,
    "date": "2017-09-14T10:35:36",
    "name": "libata: Add new med_power_with_dipm link_power_management_policy setting",
    "commit_ref": null,
    "pull_url": null,
    "state": "not-applicable",
    "archived": false,
    "hash": "a39e3817f78ed613991b02d0e9484e632af18d5a",
    "submitter": {
        "id": 1893,
        "url": "http://patchwork.ozlabs.org/api/people/1893/?format=api",
        "name": "Hans de Goede",
        "email": "hdegoede@redhat.com"
    },
    "delegate": {
        "id": 34,
        "url": "http://patchwork.ozlabs.org/api/users/34/?format=api",
        "username": "davem",
        "first_name": "David",
        "last_name": "Miller",
        "email": "davem@davemloft.net"
    },
    "mbox": "http://patchwork.ozlabs.org/project/linux-ide/patch/20170914103536.7650-2-hdegoede@redhat.com/mbox/",
    "series": [
        {
            "id": 3063,
            "url": "http://patchwork.ozlabs.org/api/series/3063/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linux-ide/list/?series=3063",
            "date": "2017-09-14T10:35:36",
            "name": "libata: Add new med_power_with_dipm link_power_management_policy setting",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/3063/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/813764/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/813764/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<linux-ide-owner@vger.kernel.org>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org",
        "Authentication-Results": [
            "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=linux-ide-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)",
            "ext-mx07.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com",
            "ext-mx07.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=hdegoede@redhat.com"
        ],
        "Received": [
            "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xtFLh48ykz9sPk\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 14 Sep 2017 20:36:12 +1000 (AEST)",
            "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751516AbdINKfk (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tThu, 14 Sep 2017 06:35:40 -0400",
            "from mx1.redhat.com ([209.132.183.28]:45934 \"EHLO mx1.redhat.com\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1752042AbdINKfj (ORCPT <rfc822;linux-ide@vger.kernel.org>);\n\tThu, 14 Sep 2017 06:35:39 -0400",
            "from smtp.corp.redhat.com\n\t(int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 7D062C04B924;\n\tThu, 14 Sep 2017 10:35:39 +0000 (UTC)",
            "from shalem.localdomain.com (ovpn-117-208.ams2.redhat.com\n\t[10.36.117.208])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 681BF6C935;\n\tThu, 14 Sep 2017 10:35:38 +0000 (UTC)"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com 7D062C04B924",
        "From": "Hans de Goede <hdegoede@redhat.com>",
        "To": "Tejun Heo <tj@kernel.org>",
        "Cc": "Hans de Goede <hdegoede@redhat.com>,\n\tMatthew Garrett <mjg59@srcf.ucam.org>,\n\tlinux-ide@vger.kernel.org, linux-kernel@vger.kernel.org",
        "Subject": "[PATCH] libata: Add new med_power_with_dipm\n\tlink_power_management_policy setting",
        "Date": "Thu, 14 Sep 2017 12:35:36 +0200",
        "Message-Id": "<20170914103536.7650-2-hdegoede@redhat.com>",
        "In-Reply-To": "<20170914103536.7650-1-hdegoede@redhat.com>",
        "References": "<20170914103536.7650-1-hdegoede@redhat.com>",
        "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.14",
        "X-Greylist": "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.31]);\n\tThu, 14 Sep 2017 10:35:39 +0000 (UTC)",
        "Sender": "linux-ide-owner@vger.kernel.org",
        "Precedence": "bulk",
        "List-ID": "<linux-ide.vger.kernel.org>",
        "X-Mailing-List": "linux-ide@vger.kernel.org"
    },
    "content": "As described by Matthew Garret quite a while back:\nhttps://mjg59.dreamwidth.org/34868.html\n\nIntel CPUs starting with the Haswell generation need SATA links to power\ndown for the \"package\" part of the CPU to reach low power-states like\nPC7 / P8 which bring a significant power-saving with them.\n\nThe default max_performance lpm policy does not allow for these high\nPC states, both the medium_power and min_power policies do allow this.\n\nThe min_power policy saves significantly more power, but there are some\nreports of some disks / SSDs not liking min_power leading to system\ncrashes and in some cases even data corruption has been reported.\n\nMatthew has found a document documenting the default settings of\nIntel's IRST Windows driver with which most laptops ship:\nhttps://www-ssl.intel.com/content/dam/doc/reference-guide/sata-devices-implementation-recommendations.pdf\n\nMatthew wrote a patch changing med_power to match those defaults, but\nthat never got anywhere as some people where reporting issues with the\npatch-set that patch was a part of.\n\nThis commit is another attempt to make the default IRST driver settings\navailable under Linux, but instead of changing medium_power and\npotentially introducing regressions, this commit adds a new\nmed_power_with_dipm setting which is identical to the existing\nmedium_power accept that it enables dipm on top, which makes it match\nthe Windows IRST driver settings, which should hopefully be safe to\nuse on most devices.\n\nThe med_power_with_dipm setting is close to min_power, except that:\na) It does not use host-initiated slumber mode (ASP not set),\n   but it does allow device-initiated slumber\nb) It does not enable DevSlp mode\n\nOn my T440s test laptop I get the following power savings when idle:\nmedium_power\t\t0.9W\nmed_power_with_dipm\t1.2W\nmin_power\t\t1.2W\n\nSuggested-by: Matthew Garrett <mjg59@srcf.ucam.org>\nCc: Matthew Garrett <mjg59@srcf.ucam.org>\nSigned-off-by: Hans de Goede <hdegoede@redhat.com>\n---\n drivers/ata/libata-core.c |  1 +\n drivers/ata/libata-eh.c   | 10 +++++-----\n drivers/ata/libata-scsi.c |  9 +++++----\n include/linux/libata.h    |  1 +\n 4 files changed, 12 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c\nindex 1945a8ea2099..f165d95c780f 100644\n--- a/drivers/ata/libata-core.c\n+++ b/drivers/ata/libata-core.c\n@@ -3964,6 +3964,7 @@ int sata_link_scr_lpm(struct ata_link *link, enum ata_lpm_policy policy,\n \t\tscontrol &= ~(0x1 << 8);\n \t\tscontrol |= (0x6 << 8);\n \t\tbreak;\n+\tcase ATA_LPM_MED_POWER_WITH_DIPM:\n \tcase ATA_LPM_MIN_POWER:\n \t\tif (ata_link_nr_enabled(link) > 0)\n \t\t\t/* no restrictions on LPM transitions */\ndiff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c\nindex 3dbd05532c09..aefe9a9971ad 100644\n--- a/drivers/ata/libata-eh.c\n+++ b/drivers/ata/libata-eh.c\n@@ -3456,9 +3456,9 @@ static int ata_eh_maybe_retry_flush(struct ata_device *dev)\n  *\t@r_failed_dev: out parameter for failed device\n  *\n  *\tEnable SATA Interface power management.  This will enable\n- *\tDevice Interface Power Management (DIPM) for min_power\n- * \tpolicy, and then call driver specific callbacks for\n- *\tenabling Host Initiated Power management.\n+ *\tDevice Interface Power Management (DIPM) for min_power and\n+ *\tmedium_power_with_dipm policies, and then call driver specific\n+ *\tcallbacks for enabling Host Initiated Power management.\n  *\n  *\tLOCKING:\n  *\tEH context.\n@@ -3504,7 +3504,7 @@ static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy,\n \t\t\thints &= ~ATA_LPM_HIPM;\n \n \t\t/* disable DIPM before changing link config */\n-\t\tif (policy != ATA_LPM_MIN_POWER && dipm) {\n+\t\tif (policy < ATA_LPM_MED_POWER_WITH_DIPM && dipm) {\n \t\t\terr_mask = ata_dev_set_feature(dev,\n \t\t\t\t\tSETFEATURES_SATA_DISABLE, SATA_DIPM);\n \t\t\tif (err_mask && err_mask != AC_ERR_DEV) {\n@@ -3547,7 +3547,7 @@ static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy,\n \n \t/* host config updated, enable DIPM if transitioning to MIN_POWER */\n \tata_for_each_dev(dev, link, ENABLED) {\n-\t\tif (policy == ATA_LPM_MIN_POWER && !no_dipm &&\n+\t\tif (policy >= ATA_LPM_MED_POWER_WITH_DIPM && !no_dipm &&\n \t\t    ata_id_has_dipm(dev->id)) {\n \t\t\terr_mask = ata_dev_set_feature(dev,\n \t\t\t\t\tSETFEATURES_SATA_ENABLE, SATA_DIPM);\ndiff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c\nindex 44ba292f2cd7..673e72f438eb 100644\n--- a/drivers/ata/libata-scsi.c\n+++ b/drivers/ata/libata-scsi.c\n@@ -106,10 +106,11 @@ static const u8 def_control_mpage[CONTROL_MPAGE_LEN] = {\n };\n \n static const char *ata_lpm_policy_names[] = {\n-\t[ATA_LPM_UNKNOWN]\t= \"max_performance\",\n-\t[ATA_LPM_MAX_POWER]\t= \"max_performance\",\n-\t[ATA_LPM_MED_POWER]\t= \"medium_power\",\n-\t[ATA_LPM_MIN_POWER]\t= \"min_power\",\n+\t[ATA_LPM_UNKNOWN]\t\t= \"max_performance\",\n+\t[ATA_LPM_MAX_POWER]\t\t= \"max_performance\",\n+\t[ATA_LPM_MED_POWER]\t\t= \"medium_power\",\n+\t[ATA_LPM_MED_POWER_WITH_DIPM]\t= \"med_power_with_dipm\",\n+\t[ATA_LPM_MIN_POWER]\t\t= \"min_power\",\n };\n \n static ssize_t ata_scsi_lpm_store(struct device *device,\ndiff --git a/include/linux/libata.h b/include/linux/libata.h\nindex 931c32f1f18d..ed9826b21c5e 100644\n--- a/include/linux/libata.h\n+++ b/include/linux/libata.h\n@@ -522,6 +522,7 @@ enum ata_lpm_policy {\n \tATA_LPM_UNKNOWN,\n \tATA_LPM_MAX_POWER,\n \tATA_LPM_MED_POWER,\n+\tATA_LPM_MED_POWER_WITH_DIPM, /* Med power + DIPM as win IRST does */\n \tATA_LPM_MIN_POWER,\n };\n \n",
    "prefixes": []
}