Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp325988pxf; Thu, 18 Mar 2021 00:49:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbLejje9fWsccE5FAKkbqYHvMYBvZ4N3Z17mNByq8H7ymrTr1cEZ5kt+woyY9PLLwn1Etl X-Received: by 2002:a05:6402:270c:: with SMTP id y12mr2048077edd.284.1616053751861; Thu, 18 Mar 2021 00:49:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616053751; cv=none; d=google.com; s=arc-20160816; b=d1NiRVrp2eMdFhI+Y6gRRQr+DO3o7PvvqVuxnJNrS8s3bo0X7MEsjxKLnMSmpIRn5o ghJCpSF9cwASdIxt1zz5qjVWJdAjD73tUDifDDTFzrS3XnxNfzXBSx6l10nyQzhrtYGn RXSum7j93sA90I7djljTmtUwPZC9AguykOc8eZ8qpGXcWIUCHYd6i2021EnlvOuuKS1b k4B/+BXZMssRiw+Is05gdvlLoMn9bUBjs4JKln9GNVLmAlFFjfp/J+JV2UUQfT2aI/t0 00RI+0mWF38c8Tpab/pPP1rK2IXK5Tu+BNUB/1oBJNHHY798LfO8oeNjqrlp12rJp51d 6SYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=KFk2yzdpUpx2SEQ5ZfLDIquZBujqGbaJCD3qryFu/h0=; b=gHW1JVtDzMf21D2cRc7yy48B3d/3nw3F0TP0gRMafMCOohn6x5dhUkb4M3E1P7ikT/ sbB9vYWHlTmgmIC4x+x93zBkgHenkjRJl4LNtFvjWHpDcF3q0hLXHlE7V/xeXH3eZRxn OjgaO2jsFS6l7l67Lf0a8g+pVH0WxfEF3G9Zdpm64ikpAZcgFExDvtlctrFQ8qL/FGRb STaq+W2mbiRNNu6t5KAkxQ1Fnm0bGNoA9nT0FyEJQIqZU38ug/P9Yfy//mNeWFAWTh2X yl/tI0EKB4UhjE2VQo+VsMiQtXSZYR9pW1UhL+52qF0ioMGF/A050KnMFFI1mqBTAcNI shGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="R/TIVuPI"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id da5si984300edb.464.2021.03.18.00.48.49; Thu, 18 Mar 2021 00:49:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="R/TIVuPI"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229564AbhCRHrw (ORCPT + 99 others); Thu, 18 Mar 2021 03:47:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:45448 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229708AbhCRHrp (ORCPT ); Thu, 18 Mar 2021 03:47:45 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 46D1464F38 for ; Thu, 18 Mar 2021 07:47:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616053665; bh=XC3LFglAEZLbOOaRbRogcgjXVbO0jwmOopBAbeoCzrg=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=R/TIVuPI3ayXAehTysn4vGcUayjJWfpJGiHAokqLTeUDcSU3bDgr+RCId1hQvaJf1 hzLuSU7JAVdsdKUhAYfwQBjeD+11gbSjEWKAtD8orc8/LPXIkwGDnSaUZ3a5HiIozh SIyai/k8fFfuoOzhRzA8WEowGcJTy4W18qss/EM0+w4RCE+jmRKMQgXBH18xukCI4j /yURQXHc/gzV2OLj1ALBX5Ruzzvh9VtUkLOYns5YuBMjf8o2BiUQYM0NBgDc17Qew4 1gI4Wxhp8oiL/TszJIKmn7klo4YyKOkZbjcLDfMocIwTM6ewRHvAubb48DHSk+efuu LaAyHKax0276A== Received: by mail-ot1-f44.google.com with SMTP id w21-20020a9d63950000b02901ce7b8c45b4so4362933otk.5 for ; Thu, 18 Mar 2021 00:47:45 -0700 (PDT) X-Gm-Message-State: AOAM531sTwDehugMWC7/Y+k8nJVgk6qqQ0ET00Hl/W8c+oXZAy9Njik5 B06rKtohdG/9g2ey1Hq92kfgPaCe7zxKstZnGOk= X-Received: by 2002:a9d:42c:: with SMTP id 41mr6293768otc.108.1616053664575; Thu, 18 Mar 2021 00:47:44 -0700 (PDT) MIME-Version: 1.0 References: <20210312083653.38780-1-ran.wang_1@nxp.com> <20210317080442.GA3018337@jade> In-Reply-To: From: Ard Biesheuvel Date: Thu, 18 Mar 2021 08:47:33 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] optee: enable apci support To: Ran Wang Cc: Jens Wiklander , "op-tee@lists.trustedfirmware.org" , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 18 Mar 2021 at 08:29, Ran Wang wrote: > > Hi Ard, > > > On Wednesday, March 17, 2021 4:29 PM, Ard Biesheuvel wrote: > > > > On Wed, 17 Mar 2021 at 09:04, Jens Wiklander wrote: > > > > > > On Fri, Mar 12, 2021 at 04:36:53PM +0800, Ran Wang wrote: > > > > This patch add ACPI support for optee driver. > > > > > > > > Signed-off-by: Ran Wang > > > > --- > > > > drivers/tee/optee/core.c | 10 ++++++++++ > > > > 1 file changed, 10 insertions(+) > > > > > > > > diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c > > > > index cf4718c6d35d..8fb261f4b9db 100644 > > > > --- a/drivers/tee/optee/core.c > > > > +++ b/drivers/tee/optee/core.c > > > > @@ -5,6 +5,7 @@ > > > > > > > > #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt > > > > > > > > +#include > > > > #include > > > > #include > > > > #include > > > > @@ -735,12 +736,21 @@ static const struct of_device_id > > > > optee_dt_match[] =3D { }; MODULE_DEVICE_TABLE(of, optee_dt_match)= ; > > > > > > > > +#ifdef CONFIG_ACPI > > > > +static const struct acpi_device_id optee_acpi_match[] =3D { > > > > + { "OPTEE01",}, > > > > You cannot just invent ACPI HIDs like that. The 4 character prefix is a= vendor ID that is assigned by the UEFI forum, the 4 following digits are > > up to the vendor to assign, > > Thanks for this info. Could you please show me where I can find the guide= /example for this assign process? > I think it is better to ask around internally. As far as I know, NXP already owns a ACPI/PNP vendor prefix. > > > > + { }, > > > > +}; > > > > +MODULE_DEVICE_TABLE(acpi, dwc3_acpi_match); > > > > dwc3_acpi_match ?? Does this even build? > > My bad, I was referring dwc3 code as an example, will correct it. > > But looks this typo didn=E2=80=99t trigger error in my unit-test. > Does your build have CONFIG_ACPI enabled? > > > > > > +#endif > > > > + > > > > static struct platform_driver optee_driver =3D { > > > > .probe =3D optee_probe, > > > > .remove =3D optee_remove, > > > > .driver =3D { > > > > .name =3D "optee", > > > > .of_match_table =3D optee_dt_match, > > > > + .acpi_match_table =3D ACPI_PTR(optee_acpi_match), > > > > }, > > > > }; > > > > module_platform_driver(optee_driver); > > > > -- > > > > 2.25.1 > > > > > > > > > > This looks simple enough. Ard, is this what you had in mind earlier? > > > > > > > Not really. > > > > On SynQuacer, we use > > > > Device (TOS0) { > > Name (_HID, "PRP0001") > > Name (_UID, 0x0) > > Name (_DSD, Package () { > > ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), > > Package () { > > Package (2) { "compatible", "linaro,optee-tz" }, > > Package (2) { "method", "smc" }, > > } > > }) > > } > > > > which does not require any changes to Linux. So I don't think this patc= h is needed at all tbh. > > Thanks for this example, but actually I failed to trigger kernel optee pr= obe function by using > above code in ACPI table. > > And I am curious how this 'compatible' properties be picked up by kernel = when try to match driver in ACPI mode? > On SynQuacer, $ cat /sys/devices/platform/PRP0001:00/firmware_node/modalias of:Ntos0TClinaro,optee-tz > My understanding is to get it done by feeding .acpi_match_table with some= thing, right? > The PRP0001 HID is handled in a special way. Please grep the Linux source if you are curious to understand how this is implemented.