From nobody Mon Jun 19 18:57:43 2023 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4QlJtN0G6Nz4fRFJ for ; Mon, 19 Jun 2023 18:57:48 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QlJtM5TvTz4KbW for ; Mon, 19 Jun 2023 18:57:47 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1b53e1cd0ffso13321285ad.0 for ; Mon, 19 Jun 2023 11:57:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687201066; x=1689793066; h=to:references:message-id:cc:date:in-reply-to:from:subject :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=m7xd+MOkvKAlGKEc6m4lyBFxp75vopMR4FJd9wCpzZU=; b=e0/d97EROgbFufksTwoy6WfTAJCQSlNTHaziGPFcg0FqDHHN5ZHiHhlFxoFhwp8uMO RR30d1p2ngS2ZsYPUAcMLqCbQgO+q7t1rLi1lVOoSOfANQdhk+dptqUfdjDZw4PMw7fk 4rlh3ahD6p3P3QG1Eshqof/e3nV5ySyZyj7q5seZyQQ4yV7RjouIK8jNwgvKe/Qe7urs L8xtyX1cBdZqp/iZ4wEcyzFOrZfNNBV5kBBIsExq4DZS/CsEm6ulRsSr8tgnHTPkN3/p 35+dBTorbRFESilh8FSBBsU2FFaQDPIytZ4HYOkja4GbE77EDrAONtoDVS1pIL9ypZ+E ylJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687201066; x=1689793066; h=to:references:message-id:cc:date:in-reply-to:from:subject :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=m7xd+MOkvKAlGKEc6m4lyBFxp75vopMR4FJd9wCpzZU=; b=YtVpw2XPixddAAkkwBFBef5xZOLNk4vQKUxARkKoAYxIQGWUmiLDk5AA/6tjvKTasl igop1yIQ2aR8wTDn9uyjCDFmU6zO9150BFdenCX02OBfuIP/m+8ToaNUNPRmZAjtxEOU 0q8gUSFDF9AKGBoZTiB0S7whQWfhfItwuMGBJOY2Id/uaGLKsvGmpCOteiCWOwVsSt83 o3liE5FpAgOBnvl5yxOLvGbGeay6daG4rjC3WbZyJKgNK2sQWhahDjlLRAdTB+LLUDb9 hJ8SqCowsdJlS4gmNVSE2cDEX/1eseu1xVs18Jm88JEWLFw3aOTLI9eGtiM+raXnrkf/ juRA== X-Gm-Message-State: AC+VfDzBRQSzheDiEe34CvO66JTGqry78CJsoa10RshbEvOHjD0IL/PJ J9QeJ73FQWJzlA/sHl1EFh0DINsdXVg= X-Google-Smtp-Source: ACHHUZ5BJ1XcmPcwRGaW28sw701PNy8hW2iLb+H3IlCe55TG+nDB8NHMq33eJ18BgabzQGbpkiuv8w== X-Received: by 2002:a17:902:d34b:b0:1b3:f8db:6f0e with SMTP id l11-20020a170902d34b00b001b3f8db6f0emr7602962plk.43.1687201065576; Mon, 19 Jun 2023 11:57:45 -0700 (PDT) Received: from smtpclient.apple (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id r1-20020a1709028bc100b001a1b66af22fsm190899plo.62.2023.06.19.11.57.44 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Jun 2023 11:57:44 -0700 (PDT) Content-Type: multipart/signed; boundary="Apple-Mail=_F8AA46D4-6834-4B10-A42D-A3A12094CB0C"; protocol="application/pgp-signature"; micalg=pgp-sha256 List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.3\)) Subject: Re: tpm for AMD Ryzen From: Enji Cooper In-Reply-To: Date: Mon, 19 Jun 2023 11:57:43 -0700 Cc: FreeBSD Hackers Message-Id: <83976649-D24E-475C-9BA2-9922466062A9@gmail.com> References: To: Johannes Totz X-Mailer: Apple Mail (2.3696.120.41.1.3) X-Rspamd-Queue-Id: 4QlJtM5TvTz4KbW X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N --Apple-Mail=_F8AA46D4-6834-4B10-A42D-A3A12094CB0C Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Jun 19, 2023, at 11:09 AM, Johannes Totz = wrote: >=20 > Hi everyone, >=20 > I'm trying to get the (f)TPM that comes with AMD's Zen2 to work. > BIOS config screen says it's doing CRB mode. >=20 > So I start poking in tpm_crb.c = https://github.com/freebsd/freebsd-src/blob/main/sys/dev/tpm/tpm_crb.c >=20 > Out of the box, it does not attach. The TPM2 ACPI table says its start = method is 2 (aka ACPI). That's easy to hack around, just mess with the = if-condition at = https://github.com/freebsd/freebsd-src/blob/main/sys/dev/tpm/tpm_crb.c#L11= 5 >=20 > With that adjusted, tpmcrb now probes successfully but does not = attach. >=20 > As far as I can tell the register values it tries to read from the = ACPI-provided memory window are just bogus. >=20 > That makes me suspect that the BIOS has misconfigured it. The TPM2 = table has a different address than what's reported at runtime. > The table says 0xfd210510 is the (physical) address, but acpi says = it's 0xbd13f000. >=20 > Fiddling about with hint.tpmcrb.0.maddr and friends does not yield = anything fruitful: anything I try to override with hints is just = ignored. > Hacking in a > bus_set_resource(dev, SYS_RES_MEMORY, ... 0xfd210510 ...); > ends up giving me that override but still no dice re actual tpm = functionality. >=20 > Has anyone gotten the tpm to work on (consumer) Ryzen? Hi Johannes, I just built a Ryzen machine too with an ASUS Motherboard. Could = you please post the hack that you did to the if-else statement up on = gist so I can take a look at it? Also, if you can post "boot -v=E2=80=9D and =E2=80=9Cpciconf = -lv=E2=80=9D output to separate gists, that would be super helpful :). Cheers! -Enji --Apple-Mail=_F8AA46D4-6834-4B10-A42D-A3A12094CB0C Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEtvtxN6kOllEF3nmX5JFNMZeDGN4FAmSQpScACgkQ5JFNMZeD GN5h7hAApIkaGylnZ4rfBBe7LTD6kPPAz3TENin2Sk64tfR/KQMO9i4h2LhwvS2q 4yNobuABvSrL3tLiTRd21D+n29a9eztY1tfEZSn+y1GjCmOEXKqbcilBP1jkBJk1 RLRxTKR0BLx9P3M/hqcW3uQZt8r3v9mzuM8/i/IeQ3GE+ZZ2yY7CZyt7/0QpHQpE f7F4dYyEFW87z1lIxzUEEwgHnOyheboh+WAtyrNV44sKjzyjeQblMPIftjMSRV/u 04cEd4gueP/rCXCzg4lhA2BaUbW0qAIiwm6OCuOewOUrmiFmo7WbQesXI8auuZ5g rSww6Z6epfZr/GJm+kfGz3pyiXJvHQlO7LnS6uN0Dd6CCIrO+TnKh8ZAbGhbM9Rb Mfvr1xWE/Y1O1dvoxFh988gPBczNVSqzPFeaWDYbi7NhnasrPyE1Gkwb19kIXipe /KrarykzOLClG/fQ8kMmexAnrxFq7QqSALdl+l45e+TqoDu4DeJy+HF6BXKLsYfp 0oHhssyBtFsHLF/5ZCI2K26cKdWmq6VyrlzT+VzYbFAOjQPgJwxkKPm8aCA5pm/o 09Lmwp09dK0SsdHECMe1ZnuPgV6uY0+v+UaoJGVryJO5IRCcBfJDtFsQEtRR6tYB ADfhZSlUnHsU6NQk4JJkX0yuAPPQ0/TebSAXdtDXMkuRy2p1dzc= =5Vdc -----END PGP SIGNATURE----- --Apple-Mail=_F8AA46D4-6834-4B10-A42D-A3A12094CB0C--