From: Filip Bozuta <Filip.Bozuta@rt-rk.com>
To: qemu-devel@nongnu.org
Cc: laurent@viver.eu, Filip.Bozuta@rt-rk.com
Subject: [PATCH v3 for 5.0 0/6] linux-user: Add support for real time clock ioctls
Date: Fri, 15 Nov 2019 13:32:10 +0100 [thread overview]
Message-ID: <1573821136-30219-1-git-send-email-Filip.Bozuta@rt-rk.com> (raw)
Add ioctls for all RTC features that are currently supported in linux kernel.
This series covers following 22 iocts:
* RTC_AIE_ON
* RTC_AIE_OFF
* RTC_UIE_ON
* RTC_UIE_OFF
* RTC_PIE_ON
* RTC_PIE_OFF
* RTC_WIE_ON
* RTC_WIE_OFF
* RTC_ALM_SET
* RTC_ALM_READ
* RTC_RD_TIME
* RTC_SET_TIME
* RTC_IRQP_READ
* RTC_IRQP_SET
* RTC_EPOCH_READ
* RTC_EPOCH_SET
* RTC_WKALM_SET
* RTC_WKALM_RD
* RTC_PLL_GET
* RTC_PLL_SET
* RTC_VL_READ
* RTC_VL_CLR
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(R) Core(TM) i7-4790K CPU @ 4.00GHz
*.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 we have used the following test program:
#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:
My test host (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 that are not supported. For example,
running my test program for ioctl RTC_EPOCH_READ gives
the error output: inappropriate ioctl for device. As
expected, i get the same output through QEMU which means
that this ioctl is recognized in QEMU but doesn't really
do anything beacuse it is not supported in my computer's
RTC.
Conclusion: Some RTC ioctls need to be tested on computers
that support their functionalities so that we can be sure
that they are really supported in QEMU. In absence of such
test hosts, we need to carefully check the specifications
of those ioctls manually and update implementations
accordingly.
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 enable/disable RTC features using ioctls
linux-user: Add support for read/set RTC time and alarm using ioctls
linux-user: Add support for read/set RTC periodic interrupt and epoch
using ioctls
linux-user: Add support for get/set RTC wakeup alarm using ioctls
linux-user: Add support for get/set 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
next reply other threads:[~2019-11-15 12:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-15 12:32 Filip Bozuta [this message]
2019-11-15 12:32 ` [PATCH v3 for 5.0 1/6] linux-user: Add support for enable/disable RTC features using ioctls Filip Bozuta
2019-11-15 12:32 ` [PATCH v3 for 5.0 2/6] linux-user: Add support for read/set RTC time and alarm " Filip Bozuta
2019-11-15 12:32 ` [PATCH v3 for 5.0 3/6] linux-user: Add support for read/set RTC periodic interrupt and epoch " Filip Bozuta
2019-11-15 12:32 ` [PATCH v3 for 5.0 4/6] linux-user: Add support for get/set RTC wakeup alarm " Filip Bozuta
2019-11-15 12:32 ` [PATCH v3 for 5.0 5/6] linux-user: Add support for get/set RTC PLL correction " Filip Bozuta
2019-11-15 12:32 ` [PATCH v3 for 5.0 6/6] linux-user: Add support for read/clear RTC voltage low detector " Filip Bozuta
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1573821136-30219-1-git-send-email-Filip.Bozuta@rt-rk.com \
--to=filip.bozuta@rt-rk.com \
--cc=laurent@viver.eu \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).