powerpc/vas: Save configured window credits
authorSukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Wed, 8 Nov 2017 02:23:47 +0000 (18:23 -0800)
committerMichael Ellerman <mpe@ellerman.id.au>
Sat, 11 Nov 2017 22:03:07 +0000 (09:03 +1100)
Save the configured max window credits for a window in the vas_window
structure. We will need this when polling for return of window credits.

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/platforms/powernv/vas-window.c
arch/powerpc/platforms/powernv/vas.h

index 1422cdd7d91798341e4747357231ac92f4fc1acb..a59a187c0cd144431a63dcb8a8c71bd8e1851da9 100644 (file)
@@ -674,7 +674,7 @@ static void init_winctx_for_rxwin(struct vas_window *rxwin,
 
        winctx->rx_fifo = rxattr->rx_fifo;
        winctx->rx_fifo_size = rxattr->rx_fifo_size;
-       winctx->wcreds_max = rxattr->wcreds_max ?: VAS_WCREDS_DEFAULT;
+       winctx->wcreds_max = rxwin->wcreds_max;
        winctx->pin_win = rxattr->pin_win;
 
        winctx->nx_win = rxattr->nx_win;
@@ -844,6 +844,7 @@ struct vas_window *vas_rx_win_open(int vasid, enum vas_cop_type cop,
        rxwin->nx_win = rxattr->nx_win;
        rxwin->user_win = rxattr->user_win;
        rxwin->cop = cop;
+       rxwin->wcreds_max = rxattr->wcreds_max ?: VAS_WCREDS_DEFAULT;
        if (rxattr->user_win)
                rxwin->pid = task_pid_vnr(current);
 
@@ -893,7 +894,7 @@ static void init_winctx_for_txwin(struct vas_window *txwin,
         */
        memset(winctx, 0, sizeof(struct vas_winctx));
 
-       winctx->wcreds_max = txattr->wcreds_max ?: VAS_WCREDS_DEFAULT;
+       winctx->wcreds_max = txwin->wcreds_max;
 
        winctx->user_win = txattr->user_win;
        winctx->nx_win = txwin->rxwin->nx_win;
@@ -978,6 +979,7 @@ struct vas_window *vas_tx_win_open(int vasid, enum vas_cop_type cop,
        txwin->nx_win = txwin->rxwin->nx_win;
        txwin->pid = attr->pid;
        txwin->user_win = attr->user_win;
+       txwin->wcreds_max = attr->wcreds_max ?: VAS_WCREDS_DEFAULT;
 
        init_winctx_for_txwin(txwin, attr, &winctx);
 
index 63e8e037eda03bc7a08e579f883e8e7d23c207b3..02d8a31d9051cf353caaa3f22b5dd1d7c3978950 100644 (file)
@@ -332,6 +332,7 @@ struct vas_window {
        void *hvwc_map;         /* HV window context */
        void *uwc_map;          /* OS/User window context */
        pid_t pid;              /* Linux process id of owner */
+       int wcreds_max;         /* Window credits */
 
        /* Fields applicable only to send windows */
        void *paste_kaddr;