[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC v3 PATCH 01/14] Introduce TCGOpcode for memory bar
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [RFC v3 PATCH 01/14] Introduce TCGOpcode for memory barrier |
Date: |
Tue, 21 Jun 2016 09:30:28 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 |
On 18/06/2016 06:03, Pranith Kumar wrote:
> +typedef enum {
> + TCG_MO_LD_LD = 1,
> + TCG_MO_ST_LD = 2,
> + TCG_MO_LD_ST = 4,
> + TCG_MO_ST_ST = 8,
I like the idea of making this a bitmask. However, most of the code you
wrote for the backends looks at these as an enum. For example,
+static inline void tcg_out_mb(TCGContext *s, TCGArg a0)
+{
+ switch (a0 & TCG_MO_ALL) {
+ case TCG_MO_LD_LD:
+ tcg_out32(s, DMB_ISH | DMB_LD);
+ break;
+ case TCG_MO_ST_ST:
+ tcg_out32(s, DMB_ISH | DMB_ST);
+ break;
+ default:
+ tcg_out32(s, DMB_ISH | DMB_LD | DMB_ST);
+ break;
+ }
+}
should rather be
if (a0 & (ST_LD|LD_ST)) {
output dmb ish
return
}
if (a0 & LD_LD) {
output dmb ishld
}
if (a0 & LD_ST) {
output dmb ishst
}
Paolo
> + TCG_MO_ALL = 0xF, // OR of all above
> +} TCGOrder;
> +
> +typedef enum {
> + TCG_BAR_ACQ = 32,
> + TCG_BAR_REL = 64,
> + TCG_BAR_SC = 128,
> +} TCGBar;