[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v7 4/4] PC: differentiate hpet's interrupt capab
From: |
Paolo Bonzini |
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 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130923 Thunderbird/17.0.9 |
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
- [Qemu-devel] [PATCH v7 0/4] bugs fix for hpet, Liu Ping Fan, 2013/10/16
- [Qemu-devel] [PATCH v7 1/4] hpet: inverse polarity when pin above ISA_NUM_IRQS, Liu Ping Fan, 2013/10/16
- [Qemu-devel] [PATCH v7 2/4] hpet: enable to entitle more irq pins for hpet, Liu Ping Fan, 2013/10/16
- [Qemu-devel] [PATCH v7 3/4] PC: use qdev_xx to create hpet instead of sysbus_create_xx, Liu Ping Fan, 2013/10/16
- [Qemu-devel] [PATCH v7 4/4] PC: differentiate hpet's interrupt capability on piix and q35, Liu Ping Fan, 2013/10/16
- Re: [Qemu-devel] [PATCH v7 4/4] PC: differentiate hpet's interrupt capability on piix and q35,
Paolo Bonzini <=
- Re: [Qemu-devel] [PATCH v7 4/4] PC: differentiate hpet's interrupt capability on piix and q35, Paolo Bonzini, 2013/10/17
- Re: [Qemu-devel] [PATCH v7 0/4] bugs fix for hpet, Michael S. Tsirkin, 2013/10/17