qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: BALATON Zoltan <balaton@eik.bme.hu>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [RFC PATCH] ati-vga: Implement dummy VBlank IRQ
Date: Thu, 15 Aug 2019 08:23:13 +0200	[thread overview]
Message-ID: <20190815062313.ve26cevmbyuewlo5@sirius.home.kraxel.org> (raw)
In-Reply-To: <20190815002652.79FDE7456E2@zero.eik.bme.hu>

On Thu, Aug 15, 2019 at 02:25:07AM +0200, BALATON Zoltan wrote:
> The MacOS driver exits if the card does not have an interrupt. If we
> set PCI_INTERRUPT_PIN to 1 then it enables VBlank interrupts and it
> boots but the mouse poniter can not be moved. This patch implements a
> dummy VBlank interrupt by a timer triggered at 60 Hz to test if it
> helps. Unfortunately it doesn't: MacOS with this patch hangs during
> boot just polling interrupts and acknowledging them so maybe it needs
> something else or there may be some other problem with this
> implementation.
> 
> This is posted for comments and to let others experiment with it but
> probably should not be committed upstream yet.
> 
> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
> ---
>  hw/display/ati.c      | 41 +++++++++++++++++++++++++++++++++++++++++
>  hw/display/ati_dbg.c  |  1 +
>  hw/display/ati_int.h  |  4 ++++
>  hw/display/ati_regs.h |  1 +
>  4 files changed, 47 insertions(+)
> 
> diff --git a/hw/display/ati.c b/hw/display/ati.c
> index a365e2455d..e06cbf3e91 100644
> --- a/hw/display/ati.c
> +++ b/hw/display/ati.c
> @@ -243,6 +243,21 @@ static uint64_t ati_i2c(bitbang_i2c_interface *i2c, uint64_t data, int base)
>      return data;
>  }
>  
> +static void ati_vga_update_irq(ATIVGAState *s)
> +{
> +    pci_set_irq(&s->dev, s->regs.gen_int_status & 1);

This should be "s->regs.gen_int_status & s->regs.gen_int_cntl" I guess?

> +static void ati_vga_vblank_irq(void *opaque)
> +{
> +    ATIVGAState *s = opaque;
> +
> +    timer_mod(&s->vblank_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) +
> +              NANOSECONDS_PER_SECOND / 60);
> +    s->regs.gen_int_status |= 1;

#defines for the irq status bits would be nice.

> +    case GEN_INT_CNTL:
> +        s->regs.gen_int_cntl = data;
> +        if (data & 1) {
> +            ati_vga_vblank_irq(s);
> +        } else {
> +            timer_del(&s->vblank_timer);
> +        }

ati_vga_update_irq() needed here.

> +        break;
> +    case GEN_INT_STATUS:
> +        data &= (s->dev_id == PCI_DEVICE_ID_ATI_RAGE128_PF ?
> +                 0x000f040fUL : 0xfc080effUL);

Add IRQ_MASK #define ?

> +        s->regs.gen_int_status &= ~data;

ati_vga_update_irq() needed here too.

cheers,
  Gerd



  reply	other threads:[~2019-08-15  6:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-15  0:25 [Qemu-devel] [RFC PATCH] ati-vga: Implement dummy VBlank IRQ BALATON Zoltan
2019-08-15  6:23 ` Gerd Hoffmann [this message]
2019-08-15  9:19   ` BALATON Zoltan
2019-08-15  9:50     ` Gerd Hoffmann
2019-08-15 11:17       ` BALATON Zoltan

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=20190815062313.ve26cevmbyuewlo5@sirius.home.kraxel.org \
    --to=kraxel@redhat.com \
    --cc=balaton@eik.bme.hu \
    --cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).