RE: [PATCH 01/19] bus/cdx: add the cdx bus driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[AMD Official Use Only - General]



> -----Original Message-----
> From: Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx>
> Sent: Tuesday, January 17, 2023 7:37 PM
> To: Gupta, Nipun <Nipun.Gupta@xxxxxxx>
> Cc: robh+dt@xxxxxxxxxx; krzysztof.kozlowski+dt@xxxxxxxxxx; rafael@xxxxxxxxxx;
> eric.auger@xxxxxxxxxx; alex.williamson@xxxxxxxxxx; cohuck@xxxxxxxxxx;
> song.bao.hua@xxxxxxxxxxxxx; mchehab+huawei@xxxxxxxxxx; maz@xxxxxxxxxx;
> f.fainelli@xxxxxxxxx; jeffrey.l.hugo@xxxxxxxxx; saravanak@xxxxxxxxxx;
> Michael.Srba@xxxxxxxxx; mani@xxxxxxxxxx; yishaih@xxxxxxxxxx;
> jgg@xxxxxxxx; jgg@xxxxxxxxxx; robin.murphy@xxxxxxx; will@xxxxxxxxxx;
> joro@xxxxxxxxxx; masahiroy@xxxxxxxxxx; ndesaulniers@xxxxxxxxxx; linux-arm-
> kernel@xxxxxxxxxxxxxxxxxxx; linux-kbuild@xxxxxxxxxxxxxxx; linux-
> kernel@xxxxxxxxxxxxxxx; devicetree@xxxxxxxxxxxxxxx; okaya@xxxxxxxxxx;
> Anand, Harpreet <harpreet.anand@xxxxxxx>; Agarwal, Nikhil
> <nikhil.agarwal@xxxxxxx>; Simek, Michal <michal.simek@xxxxxxx>; git
> (AMD-Xilinx) <git@xxxxxxx>
> Subject: Re: [PATCH 01/19] bus/cdx: add the cdx bus driver
> 
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
> 
> 
> On Tue, Jan 17, 2023 at 07:11:33PM +0530, Nipun Gupta wrote:
> > Introduce AMD CDX bus, which provides a mechanism for scanning
> > and probing CDX devices. These devices are memory mapped on
> > system bus for Application Processors(APUs).
> >
> > CDX devices can be changed dynamically in the Fabric and CDX
> > bus interacts with CDX controller to rescan the bus and
> > rediscover the devices.
> >
> > Signed-off-by: Nipun Gupta <nipun.gupta@xxxxxxx>
> > Signed-off-by: Tarak Reddy <tarak.reddy@xxxxxxx>
> 
> First off, very nice job, I didn't find any obvious issues with this
> integration into the driver core.
> 
> That being said, why do you want this in drivers/bus/?  Why not
> drivers/cdx/ ?

Thanks, Greg, for taking time out for review and providing your valuable
feedback. We do not have strong affiliation to drivers/bus/cdx so will move
it to drivers/cdx in the next spin.

> 
> One minor comment to make the code smaller:
> 
> > +static int get_free_index(void)
> > +{
> > +     unsigned long id_map;
> > +     unsigned long mask;
> > +     int index = 0;
> > +
> > +     mask  = (1UL << MAX_CDX_CONTROLLERS) - 1;
> > +retry:
> > +     id_map = cdx_controller_id_map[0];
> > +     if ((id_map & mask) == mask)
> > +             return -ENOSPC;
> > +
> > +     index = ffz(id_map);
> > +     if (index >= MAX_CDX_CONTROLLERS)
> > +             return -ENOSPC;
> > +
> > +     if (test_and_set_bit(index, &cdx_controller_id_map[0]))
> > +             goto retry;
> > +
> > +     return index;
> > +}
> 
> Why not just use the idr/ida structure instead?  That will handle all of
> that logic for you and get rid of your bit twiddling.

Agree. Using idr/ida seems more appropriate. Will update the code
accordingly.

> 
> > +/**
> > + * struct cdx_dev_params - CDX device parameters
> > + * @cdx: CDX controller associated with the device
> > + * @parent: Associated CDX controller
> > + * @vendor: Vendor ID for CDX device
> > + * @device: Device ID for CDX device
> > + * @bus_num: Bus number for this CDX device
> > + * @dev_num: Device number for this device
> > + * @res: array of MMIO region entries
> > + * @res_count: number of valid MMIO regions
> > + * @req_id: Requestor ID associated with CDX device
> > + */
> > +struct cdx_dev_params {
> > +     struct cdx_controller *cdx;
> > +     u16 vendor;
> > +     u16 device;
> 
> Are these in little endian format in memory?  Or native?  Or something
> else?

While reading from the hardware, these values are little-endian; and
they are converted to CPU endianness by the controller code using
le_to_cpu32() and then passed as CPU endian while registering the
CDX device.

Thanks,
Nipun

> 
> thanks,
> 
> greg k-h




[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux