From nobody Wed Apr 10 05:28:58 2024 X-Original-To: dev-commits-src-all@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 4VDrwW0V8Rz5GrGc; Wed, 10 Apr 2024 05:28:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VDrwV6yn5z4csx; Wed, 10 Apr 2024 05:28:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1712726939; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3wqCPrJdTuiEb7l4ryK7QTsKPl+3KYZCxsg1sAjfa0w=; b=Vk2Ouf7ekDuK+T5ZXtIFKjgkioltPYbAb+3eBejk3sXyIFUiGwwYTgDDFBtsmX//eoKuDD QdRVFTs1GK8liWtbMiP6SFDxVx/feP1uU6R7cbRonZIS6GvoKIRChXBaJzSO1hk13DNYcO SIUeM8VXsIWguHRd77iZnpG5SvtP6IFzOilMIz9mOk6Db+Glxnao6kk6dDn/16NVez7q5m XBR7NhqSM47Dxe7LcN7GCXD6SvTyPzdViHGB7sEyZPdFQH/mCfCPR4hvAY+lY8VBYUDVmk XY9IpkqcJNSKWegFDwRf1izWrAlGHH5jhj9Airi/dAy87zyhbQSrVD0PCLZX1g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1712726939; a=rsa-sha256; cv=none; b=d8uefqn8hN6GLSPlzS6m6+aO7UpDFR2zkQU5YaHiRiNLj4oir3c7CnvnzCJhrP7xkjQHOP XXZkJh2e2hlSnu6euAWnH/CA6hdCNtIklJgEew7Be1KfnscaXsiTRWJ5HvWDou2iT61SsQ KcdY79bhJSStgmjcS3XAifQU4RM+DWvd5rgSqicNnjydKyA7NAubsZ9TTuKVMX4BK0sPEA d+esMjimj6iq4mZDq4yn25FmxPX09lW8R19RR9ss6/9q8Jr+JC7EgqzzkIUesXju/0Oo2j HP1SRKjJ2VZBoA+w6D9SAGtR0gBe7iw87lqnFDXUb+66OiAvoBuHP3RCnl7Dcw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1712726939; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3wqCPrJdTuiEb7l4ryK7QTsKPl+3KYZCxsg1sAjfa0w=; b=WS1E+IFdjxgzCw2q/0USt0yLyZvDnkKRH8eEVi+G4xKtiW6UyIiIuxhqT8xj+GzGpviyDm woo7+0zgk4c3D8koxw6yuNEfDIBvjeDQSR1K5//QCr54/jWnyISh29kXZ1uDTNaZlhCSDH vQ25IgdSGyqNmYQT4GOKeFPYvSzQTab0QQ7XQM7Sf1Ot7WiatLDNU1mg3ztohAV0VbXAR7 yVGMRn5XNN/YUyNJlXMYS/KPWX3kE3+iR7VqE5H9LDWHCMw7jAUMK8BMBgczoygzyyHypd ZBkPmY7OyxlCI8R/ZDyax7WMy6at2cxFWSxTj1mHDWV1Fd8/ddp/3/ZuUwbglA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VDrwV5g8MzQGB; Wed, 10 Apr 2024 05:28:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 43A5Sw16092201; Wed, 10 Apr 2024 05:28:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43A5SwU0092198; Wed, 10 Apr 2024 05:28:58 GMT (envelope-from git) Date: Wed, 10 Apr 2024 05:28:58 GMT Message-Id: <202404100528.43A5SwU0092198@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 33adb388c78e - main - pcireg.h: Add AMD IOMMU Base Cap definitions List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: dev-commits-src-all+owner@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 33adb388c78ee48efbdc9b497fe2224397fdee84 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=33adb388c78ee48efbdc9b497fe2224397fdee84 commit 33adb388c78ee48efbdc9b497fe2224397fdee84 Author: Konstantin Belousov AuthorDate: 2024-04-07 01:25:46 +0000 Commit: Konstantin Belousov CommitDate: 2024-04-10 05:28:24 +0000 pcireg.h: Add AMD IOMMU Base Cap definitions Reviewed by: emaste Sponsored by: Advanced Micro Devices (AMD) Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D44732 --- sys/dev/pci/pcireg.h | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/sys/dev/pci/pcireg.h b/sys/dev/pci/pcireg.h index c94decd8ef2a..623deb8b4505 100644 --- a/sys/dev/pci/pcireg.h +++ b/sys/dev/pci/pcireg.h @@ -1125,4 +1125,56 @@ #define PCIM_ACS_UNCLAIMED_REQ_REDIRECT_CTL 0x1000 #define PCIR_ACS_EGRESS_CONTROL_VECTOR 0x8 +/* + * AMD IOMMU Base Capability + * From AMD I/O Virtualization Technology (IOMMU) Specification + * Publication # 48882 Revision: 3.09-PUB Date: October 2023 + */ +#define PCIR_AMDIOMMU_CAP_HEADER 0x0000 +#define PCIR_AMDIOMMU_BASE_LOW 0x0004 +#define PCIR_AMDIOMMU_BASE_HIGH 0x0008 +#define PCIR_AMDIOMMU_RANGE 0x000c +#define PCIR_AMDIOMMU_MISC0 0x0010 +#define PCIR_AMDIOMMU_MISC1 0x0014 + +#define PCIM_AMDIOMMU_CAP_CAPEXT (1 << 28) +#define PCIM_AMDIOMMU_CAP_EFR (1 << 27) +#define PCIM_AMDIOMMU_CAP_NPCACHE (1 << 26) +#define PCIM_AMDIOMMU_CAP_HTTUN (1 << 25) +#define PCIM_AMDIOMMU_CAP_IOTLB (1 << 24) +#define PCIM_AMDIOMMU_CAP_REV_MASK (0x1f << 19) +#define PCIM_AMDIOMMU_CAP_REV_VAL (0x1 << 19) +#define PCIM_AMDIOMMU_CAP_TYPE_MASK (7 << 16) +#define PCIM_AMDIOMMU_CAP_TYPE_VAL (0x3 << 16) + +#define PCIM_AMDIOMMU_BASE_LOW_EN 0x00000001 +#define PCIM_AMDIOMMU_BASE_LOW_ADDRM 0xffffc000 + +#define PCIM_AMDIOMMU_RANGE_UNITID_MASK 0x1f +#define PCIM_AMDIOMMU_RANGE_RNGVALID (1 << 7) +#define PCIM_AMDIOMMU_RANGE_BUSNUM_MASK (0xffffu << 8) +#define PCIM_AMDIOMMU_RANGE_FIRSTDEV_MASK (0xffffu << 16) +#define PCIM_AMDIOMMU_RANGE_LASTDEV_MASK (0xffffu << 24) + +#define PCIM_AMDIOMMU_MISC0_MSINUMPPR_MASK (0x1f << 27) +#define PCIM_AMDIOMMU_MISC0_HTATSRESV (1 << 22) +#define PCIM_AMDIOMMU_MISC0_VASIZE_MASK (0x7f << 15) +#define PCIM_AMDIOMMU_MISC0_PASIZE_MASK (0x7f << 8) +#define PCIM_AMDIOMMU_MISC0_GVASIZE_MASK (0x3 << 5) +#define PCIM_AMDIOMMU_MISC0_MSINUM_MASK 0x1f + +#define PCIM_AMDIOMMU_MISC0_VASIZE_32 (0x20 << 15) +#define PCIM_AMDIOMMU_MISC0_VASIZE_40 (0x28 << 15) +#define PCIM_AMDIOMMU_MISC0_VASIZE_48 (0x30 << 15) +#define PCIM_AMDIOMMU_MISC0_VASIZE_64 (0x40 << 15) + +#define PCIM_AMDIOMMU_MISC0_PASIZE_40 (0x28 << 8) +#define PCIM_AMDIOMMU_MISC0_PASIZE_48 (0x30 << 8) +#define PCIM_AMDIOMMU_MISC0_PASIZE_52 (0x34 << 8) + +#define PCIM_AMDIOMMU_MISC0_GVASIZE_48 (0x2 << 5) +#define PCIM_AMDIOMMU_MISC0_GVASIZE_57 (0x3 << 5) + +#define PCIM_AMDIOMMU_MISC1_MSINUMGA_MASK 0x1f + #endif /* __PCI_PCIREG_H */