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: <0faa472c-d21d-46df-922b-264d7915f983@intel.com>
Date:   Mon, 11 Dec 2023 12:45:35 +0200
From:   Adrian Hunter <adrian.hunter@...el.com>
To:     Jyan Chou [周芷安] <jyanchou@...ltek.com>,
        "ulf.hansson@...aro.org" <ulf.hansson@...aro.org>,
        "jh80.chung@...sung.com" <jh80.chung@...sung.com>,
        "riteshh@...eaurora.org" <riteshh@...eaurora.org>,
        "robh+dt@...nel.org" <robh+dt@...nel.org>,
        "krzysztof.kozlowski+dt@...aro.org" 
        <krzysztof.kozlowski+dt@...aro.org>
Cc:     "conor+dt@...nel.org" <conor+dt@...nel.org>,
        "asutoshd@...eaurora.org" <asutoshd@...eaurora.org>,
        "p.zabel@...gutronix.de" <p.zabel@...gutronix.de>,
        "linux-mmc@...r.kernel.org" <linux-mmc@...r.kernel.org>,
        "devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "arnd@...db.de" <arnd@...db.de>,
        "briannorris@...omium.org" <briannorris@...omium.org>,
        "doug@...morgal.com" <doug@...morgal.com>,
        "tonyhuang.sunplus@...il.com" <tonyhuang.sunplus@...il.com>,
        "abel.vesa@...aro.org" <abel.vesa@...aro.org>,
        "william.qiu@...rfivetech.com" <william.qiu@...rfivetech.com>
Subject: Re: [PATCH v7][2/4] mmc: Add Synopsys DesignWare mmc cmdq host driver

On 11/12/23 12:37, Jyan Chou [周芷安] wrote:
> Hi Adrian,
> 
>>>>> +
>>>>> +static irqreturn_t dw_mci_cqe_interrupt(int irq, void *dev_id) {
>>>>> +     struct dw_mci *host = dev_id;
>>>>> +     struct mmc_host *mmc = host->slot->mmc;
>>>>> +     struct cqhci_host *cq_host = NULL;
>>>>> +     int cmd_error = 0, data_error = 0;
>>>>> +
>>>>> +     if (host->pdata && (host->pdata->caps2 & MMC_CAP2_CQE))
>>>>> +             cq_host = mmc->cqe_private;
>>>>> +
>>>>> +     dw_mci_get_int(host);
>>>>> +
>>>>> +     if (host->pdata && (host->pdata->caps2 & MMC_CAP2_CQE)) {
>>>>> +             if (!mmc->cqe_on && !cq_host->activated)
>>>>
>>>> Shouldn't really look at internals like mmc->cqe_on or cq_host->activated.
>>>> There are the cqhci_host_ops ->enable() and ->disable() callbacks to
>>>> keep track of whether cqhci is expecting interrupts.
>>>
>>> Does this means we need to use cqhci_host_ops ->enable() and
>>> ->disable() callbacks instead of mmc->cqe_on && !cq_host->activated?
>> Thanks.
>>
>> Yes.  ->enable() is always called before cqhci operation and ->disable() before
>> non-cqhci operation, so they can be used to determine if an interrupt is for
>> cqhci.
> 
> Thanks for your advice, and I got your point for calling cqhci_host_ops ->enable()
> 
> and ->disable() callbacks, but the reason we used " if (!mmc->cqe_on && !cq_host->activated) "
> 
> is that when sending command like cmd0, 1, 7, 8... in mmc_init_card before mmc_cmdq_enable,
> 
> we need to use interrupt in legacy mode, it is much better to write in this way?
> 
> +	events = mci_readw(host, NORMAL_INT_STAT_R);
> - 	if (host->pdata && (host->pdata->caps2 & MMC_CAP2_CQE)) {
> - 		if (!mmc->cqe_on && !cq_host->activated)
> +	if (mmc->caps2 & MMC_CAP2_CQE) {
> +		if (!(events & CQE_EVENT))
> 			dw_mci_clr_signal_int(host);
> 
> Using CQE_EVENT to determine whether Command Queue enable or not.

Unless you expect CQ interrupts before cqhci_host_ops ->enable()
is called, then you know it is legacy mode.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ