Source-Changes-HG archive

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

[src/trunk]: src Implement rumpuser_sync_icache hypercall.



details:   https://anonhg.NetBSD.org/src/rev/0939f927f938
branches:  trunk
changeset: 330000:0939f927f938
user:      alnsn <alnsn%NetBSD.org@localhost>
date:      Tue Jun 17 06:31:47 2014 +0000

description:
Implement rumpuser_sync_icache hypercall.

diffstat:

 lib/librumpuser/Makefile                        |   3 +-
 lib/librumpuser/rumpuser_cache.c                |  61 +++++++++++++++++++++++++
 sys/rump/include/rump/rumpuser.h                |   7 ++-
 sys/rump/librump/rumpkern/arch/arm/Makefile.inc |   4 +-
 sys/rump/librump/rumpkern/arch/arm/cpufunc.c    |  52 +++++++++++++++++++++
 5 files changed, 124 insertions(+), 3 deletions(-)

diffs (173 lines):

diff -r 860a47ed111d -r 0939f927f938 lib/librumpuser/Makefile
--- a/lib/librumpuser/Makefile  Mon Jun 16 22:38:27 2014 +0000
+++ b/lib/librumpuser/Makefile  Tue Jun 17 06:31:47 2014 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.16 2014/02/20 00:42:27 pooka Exp $
+#      $NetBSD: Makefile,v 1.17 2014/06/17 06:31:47 alnsn Exp $
 #
 
 .include <bsd.own.mk>
@@ -20,6 +20,7 @@
 SRCS=          rumpuser.c
 SRCS+=         rumpuser_pth.c
 SRCS+=         rumpuser_component.c rumpuser_bio.c
+SRCS+=         rumpuser_cache.c
 
 SRCS+=         rumpuser_errtrans.c rumpuser_sigtrans.c
 
diff -r 860a47ed111d -r 0939f927f938 lib/librumpuser/rumpuser_cache.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/librumpuser/rumpuser_cache.c  Tue Jun 17 06:31:47 2014 +0000
@@ -0,0 +1,61 @@
+/*     $NetBSD: rumpuser_cache.c,v 1.1 2014/06/17 06:31:47 alnsn Exp $ */
+
+/*-
+ * Copyright (c) 2014 Alexander Nasonov.
+ * All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "rumpuser_port.h"
+
+#if !defined(lint)
+__RCSID("$NetBSD: rumpuser_cache.c,v 1.1 2014/06/17 06:31:47 alnsn Exp $");
+#endif /* !lint */
+
+#include <sys/types.h>
+
+#include <machine/sysarch.h>
+#include <machine/types.h>
+
+#include <rump/rumpuser.h>
+
+
+int
+rumpuser_sync_icache(void *addr, uint64_t len)
+{
+#if defined(__arm__)
+       /*
+        * arm_sync_icache is recommended over sysarch but
+        * it adds a link dependency -l${MACHINE_CPU}.
+        */
+       struct arm_sync_icache_args args;
+
+       args.addr = (uintptr_t)addr;
+       args.len = (size_t)len;
+
+       return sysarch(ARM_SYNC_ICACHE, (void *)&args);
+#else /* XXX mips_icache_sync_range */
+
+       return 0;
+#endif
+}
diff -r 860a47ed111d -r 0939f927f938 sys/rump/include/rump/rumpuser.h
--- a/sys/rump/include/rump/rumpuser.h  Mon Jun 16 22:38:27 2014 +0000
+++ b/sys/rump/include/rump/rumpuser.h  Tue Jun 17 06:31:47 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rumpuser.h,v 1.111 2014/04/27 15:18:59 pooka Exp $     */
+/*     $NetBSD: rumpuser.h,v 1.112 2014/06/17 06:31:47 alnsn Exp $     */
 
 /*
  * Copyright (c) 2007-2013 Antti Kantee.  All Rights Reserved.
@@ -229,6 +229,11 @@
 void rumpuser_dl_bootstrap(rump_modinit_fn, rump_symload_fn, rump_compload_fn);
 
 /*
+ * cache management
+ */
+int rumpuser_sync_icache(void *addr, uint64_t len);
+
+/*
  * misc management
  */
 
diff -r 860a47ed111d -r 0939f927f938 sys/rump/librump/rumpkern/arch/arm/Makefile.inc
--- a/sys/rump/librump/rumpkern/arch/arm/Makefile.inc   Mon Jun 16 22:38:27 2014 +0000
+++ b/sys/rump/librump/rumpkern/arch/arm/Makefile.inc   Tue Jun 17 06:31:47 2014 +0000
@@ -1,7 +1,9 @@
-# $NetBSD: Makefile.inc,v 1.2 2014/02/12 22:28:43 pooka Exp $
+# $NetBSD: Makefile.inc,v 1.3 2014/06/17 06:31:47 alnsn Exp $
 
 CPPFLAGS+=     -DARCH_ELFSIZE=32
 
+SRCS+=         cpufunc.c
+
 .PATH:  ${RUMPTOP}/../arch/arm/arm32
 SRCS+=         kobj_machdep.c
 
diff -r 860a47ed111d -r 0939f927f938 sys/rump/librump/rumpkern/arch/arm/cpufunc.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/rump/librump/rumpkern/arch/arm/cpufunc.c      Tue Jun 17 06:31:47 2014 +0000
@@ -0,0 +1,52 @@
+/*     $NetBSD: cpufunc.c,v 1.1 2014/06/17 06:31:47 alnsn Exp $        */
+
+/*-
+ * Copyright (c) 2014 Alexander Nasonov.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: cpufunc.c,v 1.1 2014/06/17 06:31:47 alnsn Exp $");
+
+/*
+ * Barebone implementation of arm cpufunc routines for rump.
+ */
+
+#include <machine/types.h>
+#include <arm/cpufunc.h>
+
+#include <rump/rumpuser.h>
+
+static void rump_icache_sync_range(vaddr_t, vsize_t);
+
+struct cpu_functions cpufuncs = {
+       .cf_icache_sync_range = &rump_icache_sync_range
+};
+
+static void
+rump_icache_sync_range(vaddr_t va, vsize_t sz)
+{
+
+       (void)rumpuser_sync_icache((void *)va, (uint64_t)sz);
+}



Home | Main Index | Thread Index | Old Index