Message ID | 20190916154847.28936-4-philmd@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | hw: Split RTC devices from hw/timer/ to hw/rtc/ | expand |
On Mon, Sep 16, 2019 at 9:31 AM Philippe Mathieu-Daudé <philmd@redhat.com> wrote: > > The MC146818 is a Real Time Clock, not a timer. > Move it under the hw/rtc/ subdirectory. > > Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Alistair > --- > MAINTAINERS | 4 +-- > hw/alpha/dp264.c | 2 +- > hw/hppa/machine.c | 2 +- > hw/i386/acpi-build.c | 2 +- > hw/i386/pc.c | 2 +- > hw/i386/pc_q35.c | 2 +- > hw/mips/mips_fulong2e.c | 2 +- > hw/mips/mips_jazz.c | 2 +- > hw/mips/mips_malta.c | 2 +- > hw/mips/mips_r4k.c | 2 +- > hw/ppc/pnv.c | 2 +- > hw/ppc/prep.c | 2 +- > hw/rtc/Kconfig | 3 ++ > hw/rtc/Makefile.objs | 1 + > hw/{timer => rtc}/mc146818rtc.c | 2 +- > hw/timer/Kconfig | 3 -- > hw/timer/Makefile.objs | 2 -- > hw/timer/hpet.c | 2 +- > include/hw/rtc/mc146818rtc.h | 38 ++++++++++++++++++++ > include/hw/{timer => rtc}/mc146818rtc_regs.h | 1 + > include/hw/timer/mc146818rtc.h | 14 -------- > tests/rtc-test.c | 2 +- > 22 files changed, 59 insertions(+), 35 deletions(-) > rename hw/{timer => rtc}/mc146818rtc.c (99%) > create mode 100644 include/hw/rtc/mc146818rtc.h > rename include/hw/{timer => rtc}/mc146818rtc_regs.h (98%) > delete mode 100644 include/hw/timer/mc146818rtc.h > > diff --git a/MAINTAINERS b/MAINTAINERS > index 5562d2c6d0..481f2318cb 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -1263,7 +1263,7 @@ F: hw/misc/debugexit.c > F: hw/misc/pc-testdev.c > F: hw/timer/hpet* > F: hw/timer/i8254* > -F: hw/timer/mc146818rtc* > +F: hw/rtc/mc146818rtc* > F: hw/watchdog/wdt_ib700.c > F: hw/watchdog/wdt_i6300esb.c > F: include/hw/display/vga.h > @@ -1275,7 +1275,7 @@ F: include/hw/isa/i8259_internal.h > F: include/hw/isa/superio.h > F: include/hw/timer/hpet.h > F: include/hw/timer/i8254* > -F: include/hw/timer/mc146818rtc* > +F: include/hw/rtc/mc146818rtc* > > Machine core > M: Eduardo Habkost <ehabkost@redhat.com> > diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c > index 51feee8558..51b3cf7a61 100644 > --- a/hw/alpha/dp264.c > +++ b/hw/alpha/dp264.c > @@ -14,7 +14,7 @@ > #include "alpha_sys.h" > #include "qemu/error-report.h" > #include "sysemu/sysemu.h" > -#include "hw/timer/mc146818rtc.h" > +#include "hw/rtc/mc146818rtc.h" > #include "hw/ide.h" > #include "hw/timer/i8254.h" > #include "hw/isa/superio.h" > diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c > index 2736ce835e..6598e2469d 100644 > --- a/hw/hppa/machine.c > +++ b/hw/hppa/machine.c > @@ -12,7 +12,7 @@ > #include "qemu/error-report.h" > #include "sysemu/reset.h" > #include "sysemu/sysemu.h" > -#include "hw/timer/mc146818rtc.h" > +#include "hw/rtc/mc146818rtc.h" > #include "hw/ide.h" > #include "hw/timer/i8254.h" > #include "hw/char/serial.h" > diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c > index e54e571a75..44a8073507 100644 > --- a/hw/i386/acpi-build.c > +++ b/hw/i386/acpi-build.c > @@ -45,7 +45,7 @@ > #include "hw/acpi/vmgenid.h" > #include "hw/boards.h" > #include "sysemu/tpm_backend.h" > -#include "hw/timer/mc146818rtc_regs.h" > +#include "hw/rtc/mc146818rtc_regs.h" > #include "migration/vmstate.h" > #include "hw/mem/memory-device.h" > #include "sysemu/numa.h" > diff --git a/hw/i386/pc.c b/hw/i386/pc.c > index bad866fe44..beef7a992d 100644 > --- a/hw/i386/pc.c > +++ b/hw/i386/pc.c > @@ -42,7 +42,7 @@ > #include "elf.h" > #include "migration/vmstate.h" > #include "multiboot.h" > -#include "hw/timer/mc146818rtc.h" > +#include "hw/rtc/mc146818rtc.h" > #include "hw/dma/i8257.h" > #include "hw/timer/i8254.h" > #include "hw/input/i8042.h" > diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c > index d4e8a1cb9f..a976af9a2a 100644 > --- a/hw/i386/pc_q35.c > +++ b/hw/i386/pc_q35.c > @@ -33,7 +33,7 @@ > #include "hw/loader.h" > #include "sysemu/arch_init.h" > #include "hw/i2c/smbus_eeprom.h" > -#include "hw/timer/mc146818rtc.h" > +#include "hw/rtc/mc146818rtc.h" > #include "hw/xen/xen.h" > #include "sysemu/kvm.h" > #include "kvm_i386.h" > diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c > index cf537dd7e6..03a27e1767 100644 > --- a/hw/mips/mips_fulong2e.c > +++ b/hw/mips/mips_fulong2e.c > @@ -39,7 +39,7 @@ > #include "hw/ide.h" > #include "elf.h" > #include "hw/isa/vt82c686.h" > -#include "hw/timer/mc146818rtc.h" > +#include "hw/rtc/mc146818rtc.h" > #include "hw/timer/i8254.h" > #include "exec/address-spaces.h" > #include "sysemu/qtest.h" > diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c > index c967b97d80..2811a4bd90 100644 > --- a/hw/mips/mips_jazz.c > +++ b/hw/mips/mips_jazz.c > @@ -39,7 +39,7 @@ > #include "hw/scsi/esp.h" > #include "hw/mips/bios.h" > #include "hw/loader.h" > -#include "hw/timer/mc146818rtc.h" > +#include "hw/rtc/mc146818rtc.h" > #include "hw/timer/i8254.h" > #include "hw/display/vga.h" > #include "hw/audio/pcspk.h" > diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c > index 4d9c64b36a..c1c8810e71 100644 > --- a/hw/mips/mips_malta.c > +++ b/hw/mips/mips_malta.c > @@ -45,7 +45,7 @@ > #include "hw/irq.h" > #include "hw/loader.h" > #include "elf.h" > -#include "hw/timer/mc146818rtc.h" > +#include "hw/rtc/mc146818rtc.h" > #include "hw/timer/i8254.h" > #include "exec/address-spaces.h" > #include "hw/sysbus.h" /* SysBusDevice */ > diff --git a/hw/mips/mips_r4k.c b/hw/mips/mips_r4k.c > index bc0be26544..70024235ae 100644 > --- a/hw/mips/mips_r4k.c > +++ b/hw/mips/mips_r4k.c > @@ -28,7 +28,7 @@ > #include "hw/ide.h" > #include "hw/loader.h" > #include "elf.h" > -#include "hw/timer/mc146818rtc.h" > +#include "hw/rtc/mc146818rtc.h" > #include "hw/input/i8042.h" > #include "hw/timer/i8254.h" > #include "exec/address-spaces.h" > diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c > index 3f08db7b9e..4b2649d95b 100644 > --- a/hw/ppc/pnv.c > +++ b/hw/ppc/pnv.c > @@ -48,7 +48,7 @@ > #include "hw/isa/isa.h" > #include "hw/boards.h" > #include "hw/char/serial.h" > -#include "hw/timer/mc146818rtc.h" > +#include "hw/rtc/mc146818rtc.h" > > #include <libfdt.h> > > diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c > index 4f3c6bf190..3a51536e1a 100644 > --- a/hw/ppc/prep.c > +++ b/hw/ppc/prep.c > @@ -40,7 +40,7 @@ > #include "hw/ide.h" > #include "hw/irq.h" > #include "hw/loader.h" > -#include "hw/timer/mc146818rtc.h" > +#include "hw/rtc/mc146818rtc.h" > #include "hw/isa/pc87312.h" > #include "hw/net/ne2000-isa.h" > #include "sysemu/arch_init.h" > diff --git a/hw/rtc/Kconfig b/hw/rtc/Kconfig > index 8a4383bca9..7ffd702268 100644 > --- a/hw/rtc/Kconfig > +++ b/hw/rtc/Kconfig > @@ -1,2 +1,5 @@ > config PL031 > bool > + > +config MC146818RTC > + bool > diff --git a/hw/rtc/Makefile.objs b/hw/rtc/Makefile.objs > index 3e1eb42563..3cac0d5a63 100644 > --- a/hw/rtc/Makefile.objs > +++ b/hw/rtc/Makefile.objs > @@ -1 +1,2 @@ > common-obj-$(CONFIG_PL031) += pl031.o > +obj-$(CONFIG_MC146818RTC) += mc146818rtc.o > diff --git a/hw/timer/mc146818rtc.c b/hw/rtc/mc146818rtc.c > similarity index 99% > rename from hw/timer/mc146818rtc.c > rename to hw/rtc/mc146818rtc.c > index 6cb378751b..ced15f764f 100644 > --- a/hw/timer/mc146818rtc.c > +++ b/hw/rtc/mc146818rtc.c > @@ -34,7 +34,7 @@ > #include "sysemu/replay.h" > #include "sysemu/reset.h" > #include "sysemu/runstate.h" > -#include "hw/timer/mc146818rtc.h" > +#include "hw/rtc/mc146818rtc.h" > #include "migration/vmstate.h" > #include "qapi/error.h" > #include "qapi/qapi-commands-misc-target.h" > diff --git a/hw/timer/Kconfig b/hw/timer/Kconfig > index 27c5dce09e..af415c8ef8 100644 > --- a/hw/timer/Kconfig > +++ b/hw/timer/Kconfig > @@ -35,9 +35,6 @@ config ALTERA_TIMER > bool > select PTIMER > > -config MC146818RTC > - bool > - > config ALLWINNER_A10_PIT > bool > select PTIMER > diff --git a/hw/timer/Makefile.objs b/hw/timer/Makefile.objs > index 9f64f6e11e..b0159189cf 100644 > --- a/hw/timer/Makefile.objs > +++ b/hw/timer/Makefile.objs > @@ -35,8 +35,6 @@ common-obj-$(CONFIG_SH4) += sh_timer.o > common-obj-$(CONFIG_DIGIC) += digic-timer.o > common-obj-$(CONFIG_MIPS_CPS) += mips_gictimer.o > > -obj-$(CONFIG_MC146818RTC) += mc146818rtc.o > - > common-obj-$(CONFIG_ALLWINNER_A10_PIT) += allwinner-a10-pit.o > > common-obj-$(CONFIG_STM32F2XX_TIMER) += stm32f2xx_timer.o > diff --git a/hw/timer/hpet.c b/hw/timer/hpet.c > index 1ddae4e7d7..02bf8a8ce8 100644 > --- a/hw/timer/hpet.c > +++ b/hw/timer/hpet.c > @@ -33,7 +33,7 @@ > #include "qemu/timer.h" > #include "hw/timer/hpet.h" > #include "hw/sysbus.h" > -#include "hw/timer/mc146818rtc.h" > +#include "hw/rtc/mc146818rtc.h" > #include "migration/vmstate.h" > #include "hw/timer/i8254.h" > > diff --git a/include/hw/rtc/mc146818rtc.h b/include/hw/rtc/mc146818rtc.h > new file mode 100644 > index 0000000000..888e04f9ab > --- /dev/null > +++ b/include/hw/rtc/mc146818rtc.h > @@ -0,0 +1,38 @@ > +/* > + * QEMU MC146818 RTC emulation > + * > + * Copyright (c) 2003-2004 Fabrice Bellard > + * > + * Permission is hereby granted, free of charge, to any person obtaining a copy > + * of this software and associated documentation files (the "Software"), to deal > + * in the Software without restriction, including without limitation the rights > + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell > + * copies of the Software, and to permit persons to whom the Software is > + * furnished to do so, subject to the following conditions: > + * > + * The above copyright notice and this permission notice shall be included in > + * all copies or substantial portions of the Software. > + * > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL > + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER > + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, > + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN > + * THE SOFTWARE. > + */ > + > +#ifndef MC146818RTC_H > +#define MC146818RTC_H > + > +#include "hw/isa/isa.h" > +#include "hw/rtc/mc146818rtc_regs.h" > + > +#define TYPE_MC146818_RTC "mc146818rtc" > + > +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); > + > +#endif /* MC146818RTC_H */ > diff --git a/include/hw/timer/mc146818rtc_regs.h b/include/hw/rtc/mc146818rtc_regs.h > similarity index 98% > rename from include/hw/timer/mc146818rtc_regs.h > rename to include/hw/rtc/mc146818rtc_regs.h > index bfbb57e570..c4c6305473 100644 > --- a/include/hw/timer/mc146818rtc_regs.h > +++ b/include/hw/rtc/mc146818rtc_regs.h > @@ -26,6 +26,7 @@ > #define MC146818RTC_REGS_H > > #include "qemu/timer.h" > +#include "qemu/host-utils.h" > > #define RTC_ISA_IRQ 8 > > diff --git a/include/hw/timer/mc146818rtc.h b/include/hw/timer/mc146818rtc.h > deleted file mode 100644 > index fe6ed63f71..0000000000 > --- a/include/hw/timer/mc146818rtc.h > +++ /dev/null > @@ -1,14 +0,0 @@ > -#ifndef MC146818RTC_H > -#define MC146818RTC_H > - > -#include "hw/isa/isa.h" > -#include "hw/timer/mc146818rtc_regs.h" > - > -#define TYPE_MC146818_RTC "mc146818rtc" > - > -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); > - > -#endif /* MC146818RTC_H */ > diff --git a/tests/rtc-test.c b/tests/rtc-test.c > index 6309b0ef6c..79a4ff1ed6 100644 > --- a/tests/rtc-test.c > +++ b/tests/rtc-test.c > @@ -15,7 +15,7 @@ > > #include "libqtest-single.h" > #include "qemu/timer.h" > -#include "hw/timer/mc146818rtc_regs.h" > +#include "hw/rtc/mc146818rtc_regs.h" > > #define UIP_HOLD_LENGTH (8 * NANOSECONDS_PER_SECOND / 32768) > > -- > 2.20.1 > >
On Mon, Sep 16, 2019 at 05:48:37PM +0200, Philippe Mathieu-Daudé wrote: > The MC146818 is a Real Time Clock, not a timer. > Move it under the hw/rtc/ subdirectory. > > Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> ppc parts Acked-by: David Gibson <david@gibson.dropbear.id.au> > --- > MAINTAINERS | 4 +-- > hw/alpha/dp264.c | 2 +- > hw/hppa/machine.c | 2 +- > hw/i386/acpi-build.c | 2 +- > hw/i386/pc.c | 2 +- > hw/i386/pc_q35.c | 2 +- > hw/mips/mips_fulong2e.c | 2 +- > hw/mips/mips_jazz.c | 2 +- > hw/mips/mips_malta.c | 2 +- > hw/mips/mips_r4k.c | 2 +- > hw/ppc/pnv.c | 2 +- > hw/ppc/prep.c | 2 +- > hw/rtc/Kconfig | 3 ++ > hw/rtc/Makefile.objs | 1 + > hw/{timer => rtc}/mc146818rtc.c | 2 +- > hw/timer/Kconfig | 3 -- > hw/timer/Makefile.objs | 2 -- > hw/timer/hpet.c | 2 +- > include/hw/rtc/mc146818rtc.h | 38 ++++++++++++++++++++ > include/hw/{timer => rtc}/mc146818rtc_regs.h | 1 + > include/hw/timer/mc146818rtc.h | 14 -------- > tests/rtc-test.c | 2 +- > 22 files changed, 59 insertions(+), 35 deletions(-) > rename hw/{timer => rtc}/mc146818rtc.c (99%) > create mode 100644 include/hw/rtc/mc146818rtc.h > rename include/hw/{timer => rtc}/mc146818rtc_regs.h (98%) > delete mode 100644 include/hw/timer/mc146818rtc.h > > diff --git a/MAINTAINERS b/MAINTAINERS > index 5562d2c6d0..481f2318cb 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -1263,7 +1263,7 @@ F: hw/misc/debugexit.c > F: hw/misc/pc-testdev.c > F: hw/timer/hpet* > F: hw/timer/i8254* > -F: hw/timer/mc146818rtc* > +F: hw/rtc/mc146818rtc* > F: hw/watchdog/wdt_ib700.c > F: hw/watchdog/wdt_i6300esb.c > F: include/hw/display/vga.h > @@ -1275,7 +1275,7 @@ F: include/hw/isa/i8259_internal.h > F: include/hw/isa/superio.h > F: include/hw/timer/hpet.h > F: include/hw/timer/i8254* > -F: include/hw/timer/mc146818rtc* > +F: include/hw/rtc/mc146818rtc* > > Machine core > M: Eduardo Habkost <ehabkost@redhat.com> > diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c > index 51feee8558..51b3cf7a61 100644 > --- a/hw/alpha/dp264.c > +++ b/hw/alpha/dp264.c > @@ -14,7 +14,7 @@ > #include "alpha_sys.h" > #include "qemu/error-report.h" > #include "sysemu/sysemu.h" > -#include "hw/timer/mc146818rtc.h" > +#include "hw/rtc/mc146818rtc.h" > #include "hw/ide.h" > #include "hw/timer/i8254.h" > #include "hw/isa/superio.h" > diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c > index 2736ce835e..6598e2469d 100644 > --- a/hw/hppa/machine.c > +++ b/hw/hppa/machine.c > @@ -12,7 +12,7 @@ > #include "qemu/error-report.h" > #include "sysemu/reset.h" > #include "sysemu/sysemu.h" > -#include "hw/timer/mc146818rtc.h" > +#include "hw/rtc/mc146818rtc.h" > #include "hw/ide.h" > #include "hw/timer/i8254.h" > #include "hw/char/serial.h" > diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c > index e54e571a75..44a8073507 100644 > --- a/hw/i386/acpi-build.c > +++ b/hw/i386/acpi-build.c > @@ -45,7 +45,7 @@ > #include "hw/acpi/vmgenid.h" > #include "hw/boards.h" > #include "sysemu/tpm_backend.h" > -#include "hw/timer/mc146818rtc_regs.h" > +#include "hw/rtc/mc146818rtc_regs.h" > #include "migration/vmstate.h" > #include "hw/mem/memory-device.h" > #include "sysemu/numa.h" > diff --git a/hw/i386/pc.c b/hw/i386/pc.c > index bad866fe44..beef7a992d 100644 > --- a/hw/i386/pc.c > +++ b/hw/i386/pc.c > @@ -42,7 +42,7 @@ > #include "elf.h" > #include "migration/vmstate.h" > #include "multiboot.h" > -#include "hw/timer/mc146818rtc.h" > +#include "hw/rtc/mc146818rtc.h" > #include "hw/dma/i8257.h" > #include "hw/timer/i8254.h" > #include "hw/input/i8042.h" > diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c > index d4e8a1cb9f..a976af9a2a 100644 > --- a/hw/i386/pc_q35.c > +++ b/hw/i386/pc_q35.c > @@ -33,7 +33,7 @@ > #include "hw/loader.h" > #include "sysemu/arch_init.h" > #include "hw/i2c/smbus_eeprom.h" > -#include "hw/timer/mc146818rtc.h" > +#include "hw/rtc/mc146818rtc.h" > #include "hw/xen/xen.h" > #include "sysemu/kvm.h" > #include "kvm_i386.h" > diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c > index cf537dd7e6..03a27e1767 100644 > --- a/hw/mips/mips_fulong2e.c > +++ b/hw/mips/mips_fulong2e.c > @@ -39,7 +39,7 @@ > #include "hw/ide.h" > #include "elf.h" > #include "hw/isa/vt82c686.h" > -#include "hw/timer/mc146818rtc.h" > +#include "hw/rtc/mc146818rtc.h" > #include "hw/timer/i8254.h" > #include "exec/address-spaces.h" > #include "sysemu/qtest.h" > diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c > index c967b97d80..2811a4bd90 100644 > --- a/hw/mips/mips_jazz.c > +++ b/hw/mips/mips_jazz.c > @@ -39,7 +39,7 @@ > #include "hw/scsi/esp.h" > #include "hw/mips/bios.h" > #include "hw/loader.h" > -#include "hw/timer/mc146818rtc.h" > +#include "hw/rtc/mc146818rtc.h" > #include "hw/timer/i8254.h" > #include "hw/display/vga.h" > #include "hw/audio/pcspk.h" > diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c > index 4d9c64b36a..c1c8810e71 100644 > --- a/hw/mips/mips_malta.c > +++ b/hw/mips/mips_malta.c > @@ -45,7 +45,7 @@ > #include "hw/irq.h" > #include "hw/loader.h" > #include "elf.h" > -#include "hw/timer/mc146818rtc.h" > +#include "hw/rtc/mc146818rtc.h" > #include "hw/timer/i8254.h" > #include "exec/address-spaces.h" > #include "hw/sysbus.h" /* SysBusDevice */ > diff --git a/hw/mips/mips_r4k.c b/hw/mips/mips_r4k.c > index bc0be26544..70024235ae 100644 > --- a/hw/mips/mips_r4k.c > +++ b/hw/mips/mips_r4k.c > @@ -28,7 +28,7 @@ > #include "hw/ide.h" > #include "hw/loader.h" > #include "elf.h" > -#include "hw/timer/mc146818rtc.h" > +#include "hw/rtc/mc146818rtc.h" > #include "hw/input/i8042.h" > #include "hw/timer/i8254.h" > #include "exec/address-spaces.h" > diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c > index 3f08db7b9e..4b2649d95b 100644 > --- a/hw/ppc/pnv.c > +++ b/hw/ppc/pnv.c > @@ -48,7 +48,7 @@ > #include "hw/isa/isa.h" > #include "hw/boards.h" > #include "hw/char/serial.h" > -#include "hw/timer/mc146818rtc.h" > +#include "hw/rtc/mc146818rtc.h" > > #include <libfdt.h> > > diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c > index 4f3c6bf190..3a51536e1a 100644 > --- a/hw/ppc/prep.c > +++ b/hw/ppc/prep.c > @@ -40,7 +40,7 @@ > #include "hw/ide.h" > #include "hw/irq.h" > #include "hw/loader.h" > -#include "hw/timer/mc146818rtc.h" > +#include "hw/rtc/mc146818rtc.h" > #include "hw/isa/pc87312.h" > #include "hw/net/ne2000-isa.h" > #include "sysemu/arch_init.h" > diff --git a/hw/rtc/Kconfig b/hw/rtc/Kconfig > index 8a4383bca9..7ffd702268 100644 > --- a/hw/rtc/Kconfig > +++ b/hw/rtc/Kconfig > @@ -1,2 +1,5 @@ > config PL031 > bool > + > +config MC146818RTC > + bool > diff --git a/hw/rtc/Makefile.objs b/hw/rtc/Makefile.objs > index 3e1eb42563..3cac0d5a63 100644 > --- a/hw/rtc/Makefile.objs > +++ b/hw/rtc/Makefile.objs > @@ -1 +1,2 @@ > common-obj-$(CONFIG_PL031) += pl031.o > +obj-$(CONFIG_MC146818RTC) += mc146818rtc.o > diff --git a/hw/timer/mc146818rtc.c b/hw/rtc/mc146818rtc.c > similarity index 99% > rename from hw/timer/mc146818rtc.c > rename to hw/rtc/mc146818rtc.c > index 6cb378751b..ced15f764f 100644 > --- a/hw/timer/mc146818rtc.c > +++ b/hw/rtc/mc146818rtc.c > @@ -34,7 +34,7 @@ > #include "sysemu/replay.h" > #include "sysemu/reset.h" > #include "sysemu/runstate.h" > -#include "hw/timer/mc146818rtc.h" > +#include "hw/rtc/mc146818rtc.h" > #include "migration/vmstate.h" > #include "qapi/error.h" > #include "qapi/qapi-commands-misc-target.h" > diff --git a/hw/timer/Kconfig b/hw/timer/Kconfig > index 27c5dce09e..af415c8ef8 100644 > --- a/hw/timer/Kconfig > +++ b/hw/timer/Kconfig > @@ -35,9 +35,6 @@ config ALTERA_TIMER > bool > select PTIMER > > -config MC146818RTC > - bool > - > config ALLWINNER_A10_PIT > bool > select PTIMER > diff --git a/hw/timer/Makefile.objs b/hw/timer/Makefile.objs > index 9f64f6e11e..b0159189cf 100644 > --- a/hw/timer/Makefile.objs > +++ b/hw/timer/Makefile.objs > @@ -35,8 +35,6 @@ common-obj-$(CONFIG_SH4) += sh_timer.o > common-obj-$(CONFIG_DIGIC) += digic-timer.o > common-obj-$(CONFIG_MIPS_CPS) += mips_gictimer.o > > -obj-$(CONFIG_MC146818RTC) += mc146818rtc.o > - > common-obj-$(CONFIG_ALLWINNER_A10_PIT) += allwinner-a10-pit.o > > common-obj-$(CONFIG_STM32F2XX_TIMER) += stm32f2xx_timer.o > diff --git a/hw/timer/hpet.c b/hw/timer/hpet.c > index 1ddae4e7d7..02bf8a8ce8 100644 > --- a/hw/timer/hpet.c > +++ b/hw/timer/hpet.c > @@ -33,7 +33,7 @@ > #include "qemu/timer.h" > #include "hw/timer/hpet.h" > #include "hw/sysbus.h" > -#include "hw/timer/mc146818rtc.h" > +#include "hw/rtc/mc146818rtc.h" > #include "migration/vmstate.h" > #include "hw/timer/i8254.h" > > diff --git a/include/hw/rtc/mc146818rtc.h b/include/hw/rtc/mc146818rtc.h > new file mode 100644 > index 0000000000..888e04f9ab > --- /dev/null > +++ b/include/hw/rtc/mc146818rtc.h > @@ -0,0 +1,38 @@ > +/* > + * QEMU MC146818 RTC emulation > + * > + * Copyright (c) 2003-2004 Fabrice Bellard > + * > + * Permission is hereby granted, free of charge, to any person obtaining a copy > + * of this software and associated documentation files (the "Software"), to deal > + * in the Software without restriction, including without limitation the rights > + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell > + * copies of the Software, and to permit persons to whom the Software is > + * furnished to do so, subject to the following conditions: > + * > + * The above copyright notice and this permission notice shall be included in > + * all copies or substantial portions of the Software. > + * > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL > + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER > + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, > + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN > + * THE SOFTWARE. > + */ > + > +#ifndef MC146818RTC_H > +#define MC146818RTC_H > + > +#include "hw/isa/isa.h" > +#include "hw/rtc/mc146818rtc_regs.h" > + > +#define TYPE_MC146818_RTC "mc146818rtc" > + > +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); > + > +#endif /* MC146818RTC_H */ > diff --git a/include/hw/timer/mc146818rtc_regs.h b/include/hw/rtc/mc146818rtc_regs.h > similarity index 98% > rename from include/hw/timer/mc146818rtc_regs.h > rename to include/hw/rtc/mc146818rtc_regs.h > index bfbb57e570..c4c6305473 100644 > --- a/include/hw/timer/mc146818rtc_regs.h > +++ b/include/hw/rtc/mc146818rtc_regs.h > @@ -26,6 +26,7 @@ > #define MC146818RTC_REGS_H > > #include "qemu/timer.h" > +#include "qemu/host-utils.h" > > #define RTC_ISA_IRQ 8 > > diff --git a/include/hw/timer/mc146818rtc.h b/include/hw/timer/mc146818rtc.h > deleted file mode 100644 > index fe6ed63f71..0000000000 > --- a/include/hw/timer/mc146818rtc.h > +++ /dev/null > @@ -1,14 +0,0 @@ > -#ifndef MC146818RTC_H > -#define MC146818RTC_H > - > -#include "hw/isa/isa.h" > -#include "hw/timer/mc146818rtc_regs.h" > - > -#define TYPE_MC146818_RTC "mc146818rtc" > - > -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); > - > -#endif /* MC146818RTC_H */ > diff --git a/tests/rtc-test.c b/tests/rtc-test.c > index 6309b0ef6c..79a4ff1ed6 100644 > --- a/tests/rtc-test.c > +++ b/tests/rtc-test.c > @@ -15,7 +15,7 @@ > > #include "libqtest-single.h" > #include "qemu/timer.h" > -#include "hw/timer/mc146818rtc_regs.h" > +#include "hw/rtc/mc146818rtc_regs.h" > > #define UIP_HOLD_LENGTH (8 * NANOSECONDS_PER_SECOND / 32768) >
On 16/09/2019 17.48, Philippe Mathieu-Daudé wrote: > The MC146818 is a Real Time Clock, not a timer. > Move it under the hw/rtc/ subdirectory. > > Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> [...] > diff --git a/include/hw/rtc/mc146818rtc.h b/include/hw/rtc/mc146818rtc.h > new file mode 100644 > index 0000000000..888e04f9ab > --- /dev/null > +++ b/include/hw/rtc/mc146818rtc.h > @@ -0,0 +1,38 @@ > +/* > + * QEMU MC146818 RTC emulation > + * > + * Copyright (c) 2003-2004 Fabrice Bellard > + * > + * Permission is hereby granted, free of charge, to any person obtaining a copy > + * of this software and associated documentation files (the "Software"), to deal > + * in the Software without restriction, including without limitation the rights > + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell > + * copies of the Software, and to permit persons to whom the Software is > + * furnished to do so, subject to the following conditions: > + * > + * The above copyright notice and this permission notice shall be included in > + * all copies or substantial portions of the Software. > + * > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL > + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER > + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, > + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN > + * THE SOFTWARE. > + */ If you run "git blame" on the old header file, it does not seem like Fabrice wrote this header, so I'm not sure whether it makes sense to add his (c) statement here? Maybe rather use a one-line "SPDX-License-Identifier: GPL-2.0-or-later" here? Thomas
On 9/17/19 7:07 AM, Thomas Huth wrote: > On 16/09/2019 17.48, Philippe Mathieu-Daudé wrote: >> The MC146818 is a Real Time Clock, not a timer. >> Move it under the hw/rtc/ subdirectory. >> >> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> > [...] >> diff --git a/include/hw/rtc/mc146818rtc.h b/include/hw/rtc/mc146818rtc.h >> new file mode 100644 >> index 0000000000..888e04f9ab >> --- /dev/null >> +++ b/include/hw/rtc/mc146818rtc.h >> @@ -0,0 +1,38 @@ >> +/* >> + * QEMU MC146818 RTC emulation >> + * >> + * Copyright (c) 2003-2004 Fabrice Bellard >> + * >> + * Permission is hereby granted, free of charge, to any person obtaining a copy >> + * of this software and associated documentation files (the "Software"), to deal >> + * in the Software without restriction, including without limitation the rights >> + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell >> + * copies of the Software, and to permit persons to whom the Software is >> + * furnished to do so, subject to the following conditions: >> + * >> + * The above copyright notice and this permission notice shall be included in >> + * all copies or substantial portions of the Software. >> + * >> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR >> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, >> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL >> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER >> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, >> + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN >> + * THE SOFTWARE. >> + */ > > If you run "git blame" on the old header file, it does not seem like > Fabrice wrote this header, so I'm not sure whether it makes sense to add > his (c) statement here? > > Maybe rather use a one-line "SPDX-License-Identifier: GPL-2.0-or-later" > here? It was first added by Fabrice here: $ git show 80cabfad163 [...] > diff --git a/hw/mc146818rtc.c b/hw/mc146818rtc.c new file mode 100644 index 0000000000..cab76cfab2 --- /dev/null +++ b/hw/mc146818rtc.c @@ -0,0 +1,203 @@ +/* + * QEMU MC146818 RTC emulation + * + * Copyright (c) 2003-2004 Fabrice Bellard + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */[...] diff --git a/vl.h b/vl.h index 35962d1985..026a5dee5a 100644 --- a/vl.h +++ b/vl.h +/* mc146818rtc.c */ + +typedef struct RTCState { + uint8_t cmos_data[128]; + uint8_t cmos_index; + int irq; +} RTCState; + +extern RTCState rtc_state; + +void rtc_init(int base, int irq); +void rtc_timer(void); Then moved from vl.h to pc.h: $ git show 87ecb68bdf8 commit 87ecb68bdf8a3e40ef885ddbb7ca1797dca40ebf Author: pbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162> Date: Sat Nov 17 17:14:51 2007 +0000 Break up vl.h. Then moved from pc.h to mc146818rtc.h without adding the (c): $ git show e1460e4707c commit e1460e4707cd80982add597f5cb421289db84e4e Author: Isaku Yamahata <yamahata@valinux.co.jp> Date: Fri May 14 16:29:16 2010 +0900 pc: move rtc declarations from pc.h into a dedicated header file. Move rtc_xxx declarations from pc.h into mc146818rtc.h. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com> diff --git a/hw/mc146818rtc.h b/hw/mc146818rtc.h new file mode 100644 index 0000000000..7211dae37e --- /dev/null +++ b/hw/mc146818rtc.h @@ -0,0 +1,10 @@ +#ifndef MC146818RTC_H +#define MC146818RTC_H + +typedef struct RTCState RTCState; + +RTCState *rtc_init(int base_year); +void rtc_set_memory(RTCState *s, int addr, int val); +void rtc_set_date(RTCState *s, const struct tm *tm); + +#endif /* !MC146818RTC_H */ diff --git a/hw/pc.h b/hw/pc.h index 8cfec6c0dc..e3cc0a58bd 100644 --- a/hw/pc.h +++ b/hw/pc.h @@ -5,6 +5,7 @@ #include "ioport.h" #include "isa.h" #include "fdc.h" +#include "mc146818rtc.h" /* PC-style peripherals (also used by other machines). */ @@ -76,14 +77,6 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, target_phys_addr_t base, ram_addr_t size, target_phys_addr_t mask); -/* mc146818rtc.c */ - -typedef struct RTCState RTCState; - -RTCState *rtc_init(int base_year); -void rtc_set_memory(RTCState *s, int addr, int val); -void rtc_set_date(RTCState *s, const struct tm *tm); So the (c) looks correct to me. Do you still disagree?
On 9/16/19 11:48 AM, Philippe Mathieu-Daudé wrote:
> include/hw/rtc/mc146818rtc.h | 38 ++++++++++++++++++++
Same rebase failure as for patch 4?
r~
On 17/09/2019 12.03, Philippe Mathieu-Daudé wrote: > On 9/17/19 7:07 AM, Thomas Huth wrote: >> On 16/09/2019 17.48, Philippe Mathieu-Daudé wrote: >>> The MC146818 is a Real Time Clock, not a timer. >>> Move it under the hw/rtc/ subdirectory. >>> >>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> >> [...] >>> diff --git a/include/hw/rtc/mc146818rtc.h b/include/hw/rtc/mc146818rtc.h >>> new file mode 100644 >>> index 0000000000..888e04f9ab >>> --- /dev/null >>> +++ b/include/hw/rtc/mc146818rtc.h >>> @@ -0,0 +1,38 @@ >>> +/* >>> + * QEMU MC146818 RTC emulation >>> + * >>> + * Copyright (c) 2003-2004 Fabrice Bellard >>> + * >>> + * Permission is hereby granted, free of charge, to any person obtaining a copy >>> + * of this software and associated documentation files (the "Software"), to deal >>> + * in the Software without restriction, including without limitation the rights >>> + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell >>> + * copies of the Software, and to permit persons to whom the Software is >>> + * furnished to do so, subject to the following conditions: >>> + * >>> + * The above copyright notice and this permission notice shall be included in >>> + * all copies or substantial portions of the Software. >>> + * >>> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR >>> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, >>> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL >>> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER >>> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, >>> + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN >>> + * THE SOFTWARE. >>> + */ >> >> If you run "git blame" on the old header file, it does not seem like >> Fabrice wrote this header, so I'm not sure whether it makes sense to add >> his (c) statement here? >> >> Maybe rather use a one-line "SPDX-License-Identifier: GPL-2.0-or-later" >> here? > > It was first added by Fabrice here: > > $ git show 80cabfad163 [...] > diff --git a/vl.h b/vl.h > index 35962d1985..026a5dee5a 100644 > --- a/vl.h > +++ b/vl.h > +/* mc146818rtc.c */ > + > +typedef struct RTCState { > + uint8_t cmos_data[128]; > + uint8_t cmos_index; > + int irq; > +} RTCState; > + > +extern RTCState rtc_state; > + > +void rtc_init(int base, int irq); > +void rtc_timer(void); Ok, fair. But vl.h had a slightly different copyright statement than vl.c, so I think you should rather use the one from vl.h. But IMHO you could at least drop the "THE SOFTWARE IS PROVIDED ..." paragraph and add a SPDX tag instead? Thomas
On 9/17/19 10:32 PM, Richard Henderson wrote: > On 9/16/19 11:48 AM, Philippe Mathieu-Daudé wrote: >> include/hw/rtc/mc146818rtc.h | 38 ++++++++++++++++++++ > > Same rebase failure as for patch 4? This one is actually correct, it got moved from: include/hw/timer/mc146818rtc.h | 14 -------- The difference is the addition of missing copyright/license.
On 9/18/19 9:43 AM, Thomas Huth wrote: > On 17/09/2019 12.03, Philippe Mathieu-Daudé wrote: >> On 9/17/19 7:07 AM, Thomas Huth wrote: >>> On 16/09/2019 17.48, Philippe Mathieu-Daudé wrote: >>>> The MC146818 is a Real Time Clock, not a timer. >>>> Move it under the hw/rtc/ subdirectory. >>>> >>>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> >>> [...] >>>> diff --git a/include/hw/rtc/mc146818rtc.h b/include/hw/rtc/mc146818rtc.h >>>> new file mode 100644 >>>> index 0000000000..888e04f9ab >>>> --- /dev/null >>>> +++ b/include/hw/rtc/mc146818rtc.h >>>> @@ -0,0 +1,38 @@ >>>> +/* >>>> + * QEMU MC146818 RTC emulation >>>> + * >>>> + * Copyright (c) 2003-2004 Fabrice Bellard >>>> + * >>>> + * Permission is hereby granted, free of charge, to any person obtaining a copy >>>> + * of this software and associated documentation files (the "Software"), to deal >>>> + * in the Software without restriction, including without limitation the rights >>>> + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell >>>> + * copies of the Software, and to permit persons to whom the Software is >>>> + * furnished to do so, subject to the following conditions: >>>> + * >>>> + * The above copyright notice and this permission notice shall be included in >>>> + * all copies or substantial portions of the Software. >>>> + * >>>> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR >>>> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, >>>> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL >>>> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER >>>> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, >>>> + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN >>>> + * THE SOFTWARE. >>>> + */ >>> >>> If you run "git blame" on the old header file, it does not seem like >>> Fabrice wrote this header, so I'm not sure whether it makes sense to add >>> his (c) statement here? >>> >>> Maybe rather use a one-line "SPDX-License-Identifier: GPL-2.0-or-later" >>> here? >> >> It was first added by Fabrice here: >> >> $ git show 80cabfad163 > [...] >> diff --git a/vl.h b/vl.h >> index 35962d1985..026a5dee5a 100644 >> --- a/vl.h >> +++ b/vl.h >> +/* mc146818rtc.c */ >> + >> +typedef struct RTCState { >> + uint8_t cmos_data[128]; >> + uint8_t cmos_index; >> + int irq; >> +} RTCState; >> + >> +extern RTCState rtc_state; >> + >> +void rtc_init(int base, int irq); >> +void rtc_timer(void); > > Ok, fair. But vl.h had a slightly different copyright statement than > vl.c, so I think you should rather use the one from vl.h. > But IMHO you could at least drop the "THE SOFTWARE IS PROVIDED ..." > paragraph and add a SPDX tag instead? I find SPDX tags clearer too, but last time I wanted to use them Peter said: I think we should not do that until/unless somebody (probably a corporate somebody) steps forward to make the argument for "this is why we should have them, we as a contributor to the project think they are worthwhile and a useful feature for us, and we will make the effort to add them, review that they are correct, update checkpatch to insist on tags for new files, etc". In other words, "if it ain't broke, don't fix it"; nobody is yet complaining that our current setup is broken. https://lists.gnu.org/archive/html/qemu-devel/2018-11/msg04151.html At this time we had less: $ git grep SPDX v3.1.0 | egrep -v linux-headers | wc -l 21 Since we few entered, so we have a mix: $ git grep SPDX origin/master | egrep -v linux-headers | wc -l 79
diff --git a/MAINTAINERS b/MAINTAINERS index 5562d2c6d0..481f2318cb 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1263,7 +1263,7 @@ F: hw/misc/debugexit.c F: hw/misc/pc-testdev.c F: hw/timer/hpet* F: hw/timer/i8254* -F: hw/timer/mc146818rtc* +F: hw/rtc/mc146818rtc* F: hw/watchdog/wdt_ib700.c F: hw/watchdog/wdt_i6300esb.c F: include/hw/display/vga.h @@ -1275,7 +1275,7 @@ F: include/hw/isa/i8259_internal.h F: include/hw/isa/superio.h F: include/hw/timer/hpet.h F: include/hw/timer/i8254* -F: include/hw/timer/mc146818rtc* +F: include/hw/rtc/mc146818rtc* Machine core M: Eduardo Habkost <ehabkost@redhat.com> diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c index 51feee8558..51b3cf7a61 100644 --- a/hw/alpha/dp264.c +++ b/hw/alpha/dp264.c @@ -14,7 +14,7 @@ #include "alpha_sys.h" #include "qemu/error-report.h" #include "sysemu/sysemu.h" -#include "hw/timer/mc146818rtc.h" +#include "hw/rtc/mc146818rtc.h" #include "hw/ide.h" #include "hw/timer/i8254.h" #include "hw/isa/superio.h" diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c index 2736ce835e..6598e2469d 100644 --- a/hw/hppa/machine.c +++ b/hw/hppa/machine.c @@ -12,7 +12,7 @@ #include "qemu/error-report.h" #include "sysemu/reset.h" #include "sysemu/sysemu.h" -#include "hw/timer/mc146818rtc.h" +#include "hw/rtc/mc146818rtc.h" #include "hw/ide.h" #include "hw/timer/i8254.h" #include "hw/char/serial.h" diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index e54e571a75..44a8073507 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -45,7 +45,7 @@ #include "hw/acpi/vmgenid.h" #include "hw/boards.h" #include "sysemu/tpm_backend.h" -#include "hw/timer/mc146818rtc_regs.h" +#include "hw/rtc/mc146818rtc_regs.h" #include "migration/vmstate.h" #include "hw/mem/memory-device.h" #include "sysemu/numa.h" diff --git a/hw/i386/pc.c b/hw/i386/pc.c index bad866fe44..beef7a992d 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -42,7 +42,7 @@ #include "elf.h" #include "migration/vmstate.h" #include "multiboot.h" -#include "hw/timer/mc146818rtc.h" +#include "hw/rtc/mc146818rtc.h" #include "hw/dma/i8257.h" #include "hw/timer/i8254.h" #include "hw/input/i8042.h" diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index d4e8a1cb9f..a976af9a2a 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -33,7 +33,7 @@ #include "hw/loader.h" #include "sysemu/arch_init.h" #include "hw/i2c/smbus_eeprom.h" -#include "hw/timer/mc146818rtc.h" +#include "hw/rtc/mc146818rtc.h" #include "hw/xen/xen.h" #include "sysemu/kvm.h" #include "kvm_i386.h" diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c index cf537dd7e6..03a27e1767 100644 --- a/hw/mips/mips_fulong2e.c +++ b/hw/mips/mips_fulong2e.c @@ -39,7 +39,7 @@ #include "hw/ide.h" #include "elf.h" #include "hw/isa/vt82c686.h" -#include "hw/timer/mc146818rtc.h" +#include "hw/rtc/mc146818rtc.h" #include "hw/timer/i8254.h" #include "exec/address-spaces.h" #include "sysemu/qtest.h" diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c index c967b97d80..2811a4bd90 100644 --- a/hw/mips/mips_jazz.c +++ b/hw/mips/mips_jazz.c @@ -39,7 +39,7 @@ #include "hw/scsi/esp.h" #include "hw/mips/bios.h" #include "hw/loader.h" -#include "hw/timer/mc146818rtc.h" +#include "hw/rtc/mc146818rtc.h" #include "hw/timer/i8254.h" #include "hw/display/vga.h" #include "hw/audio/pcspk.h" diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index 4d9c64b36a..c1c8810e71 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -45,7 +45,7 @@ #include "hw/irq.h" #include "hw/loader.h" #include "elf.h" -#include "hw/timer/mc146818rtc.h" +#include "hw/rtc/mc146818rtc.h" #include "hw/timer/i8254.h" #include "exec/address-spaces.h" #include "hw/sysbus.h" /* SysBusDevice */ diff --git a/hw/mips/mips_r4k.c b/hw/mips/mips_r4k.c index bc0be26544..70024235ae 100644 --- a/hw/mips/mips_r4k.c +++ b/hw/mips/mips_r4k.c @@ -28,7 +28,7 @@ #include "hw/ide.h" #include "hw/loader.h" #include "elf.h" -#include "hw/timer/mc146818rtc.h" +#include "hw/rtc/mc146818rtc.h" #include "hw/input/i8042.h" #include "hw/timer/i8254.h" #include "exec/address-spaces.h" diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 3f08db7b9e..4b2649d95b 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -48,7 +48,7 @@ #include "hw/isa/isa.h" #include "hw/boards.h" #include "hw/char/serial.h" -#include "hw/timer/mc146818rtc.h" +#include "hw/rtc/mc146818rtc.h" #include <libfdt.h> diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c index 4f3c6bf190..3a51536e1a 100644 --- a/hw/ppc/prep.c +++ b/hw/ppc/prep.c @@ -40,7 +40,7 @@ #include "hw/ide.h" #include "hw/irq.h" #include "hw/loader.h" -#include "hw/timer/mc146818rtc.h" +#include "hw/rtc/mc146818rtc.h" #include "hw/isa/pc87312.h" #include "hw/net/ne2000-isa.h" #include "sysemu/arch_init.h" diff --git a/hw/rtc/Kconfig b/hw/rtc/Kconfig index 8a4383bca9..7ffd702268 100644 --- a/hw/rtc/Kconfig +++ b/hw/rtc/Kconfig @@ -1,2 +1,5 @@ config PL031 bool + +config MC146818RTC + bool diff --git a/hw/rtc/Makefile.objs b/hw/rtc/Makefile.objs index 3e1eb42563..3cac0d5a63 100644 --- a/hw/rtc/Makefile.objs +++ b/hw/rtc/Makefile.objs @@ -1 +1,2 @@ common-obj-$(CONFIG_PL031) += pl031.o +obj-$(CONFIG_MC146818RTC) += mc146818rtc.o diff --git a/hw/timer/mc146818rtc.c b/hw/rtc/mc146818rtc.c similarity index 99% rename from hw/timer/mc146818rtc.c rename to hw/rtc/mc146818rtc.c index 6cb378751b..ced15f764f 100644 --- a/hw/timer/mc146818rtc.c +++ b/hw/rtc/mc146818rtc.c @@ -34,7 +34,7 @@ #include "sysemu/replay.h" #include "sysemu/reset.h" #include "sysemu/runstate.h" -#include "hw/timer/mc146818rtc.h" +#include "hw/rtc/mc146818rtc.h" #include "migration/vmstate.h" #include "qapi/error.h" #include "qapi/qapi-commands-misc-target.h" diff --git a/hw/timer/Kconfig b/hw/timer/Kconfig index 27c5dce09e..af415c8ef8 100644 --- a/hw/timer/Kconfig +++ b/hw/timer/Kconfig @@ -35,9 +35,6 @@ config ALTERA_TIMER bool select PTIMER -config MC146818RTC - bool - config ALLWINNER_A10_PIT bool select PTIMER diff --git a/hw/timer/Makefile.objs b/hw/timer/Makefile.objs index 9f64f6e11e..b0159189cf 100644 --- a/hw/timer/Makefile.objs +++ b/hw/timer/Makefile.objs @@ -35,8 +35,6 @@ common-obj-$(CONFIG_SH4) += sh_timer.o common-obj-$(CONFIG_DIGIC) += digic-timer.o common-obj-$(CONFIG_MIPS_CPS) += mips_gictimer.o -obj-$(CONFIG_MC146818RTC) += mc146818rtc.o - common-obj-$(CONFIG_ALLWINNER_A10_PIT) += allwinner-a10-pit.o common-obj-$(CONFIG_STM32F2XX_TIMER) += stm32f2xx_timer.o diff --git a/hw/timer/hpet.c b/hw/timer/hpet.c index 1ddae4e7d7..02bf8a8ce8 100644 --- a/hw/timer/hpet.c +++ b/hw/timer/hpet.c @@ -33,7 +33,7 @@ #include "qemu/timer.h" #include "hw/timer/hpet.h" #include "hw/sysbus.h" -#include "hw/timer/mc146818rtc.h" +#include "hw/rtc/mc146818rtc.h" #include "migration/vmstate.h" #include "hw/timer/i8254.h" diff --git a/include/hw/rtc/mc146818rtc.h b/include/hw/rtc/mc146818rtc.h new file mode 100644 index 0000000000..888e04f9ab --- /dev/null +++ b/include/hw/rtc/mc146818rtc.h @@ -0,0 +1,38 @@ +/* + * QEMU MC146818 RTC emulation + * + * Copyright (c) 2003-2004 Fabrice Bellard + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MC146818RTC_H +#define MC146818RTC_H + +#include "hw/isa/isa.h" +#include "hw/rtc/mc146818rtc_regs.h" + +#define TYPE_MC146818_RTC "mc146818rtc" + +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); + +#endif /* MC146818RTC_H */ diff --git a/include/hw/timer/mc146818rtc_regs.h b/include/hw/rtc/mc146818rtc_regs.h similarity index 98% rename from include/hw/timer/mc146818rtc_regs.h rename to include/hw/rtc/mc146818rtc_regs.h index bfbb57e570..c4c6305473 100644 --- a/include/hw/timer/mc146818rtc_regs.h +++ b/include/hw/rtc/mc146818rtc_regs.h @@ -26,6 +26,7 @@ #define MC146818RTC_REGS_H #include "qemu/timer.h" +#include "qemu/host-utils.h" #define RTC_ISA_IRQ 8 diff --git a/include/hw/timer/mc146818rtc.h b/include/hw/timer/mc146818rtc.h deleted file mode 100644 index fe6ed63f71..0000000000 --- a/include/hw/timer/mc146818rtc.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef MC146818RTC_H -#define MC146818RTC_H - -#include "hw/isa/isa.h" -#include "hw/timer/mc146818rtc_regs.h" - -#define TYPE_MC146818_RTC "mc146818rtc" - -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); - -#endif /* MC146818RTC_H */ diff --git a/tests/rtc-test.c b/tests/rtc-test.c index 6309b0ef6c..79a4ff1ed6 100644 --- a/tests/rtc-test.c +++ b/tests/rtc-test.c @@ -15,7 +15,7 @@ #include "libqtest-single.h" #include "qemu/timer.h" -#include "hw/timer/mc146818rtc_regs.h" +#include "hw/rtc/mc146818rtc_regs.h" #define UIP_HOLD_LENGTH (8 * NANOSECONDS_PER_SECOND / 32768)
The MC146818 is a Real Time Clock, not a timer. Move it under the hw/rtc/ subdirectory. Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> --- MAINTAINERS | 4 +-- hw/alpha/dp264.c | 2 +- hw/hppa/machine.c | 2 +- hw/i386/acpi-build.c | 2 +- hw/i386/pc.c | 2 +- hw/i386/pc_q35.c | 2 +- hw/mips/mips_fulong2e.c | 2 +- hw/mips/mips_jazz.c | 2 +- hw/mips/mips_malta.c | 2 +- hw/mips/mips_r4k.c | 2 +- hw/ppc/pnv.c | 2 +- hw/ppc/prep.c | 2 +- hw/rtc/Kconfig | 3 ++ hw/rtc/Makefile.objs | 1 + hw/{timer => rtc}/mc146818rtc.c | 2 +- hw/timer/Kconfig | 3 -- hw/timer/Makefile.objs | 2 -- hw/timer/hpet.c | 2 +- include/hw/rtc/mc146818rtc.h | 38 ++++++++++++++++++++ include/hw/{timer => rtc}/mc146818rtc_regs.h | 1 + include/hw/timer/mc146818rtc.h | 14 -------- tests/rtc-test.c | 2 +- 22 files changed, 59 insertions(+), 35 deletions(-) rename hw/{timer => rtc}/mc146818rtc.c (99%) create mode 100644 include/hw/rtc/mc146818rtc.h rename include/hw/{timer => rtc}/mc146818rtc_regs.h (98%) delete mode 100644 include/hw/timer/mc146818rtc.h