From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44419) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WHDkW-0004QM-U2 for qemu-devel@nongnu.org; Sat, 22 Feb 2014 09:40:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WHDkL-0007CN-RV for qemu-devel@nongnu.org; Sat, 22 Feb 2014 09:40:16 -0500 Received: from mail-ee0-x22e.google.com ([2a00:1450:4013:c00::22e]:41288) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WHDkL-00079d-I4 for qemu-devel@nongnu.org; Sat, 22 Feb 2014 09:40:05 -0500 Received: by mail-ee0-f46.google.com with SMTP id c13so2170415eek.33 for ; Sat, 22 Feb 2014 06:40:04 -0800 (PST) Sender: Paolo Bonzini Message-ID: <5308B6BF.3030503@redhat.com> Date: Sat, 22 Feb 2014 15:39:59 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <53082983.4090000@ddn.com> <16222845-E68D-4E40-8365-083EEBAC48D8@alex.org.uk> <5308821D.9060707@redhat.com> <44106FFA-013B-4B20-8457-19862B6005FA@alex.org.uk> In-Reply-To: <44106FFA-013B-4B20-8457-19862B6005FA@alex.org.uk> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] Don't enable a HPET timer if HPET is disabled List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alex Bligh Cc: QEMU Developers , Matt Lupfer Il 22/02/2014 13:25, Alex Bligh ha scritto: > Paolo, > > On 22 Feb 2014, at 10:55, Paolo Bonzini wrote: > >> Il 22/02/2014 10:03, Alex Bligh ha scritto: >>> I am unfamiliar with the HPET code but symmetry suggests perhaps the 'else' >>> condition should be changed too: >>> >>> } else if (deactivating_bit(old_val, new_val, HPET_TN_ENABLE) || >>> !hpet_enabled(s)) { >>> hpet_del_timer(timer); >>> } >>> >>> -- >> >> I thought the same, but there is no need for that. When the enabled bit goes >> from set to clear, all timers are disabled: >> >> } else if (deactivating_bit(old_val, new_val, HPET_CFG_ENABLE)) { >> /* Halt main counter and disable interrupt generation. */ >> s->hpet_counter = hpet_get_ticks(s); >> for (i = 0; i < s->num_timers; i++) { >> hpet_del_timer(&s->timer[i]); >> } >> } >> >> So hpet_del_timer would be a nop if !hpet_enabled(s). > > Thanks. I didn't know whether HPET_CFG_ENABLE and HPET_TN_ENABLE were equivalent. No, they are not, but HPET_CFG_ENABLE is equivalent to hpet_enabled. Paolo