From patchwork Wed May 17 19:35:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeffrey Hugo X-Patchwork-Id: 95520 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp15514vqo; Wed, 17 May 2023 12:55:03 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6hFTO5ohR0FSf6seLZ0JseCUmKT9XuNDMcBFqDASWzwmzimEt60cbwmnVNiRyteAgE+LBh X-Received: by 2002:a17:90a:3988:b0:253:44e7:9454 with SMTP id z8-20020a17090a398800b0025344e79454mr741722pjb.17.1684353303436; Wed, 17 May 2023 12:55:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684353303; cv=none; d=google.com; s=arc-20160816; b=ZPtCouuSSyH8KmUaBmcEDItDjmH6YqY91OAxhZxVMdIX3a6FqrfDGhtOz1Vl98enRF AAHb+za05MxHXlTCZ2pYpyI1A3eiWE6oopna0D1/QmUNFz+7gVQJIu48aaP2BA/zVAXC JuvpjG6xcC4h+/HP+nZKtinjoa1CdqO3X53Tmd60nDYCoJOBEyrwO/PL41jdQ9Ec3wtu uy5EW19tOq872m1Ri8fax+MZAhhIIoxiDDhMCxBrRsquOEzXKp9S/gPsP4AWycMcDxt3 YnDM8gIlnX5CPZoSI09Me8ANOyOmSrbVchpb1wCm6gcCx51kr9Hvc4rlHURIpkxnIDg+ O3hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=gHILGlaJE+UaeZE4foPSlJJnhuqX775h+9NAo7nH65w=; b=FyyKh7BnjHoxX58Uv/fsvw2qz8FjvDzgxL0cH9qh5Thpx01YmEm1C4c4K0OrQ774gl tpclxb4kDyVuFIh0X+AlcPeuTRrrW8HiZrTJuKY8yjVC3qqM0gcbTHo47biorNhjF46z XHp6ug5JOD9gdWqxQTNydXdhYtsZbWdwCLdvAZu9YEK2iVndoj2H4If6Oynx47SPLlCx LEi7t2DCS46BTLIQKjYuzET7XzNRN++p0ucijGtFXqlMjq2iCaVopFj/ZNEr9I3NUIDH BdQpauDuzMedkEgmmCCNhhcVdzXxEYLVi/C1VehgOxb9FBHtOOF1U65mEE8WxNy5hcNp eokg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Ywul2Pt3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r13-20020a17090aa08d00b002476baf6b4bsi2245564pjp.149.2023.05.17.12.54.49; Wed, 17 May 2023 12:55:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Ywul2Pt3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230131AbjEQTg3 (ORCPT + 99 others); Wed, 17 May 2023 15:36:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229437AbjEQTgW (ORCPT ); Wed, 17 May 2023 15:36:22 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B37A10CF; Wed, 17 May 2023 12:36:19 -0700 (PDT) Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34HJ8khd009468; Wed, 17 May 2023 19:36:09 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=gHILGlaJE+UaeZE4foPSlJJnhuqX775h+9NAo7nH65w=; b=Ywul2Pt3j/TI4rSqz4eaGPTH5Ppwp53Aev3ayV1XM5VQkyCa6BJP9mUZ8c8ulakwp/6T fdW4VZKtjGUZy/s8Ydsl9pRMTv/Vmyzb1Cm4Jb9YxSrwDVuBJKp9mV8eGjPszqQw3An2 9ykyMNjkxnxyWRtz09UgRViNsYLcI2of1LRrXgxfp7aODspLthNXIfaDzMensNRCwrQ5 Y11PlQd6i58tPqvgjTCM0yYE8Ct+8WijEsaMc68fOb6sWovQkkMT72oqDHvmGzGa2fbc QEyf/GFy2Yo/kDTWkN/QvyCXMKao3CWEGrCCBOUbgQ04fO0rlha4a/6XdmoCVpj4isb5 xg== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3qmxyp10gm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 17 May 2023 19:36:09 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 34HJa8Yl030808 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 17 May 2023 19:36:08 GMT Received: from jhugo-lnx.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Wed, 17 May 2023 12:36:07 -0700 From: Jeffrey Hugo To: , , , , , CC: , , , Jeffrey Hugo Subject: [PATCH 2/5] accel/qaic: Validate if BO is sliced before slicing Date: Wed, 17 May 2023 13:35:37 -0600 Message-ID: <20230517193540.14323-3-quic_jhugo@quicinc.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230517193540.14323-1-quic_jhugo@quicinc.com> References: <20230517193540.14323-1-quic_jhugo@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: 0bBVKB2P9Y9feIPoqc79lcoIKyItKPpJ X-Proofpoint-GUID: 0bBVKB2P9Y9feIPoqc79lcoIKyItKPpJ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-17_04,2023-05-17_02,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 priorityscore=1501 impostorscore=0 suspectscore=0 mlxscore=0 bulkscore=0 adultscore=0 lowpriorityscore=0 spamscore=0 clxscore=1015 malwarescore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305170162 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766172449504339438?= X-GMAIL-MSGID: =?utf-8?q?1766172449504339438?= From: Pranjal Ramajor Asha Kanojiya QAIC_ATTACH_SLICE_BO attaches slicing configuration to a BO. Validate if given BO is already sliced. An already sliced BO cannot be sliced again. Fixes: ff13be830333 ("accel/qaic: Add datapath") Signed-off-by: Pranjal Ramajor Asha Kanojiya Reviewed-by: Carl Vanderlip Reviewed-by: Jeffrey Hugo Signed-off-by: Jeffrey Hugo --- drivers/accel/qaic/qaic_data.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/accel/qaic/qaic_data.c b/drivers/accel/qaic/qaic_data.c index 7a4397e3122b..1285c3dc9aef 100644 --- a/drivers/accel/qaic/qaic_data.c +++ b/drivers/accel/qaic/qaic_data.c @@ -1001,6 +1001,11 @@ int qaic_attach_slice_bo_ioctl(struct drm_device *dev, void *data, struct drm_fi bo = to_qaic_bo(obj); + if (bo->sliced) { + ret = -EINVAL; + goto put_bo; + } + ret = qaic_prepare_bo(qdev, bo, &args->hdr); if (ret) goto put_bo;