Cleanup patches, mostly PC-related
v3 cover Cleanup patches, mostly PC-related
This series mostly contains PC-related patches I came up with when doing "virtual retrocomputing" with my via-apollo-pro-133t branch [1]. It includes improved tracing and reduced usage of cpu_get_current_apic(). The remaining patch resolves duplicate code in the test of DS1338 RTC which is used in e500 machines.
v3:
* Don't remove cpu_get_current_apic() since it is needed in apic_mem_{read,write} (the local APIC memory regions aren't per CPU)
v2:
* Remove some redundant APIC_COMMON(cpu->apic_state) casts
* Resolve cpu_get_current_apic()
Testing done:
* make check
* Work with recent x86_64 Linux distribution running on WHPX
[1] https://github.com/shentok/qemu/tree/via-apollo-pro-133t
Bernhard Beschow (10):
hw/timer/i8254: Add I/O trace events hw/audio/pcspk: Add I/O trace events hw/rtc/mc146818rtc: Convert CMOS_DPRINTF() into trace events hw/rtc/mc146818rtc: Use ARRAY_SIZE macro hw/rtc/mc146818rtc: Assert correct usage of
mc146818rtc_set_cmos_data()
hw/ide/ide-internal: Move dma_buf_commit() into ide "namespace" hw/i386/apic: Prefer APICCommonState over DeviceState hw/i386/apic: Ensure own APIC use in apic_msr_{read,write} hw/intc/apic: Pass APICCommonState to apic_register_{read,write} tests/qtest/ds1338-test: Reuse from_bcd()
hw/ide/ide-internal.h | 2 +- include/hw/i386/apic.h | 37 ++++---- include/hw/i386/apic_internal.h | 7 +- target/i386/cpu.h | 4 +- target/i386/kvm/kvm_i386.h | 2 +- target/i386/whpx/whpx-internal.h | 2 +- hw/audio/pcspk.c | 10 ++- hw/i386/kvm/apic.c | 3 +- hw/i386/vapic.c | 2 +- hw/i386/x86-cpu.c | 2 +- hw/ide/ahci.c | 8 +- hw/ide/core.c | 10 +-- hw/intc/apic.c | 126 ++++++++++----------------- hw/intc/apic_common.c | 56 ++++-------- hw/rtc/mc146818rtc.c | 20 ++--- hw/timer/i8254.c | 6 ++ target/i386/cpu-apic.c | 18 ++-- target/i386/cpu-dump.c | 2 +- target/i386/cpu.c | 2 +- target/i386/hvf/hvf.c | 4 +- target/i386/kvm/kvm.c | 2 +- target/i386/tcg/system/misc_helper.c | 4 +- target/i386/whpx/whpx-apic.c | 3 +- tests/qtest/ds1338-test.c | 12 +-- hw/audio/trace-events | 4 + hw/rtc/trace-events | 4 + hw/timer/trace-events | 4 + 27 files changed, 158 insertions(+), 198 deletions(-)
Signature · 1 line
2.51.1.dirty
PATCH v3 1/10 hw/timer/i8254: Add I/O trace events
Allows to see how the guest interacts with the device.
--- hw/timer/i8254.c | 6 ++++++ hw/timer/trace-events | 4 ++++ 2 files changed, 10 insertions(+)
hw/timer/i8254.c +6 -0
@@ -29,6 +29,7 @@#include "hw/timer/i8254.h" #include "hw/timer/i8254_internal.h" #include "qom/object.h" +#include "trace.h" //#define DEBUG_PIT
@@ -130,6 +131,8 @@ static void pit_ioport_write(void *opaque, hwaddr addr,int channel, access;PITChannelState *s; +trace_pit_ioport_write (addr, val); + addr &=3 ;if (addr ==3 ) { channel = val >>6 ;
@@ -248,6 +251,9 @@ static uint64_t pit_ioport_read(void *opaque, hwaddr addr,break ; } } + +trace_pit_ioport_read (addr, ret); +return ret; }
hw/timer/trace-events +4 -0
@@ -49,6 +49,10 @@ cmsdk_apb_dualtimer_read(uint64_t offset, uint64_t data, unsigned size) "CMSDK A cmsdk_apb_dualtimer_write(uint64_t offset, uint64_t data, unsigned size) "CMSDK APB dualtimer write: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u" cmsdk_apb_dualtimer_reset(void) "CMSDK APB dualtimer: reset" +# i8254.c +pit_ioport_read(uint8_t addr, uint32_t value) "[0x%" PRIx8 "] -> 0x%" PRIx32 +pit_ioport_write(uint8_t addr, uint32_t value) "[0x%" PRIx8 "] <- 0x%" PRIx32 + # imx_gpt.c imx_gpt_set_freq(uint32_t clksrc, uint32_t freq) "Setting clksrc %u to %u Hz" imx_gpt_read(const char *name, uint64_t value) "%s -> 0x%08" PRIx64
Signature · 1 line
2.51.1.dirty
Re: [PATCH v3 01/10] hw/timer/i8254: Add I/O trace events
Quoted 7 lines · Bernhard Beschow
Allows to see how the guest interacts with the device.
Signed-off-by Bernhard Beschow <[email protected]>--- hw/timer/i8254.c | 6 ++++++ hw/timer/trace-events | 4 ++++ 2 files changed, 10 insertions(+)
PATCH v3 2/10 hw/audio/pcspk: Add I/O trace events
In reply to Bernhard BeschowAllows to see how the guest interacts with the device.
--- hw/audio/pcspk.c | 10 +++++++++- hw/audio/trace-events | 4 ++++ 2 files changed, 13 insertions(+), 1 deletion(-)
hw/audio/pcspk.c +9 -1
@@ -34,6 +34,7 @@#include "hw/audio/pcspk.h" #include "qapi/error.h" #include "qom/object.h" +#include "trace.h" #define PCSPK_BUF_LEN 1792#define PCSPK_SAMPLE_RATE 32000
@@ -137,13 +138,18 @@ static uint64_t pcspk_io_read(void *opaque, hwaddr addr, {PCSpkState *s = opaque;PITChannelInfo ch; +uint8_t val;pit_get_channel_info (s->pit,2 , &ch); s->dummy_refresh_clock ^= (1 <<4 ); -return ch.gate | (s->data_on <<1 ) | s->dummy_refresh_clock | + val = ch.gate | (s->data_on <<1 ) | s->dummy_refresh_clock | (ch.out <<5 ); + +trace_pcspk_io_read (s->iobase, val); + +return val; } static void pcspk_io_write(void *opaque, hwaddr addr, uint64_t val,
@@ -152,6 +158,8 @@ static void pcspk_io_write(void *opaque, hwaddr addr, uint64_t val,PCSpkState *s = opaque;const int gate = val &1 ; +trace_pcspk_io_write (s->iobase, val); + s->data_on = (val >>1 ) &1 ;pit_set_gate (s->pit,2 , gate);if (s->voice) {
hw/audio/trace-events +4 -0
@@ -23,6 +23,10 @@ hda_audio_format(const char *stream, int chan, const char *fmt, int freq) "st %s hda_audio_adjust(const char *stream, int pos) "st %s, pos %d" hda_audio_overrun(const char *stream) "st %s" +# pcspk.c +pcspk_io_read(uint16_t addr, uint8_t val) "[0x%"PRIx16"] -> 0x%"PRIx8 +pcspk_io_write(uint16_t addr, uint8_t val) "[0x%"PRIx16"] <- 0x%"PRIx8 + #via-ac97.c via_ac97_codec_write(uint8_t addr, uint16_t val) "0x%x <- 0x%x" via_ac97_sgd_fetch(uint32_t curr, uint32_t addr, char stop, char eol, char flag, uint32_t len) "curr=0x%x addr=0x%x %c%c%c len=%d"
Signature · 1 line
2.51.1.dirty
Re: [PATCH v3 02/10] hw/audio/pcspk: Add I/O trace events
Quoted 7 lines · Bernhard Beschow
Allows to see how the guest interacts with the device.
Signed-off-by Bernhard Beschow <[email protected]>--- hw/audio/pcspk.c | 10 +++++++++- hw/audio/trace-events | 4 ++++ 2 files changed, 13 insertions(+), 1 deletion(-)
PATCH v3 3/10 hw/rtc/mc146818rtc: Convert CMOS_DPRINTF() into trace events
In reply to Bernhard Beschow--- hw/rtc/mc146818rtc.c | 14 +++----------- hw/rtc/trace-events | 4 ++++ 2 files changed, 7 insertions(+), 11 deletions(-)
hw/rtc/mc146818rtc.c +3 -11
@@ -43,16 +43,10 @@#include "qapi/error.h" #include "qapi/qapi-events-misc.h" #include "qapi/visitor.h" +#include "trace.h" -//#define DEBUG_CMOS //#define DEBUG_COALESCED -#ifdef DEBUG_CMOS -# define CMOS_DPRINTF (format, ...) printf(format, ## __VA_ARGS__) -#else -# define CMOS_DPRINTF (format, ...) do { } while (0) -#endif -#ifdef DEBUG_COALESCED # define DPRINTF_C (format, ...) printf(format, ## __VA_ARGS__)#else
@@ -439,8 +433,7 @@ static void cmos_ioport_write(void *opaque, hwaddr addr,if ((addr &1 ) ==0 ) { s->cmos_index = data &0x7f ; }else { -CMOS_DPRINTF ("cmos: write index=0x%02x val=0x%02" PRIx64"\n" , - s->cmos_index, data); +trace_mc146818_rtc_ioport_write (s->cmos_index, data);switch (s->cmos_index) {case RTC_SECONDS_ALARM :case RTC_MINUTES_ALARM :
@@ -726,8 +719,7 @@ static uint64_t cmos_ioport_read(void *opaque, hwaddr addr, ret = s->cmos_data[s->cmos_index];break ; } -CMOS_DPRINTF ("cmos: read index=0x%02x val=0x%02x\n" , - s->cmos_index, ret); +trace_mc146818_rtc_ioport_read (s->cmos_index, ret);return ret; } }
hw/rtc/trace-events +4 -0
@@ -32,6 +32,10 @@ m48txx_nvram_io_write(uint64_t addr, uint64_t value) "io write addr:0x%04" PRIx6 m48txx_nvram_mem_read(uint32_t addr, uint32_t value) "mem read addr:0x%04x value:0x%02x" m48txx_nvram_mem_write(uint32_t addr, uint32_t value) "mem write addr:0x%04x value:0x%02x" +# mc146818rtc.c +mc146818_rtc_ioport_read(uint8_t addr, uint8_t value) "[0x%02" PRIx8 "] -> 0x%02" PRIx8 +mc146818_rtc_ioport_write(uint8_t addr, uint8_t value) "[0x%02" PRIx8 "] <- 0x%02" PRIx8 + # goldfish_rtc.c goldfish_rtc_read(uint64_t addr, uint64_t value) "addr 0x%02" PRIx64 " value 0x%08" PRIx64 goldfish_rtc_write(uint64_t addr, uint64_t value) "addr 0x%02" PRIx64 " value 0x%08" PRIx64
Signature · 1 line
2.51.1.dirty
Re: [PATCH v3 03/10] hw/rtc/mc146818rtc: Convert CMOS_DPRINTF() into trace events
Quoted 12 lines · Bernhard Beschow
Signed-off-by Bernhard Beschow <[email protected]>--- hw/rtc/mc146818rtc.c | 14 +++----------- hw/rtc/trace-events | 4 ++++ 2 files changed, 7 insertions(+), 11 deletions(-)hw/rtc/trace-events +0
-0
hw/rtc/trace-events m48txx_nvram_io_write(uint64_t addr, uint64_t value) "io write addr:0x%04" PRIx6 · line 37
Quoted 6 lines
hw/rtc/trace-events +3
-0@@ -32,6 +32,10 @@ m48txx_nvram_io_write(uint64_t addr, uint64_t value) "io write addr:0x%04" PRIx6 m48txx_nvram_mem_read(uint32_t addr, uint32_t value) "mem read addr:0x%04x value:0x%02x" m48txx_nvram_mem_write(uint32_t addr, uint32_t value) "mem write addr:0x%04x value:0x%02x" +# mc146818rtc.c +mc146818_rtc_ioport_read(uint8_t addr, uint8_t value) "[0x%02" PRIx8 "] -> 0x%02" PRIx8 +mc146818_rtc_ioport_write(uint8_t addr, uint8_t value) "[0x%02" PRIx8 "] <- 0x%02" PRIx8
The block could be theorically mapped anywhere in the I/O ISA space, so 'uint8_t addr' is a bit too restrictive here. Otherwise,
Quoted 4 lines
hw/rtc/trace-events +1
-0+ # goldfish_rtc.c goldfish_rtc_read(uint64_t addr, uint64_t value) "addr 0x%02" PRIx64 " value 0x%08" PRIx64 goldfish_rtc_write(uint64_t addr, uint64_t value) "addr 0x%02" PRIx64 " value 0x%08" PRIx64
PATCH v3 4/10 hw/rtc/mc146818rtc: Use ARRAY_SIZE macro
In reply to Bernhard BeschowAvoids the error-prone repetition of the array size.
--- hw/rtc/mc146818rtc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
hw/rtc/mc146818rtc.c +3 -2
@@ -726,13 +726,14 @@ static uint64_t cmos_ioport_read(void *opaque, hwaddr addr,void mc146818rtc_set_cmos_data (MC146818RtcState *s,int addr,int val) { -if (addr >=0 && addr <=127 ) +if (addr >=0 && addr <ARRAY_SIZE (s->cmos_data)) { s->cmos_data[addr] = val; + } }int mc146818rtc_get_cmos_data (MC146818RtcState *s,int addr) { -assert (addr >=0 && addr <=127 ); +assert (addr >=0 && addr <ARRAY_SIZE (s->cmos_data));return s->cmos_data[addr]; }
Signature · 1 line
2.51.1.dirty
Re: [PATCH v3 04/10] hw/rtc/mc146818rtc: Use ARRAY_SIZE macro
Quoted 6 lines · Bernhard Beschow
Avoids the error-prone repetition of the array size.
Signed-off-by Bernhard Beschow <[email protected]>--- hw/rtc/mc146818rtc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
PATCH v3 5/10 hw/rtc/mc146818rtc: Assert correct usage of mc146818rtc_set_cmos_data()
In reply to Bernhard BeschowThe offset is never controlled by the guest, so any misuse constitutes a programming error and shouldn't be silently ignored. Fix this by using assert().
--- hw/rtc/mc146818rtc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
hw/rtc/mc146818rtc.c +2 -3
@@ -726,9 +726,8 @@ static uint64_t cmos_ioport_read(void *opaque, hwaddr addr,void mc146818rtc_set_cmos_data (MC146818RtcState *s,int addr,int val) { -if (addr >=0 && addr <ARRAY_SIZE (s->cmos_data)) { - s->cmos_data[addr] = val; - } +assert (addr >=0 && addr <ARRAY_SIZE (s->cmos_data)); + s->cmos_data[addr] = val; }int mc146818rtc_get_cmos_data (MC146818RtcState *s,int addr)
Signature · 1 line
2.51.1.dirty
Re: [PATCH v3 05/10] hw/rtc/mc146818rtc: Assert correct usage of mc146818rtc_set_cmos_data()
Quoted 2 lines · Bernhard Beschow
The offset is never controlled by the guest, so any misuse constitutes a programming error and shouldn't be silently ignored. Fix this by using
assert().
Would be nice to document the prototype.
Quoted 5 lines
Signed-off-by Bernhard Beschow <[email protected]>--- hw/rtc/mc146818rtc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
PATCH v3 6/10 hw/ide/ide-internal: Move dma_buf_commit() into ide "namespace"
In reply to Bernhard BeschowThe identifier suggests that it is a generic DMA function while it is tied to IDE. Fix this by adding an "ide_" prefix.
--- hw/ide/ide-internal.h | 2 +- hw/ide/ahci.c | 8 ++++---- hw/ide/core.c | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-)
hw/ide/ide-internal.h +1 -1
@@ -398,7 +398,7 @@ int64_t ide_get_sector(IDEState *s);void ide_set_sector (IDEState *s,int64_t sector_num);void ide_start_dma (IDEState *s,BlockCompletionFunc *cb); -void dma_buf_commit (IDEState *s,uint32_t tx_bytes); +void ide_dma_buf_commit (IDEState *s,uint32_t tx_bytes);void ide_dma_error (IDEState *s);void ide_abort_command (IDEState *s);
hw/ide/ahci.c +4 -4
@@ -1417,7 +1417,7 @@ static void ahci_pio_transfer(const IDEDMA *dma) }/* Update number of transferred bytes, destroy sglist */ -dma_buf_commit (s, size); +ide_dma_buf_commit (s, size); out:/* declare that we processed everything */
@@ -1482,8 +1482,8 @@ static int32_t ahci_dma_prepare_buf(const IDEDMA *dma, int32_t limit)/** * Updates the command header with a bytes-read value. -* Called via dma_buf_commit, for both DMA and PIO paths. -* sglist destruction is handled within dma_buf_commit. +* Called via ide_dma_buf_commit, for both DMA and PIO paths. +* sglist destruction is handled within ide_dma_buf_commit. */ static void ahci_commit_buf (const IDEDMA *dma,uint32_t tx_bytes) {
@@ -1511,7 +1511,7 @@ static int ahci_dma_rw_buf(const IDEDMA *dma, bool is_write) }/* free sglist, update byte count */ -dma_buf_commit (s, l); +ide_dma_buf_commit (s, l); s->io_buffer_index += l;trace_ahci_dma_rw_buf (ad->hba, ad->port_no, l);
hw/ide/core.c +5 -5
@@ -827,7 +827,7 @@ static void ide_sector_read(IDEState *s) ide_sector_read_cb, s); } -void dma_buf_commit (IDEState *s,uint32_t tx_bytes) +void ide_dma_buf_commit (IDEState *s,uint32_t tx_bytes) {if (s->bus->dma->ops->commit_buf) { s->bus->dma->ops->commit_buf (s->bus->dma, tx_bytes);
@@ -848,7 +848,7 @@ void ide_set_inactive(IDEState *s, bool more)void ide_dma_error (IDEState *s) { -dma_buf_commit (s,0 ); +ide_dma_buf_commit (s,0 );ide_abort_command (s);ide_set_inactive (s, false);ide_bus_set_irq (s->bus);
@@ -893,7 +893,7 @@ static void ide_dma_cb(void *opaque, int ret)if (ret <0 ) {if (ide_handle_rw_error (s, -ret,ide_dma_cmd_to_retry (s->dma_cmd))) { s->bus->dma->aiocb =NULL ; -dma_buf_commit (s,0 ); +ide_dma_buf_commit (s,0 );return ; } }
@@ -912,7 +912,7 @@ static void ide_dma_cb(void *opaque, int ret) sector_num =ide_get_sector (s);if (n >0 ) {assert (n *512 == s->sg.size); -dma_buf_commit (s, s->sg.size); +ide_dma_buf_commit (s, s->sg.size); sector_num += n;ide_set_sector (s, sector_num); s->nsector -= n;
@@ -944,7 +944,7 @@ static void ide_dma_cb(void *opaque, int ret)* Reset the Active bit and don't raise the interrupt. */ s->status =READY_STAT |SEEK_STAT ; -dma_buf_commit (s,0 ); +ide_dma_buf_commit (s,0 ); goto eot; }
Signature · 1 line
2.51.1.dirty
Re: [PATCH v3 06/10] hw/ide/ide-internal: Move dma_buf_commit() into ide "namespace"
Quoted 9 lines · Bernhard Beschow
The identifier suggests that it is a generic DMA function while it is tied to IDE. Fix this by adding an "
ide_" prefix.Signed-off-by Bernhard Beschow <[email protected]>--- hw/ide/ide-internal.h | 2 +- hw/ide/ahci.c | 8 ++++---- hw/ide/core.c | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-)
PATCH v3 7/10 hw/i386/apic: Prefer APICCommonState over DeviceState
In reply to Bernhard BeschowMakes the APIC API more type-safe by resolving quite a few APIC_COMMON downcasts.
Like PICCommonState, the APICCommonState is now a public typedef while staying an abstract datatype.
--- include/hw/i386/apic.h | 33 +++++------ include/hw/i386/apic_internal.h | 7 +-- target/i386/cpu.h | 4 +- target/i386/kvm/kvm_i386.h | 2 +- target/i386/whpx/whpx-internal.h | 2 +- hw/i386/kvm/apic.c | 3 +- hw/i386/vapic.c | 2 +- hw/i386/x86-cpu.c | 2 +- hw/intc/apic.c | 97 +++++++++++++------------------- hw/intc/apic_common.c | 56 +++++++----------- target/i386/cpu-apic.c | 18 +++--- target/i386/cpu-dump.c | 2 +- target/i386/cpu.c | 2 +- target/i386/kvm/kvm.c | 2 +- target/i386/whpx/whpx-apic.c | 3 +- 15 files changed, 95 insertions(+), 140 deletions(-)
include/hw/i386/apic.h +17 -16
@@ -1,28 +1,29 @@#ifndef APIC_H #define APIC_H +typedef struct APICCommonState APICCommonState ;/* apic.c */ void apic_set_max_apic_id (uint32_t max_apic_id); -int apic_accept_pic_intr (DeviceState *s); -void apic_deliver_pic_intr (DeviceState *s,int level); -void apic_deliver_nmi (DeviceState *d); -int apic_get_interrupt (DeviceState *s); -int cpu_set_apic_base (DeviceState *s,uint64_t val); -uint64_t cpu_get_apic_base (DeviceState *s); -bool cpu_is_apic_enabled (DeviceState *s); -void cpu_set_apic_tpr (DeviceState *s,uint8_t val); -uint8_t cpu_get_apic_tpr (DeviceState *s); -void apic_init_reset (DeviceState *s); -void apic_sipi (DeviceState *s); -void apic_poll_irq (DeviceState *d); -void apic_designate_bsp (DeviceState *d,bool bsp); -int apic_get_highest_priority_irr (DeviceState *dev); +int apic_accept_pic_intr (APICCommonState *s); +void apic_deliver_pic_intr (APICCommonState *s,int level); +void apic_deliver_nmi (APICCommonState *s); +int apic_get_interrupt (APICCommonState *s); +int cpu_set_apic_base (APICCommonState *s,uint64_t val); +uint64_t cpu_get_apic_base (APICCommonState *s); +bool cpu_is_apic_enabled (APICCommonState *s); +void cpu_set_apic_tpr (APICCommonState *s,uint8_t val); +uint8_t cpu_get_apic_tpr (APICCommonState *s); +void apic_init_reset (APICCommonState *s); +void apic_sipi (APICCommonState *s); +void apic_poll_irq (APICCommonState *s); +void apic_designate_bsp (APICCommonState *s,bool bsp); +int apic_get_highest_priority_irr (APICCommonState *s);int apic_msr_read (int index,uint64_t *val);int apic_msr_write (int index,uint64_t val); -bool is_x2apic_mode (DeviceState *d); +bool is_x2apic_mode (APICCommonState *s);/* pc.c */ -DeviceState *cpu_get_current_apic (void ); +APICCommonState *cpu_get_current_apic (void );#endif
include/hw/i386/apic_internal.h +3 -4
@@ -22,6 +22,7 @@#define QEMU_APIC_INTERNAL_H #include "cpu.h" +#include "hw/i386/apic.h" #include "system/memory.h" #include "qemu/timer.h" #include "target/i386/cpu-qom.h"
@@ -125,8 +126,6 @@#define VAPIC_ENABLE_BIT 0#define VAPIC_ENABLE_MASK (1 << VAPIC_ENABLE_BIT) -typedef struct APICCommonState APICCommonState ; -#define TYPE_APIC_COMMON "apic-common"typedef struct APICCommonClass APICCommonClass ; DECLARE_OBJ_CHECKERS(APICCommonState, APICCommonClass,
@@ -203,8 +202,8 @@ typedef struct VAPICState {extern bool apic_report_tpr_access;bool apic_next_timer (APICCommonState *s,int64_t current_time); -void apic_enable_tpr_access_reporting (DeviceState *d,bool enable); -void apic_enable_vapic (DeviceState *d,hwaddr paddr); +void apic_enable_tpr_access_reporting (APICCommonState *s,bool enable); +void apic_enable_vapic (APICCommonState *s,hwaddr paddr);void vapic_report_tpr_access (DeviceState *dev,CPUState *cpu,target_ulong ip,TPRAccess access);
target/i386/cpu.h +2 -2
@@ -2349,7 +2349,7 @@ struct ArchCPU {/* in order to simplify APIC support, we leave this pointer to the user */ -struct DeviceState *apic_state; +struct APICCommonState *apic_state;struct MemoryRegion *cpu_as_root, *cpu_as_mem, *smram;Notifier machine_done;
@@ -2830,7 +2830,7 @@ bool cpu_svm_has_intercept(CPUX86State *env, uint32_t type);/* apic.c */ void cpu_report_tpr_access (CPUX86State *env,TPRAccess access); -void apic_handle_tpr_access_report (DeviceState *d,target_ulong ip, +void apic_handle_tpr_access_report (APICCommonState *s,target_ulong ip,TPRAccess access);/* Special values for X86CPUVersion: */
target/i386/kvm/kvm_i386.h +1 -1
@@ -56,7 +56,7 @@ bool kvm_has_adjust_clock_stable(void);bool kvm_has_exception_payload (void );void kvm_synchronize_all_tsc (void ); -void kvm_get_apic_state (DeviceState *d,struct kvm_lapic_state *kapic); +void kvm_get_apic_state (APICCommonState *s,struct kvm_lapic_state *kapic);void kvm_put_apicbase (X86CPU *cpu,uint64_t value);bool kvm_has_x2apic_api (void );
target/i386/whpx/whpx-internal.h +1 -1
@@ -44,7 +44,7 @@ struct whpx_state { };extern struct whpx_state whpx_global; -void whpx_apic_get (DeviceState *s); +void whpx_apic_get (struct APICCommonState *s);#define WHV_E_UNKNOWN_CAPABILITY 0x80370300L
hw/i386/kvm/apic.c +1 -2
@@ -60,9 +60,8 @@ static void kvm_put_apic_state(APICCommonState *s, struct kvm_lapic_state *kapickvm_apic_set_reg (kapic,0x3e , s->divide_conf); } -void kvm_get_apic_state (DeviceState *dev,struct kvm_lapic_state *kapic) +void kvm_get_apic_state (APICCommonState *s,struct kvm_lapic_state *kapic) { -APICCommonState *s =APIC_COMMON (dev);int i, v;if (kvm_has_x2apic_api () && s->apicbase &MSR_IA32_APICBASE_EXTD ) {
hw/i386/vapic.c +1 -1
@@ -490,7 +490,7 @@ void vapic_report_tpr_access(DeviceState *dev, CPUState *cs, target_ulong ip, }typedef struct VAPICEnableTPRReporting { -DeviceState *apic; +APICCommonState *apic;bool enable; }VAPICEnableTPRReporting ;
hw/i386/x86-cpu.c +1 -1
@@ -86,7 +86,7 @@ int cpu_get_pic_interrupt(CPUX86State *env)return intno; } -DeviceState *cpu_get_current_apic (void ) +APICCommonState *cpu_get_current_apic (void ) {if (current_cpu) {X86CPU *cpu =X86_CPU (current_cpu);
hw/intc/apic.c +38 -59
293 lines not on this page · raw message
hw/intc/apic_common.c +19 -37
155 lines not on this page · raw message
target/i386/cpu-apic.c +7 -11
@@ -41,34 +41,31 @@ APICCommonClass *apic_get_class(Error **errp)void x86_cpu_apic_create (X86CPU *cpu,Error **errp) { -APICCommonState *apic;APICCommonClass *apic_class =apic_get_class (errp);if (!apic_class) {return ; } - cpu->apic_state =DEVICE (object_new_with_class (OBJECT_CLASS (apic_class))); + cpu->apic_state =APIC_COMMON (object_new_with_class (OBJECT_CLASS (apic_class)));object_property_add_child (OBJECT (cpu),"lapic" ,OBJECT (cpu->apic_state));object_unref (OBJECT (cpu->apic_state));/* TODO: convert to link<> */ - apic =APIC_COMMON (cpu->apic_state); - apic->cpu = cpu; - apic->apicbase =APIC_DEFAULT_ADDRESS |MSR_IA32_APICBASE_ENABLE ; + cpu->apic_state->cpu = cpu; + cpu->apic_state->apicbase =APIC_DEFAULT_ADDRESS |MSR_IA32_APICBASE_ENABLE ;/* * apic_common_set_id needs to check if the CPU has x2APIC -* feature in case APIC ID >= 255, so we need to set apic->cpu +* feature in case APIC ID >= 255, so we need to set cpu->apic_state->cpu * before setting APIC ID */ -qdev_prop_set_uint32 (cpu->apic_state,"id" , cpu->apic_id); +qdev_prop_set_uint32 (DEVICE (cpu->apic_state),"id" , cpu->apic_id); }void x86_cpu_apic_realize (X86CPU *cpu,Error **errp) { -APICCommonState *apic;static bool apic_mmio_map_once;if (cpu->apic_state ==NULL ) {
@@ -77,12 +74,11 @@ void x86_cpu_apic_realize(X86CPU *cpu, Error **errp)qdev_realize (DEVICE (cpu->apic_state),NULL , errp);/* Map APIC MMIO area */ - apic =APIC_COMMON (cpu->apic_state);if (!apic_mmio_map_once) {memory_region_add_subregion_overlap (get_system_memory (), - apic->apicbase & + cpu->apic_state->apicbase &MSR_IA32_APICBASE_BASE , - &apic->io_memory, + &cpu->apic_state->io_memory,0x1000 ); apic_mmio_map_once = true; }
target/i386/cpu-dump.c +1 -1
@@ -291,7 +291,7 @@ static void dump_apic_interrupt(const char *name, uint32_t *ireg_tab,void x86_cpu_dump_local_apic_state (CPUState *cs,int flags) {X86CPU *cpu =X86_CPU (cs); -APICCommonState *s =APIC_COMMON (cpu->apic_state); +APICCommonState *s = cpu->apic_state;if (!s) {qemu_printf ("local apic state not available\n" );return ;
target/i386/cpu.c +1 -1
@@ -8789,7 +8789,7 @@ void x86_cpu_after_reset(X86CPU *cpu) }if (cpu->apic_state) { -device_cold_reset (cpu->apic_state); +device_cold_reset (DEVICE (cpu->apic_state)); }#endif }
target/i386/kvm/kvm.c +1 -1
@@ -5029,7 +5029,7 @@ static int kvm_get_mp_state(X86CPU *cpu)static int kvm_get_apic (X86CPU *cpu) { -DeviceState *apic = cpu->apic_state; +APICCommonState *apic = cpu->apic_state;struct kvm_lapic_state kapic;int ret;
target/i386/whpx/whpx-apic.c +1 -2
@@ -151,9 +151,8 @@ static void whpx_apic_put(CPUState *cs, run_on_cpu_data data) } } -void whpx_apic_get (DeviceState *dev) +void whpx_apic_get (APICCommonState *s) { -APICCommonState *s =APIC_COMMON (dev);CPUState *cpu =CPU (s->cpu);struct whpx_lapic_state kapic;
Signature · 1 line
2.51.1.dirty
Re: [PATCH v3 07/10] hw/i386/apic: Prefer APICCommonState over DeviceState
Quoted 2 lines · Bernhard Beschow
Makes the APIC API more type-safe by resolving quite a few
APIC_COMMONdowncasts.
Nice!
Quoted 23 lines
Like PICCommonState, the APICCommonState is now a public typedef while staying an abstract datatype.
Signed-off-by Bernhard Beschow <[email protected]>--- include/hw/i386/apic.h | 33 +++++------ include/hw/i386/apic_internal.h | 7 +-- target/i386/cpu.h | 4 +- target/i386/kvm/kvm_i386.h | 2 +- target/i386/whpx/whpx-internal.h | 2 +- hw/i386/kvm/apic.c | 3 +- hw/i386/vapic.c | 2 +- hw/i386/x86-cpu.c | 2 +- hw/intc/apic.c | 97 +++++++++++++------------------- hw/intc/apic_common.c | 56 +++++++----------- target/i386/cpu-apic.c | 18 +++--- target/i386/cpu-dump.c | 2 +- target/i386/cpu.c | 2 +- target/i386/kvm/kvm.c | 2 +- target/i386/whpx/whpx-apic.c | 3 +- 15 files changed, 95 insertions(+), 140 deletions(-)
hw/intc/apic.c static void apic_set_tpr(APICCommonState *s, uint8_t val) · line 390
Quoted 8 lines
hw/intc/apic.c +2
-4-int apic_get_highest_priority_irr (DeviceState *dev) +int apic_get_highest_priority_irr (APICCommonState *s) { -APICCommonState *s; - -if (!dev) { +if (!s) {/* no interrupts */
Pre-existing dubious check.
Quoted 5 lines
return -1; } - s = APIC_COMMON(dev); return get_highest_priority_int(s->irr);}
PATCH v3 8/10 hw/i386/apic: Ensure own APIC use in apic_msr_{read,write}
In reply to Bernhard BeschowAvoids the current_cpu global and seems more robust by not "forgetting" the own APIC and then re-determining it by cpu_get_current_apic() which uses the global.
--- include/hw/i386/apic.h | 4 ++-- hw/intc/apic.c | 10 ++-------- target/i386/hvf/hvf.c | 4 ++-- target/i386/tcg/system/misc_helper.c | 4 ++-- 4 files changed, 8 insertions(+), 14 deletions(-)
include/hw/i386/apic.h +2 -2
@@ -19,8 +19,8 @@ void apic_sipi(APICCommonState *s);void apic_poll_irq (APICCommonState *s);void apic_designate_bsp (APICCommonState *s,bool bsp);int apic_get_highest_priority_irr (APICCommonState *s); -int apic_msr_read (int index,uint64_t *val); -int apic_msr_write (int index,uint64_t val); +int apic_msr_read (APICCommonState *s,int index,uint64_t *val); +int apic_msr_write (APICCommonState *s,int index,uint64_t val);bool is_x2apic_mode (APICCommonState *s);/* pc.c */
hw/intc/apic.c +2 -8
@@ -881,11 +881,8 @@ static uint64_t apic_mem_read(void *opaque, hwaddr addr, unsigned size)return val; } -int apic_msr_read (int index,uint64_t *val) +int apic_msr_read (APICCommonState *s,int index,uint64_t *val) { -APICCommonState *s; - - s =cpu_get_current_apic ();if (!s) {return -1 ; }
@@ -1079,11 +1076,8 @@ static void apic_mem_write(void *opaque, hwaddr addr, uint64_t val,apic_register_write (index, val); } -int apic_msr_write (int index,uint64_t val) +int apic_msr_write (APICCommonState *s,int index,uint64_t val) { -APICCommonState *s; - - s =cpu_get_current_apic ();if (!s) {return -1 ; }
target/i386/hvf/hvf.c +2 -2
@@ -527,7 +527,7 @@ void hvf_simulate_rdmsr(CPUState *cs)int ret;int index = (uint32_t )env->regs[R_ECX ] -MSR_APIC_START ; - ret =apic_msr_read (index, &val); + ret =apic_msr_read (cpu->apic_state, index, &val);if (ret <0 ) {x86_emul_raise_exception (env,EXCP0D_GPF ,0 ); }
@@ -638,7 +638,7 @@ void hvf_simulate_wrmsr(CPUState *cs)int ret;int index = (uint32_t )env->regs[R_ECX ] -MSR_APIC_START ; - ret =apic_msr_write (index, data); + ret =apic_msr_write (cpu->apic_state, index, data);if (ret <0 ) {x86_emul_raise_exception (env,EXCP0D_GPF ,0 ); }
target/i386/tcg/system/misc_helper.c +2 -2
@@ -299,7 +299,7 @@ void helper_wrmsr(CPUX86State *env)int index = (uint32_t )env->regs[R_ECX ] -MSR_APIC_START ;bql_lock (); - ret =apic_msr_write (index, val); + ret =apic_msr_write (env_archcpu (env)->apic_state, index, val);bql_unlock ();if (ret <0 ) { goto error;
@@ -477,7 +477,7 @@ void helper_rdmsr(CPUX86State *env)int index = (uint32_t )env->regs[R_ECX ] -MSR_APIC_START ;bql_lock (); - ret =apic_msr_read (index, &val); + ret =apic_msr_read (x86_cpu->apic_state, index, &val);bql_unlock ();if (ret <0 ) {raise_exception_err_ra (env,EXCP0D_GPF ,0 ,GETPC ());
Signature · 1 line
2.51.1.dirty
Re: [PATCH v3 08/10] hw/i386/apic: Ensure own APIC use in apic_msr_{read, write}
Quoted 11 lines · Bernhard Beschow
Avoids the
current_cpuglobal and seems more robust by not "forgetting" the own APIC and then re-determining it bycpu_get_current_apic()which uses the global.Signed-off-by Bernhard Beschow <[email protected]>--- include/hw/i386/apic.h | 4 ++-- hw/intc/apic.c | 10 ++-------- target/i386/hvf/hvf.c | 4 ++-- target/i386/tcg/system/misc_helper.c | 4 ++-- 4 files changed, 8 insertions(+), 14 deletions(-)
Good cleanup!
Re: [PATCH v3 08/10] hw/i386/apic: Ensure own APIC use in apic_msr_{read, write}
Am 20. Oktober 2025 06:09:22 UTC schrieb "Philippe Mathieu-Daudé" <[email protected]>:
Quoted 13 lines · Bernhard Beschow
Quoted 11 lines
Avoids the
current_cpuglobal and seems more robust by not "forgetting" the own APIC and then re-determining it bycpu_get_current_apic()which uses the global.Signed-off-by Bernhard Beschow <[email protected]>--- include/hw/i386/apic.h | 4 ++-- hw/intc/apic.c | 10 ++-------- target/i386/hvf/hvf.c | 4 ++-- target/i386/tcg/system/misc_helper.c | 4 ++-- 4 files changed, 8 insertions(+), 14 deletions(-)
Quoted 3 lines
Good cleanup!
Reviewed-by Philippe Mathieu-Daudé <[email protected]>
Thanks! I think it would be possible to remove cpu_get_current_apic() entirely if each local APIC's memory region could be bound to the address space of each CPU. However, it seems that the respective root memory regions aren't prepared for that and I didn't want to go into this rabbit hole here in this context.
Best regards,
Bernhard
PATCH v3 9/10 hw/intc/apic: Pass APICCommonState to apic_register_{read,write}
In reply to Bernhard BeschowAs per the previous patch, the APIC instance is already available in apic_msr_{read,write}, so it can be passed along. It turns out that the call to cpu_get_current_apic() is only required in apic_mem_{read,write}, so it has been moved there. Longer term, cpu_get_current_apic() could be removed entirely if apic_mem_{read,write} is tied to a CPU's local address space.
--- hw/intc/apic.c | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-)
hw/intc/apic.c +16 -19
@@ -769,17 +769,11 @@ static void apic_timer(void *opaque)apic_timer_update (s, s->next_time); } -static int apic_register_read (int index,uint64_t *value) +static int apic_register_read (APICCommonState *s,int index,uint64_t *value) { -APICCommonState *s;uint32_t val;int ret =0 ; - s =cpu_get_current_apic (); -if (!s) { -return -1 ; - } -switch (index) {case 0x02 :/* id */ if (is_x2apic_mode (s)) {
@@ -868,6 +862,7 @@ static int apic_register_read(int index, uint64_t *value)static uint64_t apic_mem_read (void *opaque,hwaddr addr,unsigned size) { +APICCommonState *s =cpu_get_current_apic ();uint64_t val;int index;
@@ -875,8 +870,12 @@ static uint64_t apic_mem_read(void *opaque, hwaddr addr, unsigned size)return 0 ; } +if (!s) { +return -1 ; + } + index = (addr >>4 ) &0xff ; -apic_register_read (index, &val); +apic_register_read (s, index, &val);return val; }
@@ -891,7 +890,7 @@ int apic_msr_read(APICCommonState *s, int index, uint64_t *val)return -1 ; } -return apic_register_read (index, val); +return apic_register_read (s, index, val); }static void apic_send_msi (MSIMessage *msi)
@@ -919,15 +918,8 @@ static void apic_send_msi(MSIMessage *msi)apic_deliver_irq (dest, dest_mode, delivery, vector, trigger_mode); } -static int apic_register_write (int index,uint64_t val) +static int apic_register_write (APICCommonState *s,int index,uint64_t val) { -APICCommonState *s; - - s =cpu_get_current_apic (); -if (!s) { -return -1 ; - } -trace_apic_register_write (index, val);switch (index) {
@@ -1054,12 +1046,17 @@ static int apic_register_write(int index, uint64_t val)static void apic_mem_write (void *opaque,hwaddr addr,uint64_t val,unsigned size) { +APICCommonState *s =cpu_get_current_apic ();int index = (addr >>4 ) &0xff ;if (size <4 ) {return ; } +if (!s) { +return ; + } +if (addr >0xfff || !index) {/* * MSI and MMIO APIC are at the same memory location,
@@ -1073,7 +1070,7 @@ static void apic_mem_write(void *opaque, hwaddr addr, uint64_t val,return ; } -apic_register_write (index, val); +apic_register_write (s, index, val); }int apic_msr_write (APICCommonState *s,int index,uint64_t val)
@@ -1086,7 +1083,7 @@ int apic_msr_write(APICCommonState *s, int index, uint64_t val)return -1 ; } -return apic_register_write (index, val); +return apic_register_write (s, index, val); }static void apic_pre_save (APICCommonState *s)
Signature · 1 line
2.51.1.dirty
Re: [PATCH v3 09/10] hw/intc/apic: Pass APICCommonState to apic_register_{read, write}
Quoted 11 lines · Bernhard Beschow
As per the previous patch, the APIC instance is already available in apic_msr_{read,write}, so it can be passed along. It turns out that the call to
cpu_get_current_apic()is only required in apic_mem_{read,write}, so it has been moved there. Longer term,cpu_get_current_apic()could be removed entirely if apic_mem_{read,write} is tied to a CPU's local address space.Signed-off-by Bernhard Beschow <[email protected]>--- hw/intc/apic.c | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-)
Re: [PATCH v3 09/10] hw/intc/apic: Pass APICCommonState to apic_register_{read, write}
In reply to Bernhard BeschowHi Bernhard,
Quoted 17 lines · Bernhard Beschow
As per the previous patch, the APIC instance is already available in apic_msr_{read,write}, so it can be passed along. It turns out that the call to
cpu_get_current_apic()is only required in apic_mem_{read,write}, so it has been moved there. Longer term,cpu_get_current_apic()could be removed entirely if apic_mem_{read,write} is tied to a CPU's local address space.Signed-off-by Bernhard Beschow <[email protected]>--- hw/intc/apic.c | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-)(quoted diff) +0
-0@@ -1054,12 +1046,17 @@ static int apic_register_write(int index, uint64_t val) static void apic_mem_write(void *opaque, hwaddr addr, uint64_t val, unsigned size) {
Review static int apic_register_write(int index, uint64_t val) · line 1058
Quoted 10 lines
(quoted diff) +4
-0+ APICCommonState *s = cpu_get_current_apic(); int index = (addr >> 4) & 0xff; if (size < 4) { return; } + if (!s) { + return; + }
This is not the correct place to return...
Review static int apic_register_write(int index, uint64_t val) · line 1061
Quoted 3 lines
(quoted diff) +0
-0if (addr > 0xfff || !index) { /* * MSI and MMIO APIC are at the same memory location,
... because of this comment. See the (squashed) fix below.
Review static void apic_mem_write(void *opaque, hwaddr addr, uint64_t val, · line 1074
Quoted 7 lines
(quoted diff) +1
-1@@ -1073,7 +1070,7 @@ static void apic_mem_write(void *opaque, hwaddr addr, uint64_t val, return; } - apic_register_write(index, val); + apic_register_write(s, index, val); }
-- >8 --
hw/intc/apic.c +4 -4
@@ -1046,30 +1046,30 @@ static int apic_register_write(APICCommonState *s, int index, uint64_t val)static void apic_mem_write (void *opaque,hwaddr addr,uint64_t val,unsigned size) {APICCommonState *s =cpu_get_current_apic ();int index = (addr >>4 ) &0xff ;if (size <4 ) {return ; } -if (!s) { -return ; - } -if (addr >0xfff || !index) {/* * MSI and MMIO APIC are at the same memory location, * but actually not on the global bus: MSI is on PCI bus * APIC is connected directly to the CPU. * Mapping them on the global bus happens to work because * MSI registers are reserved in APIC MMIO and vice versa. */ MSIMessage msi = { .address = addr, .data = val };apic_send_msi (&msi);return ; } +if (!s) { +return ; + } +apic_register_write (s, index, val); }
---
PATCH v3 10/10 tests/qtest/ds1338-test: Reuse from_bcd()
In reply to Bernhard Beschowfrom_bcd() is a public API function which can be unit-tested. Reuse it to avoid code duplication.
--- tests/qtest/ds1338-test.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
tests/qtest/ds1338-test.c +4 -8
@@ -18,16 +18,12 @@*/ #include "qemu/osdep.h" +#include "qemu/bcd.h" #include "libqtest.h" #include "libqos/i2c.h" #define DS1338_ADDR 0x68 -static inline uint8_t bcd2bin (uint8_t x) -{ -return ((x) &0x0f ) + ((x) >>4 ) *10 ; -} -static void send_and_receive (void *obj,void *data,QGuestAllocator *alloc) {QI2CDevice *i2cdev = (QI2CDevice *)obj;
@@ -39,9 +35,9 @@ static void send_and_receive(void *obj, void *data, QGuestAllocator *alloc)i2c_read_block (i2cdev,0 , resp,sizeof (resp));/* check retrieved time against local time */ - g_assert_cmpuint(bcd2bin(resp[4]), == , tm_ptr->tm_mday); - g_assert_cmpuint(bcd2bin(resp[5]), == , 1 + tm_ptr->tm_mon); - g_assert_cmpuint(2000 + bcd2bin(resp[6]), == , 1900 + tm_ptr->tm_year); + g_assert_cmpuint(from_bcd(resp[4]), == , tm_ptr->tm_mday); + g_assert_cmpuint(from_bcd(resp[5]), == , 1 + tm_ptr->tm_mon); + g_assert_cmpuint(2000 + from_bcd(resp[6]), == , 1900 + tm_ptr->tm_year); }static void ds1338_register_nodes (void )
Signature · 1 line
2.51.1.dirty
Re: [PATCH v3 10/10] tests/qtest/ds1338-test: Reuse from_bcd()
Quoted 7 lines · Bernhard Beschow
from_bcd()is a public API function which can be unit-tested. Reuse it to avoid code duplication.Signed-off-by Bernhard Beschow <[email protected]>--- tests/qtest/ds1338-test.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
Quoted 6 lines · Bernhard Beschow
Bernhard Beschow (10):
hw/timer/i8254: Add I/O trace events hw/audio/pcspk: Add I/O trace events hw/rtc/mc146818rtc: ConvertCMOS_DPRINTF()into trace events hw/rtc/mc146818rtc: UseARRAY_SIZEmacro hw/rtc/mc146818rtc: Assert correct usage of
Quoted 6 lines
mc146818rtc_set_cmos_data()hw/ide/ide-internal: Move
dma_buf_commit()into ide "namespace" hw/i386/apic: Prefer APICCommonState over DeviceState hw/i386/apic: Ensure own APIC use in apic_msr_{read,write} hw/intc/apic: Pass APICCommonState to apic_register_{read,write} tests/qtest/ds1338-test: Reusefrom_bcd()
Thanks, except if Paolo/MST/Igor object, series queued squashing:
-- >8 --
target/i386/cpu.h +2 -1
@@ -29,2 +29,3 @@#include "exec/memop.h" +#include "hw/i386/apic.h" #include "hw/i386/topology.h"
@@ -2352,3 +2352,3 @@ struct ArchCPU {user */ -struct APICCommonState *apic_state; +APICCommonState *apic_state;struct MemoryRegion *cpu_as_root, *cpu_as_mem, *smram;
target/i386/whpx/whpx-internal.h +3 -1
@@ -7,2 +7,4 @@ +#include "hw/i386/apic.h" + typedef enum WhpxBreakpointState {
@@ -46,3 +48,3 @@ struct whpx_state {extern struct whpx_state whpx_global; -void whpx_apic_get (struct APICCommonState *s); +void whpx_apic_get (APICCommonState *s);
---
Quoted 41 lines · Philippe Mathieu-Daudé
Quoted 4 lines · Bernhard Beschow
Bernhard Beschow (10):
hw/timer/i8254: Add I/O trace events hw/audio/pcspk: Add I/O trace events hw/rtc/mc146818rtc: ConvertCMOS_DPRINTF()into trace eventsQuoted 8 lines
hw/rtc/mc146818rtc: Use
ARRAY_SIZEmacro hw/rtc/mc146818rtc: Assert correct usage ofmc146818rtc_set_cmos_data()
hw/ide/ide-internal: Movedma_buf_commit()into ide "namespace" hw/i386/apic: Prefer APICCommonState over DeviceState hw/i386/apic: Ensure own APIC use in apic_msr_{read,write} hw/intc/apic: Pass APICCommonState to apic_register_{read,write} tests/qtest/ds1338-test: Reusefrom_bcd()Thanks, except if Paolo/MST/Igor object, series queued squashing:
-- >8 --
target/i386/cpu.h +2
-1@@ -29,2 +29,3 @@ #include "exec/memop.h" +#include "hw/i386/apic.h" #include "hw/i386/topology.h"@@ -2352,3 +2352,3 @@ struct ArchCPU {user */ - struct APICCommonState *apic_state; + APICCommonState *apic_state; struct MemoryRegion *cpu_as_root, *cpu_as_mem, *smram;target/i386/whpx/whpx-internal.h +2
-0@@ -7,2 +7,4 @@ +#include "hw/i386/apic.h" + typedef enum WhpxBreakpointState {
target/i386/whpx/whpx-internal.h struct whpx_state {
Quoted 5 lines
target/i386/whpx/whpx-internal.h +1
-2@@ -46,3 +48,3 @@ struct whpx_state { extern struct whpx_state whpx_global; -void whpx_apic_get (struct APICCommonState *s); +void whpx_apic_get (APICCommonState *s); ---
Also squashing:
-- >8 --
hw/intc/apic.c +4 -4
@@ -1056,4 +1055,0 @@ static void apic_mem_write(void *opaque, hwaddr addr, uint64_t val, -if (!s) { -return ; - } -
@@ -1072,0 +1069,4 @@ static void apic_mem_write(void *opaque, hwaddr addr, uint64_t val, +if (!s) { +return ; + } +
---