Re: [git pull] AMD-IOMMU (AMD-Vi) updates for 2.6.32

From: Joerg Roedel
Date: Fri Sep 04 2009 - 10:18:43 EST


On Fri, Sep 04, 2009 at 04:11:13PM +0200, Ingo Molnar wrote:
>
> * Joerg Roedel <joerg.roedel@xxxxxxx> wrote:
>
> > Hi Ingo,
> >
> > thanks for your comments.
> >
> > On Fri, Sep 04, 2009 at 03:06:45PM +0200, Ingo Molnar wrote:
> > > +static void dump_dte_entry(u16 devid)
> > > +{
> > > + int i;
> > > +
> > > + for (i = 0; i < 8; ++i)
> > > + pr_err("AMD-Vi: DTE[%d]: %08x\n", i,
> > > + amd_iommu_dev_table[devid].data[i]);
> > >
> > > that 8 is not very obvious - it deserves a comment. (we allocate at
> > > least one page to amd_iommu_dev_table[] so it's safe - but where the
> > > 8 comes from is not very clear.)
> >
> > Right. I will add a comment.
> >
> > > Also, we tend to write 'i++' not '++i' in loops. (there's other
> > > examples of this too in the iommu files)
> >
> > Ok, I use ++i for historic reasons from my old c++ times ;-) Is there a
> > specific reason i++ is prefered?
> >
> > > This log printing pattern:
> > >
> > > printk(KERN_ERR "AMD-Vi: Event logged [");
> > >
> > > switch (type) {
> > > case EVENT_TYPE_ILL_DEV:
> > > printk("ILLEGAL_DEV_TABLE_ENTRY device=%02x:%02x.%x "
> > > "address=0x%016llx flags=0x%04x]\n",
> > >
> > > is now broken (produces an unexpected newline) due to:
> > >
> > > 5fd29d6: printk: clean up handling of log-levels and newlines
> > >
> > > you probably want to convert all printk's to pr_*() calls, and use
> > > pr_cont() in the above place.
> >
> > Ok, I will chance this too.
> >
> > > Similar comments hold for dump_command() as well.
> > >
> > > +++ b/arch/x86/include/asm/amd_iommu_types.h
> > > @@ -457,4 +457,7 @@ static inline void amd_iommu_stats_init(void) {
> > > }
> > >
> > > #endif /* CONFIG_AMD_IOMMU_STATS */
> > >
> > > +/* some function prototypes */
> > > +extern void amd_iommu_reset_cmd_buffer(struct amd_iommu *iommu);
> > > +
> > >
> > > function prototypes belong into amd_iommu.h, not amd_iommu_types.h.
> >
> > The plan is to do it the other way around. Currently amd_iommu.h
> > contains the driver exported function prototypes and the
> > prototypes of functions only shared between amd_iommu_init.c and
> > amd_iommu.c. So my plan is to move the prototypes of the functions
> > only shared between the two driver source files to
> > amd_iommu_types.h. The prototypes I put into source files should
> > all be forward declarations of static functions only. Should these
> > be in header files too?
>
> Well, generally we only put data type definitions and constants into
> *_types.h files. If you need multiple include files for methods i'd
> suggest to split amd_iomm.h into two or so.

Ok, right, its better to split amd_iommu.h here then.

Joerg


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/