[Xenomai-git] Philippe Gerum : testsuite/gpio: fix output value set with direction

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: wip/drivers
Commit: 254fbdbc5340de89b732f4f599efe67d4a6ad191
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=254fbdbc5340de89b732f4f599efe67d4a6ad191

Author: Philippe Gerum 
Date:   Tue Jul 12 10:03:48 2016 +0200

testsuite/gpio: fix output value set with direction

---

 testsuite/gpiotest/gpiotest.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/testsuite/gpiotest/gpiotest.c b/testsuite/gpiotest/gpiotest.c
index c6620e1..a845ef5 100644
--- a/testsuite/gpiotest/gpiotest.c
+++ b/testsuite/gpiotest/gpiotest.c
@@ -202,7 +202,8 @@ static int run_write_value(struct smokey_test *t, int argc, 
char *const argv[])
return ret;
}
 
-   if (!__T(ret, ioctl(fd, GPIO_RTIOC_DIR_OUT)))
+   value = 1;
+   if (!__T(ret, ioctl(fd, GPIO_RTIOC_DIR_OUT, )))
return ret;

ret = write(fd, , sizeof(value));


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : drivers/gpio: add blocking read()

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: wip/drivers
Commit: 58e0f0a5ecedf9652a69bfcf0bb34fcbefcdd812
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=58e0f0a5ecedf9652a69bfcf0bb34fcbefcdd812

Author: Philippe Gerum 
Date:   Tue Jul 12 09:53:37 2016 +0200

drivers/gpio: add blocking read()

---

 include/rtdm/uapi/gpio.h|2 --
 kernel/drivers/gpio/gpio-core.c |7 +++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/include/rtdm/uapi/gpio.h b/include/rtdm/uapi/gpio.h
index 307e190..f846f48 100644
--- a/include/rtdm/uapi/gpio.h
+++ b/include/rtdm/uapi/gpio.h
@@ -18,8 +18,6 @@
 #ifndef _RTDM_UAPI_GPIO_H
 #define _RTDM_UAPI_GPIO_H
 
-#include 
-
 #define GPIO_RTIOC_DIR_OUT _IOW(RTDM_CLASS_GPIO, 0, int)
 #define GPIO_RTIOC_DIR_IN  _IO(RTDM_CLASS_GPIO, 1)
 #define GPIO_RTIOC_IRQEN   _IOW(RTDM_CLASS_GPIO, 2, int) /* GPIO 
trigger */
diff --git a/kernel/drivers/gpio/gpio-core.c b/kernel/drivers/gpio/gpio-core.c
index 6c1f351..f18d571 100644
--- a/kernel/drivers/gpio/gpio-core.c
+++ b/kernel/drivers/gpio/gpio-core.c
@@ -155,6 +155,13 @@ static ssize_t gpio_pin_read_rt(struct rtdm_fd *fd,
return -EINVAL;
 
pin = container_of(dev, struct rtdm_gpio_pin, dev);
+
+   if (!(fd->oflags & O_NONBLOCK)) {
+   ret = rtdm_event_wait(>event);
+   if (ret)
+   return ret;
+   }
+
value = gpiod_get_raw_value(pin->desc);
ret = rtdm_safe_copy_to_user(fd, buf, , sizeof(value));



___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : testsuite/gpio: illustrate select() + read() combination

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: wip/drivers
Commit: ab7001e2090465c9ffd0c4eee03ef1ab7edf8764
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=ab7001e2090465c9ffd0c4eee03ef1ab7edf8764

Author: Philippe Gerum 
Date:   Tue Jul 12 10:03:48 2016 +0200

testsuite/gpio: illustrate select() + read() combination

---

 testsuite/gpiotest/gpiotest.c |   24 +++-
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/testsuite/gpiotest/gpiotest.c b/testsuite/gpiotest/gpiotest.c
index 6e9ce5b..aeb16af 100644
--- a/testsuite/gpiotest/gpiotest.c
+++ b/testsuite/gpiotest/gpiotest.c
@@ -32,6 +32,7 @@
 smokey_test_plugin(interrupt,
   SMOKEY_ARGLIST(
   SMOKEY_STRING(device),
+  SMOKEY_BOOL(select),
   ),
"Wait for interrupts from a GPIO pin.\n"
"\tdevice=."
@@ -68,8 +69,8 @@ static int run_interrupt(struct smokey_test *t, int argc, 
char *const argv[])
{ .name = "level-high", .flag = GPIO_TRIGGER_LEVEL_HIGH },
{ NULL, 0 },
};
+   int do_select = 0, fd, ret, trigger, n, value;
const char *device = NULL, *trigname;
-   int fd, ret, trigger, n;
fd_set set;

smokey_parse_args(t, argc, argv);
@@ -88,6 +89,9 @@ static int run_interrupt(struct smokey_test *t, int argc, 
char *const argv[])
return ret;
}
 
+   if (SMOKEY_ARG_ISSET(interrupt, select))
+   do_select = SMOKEY_ARG_BOOL(interrupt, select);
+
trigger = GPIO_TRIGGER_NONE;
if (SMOKEY_ARG_ISSET(interrupt, trigger)) {
trigname = SMOKEY_ARG_STRING(interrupt, trigger);
@@ -115,13 +119,23 @@ static int run_interrupt(struct smokey_test *t, int argc, 
char *const argv[])
FD_SET(fd, );

for (;;) {
-   ret = select(fd + 1, , NULL, NULL, NULL);
+   if (do_select) {
+   ret = select(fd + 1, , NULL, NULL, NULL);
+   if (ret < 0) {
+   ret = -errno;
+   warning("failed listening to %s [%s]",
+   device, symerror(ret));
+   return ret;
+   }
+   }
+   ret = read(fd, , sizeof(value));
if (ret < 0) {
ret = -errno;
-   warning("failed listening to %s [%s]",
+   warning("failed reading from %s [%s]",
device, symerror(ret));
+   return ret;
}
-   printf("kick %d!\n", ret);
+   printf("received irq, GPIO state=%d\n", value);
}
 
close(fd);
@@ -142,7 +156,7 @@ static int run_read_value(struct smokey_test *t, int argc, 
char *const argv[])
}
 
device = SMOKEY_ARG_STRING(read_value, device);
-   fd = open(device, O_RDONLY);
+   fd = open(device, O_RDONLY|O_NONBLOCK);
if (fd < 0) {
ret = -errno;
warning("cannot open device %s [%s]",


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : drivers/gpio: fix enumeration/detection of controllers

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: wip/drivers
Commit: e862c055998aceeab3253991fcfc3dfd469dda6a
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=e862c055998aceeab3253991fcfc3dfd469dda6a

Author: Philippe Gerum 
Date:   Thu Sep 29 15:22:24 2016 +0200

drivers/gpio: fix enumeration/detection of controllers

---

 kernel/drivers/gpio/Kconfig|   18 +
 kernel/drivers/gpio/gpio-bcm2835.c |   12 +++---
 kernel/drivers/gpio/gpio-core.c|   71 +++-
 kernel/drivers/gpio/gpio-core.h|   10 -
 kernel/drivers/gpio/gpio-mxc.c |   39 ++--
 5 files changed, 89 insertions(+), 61 deletions(-)

diff --git a/kernel/drivers/gpio/Kconfig b/kernel/drivers/gpio/Kconfig
index 850127f..74c56d4 100644
--- a/kernel/drivers/gpio/Kconfig
+++ b/kernel/drivers/gpio/Kconfig
@@ -1,13 +1,17 @@
 menu "Real-time GPIO drivers"
 
 config XENO_DRIVERS_GPIO
-   tristate
+   tristate "GPIO controller"
depends on GPIOLIB
+   help
+
+   Real-time capable GPIO module.
+  
+if XENO_DRIVERS_GPIO
 
 config XENO_DRIVERS_GPIO_BCM2835
depends on MACH_BCM2708
-   select XENO_DRIVERS_GPIO
-   tristate "Support for BCM2835 GPIOs"
+   bool "Support for BCM2835 GPIOs"
help
 
Enables support for the GPIO controller available from
@@ -15,15 +19,15 @@ config XENO_DRIVERS_GPIO_BCM2835
 
 config XENO_DRIVERS_GPIO_MXC
depends on GPIO_MXC
-   select XENO_DRIVERS_GPIO
-   tristate "Support for MXC GPIOs"
+   bool "Support for MXC GPIOs"
help
 
Suitable for the GPIO controller available from
Freescale/NXP's MXC architecture.
 
 config XENO_DRIVERS_GPIO_DEBUG
-   depends on XENO_DRIVERS_GPIO
bool "Enable GPIO core debugging features"
-   
+
+endif
+
 endmenu
diff --git a/kernel/drivers/gpio/gpio-bcm2835.c 
b/kernel/drivers/gpio/gpio-bcm2835.c
index f277262..6328955 100644
--- a/kernel/drivers/gpio/gpio-bcm2835.c
+++ b/kernel/drivers/gpio/gpio-bcm2835.c
@@ -20,20 +20,18 @@
 
 #define RTDM_SUBCLASS_BCM2835  1
 
-static struct rtdm_gpio_chip bcm2835_gpio_chip;
-
 static int __init bcm2835_gpio_init(void)
 {
-   return rtdm_gpiochip_add_by_name(_gpio_chip, "bcm2708_gpio",
-RTDM_SUBCLASS_BCM2835);
+   return rtdm_gpiochip_scan_of(NULL, "brcm,bcm2835-gpio",
+RTDM_SUBCLASS_BCM2835);
 }
+module_init(bcm2835_gpio_init);
 
 static void __exit bcm2835_gpio_exit(void)
 {
-   rtdm_gpiochip_remove(_gpio_chip);
+   rtdm_gpiochip_remove_of(RTDM_SUBCLASS_BCM2835);
 }
-
-module_init(bcm2835_gpio_init);
 module_exit(bcm2835_gpio_exit);
 
 MODULE_LICENSE("GPL");
+
diff --git a/kernel/drivers/gpio/gpio-core.c b/kernel/drivers/gpio/gpio-core.c
index f18d571..5c08355 100644
--- a/kernel/drivers/gpio/gpio-core.c
+++ b/kernel/drivers/gpio/gpio-core.c
@@ -203,22 +203,23 @@ static void delete_pin_devices(struct rtdm_gpio_chip *rgc)
 {
struct rtdm_gpio_pin *pin, *n;
struct rtdm_device *dev;
+   rtdm_lockctx_t s;
 
-   rtdm_lock_get(>lock);
+   rtdm_lock_get_irqsave(>lock, s);

list_for_each_entry_safe(pin, n, >pins, next) {
list_del(>next);
-   rtdm_lock_put(>lock);
+   rtdm_lock_put_irqrestore(>lock, s);
dev = >dev;
rtdm_dev_unregister(dev);
rtdm_event_destroy(>event);
kfree(dev->label);
kfree(pin->name);
kfree(pin);
-   rtdm_lock_get(>lock);
+   rtdm_lock_get_irqsave(>lock, s);
}
 
-   rtdm_lock_put(>lock);
+   rtdm_lock_put_irqrestore(>lock, s);
 }
 
 static int create_pin_devices(struct rtdm_gpio_chip *rgc)
@@ -226,6 +227,7 @@ static int create_pin_devices(struct rtdm_gpio_chip *rgc)
struct gpio_chip *gc = rgc->gc;
struct rtdm_gpio_pin *pin;
struct rtdm_device *dev;
+   rtdm_lockctx_t s;
int n, ret;
 
for (n = gc->base; n < gc->base + gc->ngpio - 1; n++) {
@@ -252,9 +254,9 @@ static int create_pin_devices(struct rtdm_gpio_chip *rgc)
if (ret)
goto fail_register;
rtdm_event_init(>event, 0);
-   rtdm_lock_get(>lock);
+   rtdm_lock_get_irqsave(>lock, s);
list_add_tail(>next, >pins);
-   rtdm_lock_put(>lock);
+   rtdm_lock_put_irqrestore(>lock, s);
}
 
return 0;
@@ -362,8 +364,41 @@ EXPORT_SYMBOL_GPL(rtdm_gpiochip_add_by_name);
 
 #include 
 
+LIST_HEAD(rtdm_gpio_chips);
+
+static DEFINE_MUTEX(chip_lock);
+
+static int match_gpio_chip(struct gpio_chip *gc, void *data)
+{
+   struct device *dev = data;
+
+   return gc->dev == dev;
+}
+
+static int add_gpio_chip(struct gpio_chip *gc, int type)
+{
+   struct rtdm_gpio_chip *rgc;
+   int ret;
+
+   rgc = kzalloc(sizeof(*rgc), 

[Xenomai-git] Philippe Gerum : cobalt/clock: add support for devices without percpu semantics

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: wip/drivers
Commit: 596acc3ce2f77bab32bc36ec2666e79d4d5c00f4
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=596acc3ce2f77bab32bc36ec2666e79d4d5c00f4

Author: Philippe Gerum 
Date:   Wed Nov 16 20:49:47 2016 +0100

cobalt/clock: add support for devices without percpu semantics

Some clock devices have no percpu semantics. Passing a NULL affinity
mask to xnclock_register() (and cobalt_clock_register() as well) now
causes all timers for any such clock to be maintained into a single
queue xnclock_tick() will inspect exclusively regardless of the
current CPU.

---

 include/cobalt/kernel/timer.h |9 --
 kernel/cobalt/clock.c |   65 ++---
 kernel/cobalt/timer.c |   22 +-
 3 files changed, 63 insertions(+), 33 deletions(-)

diff --git a/include/cobalt/kernel/timer.h b/include/cobalt/kernel/timer.h
index 700392e..86ac7a7 100644
--- a/include/cobalt/kernel/timer.h
+++ b/include/cobalt/kernel/timer.h
@@ -311,15 +311,6 @@ static inline struct xnsched *xntimer_sched(struct xntimer 
*timer)
>q;\
})
 
-static inline xntimerq_t *xntimer_this_queue(struct xntimer *timer)
-{
-   struct xntimerdata *tmd;
-
-   tmd = xnclock_this_timerdata(xntimer_clock(timer));
-
-   return >q;
-}
-
 static inline unsigned long xntimer_gravity(struct xntimer *timer)
 {
struct xnclock *clock = xntimer_clock(timer);
diff --git a/kernel/cobalt/clock.c b/kernel/cobalt/clock.c
index a4d0df8..796358f 100644
--- a/kernel/cobalt/clock.c
+++ b/kernel/cobalt/clock.c
@@ -137,6 +137,10 @@ void xnclock_core_local_shot(struct xnsched *sched)
if (sched->status & XNINTCK)
return;
 
+   /*
+* Assume the core clock device always has percpu semantics in
+* SMP.
+*/
tmd = xnclock_this_timerdata();
h = xntimerq_head(>q);
if (h == NULL)
@@ -334,7 +338,13 @@ int xnclock_get_default_cpu(struct xnclock *clock, int cpu)
 * suggested CPU does not receive events from this device,
 * return the first one which does.  We also account for the
 * dynamic set of real-time CPUs.
+*
+* A clock device with no percpu semantics causes this routine
+* to return CPU0 unconditionally.
 */
+   if (cpumask_empty(>affinity))
+   return 0;
+   
cpumask_and(, >affinity, _cpu_affinity);
if (!cpumask_empty() && !cpumask_test_cpu(cpu, ))
cpu = cpumask_first();
@@ -620,7 +630,10 @@ static inline void cleanup_clock_proc(struct xnclock 
*clock) { }
  * @param clock The new clock to register.
  *
  * @param affinity The set of CPUs we may expect the backing clock
- * device to tick on.
+ * device to tick on. As a special case, passing a NULL affinity mask
+ * means that timer IRQs cannot be seen as percpu events, in which
+ * case all outstanding timers will be maintained into a single global
+ * queue instead of percpu timer queues.
  *
  * @coretags{secondary-only}
  */
@@ -633,14 +646,17 @@ int xnclock_register(struct xnclock *clock, const 
cpumask_t *affinity)
 
 #ifdef CONFIG_SMP
/*
-* A CPU affinity set is defined for each clock, enumerating
-* the CPUs which can receive ticks from the backing clock
-* device.  This set must be a subset of the real-time CPU
-* set.
+* A CPU affinity set may be defined for each clock,
+* enumerating the CPUs which can receive ticks from the
+* backing clock device.  When given, this set must be a
+* subset of the real-time CPU set.
 */
-   cpumask_and(>affinity, affinity, _realtime_cpus);
-   if (cpumask_empty(>affinity))
-   return -EINVAL;
+   if (affinity) {
+   cpumask_and(>affinity, affinity, _realtime_cpus);
+   if (cpumask_empty(>affinity))
+   return -EINVAL;
+   } else  /* No percpu semantics. */
+   cpumask_clear(>affinity);
 #endif
 
/* Allocate the percpu timer queue slot. */
@@ -651,7 +667,8 @@ int xnclock_register(struct xnclock *clock, const cpumask_t 
*affinity)
/*
 * POLA: init all timer slots for the new clock, although some
 * of them might remain unused depending on the CPU affinity
-* of the event source(s).
+* of the event source(s). If the clock device has no percpu
+* semantics, all timers will be queued to slot #0.
 */
for_each_online_cpu(cpu) {
tmd = xnclock_percpu_timerdata(clock, cpu);
@@ -712,18 +729,32 @@ EXPORT_SYMBOL_GPL(xnclock_deregister);
  *
  * @coretags{coreirq-only, atomic-entry}
  *
- * @note The current CPU must be part of the real-time affinity set,
- * otherwise weird things may happen.
+ * @note The current CPU must be part of the real-time affinity set
+ * unless 

[Xenomai-git] Philippe Gerum : drivers/spi: enable GPIO-based chip select

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: wip/drivers
Commit: f2d77932c737e31a3c2abce81ba00436a60ed1f6
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=f2d77932c737e31a3c2abce81ba00436a60ed1f6

Author: Philippe Gerum 
Date:   Tue Jun 28 09:58:10 2016 +0200

drivers/spi: enable GPIO-based chip select

---

 kernel/drivers/spi/spi-device.c |   38 +-
 kernel/drivers/spi/spi-device.h |1 +
 kernel/drivers/spi/spi-master.c |   18 --
 3 files changed, 38 insertions(+), 19 deletions(-)

diff --git a/kernel/drivers/spi/spi-device.c b/kernel/drivers/spi/spi-device.c
index 62482b2..08cf9b0 100644
--- a/kernel/drivers/spi/spi-device.c
+++ b/kernel/drivers/spi/spi-device.c
@@ -43,22 +43,14 @@ int rtdm_spi_add_remote_slave(struct rtdm_spi_remote_slave 
*slave,
slave->config.speed_hz = spi->max_speed_hz;
slave->config.mode = spi->mode;
slave->master = master;
-   mutex_init(>ctl_lock);

dev = >dev;
dev->driver = >driver;
dev->label = kasprintf(GFP_KERNEL, "%s/slave%d.%%d",
   dev_name(>dev),
   kmaster->bus_num);
-   if (dev->label == NULL) {
-   ret = -ENOMEM;
-   goto fail_label;
-   }
-
-   dev->device_data = master;
-   ret = rtdm_dev_register(dev);
-   if (ret)
-   goto fail_register;
+   if (dev->label == NULL)
+   return -ENOMEM;
 
if (gpio_is_valid(spi->cs_gpio))
slave->cs_gpio = spi->cs_gpio;
@@ -68,21 +60,30 @@ int rtdm_spi_add_remote_slave(struct rtdm_spi_remote_slave 
*slave,
slave->cs_gpio = kmaster->cs_gpios[spi->chip_select];
}
 
-   if (gpio_is_valid(slave->cs_gpio))
-   dev_dbg(slave_to_kdev(slave), "using CS GPIO%d\n",
-   slave->cs_gpio);
+   if (gpio_is_valid(slave->cs_gpio)) {
+   ret = gpio_request(slave->cs_gpio, dev->label);
+   if (ret)
+   goto fail;
+   slave->cs_gpiod = gpio_to_desc(slave->cs_gpio);
+   if (slave->cs_gpiod == NULL)
+   goto fail;
+   }
+   
+   mutex_init(>ctl_lock);
+
+   dev->device_data = master;
+   ret = rtdm_dev_register(dev);
+   if (ret)
+   goto fail;
 
rtdm_lock_get_irqsave(>lock, c);
list_add_tail(>next, >slaves);
rtdm_lock_put_irqrestore(>lock, c);
 
return 0;
-
-fail_register:
+fail:
kfree(dev->label);
 
-fail_label:
-
return ret;
 }
 EXPORT_SYMBOL_GPL(rtdm_spi_add_remote_slave);
@@ -93,6 +94,9 @@ void rtdm_spi_remove_remote_slave(struct 
rtdm_spi_remote_slave *slave)
struct rtdm_device *dev;
rtdm_lockctx_t c;

+   if (gpio_is_valid(slave->cs_gpio))
+   gpio_free(slave->cs_gpio);
+
mutex_destroy(>ctl_lock);
rtdm_lock_get_irqsave(>lock, c);
list_del(>next);
diff --git a/kernel/drivers/spi/spi-device.h b/kernel/drivers/spi/spi-device.h
index fcfca90..ee43c38 100644
--- a/kernel/drivers/spi/spi-device.h
+++ b/kernel/drivers/spi/spi-device.h
@@ -30,6 +30,7 @@ struct rtdm_spi_master;
 struct rtdm_spi_remote_slave {
u8 chip_select;
int cs_gpio;
+   struct gpio_desc *cs_gpiod;
struct rtdm_device dev;
struct list_head next;
struct rtdm_spi_config config;
diff --git a/kernel/drivers/spi/spi-master.c b/kernel/drivers/spi/spi-master.c
index 132a3b9..fe2ee40 100644
--- a/kernel/drivers/spi/spi-master.c
+++ b/kernel/drivers/spi/spi-master.c
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "spi-master.h"
 
 static inline
@@ -105,6 +106,7 @@ static int do_chip_select(struct rtdm_spi_remote_slave 
*slave)
 {  /* master->bus_lock held */
struct rtdm_spi_master *master = slave->master;
rtdm_lockctx_t c;
+   int state;
 
if (slave->config.speed_hz == 0)
return -EINVAL; /* Setup is missing. */
@@ -113,7 +115,11 @@ static int do_chip_select(struct rtdm_spi_remote_slave 
*slave)
rtdm_lock_get_irqsave(>lock, c);

if (master->cs != slave) {
-   master->ops->chip_select(slave, true);
+   if (gpio_is_valid(slave->cs_gpio)) {
+   state = !!(slave->config.mode & SPI_CS_HIGH);
+   gpiod_set_raw_value(slave->cs_gpiod, state);
+   } else
+   master->ops->chip_select(slave, true);
master->cs = slave;
}
 
@@ -126,10 +132,18 @@ static void do_chip_deselect(struct rtdm_spi_remote_slave 
*slave)
 {  /* master->bus_lock held */
struct rtdm_spi_master *master = slave->master;
rtdm_lockctx_t c;
+   int state;
 
rtdm_lock_get_irqsave(>lock, c);
-   master->ops->chip_select(slave, false);

[Xenomai-git] Philippe Gerum : drivers/gpio: bcm2835: look up for the right chip label

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: wip/drivers
Commit: 7c551990534ee52fb66d91ec2cd16229a005d5e5
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=7c551990534ee52fb66d91ec2cd16229a005d5e5

Author: Philippe Gerum 
Date:   Sun Jul 10 12:02:04 2016 +0200

drivers/gpio: bcm2835: look up for the right chip label

---

 kernel/drivers/gpio/gpio-bcm2835.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/drivers/gpio/gpio-bcm2835.c 
b/kernel/drivers/gpio/gpio-bcm2835.c
index 772298b..f277262 100644
--- a/kernel/drivers/gpio/gpio-bcm2835.c
+++ b/kernel/drivers/gpio/gpio-bcm2835.c
@@ -24,7 +24,7 @@ static struct rtdm_gpio_chip bcm2835_gpio_chip;
 
 static int __init bcm2835_gpio_init(void)
 {
-   return rtdm_gpiochip_add_by_name(_gpio_chip, "bcm2835_gpio",
+   return rtdm_gpiochip_add_by_name(_gpio_chip, "bcm2708_gpio",
 RTDM_SUBCLASS_BCM2835);
 }
 


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : drivers/spi: introduce real-time SPI support

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: wip/drivers
Commit: 9147f8a23eb296456175803ff2045d7f0a8c454b
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=9147f8a23eb296456175803ff2045d7f0a8c454b

Author: Philippe Gerum 
Date:   Fri Jun 17 16:28:25 2016 +0200

drivers/spi: introduce real-time SPI support

---

 include/rtdm/Makefile.am   |1 +
 include/rtdm/spi.h |   24 ++
 include/rtdm/uapi/Makefile.am  |1 +
 include/rtdm/uapi/rtdm.h   |9 +-
 include/rtdm/uapi/spi.h|   40 +++
 kernel/drivers/Kconfig |1 +
 kernel/drivers/Makefile|2 +-
 kernel/drivers/gpio/gpio-bcm2835.c |   18 +-
 kernel/drivers/spi/Kconfig |   20 ++
 kernel/drivers/spi/Makefile|8 +
 kernel/drivers/spi/spi-bcm2835.c   |  691 
 kernel/drivers/spi/spi-device.c|  180 ++
 kernel/drivers/spi/spi-device.h|   53 +++
 kernel/drivers/spi/spi-master.c|  423 ++
 kernel/drivers/spi/spi-master.h|   81 +
 15 files changed, 1535 insertions(+), 17 deletions(-)

diff --git a/include/rtdm/Makefile.am b/include/rtdm/Makefile.am
index ad2c342..df5b551 100644
--- a/include/rtdm/Makefile.am
+++ b/include/rtdm/Makefile.am
@@ -8,6 +8,7 @@ includesub_HEADERS =\
ipc.h   \
rtdm.h  \
serial.h\
+   spi.h   \
testing.h   \
udd.h
 
diff --git a/include/rtdm/spi.h b/include/rtdm/spi.h
new file mode 100644
index 000..339a862
--- /dev/null
+++ b/include/rtdm/spi.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2016 Philippe Gerum 
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
+ */
+#ifndef _RTDM_SPI_H
+#define _RTDM_SPI_H
+
+#include 
+#include 
+
+#endif /* !_RTDM_SPI_H */
diff --git a/include/rtdm/uapi/Makefile.am b/include/rtdm/uapi/Makefile.am
index d53f10c..96de2c3 100644
--- a/include/rtdm/uapi/Makefile.am
+++ b/include/rtdm/uapi/Makefile.am
@@ -8,5 +8,6 @@ includesub_HEADERS =\
ipc.h   \
rtdm.h  \
serial.h\
+   spi.h   \
testing.h   \
udd.h
diff --git a/include/rtdm/uapi/rtdm.h b/include/rtdm/uapi/rtdm.h
index c49378c..ee6de65 100644
--- a/include/rtdm/uapi/rtdm.h
+++ b/include/rtdm/uapi/rtdm.h
@@ -80,13 +80,8 @@ typedef int64_t nanosecs_rel_t;
 #define RTDM_CLASS_UDD 9
 #define RTDM_CLASS_MEMORY  10
 #define RTDM_CLASS_GPIO11
-/*
-#define RTDM_CLASS_USB ?
-#define RTDM_CLASS_FIREWIRE?
-#define RTDM_CLASS_INTERBUS?
-#define RTDM_CLASS_PROFIBUS?
-#define ...
-*/
+#define RTDM_CLASS_SPI 12
+
 #define RTDM_CLASS_MISC223
 #define RTDM_CLASS_EXPERIMENTAL224
 #define RTDM_CLASS_MAX 255
diff --git a/include/rtdm/uapi/spi.h b/include/rtdm/uapi/spi.h
new file mode 100644
index 000..45bc92d
--- /dev/null
+++ b/include/rtdm/uapi/spi.h
@@ -0,0 +1,40 @@
+/**
+ * @note Copyright (C) 2016 Philippe Gerum 
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+#ifndef _RTDM_UAPI_SPI_H
+#define _RTDM_UAPI_SPI_H
+
+#include 
+
+struct rtdm_spi_config {
+   __u32 speed_hz;
+   __u16 mode;
+   __u8 bits_per_word;
+};
+
+struct rtdm_spi_iobufs {
+   __u32 io_len;
+   __u32 i_offset;
+   __u32 o_offset;
+};
+
+#define SPI_RTIOC_SET_CONFIG   _IOW(RTDM_CLASS_SPI, 0, struct 
rtdm_spi_config)
+#define SPI_RTIOC_GET_CONFIG   

[Xenomai-git] Philippe Gerum : drivers/spi: bcm2835: drop unused variables

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: wip/drivers
Commit: 833ac2761c06ff2149b7ffd4d4e65a547c740321
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=833ac2761c06ff2149b7ffd4d4e65a547c740321

Author: Philippe Gerum 
Date:   Thu Sep 29 15:25:57 2016 +0200

drivers/spi: bcm2835: drop unused variables

---

 kernel/drivers/spi/spi-bcm2835.c |2 --
 1 file changed, 2 deletions(-)

diff --git a/kernel/drivers/spi/spi-bcm2835.c b/kernel/drivers/spi/spi-bcm2835.c
index da44bf7..e4a95d0 100644
--- a/kernel/drivers/spi/spi-bcm2835.c
+++ b/kernel/drivers/spi/spi-bcm2835.c
@@ -322,7 +322,6 @@ static ssize_t bcm2835_read(struct rtdm_spi_remote_slave 
*slave,
void *rx, size_t len)
 {
struct spi_master_bcm2835 *spim = to_master_bcm2835(slave);
-   struct spi_slave_bcm2835 *bcm = to_slave_bcm2835(slave);
 
spim->tx_len = len;
spim->rx_len = len;
@@ -336,7 +335,6 @@ static ssize_t bcm2835_write(struct rtdm_spi_remote_slave 
*slave,
 const void *tx, size_t len)
 {
struct spi_master_bcm2835 *spim = to_master_bcm2835(slave);
-   struct spi_slave_bcm2835 *bcm = to_slave_bcm2835(slave);
 
spim->tx_len = len;
spim->rx_len = len;


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : testsuite/gpio: add interrupt trigger argument

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: wip/drivers
Commit: 0d1f9dc90f8fbe70867b77b2983b6dc8fcf6627b
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=0d1f9dc90f8fbe70867b77b2983b6dc8fcf6627b

Author: Philippe Gerum 
Date:   Tue Jul 12 10:03:48 2016 +0200

testsuite/gpio: add interrupt trigger argument

---

 testsuite/gpiotest/gpiotest.c |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/testsuite/gpiotest/gpiotest.c b/testsuite/gpiotest/gpiotest.c
index aeb16af..c6620e1 100644
--- a/testsuite/gpiotest/gpiotest.c
+++ b/testsuite/gpiotest/gpiotest.c
@@ -32,10 +32,13 @@
 smokey_test_plugin(interrupt,
   SMOKEY_ARGLIST(
   SMOKEY_STRING(device),
+  SMOKEY_STRING(trigger),
   SMOKEY_BOOL(select),
   ),
"Wait for interrupts from a GPIO pin.\n"
-   "\tdevice=."
+   "\tdevice=\n"
+   "\trigger={edge[-rising/falling/both], level[-low/high]}\n"
+   "\tselect, wait on select(2)."
 );
 
 smokey_test_plugin(read_value,


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/clock: procfs: output tick count as hex value too

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: wip/drivers
Commit: 644821af26d46ecf9bbab662d8daa735802d6428
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=644821af26d46ecf9bbab662d8daa735802d6428

Author: Philippe Gerum 
Date:   Tue Nov 15 13:15:39 2016 +0100

cobalt/clock: procfs: output tick count as hex value too

---

 kernel/cobalt/clock.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/cobalt/clock.c b/kernel/cobalt/clock.c
index 647eca3..a4d0df8 100644
--- a/kernel/cobalt/clock.c
+++ b/kernel/cobalt/clock.c
@@ -508,6 +508,7 @@ void print_core_clock_status(struct xnclock *clock,
 static int clock_show(struct xnvfile_regular_iterator *it, void *data)
 {
struct xnclock *clock = xnvfile_priv(it->vfile);
+   xnticks_t now = xnclock_read_raw(clock);
 
if (clock->id >= 0) /* External clock, print id. */
xnvfile_printf(it, "%7s: %d\n", "id", 
__COBALT_CLOCK_EXT(clock->id));
@@ -519,7 +520,8 @@ static int clock_show(struct xnvfile_regular_iterator *it, 
void *data)
 
xnclock_print_status(clock, it);
 
-   xnvfile_printf(it, "%7s: %Lu\n", "ticks", xnclock_read_raw(clock));
+   xnvfile_printf(it, "%7s: %Lu (%.4Lx %.4x)\n", "ticks",
+  now, now >> 32, (u32)(now & -1U));
 
return 0;
 }


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : drivers/gpio: introduce real-time GPIO support

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: wip/drivers
Commit: b2dd3fdb4c02e68d9f7748a9b99e91732045cbf0
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=b2dd3fdb4c02e68d9f7748a9b99e91732045cbf0

Author: Philippe Gerum 
Date:   Wed May 25 10:54:22 2016 +0200

drivers/gpio: introduce real-time GPIO support

---

 configure.ac   |1 +
 include/rtdm/Makefile.am   |1 +
 include/rtdm/gpio.h|   24 +++
 include/rtdm/uapi/Makefile.am  |1 +
 include/rtdm/uapi/gpio.h   |   28 +++
 include/rtdm/uapi/rtdm.h   |1 +
 kernel/drivers/Kconfig |1 +
 kernel/drivers/Makefile|2 +-
 kernel/drivers/gpio/Kconfig|   25 +++
 kernel/drivers/gpio/Makefile   |7 +
 kernel/drivers/gpio/gpio-bcm2708.c |   39 
 kernel/drivers/gpio/gpio-core.c|  349 
 kernel/drivers/gpio/gpio-core.h|   48 +
 kernel/drivers/gpio/gpio-mxc.c |   67 +++
 14 files changed, 593 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 789a6d7..d4b7987 100644
--- a/configure.ac
+++ b/configure.ac
@@ -878,6 +878,7 @@ AC_CONFIG_FILES([ \
testsuite/Makefile \
testsuite/latency/Makefile \
testsuite/switchtest/Makefile \
+   testsuite/gpiotest/Makefile \
testsuite/smokey/Makefile \
testsuite/smokey/arith/Makefile \
testsuite/smokey/sched-quota/Makefile \
diff --git a/include/rtdm/Makefile.am b/include/rtdm/Makefile.am
index a4e6ff8..ad2c342 100644
--- a/include/rtdm/Makefile.am
+++ b/include/rtdm/Makefile.am
@@ -4,6 +4,7 @@ includesub_HEADERS =\
analogy.h   \
autotune.h  \
can.h   \
+   gpio.h  \
ipc.h   \
rtdm.h  \
serial.h\
diff --git a/include/rtdm/gpio.h b/include/rtdm/gpio.h
new file mode 100644
index 000..c61f229
--- /dev/null
+++ b/include/rtdm/gpio.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2016 Philippe Gerum 
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
+ */
+#ifndef _RTDM_GPIO_H
+#define _RTDM_GPIO_H
+
+#include 
+#include 
+
+#endif /* !_RTDM_GPIO_H */
diff --git a/include/rtdm/uapi/Makefile.am b/include/rtdm/uapi/Makefile.am
index 7cff6c2..d53f10c 100644
--- a/include/rtdm/uapi/Makefile.am
+++ b/include/rtdm/uapi/Makefile.am
@@ -4,6 +4,7 @@ includesub_HEADERS =\
analogy.h   \
autotune.h  \
can.h   \
+   gpio.h  \
ipc.h   \
rtdm.h  \
serial.h\
diff --git a/include/rtdm/uapi/gpio.h b/include/rtdm/uapi/gpio.h
new file mode 100644
index 000..b0d4899
--- /dev/null
+++ b/include/rtdm/uapi/gpio.h
@@ -0,0 +1,28 @@
+/**
+ * @note Copyright (C) 2016 Philippe Gerum 
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+#ifndef _RTDM_UAPI_GPIO_H
+#define _RTDM_UAPI_GPIO_H
+
+#include 
+
+#define GPIO_RTIOC_DIR_OUT _IOW(RTDM_CLASS_GPIO, 0, int)
+#define GPIO_RTIOC_DIR_IN  _IO(RTDM_CLASS_GPIO, 1)
+#define GPIO_RTIOC_IRQEN   _IO(RTDM_CLASS_GPIO, 2)
+#define GPIO_RTIOC_IRQDIS  _IO(RTDM_CLASS_GPIO, 3)
+
+#endif /* !_RTDM_UAPI_GPIO_H */
diff --git a/include/rtdm/uapi/rtdm.h b/include/rtdm/uapi/rtdm.h
index eed3b36..c49378c 100644
--- a/include/rtdm/uapi/rtdm.h
+++ b/include/rtdm/uapi/rtdm.h
@@ -79,6 +79,7 @@ typedef int64_t nanosecs_rel_t;
 #define RTDM_CLASS_COBALT  8
 #define RTDM_CLASS_UDD 9
 #define RTDM_CLASS_MEMORY

[Xenomai-git] Philippe Gerum : drivers/gpio: add debugging option

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: wip/drivers
Commit: bf1a5c101e93b984a0405c2f14ffd3c35fbdfce1
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=bf1a5c101e93b984a0405c2f14ffd3c35fbdfce1

Author: Philippe Gerum 
Date:   Thu Jun 23 11:57:50 2016 +0200

drivers/gpio: add debugging option

---

 kernel/drivers/gpio/Kconfig |6 +-
 kernel/drivers/gpio/gpio-core.c |3 +++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/kernel/drivers/gpio/Kconfig b/kernel/drivers/gpio/Kconfig
index 8997963..618f23a 100644
--- a/kernel/drivers/gpio/Kconfig
+++ b/kernel/drivers/gpio/Kconfig
@@ -19,7 +19,11 @@ config XENO_DRIVERS_GPIO_MXC
tristate "Support for MXC GPIOs"
help
 
-   Suitable for the GPIO controller available with
+   Suitable for the GPIO controller available from
Freescale/NXP's MXC architecture.
 
+config XENO_DRIVERS_GPIO_DEBUG
+   depends on XENO_DRIVERS_GPIO
+   bool "Enable GPIO core debugging features"
+   
 endmenu
diff --git a/kernel/drivers/gpio/gpio-core.c b/kernel/drivers/gpio/gpio-core.c
index e8a7ba1..d9863d9 100644
--- a/kernel/drivers/gpio/gpio-core.c
+++ b/kernel/drivers/gpio/gpio-core.c
@@ -15,6 +15,9 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
+#ifdef CONFIG_XENO_DRIVERS_GPIO_DEBUG
+#define DEBUG
+#endif
 #include 
 #include 
 #include 


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Jan Kiszka : testsuite/smokey: Add test case for setschedparam & Co,

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: wip/drivers
Commit: 3010b7ccae8fc2ebbfa915f4ed85897e29033546
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=3010b7ccae8fc2ebbfa915f4ed85897e29033546

Author: Jan Kiszka 
Date:   Mon Feb 29 16:54:26 2016 +0100

testsuite/smokey: Add test case for setschedparam & Co,

This performs basic checks on the correct execution of scheduling
parameter changes from primary mode.

Signed-off-by: Jan Kiszka 

---

 configure.ac  |1 +
 testsuite/smokey/Makefile.am  |1 +
 testsuite/smokey/setsched/Makefile.am |9 +++
 testsuite/smokey/setsched/setsched.c  |  137 +
 4 files changed, 148 insertions(+)

diff --git a/configure.ac b/configure.ac
index 38a1749..789a6d7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -882,6 +882,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/arith/Makefile \
testsuite/smokey/sched-quota/Makefile \
testsuite/smokey/sched-tp/Makefile \
+   testsuite/smokey/setsched/Makefile \
testsuite/smokey/rtdm/Makefile \
testsuite/smokey/vdso-access/Makefile \
testsuite/smokey/posix-cond/Makefile \
diff --git a/testsuite/smokey/Makefile.am b/testsuite/smokey/Makefile.am
index 5ade58b..b0904d2 100644
--- a/testsuite/smokey/Makefile.am
+++ b/testsuite/smokey/Makefile.am
@@ -23,6 +23,7 @@ COBALT_SUBDIRS =  \
rtdm\
sched-quota \
sched-tp\
+   setsched\
sigdebug\
timerfd \
tsc \
diff --git a/testsuite/smokey/setsched/Makefile.am 
b/testsuite/smokey/setsched/Makefile.am
new file mode 100644
index 000..8c0a59b
--- /dev/null
+++ b/testsuite/smokey/setsched/Makefile.am
@@ -0,0 +1,9 @@
+
+noinst_LIBRARIES = libsetsched.a
+
+libsetsched_a_SOURCES = setsched.c
+
+libsetsched_a_CPPFLAGS =   \
+   @XENO_USER_CFLAGS@  \
+   -I$(top_srcdir) \
+   -I$(top_srcdir)/include
diff --git a/testsuite/smokey/setsched/setsched.c 
b/testsuite/smokey/setsched/setsched.c
new file mode 100644
index 000..359f190
--- /dev/null
+++ b/testsuite/smokey/setsched/setsched.c
@@ -0,0 +1,137 @@
+/*
+ * Scheduler live-adjustment test.
+ *
+ * Copyright (c) Siemens AG 2016
+ *
+ * Authors:
+ *  Jan Kiszka 
+ *
+ * Released under the terms of GPLv2.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+smokey_test_plugin(setsched, SMOKEY_NOARGS,
+   "Validate correct application of scheduling parameters to running threads."
+);
+
+static pid_t thread_pid;
+
+static void __check_linux_schedparams(int expected_policy, int expected_prio,
+ int line)
+{
+   struct sched_param linux_param;
+   int linux_policy;
+
+   linux_policy = syscall(SYS_sched_getscheduler, thread_pid);
+   if (smokey_check_status(syscall(SYS_sched_getparam, thread_pid,
+   _param)))
+   pthread_exit((void *)(long)-EINVAL);
+
+   if (!smokey_assert(linux_policy == expected_policy) ||
+   !smokey_assert(linux_param.sched_priority == expected_prio)) {
+   smokey_warning("called from line %d", line);
+   pthread_exit((void *)(long)-EINVAL);
+   }
+}
+
+#define check_linux_schedparams(pol, prio) \
+   __check_linux_schedparams(pol, prio, __LINE__)
+
+static void __check_rt_schedparams(int expected_policy, int expected_prio,
+  int line)
+{
+   struct sched_param cobalt_param;
+   int cobalt_policy;
+
+   if (smokey_check_status(pthread_getschedparam(pthread_self(),
+ _policy,
+ _param)))
+   pthread_exit((void *)(long)-EINVAL);
+
+   if (!smokey_assert(cobalt_policy == expected_policy) ||
+   !smokey_assert(cobalt_param.sched_priority == expected_prio)) {
+   smokey_warning("called from line %d", line);
+   pthread_exit((void *)(long)-EINVAL);
+   }
+}
+
+#define check_rt_schedparams(pol, prio)\
+   __check_rt_schedparams(pol, prio, __LINE__)
+
+static void *thread_body(void *arg)
+{
+   struct cobalt_threadstat stats;
+   struct sched_param param;
+   unsigned long long msw;
+
+   thread_pid = syscall(SYS_gettid);
+
+   check_rt_schedparams(SCHED_FIFO, 1);
+   check_linux_schedparams(SCHED_FIFO, 1);
+
+   if (smokey_check_status(cobalt_thread_stat(thread_pid, )))
+   pthread_exit((void *)(long)-EINVAL);
+   msw = stats.msw;
+
+   param.sched_priority = 2;
+   if (smokey_check_status(pthread_setschedparam(pthread_self(),
+ SCHED_FIFO, )))
+   pthread_exit((void *)(long)-EINVAL);
+
+   

[Xenomai-git] Philippe Gerum : drivers/gpio: allow building as module

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: wip/drivers
Commit: bcfae2ffb73f50124247f10a0a5752f72bc53e08
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=bcfae2ffb73f50124247f10a0a5752f72bc53e08

Author: Philippe Gerum 
Date:   Sat Jun 18 15:39:52 2016 +0200

drivers/gpio: allow building as module

---

 kernel/drivers/gpio/Kconfig |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/drivers/gpio/Kconfig b/kernel/drivers/gpio/Kconfig
index 001c1bc..8997963 100644
--- a/kernel/drivers/gpio/Kconfig
+++ b/kernel/drivers/gpio/Kconfig
@@ -1,13 +1,13 @@
 menu "Real-time GPIO drivers"
 
 config XENO_DRIVERS_GPIO
-   bool
+   tristate
depends on GPIOLIB
 
 config XENO_DRIVERS_GPIO_BCM2708
depends on MACH_BCM2708
select XENO_DRIVERS_GPIO
-   bool "Support for BCM2708 GPIOs"
+   tristate "Support for BCM2708 GPIOs"
help
 
Suitable for the GPIO controller present on Broadcom's BCM2708
@@ -16,7 +16,7 @@ config XENO_DRIVERS_GPIO_BCM2708
 config XENO_DRIVERS_GPIO_MXC
depends on GPIO_MXC
select XENO_DRIVERS_GPIO
-   bool "Support for MXC GPIOs"
+   tristate "Support for MXC GPIOs"
help
 
Suitable for the GPIO controller available with


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : testsuite/spitest: add SPI test suite

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: wip/drivers
Commit: 4554fc810859b2b9066702c7d64a5762c191c4c3
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=4554fc810859b2b9066702c7d64a5762c191c4c3

Author: Philippe Gerum 
Date:   Sat Jun 25 18:55:14 2016 +0200

testsuite/spitest: add SPI test suite

---

 configure.ac  |1 +
 testsuite/Makefile.am |2 +
 testsuite/gpiotest/gpiotest.c |   31 +--
 testsuite/spitest/Makefile.am |   19 ++
 testsuite/spitest/spitest.c   |  451 +
 5 files changed, 491 insertions(+), 13 deletions(-)

diff --git a/configure.ac b/configure.ac
index d4b7987..058874a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -879,6 +879,7 @@ AC_CONFIG_FILES([ \
testsuite/latency/Makefile \
testsuite/switchtest/Makefile \
testsuite/gpiotest/Makefile \
+   testsuite/spitest/Makefile \
testsuite/smokey/Makefile \
testsuite/smokey/arith/Makefile \
testsuite/smokey/sched-quota/Makefile \
diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am
index c345472..76d108e 100644
--- a/testsuite/Makefile.am
+++ b/testsuite/Makefile.am
@@ -5,6 +5,7 @@ if XENO_COBALT
 SUBDIRS += \
clocktest   \
gpiotest\
+   spitest \
switchtest  \
xeno-test
 endif
@@ -14,5 +15,6 @@ DIST_SUBDIRS =\
gpiotest\
latency \
smokey  \
+   spitest \
switchtest  \
xeno-test
diff --git a/testsuite/gpiotest/gpiotest.c b/testsuite/gpiotest/gpiotest.c
index 65949ee..0bdd39f 100644
--- a/testsuite/gpiotest/gpiotest.c
+++ b/testsuite/gpiotest/gpiotest.c
@@ -1,19 +1,24 @@
 /*
- * Copyright (C) 2016 Philippe Gerum .
+ * Copyright (C) 2016 Philippe Gerum 
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *  
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 #include 
 #include 
diff --git a/testsuite/spitest/Makefile.am b/testsuite/spitest/Makefile.am
new file mode 100644
index 000..ccdd392
--- /dev/null
+++ b/testsuite/spitest/Makefile.am
@@ -0,0 +1,19 @@
+testdir = @XENO_TEST_DIR@
+
+CCLD = $(top_srcdir)/scripts/wrap-link.sh $(CC)
+
+test_PROGRAMS = spitest
+
+spitest_SOURCES = spitest.c
+
+spitest_CPPFLAGS = \
+   $(XENO_USER_CFLAGS) \
+   -I$(top_srcdir)/include
+
+spitest_LDFLAGS = @XENO_AUTOINIT_LDFLAGS@ $(XENO_POSIX_WRAPPERS)
+
+spitest_LDADD =\
+   ../../lib/smokey/libsmokey.la   \
+   ../../lib/@XENO_CORE_LIB@   \
+@XENO_USER_LDADD@  \
+   -lpthread -lrt
diff --git a/testsuite/spitest/spitest.c b/testsuite/spitest/spitest.c
new file mode 100644
index 000..0609bad
--- /dev/null
+++ b/testsuite/spitest/spitest.c
@@ -0,0 +1,451 @@
+/*
+ * Copyright (C) 2016 Philippe Gerum 
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of 

[Xenomai-git] Philippe Gerum : cobalt/timer: rbtree: fix inverted logic in helper testing emptiness

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: wip/drivers
Commit: ff70dfdea9e2ffcb1ad7db10c695fe5dc4aff8a0
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=ff70dfdea9e2ffcb1ad7db10c695fe5dc4aff8a0

Author: Philippe Gerum 
Date:   Tue Nov  8 16:11:03 2016 +0100

cobalt/timer: rbtree: fix inverted logic in helper testing emptiness

xntimerq_empty() was wrong in the rbtree-based implementation of the
timer management code, not detecting emptiness of timer queues.

This issue caused the debug assertion in xnclock_deregister() to
trigger when XENO_OPT_DEBUG_COBALT is enabled.

---

 include/cobalt/kernel/timer.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/cobalt/kernel/timer.h b/include/cobalt/kernel/timer.h
index f45a753..d92c8c8 100644
--- a/include/cobalt/kernel/timer.h
+++ b/include/cobalt/kernel/timer.h
@@ -163,7 +163,7 @@ typedef struct {
})
 
 #define xntimerq_destroy(q) do { } while (0)
-#define xntimerq_empty(q) ((q)->head != NULL)
+#define xntimerq_empty(q) ((q)->head == NULL)
 
 #define xntimerq_head(q) ((q)->head)
 


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : testsuite/gpiotest: add GPIO test suite

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: wip/drivers
Commit: a45d979c699a01ae7293ab2075c9db2aa6c6a204
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=a45d979c699a01ae7293ab2075c9db2aa6c6a204

Author: Philippe Gerum 
Date:   Wed Jun  1 15:59:27 2016 +0200

testsuite/gpiotest: add GPIO test suite

---

 testsuite/Makefile.am  |2 +
 testsuite/gpiotest/Makefile.am |   19 
 testsuite/gpiotest/gpiotest.c  |  188 
 3 files changed, 209 insertions(+)

diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am
index e83e6cb..c345472 100644
--- a/testsuite/Makefile.am
+++ b/testsuite/Makefile.am
@@ -4,12 +4,14 @@ SUBDIRS = latency smokey
 if XENO_COBALT
 SUBDIRS += \
clocktest   \
+   gpiotest\
switchtest  \
xeno-test
 endif
 
 DIST_SUBDIRS = \
clocktest   \
+   gpiotest\
latency \
smokey  \
switchtest  \
diff --git a/testsuite/gpiotest/Makefile.am b/testsuite/gpiotest/Makefile.am
new file mode 100644
index 000..b01427b
--- /dev/null
+++ b/testsuite/gpiotest/Makefile.am
@@ -0,0 +1,19 @@
+testdir = @XENO_TEST_DIR@
+
+CCLD = $(top_srcdir)/scripts/wrap-link.sh $(CC)
+
+test_PROGRAMS = gpiotest
+
+gpiotest_SOURCES = gpiotest.c
+
+gpiotest_CPPFLAGS =\
+   $(XENO_USER_CFLAGS) \
+   -I$(top_srcdir)/include
+
+gpiotest_LDFLAGS = @XENO_AUTOINIT_LDFLAGS@ $(XENO_POSIX_WRAPPERS)
+
+gpiotest_LDADD =   \
+   ../../lib/smokey/libsmokey.la   \
+   ../../lib/@XENO_CORE_LIB@   \
+@XENO_USER_LDADD@  \
+   -lpthread -lrt
diff --git a/testsuite/gpiotest/gpiotest.c b/testsuite/gpiotest/gpiotest.c
new file mode 100644
index 000..838f498
--- /dev/null
+++ b/testsuite/gpiotest/gpiotest.c
@@ -0,0 +1,188 @@
+/*
+ * Copyright (C) 2016 Philippe Gerum .
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+smokey_test_plugin(interrupt,
+  SMOKEY_ARGLIST(
+  SMOKEY_STRING(device),
+  ),
+   "Wait for interrupts from a GPIO pin.\n"
+   "\tdevice=."
+);
+
+smokey_test_plugin(read_value,
+  SMOKEY_ARGLIST(
+  SMOKEY_STRING(device),
+  ),
+   "Read GPIO value.\n"
+   "\tdevice=."
+);
+
+smokey_test_plugin(write_value,
+  SMOKEY_ARGLIST(
+  SMOKEY_STRING(device),
+  ),
+   "Write GPIO value.\n"
+   "\tdevice=."
+);
+
+static int run_interrupt(struct smokey_test *t, int argc, char *const argv[])
+{
+   const char *device = NULL;
+   int fd, ret;
+   fd_set set;
+   
+   smokey_parse_args(t, argc, argv);
+
+   if (!SMOKEY_ARG_ISSET(interrupt, device)) {
+   warning("missing device= specification");
+   return -EINVAL;
+   }
+
+   device = SMOKEY_ARG_STRING(interrupt, device);
+   fd = open(device, O_RDWR);
+   if (fd < 0) {
+   ret = -errno;
+   warning("cannot open device %s [%s]",
+   device, symerror(ret));
+   return ret;
+   }
+
+   ret = ioctl(fd, GPIO_RTIOC_IRQEN);
+   if (ret) {
+   ret = -errno;
+   warning("GPIO_RTIOC_IRQEN failed on %s [%s]",
+   device, symerror(ret));
+   return ret;
+   }
+
+   FD_ZERO();
+   FD_SET(fd, );
+   
+   for (;;) {
+   ret = select(fd + 1, , NULL, NULL, NULL);
+   if (ret < 0) {
+   ret = -errno;
+   warning("failed listening to %s [%s]",
+   device, symerror(ret));
+   }
+   printf("kick %d!\n", ret);
+   }
+
+   close(fd);
+
+   return 0;
+}
+
+static int run_read_value(struct smokey_test *t, int argc, char *const argv[])
+{
+   const char *device = NULL;
+   int fd, ret, value = -1;
+
+   smokey_parse_args(t, argc, argv);
+
+   if (!SMOKEY_ARG_ISSET(read_value, device)) {
+   warning("missing device= specification");
+

[Xenomai-git] Philippe Gerum : cobalt/timer: consider clock event affinity when pinning timers

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: wip/drivers
Commit: b9642fc43473d91d11a16baee1ce0b1aaa1ec1f1
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=b9642fc43473d91d11a16baee1ce0b1aaa1ec1f1

Author: Philippe Gerum 
Date:   Mon Nov 14 11:49:09 2016 +0100

cobalt/timer: consider clock event affinity when pinning timers

Pinning a timer to the same CPU than the caller is affine to must take
into account the affinity of the clock device backing the timer.

When an affinity mismatch is detected by xntimer_set_sched(), the
timer affinity is left unchanged, which will certainly cause
additional overhead due to the requirement of waking up a thread on a
remote CPU from the timer's handler, but will also keep the situation
sane.

---

 include/cobalt/kernel/timer.h |7 ++-
 kernel/cobalt/timer.c |   17 +
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/include/cobalt/kernel/timer.h b/include/cobalt/kernel/timer.h
index 6cb2bb3..700392e 100644
--- a/include/cobalt/kernel/timer.h
+++ b/include/cobalt/kernel/timer.h
@@ -546,11 +546,8 @@ static inline void xntimer_release_ipi(void) { }
 
 #endif /* CONFIG_SMP */
 
-static inline void xntimer_set_sched(struct xntimer *timer,
-struct xnsched *sched)
-{
-   xntimer_migrate(timer, sched);
-}
+bool xntimer_set_sched(struct xntimer *timer,
+  struct xnsched *sched);
 
 char *xntimer_format_time(xnticks_t ns,
  char *buf, size_t bufsz);
diff --git a/kernel/cobalt/timer.c b/kernel/cobalt/timer.c
index dd78c38..6263f5b 100644
--- a/kernel/cobalt/timer.c
+++ b/kernel/cobalt/timer.c
@@ -541,6 +541,23 @@ void __xntimer_migrate(struct xntimer *timer, struct 
xnsched *sched)
 }
 EXPORT_SYMBOL_GPL(__xntimer_migrate);
 
+bool xntimer_set_sched(struct xntimer *timer,
+  struct xnsched *sched)
+{
+   /*
+* We may deny the request if the target CPU does not receive
+* any event from the clock device backing the timer.
+*/
+   if (cpumask_test_cpu(xnsched_cpu(sched),
+_clock(timer)->affinity)) {
+   xntimer_migrate(timer, sched);
+   return true;
+   }
+
+   return false;
+}
+EXPORT_SYMBOL_GPL(xntimer_set_sched);
+
 int xntimer_setup_ipi(void)
 {
return ipipe_request_irq(_realtime_domain,


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : drivers/gpio: serialize access to per-chip pin list

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: wip/drivers
Commit: ce2f0d09067f23213ea63bf5719c0cd2692c9a5f
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=ce2f0d09067f23213ea63bf5719c0cd2692c9a5f

Author: Philippe Gerum 
Date:   Fri Jun 17 16:12:27 2016 +0200

drivers/gpio: serialize access to per-chip pin list

---

 kernel/drivers/gpio/gpio-core.c |9 +
 kernel/drivers/gpio/gpio-core.h |1 +
 2 files changed, 10 insertions(+)

diff --git a/kernel/drivers/gpio/gpio-core.c b/kernel/drivers/gpio/gpio-core.c
index 4f707b8..319d5c7 100644
--- a/kernel/drivers/gpio/gpio-core.c
+++ b/kernel/drivers/gpio/gpio-core.c
@@ -175,15 +175,21 @@ static void delete_pin_devices(struct rtdm_gpio_chip *rgc)
struct rtdm_gpio_pin *pin, *n;
struct rtdm_device *dev;
 
+   rtdm_lock_get(>lock);
+   
list_for_each_entry_safe(pin, n, >pins, next) {
list_del(>next);
+   rtdm_lock_put(>lock);
dev = >dev;
rtdm_dev_unregister(dev);
rtdm_event_destroy(>event);
kfree(dev->label);
kfree(pin->name);
kfree(pin);
+   rtdm_lock_get(>lock);
}
+
+   rtdm_lock_put(>lock);
 }
 
 static int create_pin_devices(struct rtdm_gpio_chip *rgc)
@@ -217,7 +223,9 @@ static int create_pin_devices(struct rtdm_gpio_chip *rgc)
if (ret)
goto fail_register;
rtdm_event_init(>event, 0);
+   rtdm_lock_get(>lock);
list_add_tail(>next, >pins);
+   rtdm_lock_put(>lock);
}
 
return 0;
@@ -277,6 +285,7 @@ int rtdm_gpiochip_add(struct rtdm_gpio_chip *rgc,
 
rgc->gc = gc;
INIT_LIST_HEAD(>pins);
+   rtdm_lock_init(>lock);
 
ret = create_pin_devices(rgc);
if (ret)
diff --git a/kernel/drivers/gpio/gpio-core.h b/kernel/drivers/gpio/gpio-core.h
index 3fa7867..d4dd28a 100644
--- a/kernel/drivers/gpio/gpio-core.h
+++ b/kernel/drivers/gpio/gpio-core.h
@@ -31,6 +31,7 @@ struct rtdm_gpio_chip {
struct class *devclass;
struct list_head pins;
struct list_head next;
+   rtdm_lock_t lock;
 };
 
 int rtdm_gpiochip_add(struct rtdm_gpio_chip *rgc,


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/clock: fix build issue w/ CONFIG_SMP off

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: wip/drivers
Commit: 8559d512a19a4b49fb0fc365a271627802d93c47
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=8559d512a19a4b49fb0fc365a271627802d93c47

Author: Philippe Gerum 
Date:   Fri Nov 18 19:05:19 2016 +0100

cobalt/clock: fix build issue w/ CONFIG_SMP off

---

 kernel/cobalt/clock.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/cobalt/clock.c b/kernel/cobalt/clock.c
index 796358f..61778cd 100644
--- a/kernel/cobalt/clock.c
+++ b/kernel/cobalt/clock.c
@@ -744,6 +744,7 @@ void xnclock_tick(struct xnclock *clock)
 
atomic_only();
 
+#ifdef CONFIG_SMP
/*
 * Some external clock devices may have no percpu semantics,
 * in which case all timers are queued to slot #0.
@@ -753,6 +754,7 @@ void xnclock_tick(struct xnclock *clock)
!cpumask_test_cpu(xnsched_cpu(sched), >affinity))
tmq = _percpu_timerdata(clock, 0)->q;
else
+#endif
tmq = _this_timerdata(clock)->q;

/*


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Wolfgang Grandegger : rtcan: ems_pci driver update to support more devices

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: wip/drivers
Commit: 6c03c92c496e3f719e8322c4180f865e29daa452
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=6c03c92c496e3f719e8322c4180f865e29daa452

Author: Wolfgang Grandegger 
Date:   Fri Oct 28 09:25:00 2016 +0200

rtcan: ems_pci driver update to support more devices

Hi Philippe

Am 06.10.2016 um 21:40 schrieb Philippe Gerum:
> >
> > Hi Wolfgang,
> >
> > On 10/04/2016 08:25 AM, Wolfgang Grandegger wrote:
>> >> The driver follows now more closely the corresponding Linux driver
>> >> to simplify updates in the future.
>> >>
> >
> > Any chance to have this forward ported to 3.x? Xenomai 2.6 has reached EOL.

Below is the patch for Xenomai-3. It's untested for the moment but the
changes compared with 2.6 seem not the be critical.

Wolfgang

>From 0fc42b023eb9f6f58ce3b2381a55cab74757c2a1 Mon Sep 17 00:00:00 2001
From: Wolfgang Grandegger 
Date: Fri, 28 Oct 2016 09:21:24 +0200
Subject: [PATCH] [PATCH] rtcan: ems_pci driver update to support more devices

The driver now also follows more closely the corresponding Linux
driver to simplify updates in the future.

Signed-off-by: Wolfgang Grandegger 

---

 kernel/drivers/can/sja1000/rtcan_ems_pci.c  |  487 +--
 kernel/drivers/can/sja1000/rtcan_sja1000_regs.h |1 +
 2 files changed, 281 insertions(+), 207 deletions(-)

diff --git a/kernel/drivers/can/sja1000/rtcan_ems_pci.c 
b/kernel/drivers/can/sja1000/rtcan_ems_pci.c
index be4b704..e3c178f 100644
--- a/kernel/drivers/can/sja1000/rtcan_ems_pci.c
+++ b/kernel/drivers/can/sja1000/rtcan_ems_pci.c
@@ -1,28 +1,28 @@
 /*
- * Copyright (C) 2007 Wolfgang Grandegger 
+ * Copyright (C) 2007, 2016 Wolfgang Grandegger 
+ * Copyright (C) 2008 Markus Plessing 
+ * Copyright (C) 2008 Sebastian Haas 
  *
- * Register definitions and descriptions are taken from LinCAN 0.3.3.
+ * Derived from Linux CAN SJA1000 PCI driver "ems_pci".
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the version 2 of the GNU General Public License
+ * as published by the Free Software Foundation
  *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * along with this program; if not, see .
  */
 
+#include 
 #include 
-#include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 
@@ -40,23 +40,30 @@
 static char *ems_pci_board_name = "EMS-CPC-PCI";
 
 MODULE_AUTHOR("Wolfgang Grandegger ");
-MODULE_DESCRIPTION("RTCAN board driver for EMS CPC-PCI cards");
-MODULE_SUPPORTED_DEVICE("EMS CPC-PCI card CAN controller");
-MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("RTCAN board driver for EMS CPC-PCI/PCIe/104P CAN cards");
+MODULE_SUPPORTED_DEVICE("EMS CPC-PCI/PCIe/104P CAN card");
+MODULE_LICENSE("GPL v2");
+
+#define EMS_PCI_V1_MAX_CHAN 2
+#define EMS_PCI_V2_MAX_CHAN 4
+#define EMS_PCI_MAX_CHANEMS_PCI_V2_MAX_CHAN
+
+struct ems_pci_card {
+   int version;
+   int channels;
 
-struct rtcan_ems_pci
-{
struct pci_dev *pci_dev;
-   struct rtcan_device *slave_dev;
-   int channel;
-   volatile void __iomem *base_addr;
-   volatile void __iomem *conf_addr;
+   struct rtcan_device *rtcan_dev[EMS_PCI_MAX_CHAN];
+
+   void __iomem *conf_addr;
+   void __iomem *base_addr;
 };
 
-#define EMS_PCI_MASTER 1 /* multi channel device, this device is master */
-#define EMS_PCI_SLAVE  2 /* multi channel device, this is slave */
+#define EMS_PCI_CAN_CLOCK (1600 / 2)
 
 /*
+ * Register definitions and descriptions are from LinCAN 0.3.3.
+ *
  * PSB4610 PITA-2 bridge control registers
  */
 #define PITA2_ICR   0x00   /* Interrupt Control Register */
@@ -64,7 +71,17 @@ struct rtcan_ems_pci
 #define PITA2_ICR_INT0_EN   0x0002 /* [RW] Enable INT0 */
 
 #define PITA2_MISC  0x1c   /* Miscellaneous Register */
-#define PITA2_MISC_CONFIG   0x0400 /* Multiplexed Parallel_interface_model 
*/

[Xenomai-git] Philippe Gerum : drivers/spi: introduce iobufs.map_len to expose the mapping length

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: wip/drivers
Commit: c4ab584844fe2c40336a43628489633e022aa649
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=c4ab584844fe2c40336a43628489633e022aa649

Author: Philippe Gerum 
Date:   Tue Jun 28 10:41:33 2016 +0200

drivers/spi: introduce iobufs.map_len to expose the mapping length

Overwriting iobufs.io_len for returning the length of the user-space
mapping makes no sense, since both values have different meanings
(DMA_ALIGNED(io_len) * 2 == map_len).

---

 include/rtdm/uapi/spi.h  |1 +
 kernel/drivers/spi/spi-bcm2835.c |2 +-
 testsuite/spitest/spitest.c  |4 ++--
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/include/rtdm/uapi/spi.h b/include/rtdm/uapi/spi.h
index 45bc92d..8f04237 100644
--- a/include/rtdm/uapi/spi.h
+++ b/include/rtdm/uapi/spi.h
@@ -30,6 +30,7 @@ struct rtdm_spi_iobufs {
__u32 io_len;
__u32 i_offset;
__u32 o_offset;
+   __u32 map_len;
 };
 
 #define SPI_RTIOC_SET_CONFIG   _IOW(RTDM_CLASS_SPI, 0, struct 
rtdm_spi_config)
diff --git a/kernel/drivers/spi/spi-bcm2835.c b/kernel/drivers/spi/spi-bcm2835.c
index 02ebecd..118cfd5 100644
--- a/kernel/drivers/spi/spi-bcm2835.c
+++ b/kernel/drivers/spi/spi-bcm2835.c
@@ -409,7 +409,7 @@ static int bcm2835_set_iobufs(struct rtdm_spi_remote_slave 
*slave,
 
p->i_offset = 0;
p->o_offset = bcm->io_len / 2;
-   p->io_len = bcm->io_len;
+   p->map_len = bcm->io_len;

return 0;
 }
diff --git a/testsuite/spitest/spitest.c b/testsuite/spitest/spitest.c
index 0609bad..40ef9a9 100644
--- a/testsuite/spitest/spitest.c
+++ b/testsuite/spitest/spitest.c
@@ -385,14 +385,14 @@ static int run_spi_transfer(struct smokey_test *t, int 
argc, char *const argv[])
if (!__T(ret, ioctl(fd, SPI_RTIOC_SET_IOBUFS, )))
return ret;
 
-   p = mmap(NULL, iobufs.io_len, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
+   p = mmap(NULL, iobufs.map_len, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
if (!__Fassert(p == MAP_FAILED))
return -EINVAL;

smokey_trace("input_area[%u..%u], output_area[%u..%u], mapping 
length=%u",
 iobufs.i_offset, iobufs.i_offset + TRANSFER_SIZE - 1,
 iobufs.o_offset, iobufs.o_offset + TRANSFER_SIZE - 1,
-iobufs.io_len);
+iobufs.map_len);

i_area = p + iobufs.i_offset;
o_area = p + iobufs.o_offset;


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : drivers/gpio: rename after the SoC

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: wip/drivers
Commit: 4ec9304670d7805813736728d8053c36b1282861
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=4ec9304670d7805813736728d8053c36b1282861

Author: Philippe Gerum 
Date:   Thu Jun 23 14:31:10 2016 +0200

drivers/gpio: rename after the SoC

---

 kernel/drivers/gpio/Kconfig|8 
 kernel/drivers/gpio/Makefile   |2 +-
 kernel/drivers/gpio/{gpio-bcm2708.c => gpio-bcm2835.c} |0
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/kernel/drivers/gpio/Kconfig b/kernel/drivers/gpio/Kconfig
index 618f23a..850127f 100644
--- a/kernel/drivers/gpio/Kconfig
+++ b/kernel/drivers/gpio/Kconfig
@@ -4,14 +4,14 @@ config XENO_DRIVERS_GPIO
tristate
depends on GPIOLIB
 
-config XENO_DRIVERS_GPIO_BCM2708
+config XENO_DRIVERS_GPIO_BCM2835
depends on MACH_BCM2708
select XENO_DRIVERS_GPIO
-   tristate "Support for BCM2708 GPIOs"
+   tristate "Support for BCM2835 GPIOs"
help
 
-   Suitable for the GPIO controller present on Broadcom's BCM2708
-   chip family.
+   Enables support for the GPIO controller available from
+   Broadcom's BCM2835 SoC.
 
 config XENO_DRIVERS_GPIO_MXC
depends on GPIO_MXC
diff --git a/kernel/drivers/gpio/Makefile b/kernel/drivers/gpio/Makefile
index 5d194a1..e237279 100644
--- a/kernel/drivers/gpio/Makefile
+++ b/kernel/drivers/gpio/Makefile
@@ -3,5 +3,5 @@ obj-$(CONFIG_XENO_DRIVERS_GPIO) += xeno_gpio.o
 
 xeno_gpio-y := gpio-core.o
 
-xeno_gpio-$(CONFIG_XENO_DRIVERS_GPIO_BCM2708) += gpio-bcm2708.o
+xeno_gpio-$(CONFIG_XENO_DRIVERS_GPIO_BCM2835) += gpio-bcm2835.o
 xeno_gpio-$(CONFIG_XENO_DRIVERS_GPIO_MXC) += gpio-mxc.o
diff --git a/kernel/drivers/gpio/gpio-bcm2708.c 
b/kernel/drivers/gpio/gpio-bcm2835.c
similarity index 100%
rename from kernel/drivers/gpio/gpio-bcm2708.c
rename to kernel/drivers/gpio/gpio-bcm2835.c


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/timer: fixup CPU affinity mismatch at init

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: wip/drivers
Commit: 9b8d7c947089dfb0b3ca4b6f1e17a989ddc9a3e4
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=9b8d7c947089dfb0b3ca4b6f1e17a989ddc9a3e4

Author: Philippe Gerum 
Date:   Sat Nov 12 11:56:09 2016 +0100

cobalt/timer: fixup CPU affinity mismatch at init

Since recently, POSIX timers can be backed by external clock
devices. Unlike the core clock, some of those devices may be ticking
only on a restricted set of CPUs, compared to the broader real-time
CPU set. This may lead to an affinity mismatch between a thread
creating a timer, and the CPU set that can receive timer events from
the backing device.

When this happens, warning on detecting such issue while initializing
the timer without fixing up the situation is not of a great help.

It is better to pick a CPU which is a member of the clock affinity set
and make such timer affine to it instead. In such a case, the overhead
induced by rescheduling a remote thread upon timer expiry is
acceptable compared to leaving a thread waiting indefinitely for timer
events that will never come.

---

 include/cobalt/kernel/timer.h |2 --
 kernel/cobalt/sched.c |6 +++---
 kernel/cobalt/thread.c|2 --
 kernel/cobalt/timer.c |   30 --
 4 files changed, 11 insertions(+), 29 deletions(-)

diff --git a/include/cobalt/kernel/timer.h b/include/cobalt/kernel/timer.h
index d92c8c8..6cb2bb3 100644
--- a/include/cobalt/kernel/timer.h
+++ b/include/cobalt/kernel/timer.h
@@ -56,8 +56,6 @@ typedef enum xntmode {
 #define XNTIMER_GRAVITY_MASK   (XNTIMER_KGRAVITY|XNTIMER_UGRAVITY)
 #define XNTIMER_INIT_MASK  (XNTIMER_GRAVITY_MASK|XNTIMER_NOBLCK)
 
-#define __XNTIMER_CORE0x1000
-
 /* These flags are available to the real-time interfaces */
 #define XNTIMER_SPARE0  0x0100
 #define XNTIMER_SPARE1  0x0200
diff --git a/kernel/cobalt/sched.c b/kernel/cobalt/sched.c
index 7cb91a5..cbe14bd 100644
--- a/kernel/cobalt/sched.c
+++ b/kernel/cobalt/sched.c
@@ -194,11 +194,11 @@ void xnsched_init(struct xnsched *sched, int cpu)
 * exit code.
 */
xntimer_init(>htimer, , NULL,
-sched, XNTIMER_IGRAVITY|__XNTIMER_CORE);
+sched, XNTIMER_IGRAVITY);
xntimer_set_priority(>htimer, XNTIMER_LOPRIO);
xntimer_set_name(>htimer, htimer_name);
xntimer_init(>rrbtimer, , roundrobin_handler,
-sched, XNTIMER_IGRAVITY|__XNTIMER_CORE);
+sched, XNTIMER_IGRAVITY);
xntimer_set_name(>rrbtimer, rrbtimer_name);
xntimer_set_priority(>rrbtimer, XNTIMER_LOPRIO);
 
@@ -213,7 +213,7 @@ void xnsched_init(struct xnsched *sched, int cpu)
 
 #ifdef CONFIG_XENO_OPT_WATCHDOG
xntimer_init(>wdtimer, , watchdog_handler,
-sched, XNTIMER_NOBLCK|XNTIMER_IGRAVITY|__XNTIMER_CORE);
+sched, XNTIMER_NOBLCK|XNTIMER_IGRAVITY);
xntimer_set_name(>wdtimer, "[watchdog]");
xntimer_set_priority(>wdtimer, XNTIMER_LOPRIO);
 #endif /* CONFIG_XENO_OPT_WATCHDOG */
diff --git a/kernel/cobalt/thread.c b/kernel/cobalt/thread.c
index fb856a4..34eca35 100644
--- a/kernel/cobalt/thread.c
+++ b/kernel/cobalt/thread.c
@@ -209,8 +209,6 @@ int __xnthread_init(struct xnthread *thread,
init_completion(>exited);
 
gravity = flags & XNUSER ? XNTIMER_UGRAVITY : XNTIMER_KGRAVITY;
-   if (flags & XNROOT)
-   gravity |= __XNTIMER_CORE;
xntimer_init(>rtimer, , timeout_handler,
 sched, gravity);
xntimer_set_name(>rtimer, thread->name);
diff --git a/kernel/cobalt/timer.c b/kernel/cobalt/timer.c
index 3563636..dd78c38 100644
--- a/kernel/cobalt/timer.c
+++ b/kernel/cobalt/timer.c
@@ -349,29 +349,15 @@ void __xntimer_init(struct xntimer *timer,
timer->handler = handler;
timer->interval_ns = 0;
/*
-* Timers are affine to a real-time CPU. If no affinity was
-* specified, assign the timer to the first possible CPU which
-* can receive interrupt events from the clock device attached
-* to the reference clock for this timer.
+* Unlike common IRQs, timer events are per-CPU by design. If
+* the CPU the caller is affine to does not receive timer
+* events, or no affinity was specified (i.e. sched == NULL),
+* assign the timer to the first possible CPU which can
+* receive interrupt events from the clock device backing this
+* timer.
 */
-   if (sched) {
-   /*
-* Complain loudly if no tick is expected from the
-* clock device on the CPU served by the specified
-* scheduler slot. This reveals a CPU affinity
-* mismatch between the clock hardware and the client
-* code initializing the timer. This check excludes
-* core timers which may have their own 

[Xenomai-git] Philippe Gerum : drivers/gpio: allow setting trigger type w/ GPIO_RTIOC_IRQEN

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: wip/drivers
Commit: cb10960b91a8a935342779211d62d8387a89c596
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=cb10960b91a8a935342779211d62d8387a89c596

Author: Philippe Gerum 
Date:   Tue Jun 28 12:16:02 2016 +0200

drivers/gpio: allow setting trigger type w/ GPIO_RTIOC_IRQEN

---

 include/rtdm/uapi/gpio.h|9 -
 kernel/drivers/gpio/gpio-core.c |   31 +++
 testsuite/gpiotest/gpiotest.c   |   34 +++---
 3 files changed, 66 insertions(+), 8 deletions(-)

diff --git a/include/rtdm/uapi/gpio.h b/include/rtdm/uapi/gpio.h
index b0d4899..307e190 100644
--- a/include/rtdm/uapi/gpio.h
+++ b/include/rtdm/uapi/gpio.h
@@ -22,7 +22,14 @@
 
 #define GPIO_RTIOC_DIR_OUT _IOW(RTDM_CLASS_GPIO, 0, int)
 #define GPIO_RTIOC_DIR_IN  _IO(RTDM_CLASS_GPIO, 1)
-#define GPIO_RTIOC_IRQEN   _IO(RTDM_CLASS_GPIO, 2)
+#define GPIO_RTIOC_IRQEN   _IOW(RTDM_CLASS_GPIO, 2, int) /* GPIO 
trigger */
 #define GPIO_RTIOC_IRQDIS  _IO(RTDM_CLASS_GPIO, 3)
 
+#define GPIO_TRIGGER_NONE  0x0 /* unspecified */
+#define GPIO_TRIGGER_EDGE_RISING   0x1
+#define GPIO_TRIGGER_EDGE_FALLING  0x2
+#define GPIO_TRIGGER_LEVEL_HIGH0x4
+#define GPIO_TRIGGER_LEVEL_LOW 0x8
+#define GPIO_TRIGGER_MASK  0xf
+
 #endif /* !_RTDM_UAPI_GPIO_H */
diff --git a/kernel/drivers/gpio/gpio-core.c b/kernel/drivers/gpio/gpio-core.c
index e8a7ba1..6c1f351 100644
--- a/kernel/drivers/gpio/gpio-core.c
+++ b/kernel/drivers/gpio/gpio-core.c
@@ -44,10 +44,20 @@ static int gpio_pin_interrupt(rtdm_irq_t *irqh)
return RTDM_IRQ_HANDLED;
 }
 
-static int request_gpio_irq(unsigned int gpio, struct rtdm_gpio_pin *pin)
+static int request_gpio_irq(unsigned int gpio, struct rtdm_gpio_pin *pin,
+   int trigger)
 {
+   static const int trigger_flags[] = {
+   IRQ_TYPE_EDGE_RISING,
+   IRQ_TYPE_EDGE_FALLING,
+   IRQ_TYPE_LEVEL_HIGH,
+   IRQ_TYPE_LEVEL_LOW,
+   };
+   int irq_trigger, ret;
unsigned int irq;
-   int ret;
+
+   if (trigger & ~GPIO_TRIGGER_MASK)
+   return -EINVAL;
 
ret = gpio_request(gpio, pin->name);
if (ret) {
@@ -66,6 +76,15 @@ static int request_gpio_irq(unsigned int gpio, struct 
rtdm_gpio_pin *pin)
 
rtdm_event_clear(>event);
irq = gpio_to_irq(gpio);
+   /*
+* Assumes GPIO_TRIGGER_xx values are forming a continuous
+* sequence of bits starting at bit #0.
+*/
+   if (trigger) {
+   irq_trigger = trigger_flags[ffs(trigger) - 1];
+   irq_set_irq_type(irq, irq_trigger);
+   }
+   
ret = rtdm_irq_request(>irqh, irq, gpio_pin_interrupt,
   0, pin->name, pin);
if (ret) {
@@ -93,8 +112,8 @@ static int gpio_pin_ioctl_nrt(struct rtdm_fd *fd,
 {
struct rtdm_device *dev = rtdm_fd_device(fd);
unsigned int gpio = rtdm_fd_minor(fd);
+   int ret = 0, val, trigger;
struct rtdm_gpio_pin *pin;
-   int ret = 0, val;

pin = container_of(dev, struct rtdm_gpio_pin, dev);
 
@@ -109,7 +128,11 @@ static int gpio_pin_ioctl_nrt(struct rtdm_fd *fd,
ret = gpio_direction_input(gpio);
break;
case GPIO_RTIOC_IRQEN:
-   ret = request_gpio_irq(gpio, pin);
+   ret = rtdm_safe_copy_from_user(fd, ,
+  arg, sizeof(trigger));
+   if (ret)
+   return ret;
+   ret = request_gpio_irq(gpio, pin, trigger);
break;
case GPIO_RTIOC_IRQDIS:
release_gpio_irq(gpio, pin);
diff --git a/testsuite/gpiotest/gpiotest.c b/testsuite/gpiotest/gpiotest.c
index 0bdd39f..6e9ce5b 100644
--- a/testsuite/gpiotest/gpiotest.c
+++ b/testsuite/gpiotest/gpiotest.c
@@ -55,8 +55,21 @@ smokey_test_plugin(write_value,
 
 static int run_interrupt(struct smokey_test *t, int argc, char *const argv[])
 {
-   const char *device = NULL;
-   int fd, ret;
+   static struct {
+   const char *name;
+   int flag;
+   } trigger_types[] = {
+   { .name = "edge", .flag = GPIO_TRIGGER_EDGE_RISING },
+   { .name = "edge-rising", .flag = GPIO_TRIGGER_EDGE_RISING },
+   { .name = "edge-falling", .flag = GPIO_TRIGGER_EDGE_FALLING },
+   { .name = "edge-both", .flag = 
GPIO_TRIGGER_EDGE_FALLING|GPIO_TRIGGER_EDGE_RISING },
+   { .name = "level", .flag = GPIO_TRIGGER_LEVEL_LOW },
+   { .name = "level-low", .flag = GPIO_TRIGGER_LEVEL_LOW },
+   { .name = "level-high", .flag = GPIO_TRIGGER_LEVEL_HIGH },
+   { NULL, 0 },
+   };
+   const char *device = NULL, *trigname;
+   int fd, ret, trigger, n;

[Xenomai-git] Philippe Gerum : boilerplate: drop __real_main() wrapper

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: wip/drivers
Commit: bc8afd4291cbf1ececf868f4e57feb5cf3f73a0b
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=bc8afd4291cbf1ececf868f4e57feb5cf3f73a0b

Author: Philippe Gerum 
Date:   Wed Nov  9 11:25:30 2016 +0100

boilerplate: drop __real_main() wrapper

Such kind of wrappers is supposed to help when --wrap is not given at
link time, in resolving direct references to the real symbols such as
those which may be done from the __wrap routines.

This said, __real_main() is special, in that there is no reason to
call such routine explicitly if --wrap is not given, by
definition. Only the bootstrap module (init/bootstrap.c) may call the
real main() entry point this way, and such module is glued to the
executable only if --wrap is passed to the linker.

Therefore we may drop this particular wrapper and the file which only
contains it altogether.

---

 lib/boilerplate/Makefile.am |3 +--
 lib/boilerplate/wrappers.c  |   27 ---
 2 files changed, 1 insertion(+), 29 deletions(-)

diff --git a/lib/boilerplate/Makefile.am b/lib/boilerplate/Makefile.am
index 4176c6d..9b8612d 100644
--- a/lib/boilerplate/Makefile.am
+++ b/lib/boilerplate/Makefile.am
@@ -8,8 +8,7 @@ libboilerplate_la_SOURCES = \
hash.c  \
obstack.c   \
setup.c \
-   time.c  \
-   wrappers.c
+   time.c
 
 if XENO_DEBUG
 libboilerplate_la_SOURCES += debug.c
diff --git a/lib/boilerplate/wrappers.c b/lib/boilerplate/wrappers.c
deleted file mode 100644
index 9d2490c..000
--- a/lib/boilerplate/wrappers.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2013 Philippe Gerum .
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
-
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
- */
-#include 
-
-int main(int argc, char *const argv[]);
-
-int __real_main(int argc, char *const argv[]);
-
-__weak int __real_main(int argc, char *const argv[])
-{
-   return main(argc, argv);
-}


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : scripts/xeno-config: fix include directory chain in compat mode

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: wip/drivers
Commit: a3fb5d8e7ad19b13cc04ccaa9a031491d881f15c
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=a3fb5d8e7ad19b13cc04ccaa9a031491d881f15c

Author: Philippe Gerum 
Date:   Fri Sep 30 15:38:21 2016 +0200

scripts/xeno-config: fix include directory chain in compat mode

== Wrong include chain:
. /install/xenomai/cobalt/pthread.h
.. /install/xenomai/trank/posix/pthread.h
... /usr/include/pthread.h

== Right include chain:
. /install/xenomai/trank/posix/pthread.h
.. /install/xenomai/cobalt/pthread.h
... /usr/include/pthread.h

Fix the order the -I directives are emitted by --cflags --compat
accordingly.

---

 scripts/xeno-config-cobalt.in |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/xeno-config-cobalt.in b/scripts/xeno-config-cobalt.in
index 802b778..62c1f33 100644
--- a/scripts/xeno-config-cobalt.in
+++ b/scripts/xeno-config-cobalt.in
@@ -213,7 +213,7 @@ if test x$do_cflags = xy; then
 for skin in $skin_list; do
case "$skin" in
posix|rtdm)
-   test x$compat = xy && cflags="$cflags 
-I$XENO_INCLUDE_DIR/trank/posix"
+   test x$compat = xy && cflags="-I$XENO_INCLUDE_DIR/trank/posix 
$cflags"
cflags="$cflags -D__COBALT_WRAP__"
;;
cobalt)


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : drivers/spi: fix read/write transfer descriptor

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: wip/drivers
Commit: 58e04fba6cb264074a3427e931b7d32778f0db25
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=58e04fba6cb264074a3427e931b7d32778f0db25

Author: Philippe Gerum 
Date:   Wed Aug 10 10:14:28 2016 +0200

drivers/spi: fix read/write transfer descriptor

---

 kernel/drivers/spi/spi-bcm2835.c |   18 ++
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/kernel/drivers/spi/spi-bcm2835.c b/kernel/drivers/spi/spi-bcm2835.c
index 117cf38..da44bf7 100644
--- a/kernel/drivers/spi/spi-bcm2835.c
+++ b/kernel/drivers/spi/spi-bcm2835.c
@@ -324,13 +324,10 @@ static ssize_t bcm2835_read(struct rtdm_spi_remote_slave 
*slave,
struct spi_master_bcm2835 *spim = to_master_bcm2835(slave);
struct spi_slave_bcm2835 *bcm = to_slave_bcm2835(slave);
 
-   if (bcm->io_len == 0)
-   return -EINVAL; /* No I/O buffers set. */
-   
-   spim->tx_len = bcm->io_len / 2;
-   spim->rx_len = spim->tx_len;
+   spim->tx_len = len;
+   spim->rx_len = len;
spim->tx_buf = NULL;
-   spim->rx_buf = bcm->io_virt;
+   spim->rx_buf = rx;
 
return do_transfer_irq(slave) ?: len;
 }
@@ -341,12 +338,9 @@ static ssize_t bcm2835_write(struct rtdm_spi_remote_slave 
*slave,
struct spi_master_bcm2835 *spim = to_master_bcm2835(slave);
struct spi_slave_bcm2835 *bcm = to_slave_bcm2835(slave);
 
-   if (bcm->io_len == 0)
-   return -EINVAL; /* No I/O buffers set. */
-   
-   spim->tx_len = bcm->io_len / 2;
-   spim->rx_len = spim->tx_len;
-   spim->tx_buf = bcm->io_virt + bcm->io_len / 2;
+   spim->tx_len = len;
+   spim->rx_len = len;
+   spim->tx_buf = tx;
spim->rx_buf = NULL;
 
return do_transfer_irq(slave) ?: len;


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/rtdm: device: allow switching device class back to default

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: wip/drivers
Commit: 118db7bca9151b12fd737ee40ff3485109336eaf
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=118db7bca9151b12fd737ee40ff3485109336eaf

Author: Philippe Gerum 
Date:   Wed Nov  9 12:48:27 2016 +0100

cobalt/rtdm: device: allow switching device class back to default

Passing NULL to rtdm_drv_set_sysclass() is now allowed, to switch a
driver back to creating devices into the default "rtdm" class.

---

 kernel/cobalt/rtdm/device.c |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/kernel/cobalt/rtdm/device.c b/kernel/cobalt/rtdm/device.c
index d0df7fa..b174c1b 100644
--- a/kernel/cobalt/rtdm/device.c
+++ b/kernel/cobalt/rtdm/device.c
@@ -575,7 +575,9 @@ EXPORT_SYMBOL_GPL(rtdm_dev_unregister);
  *
  * @param[in] drv Address of the RTDM driver descriptor.
  *
- * @param[in] cls Pointer to the kernel device class.
+ * @param[in] cls Pointer to the kernel device class. NULL is allowed
+ * to clear a previous setting, switching back to the default "rtdm"
+ * device class.
  *
  * @return 0 on success, otherwise:
  *
@@ -592,7 +594,8 @@ EXPORT_SYMBOL_GPL(rtdm_dev_unregister);
  */
 int rtdm_drv_set_sysclass(struct rtdm_driver *drv, struct class *cls)
 {
-   if (drv->profile_info.kdev_class || atomic_read(>refcount))
+   if ((cls && drv->profile_info.kdev_class) ||
+   atomic_read(>refcount))
return -EBUSY;
 
drv->profile_info.kdev_class = cls;


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/posix/timer: allow usage with external clocks

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: wip/drivers
Commit: e6cd9610215b06ee85272f57702354a7e38b5f7c
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=e6cd9610215b06ee85272f57702354a7e38b5f7c

Author: Philippe Gerum 
Date:   Fri Nov  4 16:25:15 2016 +0100

cobalt/posix/timer: allow usage with external clocks

There is no reason to restrict usage of POSIX timers to the standard
POSIX clocks, given that Cobalt allows registering user-defined
clocks, and nothing in the implementation assumes a specific clock
driving such timers.

---

 kernel/cobalt/posix/clock.c |   23 +++
 kernel/cobalt/posix/clock.h |   22 +-
 kernel/cobalt/posix/timer.c |   19 +++
 3 files changed, 39 insertions(+), 25 deletions(-)

diff --git a/kernel/cobalt/posix/clock.c b/kernel/cobalt/posix/clock.c
index b51cb4c..8dab55b 100644
--- a/kernel/cobalt/posix/clock.c
+++ b/kernel/cobalt/posix/clock.c
@@ -349,3 +349,26 @@ void cobalt_clock_deregister(struct xnclock *clock)
xnclock_deregister(clock);
 }
 EXPORT_SYMBOL_GPL(cobalt_clock_deregister);
+
+struct xnclock *cobalt_clock_find(clockid_t clock_id)
+{
+   struct xnclock *clock = ERR_PTR(-EINVAL);
+   spl_t s;
+   int nr;
+
+   if (clock_id == CLOCK_MONOTONIC ||
+   clock_id == CLOCK_MONOTONIC_RAW ||
+   clock_id == CLOCK_REALTIME)
+   return 
+   
+   if (__COBALT_CLOCK_EXT_P(clock_id)) {
+   nr = __COBALT_CLOCK_EXT_INDEX(clock_id);
+   xnlock_get_irqsave(, s);
+   if (test_bit(nr, cobalt_clock_extids))
+   clock = external_clocks[nr];
+   xnlock_put_irqrestore(, s);
+   }
+
+   return clock;
+}
+EXPORT_SYMBOL_GPL(cobalt_clock_find);
diff --git a/kernel/cobalt/posix/clock.h b/kernel/cobalt/posix/clock.h
index 82cb0b6..c77c3a5 100644
--- a/kernel/cobalt/posix/clock.h
+++ b/kernel/cobalt/posix/clock.h
@@ -26,6 +26,8 @@
 
 #define ONE_BILLION 10
 
+struct xnclock;
+
 static inline void ns2ts(struct timespec *ts, xnticks_t nsecs)
 {
ts->tv_sec = xnclock_divrem_billion(nsecs, >tv_nsec);
@@ -68,21 +70,13 @@ static inline xnticks_t clock_get_ticks(clockid_t clock_id)
 
 static inline int clock_flag(int flag, clockid_t clock_id)
 {
-   switch(flag & TIMER_ABSTIME) {
-   case 0:
+   if ((flag & TIMER_ABSTIME) == 0)
return XN_RELATIVE;
 
-   case TIMER_ABSTIME:
-   switch(clock_id) {
-   case CLOCK_MONOTONIC:
-   case CLOCK_MONOTONIC_RAW:
-   return XN_ABSOLUTE;
-
-   case CLOCK_REALTIME:
-   return XN_REALTIME;
-   }
-   }
-   return -EINVAL;
+   if (clock_id == CLOCK_REALTIME)
+   return XN_REALTIME;
+
+   return XN_ABSOLUTE;
 }
 
 int __cobalt_clock_getres(clockid_t clock_id,
@@ -118,6 +112,8 @@ int cobalt_clock_register(struct xnclock *clock,
 
 void cobalt_clock_deregister(struct xnclock *clock);
 
+struct xnclock *cobalt_clock_find(clockid_t clock_id);
+
 extern DECLARE_BITMAP(cobalt_clock_extids, COBALT_MAX_EXTCLOCKS);
 
 #endif /* !_COBALT_POSIX_CLOCK_H */
diff --git a/kernel/cobalt/posix/timer.c b/kernel/cobalt/posix/timer.c
index cf1c919..c6190d1 100644
--- a/kernel/cobalt/posix/timer.c
+++ b/kernel/cobalt/posix/timer.c
@@ -47,6 +47,7 @@ timer_init(struct cobalt_timer *timer,
   const struct sigevent *__restrict__ evp) /* nklocked, IRQs off. */
 {
struct cobalt_thread *owner = cobalt_current_thread(), *target = NULL;
+   struct xnclock *clock;
 
/*
 * First, try to offload this operation to the extended
@@ -59,14 +60,8 @@ timer_init(struct cobalt_timer *timer,
/*
 * Ok, we have no extension available, or we do but it does
 * not want to overload the standard behavior: handle this
-* timer the pure Cobalt way then. We only know about standard
-* clocks in this case.
+* timer the pure Cobalt way then.
 */
-   if (timer->clockid != CLOCK_MONOTONIC &&
-   timer->clockid != CLOCK_MONOTONIC_RAW &&
-   timer->clockid != CLOCK_REALTIME)
-   return ERR_PTR(-EINVAL);
-
if (evp == NULL || evp->sigev_notify == SIGEV_NONE) {
target = owner; /* Assume SIGEV_THREAD_ID. */
goto init;
@@ -83,11 +78,11 @@ timer_init(struct cobalt_timer *timer,
if (target == NULL)
return ERR_PTR(-EINVAL);
 init:
-   /*
-* All standard clocks are based on the core clock, and we
-* want to deliver a signal when a timer elapses.
-*/
-   xntimer_init(>timerbase, , cobalt_timer_handler,
+   clock = cobalt_clock_find(timer->clockid);
+   if (IS_ERR(clock))
+   return ERR_PTR(PTR_ERR(clock));
+
+   xntimer_init(>timerbase, clock, cobalt_timer_handler,
 target->threadbase.sched, 

[Xenomai-git] Philippe Gerum : testsuite/gpiotest: set GPIO direction

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: wip/drivers
Commit: be34d0cdac4174121b3bddc2059a5b6d03b18054
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=be34d0cdac4174121b3bddc2059a5b6d03b18054

Author: Philippe Gerum 
Date:   Sat Jun 25 18:53:36 2016 +0200

testsuite/gpiotest: set GPIO direction

---

 testsuite/gpiotest/gpiotest.c |6 ++
 1 file changed, 6 insertions(+)

diff --git a/testsuite/gpiotest/gpiotest.c b/testsuite/gpiotest/gpiotest.c
index 838f498..65949ee 100644
--- a/testsuite/gpiotest/gpiotest.c
+++ b/testsuite/gpiotest/gpiotest.c
@@ -117,6 +117,9 @@ static int run_read_value(struct smokey_test *t, int argc, 
char *const argv[])
return ret;
}
 
+   if (!__T(ret, ioctl(fd, GPIO_RTIOC_DIR_IN)))
+   return ret;
+
ret = read(fd, , sizeof(value));
close(fd);
 
@@ -149,6 +152,9 @@ static int run_write_value(struct smokey_test *t, int argc, 
char *const argv[])
return ret;
}
 
+   if (!__T(ret, ioctl(fd, GPIO_RTIOC_DIR_OUT)))
+   return ret;
+   
ret = write(fd, , sizeof(value));
close(fd);
 


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/posix/clock: uapi: strengthen test for external clock ids

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: wip/drivers
Commit: 3e8a9fd398b98482e989b97d4fd721fbff868ecd
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=3e8a9fd398b98482e989b97d4fd721fbff868ecd

Author: Philippe Gerum 
Date:   Fri Nov 11 10:52:40 2016 +0100

cobalt/posix/clock: uapi: strengthen test for external clock ids

__COBALT_CLOCK_EXT_P() was way too weak in filtering out invalid clock
ids, also returning a true value for identifiers being obviously out
of range although bit #6 is raised.

This would cause all clock* services depending on such detection to
crash badly due to using bad index values determined from invalid
clock ids they should never have considered in the first place.

The test is strengthened by comparing the clock identifier to the
valid range explicitly, i.e. [ 64...127 ] inclusive.

---

 include/cobalt/uapi/time.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/cobalt/uapi/time.h b/include/cobalt/uapi/time.h
index 4a3679b..411baf5 100644
--- a/include/cobalt/uapi/time.h
+++ b/include/cobalt/uapi/time.h
@@ -41,7 +41,7 @@
 #define COBALT_MAX_EXTCLOCKS  64
 
 #define __COBALT_CLOCK_EXT(nr) ((clockid_t)(nr) | (1 << 6))
-#define __COBALT_CLOCK_EXT_P(id)   ((int)(id) & (1 << 6))
+#define __COBALT_CLOCK_EXT_P(id)   ((int)(id) >= 64 && (int)(id) < 128)
 #define __COBALT_CLOCK_EXT_INDEX(id)   ((int)(id) & ~(1 << 6))
 
 /*


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/timer: fix build issue w/ CONFIG_SMP off

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: wip/drivers
Commit: 15620f7d298889ac6ba9da11ea1bbf70b6065e94
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=15620f7d298889ac6ba9da11ea1bbf70b6065e94

Author: Philippe Gerum 
Date:   Sat Nov 19 11:14:55 2016 +0100

cobalt/timer: fix build issue w/ CONFIG_SMP off

---

 include/cobalt/kernel/timer.h |   12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/include/cobalt/kernel/timer.h b/include/cobalt/kernel/timer.h
index 86ac7a7..3c75354 100644
--- a/include/cobalt/kernel/timer.h
+++ b/include/cobalt/kernel/timer.h
@@ -522,6 +522,9 @@ int xntimer_setup_ipi(void);
 
 void xntimer_release_ipi(void);
 
+bool xntimer_set_sched(struct xntimer *timer,
+  struct xnsched *sched);
+
 #else /* ! CONFIG_SMP */
 
 static inline void xntimer_migrate(struct xntimer *timer,
@@ -535,10 +538,13 @@ static inline int xntimer_setup_ipi(void)
 
 static inline void xntimer_release_ipi(void) { }
 
-#endif /* CONFIG_SMP */
+static inline bool xntimer_set_sched(struct xntimer *timer,
+struct xnsched *sched)
+{
+   return true;
+}
 
-bool xntimer_set_sched(struct xntimer *timer,
-  struct xnsched *sched);
+#endif /* CONFIG_SMP */
 
 char *xntimer_format_time(xnticks_t ns,
  char *buf, size_t bufsz);


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/posix/timerfd: allow usage with external clocks

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: wip/drivers
Commit: dac2df243bcd146a040329df3885131ae77bd5b9
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=dac2df243bcd146a040329df3885131ae77bd5b9

Author: Philippe Gerum 
Date:   Fri Nov  4 16:25:21 2016 +0100

cobalt/posix/timerfd: allow usage with external clocks

Same as e6cd961.

---

 kernel/cobalt/posix/timerfd.c |8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/kernel/cobalt/posix/timerfd.c b/kernel/cobalt/posix/timerfd.c
index 90c4b3f..132aba8 100644
--- a/kernel/cobalt/posix/timerfd.c
+++ b/kernel/cobalt/posix/timerfd.c
@@ -166,12 +166,14 @@ COBALT_SYSCALL(timerfd_create, lostage, (int clockid, int 
flags))
 {
struct cobalt_tfd *tfd;
struct xnthread *curr;
+   struct xnclock *clock;
int ret, ufd;
 
-   if (clockid != CLOCK_REALTIME && clockid != CLOCK_MONOTONIC)
+   if (flags & ~TFD_CREATE_FLAGS)
return -EINVAL;
 
-   if (flags & ~TFD_CREATE_FLAGS)
+   clock = cobalt_clock_find(clockid);
+   if (clock == NULL)
return -EINVAL;
 
tfd = xnmalloc(sizeof(*tfd));
@@ -189,7 +191,7 @@ COBALT_SYSCALL(timerfd_create, lostage, (int clockid, int 
flags))
tfd->fd.oflags = (flags & TFD_NONBLOCK) ? O_NONBLOCK : 0;
tfd->clockid = clockid;
curr = xnthread_current();
-   xntimer_init(>timer, , timerfd_handler,
+   xntimer_init(>timer, clock, timerfd_handler,
 curr ? curr->sched : NULL, XNTIMER_UGRAVITY);
xnsynch_init(>readers, XNSYNCH_PRIO | XNSYNCH_NOPIP, NULL);
xnselect_init(>read_select);


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : boilerplate/libc: do not combine weak and inline attributes

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: wip/drivers
Commit: 2d6a18b8aee8a55a0185b77d3437736da5c0
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=2d6a18b8aee8a55a0185b77d3437736da5c0

Author: Philippe Gerum 
Date:   Sat Nov  5 19:09:00 2016 +0100

boilerplate/libc: do not combine weak and inline attributes

gcc5 discards the weak attribute for inline symbols.

This is a forward port of
http://git.xenomai.org/xenomai-2.6.git/commit/?id=917dcebb26ec492f276cdc3b55867aa90e01fa12

---

 include/boilerplate/libc.h |   12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/boilerplate/libc.h b/include/boilerplate/libc.h
index 0e51b86..d8b0334 100644
--- a/include/boilerplate/libc.h
+++ b/include/boilerplate/libc.h
@@ -137,9 +137,9 @@ int pthread_setaffinity_np(pthread_t thread, size_t 
cpusetsize,
  * during sleep time. This is a non-issue for Cobalt, as the libcobalt
  * implementation will always be picked instead.
  */
-__weak inline int clock_nanosleep(clockid_t clock_id, int flags,
- const struct timespec *request,
- struct timespec *remain)
+__weak int clock_nanosleep(clockid_t clock_id, int flags,
+  const struct timespec *request,
+  struct timespec *remain)
 {
struct timespec now, tmp;
 
@@ -163,14 +163,14 @@ __weak inline int clock_nanosleep(clockid_t clock_id, int 
flags,
  * Might be declared in uClibc headers but not actually implemented,
  * so we make the placeholder a weak symbol.
  */
-__weak inline int sched_getcpu(void)
+__weak int sched_getcpu(void)
 {
return 0;   /* outdated uClibc: assume uniprocessor. */
 }
 #endif /* !HAVE_SCHED_GETCPU */
 
 #ifndef HAVE_SHM_OPEN
-__weak inline int shm_open(const char *name, int oflag, mode_t mode)
+__weak int shm_open(const char *name, int oflag, mode_t mode)
 {
errno = ENOSYS;
return -1;
@@ -178,7 +178,7 @@ __weak inline int shm_open(const char *name, int oflag, 
mode_t mode)
 #endif /* !HAVE_SHM_OPEN */
 
 #ifndef HAVE_SHM_UNLINK
-__weak inline int shm_unlink(const char *name)
+__weak int shm_unlink(const char *name)
 {
errno = ENOSYS;
return -1;


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Jan Kiszka : cobalt/rtdm: Restore return code tracing

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: wip/drivers
Commit: 639ed39611a63a0c4f8a787ade150b8dbb5e4fab
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=639ed39611a63a0c4f8a787ade150b8dbb5e4fab

Author: Jan Kiszka 
Date:   Thu Sep 15 19:44:33 2016 +0200

cobalt/rtdm: Restore return code tracing

Got broken by a96a6d8e2816.

Signed-off-by: Jan Kiszka 

---

 kernel/cobalt/rtdm/fd.c |   40 ++--
 1 file changed, 26 insertions(+), 14 deletions(-)

diff --git a/kernel/cobalt/rtdm/fd.c b/kernel/cobalt/rtdm/fd.c
index 3381dea..4169e85 100644
--- a/kernel/cobalt/rtdm/fd.c
+++ b/kernel/cobalt/rtdm/fd.c
@@ -438,8 +438,10 @@ int rtdm_fd_ioctl(int ufd, unsigned int request, ...)
int err, ret;
 
fd = get_fd_fixup_mode(ufd);
-   if (IS_ERR(fd))
-   return PTR_ERR(fd);
+   if (IS_ERR(fd)) {
+   err = PTR_ERR(fd);
+   goto out;
+   }
 
va_start(args, request);
arg = va_arg(args, void __user *);
@@ -464,7 +466,7 @@ int rtdm_fd_ioctl(int ufd, unsigned int request, ...)
}
 
rtdm_fd_put(fd);
-
+  out:
if (err < 0)
trace_cobalt_fd_ioctl_status(current, fd, ufd, err);
 
@@ -479,8 +481,10 @@ rtdm_fd_read(int ufd, void __user *buf, size_t size)
ssize_t ret;
 
fd = get_fd_fixup_mode(ufd);
-   if (IS_ERR(fd))
-   return PTR_ERR(fd);
+   if (IS_ERR(fd)) {
+   ret = PTR_ERR(fd);
+   goto out;
+   }
 
set_compat_bit(fd);
 
@@ -492,10 +496,11 @@ rtdm_fd_read(int ufd, void __user *buf, size_t size)
ret = fd->ops->read_rt(fd, buf, size);
 
if (!XENO_ASSERT(COBALT, !spltest()))
-   splnone();
+   splnone();
 
rtdm_fd_put(fd);
 
+  out:
if (ret < 0)
trace_cobalt_fd_read_status(current, fd, ufd, ret);
 
@@ -509,8 +514,10 @@ ssize_t rtdm_fd_write(int ufd, const void __user *buf, 
size_t size)
ssize_t ret;
 
fd = get_fd_fixup_mode(ufd);
-   if (IS_ERR(fd))
-   return PTR_ERR(fd);
+   if (IS_ERR(fd)) {
+   ret = PTR_ERR(fd);
+   goto out;
+   }
 
set_compat_bit(fd);
 
@@ -526,6 +533,7 @@ ssize_t rtdm_fd_write(int ufd, const void __user *buf, 
size_t size)
 
rtdm_fd_put(fd);
 
+  out:
if (ret < 0)
trace_cobalt_fd_write_status(current, fd, ufd, ret);
 
@@ -539,8 +547,10 @@ ssize_t rtdm_fd_recvmsg(int ufd, struct user_msghdr *msg, 
int flags)
ssize_t ret;
 
fd = get_fd_fixup_mode(ufd);
-   if (IS_ERR(fd))
-   return PTR_ERR(fd);
+   if (IS_ERR(fd)) {
+   ret = PTR_ERR(fd);
+   goto out;
+   }
 
set_compat_bit(fd);
 
@@ -555,7 +565,7 @@ ssize_t rtdm_fd_recvmsg(int ufd, struct user_msghdr *msg, 
int flags)
splnone();
 
rtdm_fd_put(fd);
-
+out:
if (ret < 0)
trace_cobalt_fd_recvmsg_status(current, fd, ufd, ret);
 
@@ -569,8 +579,10 @@ ssize_t rtdm_fd_sendmsg(int ufd, const struct user_msghdr 
*msg, int flags)
ssize_t ret;
 
fd = get_fd_fixup_mode(ufd);
-   if (IS_ERR(fd))
-   return PTR_ERR(fd);
+   if (IS_ERR(fd)) {
+   ret = PTR_ERR(fd);
+   goto out;
+   }
 
set_compat_bit(fd);
 
@@ -585,7 +597,7 @@ ssize_t rtdm_fd_sendmsg(int ufd, const struct user_msghdr 
*msg, int flags)
splnone();
 
rtdm_fd_put(fd);
-
+out:
if (ret < 0)
trace_cobalt_fd_sendmsg_status(current, fd, ufd, ret);
 


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/thread: add schedparam lazy propagation

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: db18b68aea1dad7f9bb03ee831116c04f701b760
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=db18b68aea1dad7f9bb03ee831116c04f701b760

Author: Philippe Gerum 
Date:   Fri Mar 18 12:12:50 2016 +0100

cobalt/thread: add schedparam lazy propagation

Provide a mechanism for carrying out a lazy propagation of schedparam
updates to the regular kernel, so that userland does not have to
switch to secondary mode for this.

When userland issues sc_cobalt_thread_setschedparam_ex for updating
the scheduling parameters of a Xenomai thread, a request for
propagating this change to the regular kernel is made pending. Such
request will be committed later, either when:

- the thread relaxes if it is running in primary mode when the update
  request is received;

- next time the thread calls back into the Cobalt core as a result of
  receiving a HOME action from a SIGSHADOW notification, which is sent
  if such thread was relaxed at the time of the update request.

As a result, the target thread will have propagated the schedparams
update to the regular kernel as soon as it resumes (relaxed) execution
in user-space.

---

 include/cobalt/kernel/thread.h  |8 +
 include/cobalt/uapi/kernel/thread.h |1 +
 include/cobalt/uapi/signal.h|1 +
 kernel/cobalt/posix/syscall.c   |9 ++
 kernel/cobalt/thread.c  |   55 +++
 5 files changed, 74 insertions(+)

diff --git a/include/cobalt/kernel/thread.h b/include/cobalt/kernel/thread.h
index 07b6996..a4d826e 100644
--- a/include/cobalt/kernel/thread.h
+++ b/include/cobalt/kernel/thread.h
@@ -567,6 +567,14 @@ int xnthread_set_schedparam(struct xnthread *thread,
 
 int xnthread_killall(int grace, int mask);
 
+void __xnthread_propagate_schedparam(struct xnthread *curr);
+
+static inline void xnthread_propagate_schedparam(struct xnthread *curr)
+{
+   if (xnthread_test_info(curr, XNSCHEDP))
+   __xnthread_propagate_schedparam(curr);
+}
+
 extern struct xnthread_personality xenomai_personality;
 
 /** @} */
diff --git a/include/cobalt/uapi/kernel/thread.h 
b/include/cobalt/uapi/kernel/thread.h
index bd5e34a..e534471 100644
--- a/include/cobalt/uapi/kernel/thread.h
+++ b/include/cobalt/uapi/kernel/thread.h
@@ -71,6 +71,7 @@
 #define XNROBBED  0x0020 /**< Robbed from resource ownership */
 #define XNCANCELD 0x0040 /**< Cancellation request is pending */
 #define XNPIALERT 0x0080 /**< Priority inversion alert (SIGDEBUG sent) */
+#define XNSCHEDP  0x0100 /**< schedparam propagation is pending */
 
 /* Local information flags (private to current thread) */
 
diff --git a/include/cobalt/uapi/signal.h b/include/cobalt/uapi/signal.h
index b5483d7..8a7ea15 100644
--- a/include/cobalt/uapi/signal.h
+++ b/include/cobalt/uapi/signal.h
@@ -47,6 +47,7 @@
 /* SIGSHADOW action codes. */
 #define SIGSHADOW_ACTION_HARDEN1
 #define SIGSHADOW_ACTION_BACKTRACE 2
+#define SIGSHADOW_ACTION_HOME  3
 #define SIGSHADOW_BACKTRACE_DEPTH  16
 
 #define SIGDEBUG   SIGXCPU
diff --git a/kernel/cobalt/posix/syscall.c b/kernel/cobalt/posix/syscall.c
index 3addd62..b9efa05 100644
--- a/kernel/cobalt/posix/syscall.c
+++ b/kernel/cobalt/posix/syscall.c
@@ -731,6 +731,15 @@ restart:
goto ret_handled;
}
switched = 1;
+   } else {
+   /*
+* We want to run the syscall in the current Linux
+* domain. This is a slow path, so proceed with any
+* pending schedparam update on the fly.
+*/
+   switched = 0;
+   if (thread)
+   xnthread_propagate_schedparam(thread);
}
 
ret = handler(__xn_reg_arglist(regs));
diff --git a/kernel/cobalt/thread.c b/kernel/cobalt/thread.c
index d00714c..7db3c1b 100644
--- a/kernel/cobalt/thread.c
+++ b/kernel/cobalt/thread.c
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1961,6 +1962,11 @@ int __xnthread_set_schedparam(struct xnthread *thread,
thread->lock_count == 0)
xnsched_putback(thread);
 
+   xnthread_set_info(thread, XNSCHEDP);
+   /* Ask the target thread to call back if relaxed. */
+   if (xnthread_test_state(thread, XNRELAX))
+   xnthread_signal(thread, SIGSHADOW, SIGSHADOW_ACTION_HOME);
+   
return ret;
 }
 
@@ -2082,6 +2088,40 @@ static void post_wakeup(struct task_struct *p)
ipipe_post_work_root(, work);
 }
 
+void __xnthread_propagate_schedparam(struct xnthread *curr)
+{
+   int kpolicy = SCHED_FIFO, kprio = curr->bprio, ret;
+   struct task_struct *p = current;
+   struct sched_param param;
+   spl_t s;
+
+   /*
+* Test-set race for XNSCHEDP is ok, the propagation is meant
+* to be done asap but not guaranteed to be 

[Xenomai-git] Philippe Gerum : boilerplate/libc: add placeholder for pthread_setschedprio()

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 2cf7b10e57f7c7888fce5defcb9c46661e1d6cd0
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=2cf7b10e57f7c7888fce5defcb9c46661e1d6cd0

Author: Philippe Gerum 
Date:   Tue May 24 09:43:29 2016 +0200

boilerplate/libc: add placeholder for pthread_setschedprio()

For outdated uClibc.

---

 configure.ac   |1 +
 include/boilerplate/libc.h |   19 +++
 2 files changed, 20 insertions(+)

diff --git a/configure.ac b/configure.ac
index 5bcd7f8..1397659 100644
--- a/configure.ac
+++ b/configure.ac
@@ -540,6 +540,7 @@ AC_CHECK_FUNCS([pthread_mutexattr_setprotocol   \
pthread_getattr_np  \
pthread_atfork  \
pthread_setname_np  \
+   pthread_setschedprio\
sched_getcpu\
clock_nanosleep \
shm_open\
diff --git a/include/boilerplate/libc.h b/include/boilerplate/libc.h
index 6616cef..3c9c970 100644
--- a/include/boilerplate/libc.h
+++ b/include/boilerplate/libc.h
@@ -168,6 +168,25 @@ int pthread_setaffinity_np(pthread_t thread, size_t 
cpusetsize,
 
 #endif /* !HAVE_PTHREAD_ATTR_SETAFFINITY_NP */
 
+#ifndef HAVE_PTHREAD_SETSCHEDPRIO
+
+static inline
+int pthread_setschedprio(pthread_t thread, int prio)
+{
+   struct sched_param param;
+   int policy, ret;
+
+   ret = pthread_getschedparam(thread, , );
+   if (ret)
+   return ret;
+
+   param.sched_priority = prio;
+
+   return pthread_setschedparam(thread, policy, );
+}
+
+#endif /* !HAVE_PTHREAD_SETSCHEDPRIO */
+
 #if !defined(HAVE_CLOCK_NANOSLEEP) && defined(CONFIG_XENO_MERCURY)
 /*
  * Best effort for a Mercury setup based on an outdated libc lacking


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/arm64: thread: move all TCB initializers out of line

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: edf2719b5ba31677496e1844f03b7337bd7086ef
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=edf2719b5ba31677496e1844f03b7337bd7086ef

Author: Philippe Gerum 
Date:   Fri Sep  9 16:07:54 2016 +0200

cobalt/arm64: thread: move all TCB initializers out of line

Does not impact performances and fixes inclusion hell for pulling the
struct xnthread definition for good.

---

 kernel/cobalt/arch/arm64/include/asm/xenomai/thread.h |6 +-
 kernel/cobalt/arch/arm64/thread.c |6 ++
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/thread.h 
b/kernel/cobalt/arch/arm64/include/asm/xenomai/thread.h
index ac1f1f7..319f4d8 100644
--- a/kernel/cobalt/arch/arm64/include/asm/xenomai/thread.h
+++ b/kernel/cobalt/arch/arm64/include/asm/xenomai/thread.h
@@ -60,11 +60,7 @@ int xnarch_escalate(void);
 
 #if defined(CONFIG_XENO_ARCH_FPU)
 
-static inline void xnarch_init_root_tcb(struct xnthread *thread)
-{
-   struct xnarchtcb *tcb = xnthread_archtcb(thread);
-   tcb->fpup = NULL;
-}
+void xnarch_init_root_tcb(struct xnthread *thread);
 
 void xnarch_init_shadow_tcb(struct xnthread *thread);
 
diff --git a/kernel/cobalt/arch/arm64/thread.c 
b/kernel/cobalt/arch/arm64/thread.c
index b987e09..3097aeb 100644
--- a/kernel/cobalt/arch/arm64/thread.c
+++ b/kernel/cobalt/arch/arm64/thread.c
@@ -98,6 +98,12 @@ void xnarch_init_shadow_tcb(struct xnthread *thread)
tcb->fpup = >core.host_task->thread.fpsimd_state;
 }
 
+void xnarch_init_root_tcb(struct xnthread *thread)
+{
+   struct xnarchtcb *tcb = >tcb;
+   tcb->fpup = NULL;
+}
+
 #endif /* CONFIG_XENO_ARCH_FPU */
 
 void xnarch_switch_to(struct xnthread *out, struct xnthread *in)


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Jan Kiszka : cobalt/kernel: Introduce __SCHED_CURRENT policy to setschedparam_ex

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 278e5dd0dc89706212b09a24d6243f3b30c3be8e
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=278e5dd0dc89706212b09a24d6243f3b30c3be8e

Author: Jan Kiszka 
Date:   Tue Mar  8 14:41:28 2016 +0100

cobalt/kernel: Introduce __SCHED_CURRENT policy to setschedparam_ex

Define the internal scheduling policy "current": it shall refer to the
target thread's current scheduling policy. This will allow to model
pthread_setschedprio on top of pthread_setschedparam_ex with only a
single syscall.

Signed-off-by: Jan Kiszka 

---

 include/cobalt/uapi/sched.h|3 +++
 kernel/cobalt/posix/thread.c   |   10 ++
 kernel/cobalt/trace/cobalt-posix.h |3 ++-
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/include/cobalt/uapi/sched.h b/include/cobalt/uapi/sched.h
index b672095..2a1df44 100644
--- a/include/cobalt/uapi/sched.h
+++ b/include/cobalt/uapi/sched.h
@@ -21,6 +21,9 @@
 #define SCHED_COBALT   42
 #define SCHED_WEAK 43
 
+/* for internal use */
+#define __SCHED_CURRENT44
+
 #ifndef SCHED_SPORADIC
 #define SCHED_SPORADIC 10
 #define sched_ss_low_priority  sched_u.ss.__sched_low_priority
diff --git a/kernel/cobalt/posix/thread.c b/kernel/cobalt/posix/thread.c
index d87edb1..217b81b 100644
--- a/kernel/cobalt/posix/thread.c
+++ b/kernel/cobalt/posix/thread.c
@@ -242,6 +242,7 @@ struct xnthread_personality *cobalt_thread_finalize(struct 
xnthread *zombie)
 int __cobalt_thread_setschedparam_ex(struct cobalt_thread *thread, int policy,
 const struct sched_param_ex *param_ex)
 {
+   struct xnthread *base_thread = >threadbase;
struct xnsched_class *sched_class;
union xnsched_policy_param param;
xnticks_t tslice;
@@ -256,6 +257,15 @@ int __cobalt_thread_setschedparam_ex(struct cobalt_thread 
*thread, int policy,
goto out;
}
 
+   if (policy == __SCHED_CURRENT) {
+   policy = base_thread->base_class->policy;
+   if (xnthread_base_priority(base_thread) == 0)
+   policy = SCHED_NORMAL;
+   else if (base_thread->base_class == _class_rt &&
+xnthread_test_state(base_thread, XNRRB))
+   policy = SCHED_RR;
+   }
+
tslice = thread->threadbase.rrperiod;
sched_class = cobalt_sched_policy_param(, policy,
param_ex, );
diff --git a/kernel/cobalt/trace/cobalt-posix.h 
b/kernel/cobalt/trace/cobalt-posix.h
index 3d0e20c..cc0eb05 100644
--- a/kernel/cobalt/trace/cobalt-posix.h
+++ b/kernel/cobalt/trace/cobalt-posix.h
@@ -90,7 +90,8 @@ DECLARE_EVENT_CLASS(syscall_exit,
 {SCHED_QUOTA, "quota"},\
 {SCHED_SPORADIC, "sporadic"},  \
 {SCHED_COBALT, "cobalt"},  \
-{SCHED_WEAK, "weak"})
+{SCHED_WEAK, "weak"},  \
+{__SCHED_CURRENT, ""})
 
 #define cobalt_print_sched_params(__policy, __p_ex)\
 ({ \


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Jan Kiszka : lib/cobalt: Wrap pthread_setschedprio for proper real-time support

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 1820ff5fa82dd0a823e0192fce778ee21e27f322
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=1820ff5fa82dd0a823e0192fce778ee21e27f322

Author: Jan Kiszka 
Date:   Tue Mar  8 14:46:59 2016 +0100

lib/cobalt: Wrap pthread_setschedprio for proper real-time support

Implement pthread_setschedprio on top of pthread_setschedparam_ex with
the help of the new __SCHED_CURRENT policy. This ensures that prio
changes are directly applied to the real-time core, and that with just
a single syscall.

Signed-off-by: Jan Kiszka 

---

 include/cobalt/pthread.h   |2 ++
 lib/cobalt/cobalt.wrappers |1 +
 lib/cobalt/thread.c|9 +
 lib/cobalt/wrappers.c  |6 ++
 4 files changed, 18 insertions(+)

diff --git a/include/cobalt/pthread.h b/include/cobalt/pthread.h
index f1b1c8a..3e9bd47 100644
--- a/include/cobalt/pthread.h
+++ b/include/cobalt/pthread.h
@@ -53,6 +53,8 @@ COBALT_DECL(int, pthread_setschedparam(pthread_t thread,
   int policy,
   const struct sched_param *param));
 
+COBALT_DECL(int, pthread_setschedprio(pthread_t thread, int prio));
+
 COBALT_DECL(int, pthread_mutex_init(pthread_mutex_t *mutex,
const pthread_mutexattr_t *attr));
 
diff --git a/lib/cobalt/cobalt.wrappers b/lib/cobalt/cobalt.wrappers
index 75f29d6..19153ae 100644
--- a/lib/cobalt/cobalt.wrappers
+++ b/lib/cobalt/cobalt.wrappers
@@ -2,6 +2,7 @@
 --wrap pthread_create
 --wrap pthread_setschedparam
 --wrap pthread_getschedparam
+--wrap pthread_setschedprio
 --wrap pthread_yield
 --wrap sched_yield
 --wrap sched_get_priority_min
diff --git a/lib/cobalt/thread.c b/lib/cobalt/thread.c
index 908516f..62ca0a0 100644
--- a/lib/cobalt/thread.c
+++ b/lib/cobalt/thread.c
@@ -650,6 +650,15 @@ int pthread_setschedparam_ex(pthread_t thread,
return ret;
 }
 
+COBALT_IMPL(int, pthread_setschedprio, (pthread_t thread, int prio))
+{
+   struct sched_param_ex param_ex = {
+   .sched_priority = prio,
+   };
+
+   return pthread_setschedparam_ex(thread, __SCHED_CURRENT, _ex);
+}
+
 /**
  * Get the scheduling policy and parameters of the specified thread.
  *
diff --git a/lib/cobalt/wrappers.c b/lib/cobalt/wrappers.c
index 09c74e5..1f1664e 100644
--- a/lib/cobalt/wrappers.c
+++ b/lib/cobalt/wrappers.c
@@ -60,6 +60,12 @@ int __real_pthread_getschedparam(pthread_t thread,
 }
 
 __weak
+int __real_pthread_setschedprio(pthread_t thread, int prio)
+{
+   return pthread_setschedprio(thread, prio);
+}
+
+__weak
 int __real_sched_yield(void)
 {
return sched_yield();


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Jan Kiszka : lib/cobalt: Provide RT-capable usleep

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 7e4085d689a45433c9133a937cd4bfc9cbb2bfbf
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=7e4085d689a45433c9133a937cd4bfc9cbb2bfbf

Author: Jan Kiszka 
Date:   Mon May 30 14:58:07 2016 +0200

lib/cobalt: Provide RT-capable usleep

User may expect this (probably last) sleeping service to be available
under Cobalt just like sleep, nanosleep & Co.

Signed-off-by: Jan Kiszka 

---

 include/cobalt/unistd.h|2 ++
 lib/cobalt/clock.c |   14 ++
 lib/cobalt/cobalt.wrappers |1 +
 lib/cobalt/wrappers.c  |6 ++
 4 files changed, 23 insertions(+)

diff --git a/include/cobalt/unistd.h b/include/cobalt/unistd.h
index 8ad2b40..fe3992a 100644
--- a/include/cobalt/unistd.h
+++ b/include/cobalt/unistd.h
@@ -35,6 +35,8 @@ COBALT_DECL(int, close(int fildes));
 
 COBALT_DECL(unsigned int, sleep(unsigned int seconds));
 
+COBALT_DECL(int, usleep(useconds_t usec));
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/cobalt/clock.c b/lib/cobalt/clock.c
index 0450019..7b4ef54 100644
--- a/lib/cobalt/clock.c
+++ b/lib/cobalt/clock.c
@@ -364,6 +364,20 @@ COBALT_IMPL(unsigned int, sleep, (unsigned int seconds))
return 0;
 }
 
+/* @apitags{thread-unrestricted, switch-primary} */
+
+COBALT_IMPL(int, usleep, (useconds_t usec))
+{
+   struct timespec rqt;
+
+   if (cobalt_get_current_fast() == XN_NO_HANDLE)
+   return __STD(usleep(usec));
+
+   rqt.tv_sec = usec / 100;
+   rqt.tv_nsec = (usec % 100) * 1000;
+   return __WRAP(clock_nanosleep(CLOCK_MONOTONIC, 0, , NULL));
+}
+
 /* @apitags{unrestricted} */
 
 COBALT_IMPL(int, gettimeofday, (struct timeval *tv, struct timezone *tz))
diff --git a/lib/cobalt/cobalt.wrappers b/lib/cobalt/cobalt.wrappers
index 19153ae..bf7a810 100644
--- a/lib/cobalt/cobalt.wrappers
+++ b/lib/cobalt/cobalt.wrappers
@@ -110,6 +110,7 @@
 --wrap sigqueue
 --wrap kill
 --wrap sleep
+--wrap usleep
 --wrap mmap
 --wrap mmap64
 --wrap time
diff --git a/lib/cobalt/wrappers.c b/lib/cobalt/wrappers.c
index 1f1664e..43ca630 100644
--- a/lib/cobalt/wrappers.c
+++ b/lib/cobalt/wrappers.c
@@ -538,3 +538,9 @@ unsigned int __real_sleep(unsigned int seconds)
 {
return sleep(seconds);
 }
+
+__weak
+int __real_usleep(useconds_t usec)
+{
+   return usleep(usec);
+}


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : testsuite/smokey: add test checking Cobalt' s cpu affinity control

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 2f6868082032821842649398c5c564341b6b239c
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=2f6868082032821842649398c5c564341b6b239c

Author: Philippe Gerum 
Date:   Fri Feb 26 11:44:16 2016 +0100

testsuite/smokey: add test checking Cobalt's cpu affinity control

---

 configure.ac |1 +
 1 file changed, 1 insertion(+)

diff --git a/configure.ac b/configure.ac
index 4bf37b1..e1f060a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -910,6 +910,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/net_packet_dgram/Makefile \
testsuite/smokey/net_packet_raw/Makefile \
testsuite/smokey/net_common/Makefile \
+   testsuite/smokey/cpu-affinity/Makefile \
testsuite/clocktest/Makefile \
testsuite/xeno-test/Makefile \
utils/Makefile \


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : lib/cobalt: use lazy schedparam propagation

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 693774829978464af7bc5e10f824708b9726b286
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=693774829978464af7bc5e10f824708b9726b286

Author: Philippe Gerum 
Date:   Fri Mar 18 12:12:27 2016 +0100

lib/cobalt: use lazy schedparam propagation

Do not switch to secondary mode upon schedparam updates for
propagating changes to the regular kernel, if the caller runs in
primary mode when entering pthread_setschedparam*() or
sched_setscheduler(). In such a case, the update request to the
regular kernel is left pending until the target thread resumes
execution in relaxed mode, at which point it is committed.

CAUTION: This mechanism won't update the schedparams cached by the
glibc for the caller in user-space, but this is the deal: we don't
relax threads which issue pthread_setschedparam[_ex]() from primary
mode anymore, but then only the kernel side (Cobalt and the host
kernel) will be aware of the change, and glibc might cache obsolete
information.

If the caller already runs in relaxed mode on entry to these services,
the update request takes place immediately, via the regular (g)libc
calls.

In any case, the new scheduling parameters for the target thread are
immediately applied by Cobalt, regardless of the update path followed
for the regular kernel.

---

 lib/cobalt/internal.c  |   44 ++
 lib/cobalt/sched.c |   13 
 lib/cobalt/sigshadow.c |8 +
 lib/cobalt/thread.c|   80 +---
 4 files changed, 87 insertions(+), 58 deletions(-)

diff --git a/lib/cobalt/internal.c b/lib/cobalt/internal.c
index 5b89db5..cb1d53b 100644
--- a/lib/cobalt/internal.c
+++ b/lib/cobalt/internal.c
@@ -514,3 +514,47 @@ int cobalt_sched_weighted_prio(int policy,
 {
return XENOMAI_SYSCALL2(sc_cobalt_sched_weightprio, policy, param_ex);
 }
+
+int cobalt_xlate_schedparam(int policy,
+   const struct sched_param_ex *param_ex,
+   struct sched_param *param)
+{
+   int std_policy, priority;
+
+   /*
+* Translates Cobalt scheduling parameters to native ones,
+* based on a best approximation for Cobalt policies which are
+* not available from the host kernel.
+*/
+   std_policy = policy;
+   priority = param_ex->sched_priority;
+
+   switch (policy) {
+   case SCHED_WEAK:
+   std_policy = priority ? SCHED_FIFO : SCHED_OTHER;
+   break;
+   default:
+   std_policy = SCHED_FIFO;
+   /* falldown wanted. */
+   case SCHED_OTHER:
+   case SCHED_FIFO:
+   case SCHED_RR:
+   /*
+* The Cobalt priority range is larger than those of
+* the native SCHED_FIFO/RR classes, so we have to cap
+* the priority value accordingly.  We also remap
+* "weak" (negative) priorities - which are only
+* meaningful for the Cobalt core - to regular values.
+*/
+   if (priority > __cobalt_std_fifo_maxpri)
+   priority = __cobalt_std_fifo_maxpri;
+   }
+
+   if (priority < 0)
+   priority = -priority;
+   
+   memset(param, 0, sizeof(*param));
+   param->sched_priority = priority;
+
+   return std_policy;
+}
diff --git a/lib/cobalt/sched.c b/lib/cobalt/sched.c
index b0292b5..87b9235 100644
--- a/lib/cobalt/sched.c
+++ b/lib/cobalt/sched.c
@@ -26,7 +26,6 @@
 #include 
 #include 
 #include 
-#include "current.h"
 #include "internal.h"
 
 /**
@@ -297,11 +296,13 @@ int sched_setscheduler_ex(pid_t pid,
return EINVAL;
 
/* See pthread_setschedparam_ex(). */
-   
-   std_policy = cobalt_xlate_schedparam(policy, param_ex, _param);
-   ret = __STD(sched_setscheduler(pid, std_policy, _param));
-   if (ret)
-   return errno;
+
+   if (cobalt_is_relaxed()) {
+   std_policy = cobalt_xlate_schedparam(policy, param_ex, 
_param);
+   ret = __STD(sched_setscheduler(pid, std_policy, _param));
+   if (ret)
+   return errno;
+   }
 
ret = -XENOMAI_SYSCALL5(sc_cobalt_sched_setscheduler_ex,
pid, policy, param_ex,
diff --git a/lib/cobalt/sigshadow.c b/lib/cobalt/sigshadow.c
index 3f4e9c5..48d5a81 100644
--- a/lib/cobalt/sigshadow.c
+++ b/lib/cobalt/sigshadow.c
@@ -59,6 +59,14 @@ int cobalt_sigshadow_handler(int sig, siginfo_t *si, void 
*ctxt)
skip = nr > 3 ? 3 : 0;
XENOMAI_SYSCALL3(sc_cobalt_backtrace, nr - skip, frames + skip, 
arg);
break;
+   case SIGSHADOW_ACTION_HOME:
+   /*
+* We have been asked to call home from the current
+* context: sending a query for retrieving our handle
+* will just do this.
+*/
+   

[Xenomai-git] Jan Kiszka : smokey/posix-mutex: Fix test case /wrt mutex object reuse

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 5a9481f607de2af097353cce0e027a5ab3153162
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=5a9481f607de2af097353cce0e027a5ab3153162

Author: Jan Kiszka 
Date:   Thu Feb 25 11:29:00 2016 +0100

smokey/posix-mutex: Fix test case /wrt mutex object reuse

Mutex objects created on the stack must be properly destroyed after use.
Otherwise, succeeding tests that use the same stack layout will consider
them busy and refuse to recreate the mutexes.

Signed-off-by: Jan Kiszka 

---

 testsuite/smokey/posix-mutex/posix-mutex.c |   26 +-
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/testsuite/smokey/posix-mutex/posix-mutex.c 
b/testsuite/smokey/posix-mutex/posix-mutex.c
index ae82fc1..151c2f3 100644
--- a/testsuite/smokey/posix-mutex/posix-mutex.c
+++ b/testsuite/smokey/posix-mutex/posix-mutex.c
@@ -623,7 +623,10 @@ static int protect_raise(void)
 
if (!__Tassert(get_effective_prio() == THREAD_PRIO_MEDIUM))
return -EINVAL;
-   
+
+   if (!__T(ret, pthread_mutex_destroy()))
+   return ret;
+
return 0;
 }
 
@@ -651,7 +654,10 @@ static int protect_lower(void)
 
if (!__Tassert(get_effective_prio() == THREAD_PRIO_MEDIUM))
return -EINVAL;
-   
+
+   if (!__T(ret, pthread_mutex_destroy()))
+   return ret;
+
return 0;
 }
 
@@ -699,7 +705,10 @@ static int protect_weak(void)
if (!__T(ret, pthread_setschedparam(pthread_self(),
old_policy, _param)))
return ret;
-   
+
+   if (!__T(ret, pthread_mutex_destroy()))
+   return ret;
+
return 0;
 }
 
@@ -745,7 +754,11 @@ static int protect_nesting_protect(void)
 
if (!__Tassert(get_effective_prio() == THREAD_PRIO_MEDIUM))
return -EINVAL;
-   
+
+   if (!__T(ret, pthread_mutex_destroy(_high)) ||
+   !__T(ret, pthread_mutex_destroy(_very_high)))
+   return ret;
+
return 0;
 }
 
@@ -782,7 +795,10 @@ static int protect_nesting_pi(void)
/* PP boost just dropped: HIGH -> MEDIUM. */
if (!__Tassert(get_effective_prio() == THREAD_PRIO_MEDIUM))
return -EINVAL;
-   
+
+   if (!__T(ret, pthread_mutex_destroy(_pp)))
+   return ret;
+
return 0;
 }
 


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : boilerplate/libc: provide placeholders for prioceiling ops

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: cb1ad766629e02d224be898aa0acbf4235fdefc7
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=cb1ad766629e02d224be898aa0acbf4235fdefc7

Author: Philippe Gerum 
Date:   Sun Mar 20 17:20:58 2016 +0100

boilerplate/libc: provide placeholders for prioceiling ops

---

 configure.ac   |2 ++
 include/boilerplate/libc.h |   19 +++
 2 files changed, 21 insertions(+)

diff --git a/configure.ac b/configure.ac
index 0daddd6..15c7499 100644
--- a/configure.ac
+++ b/configure.ac
@@ -511,6 +511,8 @@ AC_CHECK_FUNCS([pthread_mutexattr_setprotocol   \
pthread_mutexattr_getprioceiling \
pthread_mutexattr_setprioceiling \
pthread_mutexattr_setrobust_np  \
+   pthread_mutex_getprioceiling\
+   pthread_mutex_setprioceiling\
pthread_condattr_getclock   \
pthread_condattr_setclock   \
pthread_spin_lock fork  \
diff --git a/include/boilerplate/libc.h b/include/boilerplate/libc.h
index 4cd80b0..6616cef 100644
--- a/include/boilerplate/libc.h
+++ b/include/boilerplate/libc.h
@@ -127,6 +127,25 @@ int pthread_mutexattr_getprioceiling(const 
pthread_mutexattr_t *
 }
 #endif /* !HAVE_PTHREAD_MUTEXATTR_GETPRIOCEILING */
 
+#ifndef HAVE_PTHREAD_MUTEX_SETPRIOCEILING
+static inline
+int pthread_mutex_setprioceiling(pthread_mutex_t *__restrict attr,
+int prioceiling,
+int *__restrict old_ceiling)
+{
+   return ENOSYS;
+}
+#endif /* !HAVE_PTHREAD_MUTEXATTR_SETPRIOCEILING */
+
+#ifndef HAVE_PTHREAD_MUTEX_GETPRIOCEILING
+static inline
+int pthread_mutex_getprioceiling(pthread_mutex_t *__restrict attr,
+int *__restrict prioceiling)
+{
+   return ENOSYS;
+}
+#endif /* !HAVE_PTHREAD_MUTEXATTR_GETPRIOCEILING */
+
 #ifndef HAVE_PTHREAD_ATTR_SETAFFINITY_NP
 #include 
 static inline


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/thread: track thread_info unconditionally

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: b50284f0e9f072affbb1eccae2468b400acdce2f
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=b50284f0e9f072affbb1eccae2468b400acdce2f

Author: Philippe Gerum 
Date:   Sat Nov 14 14:47:44 2015 +0100

cobalt/thread: track thread_info unconditionally

We almost always want to track the thread_info structure of the host
task in the core tcb, and doing so is cheap, so there is no point in
building this support conditionally.

---

 kernel/cobalt/arch/arm/Kconfig |3 ---
 kernel/cobalt/arch/arm64/Kconfig   |3 ---
 kernel/cobalt/arch/powerpc/Kconfig |4 
 kernel/cobalt/include/asm-generic/xenomai/thread.h |2 --
 kernel/cobalt/sched.c  |2 --
 kernel/cobalt/thread.c |4 
 6 files changed, 18 deletions(-)

diff --git a/kernel/cobalt/arch/arm/Kconfig b/kernel/cobalt/arch/arm/Kconfig
index dc6485d..2043d70 100644
--- a/kernel/cobalt/arch/arm/Kconfig
+++ b/kernel/cobalt/arch/arm/Kconfig
@@ -26,9 +26,6 @@ config IPIPE_WANT_PREEMPTIBLE_SWITCH
 config IPIPE_WANT_ACTIVE_MM
def_bool y
 
-config XENO_ARCH_WANT_TIP
-   def_bool y
-
 config XENO_ARCH_FPU
def_bool VFP
 
diff --git a/kernel/cobalt/arch/arm64/Kconfig b/kernel/cobalt/arch/arm64/Kconfig
index 27b5026..572de3e 100644
--- a/kernel/cobalt/arch/arm64/Kconfig
+++ b/kernel/cobalt/arch/arm64/Kconfig
@@ -4,9 +4,6 @@ source "drivers/xenomai/Kconfig"
 config XENO_ARCH_UNLOCKED_SWITCH
def_bool IPIPE_WANT_PREEMPTIBLE_SWITCH
 
-config XENO_ARCH_WANT_TIP
-   def_bool y
-
 config XENO_ARCH_FPU
def_bool y
 
diff --git a/kernel/cobalt/arch/powerpc/Kconfig 
b/kernel/cobalt/arch/powerpc/Kconfig
index 3e950f5..4d5e6db 100644
--- a/kernel/cobalt/arch/powerpc/Kconfig
+++ b/kernel/cobalt/arch/powerpc/Kconfig
@@ -10,9 +10,6 @@ config IPIPE_WANT_PREEMPTIBLE_SWITCH
default y if XENO_ARCH_UNLOCKED_SWITCH
default n if !XENO_ARCH_UNLOCKED_SWITCH
 
-config XENO_ARCH_WANT_TIP
-   bool
-
 config XENO_ARCH_FPU
def_bool PPC_FPU
 
@@ -24,7 +21,6 @@ menu "Machine/platform-specific options"
 config XENO_ARCH_UNLOCKED_SWITCH
bool "Unlocked context switch"
depends on IPIPE_HAVE_PREEMPTIBLE_SWITCH
-   select XENO_ARCH_WANT_TIP
default y
help
 
diff --git a/kernel/cobalt/include/asm-generic/xenomai/thread.h 
b/kernel/cobalt/include/asm-generic/xenomai/thread.h
index 2ff19a4..cd0c6e9 100644
--- a/kernel/cobalt/include/asm-generic/xenomai/thread.h
+++ b/kernel/cobalt/include/asm-generic/xenomai/thread.h
@@ -33,9 +33,7 @@ struct xntcb {
struct mm_struct *mm;
struct mm_struct *active_mm;
struct thread_struct ts;
-#ifdef CONFIG_XENO_ARCH_WANT_TIP
struct thread_info *tip;
-#endif
 #ifdef CONFIG_XENO_ARCH_FPU
struct task_struct *user_fpu_owner;
 #endif
diff --git a/kernel/cobalt/sched.c b/kernel/cobalt/sched.c
index cbe14bd..09960ac 100644
--- a/kernel/cobalt/sched.c
+++ b/kernel/cobalt/sched.c
@@ -806,9 +806,7 @@ static inline void leave_root(struct xnthread *root)
rootcb->core.host_task = p;
rootcb->core.tsp = >thread;
rootcb->core.mm = rootcb->core.active_mm = ipipe_get_active_mm();
-#ifdef CONFIG_XENO_ARCH_WANT_TIP
rootcb->core.tip = task_thread_info(p);
-#endif
xnarch_leave_root(root);
 }
 
diff --git a/kernel/cobalt/thread.c b/kernel/cobalt/thread.c
index 34eca35..e0c488e 100644
--- a/kernel/cobalt/thread.c
+++ b/kernel/cobalt/thread.c
@@ -260,9 +260,7 @@ void xnthread_init_shadow_tcb(struct xnthread *thread)
tcb->core.tsp = >thread;
tcb->core.mm = p->mm;
tcb->core.active_mm = p->mm;
-#ifdef CONFIG_XENO_ARCH_WANT_TIP
tcb->core.tip = task_thread_info(p);
-#endif
 #ifdef CONFIG_XENO_ARCH_FPU
tcb->core.user_fpu_owner = p;
 #endif /* CONFIG_XENO_ARCH_FPU */
@@ -278,9 +276,7 @@ void xnthread_init_root_tcb(struct xnthread *thread)
tcb->core.host_task = p;
tcb->core.tsp = >core.ts;
tcb->core.mm = p->mm;
-#ifdef CONFIG_XENO_ARCH_WANT_TIP
tcb->core.tip = NULL;
-#endif
xnarch_init_root_tcb(thread);
 }
 


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Gilles Chanteperdrix : testsuite/smokey: add RTnet testsuite

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: f3cc8d3e59376e0231cb63eb8d928ff761457a23
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=f3cc8d3e59376e0231cb63eb8d928ff761457a23

Author: Gilles Chanteperdrix 
Date:   Sun Oct 11 16:05:18 2015 +0200

testsuite/smokey: add RTnet testsuite

Starting with UDP and raw sockets.
Measuring round trip time and checking for lost packets.

---

 configure.ac |3 +++
 1 file changed, 3 insertions(+)

diff --git a/configure.ac b/configure.ac
index bbaf4a7..4a3f7c7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -906,6 +906,9 @@ AC_CONFIG_FILES([ \
testsuite/smokey/tsc/Makefile \
testsuite/smokey/leaks/Makefile \
testsuite/smokey/fpu-stress/Makefile \
+   testsuite/smokey/net_udp/Makefile \
+   testsuite/smokey/net_packet_dgram/Makefile \
+   testsuite/smokey/net_common/Makefile \
testsuite/clocktest/Makefile \
testsuite/xeno-test/Makefile \
utils/Makefile \


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Dmitriy Cherkasov : cobalt/arm64: add lazy FPU switching

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 3572e5011fd31083cfa75e5cd1f1a3b293f3f201
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=3572e5011fd31083cfa75e5cd1f1a3b293f3f201

Author: Dmitriy Cherkasov 
Date:   Thu Oct  1 15:47:41 2015 -0700

cobalt/arm64: add lazy FPU switching

---

 kernel/cobalt/arch/arm64/thread.c |   83 +++--
 1 file changed, 62 insertions(+), 21 deletions(-)

diff --git a/kernel/cobalt/arch/arm64/thread.c 
b/kernel/cobalt/arch/arm64/thread.c
index 316525f6..db369be 100644
--- a/kernel/cobalt/arch/arm64/thread.c
+++ b/kernel/cobalt/arch/arm64/thread.c
@@ -32,16 +32,31 @@
 #include 
 #include 
 #include 
-
+#include 
 
 #if defined(CONFIG_XENO_ARCH_FPU)
 
-static DEFINE_MUTEX(vfp_check_lock);
+static void enable_fpsimd(void) {
+   __asm__ __volatile__("mrs x1, cpacr_el1\n\
+   orr x1, x1, #(0x3 << 20)\n\
+   msr cpacr_el1, x1\n\
+   isb" : : : "x1", "memory", "cc");
+}
 
+static void disable_fpsimd(void) {
+   __asm__ __volatile__("mrs x1, cpacr_el1\n\
+   and x1, x1, #~(0x3 << 20)\n\
+   msr cpacr_el1, x1\n\
+   isb" : : : "x1", "memory", "cc");
+}
 
 int xnarch_fault_fpu_p(struct ipipe_trap_data *d)
 {
-   /* FPU never trapped, this will be a fault */
+   /* check if this is an FPU access trap to be handled by Xenomai */
+   if(d->exception == IPIPE_TRAP_FPU_ACC){
+   return 1;
+   }
+   /* FPU already enabled, propagate fault to kernel */
return 0;
 }
 
@@ -53,6 +68,7 @@ void xnarch_leave_root(struct xnthread *root)
 {
struct xnarchtcb *rootcb = xnthread_archtcb(root);
rootcb->fpup = get_fpu_owner(rootcb);
+   disable_fpsimd();
 }
 
 void xnarch_save_fpu(struct xnthread *thread)
@@ -65,45 +81,67 @@ void xnarch_save_fpu(struct xnthread *thread)
 void xnarch_switch_fpu(struct xnthread *from, struct xnthread *to)
 {
struct fpsimd_state *const from_fpup = from ? from->tcb.fpup : NULL;
-
-   /* always switch, no lazy switching */
-
struct fpsimd_state *const to_fpup = to->tcb.fpup;
 
-   if (from_fpup == to_fpup)
-   return;
+   /*
+* This only gets called if XNFPU flag is set, or if migrating to Linux.
+* In both cases, this means turn on FPU and switch.
+*/
+   enable_fpsimd();
+
+   if (xnthread_test_state(to, XNROOT) == 0) {
+   if (from_fpup == to_fpup)
+   return;
 
-   if (from_fpup)
-   fpsimd_save_state(from_fpup);
+   if (from_fpup)
+   fpsimd_save_state(from_fpup);
 
-   fpsimd_load_state(to_fpup);
+   fpsimd_load_state(to_fpup);
+   }
+   else {
+   /* Going to Linux. */
+   if (from_fpup)
+   fpsimd_save_state(from_fpup);
 
-   /* always set FPU enabled */
-   xnthread_set_state(to, XNFPU);
+   fpsimd_load_state(to_fpup);
+   }
 
 }
 
 int xnarch_handle_fpu_fault(struct xnthread *from, 
struct xnthread *to, struct ipipe_trap_data *d)
 {
-   /* FPU always enabled, faults force exit to Linux */
-   return 0;
+   spl_t s;
+
+   if (xnthread_test_state(to, XNFPU))
+   /* FPU is already enabled, probably an exception */
+  return 0;
+
+   xnlock_get_irqsave(, s);
+   xnthread_set_state(to, XNFPU);
+   xnlock_put_irqrestore(, s);
+
+   xnarch_switch_fpu(from, to);
+
+   return 1;
+
 }
 
 void xnarch_init_shadow_tcb(struct xnthread *thread)
 {
+   spl_t s;
struct xnarchtcb *tcb = xnthread_archtcb(thread);
 
tcb->fpup = &(tcb->core.host_task->thread.fpsimd_state);
 
-   /* XNFPU is always set, no lazy switching */
-   xnthread_set_state(thread, XNFPU);
+   xnlock_get_irqsave(, s);
+   xnthread_clear_state(thread, XNFPU);
+   xnlock_put_irqrestore(, s);
+
 }
 #endif /* CONFIG_XENO_ARCH_FPU */
 
-
 /* Switch support functions */
-
 static void xnarch_tls_thread_switch(struct task_struct *next)
 {
unsigned long tpidr, tpidrro;
@@ -141,8 +179,7 @@ static inline void xnarch_contextidr_thread_switch(struct 
task_struct *next)
 {
 }
 #endif
-
-/*/Switch support functions */
+/* End switch support functions */
 
 void xnarch_switch_to(struct xnthread *out, struct xnthread *in)
 {
@@ -173,6 +210,10 @@ void xnarch_switch_to(struct xnthread *out, struct 
xnthread *in)
xnarch_tls_thread_switch(in_tcb->core.tip->task);
xnarch_contextidr_thread_switch(in_tcb->core.tip->task);
 
+   /* check if we need to switch FPU on return to Linux */
+   if (xnthread_test_state(in, XNROOT) == 1)
+   xnarch_switch_fpu(out, in);
+
/*
 * Complete any pending TLB or cache maintenance on this CPU in case
 * the thread 

[Xenomai-git] Philippe Gerum : cobalt/clock: fix build issue w/ CONFIG_SMP off

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 8559d512a19a4b49fb0fc365a271627802d93c47
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=8559d512a19a4b49fb0fc365a271627802d93c47

Author: Philippe Gerum 
Date:   Fri Nov 18 19:05:19 2016 +0100

cobalt/clock: fix build issue w/ CONFIG_SMP off

---

 kernel/cobalt/clock.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/cobalt/clock.c b/kernel/cobalt/clock.c
index 796358f..61778cd 100644
--- a/kernel/cobalt/clock.c
+++ b/kernel/cobalt/clock.c
@@ -744,6 +744,7 @@ void xnclock_tick(struct xnclock *clock)
 
atomic_only();
 
+#ifdef CONFIG_SMP
/*
 * Some external clock devices may have no percpu semantics,
 * in which case all timers are queued to slot #0.
@@ -753,6 +754,7 @@ void xnclock_tick(struct xnclock *clock)
!cpumask_test_cpu(xnsched_cpu(sched), >affinity))
tmq = _percpu_timerdata(clock, 0)->q;
else
+#endif
tmq = _this_timerdata(clock)->q;

/*


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/synch: add support for priority ceiling protocol

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 9d41c0ef9d49772c6aceac59031773bb75fc5bd0
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=9d41c0ef9d49772c6aceac59031773bb75fc5bd0

Author: Philippe Gerum 
Date:   Tue Feb 16 10:12:55 2016 +0100

cobalt/synch: add support for priority ceiling protocol

---

 include/cobalt/kernel/heap.h   |   11 +
 include/cobalt/kernel/sched-idle.h |   12 +-
 include/cobalt/kernel/sched-rt.h   |   55 ++-
 include/cobalt/kernel/sched.h  |   94 +++-
 include/cobalt/kernel/synch.h  |   51 ++-
 include/cobalt/kernel/thread.h |   54 ++-
 include/cobalt/uapi/asm-generic/features.h |   27 +-
 include/cobalt/uapi/kernel/synch.h |8 +-
 include/cobalt/uapi/kernel/thread.h|3 +-
 include/cobalt/uapi/kernel/types.h |5 +-
 include/cobalt/uapi/mutex.h|1 +
 include/cobalt/uapi/thread.h   |1 +
 kernel/cobalt/posix/cond.c |2 +-
 kernel/cobalt/posix/memory.h   |6 +
 kernel/cobalt/posix/monitor.c  |   29 +-
 kernel/cobalt/posix/mqueue.c   |4 +-
 kernel/cobalt/posix/mutex.c|  103 +++--
 kernel/cobalt/posix/process.c  |   21 +-
 kernel/cobalt/posix/process.h  |3 +-
 kernel/cobalt/posix/syscall.c  |6 +-
 kernel/cobalt/posix/timerfd.c  |2 +-
 kernel/cobalt/rtdm/drvlib.c|2 +-
 kernel/cobalt/sched-idle.c |   12 +-
 kernel/cobalt/sched-quota.c|   24 +-
 kernel/cobalt/sched-rt.c   |   14 +-
 kernel/cobalt/sched-sporadic.c |   35 +-
 kernel/cobalt/sched-tp.c   |   42 +-
 kernel/cobalt/sched-weak.c |   16 +-
 kernel/cobalt/sched.c  |  126 +-
 kernel/cobalt/synch.c  |  636 +++-
 kernel/cobalt/thread.c |  115 ++---
 31 files changed, 1038 insertions(+), 482 deletions(-)

diff --git a/include/cobalt/kernel/heap.h b/include/cobalt/kernel/heap.h
index a1cea69..d89f25d 100644
--- a/include/cobalt/kernel/heap.h
+++ b/include/cobalt/kernel/heap.h
@@ -147,6 +147,17 @@ void xnheap_free(struct xnheap *heap, void *block);
 
 int xnheap_check_block(struct xnheap *heap, void *block);
 
+static inline void *xnheap_zalloc(struct xnheap *heap, u32 size)
+{
+   void *p;
+
+   p = xnheap_alloc(heap, size);
+   if (p)
+   memset(p, 0, size);
+
+   return p;
+}
+
 static inline char *xnstrdup(const char *s)
 {
char *p;
diff --git a/include/cobalt/kernel/sched-idle.h 
b/include/cobalt/kernel/sched-idle.h
index 732ff84..75efdec 100644
--- a/include/cobalt/kernel/sched-idle.h
+++ b/include/cobalt/kernel/sched-idle.h
@@ -33,11 +33,11 @@
 
 extern struct xnsched_class xnsched_class_idle;
 
-static inline void __xnsched_idle_setparam(struct xnthread *thread,
+static inline bool __xnsched_idle_setparam(struct xnthread *thread,
   const union xnsched_policy_param *p)
 {
xnthread_clear_state(thread, XNWEAK);
-   thread->cprio = p->idle.prio;
+   return xnsched_set_effective_priority(thread, p->idle.prio);
 }
 
 static inline void __xnsched_idle_getparam(struct xnthread *thread,
@@ -50,11 +50,17 @@ static inline void __xnsched_idle_trackprio(struct xnthread 
*thread,
const union xnsched_policy_param *p)
 {
if (p)
-   __xnsched_idle_setparam(thread, p);
+   /* Inheriting a priority-less class makes no sense. */
+   XENO_WARN_ON_ONCE(COBALT, 1);
else
thread->cprio = XNSCHED_IDLE_PRIO;
 }
 
+static inline void __xnsched_idle_protectprio(struct xnthread *thread, int 
prio)
+{
+   XENO_WARN_ON_ONCE(COBALT, 1);
+}
+
 static inline int xnsched_idle_init_thread(struct xnthread *thread)
 {
return 0;
diff --git a/include/cobalt/kernel/sched-rt.h b/include/cobalt/kernel/sched-rt.h
index ffb7223..992a5ba 100644
--- a/include/cobalt/kernel/sched-rt.h
+++ b/include/cobalt/kernel/sched-rt.h
@@ -67,20 +67,33 @@ static inline void __xnsched_rt_dequeue(struct xnthread 
*thread)
xnsched_delq(>sched->rt.runnable, thread);
 }
 
-static inline void __xnsched_rt_setparam(struct xnthread *thread,
-const union xnsched_policy_param *p)
+static inline void __xnsched_rt_track_weakness(struct xnthread *thread)
 {
-   thread->cprio = p->rt.prio;
-   if (!xnthread_test_state(thread, XNBOOST)) {
-#ifdef CONFIG_XENO_OPT_SCHED_WEAK
+   /*
+* We have to track threads exiting weak scheduling, i.e. any
+* thread leaving the WEAK class code if compiled in, or
+* assigned a zero priority if weak threads are hosted by the
+* RT class.
+*
+* CAUTION: since we need to 

[Xenomai-git] Philippe Gerum : cobalt/arm64: fpu: drop obsolete xnarch_save_fpu()

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 680362fe3f059778dd3caabe864e813abe16c787
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=680362fe3f059778dd3caabe864e813abe16c787

Author: Philippe Gerum 
Date:   Thu Sep  8 16:29:59 2016 +0200

cobalt/arm64: fpu: drop obsolete xnarch_save_fpu()

---

 kernel/cobalt/arch/arm64/include/asm/xenomai/thread.h |4 
 1 file changed, 4 deletions(-)

diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/thread.h 
b/kernel/cobalt/arch/arm64/include/asm/xenomai/thread.h
index 4b247ac..ac1f1f7 100644
--- a/kernel/cobalt/arch/arm64/include/asm/xenomai/thread.h
+++ b/kernel/cobalt/arch/arm64/include/asm/xenomai/thread.h
@@ -75,8 +75,6 @@ static inline int xnarch_fault_fpu_p(struct ipipe_trap_data 
*d)
 
 void xnarch_leave_root(struct xnthread *root);
 
-void xnarch_save_fpu(struct xnthread *thread);
-
 void xnarch_switch_fpu(struct xnthread *from, struct xnthread *thread);
 
 static inline int
@@ -103,8 +101,6 @@ static inline int xnarch_fault_fpu_p(struct ipipe_trap_data 
*d)
 
 static inline void xnarch_leave_root(struct xnthread *root) { }
 
-static inline void xnarch_save_fpu(struct xnthread *thread) { }
-
 static inline void xnarch_switch_fpu(struct xnthread *f, struct xnthread *t) { 
}
 
 static inline int xnarch_handle_fpu_fault(struct xnthread *from, 


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Gilles Chanteperdrix : testsuite/smokey: add RTnet raw packets test

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 133accb0049efc7b369a947daff84d7963f285bd
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=133accb0049efc7b369a947daff84d7963f285bd

Author: Gilles Chanteperdrix 
Date:   Sun Nov  1 19:14:40 2015 +0100

testsuite/smokey: add RTnet raw packets test

---

 configure.ac |1 +
 1 file changed, 1 insertion(+)

diff --git a/configure.ac b/configure.ac
index 4a3f7c7..4bf37b1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -908,6 +908,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/fpu-stress/Makefile \
testsuite/smokey/net_udp/Makefile \
testsuite/smokey/net_packet_dgram/Makefile \
+   testsuite/smokey/net_packet_raw/Makefile \
testsuite/smokey/net_common/Makefile \
testsuite/clocktest/Makefile \
testsuite/xeno-test/Makefile \


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : lib/cobalt/mutex: add support for priority ceiling protocol

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 285c4c87ee959168507006919ca3374509893556
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=285c4c87ee959168507006919ca3374509893556

Author: Philippe Gerum 
Date:   Tue Feb 16 10:13:03 2016 +0100

lib/cobalt/mutex: add support for priority ceiling protocol

---

 configure.ac   |2 +
 include/boilerplate/libc.h |   19 +++
 include/cobalt/pthread.h   |7 ++
 lib/cobalt/cobalt.wrappers |2 +
 lib/cobalt/init.c  |1 +
 lib/cobalt/internal.h  |8 ++
 lib/cobalt/mutex.c |  301 +++-
 lib/cobalt/sched.c |   33 -
 lib/cobalt/thread.c|7 +-
 9 files changed, 311 insertions(+), 69 deletions(-)

diff --git a/configure.ac b/configure.ac
index e1f060a..0daddd6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -508,6 +508,8 @@ save_LIBS="$LIBS"
 LIBS="$LIBS -lrt -lpthread"
 AC_CHECK_FUNCS([pthread_mutexattr_setprotocol  \
pthread_mutexattr_getprotocol   \
+   pthread_mutexattr_getprioceiling \
+   pthread_mutexattr_setprioceiling \
pthread_mutexattr_setrobust_np  \
pthread_condattr_getclock   \
pthread_condattr_setclock   \
diff --git a/include/boilerplate/libc.h b/include/boilerplate/libc.h
index d8b0334..4cd80b0 100644
--- a/include/boilerplate/libc.h
+++ b/include/boilerplate/libc.h
@@ -108,6 +108,25 @@ int pthread_mutexattr_getprotocol(const 
pthread_mutexattr_t *
 }
 #endif /* !HAVE_PTHREAD_MUTEXATTR_GETPROTOCOL */
 
+#ifndef HAVE_PTHREAD_MUTEXATTR_SETPRIOCEILING
+static inline
+int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *attr,
+int prioceiling)
+{
+   return ENOSYS;
+}
+#endif /* !HAVE_PTHREAD_MUTEXATTR_SETPRIOCEILING */
+
+#ifndef HAVE_PTHREAD_MUTEXATTR_GETPRIOCEILING
+static inline
+int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t *
+ __restrict attr,
+int *__restrict prioceiling)
+{
+   return ENOSYS;
+}
+#endif /* !HAVE_PTHREAD_MUTEXATTR_GETPRIOCEILING */
+
 #ifndef HAVE_PTHREAD_ATTR_SETAFFINITY_NP
 #include 
 static inline
diff --git a/include/cobalt/pthread.h b/include/cobalt/pthread.h
index 386c337..f1b1c8a 100644
--- a/include/cobalt/pthread.h
+++ b/include/cobalt/pthread.h
@@ -67,6 +67,13 @@ COBALT_DECL(int, pthread_mutex_trylock(pthread_mutex_t 
*mutex));
 
 COBALT_DECL(int, pthread_mutex_unlock(pthread_mutex_t *mutex));
 
+COBALT_DECL(int, pthread_mutex_setprioceiling(pthread_mutex_t *__restrict 
mutex,
+ int prioceiling,
+ int *__restrict old_ceiling));
+  
+COBALT_DECL(int, pthread_mutex_getprioceiling(pthread_mutex_t *__restrict 
mutex,
+ int *__restrict old_ceiling));
+
 COBALT_DECL(int, pthread_cond_init (pthread_cond_t *cond,
const pthread_condattr_t *attr));
 
diff --git a/lib/cobalt/cobalt.wrappers b/lib/cobalt/cobalt.wrappers
index 9480f34..75f29d6 100644
--- a/lib/cobalt/cobalt.wrappers
+++ b/lib/cobalt/cobalt.wrappers
@@ -32,6 +32,8 @@
 --wrap pthread_mutex_trylock
 --wrap pthread_mutex_timedlock
 --wrap pthread_mutex_unlock
+--wrap pthread_mutex_setprioceiling
+--wrap pthread_mutex_getprioceiling
 --wrap pthread_cond_init
 --wrap pthread_cond_destroy
 --wrap pthread_cond_wait
diff --git a/lib/cobalt/init.c b/lib/cobalt/init.c
index f260744..69d4763 100644
--- a/lib/cobalt/init.c
+++ b/lib/cobalt/init.c
@@ -177,6 +177,7 @@ static void __cobalt_init(void)
sizeof(struct cobalt_sem_shadow));
 
cobalt_mutex_init();
+   cobalt_sched_init();
cobalt_thread_init();
cobalt_print_init();
 }
diff --git a/lib/cobalt/internal.h b/lib/cobalt/internal.h
index fee3fe1..4b8252b 100644
--- a/lib/cobalt/internal.h
+++ b/lib/cobalt/internal.h
@@ -52,6 +52,8 @@ void cobalt_thread_init(void);
 
 int cobalt_thread_probe(pid_t pid);
 
+void cobalt_sched_init(void);
+
 void cobalt_print_init(void);
 
 void cobalt_print_init_atfork(void);
@@ -73,4 +75,10 @@ void cobalt_check_features(struct cobalt_featinfo *finfo);
 
 extern struct sigaction __cobalt_orig_sigdebug;
 
+extern int __cobalt_std_fifo_minpri,
+  __cobalt_std_fifo_maxpri;
+
+extern int __cobalt_std_rr_minpri,
+  __cobalt_std_rr_maxpri;
+
 #endif /* _LIB_COBALT_INTERNAL_H */
diff --git a/lib/cobalt/mutex.c b/lib/cobalt/mutex.c
index 9d8a914..1456099 100644
--- a/lib/cobalt/mutex.c
+++ b/lib/cobalt/mutex.c
@@ -99,6 +99,9 @@ void cobalt_mutex_init(void)
  *   mutex, increase CONFIG_XENO_OPT_SHARED_HEAPSZ for a process-shared
  *   mutex, or CONFIG_XENO_OPT_PRIVATE_HEAPSZ for a process-private mutex.
  * - EAGAIN, no registry slot available, check/raise 
CONFIG_XENO_OPT_REGISTRY_NRSLOTS.
+ * - ENOSYS, @a attr mentions 

[Xenomai-git] Philippe Gerum : testsuite/smokey: mutex: simplify, introduce PP tests

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 5ffb02326a016241cc188865e28d7f7523279a92
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=5ffb02326a016241cc188865e28d7f7523279a92

Author: Philippe Gerum 
Date:   Wed Feb 17 09:21:27 2016 +0100

testsuite/smokey: mutex: simplify, introduce PP tests

At this chance, the lock stealing test is also fixed.

---

 testsuite/smokey/posix-mutex/posix-mutex.c | 1357 ++--
 1 file changed, 670 insertions(+), 687 deletions(-)

diff --git a/testsuite/smokey/posix-mutex/posix-mutex.c 
b/testsuite/smokey/posix-mutex/posix-mutex.c
index ac71b31..ae82fc1 100644
--- a/testsuite/smokey/posix-mutex/posix-mutex.c
+++ b/testsuite/smokey/posix-mutex/posix-mutex.c
@@ -4,6 +4,7 @@
  * Copyright (C) Gilles Chanteperdrix  ,
  *   Marion Deveaud ,
  *   Jan Kiszka 
+ *   Philippe Gerum 
  *
  * Released under the terms of GPLv2.
  */
@@ -17,8 +18,6 @@
 #include 
 #include 
 #include 
-#include 
-#include "lib/cobalt/current.h"
 #include 
 
 smokey_test_plugin(posix_mutex,
@@ -26,886 +25,870 @@ smokey_test_plugin(posix_mutex,
   "Check POSIX mutex services"
 );
 
-#define MUTEX_CREATE   1
-#define MUTEX_LOCK 2
-#define MUTEX_TRYLOCK  3
-#define MUTEX_TIMED_LOCK   4
-#define MUTEX_UNLOCK   5
-#define MUTEX_DESTROY  6
-#define COND_CREATE7
-#define COND_SIGNAL8
-#define COND_WAIT  9
-#define COND_DESTROY   10
-#define THREAD_DETACH  11
-#define THREAD_CREATE  12
-#define THREAD_JOIN13
-#define THREAD_RENICE   14
-
-#define NS_PER_MS  100
-
 static const char *reason_str[] = {
-   [SIGDEBUG_UNDEFINED] = "undefined",
+   [SIGDEBUG_UNDEFINED] = "received SIGDEBUG for unknown reason",
[SIGDEBUG_MIGRATE_SIGNAL] = "received signal",
[SIGDEBUG_MIGRATE_SYSCALL] = "invoked syscall",
[SIGDEBUG_MIGRATE_FAULT] = "triggered fault",
[SIGDEBUG_MIGRATE_PRIOINV] = "affected by priority inversion",
-   [SIGDEBUG_NOMLOCK] = "missing mlockall",
-   [SIGDEBUG_WATCHDOG] = "runaway thread",
+   [SIGDEBUG_NOMLOCK] = "process memory not locked",
+   [SIGDEBUG_WATCHDOG] = "watchdog triggered (period too short?)",
+   [SIGDEBUG_LOCK_BREAK] = "scheduler lock break",
 };
 
 static void sigdebug(int sig, siginfo_t *si, void *context)
 {
+   const char fmt[] = "%s, this is unexpected.\n"
+   "(enabling CONFIG_XENO_OPT_DEBUG_TRACE_RELAX may help)\n";
unsigned int reason = sigdebug_reason(si);
+   int n __attribute__ ((unused));
+   static char buffer[256];
 
-   smokey_trace("\nSIGDEBUG received, reason %d: %s\n", reason,
-reason <= SIGDEBUG_WATCHDOG ? reason_str[reason] : 
"");
-}
+   if (reason > SIGDEBUG_WATCHDOG)
+   reason = SIGDEBUG_UNDEFINED;
 
-static inline unsigned long long timer_get_tsc(void)
-{
-   return clockobj_get_tsc();
+   n = snprintf(buffer, sizeof(buffer), fmt, reason_str[reason]);
+   n = write(STDERR_FILENO, buffer, n);
 }
 
-static inline unsigned long long timer_tsc2ns(unsigned long long tsc)
-{
-   return clockobj_tsc_to_ns(tsc);
-}
+#define THREAD_PRIO_WEAK   0
+#define THREAD_PRIO_LOW1
+#define THREAD_PRIO_MEDIUM 2
+#define THREAD_PRIO_HIGH   3
+#define THREAD_PRIO_VERY_HIGH  4
 
-static void add_timespec(struct timespec *ts, unsigned long long value)
-{
-   ts->tv_sec += value / 10;
-   ts->tv_nsec += value % 10;
-   if (ts->tv_nsec > 10) {
-   ts->tv_sec++;
-   ts->tv_nsec -= 10;
-   }
-}
+#define MAX_100_MS  1ULL
+
+struct locker_context {
+   pthread_mutex_t *mutex;
+   struct smokey_barrier *barrier;
+   int lock_acquired;
+};
 
-static void ms_sleep(int time)
+static void sleep_ms(unsigned int ms)  /* < 1000 */
 {
struct timespec ts;
-
+   
ts.tv_sec = 0;
-   ts.tv_nsec = time*NS_PER_MS;
-
-   nanosleep(, NULL);
+   ts.tv_nsec = ms * 100;
+   clock_nanosleep(CLOCK_MONOTONIC, 0, , NULL);
 }
 
-static void check_current_prio(int expected_prio)
+static int get_effective_prio(void) 
 {
struct cobalt_threadstat stat;
int ret;
 
ret = cobalt_thread_stat(0, );
-   if (ret) {
-   fprintf(stderr,
-   "FAILURE: cobalt_threadstat (%s)\n", strerror(-ret));
-   exit(EXIT_FAILURE);
-   }
+   if (ret)
+   return ret;
 
-   if (stat.cprio != expected_prio) {
-   fprintf(stderr,
-   "FAILURE: current prio (%d) != expected prio (%d)\n",
-   stat.cprio, expected_prio);
-   exit(EXIT_FAILURE);
-   }
+   

[Xenomai-git] Jan Kiszka : cobalt/kernel: Return need_resched flag from xnsynch_release

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: efaef202d14f9df3c12697ddbd169997597621c9
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=efaef202d14f9df3c12697ddbd169997597621c9

Author: Jan Kiszka 
Date:   Mon May  9 21:19:04 2016 +0200

cobalt/kernel: Return need_resched flag from xnsynch_release

We currently return the next owner, but no caller of xnsynch_release
evaluates this beyond != NULL and calls xnsched_run in that case.
Simplify the API by returning a need_resched flag directly. This will
also help with fixing the missing reschedule after PP deboost.

Signed-off-by: Jan Kiszka 

---

 include/cobalt/kernel/synch.h |3 +--
 kernel/cobalt/posix/mutex.c   |2 +-
 kernel/cobalt/rtdm/drvlib.c   |2 +-
 kernel/cobalt/synch.c |   23 +++
 4 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/include/cobalt/kernel/synch.h b/include/cobalt/kernel/synch.h
index 04d7f10..1e99c18 100644
--- a/include/cobalt/kernel/synch.h
+++ b/include/cobalt/kernel/synch.h
@@ -164,8 +164,7 @@ int xnsynch_acquire(struct xnsynch *synch,
 
 int xnsynch_try_acquire(struct xnsynch *synch);
 
-struct xnthread *xnsynch_release(struct xnsynch *synch,
-struct xnthread *thread);
+bool xnsynch_release(struct xnsynch *synch, struct xnthread *thread);
 
 struct xnthread *xnsynch_peek_pendq(struct xnsynch *synch);
 
diff --git a/kernel/cobalt/posix/mutex.c b/kernel/cobalt/posix/mutex.c
index c6020ff..f99874b 100644
--- a/kernel/cobalt/posix/mutex.c
+++ b/kernel/cobalt/posix/mutex.c
@@ -128,7 +128,7 @@ int cobalt_mutex_release(struct xnthread *curr,
cobalt_cond_deferred_signals(cond);
}
}
-   need_resched |= xnsynch_release(>synchbase, curr) != NULL;
+   need_resched |= xnsynch_release(>synchbase, curr);
 
return need_resched;
 }
diff --git a/kernel/cobalt/rtdm/drvlib.c b/kernel/cobalt/rtdm/drvlib.c
index ae55a4b..1973c37 100644
--- a/kernel/cobalt/rtdm/drvlib.c
+++ b/kernel/cobalt/rtdm/drvlib.c
@@ -1282,7 +1282,7 @@ void rtdm_mutex_unlock(rtdm_mutex_t *mutex)
trace_cobalt_driver_mutex_release(mutex);
 
if (unlikely(xnsynch_release(>synch_base,
-xnsched_current_thread()) != NULL))
+xnsched_current_thread(
xnsched_run();
 }
 EXPORT_SYMBOL_GPL(rtdm_mutex_unlock);
diff --git a/kernel/cobalt/synch.c b/kernel/cobalt/synch.c
index 976261d..d8b83d9 100644
--- a/kernel/cobalt/synch.c
+++ b/kernel/cobalt/synch.c
@@ -843,8 +843,8 @@ static inline void clear_pp_boost(struct xnsynch *synch,
drop_booster(synch, owner);
 }
 
-static struct xnthread *transfer_ownership(struct xnsynch *synch,
-  struct xnthread *lastowner)
+static bool transfer_ownership(struct xnsynch *synch,
+  struct xnthread *lastowner)
 {  /* nklock held, irqs off */
struct xnthread *nextowner;
xnhandle_t nextownerh;
@@ -859,7 +859,7 @@ static struct xnthread *transfer_ownership(struct xnsynch 
*synch,
if (list_empty(>pendq)) {
synch->owner = NULL;
atomic_set(lockp, XN_NO_HANDLE);
-   return NULL;
+   return false;
}
 
nextowner = list_first_entry(>pendq, struct xnthread, plink);
@@ -879,11 +879,11 @@ static struct xnthread *transfer_ownership(struct xnsynch 
*synch,
 
atomic_set(lockp, nextownerh);
 
-   return nextowner;
+   return true;
 }
 
 /**
- * @fn struct xnthread *xnsynch_release(struct xnsynch *synch, struct xnthread 
*curr)
+ * @fn bool xnsynch_release(struct xnsynch *synch, struct xnthread *curr)
  * @brief Release a resource and pass it to the next waiting thread.
  *
  * This service releases the ownership of the given synchronization
@@ -900,7 +900,7 @@ static struct xnthread *transfer_ownership(struct xnsynch 
*synch,
  * @param curr The descriptor address of the current thread, which
  * must own the object at the time of calling.
  *
- * @return The descriptor address of the unblocked thread.
+ * @return True if a reschedule is required.
  *
  * @sideeffect
  *
@@ -913,10 +913,9 @@ static struct xnthread *transfer_ownership(struct xnsynch 
*synch,
  *
  * @coretags{primary-only, might-switch}
  */
-struct xnthread *xnsynch_release(struct xnsynch *synch,
-struct xnthread *curr)
+bool xnsynch_release(struct xnsynch *synch, struct xnthread *curr)
 {
-   struct xnthread *nextowner = NULL;
+   bool need_resched = false;
xnhandle_t currh, h;
atomic_t *lockp;
spl_t s;
@@ -926,7 +925,7 @@ struct xnthread *xnsynch_release(struct xnsynch *synch,
trace_cobalt_synch_release(synch);
 
if (xnthread_put_resource(curr))
-   return NULL;
+   return false;
 
   

[Xenomai-git] Philippe Gerum : cobalt/wrappers: add wrapper for reinit_completion()

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 6ab5b8a763a597cefd620230afc631f7e1c60df7
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=6ab5b8a763a597cefd620230afc631f7e1c60df7

Author: Philippe Gerum 
Date:   Thu Mar  3 09:16:21 2016 +0100

cobalt/wrappers: add wrapper for reinit_completion()

---

 kernel/cobalt/include/asm-generic/xenomai/wrappers.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/cobalt/include/asm-generic/xenomai/wrappers.h 
b/kernel/cobalt/include/asm-generic/xenomai/wrappers.h
index ceaf647..060ce85 100644
--- a/kernel/cobalt/include/asm-generic/xenomai/wrappers.h
+++ b/kernel/cobalt/include/asm-generic/xenomai/wrappers.h
@@ -44,7 +44,6 @@
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0)
 #include 
-#include 
 
 #undef alloc_netdev
 #define alloc_netdev(sizeof_priv, name, name_assign_type, setup) \
@@ -57,6 +56,7 @@ trace_seq_buffer_ptr(struct trace_seq *s)
 {
return s->buffer + s->len;
 }
+
 #endif /* < 3.17 */
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0)


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : config: bump version info to 3.1-devel

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: ab15f8c5bdc193635a22c9b42b2c882214023209
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=ab15f8c5bdc193635a22c9b42b2c882214023209

Author: Philippe Gerum 
Date:   Sun Mar 20 18:51:17 2016 +0100

config: bump version info to 3.1-devel

---

 config/version-code  |2 +-
 config/version-label |2 +-
 config/version-name  |2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/config/version-code b/config/version-code
index 75a22a2..ddd61cc 100644
--- a/config/version-code
+++ b/config/version-code
@@ -1 +1 @@
-3.0.3
+3.0.90
diff --git a/config/version-label b/config/version-label
index 75a22a2..302fdd0 100644
--- a/config/version-label
+++ b/config/version-label
@@ -1 +1 @@
-3.0.3
+3.1-devel
diff --git a/config/version-name b/config/version-name
index 09ba594..8c51501 100644
--- a/config/version-name
+++ b/config/version-name
@@ -1 +1 @@
-Groovy Cosmic Halo
+Xenomai -next


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : boilerplate: add AVL library

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 2d4ff23966c40cf24cb0ad671a38d3d4c47aeef7
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=2d4ff23966c40cf24cb0ad671a38d3d4c47aeef7

Author: Philippe Gerum 
Date:   Tue May 31 17:30:21 2016 +0200

boilerplate: add AVL library

---

 include/boilerplate/Makefile.am |1 +
 include/boilerplate/avl.h   |  298 ++
 lib/boilerplate/Makefile.am |1 +
 lib/boilerplate/avl.c   |  380 +++
 4 files changed, 680 insertions(+)

diff --git a/include/boilerplate/Makefile.am b/include/boilerplate/Makefile.am
index 2d3ace8..c975509 100644
--- a/include/boilerplate/Makefile.am
+++ b/include/boilerplate/Makefile.am
@@ -3,6 +3,7 @@ includesubdir = $(includedir)/boilerplate
 includesub_HEADERS =   \
ancillaries.h   \
atomic.h\
+   avl.h   \
compiler.h  \
debug.h \
hash.h  \
diff --git a/include/boilerplate/avl.h b/include/boilerplate/avl.h
new file mode 100644
index 000..1aa84bf
--- /dev/null
+++ b/include/boilerplate/avl.h
@@ -0,0 +1,298 @@
+/*
+ * Copyright (c) 2015 Gilles Chanteperdrix
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#ifndef _BOILERPLATE_AVL_H
+#define _BOILERPLATE_AVL_H
+
+#include 
+
+struct avlh {
+   unsigned int thr: 3;
+   int type: 2;
+   int balance :2;
+   unsigned int flags :25; /* Application-specific */
+   struct avlh *link[3];
+};
+
+/* Using -1 and 1 for left and right is slightly faster than 0 and 1, using 0
+   for "up" is just here for orthogonality... and avoid wasting 4 bytes or
+   having to use a union in struct avlh. */
+#define AVL_LEFT -1
+#define AVL_UP0
+#define AVL_RIGHT 1
+/* maps AVL_LEFT to AVL_RIGHT and reciprocally. */
+#define avl_opposite(type)   (-(type))
+/* maps AVL_LEFT to -1 and AVL_RIGHT to 1. */
+#define avl_type2sign(type)  (type)
+/* maps AVL_LEFT and AVL_RIGHT to arrays index (or bit positions). */
+#define avl_type2index(type) ((type)+1)
+/* maps <0 to AVL_LEFT and >0 to AVL_RIGHT. */
+#define avl_sign2type(sign)  (sign)
+
+#define AVL_THR_LEFT  (1<thr |= 1 << avl_type2index(side))
+#define avlh_thr_clr(holder, side) ((holder)->thr &= ~(1 << 
avl_type2index(side)))
+#define avlh_thr_tst(holder, side) ((holder)->thr & (1 << 
avl_type2index(side)))
+#define avlh_link(holder, dir) ((holder)->link[avl_type2index(dir)])
+#define avlh_up(holder)avlh_link((holder), AVL_UP)
+#define avlh_left(holder)  avlh_link((holder), AVL_LEFT)
+#define avlh_right(holder) avlh_link((holder), AVL_RIGHT)
+#define avlh_parent_link(holder)   (avlh_link(avlh_up(holder), (holder)->type))
+
+struct avl;
+
+typedef struct avlh *avl_search_t(const struct avl *, const struct avlh *, int 
*);
+
+typedef int avlh_cmp_t(const struct avlh *const, const struct avlh *const);
+
+struct avl {
+   struct avlh anchor;
+   avl_search_t *search;
+   avlh_cmp_t *cmp;
+   struct avlh *end[3];
+   unsigned int count;
+   unsigned int height;
+};
+
+#define avl_searchfn(avl) ((avl)->search)
+#define avl_cmp(avl)  ((avl)->cmp)
+#define avl_count(avl)((avl)->count)
+#define avl_height(avl)   ((avl)->height)
+#define avl_anchor(avl)   (&(avl)->anchor)
+#define avl_end(avl, dir) ((avl)->end[avl_type2index(dir)])
+#define avl_top(avl)  (avlh_right(avl_anchor(avl)))
+#define avl_head(avl) (avl_end((avl), AVL_LEFT))
+#define avl_tail(avl) (avl_end((avl), AVL_RIGHT))
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void avl_init(struct avl *avl, avl_search_t *search, avlh_cmp_t *cmp);
+
+void avl_destroy(struct avl *avl);
+
+void avl_clear(struct avl *avl, void (*destruct)(struct avlh 

[Xenomai-git] Jorge Ramirez-Ortiz : utils/analogy: fix error check [SIGSEGV]

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: a03a4016864a19d6de577192ef82e56234ab9365
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=a03a4016864a19d6de577192ef82e56234ab9365

Author: Jorge Ramirez-Ortiz 
Date:   Wed Oct  5 21:34:27 2016 +0200

utils/analogy: fix error check [SIGSEGV]

---

 utils/analogy/cmd_read.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/utils/analogy/cmd_read.c b/utils/analogy/cmd_read.c
index a507801..86522f4 100644
--- a/utils/analogy/cmd_read.c
+++ b/utils/analogy/cmd_read.c
@@ -261,12 +261,12 @@ static int map_subdevice_buffer(a4l_desc_t *dsc, unsigned 
long *buf_size, void *
 
 static int cmd_read(struct arguments *arg)
 {
-   unsigned int i, scan_size = 0, cnt = 0, ret = 0, len, ofs;
+   unsigned int i, scan_size = 0, cnt = 0, len, ofs;
dump_function_t dump_function = dump_text;
a4l_desc_t dsc = { .sbdata = NULL };
unsigned long buf_size;
char **argv = arg->argv;
-   int argc = arg->argc;
+   int ret = 0, argc = arg->argc;
void *map = NULL;
 
for (;;) {


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/arm64: switch to regular system call convention

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: c5fa33882e6fe1d0af84375eba2dd555a54c15f7
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=c5fa33882e6fe1d0af84375eba2dd555a54c15f7

Author: Philippe Gerum 
Date:   Mon Oct 19 15:54:55 2015 +0200

cobalt/arm64: switch to regular system call convention

---

 .../arch/arm64/include/asm/xenomai/syscall.h   |   29 +---
 .../arch/arm64/include/asm/xenomai/uapi/syscall.h  |8 +-
 lib/cobalt/arch/arm64/features.c   |8 -
 .../arch/arm64/include/asm/xenomai/syscall.h   |  180 
 lib/cobalt/arch/arm64/include/asm/xenomai/tsc.h|   19 +--
 5 files changed, 78 insertions(+), 166 deletions(-)

diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/syscall.h 
b/kernel/cobalt/arch/arm64/include/asm/xenomai/syscall.h
index 949f287..9fc6522 100644
--- a/kernel/cobalt/arch/arm64/include/asm/xenomai/syscall.h
+++ b/kernel/cobalt/arch/arm64/include/asm/xenomai/syscall.h
@@ -28,31 +28,16 @@
 #include 
 #include 
 
-#ifndef __NR_SYSCALL_BASE
-#define __NR_SYSCALL_BASE 0
-#endif
-
-#ifndef __ARM_NR_ipipe
-/* Legacy pipelines do not define this. */
-#define __ARM_NR_ipipe (__NR_SYSCALL_BASE + XENO_ARM_SYSCALL)
-#endif
-
-#define __xn_reg_sys(__regs)   ((__regs)->orig_x0)
-/* In OABI_COMPAT mode, handle both OABI and EABI userspace syscalls */
-#ifdef CONFIG_OABI_COMPAT
-#define __xn_syscall_p(__regs) (((__regs)->regs[8] == __NR_OABI_SYSCALL_BASE + 
XENO_ARM_SYSCALL) || \
-((__regs)->regs[8] == __ARM_NR_ipipe))
-#else /* !CONFIG_OABI_COMPAT */
-#define __xn_syscall_p(__regs) ((__regs)->regs[8] == __ARM_NR_ipipe)
-#endif /* !CONFIG_OABI_COMPAT */
+#define __xn_reg_sys(__regs)   ((unsigned long)(__regs)->syscallno)
+#define __xn_syscall_p(regs)   ((__xn_reg_sys(regs) & __COBALT_SYSCALL_BIT) != 
0)
 #define __xn_syscall(__regs)   ((unsigned long)(__xn_reg_sys(__regs) & 
~__COBALT_SYSCALL_BIT))
 
 #define __xn_reg_rval(__regs)  ((__regs)->regs[0])
-#define __xn_reg_arg1(__regs)  ((__regs)->regs[1])
-#define __xn_reg_arg2(__regs)  ((__regs)->regs[2])
-#define __xn_reg_arg3(__regs)  ((__regs)->regs[3])
-#define __xn_reg_arg4(__regs)  ((__regs)->regs[4])
-#define __xn_reg_arg5(__regs)  ((__regs)->regs[5])
+#define __xn_reg_arg1(__regs)  ((__regs)->regs[0])
+#define __xn_reg_arg2(__regs)  ((__regs)->regs[1])
+#define __xn_reg_arg3(__regs)  ((__regs)->regs[2])
+#define __xn_reg_arg4(__regs)  ((__regs)->regs[3])
+#define __xn_reg_arg5(__regs)  ((__regs)->regs[4])
 #define __xn_reg_pc(__regs)((__regs)->pc)
 #define __xn_reg_sp(__regs)((__regs)->sp)
 
diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/syscall.h 
b/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/syscall.h
index 60dabd5..5b319d6 100644
--- a/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/syscall.h
+++ b/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/syscall.h
@@ -23,12 +23,6 @@
 
 #define __xn_syscode(__nr) (__COBALT_SYSCALL_BIT | (__nr))
 
-#define XENO_ARM_SYSCALL0x000F0042 /* carefully chosen... */
-
-#define XENOMAI_SYSARCH_ATOMIC_ADD_RETURN  0
-#define XENOMAI_SYSARCH_ATOMIC_SET_MASK1
-#define XENOMAI_SYSARCH_ATOMIC_CLEAR_MASK  2
-#define XENOMAI_SYSARCH_XCHG   3
-#define XENOMAI_SYSARCH_TSCINFO 4
+#define XENOMAI_SYSARCH_TSCINFO0
 
 #endif /* !_COBALT_ARM64_ASM_UAPI_SYSCALL_H */
diff --git a/lib/cobalt/arch/arm64/features.c b/lib/cobalt/arch/arm64/features.c
index f5253a6..254c8ae 100644
--- a/lib/cobalt/arch/arm64/features.c
+++ b/lib/cobalt/arch/arm64/features.c
@@ -59,14 +59,6 @@ void cobalt_check_features(struct cobalt_featinfo *finfo)
 
page_size = sysconf(_SC_PAGESIZE);
 
-#ifndef __aarch64__
-   __xn_tscinfo.kuser_tsc_get =
-   (__xn_rdtsc_t *)(0x1004 -
-   ((*(unsigned *)(0x0ffc) + 3) << 5));
-#else
-   __xn_tscinfo.kuser_tsc_get = 0;
-#endif
-
phys_addr = (unsigned long)__xn_tscinfo.kinfo.counter;
 
addr = __STD(mmap(NULL, page_size, PROT_READ, MAP_SHARED,
diff --git a/lib/cobalt/arch/arm64/include/asm/xenomai/syscall.h 
b/lib/cobalt/arch/arm64/include/asm/xenomai/syscall.h
index 8e7ad61..d2dfda6 100644
--- a/lib/cobalt/arch/arm64/include/asm/xenomai/syscall.h
+++ b/lib/cobalt/arch/arm64/include/asm/xenomai/syscall.h
@@ -1,8 +1,5 @@
 /*
- * Copyright (C) 2001,2002,2003,2004 Philippe Gerum .
- *
- * ARM port
- *   Copyright (C) 2005 Stelian Pop
+ * Copyright (C) 2015 Philippe Gerum .
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -25,119 +22,76 @@
 #include 
 #include 
 
-/*
- * Some of the following macros have been adapted from Linux's
- * implementation of the syscall mechanism in :
- */
-
-#define LOADARGS_0(syscode, dummy...)  \
-   __a0 = (unsigned long) (syscode)
-#define 

[Xenomai-git] Philippe Gerum : net/drivers/e1000: work around UMR issue

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 4e453ce97f5ce5fe144ace1e7724c1c53a16fa9c
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=4e453ce97f5ce5fe144ace1e7724c1c53a16fa9c

Author: Philippe Gerum 
Date:   Sun Aug  7 11:29:06 2016 +0200

net/drivers/e1000: work around UMR issue

---

 kernel/drivers/net/drivers/e1000/e1000_hw.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/drivers/net/drivers/e1000/e1000_hw.c 
b/kernel/drivers/net/drivers/e1000/e1000_hw.c
index 311d48d..d974653 100644
--- a/kernel/drivers/net/drivers/e1000/e1000_hw.c
+++ b/kernel/drivers/net/drivers/e1000/e1000_hw.c
@@ -8804,7 +8804,7 @@ e1000_verify_write_ich8_byte(struct e1000_hw *hw, 
uint32_t index, uint8_t byte)
 {
 int32_t error = E1000_SUCCESS;
 int32_t program_retries;
-uint8_t temp_byte;
+uint8_t temp_byte = 0;
 
 e1000_write_ich8_byte(hw, index, byte);
 usec_delay(100);


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/syscalls: allow for handing over mode selection to syscall handlers

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: f9f23a74c6ad1cf2895da1f106d2047e29d75d94
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=f9f23a74c6ad1cf2895da1f106d2047e29d75d94

Author: Philippe Gerum 
Date:   Thu Jul  7 17:05:16 2016 +0200

cobalt/syscalls: allow for handing over mode selection to syscall handlers

Specific system calls may benefit from dealing with the caller's
runtime mode by themselves, depending on internal information which
the generic syscall dispatcher does not have access to.

To this end, a new syscall mode called "handover" is
introduced. Syscalls bearing this mode bit are always entered from the
current calling domain. The syscall handler may return -ENOSYS to
trigger a switch to the converse domain until all domains have been
visited once, at which point the syscall fails with -ENOSYS
automatically.

---

 kernel/cobalt/posix/syscall.c |1 -
 1 file changed, 1 deletion(-)

diff --git a/kernel/cobalt/posix/syscall.c b/kernel/cobalt/posix/syscall.c
index b9efa05..6282cc4 100644
--- a/kernel/cobalt/posix/syscall.c
+++ b/kernel/cobalt/posix/syscall.c
@@ -737,7 +737,6 @@ restart:
 * domain. This is a slow path, so proceed with any
 * pending schedparam update on the fly.
 */
-   switched = 0;
if (thread)
xnthread_propagate_schedparam(thread);
}


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : lib/cobalt: add config switch to enable lazy setsched update mode

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 6960e2315191701914c5a7826076b2fb028ada04
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=6960e2315191701914c5a7826076b2fb028ada04

Author: Philippe Gerum 
Date:   Sun Mar 20 17:58:33 2016 +0100

lib/cobalt: add config switch to enable lazy setsched update mode

--enable-lazy-setsched should be given for enabling lazy propagation
of scheduling parameters upon calls to pthread_setschedparam*(),
sched_setscheduler(). Defaults to off.

---

 configure.ac  |   19 +++
 lib/cobalt/internal.h |   12 
 lib/cobalt/sched.c|2 +-
 lib/cobalt/thread.c   |3 ++-
 4 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 15c7499..5bcd7f8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -284,6 +284,25 @@ if test x$workaround_condvar_pi = xy; then
fi
 fi
 
+dnl Lazy schedparam propagation for Cobalt (default: off)
+
+unset lazy_setsched_update
+AC_MSG_CHECKING(whether to enable lazy scheduling parameter update)
+AC_ARG_ENABLE(lazy-setsched,
+   AS_HELP_STRING([--enable-lazy-setsched], [Enable lazy scheduling 
parameter update]),
+   [case "$enableval" in
+   y | yes) lazy_setsched_update=y ;;
+   *) unset lazy_setsched_update ;;
+   esac])
+AC_MSG_RESULT(${lazy_setsched_update:-no})
+if test x$lazy_setsched_update = xy; then
+   if test x$rtcore_type = xcobalt; then
+   AC_DEFINE(CONFIG_XENO_LAZY_SETSCHED,1,[config])
+   else
+AC_MSG_WARN([No lazy scheduling parameter updates over Mercury - 
ignoring])
+   fi
+fi
+
 dnl Enable shared multi-processing (default: off)
 
 use_pshared=
diff --git a/lib/cobalt/internal.h b/lib/cobalt/internal.h
index 4b8252b..1531901 100644
--- a/lib/cobalt/internal.h
+++ b/lib/cobalt/internal.h
@@ -32,6 +32,18 @@ static inline int cobalt_is_relaxed(void)
return cobalt_get_current_mode() & XNRELAX;
 }
 
+#ifdef CONFIG_XENO_LAZY_SETSCHED
+static inline int cobalt_eager_setsched(void)
+{
+   return cobalt_is_relaxed();
+}
+#else
+static inline int cobalt_eager_setsched(void)
+{
+   return 1;
+}
+#endif
+
 static inline
 struct cobalt_mutex_state *mutex_get_state(struct cobalt_mutex_shadow *shadow)
 {
diff --git a/lib/cobalt/sched.c b/lib/cobalt/sched.c
index 87b9235..94f3323 100644
--- a/lib/cobalt/sched.c
+++ b/lib/cobalt/sched.c
@@ -297,7 +297,7 @@ int sched_setscheduler_ex(pid_t pid,
 
/* See pthread_setschedparam_ex(). */
 
-   if (cobalt_is_relaxed()) {
+   if (cobalt_eager_setsched()) {
std_policy = cobalt_xlate_schedparam(policy, param_ex, 
_param);
ret = __STD(sched_setscheduler(pid, std_policy, _param));
if (ret)
diff --git a/lib/cobalt/thread.c b/lib/cobalt/thread.c
index 8b4568d..908516f 100644
--- a/lib/cobalt/thread.c
+++ b/lib/cobalt/thread.c
@@ -629,7 +629,8 @@ int pthread_setschedparam_ex(pthread_t thread,
 * threads should refrain from mixing APIs for managing
 * scheduling parameters, and only rely on libcobalt for this.
 */
-   if (cobalt_is_relaxed()) { /* True if shadow not mapped yet. */
+   if (cobalt_eager_setsched()) {
+   /* True if disabled or shadow not mapped yet. */
std_policy = cobalt_xlate_schedparam(policy, param_ex, 
_param);
ret = __STD(pthread_setschedparam(thread, std_policy, 
_param));
if (ret)


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/sched: detect preemptible switch support in pipeline

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: a64c110c760a14532379fd11dee63153dd549653
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=a64c110c760a14532379fd11dee63153dd549653

Author: Philippe Gerum 
Date:   Sat Nov 14 18:07:15 2015 +0100

cobalt/sched: detect preemptible switch support in pipeline

CONFIG_XENO_ARCH_UNLOCKED_SWITCH is merely an alias for
CONFIG_IPIPE_WANT_PREEMPTIBLE_SWITCH, which is only meaningful to the
ARM architecture, now that PowerPC dropped such support.

Use the pipeline symbol directly to make the dependency explicit.

---

 include/cobalt/kernel/sched.h |8 
 kernel/cobalt/sched.c |   16 
 kernel/cobalt/thread.c|2 +-
 3 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/include/cobalt/kernel/sched.h b/include/cobalt/kernel/sched.h
index fe1df7d..d5d93c2 100644
--- a/include/cobalt/kernel/sched.h
+++ b/include/cobalt/kernel/sched.h
@@ -93,7 +93,7 @@ struct xnsched {
struct xntimer rrbtimer;
/*!< Root thread control block. */
struct xnthread rootcb;
-#ifdef CONFIG_XENO_ARCH_UNLOCKED_SWITCH
+#ifdef CONFIG_IPIPE_WANT_PREEMPTIBLE_SWITCH
struct xnthread *last;
 #endif
 #ifdef CONFIG_XENO_ARCH_FPU
@@ -329,7 +329,7 @@ static inline int xnsched_primary_p(void)
return !xnsched_unblockable_p();
 }
 
-#ifdef CONFIG_XENO_ARCH_UNLOCKED_SWITCH
+#ifdef CONFIG_IPIPE_WANT_PREEMPTIBLE_SWITCH
 
 struct xnsched *xnsched_finish_unlocked_switch(struct xnsched *sched);
 
@@ -341,7 +341,7 @@ int xnsched_maybe_resched_after_unlocked_switch(struct 
xnsched *sched)
return sched->status & XNRESCHED;
 }
 
-#else /* !CONFIG_XENO_ARCH_UNLOCKED_SWITCH */
+#else /* !CONFIG_IPIPE_WANT_PREEMPTIBLE_SWITCH */
 
 static inline struct xnsched *
 xnsched_finish_unlocked_switch(struct xnsched *sched)
@@ -358,7 +358,7 @@ xnsched_maybe_resched_after_unlocked_switch(struct xnsched 
*sched)
return 0;
 }
 
-#endif /* !CONFIG_XENO_ARCH_UNLOCKED_SWITCH */
+#endif /* !CONFIG_IPIPE_WANT_PREEMPTIBLE_SWITCH */
 
 #ifdef CONFIG_XENO_OPT_WATCHDOG
 static inline void xnsched_reset_watchdog(struct xnsched *sched)
diff --git a/kernel/cobalt/sched.c b/kernel/cobalt/sched.c
index 09960ac..b0d65d3 100644
--- a/kernel/cobalt/sched.c
+++ b/kernel/cobalt/sched.c
@@ -293,7 +293,7 @@ struct xnthread *xnsched_pick_next(struct xnsched *sched)
 #endif /* CONFIG_XENO_OPT_SCHED_CLASSES */
 }
 
-#ifdef CONFIG_XENO_ARCH_UNLOCKED_SWITCH
+#ifdef CONFIG_IPIPE_WANT_PREEMPTIBLE_SWITCH
 
 struct xnsched *xnsched_finish_unlocked_switch(struct xnsched *sched)
 {
@@ -319,7 +319,7 @@ struct xnsched *xnsched_finish_unlocked_switch(struct 
xnsched *sched)
return sched;
 }
 
-#endif /* CONFIG_XENO_ARCH_UNLOCKED_SWITCH */
+#endif /* CONFIG_IPIPE_WANT_PREEMPTIBLE_SWITCH */
 
 void xnsched_lock(void)
 {
@@ -494,16 +494,16 @@ void xnsched_migrate(struct xnthread *thread, struct 
xnsched *sched)
xnsched_set_resched(thread->sched);
migrate_thread(thread, sched);
 
-#ifdef CONFIG_XENO_ARCH_UNLOCKED_SWITCH
+#ifdef CONFIG_IPIPE_WANT_PREEMPTIBLE_SWITCH
/*
 * Mark the thread in flight, xnsched_finish_unlocked_switch()
 * will put the thread on the remote runqueue.
 */
xnthread_set_state(thread, XNMIGRATE);
-#else /* !CONFIG_XENO_ARCH_UNLOCKED_SWITCH */
+#else
/* Move thread to the remote runnable queue. */
xnsched_putback(thread);
-#endif /* !CONFIG_XENO_ARCH_UNLOCKED_SWITCH */
+#endif
 }
 
 /*
@@ -709,11 +709,11 @@ struct xnthread *xnsched_rt_pick(struct xnsched *sched)
 static inline void switch_context(struct xnsched *sched,
  struct xnthread *prev, struct xnthread *next)
 {
-#ifdef CONFIG_XENO_ARCH_UNLOCKED_SWITCH
+#ifdef CONFIG_IPIPE_WANT_PREEMPTIBLE_SWITCH
sched->last = prev;
sched->status |= XNINSW;
xnlock_clear_irqon();
-#endif /* !CONFIG_XENO_ARCH_UNLOCKED_SWITCH */
+#endif
 
xnarch_switch_to(prev, next);
 }
@@ -788,7 +788,7 @@ static inline void enter_root(struct xnthread *root)
 {
struct xnarchtcb *rootcb __maybe_unused = xnthread_archtcb(root);
 
-#ifdef CONFIG_XENO_ARCH_UNLOCKED_SWITCH
+#ifdef CONFIG_IPIPE_WANT_PREEMPTIBLE_SWITCH
if (rootcb->core.mm == NULL)
set_ti_thread_flag(rootcb->core.tip, TIF_MMSWITCH_INT);
 #endif
diff --git a/kernel/cobalt/thread.c b/kernel/cobalt/thread.c
index e0c488e..76dfbce 100644
--- a/kernel/cobalt/thread.c
+++ b/kernel/cobalt/thread.c
@@ -407,7 +407,7 @@ EXPORT_SYMBOL_GPL(xnthread_prepare_wait);
 static inline int moving_target(struct xnsched *sched, struct xnthread *thread)
 {
int ret = 0;
-#ifdef CONFIG_XENO_ARCH_UNLOCKED_SWITCH
+#ifdef CONFIG_IPIPE_WANT_PREEMPTIBLE_SWITCH
/*
 * When deleting a thread in the course of a context switch or
 * in flight to another CPU with nklock unlocked on a distant


___
Xenomai-git mailing list

[Xenomai-git] Dmitriy Cherkasov : cobalt/arm64: add basic FPU support

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: de14d34b10d563411b93f34dc158e648dd4e97ff
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=de14d34b10d563411b93f34dc158e648dd4e97ff

Author: Dmitriy Cherkasov 
Date:   Fri Sep 11 17:58:54 2015 -0700

cobalt/arm64: add basic FPU support

---

 kernel/cobalt/arch/arm64/Kconfig   |2 +-
 .../cobalt/arch/arm64/include/asm/xenomai/fptest.h |   11 +-
 .../cobalt/arch/arm64/include/asm/xenomai/thread.h |   17 +-
 .../arch/arm64/include/asm/xenomai/uapi/fptest.h   |   83 +++--
 kernel/cobalt/arch/arm64/thread.c  |  329 +---
 lib/cobalt/arch/arm64/features.c   |4 +-
 6 files changed, 153 insertions(+), 293 deletions(-)

diff --git a/kernel/cobalt/arch/arm64/Kconfig b/kernel/cobalt/arch/arm64/Kconfig
index dd5a8c6..27b5026 100644
--- a/kernel/cobalt/arch/arm64/Kconfig
+++ b/kernel/cobalt/arch/arm64/Kconfig
@@ -8,7 +8,7 @@ config XENO_ARCH_WANT_TIP
def_bool y
 
 config XENO_ARCH_FPU
-   def_bool VFP
+   def_bool y
 
 config XENO_ARCH_SYS3264
 def_bool n
diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/fptest.h 
b/kernel/cobalt/arch/arm64/include/asm/xenomai/fptest.h
index a76f1e6..743d758 100644
--- a/kernel/cobalt/arch/arm64/include/asm/xenomai/fptest.h
+++ b/kernel/cobalt/arch/arm64/include/asm/xenomai/fptest.h
@@ -20,15 +20,10 @@
 #define _COBALT_ARM_ASM_FPTEST_H
 
 #include 
+#include 
 #include 
 
-#ifdef CONFIG_VFP
-#define have_vfp (elf_hwcap & HWCAP_VFP)
-#else /* !CONFIG_VFP */
-#define have_vfp 0
-#endif /* !CONFIG_VFP */
-
-#include 
+#define have_fp (elf_hwcap & HWCAP_FP)
 
 static inline int fp_kernel_supported(void)
 {
@@ -46,7 +41,7 @@ static inline void fp_linux_end(void)
 
 static inline int fp_detect(void)
 {
-   return have_vfp ? __COBALT_HAVE_VFP : 0;
+   return have_fp ? __COBALT_HAVE_FPU : 0;
 }
 
 #endif /* _COBALT_ARM_ASM_FPTEST_H */
diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/thread.h 
b/kernel/cobalt/arch/arm64/include/asm/xenomai/thread.h
index a8d7ed4..bfcceb4 100644
--- a/kernel/cobalt/arch/arm64/include/asm/xenomai/thread.h
+++ b/kernel/cobalt/arch/arm64/include/asm/xenomai/thread.h
@@ -21,21 +21,12 @@
 
 #include 
 
-#ifdef CONFIG_XENO_ARCH_FPU
-#ifdef CONFIG_VFP
-#include 
-#endif /* CONFIG_VFP */
-#endif /* !CONFIG_XENO_ARCH_FPU */
 
 struct xnarchtcb {
struct xntcb core;
 #ifdef CONFIG_XENO_ARCH_FPU
-#ifdef CONFIG_VFP
-   union vfp_state *fpup;
+   struct fpsimd_state *fpup;
 #define xnarch_fpu_ptr(tcb) ((tcb)->fpup)
-#else
-#define xnarch_fpu_ptr(tcb) NULL
-#endif
 #endif
struct {
unsigned long pc;
@@ -67,7 +58,7 @@ static inline void xnarch_enter_root(struct xnthread *root) { 
}
 
 int xnarch_escalate(void);
 
-#if defined(CONFIG_XENO_ARCH_FPU) && defined(CONFIG_VFP)
+#if defined(CONFIG_XENO_ARCH_FPU)
 
 static inline void xnarch_init_root_tcb(struct xnthread *thread)
 {
@@ -88,7 +79,7 @@ void xnarch_switch_fpu(struct xnthread *from, struct xnthread 
*thread);
 int xnarch_handle_fpu_fault(struct xnthread *from, 
struct xnthread *to, struct ipipe_trap_data *d);
 
-#else /* !CONFIG_XENO_ARCH_FPU || !CONFIG_VFP */
+#else /* !CONFIG_XENO_ARCH_FPU */
 
 static inline void xnarch_init_root_tcb(struct xnthread *thread) { }
 static inline void xnarch_init_shadow_tcb(struct xnthread *thread) { }
@@ -114,7 +105,7 @@ static inline int xnarch_handle_fpu_fault(struct xnthread 
*from,
 {
return 0;
 }
-#endif /*  !CONFIG_XENO_ARCH_FPU || !CONFIG_VFP */
+#endif /*  !CONFIG_XENO_ARCH_FPU */
 
 static inline void xnarch_enable_kfpu(void) { }
 
diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/fptest.h 
b/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/fptest.h
index 65a3e31..25bc976 100644
--- a/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/fptest.h
+++ b/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/fptest.h
@@ -18,53 +18,86 @@
 #ifndef _COBALT_ARM_ASM_UAPI_FPTEST_H
 #define _COBALT_ARM_ASM_UAPI_FPTEST_H
 
-#ifdef __aarch64__
-/* CP10 and CP11, used for the FP/NEON operations, are already excluded from
-the list of valid operands for the generic coprocessor instructions */
-#define __COBALT_HAVE_VFP  0
-#else
-#define __COBALT_HAVE_VFP  0x1
-#endif
+#define __COBALT_HAVE_FPU  0x1
 
 static inline void fp_regs_set(int features, unsigned int val)
 {
-#if __COBALT_HAVE_VFP != 0
-   unsigned long long e[16];
+
+   unsigned long long e[32];
unsigned int i;
 
-   if (features & __COBALT_HAVE_VFP) {
-   for (i = 0; i < 16; i++)
+   if (features & __COBALT_HAVE_FPU) {
+
+   for (i = 0; i < 32; i++)
e[i] = val;
 
-   /* vldm %0!, {d0-d15},
-  AKA fldmiax %0!, {d0-d15} */
-   __asm__ __volatile__("ldc p11, cr0, [%0],#32*4":
-"=r"(i): "0"([0]): "memory");
+

[Xenomai-git] Philippe Gerum : cobalt/powerpc: drop obsolete config knob

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 88e68e368d7ce7a1c60448c0a1b117c7020fa8ea
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=88e68e368d7ce7a1c60448c0a1b117c7020fa8ea

Author: Philippe Gerum 
Date:   Sat Nov 14 18:14:53 2015 +0100

cobalt/powerpc: drop obsolete config knob

As of fbe1164, CONFIG_XENO_ARCH_UNLOCKED_SWITCH is not tested anymore
in the code base.

---

 kernel/cobalt/arch/powerpc/Kconfig |3 ---
 1 file changed, 3 deletions(-)

diff --git a/kernel/cobalt/arch/powerpc/Kconfig 
b/kernel/cobalt/arch/powerpc/Kconfig
index 1cabef3..2069288 100644
--- a/kernel/cobalt/arch/powerpc/Kconfig
+++ b/kernel/cobalt/arch/powerpc/Kconfig
@@ -10,6 +10,3 @@ config XENO_ARCH_FPU
 
 config XENO_ARCH_SYS3264
 def_bool n
-
-config XENO_ARCH_UNLOCKED_SWITCH
-   def_bool n


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Dmitriy Cherkasov : cobalt/arm64: thread.h & syscall.h: fix register references for arm64

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 25568b0b75235ea2a5b2deec84df97bb189ab81e
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=25568b0b75235ea2a5b2deec84df97bb189ab81e

Author: Dmitriy Cherkasov 
Date:   Thu May  7 16:41:09 2015 -0700

cobalt/arm64: thread.h & syscall.h: fix register references for arm64

---

 kernel/cobalt/arch/arm64/include/asm/xenomai/syscall.h |8 ++--
 kernel/cobalt/arch/arm64/include/asm/xenomai/thread.h  |2 +-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/syscall.h 
b/kernel/cobalt/arch/arm64/include/asm/xenomai/syscall.h
index f0a1090..2fdd890 100644
--- a/kernel/cobalt/arch/arm64/include/asm/xenomai/syscall.h
+++ b/kernel/cobalt/arch/arm64/include/asm/xenomai/syscall.h
@@ -28,12 +28,16 @@
 #include 
 #include 
 
+#ifndef __NR_SYSCALL_BASE
+#define __NR_SYSCALL_BASE 0
+#endif
+
 #ifndef __ARM_NR_ipipe
 /* Legacy pipelines do not define this. */
 #define __ARM_NR_ipipe (__NR_SYSCALL_BASE + XENO_ARM_SYSCALL)
 #endif
 
-#define __xn_reg_sys(__regs)   ((__regs)->ARM_ORIG_r0)
+#define __xn_reg_sys(__regs)   ((__regs)->orig_x0)
 /* In OABI_COMPAT mode, handle both OABI and EABI userspace syscalls */
 #ifdef CONFIG_OABI_COMPAT
 #define __xn_syscall_p(__regs) (((__regs)->regs[7] == __NR_OABI_SYSCALL_BASE + 
XENO_ARM_SYSCALL) || \
@@ -49,7 +53,7 @@
 #define __xn_reg_arg3(__regs)  ((__regs)->regs[3])
 #define __xn_reg_arg4(__regs)  ((__regs)->regs[4])
 #define __xn_reg_arg5(__regs)  ((__regs)->regs[5])
-#define __xn_reg_pc(__regs)((__regs)->ip)
+#define __xn_reg_pc(__regs)((__regs)->pc)
 #define __xn_reg_sp(__regs)((__regs)->sp)
 
 static inline void __xn_error_return(struct pt_regs *regs, int v)
diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/thread.h 
b/kernel/cobalt/arch/arm64/include/asm/xenomai/thread.h
index 11439a3..958f340 100644
--- a/kernel/cobalt/arch/arm64/include/asm/xenomai/thread.h
+++ b/kernel/cobalt/arch/arm64/include/asm/xenomai/thread.h
@@ -52,7 +52,7 @@ struct xnarchtcb {
 #define xnarch_fault_regs(d)   ((d)->regs)
 #define xnarch_fault_trap(d)   ((d)->exception)
 #define xnarch_fault_code(d)   (0)
-#define xnarch_fault_pc(d) ((d)->regs->ARM_pc - (thumb_mode((d)->regs) ? 2 
: 4)) /* XXX ? */
+#define xnarch_fault_pc(d) ((d)->regs->pc - 4) /* XXX ? */
 
 #define xnarch_fault_pf_p(d)   ((d)->exception == IPIPE_TRAP_ACCESS)
 #define xnarch_fault_bp_p(d)   ((current->ptrace & PT_PTRACED) &&  \


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Jan Kiszka : cobalt/kernel: Trigger missing reschedule after PP deboost

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 09a3e63bb53c19d9f1e3258b8124fc955e50ffc3
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=09a3e63bb53c19d9f1e3258b8124fc955e50ffc3

Author: Jan Kiszka 
Date:   Mon May  9 21:22:23 2016 +0200

cobalt/kernel: Trigger missing reschedule after PP deboost

xnsynch_release also needs to tell the caller about the potential need
for a reschedule after deboosting for prio-protection.

Signed-off-by: Jan Kiszka 

---

 kernel/cobalt/synch.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/cobalt/synch.c b/kernel/cobalt/synch.c
index d8b83d9..f3b70a2 100644
--- a/kernel/cobalt/synch.c
+++ b/kernel/cobalt/synch.c
@@ -949,8 +949,10 @@ bool xnsynch_release(struct xnsynch *synch, struct 
xnthread *curr)
else if (h != currh)/* FLCEIL set, FLCLAIM clear. */
atomic_set(lockp, XN_NO_HANDLE);
 
-   if (synch->status & XNSYNCH_PP)
+   if (synch->status & XNSYNCH_PP) {
clear_pp_boost(synch, curr);
+   need_resched = true;
+   }
 
xnlock_put_irqrestore(, s);
 


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Dmitriy Cherkasov : cobalt/arm64: machine.h: Add 64-bit ffnz implementation. This fixes crash when running xddp-echo.

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 9c2e932653c8bd4331c0e596e3768b1a6c044958
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=9c2e932653c8bd4331c0e596e3768b1a6c044958

Author: Dmitriy Cherkasov 
Date:   Mon Jun 15 17:10:37 2015 -0700

cobalt/arm64: machine.h: Add 64-bit ffnz implementation. This fixes crash when 
running xddp-echo.

---

 kernel/cobalt/arch/arm64/include/asm/xenomai/machine.h |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/machine.h 
b/kernel/cobalt/arch/arm64/include/asm/xenomai/machine.h
index e078564..417a7b0 100644
--- a/kernel/cobalt/arch/arm64/include/asm/xenomai/machine.h
+++ b/kernel/cobalt/arch/arm64/include/asm/xenomai/machine.h
@@ -43,9 +43,7 @@
 
 static inline __attribute_const__ unsigned long ffnz(unsigned long ul)
 {
-   int __r;
-   __asm__("clz\t%0, %1" : "=r" (__r) : "r"(ul & (-ul)) : "cc");
-   return 31 - __r;
+   return __builtin_ffsl(ul) - 1;
 }
 
 #include 


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/arm64: use regular context switching code

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: d767a4f2c4bfaba32e3b88f53847a267d3d96f2d
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=d767a4f2c4bfaba32e3b88f53847a267d3d96f2d

Author: Philippe Gerum 
Date:   Sat Oct 17 18:07:59 2015 +0200

cobalt/arm64: use regular context switching code

Instead of open coding a copy of the regular context switching code,
use __switch_to() directly, assuming the pipeline properly serializes
switches from all domains.

---

 kernel/cobalt/arch/arm64/thread.c |   66 +++--
 1 file changed, 5 insertions(+), 61 deletions(-)

diff --git a/kernel/cobalt/arch/arm64/thread.c 
b/kernel/cobalt/arch/arm64/thread.c
index 35dbd72..5282b0c 100644
--- a/kernel/cobalt/arch/arm64/thread.c
+++ b/kernel/cobalt/arch/arm64/thread.c
@@ -34,7 +34,7 @@
 #include 
 #include 
 
-#if defined(CONFIG_XENO_ARCH_FPU)
+#ifdef CONFIG_XENO_ARCH_FPU
 
 #define FPSIMD_EN (0x3 << 20)
 
@@ -60,13 +60,6 @@ static void enable_fpsimd(void)
set_cpacr(cpacr);
 }
 
-static void disable_fpsimd(void)
-{
-   unsigned long cpacr = get_cpacr();
-   cpacr &= ~FPSIMD_EN;
-   set_cpacr(cpacr);
-}
-
 int xnarch_fault_fpu_p(struct ipipe_trap_data *d)
 {
return (d->exception == IPIPE_TRAP_FPU_ACC);
@@ -130,55 +123,17 @@ void xnarch_init_shadow_tcb(struct xnthread *thread)
tcb->fpup = &(tcb->core.host_task->thread.fpsimd_state);
xnthread_clear_state(thread, XNFPU);
 }
-#endif /* CONFIG_XENO_ARCH_FPU */
 
-/* Switch support functions */
-static void xnarch_tls_thread_switch(struct task_struct *next)
-{
-   unsigned long tpidr, tpidrro;
-
-   if (!is_compat_task()) {
-   asm("mrs %0, tpidr_el0" : "=r" (tpidr));
-   current->thread.tp_value = tpidr;
-   }
-
-   if (is_compat_thread(task_thread_info(next))) {
-   tpidr = 0;
-   tpidrro = next->thread.tp_value;
-   } else {
-   tpidr = next->thread.tp_value;
-   tpidrro = 0;
-   }
-
-   asm(
-   "   msr tpidr_el0, %0\n"
-   "   msr tpidrro_el0, %1"
-   : : "r" (tpidr), "r" (tpidrro));
-}
-
-#ifdef CONFIG_PID_IN_CONTEXTIDR
-static inline void xnarch_contextidr_thread_switch(struct task_struct *next)
-{
-   asm(
-   "   msr contextidr_el1, %0\n"
-   "   isb"
-   :
-   : "r" (task_pid_nr(next)));
-}
-#else
-static inline void xnarch_contextidr_thread_switch(struct task_struct *next)
-{
-}
-#endif
-/* End switch support functions */
+#endif /* CONFIG_XENO_ARCH_FPU */
 
 void xnarch_switch_to(struct xnthread *out, struct xnthread *in)
 {
struct xnarchtcb *out_tcb = >tcb, *in_tcb = >tcb;
struct mm_struct *prev_mm, *next_mm;
-   struct task_struct *next;
+   struct task_struct *prev, *next;
 
next = in_tcb->core.host_task;
+   prev = out_tcb->core.host_task;
prev_mm = out_tcb->core.active_mm;
 
next_mm = in_tcb->core.mm;
@@ -198,18 +153,7 @@ void xnarch_switch_to(struct xnthread *out, struct 
xnthread *in)
enter_lazy_tlb(prev_mm, next);
}
 
-   xnarch_tls_thread_switch(in_tcb->core.tip->task);
-   xnarch_contextidr_thread_switch(in_tcb->core.tip->task);
-
-   /*
-* Complete any pending TLB or cache maintenance on this CPU in case
-* the thread migrates to a different CPU.
-*/
-   dsb(ish);
-
-   disable_fpsimd();
-
-   cpu_switch_to(out_tcb->core.tip->task, in_tcb->core.tip->task);
+   __switch_to(prev, next);
 }
 
 int xnarch_escalate(void)


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Dmitriy Cherkasov : cobalt/arm64: set cache aliasing and disable floating point coprocessor instructions form aarch64 /arm64

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 19412acb5580c9db8b1203db6dac5764953a
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=19412acb5580c9db8b1203db6dac5764953a

Author: Dmitriy Cherkasov 
Date:   Thu May  7 16:41:45 2015 -0700

cobalt/arm64: set cache aliasing and disable floating point coprocessor 
instructions form aarch64/arm64

---

 kernel/cobalt/arch/arm64/include/asm/xenomai/machine.h|3 ++-
 .../cobalt/arch/arm64/include/asm/xenomai/uapi/fptest.h   |   13 -
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/machine.h 
b/kernel/cobalt/arch/arm64/include/asm/xenomai/machine.h
index cf07a3f..e078564 100644
--- a/kernel/cobalt/arch/arm64/include/asm/xenomai/machine.h
+++ b/kernel/cobalt/arch/arm64/include/asm/xenomai/machine.h
@@ -38,7 +38,8 @@
 #include 
 #include 
 
-#define xnarch_cache_aliasing() cache_is_vivt()
+/* D-side always behaves as PIPT on AArch64 (see 
arch/arm64/include/asm/cachetype.h) */
+#define xnarch_cache_aliasing() 0
 
 static inline __attribute_const__ unsigned long ffnz(unsigned long ul)
 {
diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/fptest.h 
b/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/fptest.h
index b81d109..65a3e31 100644
--- a/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/fptest.h
+++ b/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/fptest.h
@@ -18,10 +18,17 @@
 #ifndef _COBALT_ARM_ASM_UAPI_FPTEST_H
 #define _COBALT_ARM_ASM_UAPI_FPTEST_H
 
+#ifdef __aarch64__
+/* CP10 and CP11, used for the FP/NEON operations, are already excluded from
+the list of valid operands for the generic coprocessor instructions */
+#define __COBALT_HAVE_VFP  0
+#else
 #define __COBALT_HAVE_VFP  0x1
+#endif
 
 static inline void fp_regs_set(int features, unsigned int val)
 {
+#if __COBALT_HAVE_VFP != 0
unsigned long long e[16];
unsigned int i;
 
@@ -34,12 +41,15 @@ static inline void fp_regs_set(int features, unsigned int 
val)
__asm__ __volatile__("ldc p11, cr0, [%0],#32*4":
 "=r"(i): "0"([0]): "memory");
}
+#endif
 }
 
 static inline unsigned int fp_regs_check(int features, unsigned int val,
 int (*report)(const char *fmt, ...))
 {
-   unsigned int result = val, i;
+   unsigned int result = val;
+#if __COBALT_HAVE_VFP != 0
+   unsigned int i;
unsigned long long e[16];
 
if (features & __COBALT_HAVE_VFP) {
@@ -54,6 +64,7 @@ static inline unsigned int fp_regs_check(int features, 
unsigned int val,
result = e[i];
}
}
+#endif
 
return result;
 }


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/arm64: assume TLS is properly supported

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: d41685b4b5d529fe17fb71e0b5003df2e1870a4e
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=d41685b4b5d529fe17fb71e0b5003df2e1870a4e

Author: Philippe Gerum 
Date:   Thu Sep 17 02:19:57 2015 +0200

cobalt/arm64: assume TLS is properly supported

---

 lib/cobalt/arch/arm64/include/asm/xenomai/syscall.h |9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/lib/cobalt/arch/arm64/include/asm/xenomai/syscall.h 
b/lib/cobalt/arch/arm64/include/asm/xenomai/syscall.h
index 1d5806c..8e7ad61 100644
--- a/lib/cobalt/arch/arm64/include/asm/xenomai/syscall.h
+++ b/lib/cobalt/arch/arm64/include/asm/xenomai/syscall.h
@@ -18,8 +18,8 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
  */
-#ifndef _LIB_COBALT_ARM_SYSCALL_H
-#define _LIB_COBALT_ARM_SYSCALL_H
+#ifndef _LIB_COBALT_ARM64_SYSCALL_H
+#define _LIB_COBALT_ARM64_SYSCALL_H
 
 #include 
 #include 
@@ -29,9 +29,6 @@
  * Some of the following macros have been adapted from Linux's
  * implementation of the syscall mechanism in :
  */
-#if defined(HAVE_TLS) && __GNUC__ == 4 && __GNUC_MINOR__ >= 3
-#error TLS support (__thread) is broken with GCC >= 4.3, use --disable-tls 
when configuring
-#endif
 
 #define LOADARGS_0(syscode, dummy...)  \
__a0 = (unsigned long) (syscode)
@@ -143,4 +140,4 @@
 #define XENOMAI_SYSBIND(breq)  \
XENOMAI_DO_SYSCALL(1,sc_cobalt_bind,breq)
 
-#endif /* !_LIB_COBALT_ARM_SYSCALL_H */
+#endif /* !_LIB_COBALT_ARM64_SYSCALL_H */


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/arm64: leave mm tracking to the pipeline

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: d74cfa3a456fe0b3a26526617334e121b9a3343d
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=d74cfa3a456fe0b3a26526617334e121b9a3343d

Author: Philippe Gerum 
Date:   Thu Sep 17 15:08:34 2015 +0200

cobalt/arm64: leave mm tracking to the pipeline

---

 kernel/cobalt/arch/arm64/Kconfig |3 ---
 1 file changed, 3 deletions(-)

diff --git a/kernel/cobalt/arch/arm64/Kconfig b/kernel/cobalt/arch/arm64/Kconfig
index 927c647..dd5a8c6 100644
--- a/kernel/cobalt/arch/arm64/Kconfig
+++ b/kernel/cobalt/arch/arm64/Kconfig
@@ -4,9 +4,6 @@ source "drivers/xenomai/Kconfig"
 config XENO_ARCH_UNLOCKED_SWITCH
def_bool IPIPE_WANT_PREEMPTIBLE_SWITCH
 
-config IPIPE_WANT_ACTIVE_MM
-   def_bool y
-
 config XENO_ARCH_WANT_TIP
def_bool y
 


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/powerpc: drop support for unlocked context switch

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 0cd7da073a05beaae2ab81cff6d8e892a2ca
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=0cd7da073a05beaae2ab81cff6d8e892a2ca

Author: Philippe Gerum 
Date:   Sat Nov 14 16:41:13 2015 +0100

cobalt/powerpc: drop support for unlocked context switch

This feature never actually brought any measurable gain on powerpc
platforms, compared to the complexity of its implementation in the
pipeline. It was primarily aimed at reducing latency for interrupt
handlers when costly cache and TLB flushes are required to switch
context, at the expense of increasing the scheduling latency.  It
turned out to be counter-productive on common powerpc platforms, with
efficient MMUs.

This feature has been default off for a while now, and 4.1+ pipelines
won't provide support for it anymore. Time to drop support from
Xenomai too.

---

 kernel/cobalt/arch/powerpc/Kconfig |   20 +---
 1 file changed, 1 insertion(+), 19 deletions(-)

diff --git a/kernel/cobalt/arch/powerpc/Kconfig 
b/kernel/cobalt/arch/powerpc/Kconfig
index 40eae0b..1cabef3 100644
--- a/kernel/cobalt/arch/powerpc/Kconfig
+++ b/kernel/cobalt/arch/powerpc/Kconfig
@@ -5,29 +5,11 @@ config XENO_ARCH_MATH_EMU
 bool
default y if MATH_EMU || MATH_EMULATION
 
-config IPIPE_WANT_PREEMPTIBLE_SWITCH
-bool
-   default y if XENO_ARCH_UNLOCKED_SWITCH
-   default n if !XENO_ARCH_UNLOCKED_SWITCH
-
 config XENO_ARCH_FPU
def_bool PPC_FPU
 
 config XENO_ARCH_SYS3264
 def_bool n
 
-menu "Machine/platform-specific options"
-
 config XENO_ARCH_UNLOCKED_SWITCH
-   bool "Unlocked context switch"
-   depends on IPIPE_HAVE_PREEMPTIBLE_SWITCH
-   default y
-   help
-
-   The Cobalt core may allow non-atomic execution of the
-   machine-dependent context switching code, so that other CPUs
-   and/or local interrupts may execute concurrently.
-
-   This option reduces interrupt latency when costly cache and
-   TLB flushes are required to switch context.
-endmenu
+   def_bool n


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Gilles Chanteperdrix : cobalt/arm64: attempt at fixing fpu switch

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: fcf98c7dceea8f6a891127540e9452ac8f3d384b
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=fcf98c7dceea8f6a891127540e9452ac8f3d384b

Author: Gilles Chanteperdrix 
Date:   Fri Oct 30 17:14:00 2015 +0100

cobalt/arm64: attempt at fixing fpu switch

Return to eager switching, since user-space applications use FPU
registers even when not using the FPU, but use an auxiliary backup area
when the "TIF_FOREIGN_FPSTATE" bit is set, in order to avoid clobbering
the saved FPU state.

---

 .../cobalt/arch/arm64/include/asm/xenomai/thread.h |   14 +++--
 kernel/cobalt/arch/arm64/thread.c  |   54 +---
 2 files changed, 25 insertions(+), 43 deletions(-)

diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/thread.h 
b/kernel/cobalt/arch/arm64/include/asm/xenomai/thread.h
index 9055e58..4b247ac 100644
--- a/kernel/cobalt/arch/arm64/include/asm/xenomai/thread.h
+++ b/kernel/cobalt/arch/arm64/include/asm/xenomai/thread.h
@@ -24,6 +24,7 @@
 struct xnarchtcb {
struct xntcb core;
 #ifdef CONFIG_XENO_ARCH_FPU
+   struct fpsimd_state xnfpsimd_state;
struct fpsimd_state *fpup;
 #define xnarch_fpu_ptr(tcb) ((tcb)->fpup)
 #endif
@@ -67,7 +68,10 @@ static inline void xnarch_init_root_tcb(struct xnthread 
*thread)
 
 void xnarch_init_shadow_tcb(struct xnthread *thread);
 
-int xnarch_fault_fpu_p(struct ipipe_trap_data *d);
+static inline int xnarch_fault_fpu_p(struct ipipe_trap_data *d)
+{
+   return xnarch_fault_trap(d) == IPIPE_TRAP_FPU_ACC;
+}
 
 void xnarch_leave_root(struct xnthread *root);
 
@@ -75,8 +79,12 @@ void xnarch_save_fpu(struct xnthread *thread);
 
 void xnarch_switch_fpu(struct xnthread *from, struct xnthread *thread);
 
-int xnarch_handle_fpu_fault(struct xnthread *from, 
-   struct xnthread *to, struct ipipe_trap_data *d);
+static inline int
+xnarch_handle_fpu_fault(struct xnthread *from,
+   struct xnthread *to, struct ipipe_trap_data *d)
+{
+   return 0;
+}
 
 #else /* !CONFIG_XENO_ARCH_FPU */
 
diff --git a/kernel/cobalt/arch/arm64/thread.c 
b/kernel/cobalt/arch/arm64/thread.c
index 2238751..b987e09 100644
--- a/kernel/cobalt/arch/arm64/thread.c
+++ b/kernel/cobalt/arch/arm64/thread.c
@@ -6,6 +6,7 @@
  * 
  * ARM64 port
  *   Copyright (C) 2015 Dmitriy Cherkasov 
+ *   Copyright (C) 2015 Gilles Chanteperdrix 
  *
  * Xenomai is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by
@@ -41,7 +42,7 @@
 static inline unsigned long get_cpacr(void)
 {
unsigned long result;
-   __asm__ __volatile__("mrs %0, cpacr_el1": "=r"(result));
+   __asm__ ("mrs %0, cpacr_el1": "=r"(result));
return result;
 }
 
@@ -53,21 +54,20 @@ static inline void set_cpacr(long val)
: /* */ : "r"(val));
 }
 
-static void enable_fpsimd(void)
+static inline void enable_fpsimd(void)
 {
-   unsigned long cpacr = get_cpacr();
-   cpacr |= FPSIMD_EN;
-   set_cpacr(cpacr);
+   set_cpacr(get_cpacr() | FPSIMD_EN);
 }
 
-int xnarch_fault_fpu_p(struct ipipe_trap_data *d)
+static inline struct fpsimd_state *get_fpu_owner(struct xnarchtcb *rootcb)
 {
-   return (d->exception == IPIPE_TRAP_FPU_ACC);
-}
+   struct task_struct *curr = rootcb->core.host_task;
 
-static inline struct fpsimd_state *get_fpu_owner(struct xnarchtcb *tcb)
-{
-   return &(tcb->core.tsp->fpsimd_state);
+   if (test_ti_thread_flag(task_thread_info(curr), TIF_FOREIGN_FPSTATE))
+   /* Foreign fpu state, use auxiliary backup area */
+   return >xnfpsimd_state;
+
+   return >thread.fpsimd_state;
 }
 
 void xnarch_leave_root(struct xnthread *root)
@@ -76,13 +76,6 @@ void xnarch_leave_root(struct xnthread *root)
rootcb->fpup = get_fpu_owner(rootcb);
 }
 
-void xnarch_save_fpu(struct xnthread *thread)
-{
-   struct xnarchtcb *tcb = &(thread->tcb);
-   if (xnarch_fpu_ptr(tcb))
-   fpsimd_save_state(tcb->fpup);
-}
-
 void xnarch_switch_fpu(struct xnthread *from, struct xnthread *to)
 {
struct fpsimd_state *const from_fpup = from ? from->tcb.fpup : NULL;
@@ -93,35 +86,16 @@ void xnarch_switch_fpu(struct xnthread *from, struct 
xnthread *to)
if (from_fpup == to_fpup)
return;
 
-   if (from_fpup)
-   fpsimd_save_state(from_fpup);
+   fpsimd_save_state(from_fpup);
 
fpsimd_load_state(to_fpup);
-}
-
-int xnarch_handle_fpu_fault(struct xnthread *from, 
-   struct xnthread *to, struct ipipe_trap_data *d)
-{
-   spl_t s;
-
-   /* FPU should already be enabled for XNFPU tasks. */
-   if (xnthread_test_state(to, XNFPU))
-   BUG();
-
-   xnlock_get_irqsave(, s);
-   xnthread_set_state(to, XNFPU);
-   xnlock_put_irqrestore(, s);
-
-   xnarch_switch_fpu(from, 

[Xenomai-git] Philippe Gerum : testsuite/smokey: add basic FPU stress test

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 902a7ce4b7ba6eed078ddbd8957534c905a996f2
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=902a7ce4b7ba6eed078ddbd8957534c905a996f2

Author: Philippe Gerum 
Date:   Sat Oct 24 15:52:48 2015 +0200

testsuite/smokey: add basic FPU stress test

---

 configure.ac |6 +-
 testsuite/smokey/Makefile.am |1 +
 testsuite/smokey/fpu-stress/Makefile.am  |8 +++
 testsuite/smokey/fpu-stress/fpu-stress.c |   95 ++
 4 files changed, 105 insertions(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index 5b2a074..bbaf4a7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -905,11 +905,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/timerfd/Makefile \
testsuite/smokey/tsc/Makefile \
testsuite/smokey/leaks/Makefile \
-   testsuite/smokey/net_udp/Makefile \
-   testsuite/smokey/net_packet_dgram/Makefile \
-   testsuite/smokey/net_packet_raw/Makefile \
-   testsuite/smokey/net_common/Makefile \
-   testsuite/smokey/cpu-affinity/Makefile \
+   testsuite/smokey/fpu-stress/Makefile \
testsuite/clocktest/Makefile \
testsuite/xeno-test/Makefile \
utils/Makefile \
diff --git a/testsuite/smokey/Makefile.am b/testsuite/smokey/Makefile.am
index b0904d2..e253d6f 100644
--- a/testsuite/smokey/Makefile.am
+++ b/testsuite/smokey/Makefile.am
@@ -9,6 +9,7 @@ COBALT_SUBDIRS =\
arith   \
bufp\
cpu-affinity\
+   fpu-stress  \
iddp\
leaks   \
net_packet_dgram\
diff --git a/testsuite/smokey/fpu-stress/Makefile.am 
b/testsuite/smokey/fpu-stress/Makefile.am
new file mode 100644
index 000..c90d0dd
--- /dev/null
+++ b/testsuite/smokey/fpu-stress/Makefile.am
@@ -0,0 +1,8 @@
+
+noinst_LIBRARIES = libfpu-stress.a
+
+libfpu_stress_a_SOURCES = fpu-stress.c
+
+libfpu_stress_a_CPPFLAGS = \
+   @XENO_USER_CFLAGS@  \
+   -I$(top_srcdir)/include
diff --git a/testsuite/smokey/fpu-stress/fpu-stress.c 
b/testsuite/smokey/fpu-stress/fpu-stress.c
new file mode 100644
index 000..59383c9
--- /dev/null
+++ b/testsuite/smokey/fpu-stress/fpu-stress.c
@@ -0,0 +1,95 @@
+#include 
+#include 
+#include 
+#include 
+#include 
+
+smokey_test_plugin(fpu_stress,
+  SMOKEY_ARGLIST(
+  SMOKEY_INT(duration),
+  ),
+  "Check FPU context sanity during real-time stress\n"
+  "\tduration=\thow long to run the stress loop 
(0=indefinitely)"
+);
+
+static int fp_features;
+
+static void *stress_loop(void *arg)
+{
+   struct timespec rqt = {
+   .tv_sec = 0,
+   .tv_nsec = CONFIG_XENO_DEFAULT_PERIOD
+   };
+   
+   for (;;) {
+   fp_regs_set(fp_features, 0xf1f5f1f5);
+   clock_nanosleep(CLOCK_MONOTONIC, 0, , NULL);
+   }
+
+   return NULL;
+}
+
+static int report_error(const char *fmt, ...)
+{
+   va_list ap;
+
+   va_start(ap, fmt);
+   smokey_vatrace(fmt, ap);
+   va_end(ap);
+
+   return 0;
+}
+
+static int run_fpu_stress(struct smokey_test *t,
+ int argc, char *const argv[])
+{
+   unsigned sleep_ms, n, rounds, duration = 3;
+   struct sched_param param;
+   pthread_attr_t attr;
+   struct timespec rqt;
+   pthread_t tid;
+   int ret;
+
+   fp_features = cobalt_fp_detect();
+   if (fp_features == 0)
+   return -ENOSYS;
+
+   smokey_parse_args(t, argc, argv);
+   
+   if (SMOKEY_ARG_ISSET(fpu_stress, duration))
+   duration = SMOKEY_ARG_INT(fpu_stress, duration);
+   
+   rqt.tv_sec = 0;
+   rqt.tv_nsec = CONFIG_XENO_DEFAULT_PERIOD;
+   sleep_ms = 100UL / rqt.tv_nsec; /* wake up each ms */
+   rounds = duration * 1000UL / sleep_ms;
+
+   pthread_attr_init();
+   pthread_attr_setdetachstate(, PTHREAD_CREATE_JOINABLE);
+   pthread_attr_setinheritsched(, PTHREAD_EXPLICIT_SCHED);
+   pthread_attr_setschedpolicy(, SCHED_FIFO);
+   param.sched_priority = 10;
+   pthread_attr_setschedparam(, );
+   ret = pthread_create(, , stress_loop, NULL);
+   if (ret)
+   return -ret;
+
+   if (rounds)
+   smokey_trace("running for %d seconds", duration);
+   else
+   smokey_trace("running indefinitely...");
+
+   for (n = 0; rounds == 0 || n < rounds; n++) {
+   fp_regs_set(fp_features, n);
+   __STD(clock_nanosleep(CLOCK_MONOTONIC, 0, , NULL));
+   if (fp_regs_check(fp_features, n, report_error) != n) {
+   ret = -EINVAL;
+   break;
+   }
+   }
+
+   pthread_cancel(tid);
+   pthread_join(tid, NULL);
+
+   return ret;
+}


___
Xenomai-git 

[Xenomai-git] Dmitriy Cherkasov : cobalt/arm64: xenomai/syscall.h: update syscall register

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 5ed4a0e54a210c4314d656253ccf1a5198475164
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=5ed4a0e54a210c4314d656253ccf1a5198475164

Author: Dmitriy Cherkasov 
Date:   Fri May  8 15:54:18 2015 -0700

cobalt/arm64: xenomai/syscall.h: update syscall register

---

 kernel/cobalt/arch/arm64/include/asm/xenomai/syscall.h |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/syscall.h 
b/kernel/cobalt/arch/arm64/include/asm/xenomai/syscall.h
index 2fdd890..7bf95fb 100644
--- a/kernel/cobalt/arch/arm64/include/asm/xenomai/syscall.h
+++ b/kernel/cobalt/arch/arm64/include/asm/xenomai/syscall.h
@@ -40,10 +40,10 @@
 #define __xn_reg_sys(__regs)   ((__regs)->orig_x0)
 /* In OABI_COMPAT mode, handle both OABI and EABI userspace syscalls */
 #ifdef CONFIG_OABI_COMPAT
-#define __xn_syscall_p(__regs) (((__regs)->regs[7] == __NR_OABI_SYSCALL_BASE + 
XENO_ARM_SYSCALL) || \
-((__regs)->regs[7] == __ARM_NR_ipipe))
+#define __xn_syscall_p(__regs) (((__regs)->regs[8] == __NR_OABI_SYSCALL_BASE + 
XENO_ARM_SYSCALL) || \
+((__regs)->regs[8] == __ARM_NR_ipipe))
 #else /* !CONFIG_OABI_COMPAT */
-#define __xn_syscall_p(__regs) ((__regs)->regs[7] == __ARM_NR_ipipe)
+#define __xn_syscall_p(__regs) ((__regs)->regs[8] == __ARM_NR_ipipe)
 #endif /* !CONFIG_OABI_COMPAT */
 #define __xn_syscall(__regs)   (__xn_reg_sys(__regs) & ~__COBALT_SYSCALL_BIT)
 


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/arm64: drop aarch32 bits from feature set

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: eb9e66781413ebd2120ad3e39e6c8495f7c0ac68
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=eb9e66781413ebd2120ad3e39e6c8495f7c0ac68

Author: Philippe Gerum 
Date:   Thu Sep 17 02:16:10 2015 +0200

cobalt/arm64: drop aarch32 bits from feature set

---

 .../arch/arm64/include/asm/xenomai/features.h  |   44 ++--
 1 file changed, 4 insertions(+), 40 deletions(-)

diff --git a/lib/cobalt/arch/arm64/include/asm/xenomai/features.h 
b/lib/cobalt/arch/arm64/include/asm/xenomai/features.h
index 0d6702b..6dfe64c 100644
--- a/lib/cobalt/arch/arm64/include/asm/xenomai/features.h
+++ b/lib/cobalt/arch/arm64/include/asm/xenomai/features.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 Philippe Gerum .
+ * Copyright (C) 2015 Philippe Gerum .
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -15,52 +15,16 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
  */
-#ifndef _LIB_COBALT_ARM_FEATURES_H
-#define _LIB_COBALT_ARM_FEATURES_H
+#ifndef _LIB_COBALT_ARM64_FEATURES_H
+#define _LIB_COBALT_ARM64_FEATURES_H
 
 #include_next 
 #include 
 
-#if defined(__ARM_ARCH_2__)
-#define __LINUX_ARM_ARCH__ 2
-#endif /* armv2 */
-
-#if defined(__ARM_ARCH_3__)
-#define __LINUX_ARM_ARCH__ 3
-#endif /* armv3 */
-
-#if defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__)
-#define __LINUX_ARM_ARCH__ 4
-#endif /* armv4 */
-
-#if defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__) \
-   || defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__)
-#define __LINUX_ARM_ARCH__ 5
-#endif /* armv5 */
-
-#if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6K__) \
-   || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__)
-#define __LINUX_ARM_ARCH__ 6
-#endif /* armv6 */
-
-#if defined(__ARM_ARCH_7A__)
-#define __LINUX_ARM_ARCH__ 7
-#endif /* armv7 */
-
-#if defined(__aarch64__)
 #define __LINUX_ARM_ARCH__ 8
-#endif /* armv8 */
-
-#ifndef __LINUX_ARM_ARCH__
-#error "Could not find current ARM architecture"
-#endif
-
-#if __LINUX_ARM_ARCH__ < 6 && defined(CONFIG_SMP)
-#error "SMP not supported below armv6, compile with -march=armv6 or above"
-#endif
 
 #include 
 
 int cobalt_fp_detect(void);
 
-#endif /* !_LIB_COBALT_ARM_FEATURES_H */
+#endif /* !_LIB_COBALT_ARM64_FEATURES_H */


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/arm64: restrict unlocked switch to SMP

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 66dfba9aebce67adfe106c48a609f706a9b642ce
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=66dfba9aebce67adfe106c48a609f706a9b642ce

Author: Philippe Gerum 
Date:   Thu Sep 17 11:43:50 2015 +0200

cobalt/arm64: restrict unlocked switch to SMP

Unlocked switching for Xenomai/ARM was specifically introduced for
improving the interrupt latency on low-end armv4/armv5 platforms with
VIVT caches.

The once massive overhead imposed on the MMU context switching code
for invalidating the cache is long gone with VIPT indexing, and
keeping IRQs off while switching the memory context on armv8 these
days is not an issue. Actually, the complexity of the code involved in
dealing with unlocked switching may overbalance the expected gain.

However, the mainline kernel implementation for ASID management in the
SMP case currently requires us to keep IRQs enabled when allocating a
new MM context over the Xenomai domain, just like it did for aarch32
during the 2.6.3x time frame until the IPI-based approach was
eventually dropped.

So, let's restrict unlocked switching to the SMP case, forcing it off
otherwise, in the hope we can drop it entirely in the future.

At this chance, CONFIG_IPIPE_WANT_PREEMPTIBLE_SWITCH moves to the
kernel area, where it actually belongs.

---

 kernel/cobalt/arch/arm64/Kconfig |   21 +
 1 file changed, 1 insertion(+), 20 deletions(-)

diff --git a/kernel/cobalt/arch/arm64/Kconfig b/kernel/cobalt/arch/arm64/Kconfig
index dc6485d..927c647 100644
--- a/kernel/cobalt/arch/arm64/Kconfig
+++ b/kernel/cobalt/arch/arm64/Kconfig
@@ -1,27 +1,8 @@
 source "kernel/xenomai/Kconfig"
 source "drivers/xenomai/Kconfig"
 
-menu "Machine/platform-specific options"
-
 config XENO_ARCH_UNLOCKED_SWITCH
-   bool "Unlocked context switch"
-   default y
-   help
-   The Cobalt core may allow non-atomic execution of the
-   machine-dependent context switching code, so that other CPUs
-   and/or local interrupts may execute concurrently.
-
-   This option reduces interrupt latency when costly cache and
-   TLB flushes are required to switch context.
-
-   You definitely want to enable that option on low-end ARM
-   platforms.
-endmenu
-
-config IPIPE_WANT_PREEMPTIBLE_SWITCH
-   bool
-   default y if XENO_ARCH_UNLOCKED_SWITCH
-   default n if !XENO_ARCH_UNLOCKED_SWITCH
+   def_bool IPIPE_WANT_PREEMPTIBLE_SWITCH
 
 config IPIPE_WANT_ACTIVE_MM
def_bool y


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Dmitriy Cherkasov : cobalt/arm64: FPU code cleanup

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: bec4dce9927e822be8c32f5534a6e87334d16c6e
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=bec4dce9927e822be8c32f5534a6e87334d16c6e

Author: Dmitriy Cherkasov 
Date:   Fri Oct  2 12:54:37 2015 -0700

cobalt/arm64: FPU code cleanup

---

 kernel/cobalt/arch/arm64/thread.c |   89 -
 1 file changed, 39 insertions(+), 50 deletions(-)

diff --git a/kernel/cobalt/arch/arm64/thread.c 
b/kernel/cobalt/arch/arm64/thread.c
index db369be..35dbd72 100644
--- a/kernel/cobalt/arch/arm64/thread.c
+++ b/kernel/cobalt/arch/arm64/thread.c
@@ -36,31 +36,44 @@
 
 #if defined(CONFIG_XENO_ARCH_FPU)
 
-static void enable_fpsimd(void) {
-   __asm__ __volatile__("mrs x1, cpacr_el1\n\
-   orr x1, x1, #(0x3 << 20)\n\
-   msr cpacr_el1, x1\n\
-   isb" : : : "x1", "memory", "cc");
+#define FPSIMD_EN (0x3 << 20)
+
+static inline unsigned long get_cpacr(void)
+{
+   unsigned long result;
+   __asm__ __volatile__("mrs %0, cpacr_el1": "=r"(result));
+   return result;
+}
+
+static inline void set_cpacr(long val)
+{
+   __asm__ __volatile__ (
+   "msr cpacr_el1, %0\n\t"
+   "isb"
+   : /* */ : "r"(val));
 }
 
-static void disable_fpsimd(void) {
-   __asm__ __volatile__("mrs x1, cpacr_el1\n\
-   and x1, x1, #~(0x3 << 20)\n\
-   msr cpacr_el1, x1\n\
-   isb" : : : "x1", "memory", "cc");
+static void enable_fpsimd(void)
+{
+   unsigned long cpacr = get_cpacr();
+   cpacr |= FPSIMD_EN;
+   set_cpacr(cpacr);
+}
+
+static void disable_fpsimd(void)
+{
+   unsigned long cpacr = get_cpacr();
+   cpacr &= ~FPSIMD_EN;
+   set_cpacr(cpacr);
 }
 
 int xnarch_fault_fpu_p(struct ipipe_trap_data *d)
 {
-   /* check if this is an FPU access trap to be handled by Xenomai */
-   if(d->exception == IPIPE_TRAP_FPU_ACC){
-   return 1;
-   }
-   /* FPU already enabled, propagate fault to kernel */
-   return 0;
+   return (d->exception == IPIPE_TRAP_FPU_ACC);
 }
 
-static inline struct fpsimd_state *get_fpu_owner(struct xnarchtcb *tcb) {
+static inline struct fpsimd_state *get_fpu_owner(struct xnarchtcb *tcb)
+{
return &(tcb->core.tsp->fpsimd_state);
 }
 
@@ -68,7 +81,6 @@ void xnarch_leave_root(struct xnthread *root)
 {
struct xnarchtcb *rootcb = xnthread_archtcb(root);
rootcb->fpup = get_fpu_owner(rootcb);
-   disable_fpsimd();
 }
 
 void xnarch_save_fpu(struct xnthread *thread)
@@ -83,29 +95,15 @@ void xnarch_switch_fpu(struct xnthread *from, struct 
xnthread *to)
struct fpsimd_state *const from_fpup = from ? from->tcb.fpup : NULL;
struct fpsimd_state *const to_fpup = to->tcb.fpup;
 
-   /*
-* This only gets called if XNFPU flag is set, or if migrating to Linux.
-* In both cases, this means turn on FPU and switch.
-*/
enable_fpsimd();
 
-   if (xnthread_test_state(to, XNROOT) == 0) {
-   if (from_fpup == to_fpup)
-   return;
-
-   if (from_fpup)
-   fpsimd_save_state(from_fpup);
-
-   fpsimd_load_state(to_fpup);
-   }
-   else {
-   /* Going to Linux. */
-   if (from_fpup)
-   fpsimd_save_state(from_fpup);
+   if (from_fpup == to_fpup)
+   return;
 
-   fpsimd_load_state(to_fpup);
-   }
+   if (from_fpup)
+   fpsimd_save_state(from_fpup);
 
+   fpsimd_load_state(to_fpup);
 }
 
 int xnarch_handle_fpu_fault(struct xnthread *from, 
@@ -113,9 +111,9 @@ int xnarch_handle_fpu_fault(struct xnthread *from,
 {
spl_t s;
 
+   /* FPU should already be enabled for XNFPU tasks. */
if (xnthread_test_state(to, XNFPU))
-   /* FPU is already enabled, probably an exception */
-  return 0;
+   BUG();
 
xnlock_get_irqsave(, s);
xnthread_set_state(to, XNFPU);
@@ -124,20 +122,13 @@ int xnarch_handle_fpu_fault(struct xnthread *from,
xnarch_switch_fpu(from, to);
 
return 1;
-
 }
 
 void xnarch_init_shadow_tcb(struct xnthread *thread)
 {
-   spl_t s;
struct xnarchtcb *tcb = xnthread_archtcb(thread);
-
tcb->fpup = &(tcb->core.host_task->thread.fpsimd_state);
-
-   xnlock_get_irqsave(, s);
xnthread_clear_state(thread, XNFPU);
-   xnlock_put_irqrestore(, s);
-
 }
 #endif /* CONFIG_XENO_ARCH_FPU */
 
@@ -210,16 +201,14 @@ void xnarch_switch_to(struct xnthread *out, struct 
xnthread *in)
xnarch_tls_thread_switch(in_tcb->core.tip->task);
xnarch_contextidr_thread_switch(in_tcb->core.tip->task);
 
-   /* check if we need to switch FPU on return to Linux */
-   if (xnthread_test_state(in, XNROOT) == 1)
-   

[Xenomai-git] Dmitriy Cherkasov : cobalt/arm64: populate arch/arm64 with a copy of arch/ arm.

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 07f1685f9d408a7b95aa53d82f7cec0271da9b77
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=07f1685f9d408a7b95aa53d82f7cec0271da9b77

Author: Dmitriy Cherkasov 
Date:   Wed May  6 15:27:23 2015 -0700

cobalt/arm64: populate arch/arm64 with a copy of arch/arm.

kernel/cobalt/arch/arm -> kernel/cobalt/arch/arm64
lib/cobalt/arch/arm -> lib/cobalt/arch/arm64

---

 configure.ac   |8 +
 kernel/cobalt/arch/arm64/Kconfig   |   40 +++
 kernel/cobalt/arch/arm64/Makefile  |5 +
 .../arch/arm64/include/asm/xenomai/calibration.h   |   59 
 .../arch/arm64/include/asm/xenomai/features.h  |   30 ++
 .../cobalt/arch/arm64/include/asm/xenomai/fptest.h |   52 +++
 .../arch/arm64/include/asm/xenomai/machine.h   |   85 +
 .../arch/arm64/include/asm/xenomai/syscall.h   |   74 
 .../arch/arm64/include/asm/xenomai/syscall32.h |   24 ++
 .../cobalt/arch/arm64/include/asm/xenomai/thread.h |  123 +++
 .../arch/arm64/include/asm/xenomai/uapi/arith.h|  142 
 .../arch/arm64/include/asm/xenomai/uapi/features.h |   43 +++
 .../arch/arm64/include/asm/xenomai/uapi/fptest.h   |   61 
 .../arch/arm64/include/asm/xenomai/uapi/syscall.h  |   34 ++
 .../arch/arm64/include/asm/xenomai/uapi/tsc.h  |   25 ++
 .../arch/arm64/include/asm/xenomai/wrappers.h  |   27 ++
 kernel/cobalt/arch/arm64/machine.c |  119 +++
 kernel/cobalt/arch/arm64/mayday.c  |  146 
 kernel/cobalt/arch/arm64/switch.S  |  167 +
 kernel/cobalt/arch/arm64/syscall.c |   53 +++
 kernel/cobalt/arch/arm64/thread.c  |  355 
 lib/cobalt/arch/Makefile.am|2 +-
 lib/cobalt/arch/arm64/Makefile.am  |   13 +
 lib/cobalt/arch/arm64/features.c   |  102 ++
 lib/cobalt/arch/arm64/include/Makefile.am  |2 +
 lib/cobalt/arch/arm64/include/asm/Makefile.am  |2 +
 .../arch/arm64/include/asm/xenomai/Makefile.am |5 +
 .../arch/arm64/include/asm/xenomai/features.h  |   62 
 .../arch/arm64/include/asm/xenomai/syscall.h   |  138 
 lib/cobalt/arch/arm64/include/asm/xenomai/tsc.h|   48 +++
 30 files changed, 2045 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 789a6d7..5b2a074 100644
--- a/configure.ac
+++ b/configure.ac
@@ -139,6 +139,10 @@ case "$build_for" in
XENO_TARGET_ARCH=arm
CONFIG_XENO_DEFAULT_PERIOD=100
;;
+ aarch64-*)
+   XENO_TARGET_ARCH=arm64
+   CONFIG_XENO_DEFAULT_PERIOD=100
+   ;;
  x86_64-*|amd64-*)
use_tls=yes
XENO_TARGET_ARCH=x86
@@ -854,6 +858,10 @@ AC_CONFIG_FILES([ \
lib/cobalt/arch/arm/include/Makefile \
lib/cobalt/arch/arm/include/asm/Makefile \
lib/cobalt/arch/arm/include/asm/xenomai/Makefile \
+   lib/cobalt/arch/arm64/Makefile \
+   lib/cobalt/arch/arm64/include/Makefile \
+   lib/cobalt/arch/arm64/include/asm/Makefile \
+   lib/cobalt/arch/arm64/include/asm/xenomai/Makefile \
lib/cobalt/arch/powerpc/Makefile \
lib/cobalt/arch/powerpc/include/Makefile \
lib/cobalt/arch/powerpc/include/asm/Makefile \
diff --git a/kernel/cobalt/arch/arm64/Kconfig b/kernel/cobalt/arch/arm64/Kconfig
new file mode 100644
index 000..dc6485d
--- /dev/null
+++ b/kernel/cobalt/arch/arm64/Kconfig
@@ -0,0 +1,40 @@
+source "kernel/xenomai/Kconfig"
+source "drivers/xenomai/Kconfig"
+
+menu "Machine/platform-specific options"
+
+config XENO_ARCH_UNLOCKED_SWITCH
+   bool "Unlocked context switch"
+   default y
+   help
+   The Cobalt core may allow non-atomic execution of the
+   machine-dependent context switching code, so that other CPUs
+   and/or local interrupts may execute concurrently.
+
+   This option reduces interrupt latency when costly cache and
+   TLB flushes are required to switch context.
+
+   You definitely want to enable that option on low-end ARM
+   platforms.
+endmenu
+
+config IPIPE_WANT_PREEMPTIBLE_SWITCH
+   bool
+   default y if XENO_ARCH_UNLOCKED_SWITCH
+   default n if !XENO_ARCH_UNLOCKED_SWITCH
+
+config IPIPE_WANT_ACTIVE_MM
+   def_bool y
+
+config XENO_ARCH_WANT_TIP
+   def_bool y
+
+config XENO_ARCH_FPU
+   def_bool VFP
+
+config XENO_ARCH_SYS3264
+def_bool n
+
+config XENO_ARCH_OUTOFLINE_XNLOCK
+   bool
+   default y
diff --git a/kernel/cobalt/arch/arm64/Makefile 
b/kernel/cobalt/arch/arm64/Makefile
new file mode 100644
index 000..f2e4e20
--- /dev/null
+++ b/kernel/cobalt/arch/arm64/Makefile
@@ -0,0 +1,5 @@
+obj-$(CONFIG_XENOMAI) += xenomai.o
+
+xenomai-y := machine.o mayday.o thread.o switch.o syscall.o
+
+ccflags-y := -Iarch/arm/xenomai/include -Iinclude/xenomai
diff --git 

[Xenomai-git] Philippe Gerum : cobalt: bump ABI revision level

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: e39025062726e76aba1a6ce2fd240aef2ff9c8fd
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=e39025062726e76aba1a6ce2fd240aef2ff9c8fd

Author: Philippe Gerum 
Date:   Thu Jul 30 14:20:45 2015 +0200

cobalt: bump ABI revision level

---

 kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/features.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/features.h 
b/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/features.h
index 01a12d9..9f1d974 100644
--- a/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/features.h
+++ b/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/features.h
@@ -22,7 +22,7 @@
 #define _COBALT_ARM64_ASM_UAPI_FEATURES_H
 
 /* The ABI revision level we use on this arch. */
-#define XENOMAI_ABI_REV   16UL
+#define XENOMAI_ABI_REV   17UL
 
 #define XENOMAI_FEAT_DEP (__xn_feat_generic_mask)
 


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Don Mahurin : lib/cobalt/arm64: add __LINUX_ARM_ARCH__ form armv8/aarch64

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: d09b2e381fce26c40318e1fadeaa0bde044d7dfd
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=d09b2e381fce26c40318e1fadeaa0bde044d7dfd

Author: Don Mahurin 
Date:   Fri May  8 10:39:01 2015 -0700

lib/cobalt/arm64: add __LINUX_ARM_ARCH__ form armv8/aarch64

---

 lib/cobalt/arch/arm64/include/asm/xenomai/features.h |4 
 1 file changed, 4 insertions(+)

diff --git a/lib/cobalt/arch/arm64/include/asm/xenomai/features.h 
b/lib/cobalt/arch/arm64/include/asm/xenomai/features.h
index 10bd0c7..0d6702b 100644
--- a/lib/cobalt/arch/arm64/include/asm/xenomai/features.h
+++ b/lib/cobalt/arch/arm64/include/asm/xenomai/features.h
@@ -47,6 +47,10 @@
 #define __LINUX_ARM_ARCH__ 7
 #endif /* armv7 */
 
+#if defined(__aarch64__)
+#define __LINUX_ARM_ARCH__ 8
+#endif /* armv8 */
+
 #ifndef __LINUX_ARM_ARCH__
 #error "Could not find current ARM architecture"
 #endif


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Don Mahurin : lib/cobalt/arm64: replace tsc counter

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 2e07669de2736e599e87915338eb175b05ea1da3
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=2e07669de2736e599e87915338eb175b05ea1da3

Author: Don Mahurin 
Date:   Wed May 13 09:36:25 2015 -0700

lib/cobalt/arm64: replace tsc counter

---

 lib/cobalt/arch/arm64/include/asm/xenomai/tsc.h |   19 +++
 1 file changed, 19 insertions(+)

diff --git a/lib/cobalt/arch/arm64/include/asm/xenomai/tsc.h 
b/lib/cobalt/arch/arm64/include/asm/xenomai/tsc.h
index 594c4ad..a055427 100644
--- a/lib/cobalt/arch/arm64/include/asm/xenomai/tsc.h
+++ b/lib/cobalt/arch/arm64/include/asm/xenomai/tsc.h
@@ -27,6 +27,8 @@
 
 #include 
 #include 
+#include 
+#include 
 
 /*
  * Putting kuser_tsc_get and kinfo.counter in the same struct results
@@ -39,10 +41,27 @@ struct __xn_full_tscinfo {
 };
 extern struct __xn_full_tscinfo __xn_tscinfo;
 
+static inline uint64_t get_counter(void)
+{
+uint64_t cval;
+
+#ifdef __aarch64__
+   asm volatile("isb; mrs %0, cntvct_el0; isb; " : "=r" (cval) :: 
"memory");
+#else
+   asm volatile("isb; mrrc p15, 1, %Q0, %R0, c14; isb" : "=r" (cval) :: 
"memory");
+#endif
+
+   return cval;
+}
+
 static inline __attribute__((always_inline))
 unsigned long long cobalt_read_tsc(void)
 {
+#ifndef __aarch64__
return __xn_tscinfo.kuser_tsc_get(__xn_tscinfo.kinfo.counter);
+#else
+   return get_counter();
+#endif
 }
 
 #endif /* !_LIB_COBALT_ARM_TSC_H */


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Dmitriy Cherkasov : cobalt/arm64: thread: use kernel switch_to

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 0f5cd024d48c5e50eebdb4d7b2dde2f55632c6b7
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=0f5cd024d48c5e50eebdb4d7b2dde2f55632c6b7

Author: Dmitriy Cherkasov 
Date:   Fri May 15 23:26:18 2015 -0700

cobalt/arm64: thread: use kernel switch_to

---

 kernel/cobalt/arch/arm64/Makefile |2 +-
 kernel/cobalt/arch/arm64/switch.S |  167 -
 kernel/cobalt/arch/arm64/thread.c |5 +-
 3 files changed, 2 insertions(+), 172 deletions(-)

diff --git a/kernel/cobalt/arch/arm64/Makefile 
b/kernel/cobalt/arch/arm64/Makefile
index a135f99..af0a0e8 100644
--- a/kernel/cobalt/arch/arm64/Makefile
+++ b/kernel/cobalt/arch/arm64/Makefile
@@ -1,5 +1,5 @@
 obj-$(CONFIG_XENOMAI) += xenomai.o
 
-xenomai-y := machine.o mayday.o thread.o switch.o syscall.o
+xenomai-y := machine.o mayday.o thread.o syscall.o
 
 ccflags-y := -Iarch/arm64/xenomai/include -Iinclude/xenomai
diff --git a/kernel/cobalt/arch/arm64/switch.S 
b/kernel/cobalt/arch/arm64/switch.S
deleted file mode 100644
index 505fd5a..000
--- a/kernel/cobalt/arch/arm64/switch.S
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Copyright (C) 2005 Stelian Pop.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, Inc., 675 Mass Ave, Cambridge MA 02139,
- * USA; either version 2 of the License, or (at your option) any later
- * version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#ifdef CONFIG_VFP
-#include 
-#endif
-
-   .macro fpu_switch tmp
-#ifdef CONFIG_VFP
-#if __LINUX_ARM_ARCH__ <= 6
-#ifdef CONFIG_JUMP_LABEL
-9998:  nop
-   .pushsection __jump_table, "aw"
-   .word   9998b, f, __xeno_vfp_key
-   .popsection
-#else
-   ldr \tmp, =elf_hwcap
-   ldr \tmp, [\tmp]
-   tst \tmp, #HWCAP_VFP
-   beq f
-#endif
-#endif
-   @ Always disable VFP so we can lazily save/restore the old
-   @ state. This occurs in the context of the previous thread.
-   VFPFMRX \tmp, FPEXC
-   bic \tmp, \tmp, #FPEXC_EN
-   VFPFMXR FPEXC, \tmp
-#if __LINUX_ARM_ARCH__ <= 6
-:
-#endif
-#endif
-   .endm
-
-   .text
-
-#if defined(CONFIG_VFP) && defined(CONFIG_XENO_ARCH_FPU)
-/* Copied from vfp_save_state in arch/arm/vfp/vfphw.S
- * r0 = pointer to union vfp_state, r1 = fpexc
- */
-ENTRY(__asm_vfp_save)
-   VFPFSTMIA   r0, r2  @ save the working registers
-   VFPFMRX r2, FPSCR   @ current status
-   tst r1, #FPEXC_EX   @ is there additional state to save?
-   beq 1f
-   VFPFMRX r3, FPINST  @ FPINST (only if FPEXC.EX is set)
-   tst r1, #FPEXC_FP2V @ is there an FPINST2 to read?
-   beq 1f
-   VFPFMRX r12, FPINST2@ FPINST2 if needed (and present)
-1:
-   stmia   r0, {r1, r2, r3, r12}   @ save FPEXC, FPSCR, FPINST, 
FPINST2
-   mov pc, lr
-ENDPROC(__asm_vfp_save)
-
-/* Copied from no_old_VFP_process in arch/arm/vfp/vfphw.S
- * r0 = pointer to union vfp_state
- * r1 = current cpu
- */
-ENTRY(__asm_vfp_load)
-#ifdef CONFIG_SMP
-   str r1, [r0, #VFP_CPU]
-#endif
-   VFPFLDMIA   r0, r2  @ reload the working registers while
-   @ FPEXC is in a safe state
-   ldmia   r0, {r1, r2, r3, r12}   @ load FPEXC, FPSCR, FPINST, 
FPINST2
-   tst r1, #FPEXC_EX   @ is there additional state to restore?
-   beq 1f
-   VFPFMXR FPINST, r3  @ restore FPINST (only if FPEXC.EX is 
set)
-   tst r1, #FPEXC_FP2V @ is there an FPINST2 to write?
-   beq 1f
-   VFPFMXR FPINST2, r12@ FPINST2 if needed (and present)
-1:
-   VFPFMXR FPSCR, r2   @ restore status
-   mov pc, lr
-ENDPROC(__asm_vfp_load)
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0)
-   .macro load_tls base, tp, tpuser
-   ldr \tp, [\base, #TI_TP_VALUE]
-   .endm
-
-   .macro switch_tls base, tp, tpuser, tmp1, tmp2
-   set_tls \tp, \tmp1, \tmp2
-   .endm
-#else
-   .macro load_tls base, tp, tpuser
-   ldr \tp, [\base, #TI_TP_VALUE]
-   ldr \tpuser, [\base, #TI_TP_VALUE + 4]
-   .endm
-#endif
-
-/*
-/*
- * Switch context routine.
- *
- * Registers 

[Xenomai-git] Don Mahurin : lib/cobalt/arm64: implement syscall for armv8/aarch64

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: f30c0cd29959e0ba71b8100eaef87c9109102220
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=f30c0cd29959e0ba71b8100eaef87c9109102220

Author: Don Mahurin 
Date:   Fri May  8 10:39:32 2015 -0700

lib/cobalt/arm64: implement syscall for armv8/aarch64

---

 lib/cobalt/arch/arm64/include/asm/xenomai/syscall.h |8 
 1 file changed, 8 insertions(+)

diff --git a/lib/cobalt/arch/arm64/include/asm/xenomai/syscall.h 
b/lib/cobalt/arch/arm64/include/asm/xenomai/syscall.h
index 8f48eb1..1d5806c 100644
--- a/lib/cobalt/arch/arm64/include/asm/xenomai/syscall.h
+++ b/lib/cobalt/arch/arm64/include/asm/xenomai/syscall.h
@@ -88,6 +88,7 @@
 #define __sys2(x)  #x
 #define __sys1(x)  __sys2(x)
 
+#ifndef __aarch64__
 #ifdef __ARM_EABI__
 #define __SYS_REG , "r7"
 #define __SYS_REG_DECL register unsigned long __r7 __asm__ ("r7")
@@ -102,6 +103,13 @@
 #define __NR_OABI_SYSCALL_BASE 0x90
 #define __SYS_CALLOP "swi\t" __sys1(__NR_OABI_SYSCALL_BASE + XENO_ARM_SYSCALL) 
""
 #endif
+#else
+#define __SYS_REG , "r8"
+#define __SYS_REG_DECL register unsigned long __r8 __asm__ ("r8")
+#define __SYS_REG_SET __r8 = XENO_ARM_SYSCALL
+#define __SYS_REG_INPUT ,"r" (__r8)
+#define __SYS_CALLOP "svc\t0"
+#endif
 
 #define XENOMAI_DO_SYSCALL(nr, op, args...)\
({  \


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Dmitriy Cherkasov : cobalt/arm64: prepare-kernel: add arm64 arch

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: a50990421deb8ddb8a77cc211c1d7583838f93f4
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=a50990421deb8ddb8a77cc211c1d7583838f93f4

Author: Dmitriy Cherkasov 
Date:   Wed May  6 15:27:10 2015 -0700

cobalt/arm64: prepare-kernel: add arm64 arch

---

 scripts/prepare-kernel.sh |3 +++
 1 file changed, 3 insertions(+)

diff --git a/scripts/prepare-kernel.sh b/scripts/prepare-kernel.sh
index 333d11c..6bb9f06 100755
--- a/scripts/prepare-kernel.sh
+++ b/scripts/prepare-kernel.sh
@@ -284,6 +284,9 @@ while : ; do
arm)
   linux_arch=arm
   ;;
+   arm64)
+  linux_arch=arm64
+  ;;
sh|sh4)
   linux_arch=sh
   ;;


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/kernel: fixup for v3.19+ (trace_seq)

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 5c02478536cb3bf39ee8cbf12897d28d2f053bce
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=5c02478536cb3bf39ee8cbf12897d28d2f053bce

Author: Philippe Gerum 
Date:   Tue Nov  3 13:11:25 2015 +0100

cobalt/kernel: fixup for v3.19+ (trace_seq)

---

 kernel/cobalt/include/asm-generic/xenomai/wrappers.h |6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/kernel/cobalt/include/asm-generic/xenomai/wrappers.h 
b/kernel/cobalt/include/asm-generic/xenomai/wrappers.h
index 11367ff..ceaf647 100644
--- a/kernel/cobalt/include/asm-generic/xenomai/wrappers.h
+++ b/kernel/cobalt/include/asm-generic/xenomai/wrappers.h
@@ -44,6 +44,7 @@
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0)
 #include 
+#include 
 
 #undef alloc_netdev
 #define alloc_netdev(sizeof_priv, name, name_assign_type, setup) \
@@ -56,7 +57,6 @@ trace_seq_buffer_ptr(struct trace_seq *s)
 {
return s->buffer + s->len;
 }
-
 #endif /* < 3.17 */
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0)
@@ -133,8 +133,4 @@ devm_hwmon_device_register_with_groups(struct device *dev, 
const char *name,
 #error "Xenomai/cobalt requires Linux kernel 3.10 or above"
 #endif /* < 3.10 */
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
-#define user_msghdr msghdr
-#endif
-
 #endif /* _COBALT_ASM_GENERIC_WRAPPERS_H */


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git



[Xenomai-git] Philippe Gerum : cobalt/arm64: disable callee-saved logic in fptest helpers

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 5372b9851f9c8de1fca303b49dd01961a38faf0f
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=5372b9851f9c8de1fca303b49dd01961a38faf0f

Author: Philippe Gerum 
Date:   Thu Oct 22 14:45:05 2015 +0200

cobalt/arm64: disable callee-saved logic in fptest helpers

We don't want GCC to apply any callee-saved logic to fpsimd registers
in fp_regs_set() before fp_regs_check() can verify their contents, but
we still want GCC to know about the registers we have clobbered.

---

 .../arch/arm64/include/asm/xenomai/uapi/fptest.h   |  160 ++--
 testsuite/switchtest/switchtest.c  |   14 +-
 2 files changed, 92 insertions(+), 82 deletions(-)

diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/fptest.h 
b/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/fptest.h
index 84607b7..7a2cb92 100644
--- a/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/fptest.h
+++ b/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/fptest.h
@@ -20,86 +20,86 @@
 
 #define __COBALT_HAVE_FPU  0x1
 
-static inline void fp_regs_set(int features, unsigned int val)
-{
-
-   unsigned long long e[32];
-   unsigned int i;
-
-   if (features & __COBALT_HAVE_FPU) {
-
-   for (i = 0; i < 32; i++)
-   e[i] = val;
-
-   __asm__ __volatile__("ldp d0, d1, [%0, #8 * 0] \n\
-   ldp   d2, d3, [%0, #8 * 
2] \n\
-   ldp d4, d5, [%0, #8 
* 4]\n\
-   ldp d6, d7, [%0, #8 
* 6]\n\
-   ldp d8, d9, [%0, #8 
* 8]\n\
-   ldp d10, d11, [%0, 
#8 * 10]\n\
-   ldp d12, d13, [%0, 
#8 * 12]\n\
-   ldp d14, d15, [%0, 
#8 * 14]\n\
-   ldp d16, d17, [%0, 
#8 * 16]\n\
-   ldp d18, d19, [%0, 
#8 * 18]\n\
-   ldp d20, d21, [%0, 
#8 * 20]\n\
-   ldp d22, d23, [%0, 
#8 * 22]\n\
-   ldp d24, d25, [%0, 
#8 * 24]\n\
-   ldp d26, d27, [%0, 
#8 * 26]\n\
-   ldp d28, d29, [%0, 
#8 * 28]\n\
-   ldp d30, d31, [%0, 
#8 * 30]"
-
-   : /* No outputs. */
-   : "r"([0])
- : "d0", "d1", "d2", "d3", "d4", "d5", "d6", 
"d7", "d8", "d9", "d10", "d11", "d12", "d13", "d14", "d15",
-   "d16", "d17", "d18", "d19", "d20", 
"d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", "d29", "d30", "d31", 
"memory"
-   );
-   }
-
-}
-
-static inline unsigned int fp_regs_check(int features, unsigned int val,
-int (*report)(const char *fmt, ...))
-{
-   unsigned int result = val;
-
-   unsigned int i;
-   unsigned long long e[32];
-
-   if (features & __COBALT_HAVE_FPU) {
-
-   __asm__ __volatile__("stp d0, d1, [%0, #8 * 0] \n\
-   stp   d2, d3, [%0, #8 * 
2] \n\
-   stp d4, d5, [%0, #8 
* 4]\n\
-   stp d6, d7, [%0, #8 
* 6]\n\
-   stp d8, d9, 
[%0, #8 * 8]\n\
-   stp d10, d11, [%0, 
#8 * 10]\n\
-   stp d12, d13, [%0, 
#8 * 12]\n\
-   stp d14, d15, [%0, 
#8 * 14]\n\
-   stp d16, d17, [%0, 
#8 * 16]\n\
-   stp d18, d19, [%0, 
#8 * 18]\n\
-   stp d20, d21, [%0, 
#8 * 20]\n\
-   stp d22, d23, [%0, 
#8 * 22]\n\
-   stp d24, d25, [%0, 
#8 * 24]\n\
-   stp d26, d27, [%0, 
#8 * 26]\n\
-   stp d28, d29, [%0, 
#8 * 28]\n\
-   stp d30, d31, [%0, 
#8 * 30]"
-
-   :  /* No 

[Xenomai-git] Philippe Gerum : cobalt/arm64: use lazy fpsimd switch mode

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 497cbc7a7844b5641b6031010dd915659b3810f5
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=497cbc7a7844b5641b6031010dd915659b3810f5

Author: Philippe Gerum 
Date:   Mon Oct 19 10:38:21 2015 +0200

cobalt/arm64: use lazy fpsimd switch mode

---

 kernel/cobalt/arch/arm64/thread.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/cobalt/arch/arm64/thread.c 
b/kernel/cobalt/arch/arm64/thread.c
index 5282b0c..2238751 100644
--- a/kernel/cobalt/arch/arm64/thread.c
+++ b/kernel/cobalt/arch/arm64/thread.c
@@ -153,7 +153,7 @@ void xnarch_switch_to(struct xnthread *out, struct xnthread 
*in)
enter_lazy_tlb(prev_mm, next);
}
 
-   __switch_to(prev, next);
+   ipipe_switch_to(prev, next);
 }
 
 int xnarch_escalate(void)


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/arm64: drop useless test on target architecture

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 0d753d77f5999fb489fecd351198d5b05507d614
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=0d753d77f5999fb489fecd351198d5b05507d614

Author: Philippe Gerum 
Date:   Sat Oct 17 14:43:25 2015 +0200

cobalt/arm64: drop useless test on target architecture

---

 kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/features.h |7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/features.h 
b/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/features.h
index 57d0f14..01a12d9 100644
--- a/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/features.h
+++ b/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/features.h
@@ -28,10 +28,9 @@
 
 #define XENOMAI_FEAT_MAN (__xn_feat_generic_man_mask)
 
-#ifndef __aarch64__
-#define XNARCH_HAVE_LLMULSHFT1
-#define XNARCH_HAVE_NODIV_LLIMD  1
-#endif
+#undef XNARCH_HAVE_LLMULSHFT
+
+#undef XNARCH_HAVE_NODIV_LLIMD
 
 struct cobalt_featinfo_archdep { /* no arch-specific feature */ };
 


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/arm64: fix inclusion guards

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 26121df455b53a73f9be0afee22a94370a3f043c
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=26121df455b53a73f9be0afee22a94370a3f043c

Author: Philippe Gerum 
Date:   Sat Oct 17 14:40:53 2015 +0200

cobalt/arm64: fix inclusion guards

---

 kernel/cobalt/arch/arm64/include/asm/xenomai/features.h  |8 
 kernel/cobalt/arch/arm64/include/asm/xenomai/fptest.h|6 +++---
 kernel/cobalt/arch/arm64/include/asm/xenomai/machine.h   |6 +++---
 kernel/cobalt/arch/arm64/include/asm/xenomai/syscall.h   |6 +++---
 kernel/cobalt/arch/arm64/include/asm/xenomai/syscall32.h |6 +++---
 kernel/cobalt/arch/arm64/include/asm/xenomai/thread.h|7 +++
 kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/arith.h|6 +++---
 kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/features.h |6 +++---
 kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/fptest.h   |6 +++---
 kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/syscall.h  |6 +++---
 kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/tsc.h  |6 +++---
 kernel/cobalt/arch/arm64/include/asm/xenomai/wrappers.h  |6 +++---
 12 files changed, 37 insertions(+), 38 deletions(-)

diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/features.h 
b/kernel/cobalt/arch/arm64/include/asm/xenomai/features.h
index d485286..112408f 100644
--- a/kernel/cobalt/arch/arm64/include/asm/xenomai/features.h
+++ b/kernel/cobalt/arch/arm64/include/asm/xenomai/features.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 Philippe Gerum .
+ * Copyright (C) 2015 Philippe Gerum .
  *
  * ARM port
  *   Copyright (C) 2005 Stelian Pop
@@ -19,12 +19,12 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  * 02111-1307, USA.
  */
-#ifndef _COBALT_ARM_ASM_FEATURES_H
-#define _COBALT_ARM_ASM_FEATURES_H
+#ifndef _COBALT_ARM64_ASM_FEATURES_H
+#define _COBALT_ARM64_ASM_FEATURES_H
 
 struct cobalt_featinfo;
 static inline void collect_arch_features(struct cobalt_featinfo *p) { }
 
 #include 
 
-#endif /* !_COBALT_ARM_ASM_FEATURES_H */
+#endif /* !_COBALT_ARM64_ASM_FEATURES_H */
diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/fptest.h 
b/kernel/cobalt/arch/arm64/include/asm/xenomai/fptest.h
index 743d758..cfdf0b3 100644
--- a/kernel/cobalt/arch/arm64/include/asm/xenomai/fptest.h
+++ b/kernel/cobalt/arch/arm64/include/asm/xenomai/fptest.h
@@ -16,8 +16,8 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  * 02111-1307, USA.
  */
-#ifndef _COBALT_ARM_ASM_FPTEST_H
-#define _COBALT_ARM_ASM_FPTEST_H
+#ifndef _COBALT_ARM64_ASM_FPTEST_H
+#define _COBALT_ARM64_ASM_FPTEST_H
 
 #include 
 #include 
@@ -44,4 +44,4 @@ static inline int fp_detect(void)
return have_fp ? __COBALT_HAVE_FPU : 0;
 }
 
-#endif /* _COBALT_ARM_ASM_FPTEST_H */
+#endif /* _COBALT_ARM64_ASM_FPTEST_H */
diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/machine.h 
b/kernel/cobalt/arch/arm64/include/asm/xenomai/machine.h
index b8290bf..7444cc8 100644
--- a/kernel/cobalt/arch/arm64/include/asm/xenomai/machine.h
+++ b/kernel/cobalt/arch/arm64/include/asm/xenomai/machine.h
@@ -20,8 +20,8 @@
  *   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  *   02111-1307, USA.
  */
-#ifndef _COBALT_ARM_ASM_MACHINE_H
-#define _COBALT_ARM_ASM_MACHINE_H
+#ifndef _COBALT_ARM64_ASM_MACHINE_H
+#define _COBALT_ARM64_ASM_MACHINE_H
 
 #include 
 #include 
@@ -58,4 +58,4 @@ static inline __attribute_const__ unsigned long ffnz(unsigned 
long ul)
 
 #include 
 
-#endif /* !_COBALT_ARM_ASM_MACHINE_H */
+#endif /* !_COBALT_ARM64_ASM_MACHINE_H */
diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/syscall.h 
b/kernel/cobalt/arch/arm64/include/asm/xenomai/syscall.h
index 77c1716..949f287 100644
--- a/kernel/cobalt/arch/arm64/include/asm/xenomai/syscall.h
+++ b/kernel/cobalt/arch/arm64/include/asm/xenomai/syscall.h
@@ -19,8 +19,8 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  * 02111-1307, USA.
  */
-#ifndef _COBALT_ARM_ASM_SYSCALL_H
-#define _COBALT_ARM_ASM_SYSCALL_H
+#ifndef _COBALT_ARM64_ASM_SYSCALL_H
+#define _COBALT_ARM64_ASM_SYSCALL_H
 
 #include 
 #include 
@@ -75,4 +75,4 @@ int xnarch_local_syscall(unsigned long a1, unsigned long a2,
 unsigned long a3, unsigned long a4,
 unsigned long a5);
 
-#endif /* !_COBALT_ARM_ASM_SYSCALL_H */
+#endif /* !_COBALT_ARM64_ASM_SYSCALL_H */
diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/syscall32.h 
b/kernel/cobalt/arch/arm64/include/asm/xenomai/syscall32.h
index 95c5a11..a66ddd6 100644
--- a/kernel/cobalt/arch/arm64/include/asm/xenomai/syscall32.h
+++ b/kernel/cobalt/arch/arm64/include/asm/xenomai/syscall32.h
@@ -16,9 +16,9 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  * 02111-1307, USA.
  */
-#ifndef _COBALT_ARM_ASM_SYSCALL32_H
-#define _COBALT_ARM_ASM_SYSCALL32_H
+#ifndef 

[Xenomai-git] Philippe Gerum : cobalt/arm64: add README for I-pipe support

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 36ae8a706c693b4d187ffb2e2f811ed2d838bb97
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=36ae8a706c693b4d187ffb2e2f811ed2d838bb97

Author: Philippe Gerum 
Date:   Sun Nov  1 17:22:33 2015 +0100

cobalt/arm64: add README for I-pipe support

---

 kernel/cobalt/arch/arm64/patches/README |   16 
 1 file changed, 16 insertions(+)

diff --git a/kernel/cobalt/arch/arm64/patches/README 
b/kernel/cobalt/arch/arm64/patches/README
new file mode 100644
index 000..fd85e06
--- /dev/null
+++ b/kernel/cobalt/arch/arm64/patches/README
@@ -0,0 +1,16 @@
+-- arch/arm64/patches
+
+Xenomai needs special kernel support to deliver fast and deterministic
+response time to external interrupts, and also to provide real-time
+services highly integrated with the standard Linux kernel.
+
+This support is provided by the interrupt pipeline (aka I-pipe) in the
+form of a kernel patch you have to apply against a vanilla kernel
+tree, before you attempt to compile the Xenomai codebase against the
+latter kernel.
+
+The Xenomai arm64 port is work in progress. The I-pipe support for
+this architecture is exclusively available from this development tree
+at the moment:
+
+git://git.xenomai.org/ipipe.git, branch devel/ipipe-3.18-linaro-arm64.


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Don Mahurin : cobalt/arm64: Use empty mayday implementation for arm64.

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: a8ebafbf1443a46c5b528e80447c1cb466147202
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=a8ebafbf1443a46c5b528e80447c1cb466147202

Author: Don Mahurin 
Date:   Mon Sep 14 12:52:27 2015 -0700

cobalt/arm64: Use empty mayday implementation for arm64.

The arm mayday implementation was not correct for arm64. Replace with empty 
implementation.
Handle mayday in the linux domain, using xnthread_relax. This change is 
essentially the same as the general change proposed in the 'Mayday issues 
again' discussion (Jan Kiszka, Jun 21), though only applied to arch/arm64.

---

 kernel/cobalt/arch/arm64/mayday.c |   86 +
 1 file changed, 1 insertion(+), 85 deletions(-)

diff --git a/kernel/cobalt/arch/arm64/mayday.c 
b/kernel/cobalt/arch/arm64/mayday.c
index bc51ad6..ca1151c 100644
--- a/kernel/cobalt/arch/arm64/mayday.c
+++ b/kernel/cobalt/arch/arm64/mayday.c
@@ -28,72 +28,6 @@ static void *mayday;
 
 static inline void setup_mayday(void *page)
 {
-   /*
-* We want this code to appear at the top of the MAYDAY page:
-*
-* ifdef ARM_EABI
-*
-* e59f000c ldr r0, [pc, #12]
-* e59f700c ldr r7, [pc, #12]
-* ef00 svc 0x
-* e3a0 mov r0, #0
-* e580 str r0, [r0]; 
-* 105e .word   0x105e  ; sc_cobalt_mayday | 
__COBALT_SYSCALL_BIT
-* 000f0042 .word   0x000f0042
-*
-* elif ARM_OABI
-*
-* e59f0008 ldr r0, [pc, #8]
-* ef9f0042 swi 0x009f0042
-* e3a0 mov r0, #0
-* e580 str r0, [r0]; 
-* 105e .word   0x105e  ; sc_cobalt_mayday | 
__COBALT_SYSCALL_BIT
-*
-* endif
-*
-* 32bit instruction words will be laid out by the compiler as
-* the target endianness requires.
-*
-* We don't mess with CPSR here, so no need to save/restore it
-* in handle/fixup code.
-*/
-#ifdef __ARM_EABI__
-   static const struct {
-   u32 ldr_r0;
-   u32 ldr_r7;
-   u32 swi_0;
-   u32 mov_r0;
-   u32 str_r0;
-   u32 cst_r0;
-   u32 cst_r7;
-   } code = {
-   .ldr_r0 = 0xe59f000c,
-   .ldr_r7 = 0xe59f700c,
-   .swi_0 = 0xef00,
-   .mov_r0 = 0xe3a0,
-   .str_r0 = 0xe580,
-   .cst_r0 =  __xn_syscode(sc_cobalt_mayday),
-   .cst_r7 = 0x000f0042,
-   };
-#else /* OABI */
-   static const struct {
-   u32 ldr_r0;
-   u32 swi_syscall;
-   u32 mov_r0;
-   u32 str_r0;
-   u32 cst_r0;
-   } code = {
-   .ldr_r0 = 0xe59f0008,
-   .swi_syscall = 0xef9f0042,
-   .mov_r0 = 0xe3a0,
-   .str_r0 = 0xe580,
-   .cst_r0 =  __xn_syscode(sc_cobalt_mayday),
-   };
-#endif /* OABI */
-
-   memcpy(page, , sizeof(code));
-
-   flush_dcache_page(vmalloc_to_page(page));
 }
 
 int xnarch_init_mayday(void)
@@ -120,27 +54,9 @@ void *xnarch_get_mayday_page(void)
 void xnarch_handle_mayday(struct xnarchtcb *tcb, struct pt_regs *regs,
  unsigned long tramp)
 {
-   tcb->mayday.pc = regs->pc;
-   tcb->mayday.r0 = regs->regs[0];
-#ifdef __ARM_EABI__
-   tcb->mayday.r7 = regs->regs[7];
-#endif
-#ifdef CONFIG_ARM_THUMB
-   /* The code on the mayday page must be run in ARM mode */
-   tcb->mayday.psr = regs->cpsr;
-   regs->cpsr &= ~PSR_T_BIT;
-#endif
-   regs->pc = tramp;
+   xnthread_relax(0, 0);
 }
 
 void xnarch_fixup_mayday(struct xnarchtcb *tcb, struct pt_regs *regs)
 {
-   regs->pc = tcb->mayday.pc;
-   regs->regs[0] = tcb->mayday.r0;
-#ifdef __ARM_EABI__
-   regs->regs[7] = tcb->mayday.r7;
-#endif
-#ifdef CONFIG_ARM_THUMB
-   regs->cpsr = tcb->mayday.psr;
-#endif
 }


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/arm64: drop obsolete config knob

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 06cabac1b89826f51d5d786e278ab3c38831786a
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=06cabac1b89826f51d5d786e278ab3c38831786a

Author: Philippe Gerum 
Date:   Sat Nov 14 18:17:49 2015 +0100

cobalt/arm64: drop obsolete config knob

All existing ARM64 pipeline implementations provide the
CONFIG_IPIPE_WANT_PREEMPTIBLE_SWITCH knob, which is tested directly in
the Xenomai code base.  No need for CONFIG_XENO_ARCH_UNLOCKED_SWITCH
anymore.

---

 kernel/cobalt/arch/arm64/Kconfig |3 ---
 1 file changed, 3 deletions(-)

diff --git a/kernel/cobalt/arch/arm64/Kconfig b/kernel/cobalt/arch/arm64/Kconfig
index 572de3e..bdf5f16 100644
--- a/kernel/cobalt/arch/arm64/Kconfig
+++ b/kernel/cobalt/arch/arm64/Kconfig
@@ -1,9 +1,6 @@
 source "kernel/xenomai/Kconfig"
 source "drivers/xenomai/Kconfig"
 
-config XENO_ARCH_UNLOCKED_SWITCH
-   def_bool IPIPE_WANT_PREEMPTIBLE_SWITCH
-
 config XENO_ARCH_FPU
def_bool y
 


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/kernel: fixup for v3.19+ (user_msghdr)

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 6c685c816fde8d8c3a59706e9bfa3f316e263112
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=6c685c816fde8d8c3a59706e9bfa3f316e263112

Author: Philippe Gerum 
Date:   Mon Nov  2 20:45:10 2015 +0100

cobalt/kernel: fixup for v3.19+ (user_msghdr)

---

 kernel/cobalt/include/asm-generic/xenomai/wrappers.h |4 
 1 file changed, 4 insertions(+)

diff --git a/kernel/cobalt/include/asm-generic/xenomai/wrappers.h 
b/kernel/cobalt/include/asm-generic/xenomai/wrappers.h
index 060ce85..11367ff 100644
--- a/kernel/cobalt/include/asm-generic/xenomai/wrappers.h
+++ b/kernel/cobalt/include/asm-generic/xenomai/wrappers.h
@@ -133,4 +133,8 @@ devm_hwmon_device_register_with_groups(struct device *dev, 
const char *name,
 #error "Xenomai/cobalt requires Linux kernel 3.10 or above"
 #endif /* < 3.10 */
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
+#define user_msghdr msghdr
+#endif
+
 #endif /* _COBALT_ASM_GENERIC_WRAPPERS_H */


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/arm: track current mm unconditionally

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 9c883274469ad4d736de06f710b48b984b1c9b91
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=9c883274469ad4d736de06f710b48b984b1c9b91

Author: Philippe Gerum 
Date:   Sat Nov 14 15:21:02 2015 +0100

cobalt/arm: track current mm unconditionally

All pipelines Cobalt can work with (i.e. 3.10+) for the arm
architecture do provide the mm tracking feature unconditionally, so
there is no point in keeping any build switch for it.

---

 kernel/cobalt/arch/arm/Kconfig |3 ---
 1 file changed, 3 deletions(-)

diff --git a/kernel/cobalt/arch/arm/Kconfig b/kernel/cobalt/arch/arm/Kconfig
index 2043d70..0c4e0aa 100644
--- a/kernel/cobalt/arch/arm/Kconfig
+++ b/kernel/cobalt/arch/arm/Kconfig
@@ -23,9 +23,6 @@ config IPIPE_WANT_PREEMPTIBLE_SWITCH
default y if XENO_ARCH_UNLOCKED_SWITCH
default n if !XENO_ARCH_UNLOCKED_SWITCH
 
-config IPIPE_WANT_ACTIVE_MM
-   def_bool y
-
 config XENO_ARCH_FPU
def_bool VFP
 


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/arch: fixup READMEs

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 5451a55a69e329ceb8f98cb75865a72c32b335a7
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=5451a55a69e329ceb8f98cb75865a72c32b335a7

Author: Philippe Gerum 
Date:   Mon Nov  2 15:41:31 2015 +0100

cobalt/arch: fixup READMEs

---

 kernel/cobalt/arch/arm/patches/README  |   21 -
 kernel/cobalt/arch/arm64/patches/README|   15 +--
 kernel/cobalt/arch/blackfin/patches/README |   23 +--
 kernel/cobalt/arch/powerpc/patches/README  |   23 +--
 kernel/cobalt/arch/x86/patches/README  |   21 -
 5 files changed, 43 insertions(+), 60 deletions(-)

diff --git a/kernel/cobalt/arch/arm/patches/README 
b/kernel/cobalt/arch/arm/patches/README
index dcc6407..d637872 100644
--- a/kernel/cobalt/arch/arm/patches/README
+++ b/kernel/cobalt/arch/arm/patches/README
@@ -1,23 +1,18 @@
 -- arch/arm/patches
 
-Xenomai needs special kernel support to deliver fast and deterministic
+Cobalt needs special kernel support to deliver fast and deterministic
 response time to external interrupts, and also to provide real-time
 services highly integrated with the standard Linux kernel.
 
 This support is provided by the interrupt pipeline (aka I-pipe) in the
 form of a kernel patch you have to apply against a vanilla kernel
-tree, before you attempt to compile the Xenomai codebase against the
-latter kernel.
+source tree as published by kernel.org.
 
-Apply one of the patches found into this directory against the
-corresponding kernel release. You may want to have a look at the
-README.*INSTALL guides at the top of the Xenomai tree for more
-information.
+You may want to have a look at
+http://xenomai.org/installing-xenomai-3-x/ for detailed information
+about installing Xenomai.
 
-This directory only contains the most recent patches for ARM
-platforms; you may find the complete collection of I-pipe patches at
-the following locations (see note):
+This directory only contains the most recent patches for ARM platforms
+at the time of the release; you may find the complete collection of
+I-pipe patches issued for this architecture at the following location:
 http://xenomai.org/downloads/ipipe/v3.x/arm/
-
-NOTE:
-Xenomai 3.x requires the latest IPIPE core series (API revision >= 2).
diff --git a/kernel/cobalt/arch/arm64/patches/README 
b/kernel/cobalt/arch/arm64/patches/README
index fd85e06..e39758e 100644
--- a/kernel/cobalt/arch/arm64/patches/README
+++ b/kernel/cobalt/arch/arm64/patches/README
@@ -1,16 +1,19 @@
 -- arch/arm64/patches
 
-Xenomai needs special kernel support to deliver fast and deterministic
+Cobalt needs special kernel support to deliver fast and deterministic
 response time to external interrupts, and also to provide real-time
 services highly integrated with the standard Linux kernel.
 
 This support is provided by the interrupt pipeline (aka I-pipe) in the
 form of a kernel patch you have to apply against a vanilla kernel
-tree, before you attempt to compile the Xenomai codebase against the
-latter kernel.
+source tree as published by kernel.org.
 
-The Xenomai arm64 port is work in progress. The I-pipe support for
-this architecture is exclusively available from this development tree
-at the moment:
+You may want to have a look at
+http://xenomai.org/installing-xenomai-3-x/ for detailed information
+about installing Xenomai.
+
+The Cobalt/arm64 port is work in progress. The I-pipe support for this
+architecture is exclusively available from this development tree at
+the moment:
 
 git://git.xenomai.org/ipipe.git, branch devel/ipipe-3.18-linaro-arm64.
diff --git a/kernel/cobalt/arch/blackfin/patches/README 
b/kernel/cobalt/arch/blackfin/patches/README
index 3b92e89..92d6dc4 100644
--- a/kernel/cobalt/arch/blackfin/patches/README
+++ b/kernel/cobalt/arch/blackfin/patches/README
@@ -1,23 +1,18 @@
 -- arch/blackfin/patches
 
-Xenomai needs special kernel support to deliver fast and deterministic
+Cobalt needs special kernel support to deliver fast and deterministic
 response time to external interrupts, and also to provide real-time
 services highly integrated with the standard Linux kernel.
 
 This support is provided by the interrupt pipeline (aka I-pipe) in the
 form of a kernel patch you have to apply against a vanilla kernel
-tree, before you attempt to compile the Xenomai codebase against the
-latter kernel.
+source tree as published by kernel.org.
 
-Apply one of the patches found into this directory against the
-corresponding kernel release. You may want to have a look at the
-README.*INSTALL guides at the top of the Xenomai tree for more
-information.
+You may want to have a look at
+http://xenomai.org/installing-xenomai-3-x/ for detailed information
+about installing Xenomai.
 
-This directory only contains the most recent patches for blackfin
-platforms; you may find the complete collection of I-pipe patches at
-the following locations (see note):

  1   2   >