From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Liguori Subject: Re: [PATCH 5/7] KVM/userspace: Device Assignment: Support for assigning PCI devices to guests Date: Tue, 23 Sep 2008 14:18:51 -0500 Message-ID: <48D9411B.8040905@codemonkey.ws> References: <1222181695-23418-1-git-send-email-amit.shah@redhat.com> <1222181695-23418-2-git-send-email-amit.shah@redhat.com> <1222181695-23418-3-git-send-email-amit.shah@redhat.com> <1222181695-23418-4-git-send-email-amit.shah@redhat.com> <1222181695-23418-5-git-send-email-amit.shah@redhat.com> <1222181695-23418-6-git-send-email-amit.shah@redhat.com> <48D919A8.8040409@codemonkey.ws> <20080923183207.GA6922@il.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Amit Shah , avi@redhat.com, kvm@vger.kernel.org, Ben-Ami Yassour1 , weidong.han@intel.com, allen.m.kay@intel.com To: Muli Ben-Yehuda Return-path: Received: from ey-out-2122.google.com ([74.125.78.24]:36899 "EHLO ey-out-2122.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751888AbYIWTTx (ORCPT ); Tue, 23 Sep 2008 15:19:53 -0400 Received: by ey-out-2122.google.com with SMTP id 6so654754eyi.37 for ; Tue, 23 Sep 2008 12:19:52 -0700 (PDT) In-Reply-To: <20080923183207.GA6922@il.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: Muli Ben-Yehuda wrote: > On Tue, Sep 23, 2008 at 11:30:32AM -0500, Anthony Liguori wrote: > >>> + + (addr - r_access->e_physbase); >>> + >>> + if (r_access->debug & DEVICE_ASSIGNMENT_DEBUG_PIO) { >>> + fprintf(stderr, "%s: r_pio=%08x e_physbase=%08x" >>> + " r_virtbase=%08lx value=%08x\n", >>> + __func__, r_pio, (int)r_access->e_physbase, >>> + (unsigned long)r_access->r_virtbase, value); >>> + } >>> + iopl(3); >>> + outb(value, r_pio); >>> >>> >> The formatting is wrong for this entire file. Also, you shouldn't >> have device specific debug. Should probably error check iopl(3). >> It's not necessary to call it every time you do an outb, just once >> when initialized. >> > > We tried that at first, but ran into cases where even after iopl() > ran, pio's from qemu still failed. Does qemu do anything to drop > iopl() privileges? In any case calling iopl() unconditionally on every > pio fixed it, but is obviously not the right long-term solution. > Make sure you issue iopl() before any of the VCPU threads are spawned. Otherwise, you may be running into issues when something other than VCPU-0 is doing PIO/MMIO and you haven't iopl()'d for that thread. Regards, Anthony Liguori > Cheers, > Muli >