On Mon, Jun 09, 2014 at 02:34:03PM +0200, Christoffer Dall wrote: > On Mon, Jun 09, 2014 at 01:39:06PM +0200, Andrew Jones wrote: > > On Mon, Jun 09, 2014 at 11:54:48AM +0200, Andrew Jones wrote: > > > On Mon, Jun 09, 2014 at 11:08:32AM +0200, Christoffer Dall wrote: > > > > On Mon, Jun 09, 2014 at 10:23:27AM +0200, Andrew Jones wrote: > > > > > On Fri, Jun 06, 2014 at 08:39:09PM +0200, Christoffer Dall wrote: > > > > > > On Thu, Apr 10, 2014 at 06:56:51PM +0200, Andrew Jones wrote: > > > > > > > Architecture neutral code may need to call low-level io accessors, > > > > > > > or use spinlocks. Create a generic io.h to ensure those accessors > > > > > > > are defined, and a generic spinlock.h that complains when included, > > > > > > > as we can't write a generic spinlock. These files can be overridden > > > > > > > or extended by architecture specific versions placed in > > > > > > > lib/$ARCH/asm/. > > > > > > > > > > > > > > Signed-off-by: Andrew Jones <drjones@xxxxxxxxxx> > > > > > > > --- > > > > > > > v4: introduce lib/asm symlink to get rid of #ifdef __arm__, > > > > > > > add spinlock.h too > > > > > > > v3: wrt to io.h (was libio.[ch]) only > > > > > > > - get rid of CONFIG_64BIT, replace with asserts > > > > > > > - get rid of {read,write}_len() [libio.c] > > > > > > > - fix bad *64_to_cpu macros > > > > > > > --- > > > > > > > .gitignore | 1 + > > > > > > > Makefile | 6 +- > > > > > > > configure | 11 ++++ > > > > > > > lib/asm-generic/io.h | 154 +++++++++++++++++++++++++++++++++++++++++++++ > > > > > > > lib/asm-generic/spinlock.h | 4 ++ > > > > > > > 5 files changed, 173 insertions(+), 3 deletions(-) > > > > > > > create mode 100644 lib/asm-generic/io.h > > > > > > > create mode 100644 lib/asm-generic/spinlock.h > > > > > > > > > > > > > > diff --git a/.gitignore b/.gitignore > > > > > > > index 775d0dfd8263e..e21939a8771e9 100644 > > > > > > > --- a/.gitignore > > > > > > > +++ b/.gitignore > > > > > > > @@ -9,6 +9,7 @@ patches > > > > > > > .stgit-* > > > > > > > cscope.* > > > > > > > *.swp > > > > > > > +/lib/asm > > > > > > > /config.mak > > > > > > > /*-run > > > > > > > /test.log > > > > > > > diff --git a/Makefile b/Makefile > > > > > > > index fba58e36f272f..51cacdac00615 100644 > > > > > > > --- a/Makefile > > > > > > > +++ b/Makefile > > > > > > > @@ -76,11 +76,11 @@ libfdt_clean: > > > > > > > $(LIBFDT_objdir)/.*.d > > > > > > > > > > > > > > distclean: clean libfdt_clean > > > > > > > - $(RM) config.mak $(TEST_DIR)-run test.log msr.out cscope.* > > > > > > > + $(RM) lib/asm config.mak $(TEST_DIR)-run test.log msr.out cscope.* > > > > > > > > > > > > > > -cscope: common_dirs = lib lib/libfdt > > > > > > > +cscope: common_dirs = lib lib/libfdt lib/asm lib/asm-generic > > > > > > > cscope: > > > > > > > $(RM) ./cscope.* > > > > > > > - find $(TEST_DIR) lib/$(TEST_DIR) $(common_dirs) -maxdepth 1 \ > > > > > > > + find -L $(TEST_DIR) lib/$(TEST_DIR) $(common_dirs) -maxdepth 1 \ > > > > > > > -name '*.[chsS]' -print | sed 's,^\./,,' > ./cscope.files > > > > > > > cscope -bk > > > > > > > diff --git a/configure b/configure > > > > > > > index 6cfc64943f6e6..8a81bf92e27b7 100755 > > > > > > > --- a/configure > > > > > > > +++ b/configure > > > > > > > @@ -95,6 +95,17 @@ if [ $exit -eq 0 ]; then > > > > > > > fi > > > > > > > rm -f lib_test.c > > > > > > > > > > > > > > +# link lib/asm for the architecture > > > > > > > +rm -f lib/asm > > > > > > > +asm=asm-generic > > > > > > > +if [ -d lib/$arch/asm ]; then > > > > > > > + asm=$arch/asm > > > > > > > +elif [ -d lib/$testdir/asm ]; then > > > > > > > + asm=$testdir/asm > > > > > > > > > > > > why do you need this elif? can you not make sure arch is always set? > > > > > > > > > > arch is always set, but there's a chance some arch may not add it's own > > > > > lib/$arch dir. It's a pretty small chance... but the elif shouldn't hurt. > > > > > > > > > If we don't have any code that uses this scheme now then let's now have > > > > Makefile rules that encourages non-standard behavior (unless I'm missing > > > > the point and this provides a 'feature' for specific archs or something > > > > like that). > > > > > > > > > > It would be something of a feature for some imaginary arch. However, as > > > that imaginary arch doesn't exist right now, then I'm fine removing it. > > > Whoever makes the imaginary arch a reality can bring it back. > > > > > > > Oh wait, it's actually not imaginary (just unused). x86 is an example of > > such a testdir that doesn't == arch. So, if either i386 or x86_64 wanted > > to use lib/asm, then they need this elif. > > > ah, ok. I'll shut up then. Before you go completely silent on it, how about an Ack? drew > -Christoffer > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majordomo@xxxxxxxxxxxxxxx > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html