[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] x86/vRTC: minor adjustment to reads from index port


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 11 May 2023 13:51:06 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=mpgonQYUpEAl3AwPVAhrNHwGHxi1zyVswuSPi4ojvwU=; b=h/yOGzGTBVQQqe+IE1kPMMHvttNfp105yaRhV0UJ+ZxJ7MFEFru6THmhTJii9XMji2OuJiWmLbQIDpQUzPVy2xofFd35iYjjeYpxjjrxouMvKnltNe9DCVGdBMrl0i5rxrdrghryhsutNzQXG3JN4H4qHNMkJATHog3q952RksaZAJ6LAUe8Gg1ip5/8J48DRaDaRyLTaXW8UnBkrdGbQVahHV9a2Asklek3omrbvvfjVDLaFNgLOLS4l7eR15urUsC6qlvlgmhibr5hkJfVQYyy19+PWv078PPUgWGb5nB//Ti1W2KGuT1EoA4qYEXRrWmljTMpZCZ6M3HDxhCQzg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PFO2N8g1N3L29rBDP2FEWSuT/Q78PjkkozzTuD5SiDey7pTKa72YA+SK6ycMHjYhpordTr0R+M8yMphxywIvB4qb4KL3+B2y8bfJLQ08mbBEZiGJggn3zt6PcIjIHKHijfERtDJZ80OqhBkGeOnFh35ABgF60VoDBhwxDaM13qO4ky80F3pxdsAn+G4bgGZA+30qidPKmi9CdnhUxz+k3VdoeKglNXbTSk6vS/YE8zCNbKC8flUCPNlqczQFNe+3MtHIdWvbiCkVUrC3OH5Y0vA5Ujlmjzjicqya7ML8h+92zvZVOqG5R01BbazrnMtUYXr7wkqPj4JkrDooiJ7pGg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Thu, 11 May 2023 11:51:13 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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@xxxxxxxx>

--- 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;
     }
 



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.