History

Merge branch 'for-4.10' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata

Pull libata updates from Tejun Heo: - Adam added opt-in ATA command priority support. - There are machines which hide multiple nvme devices behind an ahci BAR. Dan Williams proposed a solution to force-switch the mode but deemed too hackishd. People are gonna discuss the proper way to handle the situation in nvme standard meetings. For now, detect and warn about the situation. - Low level driver specific changes. Christoph Hellwig pipes in about the hidden nvme warning: "I wish that was the case. We've pretty much agreed that we'll want to implement it as a virtual PCIe root bridge, similar to Intels other 'innovation' VMD that we work around that way. But Intel management has apparently decided that they don't want to spend more cycles on this now that Lenovo has an optional BIOS that doesn't force this broken mode anymore, and no one outside of Intel has enough information to implement something like this. So for now I guess this warning is it, until Intel reconsideres and spends resources on fixing up the damage their Chipset people caused" * 'for-4.10' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata: ahci: warn about remapped NVMe devices ahci-remap.h: add ahci remapping definitions nvme: move NVMe class code to pci_ids.h pata: imx: support controller modes up to PIO4 pata: imx: add support of setting timings for PIO modes pata: imx: set controller PIO mode with .set_piomode callback pata: imx: sort headers out ata: set ncq_prio_enabled iff device has support ata: ATA Command Priority Disabled By Default ata: Enabling ATA Command Priorities block: Add iocontext priority to request ahci: qoriq: added ls1046a platform support

Linus Torvalds committed 9 years ago

Commit b92e09b2 parents c11a6cf aecec8b14 files · +282 −35Browse files

Unified · Split

14 files
  1. block/blk-core.c +3 −1
  2. drivers/ata/ahci.c +39 −0
  3. drivers/ata/ahci_qoriq.c +13 −3
  4. drivers/ata/libahci.c +1 −0
  5. drivers/ata/libata-core.c +34 −1
  6. drivers/ata/libata-scsi.c +79 −1
  7. drivers/ata/libata.h +1 −1
  8. drivers/ata/pata_imx.c +57 −25
  9. drivers/nvme/host/pci.c +0 −3
  10. include/linux/ahci-remap.h +28 −0
  11. include/linux/ata.h +6 −0
  12. include/linux/blkdev.h +14 −0
  13. include/linux/libata.h +5 −0
  14. include/linux/pci_ids.h +2 −0
block/blk-core.c+3−1
@@ -1154,6 +1154,7 @@ static struct request *__get_request(struct request_list *rl, unsigned int op, · 1153 unmodified lines
11541154
11551155 blk_rq_init(q, rq);
11561156 blk_rq_set_rl(rq, rl);
1157+ blk_rq_set_prio(rq, ioc);
11571158 rq->cmd_flags = op;
11581159 rq->rq_flags = rq_flags;
11591160
@@ -1626,7 +1627,8 @@ void init_request_from_bio(struct request *req, struct bio *bio) · 466 unmodified lines
16261627
16271628 req->errors = 0;
16281629 req->__sector = bio->bi_iter.bi_sector;
1629− req->ioprio = bio_prio(bio);
1630+ if (ioprio_valid(bio_prio(bio)))
1631+ req->ioprio = bio_prio(bio);
16301632 blk_rq_bio_prep(req->q, req, bio);
16311633 }
16321634
drivers/ata/ahci.c+39−0
@@ -46,6 +46,8 @@ · 45 unmodified lines
4646 #include <scsi/scsi_host.h>
4747 #include <scsi/scsi_cmnd.h>
4848 #include <linux/libata.h>
49+#include <linux/ahci-remap.h>
50+#include <linux/io-64-nonatomic-lo-hi.h>
4951 #include "ahci.h"
5052
5153 #define DRV_NAME "ahci"
@@ -1400,6 +1402,40 @@ static irqreturn_t ahci_thunderx_irq_handler(int irq, void *dev_instance) · 1348 unmodified lines
14001402 }
14011403 #endif
14021404
1405+static void ahci_remap_check(struct pci_dev *pdev, int bar,
1406+ struct ahci_host_priv *hpriv)
1407+{
1408+ int i, count = 0;
1409+ u32 cap;
1410+
1411+ /*
1412+ * Check if this device might have remapped nvme devices.
1413+ */
1414+ if (pdev->vendor != PCI_VENDOR_ID_INTEL ||
1415+ pci_resource_len(pdev, bar) < SZ_512K ||
1416+ bar != AHCI_PCI_BAR_STANDARD ||
1417+ !(readl(hpriv->mmio + AHCI_VSCAP) & 1))
1418+ return;
1419+
1420+ cap = readq(hpriv->mmio + AHCI_REMAP_CAP);
1421+ for (i = 0; i < AHCI_MAX_REMAP; i++) {
1422+ if ((cap & (1 << i)) == 0)
1423+ continue;
1424+ if (readl(hpriv->mmio + ahci_remap_dcc(i))
1425+ != PCI_CLASS_STORAGE_EXPRESS)
1426+ continue;
1427+
1428+ /* We've found a remapped device */
1429+ count++;
1430+ }
1431+
1432+ if (!count)
1433+ return;
1434+
1435+ dev_warn(&pdev->dev, "Found %d remapped NVMe devices.\n", count);
1436+ dev_warn(&pdev->dev, "Switch your BIOS from RAID to AHCI mode to use them.\n");
1437+}
1438+
14031439 static int ahci_get_irq_vector(struct ata_host *host, int port)
14041440 {
14051441 return pci_irq_vector(to_pci_dev(host->dev), port);
@@ -1541,6 +1577,9 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) · 135 unmodified lines
15411577
15421578 hpriv->mmio = pcim_iomap_table(pdev)[ahci_pci_bar];
15431579
1580+ /* detect remapped nvme devices */
1581+ ahci_remap_check(pdev, ahci_pci_bar, hpriv);
1582+
15441583 /* must set flag prior to save config in order to take effect */
15451584 if (ahci_broken_devslp(pdev))
15461585 hpriv->flags |= AHCI_HFLAG_NO_DEVSLP;
drivers/ata/ahci_qoriq.c+13−3
@@ -46,11 +46,13 @@ · 45 unmodified lines
4646 #define LS1021A_AXICC_ADDR 0xC0
4747
4848 #define SATA_ECC_DISABLE 0x00020000
49+#define LS1046A_SATA_ECC_DIS 0x80000000
4950
5051 enum ahci_qoriq_type {
5152 AHCI_LS1021A,
5253 AHCI_LS1043A,
5354 AHCI_LS2080A,
55+ AHCI_LS1046A,
5456 };
5557
5658 struct ahci_qoriq_priv {
@@ -63,6 +65,7 @@ static const struct of_device_id ahci_qoriq_of_match[] = { · 6 unmodified lines
6365 { .compatible = "fsl,ls1021a-ahci", .data = (void *)AHCI_LS1021A},
6466 { .compatible = "fsl,ls1043a-ahci", .data = (void *)AHCI_LS1043A},
6567 { .compatible = "fsl,ls2080a-ahci", .data = (void *)AHCI_LS2080A},
68+ { .compatible = "fsl,ls1046a-ahci", .data = (void *)AHCI_LS1046A},
6669 {},
6770 };
6871 MODULE_DEVICE_TABLE(of, ahci_qoriq_of_match);
@@ -175,6 +178,13 @@ static int ahci_qoriq_phy_init(struct ahci_host_priv *hpriv) · 106 unmodified lines
175178 writel(AHCI_PORT_TRANS_CFG, reg_base + PORT_TRANS);
176179 writel(AHCI_PORT_AXICC_CFG, reg_base + PORT_AXICC);
177180 break;
181+
182+ case AHCI_LS1046A:
183+ writel(LS1046A_SATA_ECC_DIS, qpriv->ecc_addr);
184+ writel(AHCI_PORT_PHY_1_CFG, reg_base + PORT_PHY1);
185+ writel(AHCI_PORT_TRANS_CFG, reg_base + PORT_TRANS);
186+ writel(AHCI_PORT_AXICC_CFG, reg_base + PORT_AXICC);
187+ break;
178188 }
179189
180190 return 0;
@@ -204,9 +214,9 @@ static int ahci_qoriq_probe(struct platform_device *pdev) · 23 unmodified lines
204214
205215 qoriq_priv->type = (enum ahci_qoriq_type)of_id->data;
206216
207− if (qoriq_priv->type == AHCI_LS1021A) {
208− res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
209− "sata-ecc");
217+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
218+ "sata-ecc");
219+ if (res) {
210220 qoriq_priv->ecc_addr = devm_ioremap_resource(dev, res);
211221 if (IS_ERR(qoriq_priv->ecc_addr))
212222 return PTR_ERR(qoriq_priv->ecc_addr);
drivers/ata/libahci.c+1−0
@@ -140,6 +140,7 @@ EXPORT_SYMBOL_GPL(ahci_shost_attrs); · 139 unmodified lines
140140 struct device_attribute *ahci_sdev_attrs[] = {
141141 &dev_attr_sw_activity,
142142 &dev_attr_unload_heads,
143+ &dev_attr_ncq_prio_enable,
143144 NULL
144145 };
145146 EXPORT_SYMBOL_GPL(ahci_sdev_attrs);
drivers/ata/libata-core.c+34−1
@@ -739,6 +739,7 @@ u64 ata_tf_read_block(const struct ata_taskfile *tf, struct ata_device *dev) · 738 unmodified lines
739739 * @n_block: Number of blocks
740740 * @tf_flags: RW/FUA etc...
741741 * @tag: tag
742+ * @class: IO priority class
742743 *
743744 * LOCKING:
744745 * None.
@@ -753,7 +754,7 @@ u64 ata_tf_read_block(const struct ata_taskfile *tf, struct ata_device *dev) · 8 unmodified lines
753754 */
754755 int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev,
755756 u64 block, u32 n_block, unsigned int tf_flags,
756− unsigned int tag)
757+ unsigned int tag, int class)
757758 {
758759 tf->flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
759760 tf->flags |= tf_flags;
@@ -785,6 +786,12 @@ int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev, · 25 unmodified lines
785786 tf->device = ATA_LBA;
786787 if (tf->flags & ATA_TFLAG_FUA)
787788 tf->device |= 1 << 7;
789+
790+ if (dev->flags & ATA_DFLAG_NCQ_PRIO_ENABLE) {
791+ if (class == IOPRIO_CLASS_RT)
792+ tf->hob_nsect |= ATA_PRIO_HIGH <<
793+ ATA_SHIFT_PRIO;
794+ }
788795 } else if (dev->flags & ATA_DFLAG_LBA) {
789796 tf->flags |= ATA_TFLAG_LBA;
790797
@@ -2156,6 +2163,30 @@ static void ata_dev_config_ncq_non_data(struct ata_device *dev) · 1365 unmodified lines
21562163 }
21572164 }
21582165
2166+static void ata_dev_config_ncq_prio(struct ata_device *dev)
2167+{
2168+ struct ata_port *ap = dev->link->ap;
2169+ unsigned int err_mask;
2170+
2171+ err_mask = ata_read_log_page(dev,
2172+ ATA_LOG_SATA_ID_DEV_DATA,
2173+ ATA_LOG_SATA_SETTINGS,
2174+ ap->sector_buf,
2175+ 1);
2176+ if (err_mask) {
2177+ ata_dev_dbg(dev,
2178+ "failed to get Identify Device data, Emask 0x%x\n",
2179+ err_mask);
2180+ return;
2181+ }
2182+
2183+ if (ap->sector_buf[ATA_LOG_NCQ_PRIO_OFFSET] & BIT(3))
2184+ dev->flags |= ATA_DFLAG_NCQ_PRIO;
2185+ else
2186+ ata_dev_dbg(dev, "SATA page does not support priority\n");
2187+
2188+}
2189+
21592190 static int ata_dev_config_ncq(struct ata_device *dev,
21602191 char *desc, size_t desc_sz)
21612192 {
@@ -2205,6 +2236,8 @@ static int ata_dev_config_ncq(struct ata_device *dev, · 43 unmodified lines
22052236 ata_dev_config_ncq_send_recv(dev);
22062237 if (ata_id_has_ncq_non_data(dev->id))
22072238 ata_dev_config_ncq_non_data(dev);
2239+ if (ata_id_has_ncq_prio(dev->id))
2240+ ata_dev_config_ncq_prio(dev);
22082241 }
22092242
22102243 return 0;
drivers/ata/libata-scsi.c+79−1
@@ -50,6 +50,7 @@ · 49 unmodified lines
5050 #include <linux/uaccess.h>
5151 #include <linux/suspend.h>
5252 #include <asm/unaligned.h>
53+#include <linux/ioprio.h>
5354
5455 #include "libata.h"
5556 #include "libata-transport.h"
@@ -270,6 +271,79 @@ DEVICE_ATTR(unload_heads, S_IRUGO | S_IWUSR, · 214 unmodified lines
270271 ata_scsi_park_show, ata_scsi_park_store);
271272 EXPORT_SYMBOL_GPL(dev_attr_unload_heads);
272273
274+static ssize_t ata_ncq_prio_enable_show(struct device *device,
275+ struct device_attribute *attr, char *buf)
276+{
277+ struct scsi_device *sdev = to_scsi_device(device);
278+ struct ata_port *ap;
279+ struct ata_device *dev;
280+ bool ncq_prio_enable;
281+ int rc = 0;
282+
283+ ap = ata_shost_to_port(sdev->host);
284+
285+ spin_lock_irq(ap->lock);
286+ dev = ata_scsi_find_dev(ap, sdev);
287+ if (!dev) {
288+ rc = -ENODEV;
289+ goto unlock;
290+ }
291+
292+ ncq_prio_enable = dev->flags & ATA_DFLAG_NCQ_PRIO_ENABLE;
293+
294+unlock:
295+ spin_unlock_irq(ap->lock);
296+
297+ return rc ? rc : snprintf(buf, 20, "%u\n", ncq_prio_enable);
298+}
299+
300+static ssize_t ata_ncq_prio_enable_store(struct device *device,
301+ struct device_attribute *attr,
302+ const char *buf, size_t len)
303+{
304+ struct scsi_device *sdev = to_scsi_device(device);
305+ struct ata_port *ap;
306+ struct ata_device *dev;
307+ long int input;
308+ unsigned long flags;
309+ int rc;
310+
311+ rc = kstrtol(buf, 10, &input);
312+ if (rc)
313+ return rc;
314+ if ((input < 0) || (input > 1))
315+ return -EINVAL;
316+
317+ ap = ata_shost_to_port(sdev->host);
318+
319+ spin_lock_irqsave(ap->lock, flags);
320+ dev = ata_scsi_find_dev(ap, sdev);
321+ if (unlikely(!dev)) {
322+ rc = -ENODEV;
323+ goto unlock;
324+ }
325+
326+ if (input) {
327+ if (!(dev->flags & ATA_DFLAG_NCQ_PRIO)) {
328+ rc = -EOPNOTSUPP;
329+ goto unlock;
330+ }
331+
332+ dev->flags |= ATA_DFLAG_NCQ_PRIO_ENABLE;
333+ } else {
334+ dev->flags &= ~ATA_DFLAG_NCQ_PRIO_ENABLE;
335+ }
336+
337+unlock:
338+ spin_unlock_irqrestore(ap->lock, flags);
339+
340+ return rc ? rc : len;
341+}
342+
343+DEVICE_ATTR(ncq_prio_enable, S_IRUGO | S_IWUSR,
344+ ata_ncq_prio_enable_show, ata_ncq_prio_enable_store);
345+EXPORT_SYMBOL_GPL(dev_attr_ncq_prio_enable);
346+
273347 void ata_scsi_set_sense(struct ata_device *dev, struct scsi_cmnd *cmd,
274348 u8 sk, u8 asc, u8 ascq)
275349 {
@@ -401,6 +475,7 @@ EXPORT_SYMBOL_GPL(dev_attr_sw_activity); · 125 unmodified lines
401475
402476 struct device_attribute *ata_common_sdev_attrs[] = {
403477 &dev_attr_unload_heads,
478+ &dev_attr_ncq_prio_enable,
404479 NULL
405480 };
406481 EXPORT_SYMBOL_GPL(ata_common_sdev_attrs);
@@ -1756,6 +1831,8 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc) · 1349 unmodified lines
17561831 {
17571832 struct scsi_cmnd *scmd = qc->scsicmd;
17581833 const u8 *cdb = scmd->cmnd;
1834+ struct request *rq = scmd->request;
1835+ int class = IOPRIO_PRIO_CLASS(req_get_ioprio(rq));
17591836 unsigned int tf_flags = 0;
17601837 u64 block;
17611838 u32 n_block;
@@ -1822,7 +1899,8 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc) · 60 unmodified lines
18221899 qc->nbytes = n_block * scmd->device->sector_size;
18231900
18241901 rc = ata_build_rw_tf(&qc->tf, qc->dev, block, n_block, tf_flags,
1825− qc->tag);
1902+ qc->tag, class);
1903+
18261904 if (likely(rc == 0))
18271905 return 0;
18281906
drivers/ata/libata.h+1−1
@@ -66,7 +66,7 @@ extern u64 ata_tf_to_lba48(const struct ata_taskfile *tf); · 65 unmodified lines
6666 extern struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev, int tag);
6767 extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev,
6868 u64 block, u32 n_block, unsigned int tf_flags,
69− unsigned int tag);
69+ unsigned int tag, int class);
7070 extern u64 ata_tf_read_block(const struct ata_taskfile *tf,
7171 struct ata_device *dev);
7272 extern unsigned ata_exec_internal(struct ata_device *dev,
drivers/ata/pata_imx.c+57−25
@@ -11,19 +11,26 @@ · 10 unmodified lines
1111 *
1212 * TODO:
1313 * - dmaengine support
14− * - check if timing stuff needed
1514 */
16−#include <linux/kernel.h>
17−#include <linux/module.h>
18−#include <linux/blkdev.h>
19−#include <scsi/scsi_host.h>
15+
2016 #include <linux/ata.h>
17+#include <linux/clk.h>
2118 #include <linux/libata.h>
19+#include <linux/module.h>
2220 #include <linux/platform_device.h>
23−#include <linux/clk.h>
2421
2522 #define DRV_NAME "pata_imx"
2623
24+#define PATA_IMX_ATA_TIME_OFF 0x00
25+#define PATA_IMX_ATA_TIME_ON 0x01
26+#define PATA_IMX_ATA_TIME_1 0x02
27+#define PATA_IMX_ATA_TIME_2W 0x03
28+#define PATA_IMX_ATA_TIME_2R 0x04
29+#define PATA_IMX_ATA_TIME_AX 0x05
30+#define PATA_IMX_ATA_TIME_PIO_RDX 0x06
31+#define PATA_IMX_ATA_TIME_4 0x07
32+#define PATA_IMX_ATA_TIME_9 0x08
33+
2734 #define PATA_IMX_ATA_CONTROL 0x24
2835 #define PATA_IMX_ATA_CTRL_FIFO_RST_B (1<<7)
2936 #define PATA_IMX_ATA_CTRL_ATA_RST_B (1<<6)
@@ -33,6 +40,10 @@ · 3 unmodified lines
3340 #define PATA_IMX_DRIVE_DATA 0xA0
3441 #define PATA_IMX_DRIVE_CONTROL 0xD8
3542
43+static u32 pio_t4[] = { 30, 20, 15, 10, 10 };
44+static u32 pio_t9[] = { 20, 15, 10, 10, 10 };
45+static u32 pio_tA[] = { 35, 35, 35, 35, 35 };
46+
3647 struct pata_imx_priv {
3748 struct clk *clk;
3849 /* timings/interrupt/control regs */
@@ -40,28 +51,49 @@ struct pata_imx_priv { · 1 unmodified line
4051 u32 ata_ctl;
4152 };
4253
43−static int pata_imx_set_mode(struct ata_link *link, struct ata_device **unused)
54+static void pata_imx_set_timing(struct ata_device *adev,
55+ struct pata_imx_priv *priv)
56+{
57+ struct ata_timing timing;
58+ unsigned long clkrate;
59+ u32 T, mode;
60+
61+ clkrate = clk_get_rate(priv->clk);
62+
63+ if (adev->pio_mode < XFER_PIO_0 || adev->pio_mode > XFER_PIO_4 ||
64+ !clkrate)
65+ return;
66+
67+ T = 1000000000 / clkrate;
68+ ata_timing_compute(adev, adev->pio_mode, &timing, T * 1000, 0);
69+
70+ mode = adev->pio_mode - XFER_PIO_0;
71+
72+ writeb(3, priv->host_regs + PATA_IMX_ATA_TIME_OFF);
73+ writeb(3, priv->host_regs + PATA_IMX_ATA_TIME_ON);
74+ writeb(timing.setup, priv->host_regs + PATA_IMX_ATA_TIME_1);
75+ writeb(timing.act8b, priv->host_regs + PATA_IMX_ATA_TIME_2W);
76+ writeb(timing.act8b, priv->host_regs + PATA_IMX_ATA_TIME_2R);
77+ writeb(1, priv->host_regs + PATA_IMX_ATA_TIME_PIO_RDX);
78+
79+ writeb(pio_t4[mode] / T + 1, priv->host_regs + PATA_IMX_ATA_TIME_4);
80+ writeb(pio_t9[mode] / T + 1, priv->host_regs + PATA_IMX_ATA_TIME_9);
81+ writeb(pio_tA[mode] / T + 1, priv->host_regs + PATA_IMX_ATA_TIME_AX);
82+}
83+
84+static void pata_imx_set_piomode(struct ata_port *ap, struct ata_device *adev)
4485 {
45− struct ata_device *dev;
46− struct ata_port *ap = link->ap;
4786 struct pata_imx_priv *priv = ap->host->private_data;
4887 u32 val;
4988
50− ata_for_each_dev(dev, link, ENABLED) {
51− dev->pio_mode = dev->xfer_mode = XFER_PIO_0;
52− dev->xfer_shift = ATA_SHIFT_PIO;
53− dev->flags |= ATA_DFLAG_PIO;
54−
55− val = __raw_readl(priv->host_regs + PATA_IMX_ATA_CONTROL);
56− if (ata_pio_need_iordy(dev))
57− val |= PATA_IMX_ATA_CTRL_IORDY_EN;
58− else
59− val &= ~PATA_IMX_ATA_CTRL_IORDY_EN;
60− __raw_writel(val, priv->host_regs + PATA_IMX_ATA_CONTROL);
89+ pata_imx_set_timing(adev, priv);
6190
62− ata_dev_info(dev, "configured for PIO\n");
63− }
64− return 0;
91+ val = __raw_readl(priv->host_regs + PATA_IMX_ATA_CONTROL);
92+ if (ata_pio_need_iordy(adev))
93+ val |= PATA_IMX_ATA_CTRL_IORDY_EN;
94+ else
95+ val &= ~PATA_IMX_ATA_CTRL_IORDY_EN;
96+ __raw_writel(val, priv->host_regs + PATA_IMX_ATA_CONTROL);
6597 }
6698
6799 static struct scsi_host_template pata_imx_sht = {
@@ -72,7 +104,7 @@ static struct ata_port_operations pata_imx_port_ops = { · 4 unmodified lines
72104 .inherits = &ata_sff_port_ops,
73105 .sff_data_xfer = ata_sff_data_xfer_noirq,
74106 .cable_detect = ata_cable_unknown,
75− .set_mode = pata_imx_set_mode,
107+ .set_piomode = pata_imx_set_piomode,
76108 };
77109
78110 static void pata_imx_setup_port(struct ata_ioports *ioaddr)
@@ -128,7 +160,7 @@ static int pata_imx_probe(struct platform_device *pdev) · 49 unmodified lines
128160 ap = host->ports[0];
129161
130162 ap->ops = &pata_imx_port_ops;
131− ap->pio_mask = ATA_PIO0;
163+ ap->pio_mask = ATA_PIO4;
132164 ap->flags |= ATA_FLAG_SLAVE_POSS;
133165
134166 io_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
drivers/nvme/host/pci.c+0−3
@@ -2086,9 +2086,6 @@ static const struct pci_error_handlers nvme_err_handler = { · 2085 unmodified lines
20862086 .reset_notify = nvme_reset_notify,
20872087 };
20882088
2089−/* Move to pci_ids.h later */
2090−#define PCI_CLASS_STORAGE_EXPRESS 0x010802
2091−
20922089 static const struct pci_device_id nvme_id_table[] = {
20932090 { PCI_VDEVICE(INTEL, 0x0953),
20942091 .driver_data = NVME_QUIRK_STRIPE_SIZE |
include/linux/ahci-remap.h+28−0
@@ -0,0 +1,28 @@
1+#ifndef _LINUX_AHCI_REMAP_H
2+#define _LINUX_AHCI_REMAP_H
3+
4+#include <linux/sizes.h>
5+
6+#define AHCI_VSCAP 0xa4
7+#define AHCI_REMAP_CAP 0x800
8+
9+/* device class code */
10+#define AHCI_REMAP_N_DCC 0x880
11+
12+/* remap-device base relative to ahci-bar */
13+#define AHCI_REMAP_N_OFFSET SZ_16K
14+#define AHCI_REMAP_N_SIZE SZ_16K
15+
16+#define AHCI_MAX_REMAP 3
17+
18+static inline unsigned int ahci_remap_dcc(int i)
19+{
20+ return AHCI_REMAP_N_DCC + i * 0x80;
21+}
22+
23+static inline unsigned int ahci_remap_base(int i)
24+{
25+ return AHCI_REMAP_N_OFFSET + i * AHCI_REMAP_N_SIZE;
26+}
27+
28+#endif /* _LINUX_AHCI_REMAP_H */
include/linux/ata.h+6−0
@@ -348,6 +348,7 @@ enum { · 347 unmodified lines
348348 ATA_LOG_DEVSLP_DETO = 0x01,
349349 ATA_LOG_DEVSLP_VALID = 0x07,
350350 ATA_LOG_DEVSLP_VALID_MASK = 0x80,
351+ ATA_LOG_NCQ_PRIO_OFFSET = 0x09,
351352
352353 /* NCQ send and receive log */
353354 ATA_LOG_NCQ_SEND_RECV_SUBCMDS_OFFSET = 0x00,
@@ -940,6 +941,11 @@ static inline bool ata_id_has_ncq_non_data(const u16 *id) · 586 unmodified lines
940941 return id[ATA_ID_SATA_CAPABILITY_2] & BIT(5);
941942 }
942943
944+static inline bool ata_id_has_ncq_prio(const u16 *id)
945+{
946+ return id[ATA_ID_SATA_CAPABILITY] & BIT(12);
947+}
948+
943949 static inline bool ata_id_has_trim(const u16 *id)
944950 {
945951 if (ata_id_major_version(id) >= 7 &&
include/linux/blkdev.h+14−0
@@ -1058,6 +1058,20 @@ static inline unsigned int blk_rq_count_bios(struct request *rq) · 1057 unmodified lines
10581058 return nr_bios;
10591059 }
10601060
1061+/*
1062+ * blk_rq_set_prio - associate a request with prio from ioc
1063+ * @rq: request of interest
1064+ * @ioc: target iocontext
1065+ *
1066+ * Assocate request prio with ioc prio so request based drivers
1067+ * can leverage priority information.
1068+ */
1069+static inline void blk_rq_set_prio(struct request *rq, struct io_context *ioc)
1070+{
1071+ if (ioc)
1072+ rq->ioprio = ioc->ioprio;
1073+}
1074+
10611075 /*
10621076 * Request issue related functions.
10631077 */
include/linux/libata.h+5−0
@@ -166,6 +166,8 @@ enum { · 165 unmodified lines
166166 ATA_DFLAG_NO_UNLOAD = (1 << 17), /* device doesn't support unload */
167167 ATA_DFLAG_UNLOCK_HPA = (1 << 18), /* unlock HPA */
168168 ATA_DFLAG_NCQ_SEND_RECV = (1 << 19), /* device supports NCQ SEND and RECV */
169+ ATA_DFLAG_NCQ_PRIO = (1 << 20), /* device supports NCQ priority */
170+ ATA_DFLAG_NCQ_PRIO_ENABLE = (1 << 21), /* Priority cmds sent to dev */
169171 ATA_DFLAG_INIT_MASK = (1 << 24) - 1,
170172
171173 ATA_DFLAG_DETACH = (1 << 24),
@@ -342,7 +344,9 @@ enum { · 170 unmodified lines
342344 ATA_SHIFT_PIO = 0,
343345 ATA_SHIFT_MWDMA = ATA_SHIFT_PIO + ATA_NR_PIO_MODES,
344346 ATA_SHIFT_UDMA = ATA_SHIFT_MWDMA + ATA_NR_MWDMA_MODES,
347+ ATA_SHIFT_PRIO = 6,
345348
349+ ATA_PRIO_HIGH = 2,
346350 /* size of buffer to pad xfers ending on unaligned boundaries */
347351 ATA_DMA_PAD_SZ = 4,
348352
@@ -542,6 +546,7 @@ typedef void (*ata_postreset_fn_t)(struct ata_link *link, unsigned int *classes) · 193 unmodified lines
542546
543547 extern struct device_attribute dev_attr_link_power_management_policy;
544548 extern struct device_attribute dev_attr_unload_heads;
549+extern struct device_attribute dev_attr_ncq_prio_enable;
545550 extern struct device_attribute dev_attr_em_message_type;
546551 extern struct device_attribute dev_attr_em_message;
547552 extern struct device_attribute dev_attr_sw_activity;
include/linux/pci_ids.h+2−0
@@ -23,8 +23,10 @@ · 22 unmodified lines
2323 #define PCI_CLASS_STORAGE_SATA 0x0106
2424 #define PCI_CLASS_STORAGE_SATA_AHCI 0x010601
2525 #define PCI_CLASS_STORAGE_SAS 0x0107
26+#define PCI_CLASS_STORAGE_EXPRESS 0x010802
2627 #define PCI_CLASS_STORAGE_OTHER 0x0180
2728
29+
2830 #define PCI_BASE_CLASS_NETWORK 0x02
2931 #define PCI_CLASS_NETWORK_ETHERNET 0x0200
3032 #define PCI_CLASS_NETWORK_TOKEN_RING 0x0201