Commit 601fc705 authored by Federico Vaga's avatar Federico Vaga

Merge branch 'release/v4.0.2'

parents 4ae03dfa 0156922b
# Change Log
## [4.0.1] - 2019-09-13
### Software
#### Fixed
- File Descriptor closed correctly so that the same process can do
``trtl_open()`` and ``trtl_close()`` multiple times
## [4.0.0] - 2019-05-14
### Documentation
#### Changed
- moved to sphinx and ReST
- merged HDL and software
- improved with examples
- doxygen and wbgen2 integration
#### Added
- Tools section
- Demo section
- Glossary section
### Gateware
#### Changed
- soft-CPU is now uRV
- each core has a set of dedicated HMQ and RMQ
#### Added
- uRV debug interface
- notification interrupts from firmwares
- new test benches
### Software
#### Changed
- synchronous messages redesigned
- HMQ API reflects gateware changes
- firmware library and framework improvements
- re-design Python wrapper a bit
#### Added
- driver auto-configuration from configuration ROM
- GDB agent to debug firmware
- tool to generated empty projects
- tools to interact with firmware framework
#### Removed
- Driver message filter
- LM32 support
- function to pause and start CPU execution
### Demo
#### Added
- new demo section
### Tests
#### Added
- new integration test section
## [3.1.0] - 2018-03-09
### Gateware
This release brings in the gateware from wr-node-core repository, such as it
is being used in the released and deployed v1.0 version of masterFIP.
The relevant commit is 96a7859 from git://ohwr.org/white-rabbit/wr-node-core.git.
This is a "known to work" version of the gateware, still using the "node core" name.
Following releases will switch to the "mock turtle" name.
## [3.0.0] - 2017-09-14
### Software
The realease of a new version has been necessary because I decided to remove
the debug interface from the API. This interface has been problematic, and
its original purpose has been neglected
#### Added
- standard TTY interface to access the soft-CPU serial console output
#### Removed
- debugfs interface to access the soft-CPU serial console output
- removed library functions to access the debugfs console output
- the ``mockturtle-messages`` tool is not able anymore to access the soft-CPU
serial console output
#### Fixed
- minor fixes
## [2.0] - 2016-06-08
### Software
#### Changed
- Project change name to Mock Turtle. this means renaming all files
functions, data structures, enumerates and variables to a new
convention
- port output real-time application to the real-time library
- improve kernel driver performance
#### Added
- unittest
## [1.1] - 2015-10-20
### Software
#### Changed
- minor changes in API behaviour on error
## [1.0] - 2015-09-17
### Software
- first release White Rabbit Node Core
[3.0.0] https://www.ohwr.org/projects/mock-turtle-sw/repository?rev=mock-turtle-3.0.0
[2.0] https://www.ohwr.org/projects/mock-turtle-sw/repository?rev=mock-turtle-2.0
[1.1] https://www.ohwr.org/projects/mock-turtle-sw/repository?rev=mock-turtle-1.1
[1.0] https://www.ohwr.org/projects/mock-turtle-sw/repository?rev=mock-turtle-1.0
==========
Change Log
==========
[4.0.2] - 2019-10-14
====================
Changed
-------
- [sw] build driver on Linux v5.0 or greater
- [sw] driver sysfs files permission are g+w
Fixed
-----
- [sw] string overflow control
- [sw] ``trtl_msg_poll`` input validation
[4.0.1] - 2019-09-13
====================
Fixed
-----
- [sw] File Descriptor closed correctly so that the same process can do
``trtl_open()`` and ``trtl_close()`` multiple times
[4.0.0] - 2019-05-14
====================
Changed
-------
- [gw] soft-CPU is now uRV
- [gw] each core has a set of dedicated HMQ and RMQ
- [doc] moved to sphinx and ReST
- [doc] merged HDL and software
- [doc] improved with examples
- [doc] doxygen and wbgen2 integration
- [sw] synchronous messages redesigned
- [sw] HMQ API reflects gateware changes
- [sw] firmware library and framework improvements
- [sw] re-design Python wrapper a bit
Added
-----
- [gw] uRV debug interface
- [gw] notification interrupts from firmwares
- [gw] new test benches
- [doc] Tools section
- [doc] Demo section
- [doc] Glossary section
- [sw] driver auto-configuration from configuration ROM
- [sw] GDB agent to debug firmware
- [sw] tool to generated empty projects
- [sw] tools to interact with firmware framework
- [demo] new demo section
- [test] new integration test section
Removed
-------
- [sw] Driver message filter
- [sw] LM32 support
- [sw] function to pause and start CPU execution
[3.1.0] - 2018-03-09
====================
This release brings in the gateware from wr-node-core repository, such as it
is being used in the released and deployed v1.0 version of masterFIP.
The relevant commit is 96a7859 from git://ohwr.org/white-rabbit/wr-node-core.git.
This is a "known to work" version of the gateware, still using the "node core" name.
Following releases will switch to the "mock turtle" name.
[3.0.0] - 2017-09-14
====================
The realease of a new version has been necessary because I decided to remove
the debug interface from the API. This interface has been problematic, and
its original purpose has been neglected
Added
-----
- [sw] standard TTY interface to access the soft-CPU serial console output
Removed
-------
- [sw] debugfs interface to access the soft-CPU serial console output
- [sw] removed library functions to access the debugfs console output
- [sw] the ``mockturtle-messages`` tool is not able anymore to access the
soft-CPU serial console output
Fixed
-----
- [sw] minor fixes
[2.0.0] - 2016-06-08
====================
Changed
-------
- [sw] Project change name to Mock Turtle. this means renaming all files
[sw] functions, data structures, enumerates and variables to a new
convention
- [sw] port output real-time application to the real-time library
- [sw] improve kernel driver performance
Added
-----
- [test] unittest
[1.1.0] - 2015-10-20
====================
Changed
-------
- [sw] minor changes in API behaviour on error
[1.0.0] - 2015-09-17
====================
- [sw] first release White Rabbit Node Core
[3.0.0] https://www.ohwr.org/projects/mock-turtle-sw/repository?rev=mock-turtle-3.0.0
[2.0] https://www.ohwr.org/projects/mock-turtle-sw/repository?rev=mock-turtle-2.0
[1.1] https://www.ohwr.org/projects/mock-turtle-sw/repository?rev=mock-turtle-1.1
[1.0] https://www.ohwr.org/projects/mock-turtle-sw/repository?rev=mock-turtle-1.0
...@@ -25,6 +25,9 @@ ...@@ -25,6 +25,9 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/tty.h> #include <linux/tty.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/mod_devicetable.h>
#include <linux/uaccess.h>
#include <linux/version.h>
#include <mockturtle/hw/mockturtle_cpu_csr.h> #include <mockturtle/hw/mockturtle_cpu_csr.h>
#include <mockturtle/hw/mockturtle_queue.h> #include <mockturtle/hw/mockturtle_queue.h>
...@@ -175,7 +178,7 @@ static ssize_t reset_mask_store(struct device *dev, ...@@ -175,7 +178,7 @@ static ssize_t reset_mask_store(struct device *dev,
DEVICE_ATTR(application_id, 0444, application_id_show, NULL); DEVICE_ATTR(application_id, 0444, application_id_show, NULL);
DEVICE_ATTR(n_cpu, 0444, n_cpu_show, NULL); DEVICE_ATTR(n_cpu, 0444, n_cpu_show, NULL);
DEVICE_ATTR(reset_mask, 0644, reset_mask_show, reset_mask_store); DEVICE_ATTR(reset_mask, 0664, reset_mask_show, reset_mask_store);
static struct attribute *trtl_dev_attr[] = { static struct attribute *trtl_dev_attr[] = {
&dev_attr_application_id.attr, &dev_attr_application_id.attr,
...@@ -253,11 +256,14 @@ static long trtl_ioctl(struct file *f, unsigned int cmd, unsigned long arg) ...@@ -253,11 +256,14 @@ static long trtl_ioctl(struct file *f, unsigned int cmd, unsigned long arg)
if (_IOC_TYPE(cmd) != TRTL_IOCTL_MAGIC) if (_IOC_TYPE(cmd) != TRTL_IOCTL_MAGIC)
return -ENOTTY; return -ENOTTY;
/* Validate user pointer */ #if KERNEL_VERSION(5, 0, 0) <= LINUX_VERSION_CODE
err = !access_ok(uarg, _IOC_SIZE(cmd));
#else
if (_IOC_DIR(cmd) & _IOC_READ) if (_IOC_DIR(cmd) & _IOC_READ)
err = !access_ok(VERIFY_WRITE, uarg, _IOC_SIZE(cmd)); err = !access_ok(VERIFY_WRITE, uarg, _IOC_SIZE(cmd));
if (_IOC_DIR(cmd) & _IOC_WRITE) if (_IOC_DIR(cmd) & _IOC_WRITE)
err = !access_ok(VERIFY_READ, uarg, _IOC_SIZE(cmd)); err = !access_ok(VERIFY_READ, uarg, _IOC_SIZE(cmd));
#endif
if (err) if (err)
return -EFAULT; return -EFAULT;
......
...@@ -138,7 +138,7 @@ static ssize_t reset_store(struct device *dev, ...@@ -138,7 +138,7 @@ static ssize_t reset_store(struct device *dev,
return count; return count;
} }
DEVICE_ATTR(reset, 0644, reset_show, reset_store); DEVICE_ATTR(reset, 0664, reset_show, reset_store);
static struct attribute *trtl_cpu_attr[] = { static struct attribute *trtl_cpu_attr[] = {
&dev_attr_reset.attr, &dev_attr_reset.attr,
......
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/circ_buf.h> #include <linux/circ_buf.h>
#include <linux/uaccess.h>
#include <linux/version.h>
#include <mockturtle/hw/mockturtle_queue.h> #include <mockturtle/hw/mockturtle_queue.h>
#include <mockturtle/hw/mockturtle_cpu_csr.h> #include <mockturtle/hw/mockturtle_cpu_csr.h>
...@@ -409,7 +411,7 @@ static ssize_t discard_all_store(struct device *dev, ...@@ -409,7 +411,7 @@ static ssize_t discard_all_store(struct device *dev,
return count; return count;
} }
DEVICE_ATTR(discard_all, 0200, NULL, discard_all_store); DEVICE_ATTR(discard_all, 0220, NULL, discard_all_store);
/** /**
...@@ -723,11 +725,14 @@ static long trtl_hmq_ioctl(struct file *f, unsigned int cmd, unsigned long arg) ...@@ -723,11 +725,14 @@ static long trtl_hmq_ioctl(struct file *f, unsigned int cmd, unsigned long arg)
if (_IOC_TYPE(cmd) != TRTL_IOCTL_MAGIC) if (_IOC_TYPE(cmd) != TRTL_IOCTL_MAGIC)
return -ENOTTY; return -ENOTTY;
/* Validate user pointer */ #if KERNEL_VERSION(5, 0, 0) <= LINUX_VERSION_CODE
err = !access_ok(uarg, _IOC_SIZE(cmd));
#else
if (_IOC_DIR(cmd) & _IOC_READ) if (_IOC_DIR(cmd) & _IOC_READ)
err = !access_ok(VERIFY_WRITE, uarg, _IOC_SIZE(cmd)); err = !access_ok(VERIFY_WRITE, uarg, _IOC_SIZE(cmd));
if (_IOC_DIR(cmd) & _IOC_WRITE) if (_IOC_DIR(cmd) & _IOC_WRITE)
err = !access_ok(VERIFY_READ, uarg, _IOC_SIZE(cmd)); err = !access_ok(VERIFY_READ, uarg, _IOC_SIZE(cmd));
#endif
if (err) if (err)
return -EFAULT; return -EFAULT;
......
...@@ -520,12 +520,12 @@ int trtl_cpu_load_application_raw(struct trtl_dev *trtl, ...@@ -520,12 +520,12 @@ int trtl_cpu_load_application_raw(struct trtl_dev *trtl,
unsigned int offset) unsigned int offset)
{ {
struct trtl_desc *wdesc = (struct trtl_desc *)trtl; struct trtl_desc *wdesc = (struct trtl_desc *)trtl;
char path[TRTL_PATH_LEN]; char path[TRTL_PATH_LEN + TRTL_NAME_LEN + 1 + 3];
int fd; int fd;
ssize_t ret; ssize_t ret;
size_t i = 0; size_t i = 0;
snprintf(path, TRTL_PATH_LEN, "%s/%s-%02u", snprintf(path, sizeof(path), "%s/%s-%02u",
wdesc->path, wdesc->name, index); wdesc->path, wdesc->name, index);
fd = open(path, O_WRONLY); fd = open(path, O_WRONLY);
if (fd < 0) if (fd < 0)
...@@ -565,10 +565,10 @@ int trtl_cpu_dump_application_raw(struct trtl_dev *trtl, ...@@ -565,10 +565,10 @@ int trtl_cpu_dump_application_raw(struct trtl_dev *trtl,
unsigned int offset) unsigned int offset)
{ {
struct trtl_desc *wdesc = (struct trtl_desc *)trtl; struct trtl_desc *wdesc = (struct trtl_desc *)trtl;
char path[TRTL_PATH_LEN]; char path[TRTL_PATH_LEN + TRTL_NAME_LEN + 1 + 3];
int fd, i = 0, c = 100; int fd, i = 0, c = 100;
snprintf(path, TRTL_PATH_LEN, "%s/%s-%02u", snprintf(path, sizeof(path), "%s/%s-%02u",
wdesc->path, wdesc->name, index); wdesc->path, wdesc->name, index);
fd = open(path, O_RDONLY); fd = open(path, O_RDONLY);
if (fd < 0) if (fd < 0)
...@@ -683,12 +683,13 @@ int trtl_cpu_dump_application_file(struct trtl_dev *trtl, ...@@ -683,12 +683,13 @@ int trtl_cpu_dump_application_file(struct trtl_dev *trtl,
static int trtl_dev_open(struct trtl_desc *wdesc) static int trtl_dev_open(struct trtl_desc *wdesc)
{ {
if (wdesc->fd_dev < 0) { if (wdesc->fd_dev < 0) {
char path[64]; char path[TRTL_PATH_LEN + TRTL_NAME_LEN + 1];
snprintf(path, sizeof(path), "%s/%s", wdesc->path, wdesc->name); snprintf(path, sizeof(path), "%s/%s", wdesc->path, wdesc->name);
wdesc->fd_dev = open(path, O_RDWR); wdesc->fd_dev = open(path, O_RDWR);
if (wdesc->fd_dev < 0) if (wdesc->fd_dev < 0)
return -1; return -1;
} }
return 0; return 0;
} }
...@@ -1072,6 +1073,10 @@ int trtl_msg_poll(struct polltrtl *trtlp, ...@@ -1072,6 +1073,10 @@ int trtl_msg_poll(struct polltrtl *trtlp,
struct pollfd *p; struct pollfd *p;
int i, ret; int i, ret;
if (!trtlp || !npolls) {
errno = EINVAL;
return -1;
}
p = calloc(npolls, sizeof(struct pollfd)); p = calloc(npolls, sizeof(struct pollfd));
if (!p) if (!p)
return -1; return -1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment