* 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-01-18 1:53 pci " Rabinarayan Panigrahi
@ 2016-01-18 5:11 ` Greg KH
2016-01-18 7:00 ` Saumendra Dash
0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2016-01-18 5:11 UTC (permalink / raw)
To: kernelnewbies
On Mon, Jan 18, 2016 at 07:23:42AM +0530, Rabinarayan Panigrahi wrote:
> 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.
What exactly do you have questions about? Specific questions are best
please.
greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
* pci device driver
2016-01-18 5:11 ` Greg KH
@ 2016-01-18 7:00 ` Saumendra Dash
2016-01-20 7:11 ` Rabinarayan Panigrahi
0 siblings, 1 reply; 6+ messages in thread
From: Saumendra Dash @ 2016-01-18 7:00 UTC (permalink / raw)
To: kernelnewbies
-----Original Message-----
From: kernelnewbies-bounces@kernelnewbies.org [mailto:kernelnewbies-bounces at kernelnewbies.org] On Behalf Of Greg KH
Sent: Monday, January 18, 2016 10:42 AM
To: Rabinarayan Panigrahi
Cc: kernelnewbies at kernelnewbies.org
Subject: Re: pci device driver
On Mon, Jan 18, 2016 at 07:23:42AM +0530, Rabinarayan Panigrahi wrote:
> 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.
>What exactly do you have questions about? Specific questions are best please.
Please go through some simple PCI driver code to know more about PCI programming.
8250/16550 family of Serial Driver is a good one to start with.
Thanks,
Saumendra
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
::DISCLAIMER::
----------------------------------------------------------------------------------------------------------------------------------------------------
The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.
E-mail transmission is not guaranteed to be secure or error-free as information could be intercepted, corrupted,
lost, destroyed, arrive late or incomplete, or may contain viruses in transmission. The e mail and its contents
(with or without referred errors) shall therefore not attach any liability on the originator or HCL or its affiliates.
Views or opinions, if any, presented in this email are solely those of the author and may not necessarily reflect the
views or opinions of HCL or its affiliates. Any form of reproduction, dissemination, copying, disclosure, modification,
distribution and / or publication of this message without the prior written consent of authorized representative of
HCL is strictly prohibited. If you have received this email in error please delete it and notify the sender immediately.
Before opening any email and/or attachments, please check them for viruses and other defects.
----------------------------------------------------------------------------------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 6+ messages in thread
* pci device driver
2016-01-18 7:00 ` Saumendra Dash
@ 2016-01-20 7:11 ` Rabinarayan Panigrahi
0 siblings, 0 replies; 6+ messages in thread
From: Rabinarayan Panigrahi @ 2016-01-20 7:11 UTC (permalink / raw)
To: kernelnewbies
Hi,
At first I would like to say thanks to Saumendra Das and Greg KH for your
response and I believe 8250/16550 family of Serial Driver is really good to
start as it easily available in market.
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 and if I take 8250 server family then how
interaction is happens between kernel and pci device.
To know more about this i went to below files
drivers\tty\serial\8250\8250_pci.c
drivers\pci (some files)
Please suggest me if i am going anything wrong.
Regards
Rabi
On Mon, Jan 18, 2016 at 12:30 PM, Saumendra Dash <saumendra.d@hcl.com>
wrote:
>
> -----Original Message-----
> From: kernelnewbies-bounces at kernelnewbies.org [mailto:
> kernelnewbies-bounces at kernelnewbies.org] On Behalf Of Greg KH
> Sent: Monday, January 18, 2016 10:42 AM
> To: Rabinarayan Panigrahi
> Cc: kernelnewbies at kernelnewbies.org
> Subject: Re: pci device driver
>
> On Mon, Jan 18, 2016 at 07:23:42AM +0530, Rabinarayan Panigrahi wrote:
> > 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.
>
> >What exactly do you have questions about? Specific questions are best
> please.
>
> Please go through some simple PCI driver code to know more about PCI
> programming.
> 8250/16550 family of Serial Driver is a good one to start with.
>
> Thanks,
> Saumendra
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>
> ::DISCLAIMER::
>
> ----------------------------------------------------------------------------------------------------------------------------------------------------
>
> The contents of this e-mail and any attachment(s) are confidential and
> intended for the named recipient(s) only.
> E-mail transmission is not guaranteed to be secure or error-free as
> information could be intercepted, corrupted,
> lost, destroyed, arrive late or incomplete, or may contain viruses in
> transmission. The e mail and its contents
> (with or without referred errors) shall therefore not attach any liability
> on the originator or HCL or its affiliates.
> Views or opinions, if any, presented in this email are solely those of the
> author and may not necessarily reflect the
> views or opinions of HCL or its affiliates. Any form of reproduction,
> dissemination, copying, disclosure, modification,
> distribution and / or publication of this message without the prior
> written consent of authorized representative of
> HCL is strictly prohibited. If you have received this email in error
> please delete it and notify the sender immediately.
> Before opening any email and/or attachments, please check them for viruses
> and other defects.
>
>
> ----------------------------------------------------------------------------------------------------------------------------------------------------
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160120/5c6f40c0/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.