Re: [PATCH v2] pci: quirks: Disable native PCIe hotplug on MSI Claw A8 root bridge
From: Derek John Clark
Date: Wed Aug 12 2026 - 16:14:53 EST
On Wed, Aug 12, 2026 at 11:13 AM Lukas Wunner <lukas@xxxxxxxxx> wrote:
>
> On Tue, Aug 11, 2026 at 10:59:09AM +0200, Lukas Wunner wrote:
> > So the completely untested patch below might be an upstreamable approach.
>
> Sorry, I was OOO for a day and sent out the patch without compile-testing
> right before hitting the road. I'm back now and it turns out that
> an #include statement was mising. Rectified patch below.
>
No problem. Thanks for catching it after. I only got around to testing
today. It works well.
Tested-by: Derek J. Clark <derekjohn.clark@xxxxxxxxx>
Thanks,
Derek
> -- >8 --
>
> diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
> index 0274e8d07660..1a82233a30d0 100644
> --- a/drivers/mmc/core/block.c
> +++ b/drivers/mmc/core/block.c
> @@ -2978,8 +2978,11 @@ static int mmc_blk_alloc_parts(struct mmc_card *card, struct mmc_blk_data *md)
> return 0;
> }
>
> -static void mmc_blk_remove_req(struct mmc_blk_data *md)
> +static void mmc_blk_remove_req(struct mmc_card *card, struct mmc_blk_data *md)
> {
> + if (mmc_card_removed(card))
> + blk_mark_disk_dead(md->disk);
> +
> /*
> * Flush remaining requests and free queues. It is freeing the queue
> * that stops new requests from being accepted.
> @@ -3006,7 +3009,7 @@ static void mmc_blk_remove_parts(struct mmc_card *card,
> list_for_each_safe(pos, q, &md->part) {
> part_md = list_entry(pos, struct mmc_blk_data, part);
> list_del(pos);
> - mmc_blk_remove_req(part_md);
> + mmc_blk_remove_req(card, part_md);
> }
> }
>
> @@ -3252,7 +3255,7 @@ static int mmc_blk_probe(struct mmc_card *card)
>
> out:
> mmc_blk_remove_parts(card, md);
> - mmc_blk_remove_req(md);
> + mmc_blk_remove_req(card, md);
> out_free:
> destroy_workqueue(card->complete_wq);
> return ret;
> @@ -3273,7 +3276,7 @@ static void mmc_blk_remove(struct mmc_card *card)
> if (!mmc_card_sd_combo(card))
> pm_runtime_disable(&card->dev);
> pm_runtime_put_noidle(&card->dev);
> - mmc_blk_remove_req(md);
> + mmc_blk_remove_req(card, md);
> destroy_workqueue(card->complete_wq);
> }
>
> diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
> index b7ce3137d452..2625d918081b 100644
> --- a/drivers/mmc/core/host.c
> +++ b/drivers/mmc/core/host.c
> @@ -22,6 +22,7 @@
> #include <linux/mmc/card.h>
> #include <linux/mmc/slot-gpio.h>
>
> +#include "card.h"
> #include "core.h"
> #include "crypto.h"
> #include "host.h"
> @@ -703,3 +704,17 @@ void mmc_free_host(struct mmc_host *host)
> }
>
> EXPORT_SYMBOL(mmc_free_host);
> +
> +/**
> + * mmc_host_set_removed - declare host removed
> + * @host: mmc host
> + *
> + * Declare the host (and any inserted card) removed and inaccessible.
> + */
> +void mmc_host_set_removed(struct mmc_host *host)
> +{
> + if (host->card)
> + mmc_card_set_removed(host->card);
> +}
> +
> +EXPORT_SYMBOL(mmc_host_set_removed);
> diff --git a/drivers/mmc/host/rtsx_pci_sdmmc.c b/drivers/mmc/host/rtsx_pci_sdmmc.c
> index 8dfbc62f165b..3f97659fba7c 100644
> --- a/drivers/mmc/host/rtsx_pci_sdmmc.c
> +++ b/drivers/mmc/host/rtsx_pci_sdmmc.c
> @@ -1511,6 +1511,9 @@ static void rtsx_pci_sdmmc_drv_remove(struct platform_device *pdev)
> pcr->slots[RTSX_SD_CARD].card_event = NULL;
> mmc = host->mmc;
>
> + if (pci_dev_is_disconnected(pcr->pci))
> + mmc_host_set_removed(mmc);
> +
> cancel_work_sync(&host->work);
>
> mutex_lock(&host->host_mutex);
> diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
> index ba84f02c2a10..a2403062d770 100644
> --- a/include/linux/mmc/host.h
> +++ b/include/linux/mmc/host.h
> @@ -588,6 +588,7 @@ struct mmc_host *devm_mmc_alloc_host(struct device *dev, int extra);
> int mmc_add_host(struct mmc_host *);
> void mmc_remove_host(struct mmc_host *);
> void mmc_free_host(struct mmc_host *);
> +void mmc_host_set_removed(struct mmc_host *host);
> void mmc_of_parse_clk_phase(struct device *dev,
> struct mmc_clk_phase_map *map);
> int mmc_of_parse(struct mmc_host *host);