From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:40146) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QUJoT-0001Mp-BD for qemu-devel@nongnu.org; Wed, 08 Jun 2011 10:33:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QUJoO-0000Yu-4V for qemu-devel@nongnu.org; Wed, 08 Jun 2011 10:32:53 -0400 Received: from david.siemens.de ([192.35.17.14]:26202) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QUJoN-0000YK-Jw for qemu-devel@nongnu.org; Wed, 08 Jun 2011 10:32:47 -0400 Message-ID: <4DEF880B.3000806@siemens.com> Date: Wed, 08 Jun 2011 16:32:43 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <0074e8926b2a8c93a8ef6aab9071d3e7e882a6c3.1307528800.git.jan.kiszka@siemens.com> <4DEF6AF6.6000805@redhat.com> <4DEF6C0D.5020605@siemens.com> In-Reply-To: <4DEF6C0D.5020605@siemens.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 2/7] msi: Guard msi/msix_write_config with msi_present List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: qemu-devel , "Michael S. Tsirkin" On 2011-06-08 14:33, Jan Kiszka wrote: > On 2011-06-08 14:28, Gerd Hoffmann wrote: >>> @@ -1173,12 +1173,8 @@ static int intel_hda_exit(PCIDevice *pci) >>> static void intel_hda_write_config(PCIDevice *pci, uint32_t addr, >>> uint32_t val, int len) >>> { >>> - IntelHDAState *d = DO_UPCAST(IntelHDAState, pci, pci); >>> - >>> pci_default_write_config(pci, addr, val, len); >>> - if (d->msi) { >>> - msi_write_config(pci, addr, val, len); >>> - } >>> + msi_write_config(pci, addr, val, len); >>> } >> >> Nothing device specific left in there now. If msi_write_config() checks >> itself whenever msi is enabled or not we could call it from >> pci_default_write_config(), then zap this function altogether, no? > > Well, we could put those helpers (msi_write_config, msi_reset, maybe > more) into generic PCI code. Then device will only have to overload the > handlers if they do something in addition. Haven't checked the details > yet, though. Seems to fly. I'll repost the series to make msi_reset, msi_write_config, and msi_uninit implicit. Less boilerplate, less potential bugs. Jan -- Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux