All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Liu Ping Fan <qemulist@gmail.com>
Cc: qemu-devel@nongnu.org, Anthony Liguori <anthony@codemonkey.ws>,
	"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v7 4/4] PC: differentiate hpet's interrupt capability on piix and q35
Date: Thu, 17 Oct 2013 13:19:39 +0200	[thread overview]
Message-ID: <525FC7CB.3020709@redhat.com> (raw)
In-Reply-To: <1381979765-23092-5-git-send-email-pingfank@linux.vnet.ibm.com>

Il 17/10/2013 05:16, Liu Ping Fan ha scritto:
> +                          bool hpet_irqs)
>  {
>      int i;
>      DriveInfo *fd[MAX_FD];
> @@ -1249,10 +1250,19 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
>          /* In order to set property, here not using sysbus_try_create_simple */
>          hpet = qdev_try_create(NULL, "hpet");
>          if (hpet) {
> -            /* tmp fix. For compat, hard code to IRQ2 until we have correct
> -             * compat property and differentiate pc-iix with pc-q35
> -             */
> -            qdev_prop_set_uint32(hpet, HPET_INTCAP, 0x4);
> +            /* For pc-piix-*, hpet's intcap is always IRQ2. */
> +            if (!hpet_irqs) {
> +                qdev_prop_set_uint32(hpet, HPET_INTCAP, 0x4);
> +            } else {
> +                /* For pc-q35-1.7 and earlier, use IRQ2 for compat.
> +                 * Otherwise, use IRQ16~23, IRQ8 and IRQ2.
> +                 */
> +                uint8_t compat = object_property_get_int(OBJECT(hpet),
> +                        HPET_INTCAP, NULL);
> +                if (!compat) {
> +                    qdev_prop_set_uint32(hpet, HPET_INTCAP, 0xff0104);
> +                }
> +            }

Simpler:

    if (hpet) {
        uint8_t compat = object_property_get_int(OBJECT(hpet),
                    HPET_INTCAP, NULL);
        if (!compat) {
             qdev_prop_set_uint32(hpet, HPET_INTCAP, 0xff0104);
        }
    }

and just pass 0x4 or 0xff0104 to the function.

I think the "unused" property is okay.  It is a matter of fact that
before these patches intcap was hardcoded to 0x4.  Who cares if it
remains 0x4 in some cases.

Note that when this will go into 1.8 you will need to add the 1.8 machines.

Paolo

  parent reply	other threads:[~2013-10-17 11:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-17  3:16 [Qemu-devel] [PATCH v7 0/4] bugs fix for hpet Liu Ping Fan
2013-10-17  3:16 ` [Qemu-devel] [PATCH v7 1/4] hpet: inverse polarity when pin above ISA_NUM_IRQS Liu Ping Fan
2013-10-17  3:16 ` [Qemu-devel] [PATCH v7 2/4] hpet: enable to entitle more irq pins for hpet Liu Ping Fan
2013-10-17  3:16 ` [Qemu-devel] [PATCH v7 3/4] PC: use qdev_xx to create hpet instead of sysbus_create_xx Liu Ping Fan
2013-10-17  3:16 ` [Qemu-devel] [PATCH v7 4/4] PC: differentiate hpet's interrupt capability on piix and q35 Liu Ping Fan
2013-10-17  5:44   ` Michael S. Tsirkin
2013-10-17  6:27     ` liu ping fan
2013-10-17  6:43       ` Michael S. Tsirkin
2013-10-17 11:19   ` Paolo Bonzini [this message]
2013-10-17 11:19   ` Paolo Bonzini
2013-10-17  5:45 ` [Qemu-devel] [PATCH v7 0/4] bugs fix for hpet Michael S. Tsirkin

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=525FC7CB.3020709@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=anthony@codemonkey.ws \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemulist@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.