From: Marcelo Tosatti <mtosatti@redhat.com>
To: avi@redhat.com
Cc: kvm@vger.kernel.org, Marcelo Tosatti <mtosatti@redhat.com>
Subject: [patch 1/3] kvm test: protect fwfcg accesses with spinlock
Date: Mon, 05 Jul 2010 15:16:09 -0300 [thread overview]
Message-ID: <20100705181654.614344513@amt.cnet> (raw)
In-Reply-To: 20100705181608.720014170@amt.cnet
[-- Attachment #1: 3-8-test-protect-fwcfg-accesses-with-lock.patch --]
[-- Type: text/plain, Size: 795 bytes --]
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Index: qemu-kvm/kvm/user/test/lib/x86/fwcfg.c
===================================================================
--- qemu-kvm.orig/kvm/test/lib/x86/fwcfg.c
+++ qemu-kvm/kvm/test/lib/x86/fwcfg.c
@@ -1,4 +1,7 @@
#include "fwcfg.h"
+#include "smp.h"
+
+static struct spinlock lock;
uint64_t fwcfg_get_u(uint16_t index, int bytes)
{
@@ -6,11 +9,13 @@ uint64_t fwcfg_get_u(uint16_t index, int
uint8_t b;
int i;
+ spin_lock(&lock);
asm volatile ("out %0, %1" : : "a"(index), "d"((uint16_t)BIOS_CFG_IOPORT));
for (i = 0; i < bytes; ++i) {
asm volatile ("in %1, %0" : "=a"(b) : "d"((uint16_t)(BIOS_CFG_IOPORT + 1)));
r |= (uint64_t)b << (i * 8);
}
+ spin_unlock(&lock);
return r;
}
next prev parent reply other threads:[~2010-07-05 18:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-05 18:16 [patch 0/3] [RESEND] kvm test: test rmap chains Marcelo Tosatti
2010-07-05 18:16 ` Marcelo Tosatti [this message]
2010-07-05 18:16 ` [patch 2/3] kvm test: export vm helpers Marcelo Tosatti
2010-07-05 18:16 ` [patch 3/3] kvm test: long rmap chains Marcelo Tosatti
2010-07-06 7:32 ` Avi Kivity
2010-07-06 7:27 ` [patch 0/3] [RESEND] kvm test: test " 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=20100705181654.614344513@amt.cnet \
--to=mtosatti@redhat.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
/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.