Re: PCIe: readl()

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

 



On Thu, Jan 06, 2022 at 10:43:52PM +0530, Muni Sekhar wrote:
> Hi all,
> 
> We have a free-running counter on x86 PCIe bus and plan to use it as a
> clocksource. The 'read' field of the clocksource structure reads from
> this free-running counter and returns this value.
> 
> Since PCIe reads are synchronous, is it safe to use readl() API to
> read this free-running counter value in struct clocksource.read()? If
> not, what's the best way to read the counter value from the struct
> clocksource read field?

Yes, you can use readl().  Of course, the driver for your PCIe device
will have to do the usual setup, e.g.,

  probe(struct pci_dev *dev)
  {
    pci_request_regions(dev, "name");
    addr = pci_ioremap_bar(dev, 0);
    readl(addr);

The readl() should give you a single PCIe transaction, which is the
best you can do.

Bjorn



[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux