Can register addresses conversion go through iommu too? probably not..

2021-09-29 Thread ckim
Hello all,

I know when a device does dma to memory, we use functions like
dma_alloc_coherent to allocate a memory region for the dma and we get the
kernel virtual address and device virtual address at the same time. The
iommu hardware converts the device virtual address to physical address
reducing the processing time.  

 

I have a question (to make sure my understanding is correct).

To use registers in the device driver, we use ioremap function to get the
kernel virtual address for the device registers. If the OS is running in
virtualized environment (a hypervisor under it), this kernel virtual address
should go under conversion twice  

1. virtual to physical by OS  (this physical is not actually physical, an
intermediate physical?)

2. intermediate physical to real physical

I thought these two conversions are done by kernel or hypervisor software
because iommu is for address translation for the addresses that the device
"uses(or generates)", not for the kernel to access the device itself. 

Is my understanding correct?

Any help will be appreciated.

Thank you!

Chan Kim

 

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: ALSA kernel projects - for academic purposes

2021-09-29 Thread Ruben Safir
Bingo 


Correct Answer


On Wed, Sep 29, 2021 at 10:11:33PM -0400, Aruna Hewapathirane wrote:
> On Fri, Sep 24, 2021 at 10:05 AM Muni Sekhar 
> wrote:
> 
> > Hi all,
> >
> >
> > What small projects would you suggest to a novice with the ALSA
> > kernel. The aim is to develop a familiarity with the ALSA kernel
> > source code, and also to submit it for academic purposes.
> >
> >
> > --
> > Thanks,
> > Sekhar
> >
> 
> 
> 1. Read the documentation for the Linux Sound Subsystem :
> https://www.kernel.org/doc/html/latest/sound/index.html
> 2. Then try to understand the the ALSA Driver API
> 3. In your kernel source tree under the sound folder/directory you will
> find lot's of useful source code.
> 
> If you open the /sound/x86/intel_hdmi_audio.h file at the very top you will
> see what is below:
> 
> // SPDX-License-Identifier: GPL-2.0-only
> /*
>  *   intel_hdmi_audio.c - Intel HDMI audio driver
>  *
>  *  Copyright (C) 2016 Intel Corp
>  *  Authors: Sailaja Bandarupalli 
>  * Ramesh Babu K V 
>  * Vaibhav Agarwal 
>  * Jerome Anand 
>  *
>  ~~
>  *
>  *
> ~~
>  * ALSA driver for Intel HDMI audio
>  */
> 
> All the authors you will notice are from intel and seem to be all south
> asian :-))) pure coincidence ? I somehow
> do not think so.
> 
> Muni in my experience what I have learnt  over the years is there will be
> times when you ask a question and
> you will get very negative or straight-up demoralising and demotivating
> toxic remarks and comments. My advice
> to you is this:
> 
> Have a deaf ear to the obstacles and negative comments, rather use them as
> motivation to achieve your goals.
> 
> *Lesson to take away:*
> 
>1. Alas! We can’t have a deaf ear to the negative comments that we
>receive so abundantly from people all around us.
>I mean even those who don’t usually give advice, would try to stop you
>from doing something you so eagerly wanted to do,
>even when they themselves don’t know anything about it. But we can,
>however, avoid them or use them as a motivation
>to prove them wrong. Yep, use their words to prove them wrong!
> 
> Good luck - Aruna

> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


-- 
So many immigrant groups have swept through our town
that Brooklyn, like Atlantis, reaches mythological
proportions in the mind of the world - RI Safir 1998
http://www.mrbrklyn.com 

DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002
http://www.nylxs.com - Leadership Development in Free Software
http://www2.mrbrklyn.com/resources - Unpublished Archive 
http://www.coinhangout.com - coins!
http://www.brooklyn-living.com 

Being so tracked is for FARM ANIMALS and extermination camps, 
but incompatible with living as a free human being. -RI Safir 2013


___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: ALSA kernel projects - for academic purposes

2021-09-29 Thread Aruna Hewapathirane
On Fri, Sep 24, 2021 at 10:05 AM Muni Sekhar 
wrote:

> Hi all,
>
>
> What small projects would you suggest to a novice with the ALSA
> kernel. The aim is to develop a familiarity with the ALSA kernel
> source code, and also to submit it for academic purposes.
>
>
> --
> Thanks,
> Sekhar
>


1. Read the documentation for the Linux Sound Subsystem :
https://www.kernel.org/doc/html/latest/sound/index.html
2. Then try to understand the the ALSA Driver API
3. In your kernel source tree under the sound folder/directory you will
find lot's of useful source code.

If you open the /sound/x86/intel_hdmi_audio.h file at the very top you will
see what is below:

// SPDX-License-Identifier: GPL-2.0-only
/*
 *   intel_hdmi_audio.c - Intel HDMI audio driver
 *
 *  Copyright (C) 2016 Intel Corp
 *  Authors: Sailaja Bandarupalli 
 * Ramesh Babu K V 
 * Vaibhav Agarwal 
 * Jerome Anand 
 *
 ~~
 *
 *
~~
 * ALSA driver for Intel HDMI audio
 */

All the authors you will notice are from intel and seem to be all south
asian :-))) pure coincidence ? I somehow
do not think so.

Muni in my experience what I have learnt  over the years is there will be
times when you ask a question and
you will get very negative or straight-up demoralising and demotivating
toxic remarks and comments. My advice
to you is this:

Have a deaf ear to the obstacles and negative comments, rather use them as
motivation to achieve your goals.

*Lesson to take away:*

   1. Alas! We can’t have a deaf ear to the negative comments that we
   receive so abundantly from people all around us.
   I mean even those who don’t usually give advice, would try to stop you
   from doing something you so eagerly wanted to do,
   even when they themselves don’t know anything about it. But we can,
   however, avoid them or use them as a motivation
   to prove them wrong. Yep, use their words to prove them wrong!

Good luck - Aruna
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: ALSA kernel projects - for academic purposes

2021-09-29 Thread Ruben Safir
> I don't see your point here. 


I know that.  So read what I wrote again and think about the original
poster sitting in a CLASSROOM and working on a thesis due in 2 months


Just try to place yourslef in another persons shoes for 15 minutes.


This guy gets assigned this task and is trying to figure out an
approach.  He is not trying to satisfy YOUR needs,  but the requirments
of is grade so he can graduate.



___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: ALSA kernel projects - for academic purposes

2021-09-29 Thread Geraldo Nascimento
On Wed, Sep 29, 2021 at 11:07:15AM -0400, Ruben Safir wrote:
> On Fri, Sep 24, 2021 at 07:26:08PM -0300, Geraldo Nascimento wrote:
> > On Fri, Sep 24, 2021 at 10:28:01PM +0530, Muni Sekhar wrote:
> > > On Fri, Sep 24, 2021 at 10:02 PM Valdis Klētnieks
> > >  wrote:
> > > >
> > > > On Fri, 24 Sep 2021 19:34:59 +0530, Muni Sekhar said:
> > > > > What small projects would you suggest to a novice with the ALSA
> > > > > kernel. The aim is to develop a familiarity with the ALSA kernel
> > > > > source code, and also to submit it for academic purposes.
> > 
> > I'm not an academicist by far but if you want your patches to be academic,
> > I think it's more of a question of scientific rigour and scientific
> > method, 
> 
> 
> No - it is an issue of education.  They are trying to learn something
> that they don't already know.  The contribution is they become educated.
>
> > such that when the patch(set) is finally accepted by the Linux
> > community and Linus Torvalds ultimately, you can write a paper about
> > it.
> >
> 
> 
> They are not writing a paper for Linus.  They are writing it for their
> dean or mentor.
>

Hello Ruben,

I don't see your point here. I mentioned not being in academia myself
but last time I was, the academics, from the most junior to the most
seasoned scholar, are writing for journals. They are writing to get
published and cited hopefully.

If they were writing for their dean or mentor to grade them, that would
be called homework. While that's arguably part of education, higher
or otherwise, Muni Sekhar certainly did not ask for help with his
homework.

> 
> > Obviously there are a lot of things an academicist could bring from his
> > background to improve the Linux kernel, 
> 
> Yeah - but that is not what they are trying to do.  And if that was the
> case, this would likely not be the list for it, since this is a newbies
> list.
> 
> 
> > My suggestion is to ask Takashi Iwai if he has in mind 
> 
> BOINK - the doesn't need a new student dragging on his tail and if he
> did then he would chose an intern to help with his code.
> 
> You are failing to understand how higher education works.

I do have my gripes with higher education and I never suggested I
understood it.

As to contacting the maintainer precisely of the part of the kernel you
want to contribute (ALSA kernel-side for Muni Sekhar in this case)
before actually contributing any code, this sounds, at least to me,
like sensible advice.

Thank you,
Geraldo Nascimento

> 
> > ___
> > Kernelnewbies mailing list
> > Kernelnewbies@kernelnewbies.org
> > https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> 
> 
> -- 
> So many immigrant groups have swept through our town
> that Brooklyn, like Atlantis, reaches mythological
> proportions in the mind of the world - RI Safir 1998
> http://www.mrbrklyn.com 
> 
> DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002
> http://www.nylxs.com - Leadership Development in Free Software
> http://www2.mrbrklyn.com/resources - Unpublished Archive 
> http://www.coinhangout.com - coins!
> http://www.brooklyn-living.com 
> 
> Being so tracked is for FARM ANIMALS and extermination camps, 
> but incompatible with living as a free human being. -RI Safir 2013
> 

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: ALSA kernel projects - for academic purposes

2021-09-29 Thread Ruben Safir
On Fri, Sep 24, 2021 at 07:26:08PM -0300, Geraldo Nascimento wrote:
> On Fri, Sep 24, 2021 at 10:28:01PM +0530, Muni Sekhar wrote:
> > On Fri, Sep 24, 2021 at 10:02 PM Valdis Klētnieks
> >  wrote:
> > >
> > > On Fri, 24 Sep 2021 19:34:59 +0530, Muni Sekhar said:
> > > > What small projects would you suggest to a novice with the ALSA
> > > > kernel. The aim is to develop a familiarity with the ALSA kernel
> > > > source code, and also to submit it for academic purposes.
> 
> I'm not an academicist by far but if you want your patches to be academic,
> I think it's more of a question of scientific rigour and scientific
> method, 


No - it is an issue of education.  They are trying to learn something
that they don't already know.  The contribution is they become educated.

> such that when the patch(set) is finally accepted by the Linux
> community and Linus Torvalds ultimately, you can write a paper about
> it.
>


They are not writing a paper for Linus.  They are writing it for their
dean or mentor.


> Obviously there are a lot of things an academicist could bring from his
> background to improve the Linux kernel, 

Yeah - but that is not what they are trying to do.  And if that was the
case, this would likely not be the list for it, since this is a newbies
list.


> My suggestion is to ask Takashi Iwai if he has in mind 

BOINK - the doesn't need a new student dragging on his tail and if he
did then he would chose an intern to help with his code.

You are failing to understand how higher education works.

> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


-- 
So many immigrant groups have swept through our town
that Brooklyn, like Atlantis, reaches mythological
proportions in the mind of the world - RI Safir 1998
http://www.mrbrklyn.com 

DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002
http://www.nylxs.com - Leadership Development in Free Software
http://www2.mrbrklyn.com/resources - Unpublished Archive 
http://www.coinhangout.com - coins!
http://www.brooklyn-living.com 

Being so tracked is for FARM ANIMALS and extermination camps, 
but incompatible with living as a free human being. -RI Safir 2013


___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: ALSA kernel projects - for academic purposes

2021-09-29 Thread Ruben Safir
> 
> also, theres now pipewire, which is new, and all the buzz.
> its apparently the future of linux audio
> 



BTW - we hear the BS every month, and yet, ALSA is still here and the
backbone of Linux sound... 


-- 
So many immigrant groups have swept through our town
that Brooklyn, like Atlantis, reaches mythological
proportions in the mind of the world - RI Safir 1998
http://www.mrbrklyn.com 

DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002
http://www.nylxs.com - Leadership Development in Free Software
http://www2.mrbrklyn.com/resources - Unpublished Archive 
http://www.coinhangout.com - coins!
http://www.brooklyn-living.com 

Being so tracked is for FARM ANIMALS and extermination camps, 
but incompatible with living as a free human being. -RI Safir 2013


___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: ALSA kernel projects - for academic purposes

2021-09-29 Thread Ruben Safir
On Fri, Sep 24, 2021 at 11:15:35AM -0600, jim.cro...@gmail.com wrote:
> On Fri, Sep 24, 2021 at 10:58 AM Muni Sekhar  wrote:
> >
> > On Fri, Sep 24, 2021 at 10:02 PM Valdis Klētnieks
> >  wrote:
> > >
> > > On Fri, 24 Sep 2021 19:34:59 +0530, Muni Sekhar said:
> > > > What small projects would you suggest to a novice with the ALSA
> > > > kernel. The aim is to develop a familiarity with the ALSA kernel
> > > > source code, and also to submit it for academic purposes.
> > >
> > > A good place to start is getting a good handle on what the phrase "the 
> > > ALSA
> > > kernel" even means.
> > Basically looking for kernel space audio subsystem projects rather
> > than its user-space library(alsa-lib) and utilities(alsa-utils).
> 
> why ?
> if your interest is better sound, then improving user-space is going
> to be more productive.


Because he wants to, that is why.  It is his agenda, not yours.

I am not sure if people percieve just how much of a jerk they sound when
they routely redirect a question to their favorite view of how the world
should work.

Either help or shut up


___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


RE: does dma_alloc_coherent setup iommu page table?

2021-09-29 Thread ckim
I realized the IOMMU mapping is done with dma_alloc_  or dma_map_..

It's so basic (I have read
https://www.kernel.org/doc/Documentation/DMA-API-HOWTO.txt ) but I forgot.

Thanks!

Chan Kim

 

From: c...@etri.re.kr  
Sent: Wednesday, September 29, 2021 4:15 PM
To: kernelnewbies@kernelnewbies.org
Subject: does dma_alloc_coherent setup iommu page table?

 

Hello all,

When the driver calls dma_alloc_coherent for a device, and if the device
uses iommu, is the table entry for the iommu setup for the dma_handle?

Seeing the struct device has something related to iommu, I guess so..

Any help appreciated.

Thanks!

Chan Kim

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


does dma_alloc_coherent setup iommu page table?

2021-09-29 Thread ckim
Hello all,

When the driver calls dma_alloc_coherent for a device, and if the device
uses iommu, is the table entry for the iommu setup for the dma_handle?

Seeing the struct device has something related to iommu, I guess so..

Any help appreciated.

Thanks!

Chan Kim

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies