RE: porting a mm specific macro from 2.4 to 2.6

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

 



Hi Thomas,
Here is the context-of-use --
The driver is for Crypto-Hardware-Accelerator(CHA).  The user space
creates the Descriptors(which has data to be encrypted, type of
crypto-algorithm etc) which guides the CHA.
A dummy malloc is implemented in kernel driver which uses kmalloc and
user can request that memory(to create Descriptors) via
IOCTL(CHA_MALLOC).  The idea is (most likely) to avoid the "copy from
usersapce". Then the descriptor pointer is filled with the data by
user-space which passes it back to CHA via second
IOCTL(CHA_CRYPT_REQUEST).

In kernel the "__vpa"  is used on the above descriptor and returned
address is written into the hardware-registers of the
Crypto-Accelerator.

Yes I really wonder why this MACRO was created and why "virt_to_phys"
was not used(kernel 2.4.28).  Is this MACRO doing something else?

#define __vpa(va) \
 ((pte_val(*pte_offset(pmd_offset(pgd_offset_k(va),(va)),(va))) & \
 PAGE_MASK) + (va & ~PAGE_MASK))

Now back to my original question will this MACRO do the samething in
2.6.10 kernel or I have to rewrite , like use "pte_offset_kernel"
instead of "pte_offset".

Regards
-vikas



--------------------------------------------------------
This e-mail, including any attachments, may be confidential, privileged or otherwise legally protected. It is intended only for the addressee. If you received this e-mail in error or from someone who was not authorized to send it to you, do not disseminate, copy or otherwise use this e-mail or its attachments.  Please notify the sender immediately by reply e-mail and delete the e-mail from your system.


-----Original Message-----

From: kernelnewbies-bounce@xxxxxxxxxxxx
[mailto:kernelnewbies-bounce@xxxxxxxxxxxx] On Behalf Of Thomas Petazzoni
Sent: Tuesday, July 26, 2005 4:29 AM
To: kernelnewbies@xxxxxxxxxxxx
Subject: Re: porting a mm specific macro from 2.4 to 2.6

Hi,

Vikas Aggarwal wrote:

> #define __vpa(va)
> ((pte_val(*pte_offset(pmd_offset(pgd_offset_k(va),(va)),(va))) &
> PAGE_MASK) + (va & ~PAGE_MASK))

What is supposed to do this macro ? As far as I understand it, it's 
supposed to convert a virtual address into a physical one by traveling 
through the page tables. Is that it ?

If yes, then the virt_to_phys() macro already does the job, but only for

kernel virtual addresses (I think, I only had a quick look at the code).

Directly translating user virtual addresses to physical addresses is, I 
think, a bad idea, because user stuff might be swapped.

Then, can you give more details about the context of use ? (The code of 
the function is which it is used for example).

Sincerly,

Thomas
-- 
Thomas Petazzoni
thomas.petazzoni@xxxxxxxx

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux