From: Christoph Hellwig <hch@infradead.org>
To: Kelvin.Cao@microchip.com
Cc: hch@infradead.org, dmaengine@vger.kernel.org, vkoul@kernel.org,
George.Ge@microchip.com, linux-kernel@vger.kernel.org,
logang@deltatee.com, tglx@linutronix.de,
christophe.jaillet@wanadoo.fr
Subject: Re: [PATCH v4 1/1] dmaengine: switchtec-dma: Introduce Switchtec DMA engine PCI driver
Date: Mon, 15 May 2023 08:13:44 -0700 [thread overview]
Message-ID: <ZGJMKFrLfU2zc/2P@infradead.org> (raw)
In-Reply-To: <50e111a3cfecd0f232508d1b03e02d1e25d9d4a9.camel@microchip.com>
On Fri, May 05, 2023 at 12:31:11AM +0000, Kelvin.Cao@microchip.com wrote:
> Hi Christoph,
>
> Thanks for the comments. For the tasklet stuff, I guess your opinion is
> that by default the driver should go with threaded irq instead of
> tasklet as the former is more efficient, unless there's a good reason
> of using tasklet.
>
> Tasklet is widely used in DMA drivers, not sure if there's a rational
> reason or people just follow the code structure of the current ones.
Given that neither nor anyone else from the RT community chimed
in I'm going to throw the towel on the tasklet use. It looks fairly
suboptimal, but I don't want to block the driver on that.
> > > + union {
> > > + __le32 saddr_lo;
> > > + __le32 widata_lo;
> > > + };
> > > + union {
> > > + __le32 saddr_hi;
> > > + __le32 widata_hi;
> > > + };
> >
> > What is the point for unions of identical data types?
>
> The same offset could hold either source address or write immediate
> data in different transactions. Unions used here is to give different
> names for the same offset. I guess it improves readability when
> referring to them with proper names.
I find this rather confusing, especially as some code literally
switches on the op to fill in either set.
> The CE is little-endian and is filled by hardware. As an error message,
> I'd like to dump the whole structure. Would the following code look
> better?
>
> __le32 *p;
> ...
> p = (__le32 *)ce;
> for (i = 0; i < sizeof(*ce)/4; i++) {
> dev_err(chan_dev, "CE DW%d: 0x%08x\n", i,
> le32_to_cpu(*p));
> p++;
> }
Fine with me.
> > > +#define SWITCHTEC_DMA_DEVICE(device_id) \
> > > + { \
> > > + .vendor = PCI_VENDOR_ID_MICROSEMI, \
> > > + .device = device_id, \
> > > + .subvendor = PCI_ANY_ID, \
> > > + .subdevice = PCI_ANY_ID, \
> > > + .class = PCI_CLASS_SYSTEM_OTHER << 8, \
> > > + .class_mask = 0xFFFFFFFF, \
> > > + }
> > > +
> > > +static const struct pci_device_id switchtec_dma_pci_tbl[] = {
> > > + SWITCHTEC_DMA_DEVICE(0x4000), /* PFX 100XG4 */
> >
> > This should use the common PCI_DEVICE() macro instead, i.e.
> >
> > PCI_DEVICE(PCI_VENDOR_ID_MICROSEMI, 0x4000), /* PFX 100XG4 */
> > ...
>
> We also need to distinguish the .class as we have devices of other
> .class with the same vendor/device ID.
Ok, that's roetty weird and probably worth a little comment.
next prev parent reply other threads:[~2023-05-15 15:13 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-23 21:37 [PATCH v4 0/1] Switchtec Switch DMA Engine Driver Kelvin Cao
2023-04-23 21:37 ` [PATCH v4 1/1] dmaengine: switchtec-dma: Introduce Switchtec DMA engine PCI driver Kelvin Cao
2023-04-24 1:36 ` kernel test robot
2023-05-03 6:31 ` Christoph Hellwig
2023-05-05 0:31 ` Kelvin.Cao
2023-05-15 15:13 ` Christoph Hellwig [this message]
2023-05-15 18:18 ` Kelvin.Cao
2023-05-16 5:00 ` Christoph Hellwig
2023-05-16 5:20 ` Kelvin.Cao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZGJMKFrLfU2zc/2P@infradead.org \
--to=hch@infradead.org \
--cc=George.Ge@microchip.com \
--cc=Kelvin.Cao@microchip.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=dmaengine@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=logang@deltatee.com \
--cc=tglx@linutronix.de \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox