All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/vRTC: minor adjustment to reads from index port
@ 2023-05-11 11:51 Jan Beulich
  2023-10-25 11:36 ` Roger Pau Monné
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2023-05-11 11:51 UTC (permalink / raw)
  To: xen-devel@lists.xenproject.org
  Cc: Andrew Cooper, Wei Liu, Roger Pau Monné

Whether to handle this shouldn't depend on the present value of the
index register. Since the handling is done outside of the lock anyway,
pull it out into the sole caller and drop the no longer needed function
parameter.

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

--- a/xen/arch/x86/hvm/rtc.c
+++ b/xen/arch/x86/hvm/rtc.c
@@ -645,14 +645,11 @@ static int update_in_progress(RTCState *
     return 0;
 }
 
-static uint32_t rtc_ioport_read(RTCState *s, uint32_t addr)
+static uint32_t rtc_ioport_read(RTCState *s)
 {
     int ret;
     struct domain *d = vrtc_domain(s);
 
-    if ( (addr & 1) == 0 )
-        return 0xff;
-
     spin_lock(&s->lock);
 
     switch ( s->hw.cmos_index )
@@ -714,9 +711,14 @@ static int cf_check handle_rtc_io(
         if ( rtc_ioport_write(vrtc, port, (uint8_t)*val) )
             return X86EMUL_OKAY;
     }
+    else if ( !(port & 1) )
+    {
+        *val = 0xff;
+        return X86EMUL_OKAY;
+    }
     else if ( vrtc->hw.cmos_index < RTC_CMOS_SIZE )
     {
-        *val = rtc_ioport_read(vrtc, port);
+        *val = rtc_ioport_read(vrtc);
         return X86EMUL_OKAY;
     }
 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-10-25 11:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-11 11:51 [PATCH] x86/vRTC: minor adjustment to reads from index port Jan Beulich
2023-10-25 11:36 ` Roger Pau Monné

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.