From patchwork Wed May 12 20:57:20 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Blue Swirl X-Patchwork-Id: 52436 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 114A9B7DF3 for ; Thu, 13 May 2010 14:28:37 +1000 (EST) Received: from localhost ([127.0.0.1]:37939 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OCQ2C-0000gw-PD for incoming@patchwork.ozlabs.org; Thu, 13 May 2010 00:28:32 -0400 Received: from [140.186.70.92] (port=36326 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OCPGi-00034h-AC for qemu-devel@nongnu.org; Wed, 12 May 2010 23:39:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OCJSy-000190-Et for qemu-devel@nongnu.org; Wed, 12 May 2010 17:28:00 -0400 Received: from mail-pw0-f45.google.com ([209.85.160.45]:62897) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OCJSv-00017X-Pm for qemu-devel@nongnu.org; Wed, 12 May 2010 17:27:42 -0400 Received: by pwj3 with SMTP id 3so180758pwj.4 for ; Wed, 12 May 2010 14:27:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=Bbwdp65u/0ezJ1jSFZtOSa06X+oc6K5hs5H14WzqM1g=; b=Z/zS9CckHCpl0sCOjFY5mDi/kVVCxe9RfikPoS029TEzYzQ6Qoqiswbf+VatCHlZsd kEa0ciirpjJXSPSArLkC9HW1yo2aUUTKqideAoZ5iNE5M6KBCkbC7kFkImKGnDHpJ5ke icacuGTOSftuZN/PrztrR0j1Xu6DUgPUh+vKU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=g7ITZLwM2Nk9PIM/KOuj8oWtyLryS8j1X5rKWDEHT/k432izWRD9Kt7i0P9JRfhy/C 6SQDNl51/K2HRLtFLzV4VdQjCCcUKvEJOsP+4bfSnm/2gXKKR9g6ZXlX1hJhCx9uY8jm Y6RRX1CakKf0YuYnsWYyYkUpdy/T0OppA5Qpk= MIME-Version: 1.0 Received: by 10.141.2.8 with SMTP id e8mr5372638rvi.205.1273697840502; Wed, 12 May 2010 13:57:20 -0700 (PDT) Received: by 10.141.44.12 with HTTP; Wed, 12 May 2010 13:57:20 -0700 (PDT) Date: Wed, 12 May 2010 23:57:20 +0300 Message-ID: From: Blue Swirl To: qemu-devel X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: [Qemu-devel] [PATCH 3/4] x86/Sparc32: use device info for pic and irq X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Blue Swirl --- hw/an5206.c | 9 -------- hw/arm_pic.c | 10 --------- hw/cris_pic_cpu.c | 5 ---- hw/i8259.c | 50 ++++++++++++++++++++++++++++++---------------- hw/microblaze_pic_cpu.c | 5 ---- hw/pc.h | 2 - hw/shix.c | 10 --------- hw/slavio_intctl.c | 26 +++++++++++++++--------- hw/sun4c_intctl.c | 16 +++++++++++++- hw/sun4m.c | 15 +------------- hw/sun4m.h | 8 ------- hw/sun4u.c | 8 ------- monitor.c | 16 +-------------- qemu-monitor.hx | 4 --- 14 files changed, 64 insertions(+), 120 deletions(-) diff --git a/hw/an5206.c b/hw/an5206.c index f584d88..cf84845 100644 --- a/hw/an5206.c +++ b/hw/an5206.c @@ -18,15 +18,6 @@ #define AN5206_MBAR_ADDR 0x10000000 #define AN5206_RAMBAR_ADDR 0x20000000 -/* Stub functions for hardware that doesn't exist. */ -void pic_info(Monitor *mon) -{ -} - -void irq_info(Monitor *mon) -{ -} - /* Board init. */ static void an5206_init(ram_addr_t ram_size, diff --git a/hw/arm_pic.c b/hw/arm_pic.c index f44568c..e4822f0 100644 --- a/hw/arm_pic.c +++ b/hw/arm_pic.c @@ -11,16 +11,6 @@ #include "pc.h" #include "arm-misc.h" -/* Stub functions for hardware that doesn't exist. */ -void pic_info(Monitor *mon) -{ -} - -void irq_info(Monitor *mon) -{ -} - - /* Input 0 is IRQ and input 1 is FIQ. */ static void arm_pic_cpu_handler(void *opaque, int irq, int level) { diff --git a/hw/cris_pic_cpu.c b/hw/cris_pic_cpu.c index a92d445..e4d7d1a 100644 --- a/hw/cris_pic_cpu.c +++ b/hw/cris_pic_cpu.c @@ -28,11 +28,6 @@ #define D(x) -void pic_info(Monitor *mon) -{} -void irq_info(Monitor *mon) -{} - static void cris_pic_cpu_handler(void *opaque, int irq, int level) { CPUState *env = (CPUState *)opaque; diff --git a/hw/i8259.c b/hw/i8259.c index ea48e0e..a36bb20 100644 --- a/hw/i8259.c +++ b/hw/i8259.c @@ -52,6 +52,13 @@ typedef struct PicState { uint8_t elcr; /* PIIX edge/trigger selection*/ uint8_t elcr_mask; PicState2 *pics_state; +#if defined(DEBUG_PIC) || defined (DEBUG_IRQ_COUNT) + int irq_level[16]; +#endif +#ifdef DEBUG_IRQ_COUNT + uint64_t irq_count[16]; +#endif + } PicState; struct PicState2 { @@ -62,12 +69,6 @@ struct PicState2 { void *irq_request_opaque; }; -#if defined(DEBUG_PIC) || defined (DEBUG_IRQ_COUNT) -static int irq_level[16]; -#endif -#ifdef DEBUG_IRQ_COUNT -static uint64_t irq_count[16]; -#endif PicState2 *isa_pic; /* set irq level. If an edge is detected, then the IRR is set to 1 */ @@ -184,14 +185,15 @@ static void i8259_set_irq(void *opaque, int irq, int level) PicState2 *s = opaque; #if defined(DEBUG_PIC) || defined(DEBUG_IRQ_COUNT) - if (level != irq_level[irq]) { + if (level != s->irq_level[irq]) { #if defined(DEBUG_PIC) printf("i8259_set_irq: irq=%d level=%d\n", irq, level); #endif - irq_level[irq] = level; + s->irq_level[irq] = level; #ifdef DEBUG_IRQ_COUNT - if (level == 1) - irq_count[irq]++; + if (level == 1) { + s->irq_count[irq]++; + } #endif } #endif @@ -488,16 +490,14 @@ static void pic_init1(int io_addr, int elcr_addr, PicState *s) qemu_register_reset(pic_reset, s); } -void pic_info(Monitor *mon) +static void pic_info(Monitor *mon, void *opaque) { + PicState2 *pic = opaque; int i; PicState *s; - if (!isa_pic) - return; - for(i=0;i<2;i++) { - s = &isa_pic->pics[i]; + s = &pic->pics[i]; monitor_printf(mon, "pic%d: irr=%02x imr=%02x isr=%02x hprio=%d " "irq_base=%02x rr_sel=%d elcr=%02x fnm=%d\n", i, s->irr, s->imr, s->isr, s->priority_add, @@ -506,23 +506,35 @@ void pic_info(Monitor *mon) } } -void irq_info(Monitor *mon) +static void irq_info(Monitor *mon, void *opaque) { #ifndef DEBUG_IRQ_COUNT monitor_printf(mon, "irq statistic code not compiled.\n"); #else int i; int64_t count; + PicState2 *pic = opaque; monitor_printf(mon, "IRQ statistics:\n"); for (i = 0; i < 16; i++) { - count = irq_count[i]; - if (count > 0) + count = pic->irq_count[i]; + if (count > 0) { monitor_printf(mon, "%2d: %" PRId64 "\n", i, count); + } } #endif } +static const struct MonDevInfo i8259_pic_info = { + .dev_name = "i8259.state", + .dev_info_cb = pic_info, +}; + +static const struct MonDevInfo i8259_irq_info = { + .dev_name = "i8259.stats", + .dev_info_cb = irq_info, +}; + qemu_irq *i8259_init(qemu_irq parent_irq) { PicState2 *s; @@ -536,5 +548,7 @@ qemu_irq *i8259_init(qemu_irq parent_irq) s->pics[0].pics_state = s; s->pics[1].pics_state = s; isa_pic = s; + monitor_register_device_info(&i8259_pic_info, s); + monitor_register_device_info(&i8259_irq_info, s); return qemu_allocate_irqs(i8259_set_irq, s, 16); } diff --git a/hw/microblaze_pic_cpu.c b/hw/microblaze_pic_cpu.c index 7c59382..cfd1a46 100644 --- a/hw/microblaze_pic_cpu.c +++ b/hw/microblaze_pic_cpu.c @@ -27,11 +27,6 @@ #define D(x) -void pic_info(Monitor *mon) -{} -void irq_info(Monitor *mon) -{} - static void microblaze_pic_cpu_handler(void *opaque, int irq, int level) { CPUState *env = (CPUState *)opaque; diff --git a/hw/pc.h b/hw/pc.h index d11a576..8e65908 100644 --- a/hw/pc.h +++ b/hw/pc.h @@ -33,8 +33,6 @@ qemu_irq *i8259_init(qemu_irq parent_irq); int pic_read_irq(PicState2 *s); void pic_update_irq(PicState2 *s); uint32_t pic_intack_read(PicState2 *s); -void pic_info(Monitor *mon); -void irq_info(Monitor *mon); /* i8254.c */ diff --git a/hw/shix.c b/hw/shix.c index 638bf16..3fefb37 100644 --- a/hw/shix.c +++ b/hw/shix.c @@ -37,16 +37,6 @@ #define BIOS_FILENAME "shix_bios.bin" #define BIOS_ADDRESS 0xA0000000 -void irq_info(Monitor *mon) -{ - /* XXXXX */ -} - -void pic_info(Monitor *mon) -{ - /* XXXXX */ -} - static void shix_init(ram_addr_t ram_size, const char *boot_device, const char *kernel_filename, const char *kernel_cmdline, diff --git a/hw/slavio_intctl.c b/hw/slavio_intctl.c index b76d3ac..c5b7839 100644 --- a/hw/slavio_intctl.c +++ b/hw/slavio_intctl.c @@ -215,14 +215,11 @@ static CPUWriteMemoryFunc * const slavio_intctlm_mem_write[3] = { slavio_intctlm_mem_writel, }; -void slavio_pic_info(Monitor *mon, DeviceState *dev) +static void pic_info(Monitor *mon, void *opaque) { - SysBusDevice *sd; - SLAVIO_INTCTLState *s; + SLAVIO_INTCTLState *s = opaque; int i; - sd = sysbus_from_qdev(dev); - s = FROM_SYSBUS(SLAVIO_INTCTLState, sd); for (i = 0; i < MAX_CPUS; i++) { monitor_printf(mon, "per-cpu %d: pending 0x%08x\n", i, s->slaves[i].intreg_pending); @@ -231,18 +228,15 @@ void slavio_pic_info(Monitor *mon, DeviceState *dev) s->intregm_pending, s->intregm_disabled); } -void slavio_irq_info(Monitor *mon, DeviceState *dev) +static void irq_info(Monitor *mon, void *opaque) { #ifndef DEBUG_IRQ_COUNT monitor_printf(mon, "irq statistic code not compiled.\n"); #else - SysBusDevice *sd; - SLAVIO_INTCTLState *s; + SLAVIO_INTCTLState *s = opaque; int i; int64_t count; - sd = sysbus_from_qdev(dev); - s = FROM_SYSBUS(SLAVIO_INTCTLState, sd); monitor_printf(mon, "IRQ statistics:\n"); for (i = 0; i < 32; i++) { count = s->irq_count[i]; @@ -381,6 +375,16 @@ static int vmstate_intctl_post_load(void *opaque, int version_id) return 0; } +static const struct MonDevInfo slavio_pic_info = { + .dev_name = "intctl.state", + .dev_info_cb = pic_info, +}; + +static const struct MonDevInfo slavio_irq_info = { + .dev_name = "intctl.stats", + .dev_info_cb = irq_info, +}; + static const VMStateDescription vmstate_intctl_cpu = { .name ="slavio_intctl_cpu", .version_id = 1, @@ -445,6 +449,8 @@ static int slavio_intctl_init1(SysBusDevice *dev) s->slaves[i].cpu = i; s->slaves[i].master = s; } + monitor_register_device_info(&slavio_pic_info, s); + monitor_register_device_info(&slavio_irq_info, s); return 0; } diff --git a/hw/sun4c_intctl.c b/hw/sun4c_intctl.c index 7d7542d..beabf85 100644 --- a/hw/sun4c_intctl.c +++ b/hw/sun4c_intctl.c @@ -94,7 +94,7 @@ static CPUWriteMemoryFunc * const sun4c_intctl_mem_write[3] = { NULL, }; -void sun4c_pic_info(Monitor *mon, void *opaque) +static void pic_info(Monitor *mon, void *opaque) { Sun4c_INTCTLState *s = opaque; @@ -102,7 +102,7 @@ void sun4c_pic_info(Monitor *mon, void *opaque) s->pending, s->reg); } -void sun4c_irq_info(Monitor *mon, void *opaque) +static void irq_info(Monitor *mon, void *opaque) { #ifndef DEBUG_IRQ_COUNT monitor_printf(mon, "irq statistic code not compiled.\n"); @@ -169,6 +169,16 @@ static void sun4c_set_irq(void *opaque, int irq, int level) } } +static const struct MonDevInfo sun4c_pic_info = { + .dev_name = "intctl.state", + .dev_info_cb = pic_info, +}; + +static const struct MonDevInfo sun4c_irq_info = { + .dev_name = "intctl.stats", + .dev_info_cb = irq_info, +}; + static const VMStateDescription vmstate_sun4c_intctl = { .name ="sun4c_intctl", .version_id = 1, @@ -203,6 +213,8 @@ static int sun4c_intctl_init1(SysBusDevice *dev) for (i = 0; i < MAX_PILS; i++) { sysbus_init_irq(dev, &s->cpu_irqs[i]); } + monitor_register_device_info(&sun4c_pic_info, s); + monitor_register_device_info(&sun4c_irq_info, s); return 0; } diff --git a/hw/sun4m.c b/hw/sun4m.c index 9a79120..dfa3c96 100644 --- a/hw/sun4m.c +++ b/hw/sun4m.c @@ -212,20 +212,6 @@ static void nvram_init(M48t59State *nvram, uint8_t *macaddr, m48t59_write(nvram, i, image[i]); } -static DeviceState *slavio_intctl; - -void pic_info(Monitor *mon) -{ - if (slavio_intctl) - slavio_pic_info(mon, slavio_intctl); -} - -void irq_info(Monitor *mon) -{ - if (slavio_intctl) - slavio_irq_info(mon, slavio_intctl); -} - void cpu_check_irqs(CPUState *env) { if (env->pil_in && (env->interrupt_index == 0 || @@ -806,6 +792,7 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef, ram_addr_t RAM_size, unsigned long kernel_size; DriveInfo *fd[MAX_FD]; void *fw_cfg; + DeviceState *slavio_intctl; /* init CPUs */ if (!cpu_model) diff --git a/hw/sun4m.h b/hw/sun4m.h index ce97ee5..b204cc1 100644 --- a/hw/sun4m.h +++ b/hw/sun4m.h @@ -22,14 +22,6 @@ static inline void sparc_iommu_memory_write(void *opaque, sparc_iommu_memory_rw(opaque, addr, buf, len, 1); } -/* slavio_intctl.c */ -void slavio_pic_info(Monitor *mon, DeviceState *dev); -void slavio_irq_info(Monitor *mon, DeviceState *dev); - -/* sun4c_intctl.c */ -void sun4c_pic_info(Monitor *mon, void *opaque); -void sun4c_irq_info(Monitor *mon, void *opaque); - /* sparc32_dma.c */ #include "sparc32_dma.h" diff --git a/hw/sun4u.c b/hw/sun4u.c index 24ea367..8bc9a9a 100644 --- a/hw/sun4u.c +++ b/hw/sun4u.c @@ -231,14 +231,6 @@ static unsigned long sun4u_load_kernel(const char *kernel_filename, return kernel_size; } -void pic_info(Monitor *mon) -{ -} - -void irq_info(Monitor *mon) -{ -} - void cpu_check_irqs(CPUState *env) { uint32_t pil = env->pil_in | diff --git a/monitor.c b/monitor.c index 9bb1a30..eed1026 100644 --- a/monitor.c +++ b/monitor.c @@ -2594,20 +2594,6 @@ static const mon_cmd_t info_cmds[] = { .mhandler.info = do_info_history, }, { - .name = "irq", - .args_type = "", - .params = "", - .help = "show the interrupts statistics (if available)", - .mhandler.info = irq_info, - }, - { - .name = "pic", - .args_type = "", - .params = "", - .help = "show i8259 (PIC) state", - .mhandler.info = pic_info, - }, - { .name = "pci", .args_type = "", .params = "", @@ -4719,5 +4705,5 @@ void monitor_register_device_info(const struct MonDevInfo *dev_info, entry = qemu_malloc(sizeof(*entry)); entry->dev_info = dev_info; entry->dev_opaque = dev_opaque; - QLIST_INSERT_HEAD(&cur_mon->dev_infos, entry, next); + QLIST_INSERT_HEAD(&default_mon->dev_infos, entry, next); } diff --git a/qemu-monitor.hx b/qemu-monitor.hx index 596025f..37c733f 100644 --- a/qemu-monitor.hx +++ b/qemu-monitor.hx @@ -68,10 +68,6 @@ show the cpu registers show infos for each CPU @item info history show the command line history -@item info irq -show the interrupts statistics (if available) -@item info pic -show i8259 (PIC) state @item info pci show emulated PCI device info @item info tlb