From: Sasha Levin Date: Wed, 2 Oct 2019 01:08:44 +0000 (-0400) Subject: fixes for 4.19 X-Git-Tag: v4.4.195~53 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3842efa45cf2bf6767e592543925809d6316bd16;p=thirdparty%2Fkernel%2Fstable-queue.git fixes for 4.19 Signed-off-by: Sasha Levin --- diff --git a/queue-4.19/alsa-hda-realtek-pci-quirk-for-medion-e4254.patch b/queue-4.19/alsa-hda-realtek-pci-quirk-for-medion-e4254.patch new file mode 100644 index 00000000000..748ad1a1715 --- /dev/null +++ b/queue-4.19/alsa-hda-realtek-pci-quirk-for-medion-e4254.patch @@ -0,0 +1,84 @@ +From f1d6f591f4f898c0cf2cbf0ba6cc86d991749309 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 15 Sep 2019 16:57:28 +0200 +Subject: ALSA: hda/realtek - PCI quirk for Medion E4254 + +From: Jan-Marek Glogowski + +[ Upstream commit bd9c10bc663dd2eaac8fe39dad0f18cd21527446 ] + +The laptop has a combined jack to attach headsets on the right. +The BIOS encodes them as two different colored jacks at the front, +but otherwise it seems to be configured ok. But any adaption of +the pins config on its own doesn't fix the jack detection to work +in Linux. Still Windows works correct. + +This is somehow fixed by chaining ALC256_FIXUP_ASUS_HEADSET_MODE, +which seems to register the microphone jack as a headset part and +also results in fixing jack sensing, visible in dmesg as: + +-snd_hda_codec_realtek hdaudioC0D0: Mic=0x19 ++snd_hda_codec_realtek hdaudioC0D0: Headset Mic=0x19 + +[ Actually the essential change is the location of the jack; the + driver created "Front Mic Jack" without the matching volume / mute + control element due to its jack location, which confused PA. + -- tiwai ] + +Signed-off-by: Jan-Marek Glogowski +Cc: +Link: https://lore.kernel.org/r/8f4f9b20-0aeb-f8f1-c02f-fd53c09679f1@fbihome.de +Signed-off-by: Takashi Iwai +Signed-off-by: Sasha Levin +--- + sound/pci/hda/patch_realtek.c | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index e791379439be0..e1b08d6f2a519 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -5679,6 +5679,7 @@ enum { + ALC256_FIXUP_ASUS_MIC_NO_PRESENCE, + ALC299_FIXUP_PREDATOR_SPK, + ALC294_FIXUP_ASUS_INTSPK_HEADSET_MIC, ++ ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, + }; + + static const struct hda_fixup alc269_fixups[] = { +@@ -6717,6 +6718,16 @@ static const struct hda_fixup alc269_fixups[] = { + .chained = true, + .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC + }, ++ [ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = { ++ .type = HDA_FIXUP_PINS, ++ .v.pins = (const struct hda_pintbl[]) { ++ { 0x19, 0x04a11040 }, ++ { 0x21, 0x04211020 }, ++ { } ++ }, ++ .chained = true, ++ .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE ++ }, + }; + + static const struct snd_pci_quirk alc269_fixup_tbl[] = { +@@ -6980,6 +6991,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD), + SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MBXP", ALC256_FIXUP_HUAWEI_MBXP_PINS), + SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */ ++ SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE), + + #if 0 + /* Below is a quirk table taken from the old code. +@@ -7144,6 +7156,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = { + {.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"}, + {.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"}, + {.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"}, ++ {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"}, + {} + }; + #define ALC225_STANDARD_PINS \ +-- +2.20.1 + diff --git a/queue-4.19/blk-mq-add-callback-of-.cleanup_rq.patch b/queue-4.19/blk-mq-add-callback-of-.cleanup_rq.patch new file mode 100644 index 00000000000..1d4d8b58edf --- /dev/null +++ b/queue-4.19/blk-mq-add-callback-of-.cleanup_rq.patch @@ -0,0 +1,98 @@ +From c0577eb0c0dca54a5696dfe5a19a5a28501d0fc7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 25 Jul 2019 10:04:59 +0800 +Subject: blk-mq: add callback of .cleanup_rq + +From: Ming Lei + +[ Upstream commit 226b4fc75c78f9c497c5182d939101b260cfb9f3 ] + +SCSI maintains its own driver private data hooked off of each SCSI +request, and the pridate data won't be freed after scsi_queue_rq() +returns BLK_STS_RESOURCE or BLK_STS_DEV_RESOURCE. An upper layer driver +(e.g. dm-rq) may need to retry these SCSI requests, before SCSI has +fully dispatched them, due to a lower level SCSI driver's resource +limitation identified in scsi_queue_rq(). Currently SCSI's per-request +private data is leaked when the upper layer driver (dm-rq) frees and +then retries these requests in response to BLK_STS_RESOURCE or +BLK_STS_DEV_RESOURCE returns from scsi_queue_rq(). + +This usecase is so specialized that it doesn't warrant training an +existing blk-mq interface (e.g. blk_mq_free_request) to allow SCSI to +account for freeing its driver private data -- doing so would add an +extra branch for handling a special case that all other consumers of +SCSI (and blk-mq) won't ever need to worry about. + +So the most pragmatic way forward is to delegate freeing SCSI driver +private data to the upper layer driver (dm-rq). Do so by adding +new .cleanup_rq callback and calling a new blk_mq_cleanup_rq() method +from dm-rq. A following commit will implement the .cleanup_rq() hook +in scsi_mq_ops. + +Cc: Ewan D. Milne +Cc: Bart Van Assche +Cc: Hannes Reinecke +Cc: Christoph Hellwig +Cc: Mike Snitzer +Cc: dm-devel@redhat.com +Cc: +Fixes: 396eaf21ee17 ("blk-mq: improve DM's blk-mq IO merging via blk_insert_cloned_request feedback") +Signed-off-by: Ming Lei +Signed-off-by: Jens Axboe +Signed-off-by: Sasha Levin +--- + drivers/md/dm-rq.c | 1 + + include/linux/blk-mq.h | 13 +++++++++++++ + 2 files changed, 14 insertions(+) + +diff --git a/drivers/md/dm-rq.c b/drivers/md/dm-rq.c +index 17c6a73c536c6..4d36373e1c0f0 100644 +--- a/drivers/md/dm-rq.c ++++ b/drivers/md/dm-rq.c +@@ -505,6 +505,7 @@ static int map_request(struct dm_rq_target_io *tio) + ret = dm_dispatch_clone_request(clone, rq); + if (ret == BLK_STS_RESOURCE || ret == BLK_STS_DEV_RESOURCE) { + blk_rq_unprep_clone(clone); ++ blk_mq_cleanup_rq(clone); + tio->ti->type->release_clone_rq(clone, &tio->info); + tio->clone = NULL; + if (!rq->q->mq_ops) +diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h +index 1da59c16f6377..2885dce1ad496 100644 +--- a/include/linux/blk-mq.h ++++ b/include/linux/blk-mq.h +@@ -114,6 +114,7 @@ typedef void (busy_iter_fn)(struct blk_mq_hw_ctx *, struct request *, void *, + typedef void (busy_tag_iter_fn)(struct request *, void *, bool); + typedef int (poll_fn)(struct blk_mq_hw_ctx *, unsigned int); + typedef int (map_queues_fn)(struct blk_mq_tag_set *set); ++typedef void (cleanup_rq_fn)(struct request *); + + + struct blk_mq_ops { +@@ -165,6 +166,12 @@ struct blk_mq_ops { + /* Called from inside blk_get_request() */ + void (*initialize_rq_fn)(struct request *rq); + ++ /* ++ * Called before freeing one request which isn't completed yet, ++ * and usually for freeing the driver private data ++ */ ++ cleanup_rq_fn *cleanup_rq; ++ + map_queues_fn *map_queues; + + #ifdef CONFIG_BLK_DEBUG_FS +@@ -324,4 +331,10 @@ static inline void *blk_mq_rq_to_pdu(struct request *rq) + for ((i) = 0; (i) < (hctx)->nr_ctx && \ + ({ ctx = (hctx)->ctxs[(i)]; 1; }); (i)++) + ++static inline void blk_mq_cleanup_rq(struct request *rq) ++{ ++ if (rq->q->mq_ops->cleanup_rq) ++ rq->q->mq_ops->cleanup_rq(rq); ++} ++ + #endif +-- +2.20.1 + diff --git a/queue-4.19/scsi-implement-.cleanup_rq-callback.patch b/queue-4.19/scsi-implement-.cleanup_rq-callback.patch new file mode 100644 index 00000000000..b329198b3d5 --- /dev/null +++ b/queue-4.19/scsi-implement-.cleanup_rq-callback.patch @@ -0,0 +1,62 @@ +From 01e310bf9e127da94760b49770d282b173147cf1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 25 Jul 2019 10:05:00 +0800 +Subject: scsi: implement .cleanup_rq callback + +From: Ming Lei + +[ Upstream commit b7e9e1fb7a9227be34ad4a5e778022c3164494cf ] + +Implement .cleanup_rq() callback for freeing driver private part +of the request. Then we can avoid to leak this part if the request isn't +completed by SCSI, and freed by blk-mq or upper layer(such as dm-rq) finally. + +Cc: Ewan D. Milne +Cc: Bart Van Assche +Cc: Hannes Reinecke +Cc: Christoph Hellwig +Cc: Mike Snitzer +Cc: dm-devel@redhat.com +Cc: +Fixes: 396eaf21ee17 ("blk-mq: improve DM's blk-mq IO merging via blk_insert_cloned_request feedback") +Signed-off-by: Ming Lei +Signed-off-by: Jens Axboe +Signed-off-by: Sasha Levin +--- + drivers/scsi/scsi_lib.c | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c +index 75b926e700766..abfcc2f924ce8 100644 +--- a/drivers/scsi/scsi_lib.c ++++ b/drivers/scsi/scsi_lib.c +@@ -1252,6 +1252,18 @@ static void scsi_initialize_rq(struct request *rq) + cmd->retries = 0; + } + ++/* ++ * Only called when the request isn't completed by SCSI, and not freed by ++ * SCSI ++ */ ++static void scsi_cleanup_rq(struct request *rq) ++{ ++ if (rq->rq_flags & RQF_DONTPREP) { ++ scsi_mq_uninit_cmd(blk_mq_rq_to_pdu(rq)); ++ rq->rq_flags &= ~RQF_DONTPREP; ++ } ++} ++ + /* Add a command to the list used by the aacraid and dpt_i2o drivers */ + void scsi_add_cmd_to_list(struct scsi_cmnd *cmd) + { +@@ -2339,6 +2351,7 @@ static const struct blk_mq_ops scsi_mq_ops = { + .init_request = scsi_mq_init_request, + .exit_request = scsi_mq_exit_request, + .initialize_rq_fn = scsi_initialize_rq, ++ .cleanup_rq = scsi_cleanup_rq, + .map_queues = scsi_map_queues, + }; + +-- +2.20.1 + diff --git a/queue-4.19/series b/queue-4.19/series index d3620cf7403..2888902c5a3 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -157,3 +157,6 @@ ib-hfi1-define-variables-as-unsigned-long-to-fix-kasan-warning.patch randstruct-check-member-structs-in-is_pure_ops_struct.patch revert-ceph-use-ceph_evict_inode-to-cleanup-inode-s-.patch ceph-use-ceph_evict_inode-to-cleanup-inode-s-resourc.patch +alsa-hda-realtek-pci-quirk-for-medion-e4254.patch +blk-mq-add-callback-of-.cleanup_rq.patch +scsi-implement-.cleanup_rq-callback.patch