From: Thomas Huth <thuth@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
Michael S Tsirkin <mst@redhat.com>,
qemu-devel@nongnu.org, Bernhard Beschow <shentey@gmail.com>,
Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Cc: "Philippe Mathieu-Daudé" <philmd@linaro.org>,
"BALATON Zoltan" <balaton@eik.bme.hu>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Eduardo Habkost" <eduardo@habkost.net>,
"Hervé Poussineau" <hpoussin@reactos.org>,
"Aurelien Jarno" <aurelien@aurel32.net>
Subject: [PATCH 5/6] hw/rtc/mc146818rtc: Make the mc146818 RTC device target independent
Date: Tue, 3 Jan 2023 09:48:00 +0100 [thread overview]
Message-ID: <20230103084801.20437-6-thuth@redhat.com> (raw)
In-Reply-To: <20230103084801.20437-1-thuth@redhat.com>
The only reason for this code being target dependent was the IRQ-counting
related code in rtc_policy_slew_deliver_irq(). Since these functions have
been moved into a new, separate file (kvm_irqcount.c) which is now always
compiled and linked if either APIC or the mc146818 device are required,
and since we've got a new mechanism for deciding whether the slew tick
policy is available now (via the "slew-tick-policy-available" property),
we can get rid of the #ifdef TARGET_I386 switches in mc146818rtc.c and
declare it in the softmmu_ss instead of specific_ss, so that the code only
gets compiled once for all targets.
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
include/hw/rtc/mc146818rtc.h | 1 +
hw/rtc/mc146818rtc.c | 15 +--------------
hw/rtc/meson.build | 3 +--
3 files changed, 3 insertions(+), 16 deletions(-)
diff --git a/include/hw/rtc/mc146818rtc.h b/include/hw/rtc/mc146818rtc.h
index 54af63d091..9d15d70da8 100644
--- a/include/hw/rtc/mc146818rtc.h
+++ b/include/hw/rtc/mc146818rtc.h
@@ -56,5 +56,6 @@ ISADevice *mc146818_rtc_init(ISABus *bus, int base_year,
qemu_irq intercept_irq);
void rtc_set_memory(ISADevice *dev, int addr, int val);
int rtc_get_memory(ISADevice *dev, int addr);
+void qmp_rtc_reset_reinjection(Error **errp);
#endif /* HW_RTC_MC146818RTC_H */
diff --git a/hw/rtc/mc146818rtc.c b/hw/rtc/mc146818rtc.c
index 86381a74c3..4497ddf024 100644
--- a/hw/rtc/mc146818rtc.c
+++ b/hw/rtc/mc146818rtc.c
@@ -45,10 +45,6 @@
#include "qapi/visitor.h"
#include "hw/rtc/mc146818rtc_regs.h"
-#ifdef TARGET_I386
-#include "qapi/qapi-commands-misc-target.h"
-#endif
-
//#define DEBUG_CMOS
//#define DEBUG_COALESCED
@@ -112,7 +108,6 @@ static void rtc_coalesced_timer_update(RTCState *s)
static QLIST_HEAD(, RTCState) rtc_devices =
QLIST_HEAD_INITIALIZER(rtc_devices);
-#ifdef TARGET_I386
void qmp_rtc_reset_reinjection(Error **errp)
{
RTCState *s;
@@ -124,6 +119,7 @@ void qmp_rtc_reset_reinjection(Error **errp)
static bool rtc_policy_slew_deliver_irq(RTCState *s)
{
+ assert(s->slew_tick_policy_available);
kvm_reset_irq_delivered();
qemu_irq_raise(s->irq);
return kvm_get_irq_delivered();
@@ -145,13 +141,6 @@ static void rtc_coalesced_timer(void *opaque)
rtc_coalesced_timer_update(s);
}
-#else
-static bool rtc_policy_slew_deliver_irq(RTCState *s)
-{
- assert(0);
- return false;
-}
-#endif
static uint32_t rtc_periodic_clock_ticks(RTCState *s)
{
@@ -925,12 +914,10 @@ static void rtc_realizefn(DeviceState *dev, Error **errp)
case LOST_TICK_POLICY_DISCARD:
break;
case LOST_TICK_POLICY_SLEW:
-#ifdef TARGET_I386
if (s->slew_tick_policy_available) {
s->coalesced_timer = timer_new_ns(rtc_clock, rtc_coalesced_timer, s);
break;
}
-#endif
/* fallthrough */
default:
error_setg(errp, "Invalid lost tick policy.");
diff --git a/hw/rtc/meson.build b/hw/rtc/meson.build
index dc33973384..34a4d316fa 100644
--- a/hw/rtc/meson.build
+++ b/hw/rtc/meson.build
@@ -13,5 +13,4 @@ softmmu_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files('aspeed_rtc.c'))
softmmu_ss.add(when: 'CONFIG_GOLDFISH_RTC', if_true: files('goldfish_rtc.c'))
softmmu_ss.add(when: 'CONFIG_LS7A_RTC', if_true: files('ls7a_rtc.c'))
softmmu_ss.add(when: 'CONFIG_ALLWINNER_H3', if_true: files('allwinner-rtc.c'))
-
-specific_ss.add(when: 'CONFIG_MC146818RTC', if_true: files('mc146818rtc.c'))
+softmmu_ss.add(when: 'CONFIG_MC146818RTC', if_true: files('mc146818rtc.c'))
--
2.31.1
next prev parent reply other threads:[~2023-01-03 8:50 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-03 8:47 [PATCH 0/6] mc146818rtc related clean-ups and improvements Thomas Huth
2023-01-03 8:47 ` [PATCH 1/6] hw/i386/pc: Create RTC controllers in south bridges Thomas Huth
2023-01-03 8:47 ` [PATCH 2/6] hw/i386/pc: No need for rtc_state to be an out-parameter Thomas Huth
2023-01-03 13:11 ` Philippe Mathieu-Daudé
2023-01-03 8:47 ` [PATCH 3/6] hw/intc: Extract the IRQ counting functions into a separate file Thomas Huth
2023-01-03 12:55 ` Bernhard Beschow
2023-01-03 8:47 ` [PATCH 4/6] hw/rtc/mc146818rtc: Add a property for the availability of the slew tick policy Thomas Huth
2023-01-03 13:10 ` Philippe Mathieu-Daudé
2023-01-03 13:32 ` Bernhard Beschow
2023-01-03 13:46 ` Bernhard Beschow
2023-01-03 15:00 ` Bernhard Beschow
2023-01-04 8:55 ` Mark Cave-Ayland
2023-01-09 20:12 ` Thomas Huth
2023-01-09 20:53 ` B
2023-01-10 7:52 ` Thomas Huth
2023-01-03 8:48 ` Thomas Huth [this message]
2023-01-03 12:58 ` [PATCH 5/6] hw/rtc/mc146818rtc: Make the mc146818 RTC device target independent Bernhard Beschow
2023-01-03 8:48 ` [PATCH 6/6] softmmu/rtc: Emit warning when using driftfix=slew on systems without mc146818 Thomas Huth
2023-01-03 13:08 ` Philippe Mathieu-Daudé
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=20230103084801.20437-6-thuth@redhat.com \
--to=thuth@redhat.com \
--cc=aurelien@aurel32.net \
--cc=balaton@eik.bme.hu \
--cc=eduardo@habkost.net \
--cc=hpoussin@reactos.org \
--cc=marcel.apfelbaum@gmail.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=shentey@gmail.com \
/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 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.