[PATCH] x86/vrtc: Use a real type for rtc_ioport_write()

Andrew Cooper posted 1 patch 4 weeks, 1 day ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/20260728123137.41861-1-andrew.cooper3@citrix.com
xen/arch/x86/hvm/rtc.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
[PATCH] x86/vrtc: Use a real type for rtc_ioport_write()
Posted by Andrew Cooper 4 weeks, 1 day ago
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <jbeulich@suse.com>
CC: Roger Pau Monné <roger@xenproject.org>
CC: Teddy Astie <teddy.astie@vates.tech>
---
 xen/arch/x86/hvm/rtc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/rtc.c b/xen/arch/x86/hvm/rtc.c
index 65b3b79f1edb..9895dd570c65 100644
--- a/xen/arch/x86/hvm/rtc.c
+++ b/xen/arch/x86/hvm/rtc.c
@@ -469,9 +469,8 @@ static void cf_check rtc_alarm_cb(void *opaque)
     spin_unlock(&s->lock);
 }
 
-static int rtc_ioport_write(void *opaque, uint32_t addr, uint32_t data)
+static int rtc_ioport_write(RTCState *s, uint32_t addr, uint32_t data)
 {
-    RTCState *s = opaque;
     struct domain *d = vrtc_domain(s);
     uint32_t orig;
 

base-commit: 75f920bd47a4f59eaaa4596aa3f4e12a447d26d2
-- 
2.39.5


Re: [PATCH] x86/vrtc: Use a real type for rtc_ioport_write()
Posted by Jan Beulich 4 weeks, 1 day ago
On 28.07.2026 14:31, Andrew Cooper wrote:
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>

> --- a/xen/arch/x86/hvm/rtc.c
> +++ b/xen/arch/x86/hvm/rtc.c
> @@ -469,9 +469,8 @@ static void cf_check rtc_alarm_cb(void *opaque)
>      spin_unlock(&s->lock);
>  }
>  
> -static int rtc_ioport_write(void *opaque, uint32_t addr, uint32_t data)
> +static int rtc_ioport_write(RTCState *s, uint32_t addr, uint32_t data)
>  {
> -    RTCState *s = opaque;
>      struct domain *d = vrtc_domain(s);
>      uint32_t orig;

It's entirely unclear why it was ever done like this. Even in 3.2 it could
already have been done the type-correct way.

Jan
Re: [PATCH] x86/vrtc: Use a real type for rtc_ioport_write()
Posted by Andrew Cooper 4 weeks, 1 day ago
On 28/07/2026 1:36 pm, Jan Beulich wrote:
> On 28.07.2026 14:31, Andrew Cooper wrote:
>> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> Reviewed-by: Jan Beulich <jbeulich@suse.com>

Thanks.

>
>> --- a/xen/arch/x86/hvm/rtc.c
>> +++ b/xen/arch/x86/hvm/rtc.c
>> @@ -469,9 +469,8 @@ static void cf_check rtc_alarm_cb(void *opaque)
>>      spin_unlock(&s->lock);
>>  }
>>  
>> -static int rtc_ioport_write(void *opaque, uint32_t addr, uint32_t data)
>> +static int rtc_ioport_write(RTCState *s, uint32_t addr, uint32_t data)
>>  {
>> -    RTCState *s = opaque;
>>      struct domain *d = vrtc_domain(s);
>>      uint32_t orig;
> It's entirely unclear why it was ever done like this. Even in 3.2 it could
> already have been done the type-correct way.

There are a whole bunch of callbacks which use this pattern.  They must
continue to use void * for the function types to work.

I wonder if at any point in the past rtc_ioport_write() was used
directly as a pointee, but I haven't gone looking.

~Andrew