diff options
author | Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> | 2017-11-07 18:23:42 -0800 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2017-11-12 09:03:05 +1100 |
commit | 51b537124fc24074aee67cae9ca94ec4d9c204fc (patch) | |
tree | f4cd2e48f6d3e2e798d617c2ba64497845121d94 /arch/powerpc/platforms/powernv/vas-window.c | |
parent | e34917fbee1226144c94413697ddbf2d5b06d0d3 (diff) |
powerpc/vas: Validate window credits
NX-842, the only user of VAS, sets the window credits to default values
but VAS should check the credits against the possible max values.
The VAS_WCREDS_MIN is not needed and can be dropped.
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/platforms/powernv/vas-window.c')
-rw-r--r-- | arch/powerpc/platforms/powernv/vas-window.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/powernv/vas-window.c b/arch/powerpc/platforms/powernv/vas-window.c index cec7ab7119df..a2fe120ac06d 100644 --- a/arch/powerpc/platforms/powernv/vas-window.c +++ b/arch/powerpc/platforms/powernv/vas-window.c @@ -738,6 +738,9 @@ static bool rx_win_args_valid(enum vas_cop_type cop, if (attr->rx_fifo_size > VAS_RX_FIFO_SIZE_MAX) return false; + if (attr->wcreds_max > VAS_RX_WCREDS_MAX) + return false; + if (attr->nx_win) { /* cannot be fault or user window if it is nx */ if (attr->fault_win || attr->user_win) @@ -927,6 +930,9 @@ static bool tx_win_args_valid(enum vas_cop_type cop, if (cop > VAS_COP_TYPE_MAX) return false; + if (attr->wcreds_max > VAS_TX_WCREDS_MAX) + return false; + if (attr->user_win && (cop != VAS_COP_TYPE_FTW || attr->rsvd_txbuf_count)) return false; |