Add ioctls for all RTC features that are currently supported in linux kernel.
This series covers following 22 iocts: * RTC_AIE_ON * RTC_ALM_SET * RTC_WKALM_SET * RTC_AIE_OFF * RTC_ALM_READ * RTC_WKALM_RD * RTC_UIE_ON * RTC_RD_TIME * RTC_PLL_GET * RTC_UIE_OFF * RTC_SET_TIME * RTC_PLL_SET * RTC_PIE_ON * RTC_IRQP_READ * RTC_VL_READ * RTC_PIE_OFF * RTC_IRQP_SET * RTC_VL_CLR * RTC_WIE_ON * RTC_EPOCH_READ * RTC_WIE_OFF * RTC_EPOCH_SET The functionalities of individual ioctls were described in this series patch commit messages. Testing method: Mini test programs were written for each ioctl. Those programs were compiled (sometimes using cross-compilers) for the following architectures: * Intel 64-bit (little endian) * Power pc 32-bit (big endian) * Power pc 64-bit (big endian) The corresponding native programs were executed without using QEMU on following hosts: * Intel Core i7-4790K (x86_64 host) * Power 7447A (ppc32 host) All applicable compiled programs were in turn executed through QEMU and the results obtained were the same ones gotten for native execution. Example of a test program: For ioctl RTC_RD_TIME the following test program was used: #include <stdio.h> #include <stdlib.h> #include <linux/rtc.h> #include <fcntl.h> #include <linux/input.h> #include <sys/types.h> #include <unistd.h> #define ERROR -1 int main() { int fd = open("/dev/rtc", O_RDWR | O_NONBLOCK); if(fd == ERROR) { perror("open"); return -1; } struct rtc_time cur_time; if(ioctl(fd, RTC_RD_TIME, &cur_time) < 0) { perror("ioctl"); return -1; } printf("Second: %d, Minute: %d, Hour: %d, Day: %d, Month: %d, Year: %d,", cur_time.tm_sec, cur_time.tm_min, cur_time.tm_hour, cur_time.tm_mday, cur_time.tm_mon, cur_time.tm_year); return 0; } Limitations of testing: The test host pc that was used for testing (intel pc) has RTC that doesn't support all RTC features that are accessible through ioctls. This means that testing can't discover functionality errors related to the third argument of ioctls that are used for features which are not supported. For example, running the test program for ioctl RTC_EPOCH_READ gives the error output: inappropriate ioctl for device. As expected, the same output was obtained through QEMU which means that this ioctl is recognized in QEMU but doesn't really do anything because it is not supported in the host computer's RTC. Conclusion: Some RTC ioctls need to be tested on computers that support their functionalities so that it can be inferred that they are really supported in QEMU. In absence of such test hosts, the specifications of those ioctls need to be carefully checked manually and the implementations should be updated accordingly. v4: * changed patch descriptions so that they are better formatted and more cemprehensible v3: * changed two instances of MK_PTR(TYPE_ULONG) to TYPE_ULONG v2: * added description of each ioctl in patches * wrote a more detailed cover letter with description of testing * changed one instance of TYPE_INT to MK_PTR(TYPE_INT) Filip Bozuta (6): linux-user: Add support for enabling/disabling RTC features using ioctls linux-user: Add support for getting/setting RTC time and alarm using ioctls linux-user: Add support for getting/setting RTC periodic interrupt and epoch using ioctls linux-user: Add support for getting/setting RTC wakeup alarm using ioctls linux-user: Add support for getting/setting RTC PLL correction using ioctls linux-user: Add support for read/clear RTC voltage low detector using ioctls linux-user/ioctls.h | 23 +++++++++++++++++++++++ linux-user/syscall.c | 1 + linux-user/syscall_defs.h | 36 ++++++++++++++++++++++++++++++++++++ linux-user/syscall_types.h | 25 +++++++++++++++++++++++++ 4 files changed, 85 insertions(+) -- 2.7.4