Skip to content

Commit

Permalink
powerpc/vas: Use helper to unpin/close window
Browse files Browse the repository at this point in the history
Use a helper to have the hardware unpin and mark a window closed.

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
  • Loading branch information
Sukadev Bhattiprolu authored and Michael Ellerman committed Nov 11, 2017
1 parent 4963ac3 commit 36a288f
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions arch/powerpc/platforms/powernv/vas-window.c
Original file line number Diff line number Diff line change
Expand Up @@ -1100,6 +1100,20 @@ static void poll_window_castout(struct vas_window *window)
/* stub for now */
}

/*
* Unpin and close a window so no new requests are accepted and the
* hardware can evict this window from cache if necessary.
*/
static void unpin_close_window(struct vas_window *window)
{
u64 val;

val = read_hvwc_reg(window, VREG(WINCTL));
val = SET_FIELD(VAS_WINCTL_PIN, val, 0);
val = SET_FIELD(VAS_WINCTL_OPEN, val, 0);
write_hvwc_reg(window, VREG(WINCTL), val);
}

/*
* Close a window.
*
Expand All @@ -1114,8 +1128,6 @@ static void poll_window_castout(struct vas_window *window)
*/
int vas_win_close(struct vas_window *window)
{
u64 val;

if (!window)
return 0;

Expand All @@ -1131,11 +1143,7 @@ int vas_win_close(struct vas_window *window)

poll_window_busy_state(window);

/* Unpin window from cache and close it */
val = read_hvwc_reg(window, VREG(WINCTL));
val = SET_FIELD(VAS_WINCTL_PIN, val, 0);
val = SET_FIELD(VAS_WINCTL_OPEN, val, 0);
write_hvwc_reg(window, VREG(WINCTL), val);
unpin_close_window(window);

poll_window_castout(window);

Expand Down

0 comments on commit 36a288f

Please sign in to comment.