lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAPDyKFrkLQaFp_L0uZzB_KWnNkehg8ECK4cnf8o1yGCB9UZkBQ@mail.gmail.com>
Date:   Tue, 23 Nov 2021 17:14:24 +0100
From:   Ulf Hansson <ulf.hansson@...aro.org>
To:     Wojciech Bartczak <wbartczak@...vell.com>
Cc:     linux-mmc@...r.kernel.org, rric@...nel.org, beanhuo@...ron.com,
        tanxiaofei@...wei.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mmc: cavium: Ensure proper mapping between request and interrupt

On Mon, 15 Nov 2021 at 17:04, Wojciech Bartczak <wbartczak@...vell.com> wrote:
>
> The MMC block in octeontx2 uses architecture, where data lines are
> shared between up to three supported cards. To keep the track of the
> request hardware reports bus_id for the command complete interrupt.
> At the same time the driver keeps information about the request on the
> fly. This change combines these information to ensure proper mapping
> between the request and the response.
>
> Signed-off-by: Wojciech Bartczak <wbartczak@...vell.com>
> ---
>  drivers/mmc/host/cavium.c | 19 ++++++++++++++++++-
>  1 file changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/cavium.c b/drivers/mmc/host/cavium.c
> index 95a41983c6c0..24ea03f5a7c0 100644
> --- a/drivers/mmc/host/cavium.c
> +++ b/drivers/mmc/host/cavium.c
> @@ -438,6 +438,8 @@ irqreturn_t cvm_mmc_interrupt(int irq, void *dev_id)
>         struct mmc_request *req;
>         u64 emm_int, rsp_sts;
>         bool host_done;
> +       struct cvm_mmc_slot *slot;
> +       int bus_id;
>
>         if (host->need_irq_handler_lock)
>                 spin_lock(&host->irq_handler_lock);
> @@ -455,7 +457,19 @@ irqreturn_t cvm_mmc_interrupt(int irq, void *dev_id)
>         if (!req)
>                 goto out;
>
> +       slot = mmc_priv(req->host);
> +
> +       /* Get response */
>         rsp_sts = readq(host->base + MIO_EMM_RSP_STS(host));
> +       /* Map request to cvm_mmc_slot */
> +       bus_id = FIELD_GET(MIO_EMM_RSP_STS_BUS_ID, rsp_sts);
> +       if (bus_id != slot->bus_id) {
> +               dev_err(mmc_classdev(slot->mmc),
> +                       "Remapping, request for slot %d, interrupt for %d!\n",
> +                       slot->bus_id, bus_id);
> +               slot = host->slot[bus_id];
> +       }
> +
>         /*
>          * dma_val set means DMA is still in progress. Don't touch
>          * the request and wait for the interrupt indicating that
> @@ -493,8 +507,9 @@ irqreturn_t cvm_mmc_interrupt(int irq, void *dev_id)
>             (rsp_sts & MIO_EMM_RSP_STS_DMA_PEND))
>                 cleanup_dma(host, rsp_sts);
>
> +       if (mrq->done)
> +               mrq->done(mrq);
>         host->current_req = NULL;
> -       req->done(req);

This looks unrelated, please drop this from @subject patch.

>
>  no_req_done:
>         if (host->dmar_fixup_done)
> @@ -669,6 +684,7 @@ static void cvm_mmc_dma_request(struct mmc_host *mmc,
>                 set_wdog(slot, data->timeout_ns);
>
>         WARN_ON(host->current_req);
> +       mrq->host = mmc;

Please, no. We don't want the host driver to update the mrq->host. If
that should be done, which is kind of questionable to me, that should
be managed by the core layer.

In this particular case, an option could be to store the bus-id that
corresponds to the slot for the request that is about to be started.
Along the lines of how we store host->current_req, below.

>         host->current_req = mrq;
>
>         emm_dma = prepare_ext_dma(mmc, mrq);
> @@ -776,6 +792,7 @@ static void cvm_mmc_request(struct mmc_host *mmc, struct mmc_request *mrq)
>         mods = cvm_mmc_get_cr_mods(cmd);
>
>         WARN_ON(host->current_req);
> +       mrq->host = mmc;
>         host->current_req = mrq;
>
>         if (cmd->data) {

Kind regards
Uffe

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ