All of lore.kernel.org
 help / color / mirror / Atom feed
* PCI device driver
@ 2004-07-06 13:40 Frederic Dumoulin
  0 siblings, 0 replies; 6+ messages in thread
From: Frederic Dumoulin @ 2004-07-06 13:40 UTC (permalink / raw)
  To: linux-kernel; +Cc: Frederic Dumoulin

Hi,

I've got several questions about PCI device driver (some of them have
nothing to do with kernel, but one never knows, maybe somone can help
me or give me the address of the right mailing list):



1) In my driver, I allocate memory for the dma.

What are the difference between the following methods :
     * kmalloc (PAGE_SIZE, GFP_KERNEL | GFP_ATOMIC | GFP_DMA)
     * __get_dma_pages (GFP_KERNEL | GFP_ATOMIC | GFP_DMA, 1)
     * pci_alloc_consistent (pci_device, PAGE_SIZE, &buffer_phys)

On the performance point of view, is there any difference between
consistent and streaming DMA mappings?



2) I'd like to have information about the master write latency.

When I launch a master write access, I'm doing a software polling on
the PC memory in order to know when the data is present. I measure
this time with the RDTSC Pentium instruction and it give me about 1.3
us, with an oscilloscope I can see that the data "leave" the PCI after
only 0.550us!

Where is my data during those 0.7us?
How can I reduce this latency?

How can I use the function "ioremap_nocache"? (I can't see any difference with ioremap)



3) I'd like to have information about the use of the CACHE_LINE_SIZE
register.

When this register is used?
     only when using master write and invalidate commands
     or also in slave read / write accesses

I'm trying to increase the performance of my slave read accesses
I try to force the CACHE_LINE_SIZE register with
$ setpci -v -s 02:0a.0 CACHE_LINE_SIZE
02:0a.0:0c = 00
$ setpci -v -s 02:0a.0 CACHE_LINE_SIZE=10
02:0a.0:0c 10
$ setpci -v -s 02:0a.0 CACHE_LINE_SIZE
02:0a.0:0c = 00


I've got the same problem with the COMMAND register when I try to set
the FAST_BACK_TO_BACK bit, or the PREFETCH bit in the BASE_ADDRESS_0
register.


How can I overwrite the configuration set by the PCI board?
(I cannot configurate all the PCI registers in my IP)



4) I try to modify the Memory Type Range Register.

I use the /proc/mtrr system file :
$ echo "base=0xfd000000 size=0x01000000 type=write-combining" >>
/proc/mtrr
$ cat /proc/mtrr
reg00: base=0x00000000 (   0MB), size= 256MB: write-back, count=1
reg01: base=0x10000000 ( 256MB), size= 128MB: write-back, count=1
reg02: base=0x18000000 ( 384MB), size=   1MB: write-back, count=1
reg03: base=0x18000000 ( 384MB), size=   1MB: uncachable, count=1
reg04: base=0xfd000000 (4048MB), size=  16MB: write-combining, count=1

If I re-do the same operation, count=2
What is the use of "count"? The speed doesn't seem to be increased if count = 1 or 2.

Which type is the best for simple memory slave read / write and master
write accesses?

I don't know how to have the longest burst as possible in slave read?




Thanks for your help

Best regards



Frederic

^ permalink raw reply	[flat|nested] 6+ messages in thread
* pci device driver
@ 2016-01-18  1:53 Rabinarayan Panigrahi
  2016-01-18  5:11 ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Rabinarayan Panigrahi @ 2016-01-18  1:53 UTC (permalink / raw)
  To: kernelnewbies

Hi,

For understanding more about pci device driver i went though below links

http://www.tldp.org/LDP/tlk/dd/pci.html

and

http://www.makelinux.net/ldd3/  chapter 12

but i am trying to understand a bit code side. can some one help me or any
resources which will help me to understand more about it.


Regards
Rabi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160118/311bafa3/attachment.html 

^ permalink raw reply	[flat|nested] 6+ messages in thread
* pci device driver
@ 2016-03-31 13:43 Manoj Nayak
  0 siblings, 0 replies; 6+ messages in thread
From: Manoj Nayak @ 2016-03-31 13:43 UTC (permalink / raw)
  To: kernelnewbies

>I am completely new to this PCI device driver so I just wanted to know that
>how kernel build pci_dev structure during pci initialization time. what are
>the pci function are being called


The sequence of routines that lead to pci device initialization.

pci_legacy_init() -> pcibios_scan_root() -> pci_scan_child_bus()->
pci_scan_slot()-> pci_scan_single_device()
->pci_device_add()-> device_add(&dev->dev) -> bus_probe_device() ->
device_attach()




struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn)
{
        struct pci_dev *dev;

        dev = pci_get_slot(bus, devfn);
        if (dev) {
                pci_dev_put(dev);
                return dev;
        }

        dev = pci_scan_device(bus, devfn);
        if (!dev)
                return NULL;

        pci_device_add(dev, bus);

        return dev;
}



/*
 * Read the config data for a PCI device, sanity-check it
 * and fill in the dev structure...
 */
static struct pci_dev *pci_scan_device(struct pci_bus *bus, int devfn)
{
        struct pci_dev *dev;
        u32 l;

        if (!pci_bus_read_dev_vendor_id(bus, devfn, &l, 60*1000))
                return NULL;

        dev = pci_alloc_dev(bus);
        if (!dev)
                return NULL;

        dev->devfn = devfn;
        dev->vendor = l & 0xffff;
        dev->device = (l >> 16) & 0xffff;

        pci_set_of_node(dev);

        if (pci_setup_device(dev)) {
                pci_bus_put(dev->bus);
                kfree(dev);
                return NULL;
        }

        return dev;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160331/12a88e9b/attachment.html 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-03-31 13:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-06 13:40 PCI device driver Frederic Dumoulin
  -- strict thread matches above, loose matches on Subject: below --
2016-01-18  1:53 pci " Rabinarayan Panigrahi
2016-01-18  5:11 ` Greg KH
2016-01-18  7:00   ` Saumendra Dash
2016-01-20  7:11     ` Rabinarayan Panigrahi
2016-03-31 13:43 Manoj Nayak

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.