From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=52146 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OGc0C-0005l4-Vv for qemu-devel@nongnu.org; Mon, 24 May 2010 14:03:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OGc06-0002xk-Fw for qemu-devel@nongnu.org; Mon, 24 May 2010 14:03:48 -0400 Received: from mail-pz0-f181.google.com ([209.85.222.181]:37018) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OGc06-0002xb-Az for qemu-devel@nongnu.org; Mon, 24 May 2010 14:03:42 -0400 Received: by pzk11 with SMTP id 11so2078947pzk.28 for ; Mon, 24 May 2010 11:03:41 -0700 (PDT) Message-ID: <4BFABF77.8050108@codemonkey.ws> Date: Mon, 24 May 2010 13:03:35 -0500 From: Anthony Liguori MIME-Version: 1.0 References: <201005241732.46988.paul@codesourcery.com> <4BFAAE22.5040900@codemonkey.ws> <201005241811.10219.paul@codesourcery.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH 0/6] Make hpet a compile time option List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Juan Quintela Cc: Blue Swirl , Jan Kiszka , Paul Brook , qemu-devel@nongnu.org On 05/24/2010 12:54 PM, Juan Quintela wrote: > Paul Brook wrote: > >>> On 05/24/2010 11:32 AM, Paul Brook wrote: >>> >>>>> Notice that this patch was sent against hpet as one example, if we agree >>>>> that this "way" of disabling devices is ok, we could disable more >>>>> devices/have more flexibility. Notice that in general, we (RHEL/KVM) >>>>> are interested in a small subset of qemu devices. >>>>> >>>> IMO this patch is a backwards step. The device models should be cleaned >>>> up so that you don't need to make a compile time decision. >>>> >>> I disagree. I think the device model should be cleaned up so that no >>> CONFIG_HPET is required in code but I think it's still useful to be able >>> to exclude device models from the build. That should just be a matter >>> of not building the object though (that's the point of device_init()). >>> >> I think we're saying the same thing. >> >> We already have a mechanism for avoiding things at build time - specifically >> config-devices.mak. We don't have a nice UI for it, but it's there. >> At worst your distro specific patch is a 1-line change to default- >> configs/i386-softmmu.mak. >> >> I have no objection to moving hpet.c into Makefile.objs, conditional on >> CONFIG_HPET (like e.g. CONFIG_SERIAL/serial.o). However a necessary >> prerequisite is that you fix the device model and machine initialisation so >> that it's possible to omit hpet.o without rebuilding anything else. >> > We have two exported functions: > > void hpet_init(qemu_irq *irq); > uint32_t hpet_in_legacy_mode(void); > > This is how one is used in mc14818rtc: > > #if defined TARGET_I386 > if (!hpet_in_legacy_mode()) > #endif > In real hardware, and HPET would normally emulate an RTC. The interaction problem here is that we aren't modelling that correctly in qemu as we're treating the rtc as a separate device. What could probably work at a hand wave level, is to make the rtc init function take a qemu_irq instead of directly grabbing the isa irq. When an HPET is in use, the rtc no longer is directly initiated but instead is indirectly initiated by the HPET passing a special qemu_irq to the device that masks the actual interrupt line when legacy mode isn't enabled. When the HPET isn't in use, the rtc would be created with an isa allocated qemu_irq. Regards, Anthony Liguori > how the other one is used on pc.c > > if (!no_hpet) { > hpet_init(isa_irq); > } > > I agree that I could probably came with some trick with qdev_create() to > substitute the hpet_init() (my understanding is that jan already have it > or something like that). > > But for the other call, what do you propose? > > My best try was to hide the availability of hpet inside hpet_emul.h > with: > > #ifdef CONFIG_HPET > uint32_t hpet_in_legacy_mode(void); > else > uint32_t hpet_in_legacy_mode(void) { return 0;} > #endif > > I can't see any obvious way to change the hpet_in_legacy_mode() that is > cleaner than this. > > Thanks, Juan. > > >> Paul >>