public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Gleb Natapov <gleb@redhat.com>
To: Beth Kon <eak@us.ibm.com>
Cc: avi@redhat.com, kvm@vger.kernel.org
Subject: Re: [PATCH 1/5] BIOS changes for irq0->inti2 override (v8)
Date: Tue, 7 Jul 2009 14:58:15 +0300	[thread overview]
Message-ID: <20090707115815.GE28046@redhat.com> (raw)
In-Reply-To: <1246420759-12502-1-git-send-email-eak@us.ibm.com>

On Tue, Jun 30, 2009 at 11:59:15PM -0400, Beth Kon wrote:
>  
> +#ifdef BX_QEMU
> +void irq0_override_probe(void)
> +{
> +    if(qemu_cfg_port) {
> +        qemu_cfg_select(QEMU_CFG_IRQ0_OVERRIDE);
> +        qemu_cfg_read(&irq0_override, 1);
> +        return;
Drop return here.

> +    }
> +}
> +#endif
> +
>  void cpu_probe(void)
>  {
>      uint32_t eax, ebx, ecx, edx;
> @@ -1153,7 +1168,14 @@ static void mptable_init(void)
>      putstr(&q, "0.1         "); /* vendor id */
>      putle32(&q, 0); /* OEM table ptr */
>      putle16(&q, 0); /* OEM table size */
> +#ifdef BX_QEMU
> +    if (irq0_override)
> +        putle16(&q, MAX_CPUS + 17); /* entry count */
> +    else
> +        putle16(&q, MAX_CPUS + 18); /* entry count */
> +#else
>      putle16(&q, MAX_CPUS + 18); /* entry count */
> +#endif
>      putle32(&q, 0xfee00000); /* local APIC addr */
>      putle16(&q, 0); /* ext table length */
>      putb(&q, 0); /* ext table checksum */
> @@ -1197,6 +1219,13 @@ static void mptable_init(void)
>  
>      /* irqs */
>      for(i = 0; i < 16; i++) {
> +#ifdef BX_QEMU
> +        /* One entry per ioapic interrupt destination. Destination 2 is covered
> +         * by irq0->inti2 override (i == 0). Source IRQ 2 is unused
> +         */
> +        if (irq0_override && i == 2)
> +            continue;
> +#endif
>          putb(&q, 3); /* entry type = I/O interrupt */
>          putb(&q, 0); /* interrupt type = vectored interrupt */
>          putb(&q, 0); /* flags: po=0, el=0 */
> @@ -1204,7 +1233,12 @@ static void mptable_init(void)
>          putb(&q, 0); /* source bus ID = ISA */
>          putb(&q, i); /* source bus IRQ */
>          putb(&q, ioapic_id); /* dest I/O APIC ID */
> -        putb(&q, i); /* dest I/O APIC interrupt in */
> +#ifdef BX_QEMU
> +        if (irq0_override && i == 0)
> +            putb(&q, 2); /* dest I/O APIC interrupt in */
> +        else
> +#endif
> +            putb(&q, i); /* dest I/O APIC interrupt in */
>      }
>      /* patch length */
>      len = q - mp_config_table;
> @@ -1768,23 +1802,21 @@ void acpi_bios_init(void)
>          io_apic->io_apic_id = smp_cpus;
>          io_apic->address = cpu_to_le32(0xfec00000);
>          io_apic->interrupt = cpu_to_le32(0);
> -#ifdef BX_QEMU
> -#ifdef HPET_WORKS_IN_KVM
>          io_apic++;
> -
> -        int_override = (void *)io_apic;
> -        int_override->type = APIC_XRUPT_OVERRIDE;
> -        int_override->length = sizeof(*int_override);
> -        int_override->bus = cpu_to_le32(0);
> -        int_override->source = cpu_to_le32(0);
> -        int_override->gsi = cpu_to_le32(2);
> -        int_override->flags = cpu_to_le32(0);
> -#endif
> +        int_override = (struct madt_int_override*)(io_apic);
> +#ifdef BX_QEMU
> +        if (irq0_override) {
> +            memset(int_override, 0, sizeof(*int_override));
> +            int_override->type = APIC_XRUPT_OVERRIDE;
> +            int_override->length = sizeof(*int_override);
> +            int_override->source = 0;
> +            int_override->gsi = 2;
> +            int_override->flags = 0; /* conforms to bus specifications */
> +            int_override++;
> +        }
>  #endif
> -
> -        int_override = (struct madt_int_override*)(io_apic + 1);
> -        for ( i = 0; i < 16; i++ ) {
> -            if ( PCI_ISA_IRQ_MASK & (1U << i) ) {
> +        for (i = 0; i < 16; i++) {
> +            if (PCI_ISA_IRQ_MASK & (1U << i)) {
>                  memset(int_override, 0, sizeof(*int_override));
>                  int_override->type   = APIC_XRUPT_OVERRIDE;
>                  int_override->length = sizeof(*int_override);
> @@ -2708,6 +2740,9 @@ void rombios32_init(uint32_t *s3_resume_vector, uint8_t *shutdown_flag)
>  
>      if (bios_table_cur_addr != 0) {
>  
> +#ifdef BX_QEMU
> +        irq0_override_probe();
> +#endif
>          mptable_init();
>  
>          smbios_init();
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
			Gleb.

      parent reply	other threads:[~2009-07-07 11:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-01  3:59 [PATCH 1/5] BIOS changes for irq0->inti2 override (v8) Beth Kon
2009-07-01  3:59 ` [PATCH 2/5] Userspace changes for irq0->inti2 override support (v8) Beth Kon
2009-07-01  3:59 ` [PATCH 3/5] BIOS changes for qemu-kvm hpet " Beth Kon
2009-07-01  3:59 ` [PATCH 4/5] Userspace changes for qemu-kvm HPET support(v8) Beth Kon
2009-07-07 11:57   ` Gleb Natapov
2009-07-01  3:59 ` [PATCH 5/5] Kernel changes for HPET legacy support(v8) Beth Kon
2009-07-07 11:58 ` Gleb Natapov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090707115815.GE28046@redhat.com \
    --to=gleb@redhat.com \
    --cc=avi@redhat.com \
    --cc=eak@us.ibm.com \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox