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] [thread-next>] [day] [month] [year] [list]
Message-ID: <6bf86b26-391a-0699-1818-d070357b9ddc@intel.com>
Date:   Wed, 16 Sep 2020 13:00:35 +0300
From:   Adrian Hunter <adrian.hunter@...el.com>
To:     AKASHI Takahiro <takahiro.akashi@...aro.org>,
        Ben Chuang <benchuanggli@...il.com>, ulf.hansson@...aro.org,
        linux-mmc@...r.kernel.org, linux-kernel@...r.kernel.org,
        ben.chuang@...esyslogic.com.tw, greg.tu@...esyslogic.com.tw
Subject: Re: [RFC PATCH V3 12/21] mmc: sdhci: UHS-II support, add hooks for
 additional operations

On 16/09/20 11:05 am, AKASHI Takahiro wrote:
> Adrian,
> 
> Your comments are scattered over various functions, and so
> I would like to address them in separate replies.
> 
> First, I'd like to discuss sdhci_[add|remove]_host().
> 
> On Fri, Aug 21, 2020 at 05:08:32PM +0300, Adrian Hunter wrote:
>> On 10/07/20 2:10 pm, Ben Chuang wrote:
>>> From: Ben Chuang <ben.chuang@...esyslogic.com.tw>
>>>
>>> In this commit, UHS-II related operations will be called via a function
>>> pointer array, sdhci_uhs2_ops, in order to make UHS-II support as
>>> a kernel module.
>>> This array will be initialized only if CONFIG_MMC_SDHCI_UHS2 is enabled
>>> and when the UHS-II module is loaded. Otherwise, all the functions
>>> stay void.
>>>
>>> Signed-off-by: Ben Chuang <ben.chuang@...esyslogic.com.tw>
>>> Signed-off-by: AKASHI Takahiro <takahiro.akashi@...aro.org>
>>> ---
> 
>  (snip)
> 
>>>  		if (intmask & (SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE)) {
>>>  			u32 present = sdhci_readl(host, SDHCI_PRESENT_STATE) &
>>>  				      SDHCI_CARD_PRESENT;
>>> @@ -4717,6 +4812,14 @@ int sdhci_setup_host(struct sdhci_host *host)
>>>  		/* This may alter mmc->*_blk_* parameters */
>>>  		sdhci_allocate_bounce_buffer(host);
>>>  
>>> +	if (IS_ENABLED(CONFIG_MMC_SDHCI_UHS2) &&
>>> +	    host->version >= SDHCI_SPEC_400 &&
>>> +	    sdhci_uhs2_ops.add_host) {
>>> +		ret = sdhci_uhs2_ops.add_host(host, host->caps1);
>>> +		if (ret)
>>> +			goto unreg;
>>> +	}
>>> +
>>
>> I think you should look at creating uhs2_add_host() instead
>>
>>>  	return 0;
>>>  
>>>  unreg:
>>> @@ -4738,6 +4841,8 @@ void sdhci_cleanup_host(struct sdhci_host *host)
>>>  {
>>>  	struct mmc_host *mmc = host->mmc;
>>>  
>>> +	/* FIXME: Do we have to do some cleanup for UHS2 here? */
>>> +
>>>  	if (!IS_ERR(mmc->supply.vqmmc))
>>>  		regulator_disable(mmc->supply.vqmmc);
>>>  
>>> @@ -4766,6 +4871,14 @@ int __sdhci_add_host(struct sdhci_host *host)
>>>  		mmc->cqe_ops = NULL;
>>>  	}
>>>  
>>> +	if ((mmc->caps & MMC_CAP_UHS2) && !host->v4_mode) {
>>> +		/* host doesn't want to enable UHS2 support */
>>> +		mmc->caps &= ~MMC_CAP_UHS2;
>>> +		mmc->flags &= ~MMC_UHS2_SUPPORT;
>>> +
>>> +		/* FIXME: Do we have to do some cleanup here? */
>>> +	}
>>> +
>>>  	host->complete_wq = alloc_workqueue("sdhci", flags, 0);
>>>  	if (!host->complete_wq)
>>>  		return -ENOMEM;
>>> @@ -4812,6 +4925,9 @@ int __sdhci_add_host(struct sdhci_host *host)
>>>  unled:
>>>  	sdhci_led_unregister(host);
>>>  unirq:
>>> +	if (IS_ENABLED(CONFIG_MMC_SDHCI_UHS2) &&
>>> +	    sdhci_uhs2_ops.remove_host)
>>> +		sdhci_uhs2_ops.remove_host(host, 0);
>>>  	sdhci_do_reset(host, SDHCI_RESET_ALL);
>>>  	sdhci_writel(host, 0, SDHCI_INT_ENABLE);
>>>  	sdhci_writel(host, 0, SDHCI_SIGNAL_ENABLE);
>>> @@ -4869,6 +4985,10 @@ void sdhci_remove_host(struct sdhci_host *host, int dead)
>>>  
>>>  	sdhci_led_unregister(host);
>>>  
>>> +	if (IS_ENABLED(CONFIG_MMC_SDHCI_UHS2) &&
>>> +	    sdhci_uhs2_ops.remove_host)
>>> +		sdhci_uhs2_ops.remove_host(host, dead);
>>> +
>>
>> I think you should look at creating uhs2_remove_host() instead
> 
> You suggest that we will have separate sdhci_uhs2_[add|remove]_host(),
> but I don't think it's always convenient.
> 
> UHS-II capable host will be set to call sdhci_uhs2_add_host() explicitly,
> but we can't do that in case of pci and pltfm based drivers as they utilize
> common helper functions, sdhci_pci_probe() and sdhci_pltfm_register(),
> respectively.

sdhci-pci has an add_host op

sdhci_pltfm_init can be used instead of sdhci_pltfm_register


> Therefore, we inevitably have to call sdhci_uhs2_add_host() there.
> 
> If so, why should we distinguish sdhci_uhs2_add_host from sdhci_uhs_add_host?
> I don't see any good reason.
> Moreover, as a result, there exists a mixed usage of sdhci_ interfaces
> and sdhci_uhs2_ interfaces in sdhci-pci-core.c and sdhci-pltfm.c.
> 
> It sounds odd to me.

It is already done that way for cqhci.

> 
> -Takahiro Akashi
> 
> 
>>
>>>  	if (!dead)
>>>  		sdhci_do_reset(host, SDHCI_RESET_ALL);
>>>  
>>>
>>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ