mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Laura Abbott" <lauraa@codeaurora.org>
To: "Roedel, Joerg" <Joerg.Roedel@amd.com>
Cc: "Ohad Ben-Cohen" <ohad@wizery.com>,
	"iommu@lists.linux-foundation.org"
	<iommu@lists.linux-foundation.org>,
	"David Woodhouse" <dwmw2@infradead.org>,
	"Stepan Moskovchenko" <stepanm@codeaurora.org>,
	"David Brown" <davidb@codeaurora.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] iommu: Remove stub functions for !CONFIG_IOMMU_API
Date: Thu, 1 Sep 2011 17:57:06 -0700 (PDT)	[thread overview]
Message-ID: <915a03e22a061c147bb94b92a876af06.squirrel@www.codeaurora.org> (raw)
In-Reply-To: <20110831130304.GP12940@amd.com>


On Wed, August 31, 2011 6:03 am, Roedel, Joerg wrote:
> On Mon, Aug 29, 2011 at 09:21:54AM -0400, Ohad Ben-Cohen wrote:
>> On Mon, Aug 29, 2011 at 4:05 PM, Roedel, Joerg <Joerg.Roedel@amd.com>
>> wrote:
>> > So in this case you can skip this whole part when CONFIG_IOMMU_API is
>> > disabled
>>
>> Sure, we can do something like this in the driver:
>>
>> #ifdef CONFIG_IOMMU_API
>>
>> int do_the_iommu_thing(..)
>> {
>>    ... call the IOMMU API as needed...
>> }
>>
>> #else
>>
>> int do_the_iommu_thing(..)
>> {
>>     return 0;
>> }
>>
>> #endif
>>
>> Essentially, this means implementing the !CONFIG_IOMMU_API stubs in the
>> driver.
>
> I expect only very few drivers need that. Most drivers (like KVM and the
> upcoming VFIO) rely on the iommu-api and I expect most other drivers
> using the directly will also rely on an iommu. So this change makes
> still sense to me.
>

At least with MSM code, the iommu calls are abstracted through an API so
drivers don't need to know if the platform has an iommu or not.
Essentially:

if (iommu_found())
    iommu_map(...)
else
    do something else reasonable.

With this change, all code that might potentially call any iommu_map
function must exist in a separate file or face linker errors.

This idiom of having stubbed out functions is all over the kernel. I'm not
really sure what is gained by not having stubbed out versions of the
functions. There are better ways to catch users not selecting
CONFIG_IOMMU.

>> Possible of course, but I think it's a bit neater to have that in one
>> place, where all drivers can use. Similar to !CONFIG_HWSPINLOCK,
>> !CONFIG_DEBUG_FS, ...
>>
>> > This saves you even more .text size, no?
>>
>> Not sure; I expect the code to be compiled out today when the IOMMU
>> API is called and CONFIG_IOMMU_API is not set.
>
> But you even save all code that would use the iommu-api in your driver.
> This change forces you to compile out this code too leading to smaller
> .text-size.
>
> 	Joerg
>
The .text size reduction doesn't seem like it would be that great compared
to the annoyance of not having stubbed out functions.

Laura

> --
> AMD Operating System Research Center
>
> Advanced Micro Devices GmbH Einsteinring 24 85609 Dornach
> General Managers: Alberto Bozzo, Andrew Bowd
> Registration: Dornach, Landkr. Muenchen; Registerger. Muenchen, HRB Nr.
> 43632
>
> _______________________________________________
> iommu mailing list
> iommu@lists.linux-foundation.org
> https://lists.linux-foundation.org/mailman/listinfo/iommu
>


-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.



      reply	other threads:[~2011-09-02  0:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-26 13:20 Joerg Roedel
2011-08-27 11:56 ` Ohad Ben-Cohen
2011-08-29 10:15   ` Roedel, Joerg
2011-08-29 10:59     ` Ohad Ben-Cohen
2011-08-29 12:25       ` Roedel, Joerg
2011-08-29 12:55         ` Ohad Ben-Cohen
2011-08-29 13:05           ` Roedel, Joerg
2011-08-29 13:21             ` Ohad Ben-Cohen
2011-08-31 13:03               ` Roedel, Joerg
2011-09-02  0:57                 ` Laura Abbott [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=915a03e22a061c147bb94b92a876af06.squirrel@www.codeaurora.org \
    --to=lauraa@codeaurora.org \
    --cc=Joerg.Roedel@amd.com \
    --cc=davidb@codeaurora.org \
    --cc=dwmw2@infradead.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ohad@wizery.com \
    --cc=stepanm@codeaurora.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®