From: Alexandre Belloni <alexandre.belloni@bootlin.com> To: Aleksandar Markovic <aleksandar.m.mail@gmail.com> Cc: "Arnd Bergmann" <arnd@arndb.de>, "Laurent Vivier" <laurent@vivier.eu>, "Filip Bozuta" <Filip.Bozuta@rt-rk.com>, "Peter Maydell" <peter.maydell@linaro.org>, "Daniel P. Berrangé" <berrange@redhat.com>, "Richard Henderson" <richard.henderson@linaro.org>, "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>, "Max Filippov" <jcmvbkbc@gmail.com>, "amarkovic@wavecomp.com" <amarkovic@wavecomp.com>, "philmd@redhat.com" <philmd@redhat.com>, linux-rtc@vger.kernel.org Subject: Re: [PATCH 08/12] linux-user: Add support for setting alsa timer enhanced read using ioctl Date: Fri, 17 Jan 2020 22:54:44 +0100 [thread overview] Message-ID: <20200117215444.GD3036@piout.net> (raw) In-Reply-To: <CAL1e-=gv_L0fuq9t8mmOiZ2D-CwpPrZZOjwrDwKwe09jvWJpXQ@mail.gmail.com> Hi, Quick answers to your very good questions below: On 17/01/2020 21:50:34+0100, Aleksandar Markovic wrote: > Alexandre (and Arnd too, or any other person knowledgeable in the area), > > I just need to clarify a couple of details with you, please. > > Firstly, here is what man page rtc(4) says: > > "The /dev/rtc (or /dev/rtc0, /dev/rtc1, etc.) device can be opened > only once (until it is closed) and it is read-only. On read(2) and > select(2) the calling process is blocked until the next interrupt from > that RTC is received. Following the interrupt, the process can read a > long integer, of which the least significant byte contains a bit mask > encoding the types of interrupt that occurred, while the remaining 3 > bytes contain the number of interrupts since the last read(2)." > > So, it looks read() will always return only 4 bytes of useful info > (regardless of host being 32-bit/64-bit). > > My questions are: > > - Is the description in man page genuinely accurate? > It is accurate. It is a mask of: #define RTC_IRQF 0x80 /* Any of the following is active */ #define RTC_PF 0x40 /* Periodic interrupt */ #define RTC_AF 0x20 /* Alarm interrupt */ #define RTC_UF 0x10 /* Update interrupt for 1Hz RTC */ Which will most likely be RTC_IRQF | RTC_AF. > - To me (but I am really an outsider to using RTC in applications), > this feature (blocking read()/select()) even looks very nice and > convenient, in all fairness. But I would like to ask you: Is this > feature used rarely or frequently by other libraries/tools/etc.? In > other words, is the feature "obscure" or "crucial" part of RTC kernel > support? Or, something in between? > Nobody is actually using the return value. > - Does MC146818 support this feature? > This feature is implemented in the RTC core so it is supported by all RTCs that have alarms. Internally, the value is an unsigned long and it is casted properly by put_user in rtc_dev_read: https://elixir.bootlin.com/linux/v5.4/source/drivers/rtc/dev.c#L178 -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
WARNING: multiple messages have this Message-ID (diff)
From: Alexandre Belloni <alexandre.belloni@bootlin.com> To: Aleksandar Markovic <aleksandar.m.mail@gmail.com> Cc: linux-rtc@vger.kernel.org, "Peter Maydell" <peter.maydell@linaro.org>, "Daniel P. Berrangé" <berrange@redhat.com>, "Arnd Bergmann" <arnd@arndb.de>, "Richard Henderson" <richard.henderson@linaro.org>, "Laurent Vivier" <laurent@vivier.eu>, "Filip Bozuta" <Filip.Bozuta@rt-rk.com>, "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>, "Max Filippov" <jcmvbkbc@gmail.com>, "amarkovic@wavecomp.com" <amarkovic@wavecomp.com>, "philmd@redhat.com" <philmd@redhat.com> Subject: Re: [PATCH 08/12] linux-user: Add support for setting alsa timer enhanced read using ioctl Date: Fri, 17 Jan 2020 22:54:44 +0100 [thread overview] Message-ID: <20200117215444.GD3036@piout.net> (raw) In-Reply-To: <CAL1e-=gv_L0fuq9t8mmOiZ2D-CwpPrZZOjwrDwKwe09jvWJpXQ@mail.gmail.com> Hi, Quick answers to your very good questions below: On 17/01/2020 21:50:34+0100, Aleksandar Markovic wrote: > Alexandre (and Arnd too, or any other person knowledgeable in the area), > > I just need to clarify a couple of details with you, please. > > Firstly, here is what man page rtc(4) says: > > "The /dev/rtc (or /dev/rtc0, /dev/rtc1, etc.) device can be opened > only once (until it is closed) and it is read-only. On read(2) and > select(2) the calling process is blocked until the next interrupt from > that RTC is received. Following the interrupt, the process can read a > long integer, of which the least significant byte contains a bit mask > encoding the types of interrupt that occurred, while the remaining 3 > bytes contain the number of interrupts since the last read(2)." > > So, it looks read() will always return only 4 bytes of useful info > (regardless of host being 32-bit/64-bit). > > My questions are: > > - Is the description in man page genuinely accurate? > It is accurate. It is a mask of: #define RTC_IRQF 0x80 /* Any of the following is active */ #define RTC_PF 0x40 /* Periodic interrupt */ #define RTC_AF 0x20 /* Alarm interrupt */ #define RTC_UF 0x10 /* Update interrupt for 1Hz RTC */ Which will most likely be RTC_IRQF | RTC_AF. > - To me (but I am really an outsider to using RTC in applications), > this feature (blocking read()/select()) even looks very nice and > convenient, in all fairness. But I would like to ask you: Is this > feature used rarely or frequently by other libraries/tools/etc.? In > other words, is the feature "obscure" or "crucial" part of RTC kernel > support? Or, something in between? > Nobody is actually using the return value. > - Does MC146818 support this feature? > This feature is implemented in the RTC core so it is supported by all RTCs that have alarms. Internally, the value is an unsigned long and it is casted properly by put_user in rtc_dev_read: https://elixir.bootlin.com/linux/v5.4/source/drivers/rtc/dev.c#L178 -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
next prev parent reply other threads:[~2020-01-17 21:54 UTC|newest] Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-01-15 15:53 [PATCH 00/12] linux-user: Add support for real time clock and Filip Bozuta 2020-01-15 15:53 ` [PATCH 01/12] linux-user: Add support for enabling/disabling RTC features using ioctls Filip Bozuta 2020-01-15 15:53 ` [PATCH 02/12] linux-user: Add support for getting/setting RTC time and alarm " Filip Bozuta 2020-01-15 15:53 ` [PATCH 03/12] linux-user: Add support for getting/setting RTC periodic interrupt and epoch " Filip Bozuta 2020-01-15 16:46 ` Laurent Vivier 2020-01-15 15:53 ` [PATCH 04/12] linux-user: Add support for getting/setting RTC wakeup alarm " Filip Bozuta 2020-01-15 15:53 ` [PATCH 05/12] linux-user: Add support for getting/setting RTC PLL correction " Filip Bozuta 2020-01-15 15:53 ` [PATCH 06/12] linux-user: Add support for read/clear RTC voltage low detector " Filip Bozuta 2020-01-15 15:53 ` [PATCH 07/12] linux-user: Add support for getting alsa timer version and id Filip Bozuta 2020-01-15 15:53 ` [PATCH 08/12] linux-user: Add support for setting alsa timer enhanced read using ioctl Filip Bozuta 2020-01-15 16:18 ` Arnd Bergmann 2020-01-15 16:32 ` Laurent Vivier 2020-01-15 16:37 ` Arnd Bergmann 2020-01-15 19:17 ` Filip Bozuta 2020-01-15 19:51 ` Arnd Bergmann 2020-01-15 21:30 ` Laurent Vivier 2020-01-15 21:52 ` Laurent Vivier 2020-01-16 2:49 ` Aleksandar Markovic 2020-01-16 11:27 ` Aleksandar Markovic 2020-01-16 12:00 ` Arnd Bergmann 2020-01-16 12:00 ` Arnd Bergmann 2020-01-17 20:50 ` Aleksandar Markovic 2020-01-17 20:50 ` Aleksandar Markovic 2020-01-17 21:45 ` Arnd Bergmann 2020-01-17 21:45 ` Arnd Bergmann 2020-01-17 21:54 ` Alexandre Belloni [this message] 2020-01-17 21:54 ` Alexandre Belloni 2020-01-15 15:53 ` [PATCH 09/12] linux-user: Add support for getting/setting specified alsa timer parameters using ioctls Filip Bozuta 2020-01-15 15:53 ` [PATCH 10/12] linux-user: Add support for selecting alsa timer using ioctl Filip Bozuta 2020-01-15 15:53 ` [PATCH 11/12] linux-user: Add support for getting/setting selected alsa timer parameters using ioctls Filip Bozuta 2020-01-15 15:53 ` [PATCH 12/12] linux-user: Add support for selected alsa timer instructions " Filip Bozuta 2020-01-15 16:35 ` [PATCH 00/12] linux-user: Add support for real time clock and Laurent Vivier -- strict thread matches above, loose matches on Subject: below -- 2020-01-09 12:59 Filip Bozuta 2020-01-09 12:59 ` [PATCH 08/12] linux-user: Add support for setting alsa timer enhanced read using ioctl Filip Bozuta 2020-01-14 12:44 ` Laurent Vivier
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=20200117215444.GD3036@piout.net \ --to=alexandre.belloni@bootlin.com \ --cc=Filip.Bozuta@rt-rk.com \ --cc=aleksandar.m.mail@gmail.com \ --cc=amarkovic@wavecomp.com \ --cc=arnd@arndb.de \ --cc=berrange@redhat.com \ --cc=jcmvbkbc@gmail.com \ --cc=laurent@vivier.eu \ --cc=linux-rtc@vger.kernel.org \ --cc=peter.maydell@linaro.org \ --cc=philmd@redhat.com \ --cc=qemu-devel@nongnu.org \ --cc=richard.henderson@linaro.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.