Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp441347rdg; Tue, 10 Oct 2023 15:21:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGTnAH+SpIjzbp1tKab6TP6SbtOMheWiMMGaWT7l4eN5QrNzdmYAo5kDINHUFnSGc+DM0SM X-Received: by 2002:a17:903:192:b0:1c7:2e8f:c3b5 with SMTP id z18-20020a170903019200b001c72e8fc3b5mr23345086plg.20.1696976469338; Tue, 10 Oct 2023 15:21:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696976469; cv=none; d=google.com; s=arc-20160816; b=ogdO1YDr9Pe111luoFWjrOqsG7l+gEi0/snr2RV90KcJwAwMsf8UugJlCe42MNW0WH O4BTJJCbToc68z184DuEAyQwDhTqwbaOpY3CPFQpbiboqT+G5rYXA/wNdZ5vuR3kOCwe DN3m4DtpmjIrlLoeDroRUNNkplPEUvnwVNACpdwFFaopZQjoFRcvcrE+KGQTPsLCGWrz +3AI366h3oR0IMbOU/2Sl5ILEeBYdmseRHQtD2Kki7hOqzNx209iv1wDmg/bQ8gkZWX2 bi1pnhQ4sv6J69/9fcqxeMlc9LDr6PgUeAqm1G30h980JgnXbECN3ccyxFoc9Dx5/CZi ucow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=460OD4B2O0RmiKOd3BNdzwTQ6xFcB587G5axsVGpZnA=; fh=4jyF2ZUBQ/SiJHAfGoV+niA288FYUMeb6Ahk+NIw7Pw=; b=feNdoEvC0Qvixt3WTT6Qv2MJ9F8TmyY5bUKOgarvtpnQnyoal5iRNKPRLJkjgC4XNu 9IICxZ2i0I5mkia9KFEE3GsGf5pFIR+ai6CvdEKFTc8MFBye4XM9dH3Jg9gfW42NSDtk u/2a2LfGwtmH/Kz5+BVYQfGt1VWzHkmcq5pPXQC191QC5ElQNZJWNyfnQwjQnNaqfewH 3n+c8NLX40+hg/jH72vdO/rf8KKpM8E1WXdQo0Y3dxB6U9yjhGInon3+m0Buxfdh9J/4 FWCOWYpD5Q38rPygj6MV7DtcJgyItExtLfmkZ+WZLd0tux99JYrKrijC7SnWpiejPq4s W2wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NbevVtDa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id le7-20020a170902fb0700b001c724cd1128si3796476plb.276.2023.10.10.15.21.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 15:21:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NbevVtDa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 0475680E6C64; Tue, 10 Oct 2023 15:21:07 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229932AbjJJWUM (ORCPT + 99 others); Tue, 10 Oct 2023 18:20:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229542AbjJJWUL (ORCPT ); Tue, 10 Oct 2023 18:20:11 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BA898F for ; Tue, 10 Oct 2023 15:19:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696976358; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=460OD4B2O0RmiKOd3BNdzwTQ6xFcB587G5axsVGpZnA=; b=NbevVtDa8OSyMB9t6lV+5Wkr8iDl2Pd1I/2fpiyDJrFynzMroP8Ayq+gKzDV3t35uHTpDN ms/L3+hEuI7GuPB5hl7p6au9A2FboCm5b74lTLh8znGcOdZ/eUhpasGTtFcXySR4cSaArI XWsSt8bN+QU7IUAIHKHYbKdYX7MS/jo= Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-91-8Uc8q7OEOkOqOQ6DuYSNZQ-1; Tue, 10 Oct 2023 18:19:07 -0400 X-MC-Unique: 8Uc8q7OEOkOqOQ6DuYSNZQ-1 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-775869cf2f5so48639785a.1 for ; Tue, 10 Oct 2023 15:19:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696976347; x=1697581147; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=460OD4B2O0RmiKOd3BNdzwTQ6xFcB587G5axsVGpZnA=; b=J1YJuuDOJhLDUUCkmKaN54lTyv1jH+i5rRiN3TCphdjNvdWktLUjU223xIwjf4SgAL tyW20UzxT0WOGHZUV4ZtccCn1cJgbEgbEMUmMMe4EN6xQ1PYupAlF7jb3+BQ5k0V8Lqx 7Pnwe0pfspLNZk2nL1rQNGQ6uHQKJ6Xq0PoZvDDWhc3E6CB0TqzHKpdiDoVXFMYQxfm1 xhgq7b77TvRt4L3BCuVu7Kx+thLWeRz9AEGxxElzwwIBx/AEaIGK6Hs0S3WpVYMEgGZp mwVMRUGU/tY5k/JlsWOll2NB2TN64+207YIcdjMDiZJYbAC3fKErtV0YYxsleXTSUdhP jglg== X-Gm-Message-State: AOJu0YyS4RvYC4QHJOmtDJmbGqBxnwRptfVz/mbxgy7OFF4t5CKgEi2T qHIW3kd0XBds4cslaUjSdZgEx6vzUT4L83mgqwCvwIKbxfMRDcig/LUhzZkrlE0GUpR9ksPXGzg 3smXV5rqTuRCSVlNy6TjnISjh X-Received: by 2002:a05:620a:3725:b0:76c:a911:f74f with SMTP id de37-20020a05620a372500b0076ca911f74fmr26760440qkb.27.1696976346906; Tue, 10 Oct 2023 15:19:06 -0700 (PDT) X-Received: by 2002:a05:620a:3725:b0:76c:a911:f74f with SMTP id de37-20020a05620a372500b0076ca911f74fmr26760424qkb.27.1696976346651; Tue, 10 Oct 2023 15:19:06 -0700 (PDT) Received: from fedora ([2600:1700:1ff0:d0e0::37]) by smtp.gmail.com with ESMTPSA id k26-20020a05620a143a00b007758b25ac3bsm4699190qkj.82.2023.10.10.15.19.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 15:19:06 -0700 (PDT) Date: Tue, 10 Oct 2023 17:19:04 -0500 From: Andrew Halaney To: Bartosz Golaszewski Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Elliot Berman , Krzysztof Kozlowski , Guru Das Srinagesh , Maximilian Luz , Alex Elder , Srini Kandagatla , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel@quicinc.com, Bartosz Golaszewski Subject: Re: [PATCH v3 07/15] firmware: qcom: scm: make qcom_scm_assign_mem() use the TZ allocator Message-ID: References: <20231009153427.20951-1-brgl@bgdev.pl> <20231009153427.20951-8-brgl@bgdev.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231009153427.20951-8-brgl@bgdev.pl> X-Spam-Status: No, score=2.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Tue, 10 Oct 2023 15:21:07 -0700 (PDT) X-Spam-Level: ** On Mon, Oct 09, 2023 at 05:34:19PM +0200, Bartosz Golaszewski wrote: > From: Bartosz Golaszewski > > Let's use the new TZ memory allocator to obtain a buffer for this call > instead of using dma_alloc_coherent(). > > Signed-off-by: Bartosz Golaszewski > --- > drivers/firmware/qcom/qcom_scm.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/drivers/firmware/qcom/qcom_scm.c b/drivers/firmware/qcom/qcom_scm.c > index 71e98b666391..754f6056b99f 100644 > --- a/drivers/firmware/qcom/qcom_scm.c > +++ b/drivers/firmware/qcom/qcom_scm.c > @@ -4,6 +4,7 @@ > */ > > #include > +#include > #include > #include > #include > @@ -998,14 +999,13 @@ int qcom_scm_assign_mem(phys_addr_t mem_addr, size_t mem_sz, > struct qcom_scm_mem_map_info *mem_to_map; > phys_addr_t mem_to_map_phys; > phys_addr_t dest_phys; > - dma_addr_t ptr_phys; > + phys_addr_t ptr_phys; > size_t mem_to_map_sz; > size_t dest_sz; > size_t src_sz; > size_t ptr_sz; > int next_vm; > __le32 *src; > - void *ptr; nit: couldn't you keep this up here? Otherwise, Reviewed-by: Andrew Halaney > int ret, i, b; > u64 srcvm_bits = *srcvm; > > @@ -1015,10 +1015,13 @@ int qcom_scm_assign_mem(phys_addr_t mem_addr, size_t mem_sz, > ptr_sz = ALIGN(src_sz, SZ_64) + ALIGN(mem_to_map_sz, SZ_64) + > ALIGN(dest_sz, SZ_64); > > - ptr = dma_alloc_coherent(__scm->dev, ptr_sz, &ptr_phys, GFP_KERNEL); > + void *ptr __free(qcom_tzmem) = qcom_tzmem_alloc(__scm->mempool, > + ptr_sz, GFP_KERNEL); > if (!ptr) > return -ENOMEM; > > + ptr_phys = qcom_tzmem_to_phys(ptr); > + > /* Fill source vmid detail */ > src = ptr; > i = 0; > @@ -1047,7 +1050,6 @@ int qcom_scm_assign_mem(phys_addr_t mem_addr, size_t mem_sz, > > ret = __qcom_scm_assign_mem(__scm->dev, mem_to_map_phys, mem_to_map_sz, > ptr_phys, src_sz, dest_phys, dest_sz); > - dma_free_coherent(__scm->dev, ptr_sz, ptr, ptr_phys); > if (ret) { > dev_err(__scm->dev, > "Assign memory protection call failed %d\n", ret); > -- > 2.39.2 >