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]
Date:   Wed, 16 Jun 2021 17:30:49 +0530
From:   Sanjay R Mehta <sanmehta@....com>
To:     Vinod Koul <vkoul@...nel.org>
Cc:     Greg KH <gregkh@...uxfoundation.org>,
        Sanjay R Mehta <Sanju.Mehta@....com>,
        dan.j.williams@...el.com, Thomas.Lendacky@....com,
        Shyam-sundar.S-k@....com, Nehal-bakulchandra.Shah@....com,
        robh@...nel.org, mchehab+samsung@...nel.org, davem@...emloft.net,
        linux-kernel@...r.kernel.org, dmaengine@...r.kernel.org
Subject: Re: [PATCH v9 1/3] dmaengine: ptdma: Initial driver for the AMD PTDMA



On 6/16/2021 1:22 PM, Vinod Koul wrote:
> [CAUTION: External Email]
> 
> On 16-06-21, 12:27, Sanjay R Mehta wrote:
>>
>>
>> On 6/16/2021 11:46 AM, Greg KH wrote:
>>> [CAUTION: External Email]
>>>
>>> On Wed, Jun 16, 2021 at 10:24:52AM +0530, Sanjay R Mehta wrote:
>>>>
>>>>
>>>> On 6/16/2021 9:45 AM, Vinod Koul wrote:
>>>>> [CAUTION: External Email]
>>>>>
>>>>> On 15-06-21, 16:50, Sanjay R Mehta wrote:
>>>>>
>>>>>>>> +static struct pt_device *pt_alloc_struct(struct device *dev)
>>>>>>>> +{
>>>>>>>> +     struct pt_device *pt;
>>>>>>>> +
>>>>>>>> +     pt = devm_kzalloc(dev, sizeof(*pt), GFP_KERNEL);
>>>>>>>> +
>>>>>>>> +     if (!pt)
>>>>>>>> +             return NULL;
>>>>>>>> +     pt->dev = dev;
>>>>>>>> +     pt->ord = atomic_inc_return(&pt_ordinal);
>>>>>>>
>>>>>>> What is the use of this number?
>>>>>>>
>>>>>>
>>>>>> There are eight similar instances of this DMA engine on AMD SOC.
>>>>>> It is to differentiate each of these instances.
>>>>>
>>>>> Are they individual device objects?
>>>>>
>>>>
>>>> Yes, they are individual device objects.
>>>
>>> Then what is "ord" for?  Why are you using an atomic variable for this?
>>> What does this field do?  Why doesn't the normal way of naming a device
>>> come into play here instead?
>>>
>>
>> Hi Greg,
>>
>> The value of "ord" is incremented for each device instance and then it
>> is used to store different name for each device as shown in below snippet.
>>
>>       pt->ord = atomic_inc_return(&pt_ordinal);
>>       snprintf(pt->name, MAX_PT_NAME_LEN, "pt-%u", pt->ord);
> 
> Okay why not use device->name ?
> 
> Trying to unroll further, who creates pt_device? who creates the dev
> object under this..?
> 

Hi Vinod,

The pt_device is allocated and initialized in the PCI probe function and
then we just get the "dev" from the "pci_dev" object and save it in
"pt->dev" as shown in below snippet.


   static int pt_pci_probe(struct pci_dev *pdev, const struct
pci_device_id *id)
   {
	struct pt_device *pt;
	struct pt_msix *pt_msix;
	struct device *dev = &pdev->dev;


Thanks,
- Sanjay

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ