Skip to content

Commit 439b19e

Browse files
ozbenhstewartsmith
authored andcommitted
xive: Move xive_cpu_state up and clean up layout
This contains both fields used generally by XIVE for physical processors (including in exploitation mode) such as the reference to the physical VPs, and fields specific to the XICS emulation code. Make them separate and rename eqidx to eqptr as "idx" generally represent structure indices inside of VSDs and we are soon going to introduce an eq_idx field. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
1 parent a16cb0d commit 439b19e

File tree

1 file changed

+32
-26
lines changed

1 file changed

+32
-26
lines changed

hw/xive.c

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,30 @@ struct xive_src {
246246
uint32_t flags;
247247
};
248248

249+
struct xive_cpu_state {
250+
struct xive *xive;
251+
void *tm_ring1;
252+
253+
/* Base HW VP */
254+
uint32_t vp_blk;
255+
uint32_t vp_idx;
256+
257+
/* Pre-allocated IPI */
258+
uint32_t ipi_irq;
259+
260+
/* Use for XICS emulation */
261+
struct lock lock;
262+
uint8_t cppr;
263+
uint8_t mfrr;
264+
uint8_t pending;
265+
uint8_t prev_cppr;
266+
uint32_t *eqbuf;
267+
uint32_t eqptr;
268+
uint32_t eqmsk;
269+
uint8_t eqgen;
270+
void *eqmmio;
271+
};
272+
249273
struct xive {
250274
uint32_t chip_id;
251275
uint32_t block_id;
@@ -1957,24 +1981,6 @@ static void init_one_xive(struct dt_node *np)
19571981
/*
19581982
* XICS emulation
19591983
*/
1960-
struct xive_cpu_state {
1961-
struct xive *xive;
1962-
void *tm_ring1;
1963-
uint32_t vp_blk;
1964-
uint32_t vp_idx;
1965-
struct lock lock;
1966-
uint8_t cppr;
1967-
uint8_t mfrr;
1968-
uint8_t pending;
1969-
uint8_t prev_cppr;
1970-
uint32_t *eqbuf;
1971-
uint32_t eqidx;
1972-
uint32_t eqmsk;
1973-
uint8_t eqgen;
1974-
void *eqmmio;
1975-
uint32_t ipi_irq;
1976-
};
1977-
19781984
static void xive_ipi_init(struct xive *x, struct cpu_thread *cpu)
19791985
{
19801986
struct xive_cpu_state *xs = cpu->xstate;
@@ -2092,7 +2098,7 @@ static void xive_init_cpu(struct cpu_thread *c)
20922098

20932099
/* XXX Find the one eq buffer associated with the VP, for now same BLK/ID */
20942100
xs->eqbuf = xive_get_eq_buf(x, xs->vp_blk, xs->vp_idx);
2095-
xs->eqidx = 0;
2101+
xs->eqptr = 0;
20962102
xs->eqmsk = (0x10000/4) - 1;
20972103
xs->eqgen = false;
20982104
xs->eqmmio = x->eq_mmio + xs->vp_idx * 0x20000;
@@ -2134,17 +2140,17 @@ static uint32_t xive_read_eq(struct xive_cpu_state *xs, bool just_peek)
21342140

21352141
xive_cpu_vdbg(this_cpu(), " EQ %s... IDX=%x MSK=%x G=%d\n",
21362142
just_peek ? "peek" : "read",
2137-
xs->eqidx, xs->eqmsk, xs->eqgen);
2138-
cur = xs->eqbuf[xs->eqidx];
2143+
xs->eqptr, xs->eqmsk, xs->eqgen);
2144+
cur = xs->eqbuf[xs->eqptr];
21392145
xive_cpu_vdbg(this_cpu(), " cur: %08x [%08x %08x %08x ...]\n", cur,
2140-
xs->eqbuf[(xs->eqidx + 1) & xs->eqmsk],
2141-
xs->eqbuf[(xs->eqidx + 2) & xs->eqmsk],
2142-
xs->eqbuf[(xs->eqidx + 3) & xs->eqmsk]);
2146+
xs->eqbuf[(xs->eqptr + 1) & xs->eqmsk],
2147+
xs->eqbuf[(xs->eqptr + 2) & xs->eqmsk],
2148+
xs->eqbuf[(xs->eqptr + 3) & xs->eqmsk]);
21432149
if ((cur >> 31) == xs->eqgen)
21442150
return 0;
21452151
if (!just_peek) {
2146-
xs->eqidx = (xs->eqidx + 1) & xs->eqmsk;
2147-
if (xs->eqidx == 0)
2152+
xs->eqptr = (xs->eqptr + 1) & xs->eqmsk;
2153+
if (xs->eqptr == 0)
21482154
xs->eqgen = !xs->eqgen;
21492155
}
21502156
return cur & 0x00ffffff;

0 commit comments

Comments
 (0)