summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2009-12-02 12:58:14 +0200
committerAvi Kivity <avi@redhat.com>2009-12-02 12:58:14 +0200
commit41efb9b5532a76ddad1344ae83c963095af2c2ca (patch)
treea260c3648cf9131bfd4383e2785812736f795e12 /cpu-all.h
parentMerge commit 'b0293e54af32bcf08f4b4e5b4b472534de343972' into upstream-merge (diff)
parentmsix: clear pending bit of an unused vector (diff)
downloadqemu-kvm-41efb9b5532a76ddad1344ae83c963095af2c2ca.tar.gz
qemu-kvm-41efb9b5532a76ddad1344ae83c963095af2c2ca.tar.bz2
qemu-kvm-41efb9b5532a76ddad1344ae83c963095af2c2ca.zip
Merge commit '98304c846d8866dae6322ef400ce6595b23cfc41' into upstream-merge
* commit '98304c846d8866dae6322ef400ce6595b23cfc41': (33 commits) msix: clear pending bit of an unused vector msix: fix reset value for enable bit msix: fix mask bit state after reset virtio: do not reset msix state on soft reset msix: add helper to unuse all msix entries pci: convert goto into scope in bridge_filter pci: pci bridge related clean up. pci: fix pci_config_get_io_base(). pci: remove magic number, 256 in pci.c pci: split up up pci_update mappings pci: clean up of pci_update_mappings() pci: remove unused constants pci: move typedef, PCIHostState, PCIExpressHost to qemu-common.h. pci: remove some unnecessary comment in pci.h pci: clean up of pci_init_wmask(). pci: kill unnecessary included in pci.c pci_host: remove unnecessary & 0xff. pci: s/pci_find_host_bus/pci_find_root_bus/g pci: remove pci_sub_bus() by open coding. pci: shorten pci_host_{conf, data}_register_xxx function a bit. ... Conflicts: hw/msix.c Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'cpu-all.h')
-rw-r--r--cpu-all.h27
1 files changed, 18 insertions, 9 deletions
diff --git a/cpu-all.h b/cpu-all.h
index 93000ffd2..0321c30c0 100644
--- a/cpu-all.h
+++ b/cpu-all.h
@@ -1018,24 +1018,33 @@ static inline int64_t cpu_get_real_ticks (void)
#endif
}
-#elif defined(__mips__)
+#elif (defined(__mips_isa_rev) && __mips_isa_rev >= 2) || defined(__linux__)
+/*
+ * binutils wants to use rdhwr only on mips32r2
+ * but as linux kernel emulate it, it's fine
+ * to use it.
+ *
+ */
+#define MIPS_RDHWR(rd, value) { \
+ __asm__ __volatile__ ( \
+ ".set push\n\t" \
+ ".set mips32r2\n\t" \
+ "rdhwr %0, "rd"\n\t" \
+ ".set pop" \
+ : "=r" (value)); \
+}
static inline int64_t cpu_get_real_ticks(void)
{
-#if defined(__mips_isa_rev) && __mips_isa_rev >= 2
+/* On kernels >= 2.6.25 rdhwr <reg>, $2 and $3 are emulated */
uint32_t count;
static uint32_t cyc_per_count = 0;
if (!cyc_per_count)
- __asm__ __volatile__("rdhwr %0, $3" : "=r" (cyc_per_count));
+ MIPS_RDHWR("$3", cyc_per_count);
- __asm__ __volatile__("rdhwr %1, $2" : "=r" (count));
+ MIPS_RDHWR("$2", count);
return (int64_t)(count * cyc_per_count);
-#else
- /* FIXME */
- static int64_t ticks = 0;
- return ticks++;
-#endif
}
#else