aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/oxnas/patches-5.10/999-libata-hacks.patch
diff options
context:
space:
mode:
authorDaniel Golle <daniel@makrotopia.org>2021-02-18 17:59:12 +0000
committerDaniel Golle <daniel@makrotopia.org>2021-02-25 16:39:55 +0000
commit45c0e0ee419f678cf995127cef38093b974727d6 (patch)
treee020a124176098670cb9300f53d2b0376934f20b /target/linux/oxnas/patches-5.10/999-libata-hacks.patch
parentdc68af4a1312775f3aeade7c46786858725cfabe (diff)
downloadupstream-45c0e0ee419f678cf995127cef38093b974727d6.tar.gz
upstream-45c0e0ee419f678cf995127cef38093b974727d6.tar.bz2
upstream-45c0e0ee419f678cf995127cef38093b974727d6.zip
oxnas: add experimental support for Linux 5.10
PCIe still reports link-down for some reason, RAID fails to assemble despite SATA looking good (maybe a generic problem with RAID?) Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Diffstat (limited to 'target/linux/oxnas/patches-5.10/999-libata-hacks.patch')
-rw-r--r--target/linux/oxnas/patches-5.10/999-libata-hacks.patch57
1 files changed, 57 insertions, 0 deletions
diff --git a/target/linux/oxnas/patches-5.10/999-libata-hacks.patch b/target/linux/oxnas/patches-5.10/999-libata-hacks.patch
new file mode 100644
index 0000000000..b02c506e9f
--- /dev/null
+++ b/target/linux/oxnas/patches-5.10/999-libata-hacks.patch
@@ -0,0 +1,57 @@
+--- a/drivers/ata/libata-core.c
++++ b/drivers/ata/libata-core.c
+@@ -1528,6 +1528,14 @@ unsigned ata_exec_internal_sg(struct ata
+ return AC_ERR_SYSTEM;
+ }
+
++ if (ap->ops->acquire_hw && !ap->ops->acquire_hw(ap, 0, 0)) {
++ spin_unlock_irqrestore(ap->lock, flags);
++ if (!ap->ops->acquire_hw(ap, 1, (2*HZ))) {
++ return AC_ERR_TIMEOUT;
++ }
++ spin_lock_irqsave(ap->lock, flags);
++ }
++
+ /* initialize internal qc */
+ qc = __ata_qc_from_tag(ap, ATA_TAG_INTERNAL);
+
+@@ -4520,6 +4528,9 @@ struct ata_queued_cmd *ata_qc_new_init(s
+ if (unlikely(ap->pflags & ATA_PFLAG_FROZEN))
+ return NULL;
+
++ if (ap->ops->qc_new && ap->ops->qc_new(ap))
++ return NULL;
++
+ /* libsas case */
+ if (ap->flags & ATA_FLAG_SAS_HOST) {
+ tag = ata_sas_allocate_tag(ap);
+@@ -4565,6 +4576,8 @@ void ata_qc_free(struct ata_queued_cmd *
+ qc->tag = ATA_TAG_POISON;
+ if (ap->flags & ATA_FLAG_SAS_HOST)
+ ata_sas_free_tag(tag, ap);
++ if (ap->ops->qc_free)
++ ap->ops->qc_free(qc);
+ }
+ }
+
+--- a/include/linux/libata.h
++++ b/include/linux/libata.h
+@@ -911,6 +911,8 @@ struct ata_port_operations {
+ enum ata_completion_errors (*qc_prep)(struct ata_queued_cmd *qc);
+ unsigned int (*qc_issue)(struct ata_queued_cmd *qc);
+ bool (*qc_fill_rtf)(struct ata_queued_cmd *qc);
++ int (*qc_new)(struct ata_port *ap);
++ void (*qc_free)(struct ata_queued_cmd *qc);
+
+ /*
+ * Configuration and exception handling
+@@ -1001,6 +1003,9 @@ struct ata_port_operations {
+ void (*phy_reset)(struct ata_port *ap);
+ void (*eng_timeout)(struct ata_port *ap);
+
++ int (*acquire_hw)(struct ata_port *ap, int may_sleep,
++ int timeout_jiffies);
++
+ /*
+ * ->inherits must be the last field and all the preceding
+ * fields must be pointers.