From: Gleb Natapov <gleb@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Glauber Costa <glommer@redhat.com>, kvm@vger.kernel.org, avi@redhat.com
Subject: Re: [PATCH v2 5/6] remove kvm_specific kvm_out* functions
Date: Thu, 23 Jul 2009 08:47:58 +0300 [thread overview]
Message-ID: <20090723054758.GA7928@redhat.com> (raw)
In-Reply-To: <20090722195028.GA8621@amt.cnet>
On Wed, Jul 22, 2009 at 04:50:28PM -0300, Marcelo Tosatti wrote:
> Gleb,
>
> Can you please review this to make sure the handling in acpi.c
> is correct and complete?
>
The handling in acpi.c is the same except this bit:
case 0: {
cpu_outb(0, 0xb3, 0);
break;
But this doesn't make sense according to a spec and if it is needed
(which I doubt) it should be handled in acpi.c too.
> On Tue, Jul 21, 2009 at 06:13:11PM -0400, Glauber Costa wrote:
> > As example of what was already done with inb.
> > This is a little bit more tricky, because of SMM, but those
> > bits are handled directly in apic anyway.
> >
> > Signed-off-by: Glauber Costa <glommer@redhat.com>
> > ---
> > qemu-kvm.c | 60 +++---------------------------------------------------------
> > 1 files changed, 3 insertions(+), 57 deletions(-)
> >
> > diff --git a/qemu-kvm.c b/qemu-kvm.c
> > index cef522d..0724c28 100644
> > --- a/qemu-kvm.c
> > +++ b/qemu-kvm.c
> > @@ -95,55 +95,6 @@ static int kvm_debug(void *opaque, void *data,
> > }
> > #endif
> >
> > -#define PM_IO_BASE 0xb000
> > -
> > -static int kvm_outb(void *opaque, uint16_t addr, uint8_t data)
> > -{
> > - if (addr == 0xb2) {
> > - switch (data) {
> > - case 0: {
> > - cpu_outb(0, 0xb3, 0);
> > - break;
> > - }
> > - case 0xf0: {
> > - unsigned x;
> > -
> > - /* enable acpi */
> > - x = cpu_inw(0, PM_IO_BASE + 4);
> > - x &= ~1;
> > - cpu_outw(0, PM_IO_BASE + 4, x);
> > - break;
> > - }
> > - case 0xf1: {
> > - unsigned x;
> > -
> > - /* enable acpi */
> > - x = cpu_inw(0, PM_IO_BASE + 4);
> > - x |= 1;
> > - cpu_outw(0, PM_IO_BASE + 4, x);
> > - break;
> > - }
> > - default:
> > - break;
> > - }
> > - return 0;
> > - }
> > - cpu_outb(0, addr, data);
> > - return 0;
> > -}
> > -
> > -static int kvm_outw(void *opaque, uint16_t addr, uint16_t data)
> > -{
> > - cpu_outw(0, addr, data);
> > - return 0;
> > -}
> > -
> > -static int kvm_outl(void *opaque, uint16_t addr, uint32_t data)
> > -{
> > - cpu_outl(0, addr, data);
> > - return 0;
> > -}
> > -
> > int kvm_mmio_read(void *opaque, uint64_t addr, uint8_t *data, int len)
> > {
> > cpu_physical_memory_rw(addr, data, len, 0);
> > @@ -825,14 +776,12 @@ static int handle_io(kvm_vcpu_context_t vcpu)
> > struct kvm_run *run = vcpu->run;
> > kvm_context_t kvm = vcpu->kvm;
> > uint16_t addr = run->io.port;
> > - int r;
> > int i;
> > void *p = (void *)run + run->io.data_offset;
> >
> > for (i = 0; i < run->io.count; ++i) {
> > switch (run->io.direction) {
> > case KVM_EXIT_IO_IN:
> > - r = 0;
> > switch (run->io.size) {
> > case 1:
> > *(uint8_t *)p = cpu_inb(kvm->opaque, addr);
> > @@ -851,16 +800,13 @@ static int handle_io(kvm_vcpu_context_t vcpu)
> > case KVM_EXIT_IO_OUT:
> > switch (run->io.size) {
> > case 1:
> > - r = kvm_outb(kvm->opaque, addr,
> > - *(uint8_t *)p);
> > + cpu_outb(kvm->opaque, addr, *(uint8_t *)p);
> > break;
> > case 2:
> > - r = kvm_outw(kvm->opaque, addr,
> > - *(uint16_t *)p);
> > + cpu_outw(kvm->opaque, addr, *(uint16_t *)p);
> > break;
> > case 4:
> > - r = kvm_outl(kvm->opaque, addr,
> > - *(uint32_t *)p);
> > + cpu_outl(kvm->opaque, addr, *(uint32_t *)p);
> > break;
> > default:
> > fprintf(stderr, "bad I/O size %d\n", run->io.size);
> > --
> > 1.6.2.2
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe kvm" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Gleb.
next prev parent reply other threads:[~2009-07-23 5:48 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-21 22:13 [PATCH v2 0/6] Glauber Costa
2009-07-21 22:13 ` [PATCH v2 1/6] remove kvm_in* functions Glauber Costa
2009-07-21 22:13 ` [PATCH v2 2/6] reuse env stop and stopped states Glauber Costa
2009-07-21 22:13 ` [PATCH v2 3/6] remove kvm_abi variable Glauber Costa
2009-07-21 22:13 ` [PATCH v2 4/6] remove created from kvm_state Glauber Costa
2009-07-21 22:13 ` [PATCH v2 5/6] remove kvm_specific kvm_out* functions Glauber Costa
2009-07-21 22:13 ` [PATCH v2 6/6] remove kvm_mmio_read and kvm_mmio_write Glauber Costa
2009-07-25 15:24 ` Marcelo Tosatti
2009-07-27 17:47 ` Glauber Costa
2009-07-22 19:50 ` [PATCH v2 5/6] remove kvm_specific kvm_out* functions Marcelo Tosatti
2009-07-23 5:47 ` Gleb Natapov [this message]
2009-07-22 19:51 ` [PATCH v2 3/6] remove kvm_abi variable Marcelo Tosatti
2009-07-27 15:43 ` [PATCH v2 2/6] reuse env stop and stopped states Avi Kivity
2009-07-28 0:48 ` Glauber Costa
2009-07-28 6:17 ` Avi Kivity
2009-07-28 6:24 ` Gleb Natapov
2009-07-28 6:28 ` Avi Kivity
2009-07-28 6:29 ` Gleb Natapov
2009-07-28 6:31 ` Avi Kivity
2009-07-28 13:45 ` Avi Kivity
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090723054758.GA7928@redhat.com \
--to=gleb@redhat.com \
--cc=avi@redhat.com \
--cc=glommer@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.