Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp8844490ybi; Tue, 23 Jul 2019 16:33:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqxD8s1p/oQl7MEeO4XbRsMzwuNvpNNt0isi3GrePaQZdS8uh+8iNW4JLHVNOgglp9p2Ul7Y X-Received: by 2002:aa7:8e10:: with SMTP id c16mr7966451pfr.124.1563924825964; Tue, 23 Jul 2019 16:33:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563924825; cv=none; d=google.com; s=arc-20160816; b=Z3CIXGrN3ZhrPLZAOFrJkPNcsb2ycqR+e35bB9GuVBHsx5Wo19D1YExzChqSnajusb sr71Y5RxTV8sL/l2l3pX2ui6X0lbXXIuAqKygfKfqQE9oo9bR5/SzKvMgtVKvkeyijHt CNapi1Gq04255YMSAzkSLNu5hFj9mDvmdkGSM0DbOZ5KzWKL5Vtb1L/c1l33M2dg/SNM gBtYoWwJpbTPv4a8qgc+cUsUhj4jMq5yTBDptrr4UZ1jKdudIT3T5nbWIvS3tWthBM+E 6I+kNaFtEz28QNoIUYKOkSmDYEBZXyZutIYN8bLyB+x2wUIshq0j6w0rHs52PIr9aoyR gxFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=chWP9LaVBb836yc/U3pqKBmIvWdwOkmxAAs2bRxtFvw=; b=R3YcXnXFL6wLfcFLH1/MC1PES/5W8aL6U9358Rg2wSSHqzXAw3Vw+rRdHn03vbogZd bpMg7s1JIxLsgNJmc+KWlu6KrYQ/FPJhH0TomlBLnPVQcA/1DeTffpyRiWkiHKZfeXIB wngaWbp6j76m/g9mPkerKeArU1ejIfxUYdKgMgJPEF2y27dFCllqho2+TVEJUe0HDdAC +Q7Bi6EaEaYD9Fa5iCAHs0njZB8jUXc0kelJEyW0q4NIM3fy//7EwPGSEX5f8rPLCAPf TRiOAd+DopIkesxl7E9NU1+T9w+e23eGP4AXMO5AimAxNQRLVt8v3c2pkJkZlSH7MdDk BO2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=EPi3Dkd8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h8si13544846pgc.402.2019.07.23.16.33.30; Tue, 23 Jul 2019 16:33:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=EPi3Dkd8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390214AbfGWN23 (ORCPT + 99 others); Tue, 23 Jul 2019 09:28:29 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:43178 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731095AbfGWN23 (ORCPT ); Tue, 23 Jul 2019 09:28:29 -0400 Received: by mail-pg1-f193.google.com with SMTP id f25so19430511pgv.10; Tue, 23 Jul 2019 06:28:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=chWP9LaVBb836yc/U3pqKBmIvWdwOkmxAAs2bRxtFvw=; b=EPi3Dkd8v/VtsrHLzX7ap6XGP0FBARnBudXPyGak7HIGeeP0DQgP6QZo/or50iOxWk 09AytT6G0LogTTAUQbor/BUlMSMnqGu61cebV9+w6PdxzSFzlK+tp3YM0kzYX3g1e1jb hEm/pPKQSC37mc2D1XXRyiLL0bOtsRym7zdxgypStpQDNns7vODvU00shptG9Ice8fO+ dden0FhCoJmuUx7zPLkQsf9uZWCEs7V51R3V51gLc13ATPBtoQ7gS1u9Aia52jX0VjeI KXBMe7urT0Y4/phuJaqXKlQBiD5bdnVxdg/NMRnEe3h8QsXx/UUXLrEmC6jhNta8TZjX 064Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=chWP9LaVBb836yc/U3pqKBmIvWdwOkmxAAs2bRxtFvw=; b=BXIo8oaNtJTrkwVnONpR/H8yF+8dUi9bXTXUO6HIFBS7IP8HvNfAXLOmHZx68TS0qu KxK0zYXzOLfBb+dWoeF87/1aBeUPLKNnEPx5CwQV+Vwg/KvVz7xYdtZkj+rk2gS13cCH Sewp7G3KN9bkCgPDlSOqrFy3ZZDDVl72U3AAamHPcMxnDRjUSS0hnpkcfJBewavvNBRj ZigkqpUk4yZfEVulx7EthOUWyO/27FLLlTjXyfvqjo6AtHwWSGho44uPasYWyqSEOVAU ipS3tUXdg9FNXA7/dB9lIuLU+4pfS4WhA429u155sMBzqu64ovvxYC3CL0N8ACF9aw6P zWhQ== X-Gm-Message-State: APjAAAVRXMJQ942+wmLQrT1xsIuCPoMGHOVoPLxVmF8jkx6ni8hRdzRh Ju9xRAGQtoOGwOIgaTfKJ98= X-Received: by 2002:a63:c84d:: with SMTP id l13mr71688713pgi.154.1563888508740; Tue, 23 Jul 2019 06:28:28 -0700 (PDT) Received: from localhost ([123.213.206.190]) by smtp.gmail.com with ESMTPSA id h1sm53656426pfo.152.2019.07.23.06.28.27 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Jul 2019 06:28:27 -0700 (PDT) Date: Tue, 23 Jul 2019 22:28:25 +0900 From: Minwoo Im To: Bjorn Andersson Cc: Christoph Hellwig , Marc Gonzalez , MSM , LKML , Andy Gross , Stanimir Varbanov , Rob Clark , Stephen Boyd , Minwoo Im Subject: Re: [PATCH] firmware: qcom_scm: fix error for incompatible pointer Message-ID: <20190723132825.GA7148@minwoo-desktop> References: <20190719134303.7617-1-minwoo.im.dev@gmail.com> <7ea51e42-ab8a-e4e2-1833-651e2dabca3c@free.fr> <20190722093059.GA29538@lst.de> <20190722151234.GJ7234@tuxbook-pro> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190722151234.GJ7234@tuxbook-pro> User-Agent: Mutt/1.11.4 (2019-03-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > > > We just can cast phys_addr_t to dma_addr_t here. > > > > > > IME, casting is rarely a proper solution. > > > > *nod* > > > > ptr_phys probably should be a dma_addr_t. Unless this driver is so > > magic that it really wants a physical and not a dma address, in which > > case it needs to use alloc_pages instead of dma_alloc_coherent > > and then call page_to_phys on the returned page, and a very big comment > > explaining why it is so special. > > The scm call takes physical addresses (which happens to be 1:1 with DMA > addresses for this driver). > > This allocation started off (downstream) as a simple kmalloc(), but > while the scm call is being executed an access from Linux will cause a > security violation (that's not handled gracefully). The properties of > dma_alloc is closer, so that's where the code is today. > > Optimally this should be something like alloc_pages() and some mechanism > for unmapping the pages during the call. But no one has come up with a > suitable patch for that. > > > But there's a patch from Stephen for this already (not doing a > typecast). Apparently I missed merging this, so I'll do that. > > https://lore.kernel.org/linux-arm-msm/20190517210923.202131-2-swboyd@chromium.org/ Bjron, I appreciate for checking this. And also thanks all you guys for the comments here! Thanks,